]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
cb40b38b73af0ce311e0d65c721a176dc15e06c2
[thirdparty/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 @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 -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 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7839 @opindex Wsuggest-attribute=
7840 @opindex Wno-suggest-attribute=
7841 Warn for cases where adding an attribute may be beneficial. The
7842 attributes currently supported are listed below.
7843
7844 @table @gcctabopt
7845 @item -Wsuggest-attribute=pure
7846 @itemx -Wsuggest-attribute=const
7847 @itemx -Wsuggest-attribute=noreturn
7848 @itemx -Wmissing-noreturn
7849 @itemx -Wsuggest-attribute=malloc
7850 @opindex Wsuggest-attribute=pure
7851 @opindex Wno-suggest-attribute=pure
7852 @opindex Wsuggest-attribute=const
7853 @opindex Wno-suggest-attribute=const
7854 @opindex Wsuggest-attribute=noreturn
7855 @opindex Wno-suggest-attribute=noreturn
7856 @opindex Wmissing-noreturn
7857 @opindex Wno-missing-noreturn
7858 @opindex Wsuggest-attribute=malloc
7859 @opindex Wno-suggest-attribute=malloc
7860
7861 Warn about functions that might be candidates for attributes
7862 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7863 only warns for functions visible in other compilation units or (in the case of
7864 @code{pure} and @code{const}) if it cannot prove that the function returns
7865 normally. A function returns normally if it doesn't contain an infinite loop or
7866 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7867 requires option @option{-fipa-pure-const}, which is enabled by default at
7868 @option{-O} and higher. Higher optimization levels improve the accuracy
7869 of the analysis.
7870
7871 @item -Wsuggest-attribute=format
7872 @itemx -Wmissing-format-attribute
7873 @opindex Wsuggest-attribute=format
7874 @opindex Wmissing-format-attribute
7875 @opindex Wno-suggest-attribute=format
7876 @opindex Wno-missing-format-attribute
7877 @opindex Wformat
7878 @opindex Wno-format
7879
7880 Warn about function pointers that might be candidates for @code{format}
7881 attributes. Note these are only possible candidates, not absolute ones.
7882 GCC guesses that function pointers with @code{format} attributes that
7883 are used in assignment, initialization, parameter passing or return
7884 statements should have a corresponding @code{format} attribute in the
7885 resulting type. I.e.@: the left-hand side of the assignment or
7886 initialization, the type of the parameter variable, or the return type
7887 of the containing function respectively should also have a @code{format}
7888 attribute to avoid the warning.
7889
7890 GCC also warns about function definitions that might be
7891 candidates for @code{format} attributes. Again, these are only
7892 possible candidates. GCC guesses that @code{format} attributes
7893 might be appropriate for any function that calls a function like
7894 @code{vprintf} or @code{vscanf}, but this might not always be the
7895 case, and some functions for which @code{format} attributes are
7896 appropriate may not be detected.
7897
7898 @item -Wsuggest-attribute=cold
7899 @opindex Wsuggest-attribute=cold
7900 @opindex Wno-suggest-attribute=cold
7901
7902 Warn about functions that might be candidates for @code{cold} attribute. This
7903 is based on static detection and generally only warns about functions which
7904 always leads to a call to another @code{cold} function such as wrappers of
7905 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7906 @end table
7907
7908 @item -Walloc-zero
7909 @opindex Wno-alloc-zero
7910 @opindex Walloc-zero
7911 Warn about calls to allocation functions decorated with attribute
7912 @code{alloc_size} that specify zero bytes, including those to the built-in
7913 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7914 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7915 when called with a zero size differs among implementations (and in the case
7916 of @code{realloc} has been deprecated) relying on it may result in subtle
7917 portability bugs and should be avoided.
7918
7919 @item -Walloc-size-larger-than=@var{byte-size}
7920 @opindex Walloc-size-larger-than=
7921 @opindex Wno-alloc-size-larger-than
7922 Warn about calls to functions decorated with attribute @code{alloc_size}
7923 that attempt to allocate objects larger than the specified number of bytes,
7924 or where the result of the size computation in an integer type with infinite
7925 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7926 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7927 Warnings controlled by the option can be disabled either by specifying
7928 @var{byte-size} of @samp{SIZE_MAX} or more or by
7929 @option{-Wno-alloc-size-larger-than}.
7930 @xref{Function Attributes}.
7931
7932 @item -Wno-alloc-size-larger-than
7933 @opindex Wno-alloc-size-larger-than
7934 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7935 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7936 larger.
7937
7938 @item -Walloca
7939 @opindex Wno-alloca
7940 @opindex Walloca
7941 This option warns on all uses of @code{alloca} in the source.
7942
7943 @item -Walloca-larger-than=@var{byte-size}
7944 @opindex Walloca-larger-than=
7945 @opindex Wno-alloca-larger-than
7946 This option warns on calls to @code{alloca} with an integer argument whose
7947 value is either zero, or that is not bounded by a controlling predicate
7948 that limits its value to at most @var{byte-size}. It also warns for calls
7949 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7950 types are considered unbounded even if they appear to be constrained to
7951 the expected range.
7952
7953 For example, a bounded case of @code{alloca} could be:
7954
7955 @smallexample
7956 void func (size_t n)
7957 @{
7958 void *p;
7959 if (n <= 1000)
7960 p = alloca (n);
7961 else
7962 p = malloc (n);
7963 f (p);
7964 @}
7965 @end smallexample
7966
7967 In the above example, passing @code{-Walloca-larger-than=1000} would not
7968 issue a warning because the call to @code{alloca} is known to be at most
7969 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7970 the compiler would emit a warning.
7971
7972 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7973 controlling predicate constraining its integer argument. For example:
7974
7975 @smallexample
7976 void func ()
7977 @{
7978 void *p = alloca (n);
7979 f (p);
7980 @}
7981 @end smallexample
7982
7983 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7984 a warning, but this time because of the lack of bounds checking.
7985
7986 Note, that even seemingly correct code involving signed integers could
7987 cause a warning:
7988
7989 @smallexample
7990 void func (signed int n)
7991 @{
7992 if (n < 500)
7993 @{
7994 p = alloca (n);
7995 f (p);
7996 @}
7997 @}
7998 @end smallexample
7999
8000 In the above example, @var{n} could be negative, causing a larger than
8001 expected argument to be implicitly cast into the @code{alloca} call.
8002
8003 This option also warns when @code{alloca} is used in a loop.
8004
8005 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8006 but is usually only effective when @option{-ftree-vrp} is active (default
8007 for @option{-O2} and above).
8008
8009 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8010
8011 @item -Wno-alloca-larger-than
8012 @opindex Wno-alloca-larger-than
8013 Disable @option{-Walloca-larger-than=} warnings. The option is
8014 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8015
8016 @item -Warith-conversion
8017 @opindex Warith-conversion
8018 @opindex Wno-arith-conversion
8019 Do warn about implicit conversions from arithmetic operations even
8020 when conversion of the operands to the same type cannot change their
8021 values. This affects warnings from @option{-Wconversion},
8022 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8023
8024 @smallexample
8025 @group
8026 void f (char c, int i)
8027 @{
8028 c = c + i; // warns with @option{-Wconversion}
8029 c = c + 1; // only warns with @option{-Warith-conversion}
8030 @}
8031 @end group
8032 @end smallexample
8033
8034 @item -Warray-bounds
8035 @itemx -Warray-bounds=@var{n}
8036 @opindex Wno-array-bounds
8037 @opindex Warray-bounds
8038 Warn about out of bounds subscripts or offsets into arrays. This warning
8039 is enabled by @option{-Wall}. It is more effective when @option{-ftree-vrp}
8040 is active (the default for @option{-O2} and above) but a subset of instances
8041 are issued even without optimization.
8042
8043 By default, the trailing array of a structure will be treated as a flexible
8044 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8045 if it is declared as either a flexible array member per C99 standard onwards
8046 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8047 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8048 zero-length arrays or one-element arrays are not warned by default.
8049
8050 You can add the option @option{-fstrict-flex-arrays} or
8051 @option{-fstrict-flex-arrays=@var{level}} to control how this
8052 option treat trailing array of a structure as a flexible array member:
8053
8054 when @var{level}<=1, no change to the default behavior.
8055
8056 when @var{level}=2, additional warnings will be issued for out of bounds
8057 subscripts or offsets into one-element arrays;
8058
8059 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8060 issued for out of bounds subscripts or offsets into zero-length arrays.
8061
8062 @table @gcctabopt
8063 @item -Warray-bounds=1
8064 This is the default warning level of @option{-Warray-bounds} and is enabled
8065 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8066
8067 @item -Warray-bounds=2
8068 This warning level also warns about the intermediate results of pointer
8069 arithmetic that may yield out of bounds values. This warning level may
8070 give a larger number of false positives and is deactivated by default.
8071 @end table
8072
8073 @item -Warray-compare
8074 @opindex Warray-compare
8075 @opindex Wno-array-compare
8076 Warn about equality and relational comparisons between two operands of array
8077 type. This comparison was deprecated in C++20. For example:
8078
8079 @smallexample
8080 int arr1[5];
8081 int arr2[5];
8082 bool same = arr1 == arr2;
8083 @end smallexample
8084
8085 @option{-Warray-compare} is enabled by @option{-Wall}.
8086
8087 @item -Warray-parameter
8088 @itemx -Warray-parameter=@var{n}
8089 @opindex Wno-array-parameter
8090 Warn about redeclarations of functions involving arguments of array or
8091 pointer types of inconsistent kinds or forms, and enable the detection
8092 of out-of-bounds accesses to such parameters by warnings such as
8093 @option{-Warray-bounds}.
8094
8095 If the first function declaration uses the array form the bound specified
8096 in the array is assumed to be the minimum number of elements expected to
8097 be provided in calls to the function and the maximum number of elements
8098 accessed by it. Failing to provide arguments of sufficient size or accessing
8099 more than the maximum number of elements may be diagnosed by warnings such
8100 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
8101 involving array parameters declared using the @code{T[static N]} form.
8102
8103 For example, the warning triggers for the following redeclarations because
8104 the first one allows an array of any size to be passed to @code{f} while
8105 the second one with the keyword @code{static} specifies that the array
8106 argument must have at least four elements.
8107
8108 @smallexample
8109 void f (int[static 4]);
8110 void f (int[]); // warning (inconsistent array form)
8111
8112 void g (void)
8113 @{
8114 int *p = (int *)malloc (4);
8115 f (p); // warning (array too small)
8116 @dots{}
8117 @}
8118 @end smallexample
8119
8120 At level 2 the warning also triggers for redeclarations involving any other
8121 inconsistency in array or pointer argument forms denoting array sizes.
8122 Pointers and arrays of unspecified bound are considered equivalent and do
8123 not trigger a warning.
8124
8125 @smallexample
8126 void g (int*);
8127 void g (int[]); // no warning
8128 void g (int[8]); // warning (inconsistent array bound)
8129 @end smallexample
8130
8131 @option{-Warray-parameter=2} is included in @option{-Wall}. The
8132 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8133 involving Variable Length Array arguments.
8134
8135 @item -Wattribute-alias=@var{n}
8136 @itemx -Wno-attribute-alias
8137 @opindex Wattribute-alias
8138 @opindex Wno-attribute-alias
8139 Warn about declarations using the @code{alias} and similar attributes whose
8140 target is incompatible with the type of the alias.
8141 @xref{Function Attributes,,Declaring Attributes of Functions}.
8142
8143 @table @gcctabopt
8144 @item -Wattribute-alias=1
8145 The default warning level of the @option{-Wattribute-alias} option diagnoses
8146 incompatibilities between the type of the alias declaration and that of its
8147 target. Such incompatibilities are typically indicative of bugs.
8148
8149 @item -Wattribute-alias=2
8150
8151 At this level @option{-Wattribute-alias} also diagnoses cases where
8152 the attributes of the alias declaration are more restrictive than the
8153 attributes applied to its target. These mismatches can potentially
8154 result in incorrect code generation. In other cases they may be
8155 benign and could be resolved simply by adding the missing attribute to
8156 the target. For comparison, see the @option{-Wmissing-attributes}
8157 option, which controls diagnostics when the alias declaration is less
8158 restrictive than the target, rather than more restrictive.
8159
8160 Attributes considered include @code{alloc_align}, @code{alloc_size},
8161 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8162 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8163 @code{returns_nonnull}, and @code{returns_twice}.
8164 @end table
8165
8166 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8167 This is the default. You can disable these warnings with either
8168 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8169
8170 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8171 @opindex Wbidi-chars=
8172 @opindex Wbidi-chars
8173 @opindex Wno-bidi-chars
8174 Warn about possibly misleading UTF-8 bidirectional control characters in
8175 comments, string literals, character constants, and identifiers. Such
8176 characters can change left-to-right writing direction into right-to-left
8177 (and vice versa), which can cause confusion between the logical order and
8178 visual order. This may be dangerous; for instance, it may seem that a piece
8179 of code is not commented out, whereas it in fact is.
8180
8181 There are three levels of warning supported by GCC@. The default is
8182 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8183 bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
8184 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8185 characters.
8186
8187 By default, this warning does not warn about UCNs. It is, however, possible
8188 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8189 @option{-Wbidi-chars=any,ucn}. Using @option{-Wbidi-chars=ucn} is valid,
8190 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8191 @option{-Wbidi-chars=any} was specified.
8192
8193 @item -Wbool-compare
8194 @opindex Wno-bool-compare
8195 @opindex Wbool-compare
8196 Warn about boolean expression compared with an integer value different from
8197 @code{true}/@code{false}. For instance, the following comparison is
8198 always false:
8199 @smallexample
8200 int n = 5;
8201 @dots{}
8202 if ((n > 1) == 2) @{ @dots{} @}
8203 @end smallexample
8204 This warning is enabled by @option{-Wall}.
8205
8206 @item -Wbool-operation
8207 @opindex Wno-bool-operation
8208 @opindex Wbool-operation
8209 Warn about suspicious operations on expressions of a boolean type. For
8210 instance, bitwise negation of a boolean is very likely a bug in the program.
8211 For C, this warning also warns about incrementing or decrementing a boolean,
8212 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
8213 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8214
8215 This warning is enabled by @option{-Wall}.
8216
8217 @item -Wduplicated-branches
8218 @opindex Wno-duplicated-branches
8219 @opindex Wduplicated-branches
8220 Warn when an if-else has identical branches. This warning detects cases like
8221 @smallexample
8222 if (p != NULL)
8223 return 0;
8224 else
8225 return 0;
8226 @end smallexample
8227 It doesn't warn when both branches contain just a null statement. This warning
8228 also warn for conditional operators:
8229 @smallexample
8230 int i = x ? *p : *p;
8231 @end smallexample
8232
8233 @item -Wduplicated-cond
8234 @opindex Wno-duplicated-cond
8235 @opindex Wduplicated-cond
8236 Warn about duplicated conditions in an if-else-if chain. For instance,
8237 warn for the following code:
8238 @smallexample
8239 if (p->q != NULL) @{ @dots{} @}
8240 else if (p->q != NULL) @{ @dots{} @}
8241 @end smallexample
8242
8243 @item -Wframe-address
8244 @opindex Wno-frame-address
8245 @opindex Wframe-address
8246 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8247 is called with an argument greater than 0. Such calls may return indeterminate
8248 values or crash the program. The warning is included in @option{-Wall}.
8249
8250 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8251 @opindex Wno-discarded-qualifiers
8252 @opindex Wdiscarded-qualifiers
8253 Do not warn if type qualifiers on pointers are being discarded.
8254 Typically, the compiler warns if a @code{const char *} variable is
8255 passed to a function that takes a @code{char *} parameter. This option
8256 can be used to suppress such a warning.
8257
8258 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8259 @opindex Wno-discarded-array-qualifiers
8260 @opindex Wdiscarded-array-qualifiers
8261 Do not warn if type qualifiers on arrays which are pointer targets
8262 are being discarded. Typically, the compiler warns if a
8263 @code{const int (*)[]} variable is passed to a function that
8264 takes a @code{int (*)[]} parameter. This option can be used to
8265 suppress such a warning.
8266
8267 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8268 @opindex Wno-incompatible-pointer-types
8269 @opindex Wincompatible-pointer-types
8270 Do not warn when there is a conversion between pointers that have incompatible
8271 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
8272 which warns for pointer argument passing or assignment with different
8273 signedness.
8274
8275 @item -Wno-int-conversion @r{(C and Objective-C only)}
8276 @opindex Wno-int-conversion
8277 @opindex Wint-conversion
8278 Do not warn about incompatible integer to pointer and pointer to integer
8279 conversions. This warning is about implicit conversions; for explicit
8280 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8281 @option{-Wno-pointer-to-int-cast} may be used.
8282
8283 @item -Wzero-length-bounds
8284 @opindex Wzero-length-bounds
8285 @opindex Wzero-length-bounds
8286 Warn about accesses to elements of zero-length array members that might
8287 overlap other members of the same object. Declaring interior zero-length
8288 arrays is discouraged because accesses to them are undefined. See
8289 @xref{Zero Length}.
8290
8291 For example, the first two stores in function @code{bad} are diagnosed
8292 because the array elements overlap the subsequent members @code{b} and
8293 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
8294 because it is beyond the bounds of the enclosing object.
8295
8296 @smallexample
8297 struct X @{ int a[0]; int b, c; @};
8298 struct X x;
8299
8300 void bad (void)
8301 @{
8302 x.a[0] = 0; // -Wzero-length-bounds
8303 x.a[1] = 1; // -Wzero-length-bounds
8304 x.a[2] = 2; // -Warray-bounds
8305 @}
8306 @end smallexample
8307
8308 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8309
8310 @item -Wno-div-by-zero
8311 @opindex Wno-div-by-zero
8312 @opindex Wdiv-by-zero
8313 Do not warn about compile-time integer division by zero. Floating-point
8314 division by zero is not warned about, as it can be a legitimate way of
8315 obtaining infinities and NaNs.
8316
8317 @item -Wsystem-headers
8318 @opindex Wsystem-headers
8319 @opindex Wno-system-headers
8320 @cindex warnings from system headers
8321 @cindex system headers, warnings from
8322 Print warning messages for constructs found in system header files.
8323 Warnings from system headers are normally suppressed, on the assumption
8324 that they usually do not indicate real problems and would only make the
8325 compiler output harder to read. Using this command-line option tells
8326 GCC to emit warnings from system headers as if they occurred in user
8327 code. However, note that using @option{-Wall} in conjunction with this
8328 option does @emph{not} warn about unknown pragmas in system
8329 headers---for that, @option{-Wunknown-pragmas} must also be used.
8330
8331 @item -Wtautological-compare
8332 @opindex Wtautological-compare
8333 @opindex Wno-tautological-compare
8334 Warn if a self-comparison always evaluates to true or false. This
8335 warning detects various mistakes such as:
8336 @smallexample
8337 int i = 1;
8338 @dots{}
8339 if (i > i) @{ @dots{} @}
8340 @end smallexample
8341
8342 This warning also warns about bitwise comparisons that always evaluate
8343 to true or false, for instance:
8344 @smallexample
8345 if ((a & 16) == 10) @{ @dots{} @}
8346 @end smallexample
8347 will always be false.
8348
8349 This warning is enabled by @option{-Wall}.
8350
8351 @item -Wtrampolines
8352 @opindex Wtrampolines
8353 @opindex Wno-trampolines
8354 Warn about trampolines generated for pointers to nested functions.
8355 A trampoline is a small piece of data or code that is created at run
8356 time on the stack when the address of a nested function is taken, and is
8357 used to call the nested function indirectly. For some targets, it is
8358 made up of data only and thus requires no special treatment. But, for
8359 most targets, it is made up of code and thus requires the stack to be
8360 made executable in order for the program to work properly.
8361
8362 @item -Wfloat-equal
8363 @opindex Wfloat-equal
8364 @opindex Wno-float-equal
8365 Warn if floating-point values are used in equality comparisons.
8366
8367 The idea behind this is that sometimes it is convenient (for the
8368 programmer) to consider floating-point values as approximations to
8369 infinitely precise real numbers. If you are doing this, then you need
8370 to compute (by analyzing the code, or in some other way) the maximum or
8371 likely maximum error that the computation introduces, and allow for it
8372 when performing comparisons (and when producing output, but that's a
8373 different problem). In particular, instead of testing for equality, you
8374 should check to see whether the two values have ranges that overlap; and
8375 this is done with the relational operators, so equality comparisons are
8376 probably mistaken.
8377
8378 @item -Wtraditional @r{(C and Objective-C only)}
8379 @opindex Wtraditional
8380 @opindex Wno-traditional
8381 Warn about certain constructs that behave differently in traditional and
8382 ISO C@. Also warn about ISO C constructs that have no traditional C
8383 equivalent, and/or problematic constructs that should be avoided.
8384
8385 @itemize @bullet
8386 @item
8387 Macro parameters that appear within string literals in the macro body.
8388 In traditional C macro replacement takes place within string literals,
8389 but in ISO C it does not.
8390
8391 @item
8392 In traditional C, some preprocessor directives did not exist.
8393 Traditional preprocessors only considered a line to be a directive
8394 if the @samp{#} appeared in column 1 on the line. Therefore
8395 @option{-Wtraditional} warns about directives that traditional C
8396 understands but ignores because the @samp{#} does not appear as the
8397 first character on the line. It also suggests you hide directives like
8398 @code{#pragma} not understood by traditional C by indenting them. Some
8399 traditional implementations do not recognize @code{#elif}, so this option
8400 suggests avoiding it altogether.
8401
8402 @item
8403 A function-like macro that appears without arguments.
8404
8405 @item
8406 The unary plus operator.
8407
8408 @item
8409 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8410 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
8411 constants.) Note, these suffixes appear in macros defined in the system
8412 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8413 Use of these macros in user code might normally lead to spurious
8414 warnings, however GCC's integrated preprocessor has enough context to
8415 avoid warning in these cases.
8416
8417 @item
8418 A function declared external in one block and then used after the end of
8419 the block.
8420
8421 @item
8422 A @code{switch} statement has an operand of type @code{long}.
8423
8424 @item
8425 A non-@code{static} function declaration follows a @code{static} one.
8426 This construct is not accepted by some traditional C compilers.
8427
8428 @item
8429 The ISO type of an integer constant has a different width or
8430 signedness from its traditional type. This warning is only issued if
8431 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
8432 typically represent bit patterns, are not warned about.
8433
8434 @item
8435 Usage of ISO string concatenation is detected.
8436
8437 @item
8438 Initialization of automatic aggregates.
8439
8440 @item
8441 Identifier conflicts with labels. Traditional C lacks a separate
8442 namespace for labels.
8443
8444 @item
8445 Initialization of unions. If the initializer is zero, the warning is
8446 omitted. This is done under the assumption that the zero initializer in
8447 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8448 initializer warnings and relies on default initialization to zero in the
8449 traditional C case.
8450
8451 @item
8452 Conversions by prototypes between fixed/floating-point values and vice
8453 versa. The absence of these prototypes when compiling with traditional
8454 C causes serious problems. This is a subset of the possible
8455 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8456
8457 @item
8458 Use of ISO C style function definitions. This warning intentionally is
8459 @emph{not} issued for prototype declarations or variadic functions
8460 because these ISO C features appear in your code when using
8461 libiberty's traditional C compatibility macros, @code{PARAMS} and
8462 @code{VPARAMS}. This warning is also bypassed for nested functions
8463 because that feature is already a GCC extension and thus not relevant to
8464 traditional C compatibility.
8465 @end itemize
8466
8467 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8468 @opindex Wtraditional-conversion
8469 @opindex Wno-traditional-conversion
8470 Warn if a prototype causes a type conversion that is different from what
8471 would happen to the same argument in the absence of a prototype. This
8472 includes conversions of fixed point to floating and vice versa, and
8473 conversions changing the width or signedness of a fixed-point argument
8474 except when the same as the default promotion.
8475
8476 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8477 @opindex Wdeclaration-after-statement
8478 @opindex Wno-declaration-after-statement
8479 Warn when a declaration is found after a statement in a block. This
8480 construct, known from C++, was introduced with ISO C99 and is by default
8481 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
8482
8483 @item -Wshadow
8484 @opindex Wshadow
8485 @opindex Wno-shadow
8486 Warn whenever a local variable or type declaration shadows another
8487 variable, parameter, type, class member (in C++), or instance variable
8488 (in Objective-C) or whenever a built-in function is shadowed. Note
8489 that in C++, the compiler warns if a local variable shadows an
8490 explicit typedef, but not if it shadows a struct/class/enum.
8491 If this warning is enabled, it includes also all instances of
8492 local shadowing. This means that @option{-Wno-shadow=local}
8493 and @option{-Wno-shadow=compatible-local} are ignored when
8494 @option{-Wshadow} is used.
8495 Same as @option{-Wshadow=global}.
8496
8497 @item -Wno-shadow-ivar @r{(Objective-C only)}
8498 @opindex Wno-shadow-ivar
8499 @opindex Wshadow-ivar
8500 Do not warn whenever a local variable shadows an instance variable in an
8501 Objective-C method.
8502
8503 @item -Wshadow=global
8504 @opindex Wshadow=global
8505 Warn for any shadowing.
8506 Same as @option{-Wshadow}.
8507
8508 @item -Wshadow=local
8509 @opindex Wshadow=local
8510 Warn when a local variable shadows another local variable or parameter.
8511
8512 @item -Wshadow=compatible-local
8513 @opindex Wshadow=compatible-local
8514 Warn when a local variable shadows another local variable or parameter
8515 whose type is compatible with that of the shadowing variable. In C++,
8516 type compatibility here means the type of the shadowing variable can be
8517 converted to that of the shadowed variable. The creation of this flag
8518 (in addition to @option{-Wshadow=local}) is based on the idea that when
8519 a local variable shadows another one of incompatible type, it is most
8520 likely intentional, not a bug or typo, as shown in the following example:
8521
8522 @smallexample
8523 @group
8524 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8525 @{
8526 for (int i = 0; i < N; ++i)
8527 @{
8528 ...
8529 @}
8530 ...
8531 @}
8532 @end group
8533 @end smallexample
8534
8535 Since the two variable @code{i} in the example above have incompatible types,
8536 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8537 Because their types are incompatible, if a programmer accidentally uses one
8538 in place of the other, type checking is expected to catch that and emit an
8539 error or warning. Use of this flag instead of @option{-Wshadow=local} can
8540 possibly reduce the number of warnings triggered by intentional shadowing.
8541 Note that this also means that shadowing @code{const char *i} by
8542 @code{char *i} does not emit a warning.
8543
8544 This warning is also enabled by @option{-Wshadow=local}.
8545
8546 @item -Wlarger-than=@var{byte-size}
8547 @opindex Wlarger-than=
8548 @opindex Wlarger-than-@var{byte-size}
8549 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8550 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8551 Warnings controlled by the option can be disabled either by specifying
8552 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8553
8554 Also warn for calls to bounded functions such as @code{memchr} or
8555 @code{strnlen} that specify a bound greater than the largest possible
8556 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
8557 can only be disabled by @option{-Wno-larger-than}.
8558
8559 @item -Wno-larger-than
8560 @opindex Wno-larger-than
8561 Disable @option{-Wlarger-than=} warnings. The option is equivalent
8562 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8563
8564 @item -Wframe-larger-than=@var{byte-size}
8565 @opindex Wframe-larger-than=
8566 @opindex Wno-frame-larger-than
8567 Warn if the size of a function frame exceeds @var{byte-size}.
8568 The computation done to determine the stack frame size is approximate
8569 and not conservative.
8570 The actual requirements may be somewhat greater than @var{byte-size}
8571 even if you do not get a warning. In addition, any space allocated
8572 via @code{alloca}, variable-length arrays, or related constructs
8573 is not included by the compiler when determining
8574 whether or not to issue a warning.
8575 @option{-Wframe-larger-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
8578 @option{-Wno-frame-larger-than}.
8579
8580 @item -Wno-frame-larger-than
8581 @opindex Wno-frame-larger-than
8582 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8583 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8584
8585 @item -Wfree-nonheap-object
8586 @opindex Wfree-nonheap-object
8587 @opindex Wno-free-nonheap-object
8588 Warn when attempting to deallocate an object that was either not allocated
8589 on the heap, or by using a pointer that was not returned from a prior call
8590 to the corresponding allocation function. For example, because the call
8591 to @code{stpcpy} returns a pointer to the terminating nul character and
8592 not to the beginning of the object, the call to @code{free} below is
8593 diagnosed.
8594
8595 @smallexample
8596 void f (char *p)
8597 @{
8598 p = stpcpy (p, "abc");
8599 // ...
8600 free (p); // warning
8601 @}
8602 @end smallexample
8603
8604 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8605
8606 @item -Wstack-usage=@var{byte-size}
8607 @opindex Wstack-usage
8608 @opindex Wno-stack-usage
8609 Warn if the stack usage of a function might exceed @var{byte-size}.
8610 The computation done to determine the stack usage is conservative.
8611 Any space allocated via @code{alloca}, variable-length arrays, or related
8612 constructs is included by the compiler when determining whether or not to
8613 issue a warning.
8614
8615 The message is in keeping with the output of @option{-fstack-usage}.
8616
8617 @itemize
8618 @item
8619 If the stack usage is fully static but exceeds the specified amount, it's:
8620
8621 @smallexample
8622 warning: stack usage is 1120 bytes
8623 @end smallexample
8624 @item
8625 If the stack usage is (partly) dynamic but bounded, it's:
8626
8627 @smallexample
8628 warning: stack usage might be 1648 bytes
8629 @end smallexample
8630 @item
8631 If the stack usage is (partly) dynamic and not bounded, it's:
8632
8633 @smallexample
8634 warning: stack usage might be unbounded
8635 @end smallexample
8636 @end itemize
8637
8638 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8639 Warnings controlled by the option can be disabled either by specifying
8640 @var{byte-size} of @samp{SIZE_MAX} or more or by
8641 @option{-Wno-stack-usage}.
8642
8643 @item -Wno-stack-usage
8644 @opindex Wno-stack-usage
8645 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8646 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8647
8648 @item -Wunsafe-loop-optimizations
8649 @opindex Wunsafe-loop-optimizations
8650 @opindex Wno-unsafe-loop-optimizations
8651 Warn if the loop cannot be optimized because the compiler cannot
8652 assume anything on the bounds of the loop indices. With
8653 @option{-funsafe-loop-optimizations} warn if the compiler makes
8654 such assumptions.
8655
8656 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8657 @opindex Wno-pedantic-ms-format
8658 @opindex Wpedantic-ms-format
8659 When used in combination with @option{-Wformat}
8660 and @option{-pedantic} without GNU extensions, this option
8661 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8662 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8663 which depend on the MS runtime.
8664
8665 @item -Wpointer-arith
8666 @opindex Wpointer-arith
8667 @opindex Wno-pointer-arith
8668 Warn about anything that depends on the ``size of'' a function type or
8669 of @code{void}. GNU C assigns these types a size of 1, for
8670 convenience in calculations with @code{void *} pointers and pointers
8671 to functions. In C++, warn also when an arithmetic operation involves
8672 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8673
8674 @item -Wno-pointer-compare
8675 @opindex Wpointer-compare
8676 @opindex Wno-pointer-compare
8677 Do not warn if a pointer is compared with a zero character constant.
8678 This usually
8679 means that the pointer was meant to be dereferenced. For example:
8680
8681 @smallexample
8682 const char *p = foo ();
8683 if (p == '\0')
8684 return 42;
8685 @end smallexample
8686
8687 Note that the code above is invalid in C++11.
8688
8689 This warning is enabled by default.
8690
8691 @item -Wtsan
8692 @opindex Wtsan
8693 @opindex Wno-tsan
8694 Warn about unsupported features in ThreadSanitizer.
8695
8696 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8697 can report false positives.
8698
8699 This warning is enabled by default.
8700
8701 @item -Wtype-limits
8702 @opindex Wtype-limits
8703 @opindex Wno-type-limits
8704 Warn if a comparison is always true or always false due to the limited
8705 range of the data type, but do not warn for constant expressions. For
8706 example, warn if an unsigned variable is compared against zero with
8707 @code{<} or @code{>=}. This warning is also enabled by
8708 @option{-Wextra}.
8709
8710 @item -Wabsolute-value @r{(C and Objective-C only)}
8711 @opindex Wabsolute-value
8712 @opindex Wno-absolute-value
8713 Warn for calls to standard functions that compute the absolute value
8714 of an argument when a more appropriate standard function is available.
8715 For example, calling @code{abs(3.14)} triggers the warning because the
8716 appropriate function to call to compute the absolute value of a double
8717 argument is @code{fabs}. The option also triggers warnings when the
8718 argument in a call to such a function has an unsigned type. This
8719 warning can be suppressed with an explicit type cast and it is also
8720 enabled by @option{-Wextra}.
8721
8722 @include cppwarnopts.texi
8723
8724 @item -Wbad-function-cast @r{(C and Objective-C only)}
8725 @opindex Wbad-function-cast
8726 @opindex Wno-bad-function-cast
8727 Warn when a function call is cast to a non-matching type.
8728 For example, warn if a call to a function returning an integer type
8729 is cast to a pointer type.
8730
8731 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8732 @opindex Wc90-c99-compat
8733 @opindex Wno-c90-c99-compat
8734 Warn about features not present in ISO C90, but present in ISO C99.
8735 For instance, warn about use of variable length arrays, @code{long long}
8736 type, @code{bool} type, compound literals, designated initializers, and so
8737 on. This option is independent of the standards mode. Warnings are disabled
8738 in the expression that follows @code{__extension__}.
8739
8740 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8741 @opindex Wc99-c11-compat
8742 @opindex Wno-c99-c11-compat
8743 Warn about features not present in ISO C99, but present in ISO C11.
8744 For instance, warn about use of anonymous structures and unions,
8745 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8746 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8747 and so on. This option is independent of the standards mode. Warnings are
8748 disabled in the expression that follows @code{__extension__}.
8749
8750 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8751 @opindex Wc11-c2x-compat
8752 @opindex Wno-c11-c2x-compat
8753 Warn about features not present in ISO C11, but present in ISO C2X.
8754 For instance, warn about omitting the string in @code{_Static_assert},
8755 use of @samp{[[]]} syntax for attributes, use of decimal
8756 floating-point types, and so on. This option is independent of the
8757 standards mode. Warnings are disabled in the expression that follows
8758 @code{__extension__}.
8759
8760 @item -Wc++-compat @r{(C and Objective-C only)}
8761 @opindex Wc++-compat
8762 @opindex Wno-c++-compat
8763 Warn about ISO C constructs that are outside of the common subset of
8764 ISO C and ISO C++, e.g.@: request for implicit conversion from
8765 @code{void *} to a pointer to non-@code{void} type.
8766
8767 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8768 @opindex Wc++11-compat
8769 @opindex Wno-c++11-compat
8770 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8771 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8772 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8773 enabled by @option{-Wall}.
8774
8775 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8776 @opindex Wc++14-compat
8777 @opindex Wno-c++14-compat
8778 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8779 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8780
8781 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8782 @opindex Wc++17-compat
8783 @opindex Wno-c++17-compat
8784 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8785 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8786
8787 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8788 @opindex Wc++20-compat
8789 @opindex Wno-c++20-compat
8790 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8791 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8792
8793 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8794 @opindex Wc++11-extensions
8795 @opindex Wno-c++11-extensions
8796 Do not warn about C++11 constructs in code being compiled using
8797 an older C++ standard. Even without this option, some C++11 constructs
8798 will only be diagnosed if @option{-Wpedantic} is used.
8799
8800 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8801 @opindex Wc++14-extensions
8802 @opindex Wno-c++14-extensions
8803 Do not warn about C++14 constructs in code being compiled using
8804 an older C++ standard. Even without this option, some C++14 constructs
8805 will only be diagnosed if @option{-Wpedantic} is used.
8806
8807 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8808 @opindex Wc++17-extensions
8809 @opindex Wno-c++17-extensions
8810 Do not warn about C++17 constructs in code being compiled using
8811 an older C++ standard. Even without this option, some C++17 constructs
8812 will only be diagnosed if @option{-Wpedantic} is used.
8813
8814 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8815 @opindex Wc++20-extensions
8816 @opindex Wno-c++20-extensions
8817 Do not warn about C++20 constructs in code being compiled using
8818 an older C++ standard. Even without this option, some C++20 constructs
8819 will only be diagnosed if @option{-Wpedantic} is used.
8820
8821 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8822 @opindex Wc++23-extensions
8823 @opindex Wno-c++23-extensions
8824 Do not warn about C++23 constructs in code being compiled using
8825 an older C++ standard. Even without this option, some C++23 constructs
8826 will only be diagnosed if @option{-Wpedantic} is used.
8827
8828 @item -Wcast-qual
8829 @opindex Wcast-qual
8830 @opindex Wno-cast-qual
8831 Warn whenever a pointer is cast so as to remove a type qualifier from
8832 the target type. For example, warn if a @code{const char *} is cast
8833 to an ordinary @code{char *}.
8834
8835 Also warn when making a cast that introduces a type qualifier in an
8836 unsafe way. For example, casting @code{char **} to @code{const char **}
8837 is unsafe, as in this example:
8838
8839 @smallexample
8840 /* p is char ** value. */
8841 const char **q = (const char **) p;
8842 /* Assignment of readonly string to const char * is OK. */
8843 *q = "string";
8844 /* Now char** pointer points to read-only memory. */
8845 **p = 'b';
8846 @end smallexample
8847
8848 @item -Wcast-align
8849 @opindex Wcast-align
8850 @opindex Wno-cast-align
8851 Warn whenever a pointer is cast such that the required alignment of the
8852 target is increased. For example, warn if a @code{char *} is cast to
8853 an @code{int *} on machines where integers can only be accessed at
8854 two- or four-byte boundaries.
8855
8856 @item -Wcast-align=strict
8857 @opindex Wcast-align=strict
8858 Warn whenever a pointer is cast such that the required alignment of the
8859 target is increased. For example, warn if a @code{char *} is cast to
8860 an @code{int *} regardless of the target machine.
8861
8862 @item -Wcast-function-type
8863 @opindex Wcast-function-type
8864 @opindex Wno-cast-function-type
8865 Warn when a function pointer is cast to an incompatible function pointer.
8866 In a cast involving function types with a variable argument list only
8867 the types of initial arguments that are provided are considered.
8868 Any parameter of pointer-type matches any other pointer-type. Any benign
8869 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8870 on ILP32 targets. Likewise type qualifiers are ignored. The function
8871 type @code{void (*) (void)} is special and matches everything, which can
8872 be used to suppress this warning.
8873 In a cast involving pointer to member types this warning warns whenever
8874 the type cast is changing the pointer to member type.
8875 This warning is enabled by @option{-Wextra}.
8876
8877 @item -Wwrite-strings
8878 @opindex Wwrite-strings
8879 @opindex Wno-write-strings
8880 When compiling C, give string constants the type @code{const
8881 char[@var{length}]} so that copying the address of one into a
8882 non-@code{const} @code{char *} pointer produces a warning. These
8883 warnings help you find at compile time code that can try to write
8884 into a string constant, but only if you have been very careful about
8885 using @code{const} in declarations and prototypes. Otherwise, it is
8886 just a nuisance. This is why we did not make @option{-Wall} request
8887 these warnings.
8888
8889 When compiling C++, warn about the deprecated conversion from string
8890 literals to @code{char *}. This warning is enabled by default for C++
8891 programs.
8892
8893 @item -Wclobbered
8894 @opindex Wclobbered
8895 @opindex Wno-clobbered
8896 Warn for variables that might be changed by @code{longjmp} or
8897 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8898
8899 @item -Wconversion
8900 @opindex Wconversion
8901 @opindex Wno-conversion
8902 Warn for implicit conversions that may alter a value. This includes
8903 conversions between real and integer, like @code{abs (x)} when
8904 @code{x} is @code{double}; conversions between signed and unsigned,
8905 like @code{unsigned ui = -1}; and conversions to smaller types, like
8906 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8907 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8908 changed by the conversion like in @code{abs (2.0)}. Warnings about
8909 conversions between signed and unsigned integers can be disabled by
8910 using @option{-Wno-sign-conversion}.
8911
8912 For C++, also warn for confusing overload resolution for user-defined
8913 conversions; and conversions that never use a type conversion
8914 operator: conversions to @code{void}, the same type, a base class or a
8915 reference to them. Warnings about conversions between signed and
8916 unsigned integers are disabled by default in C++ unless
8917 @option{-Wsign-conversion} is explicitly enabled.
8918
8919 Warnings about conversion from arithmetic on a small type back to that
8920 type are only given with @option{-Warith-conversion}.
8921
8922 @item -Wdangling-else
8923 @opindex Wdangling-else
8924 @opindex Wno-dangling-else
8925 Warn about constructions where there may be confusion to which
8926 @code{if} statement an @code{else} branch belongs. Here is an example of
8927 such a case:
8928
8929 @smallexample
8930 @group
8931 @{
8932 if (a)
8933 if (b)
8934 foo ();
8935 else
8936 bar ();
8937 @}
8938 @end group
8939 @end smallexample
8940
8941 In C/C++, every @code{else} branch belongs to the innermost possible
8942 @code{if} statement, which in this example is @code{if (b)}. This is
8943 often not what the programmer expected, as illustrated in the above
8944 example by indentation the programmer chose. When there is the
8945 potential for this confusion, GCC issues a warning when this flag
8946 is specified. To eliminate the warning, add explicit braces around
8947 the innermost @code{if} statement so there is no way the @code{else}
8948 can belong to the enclosing @code{if}. The resulting code
8949 looks like this:
8950
8951 @smallexample
8952 @group
8953 @{
8954 if (a)
8955 @{
8956 if (b)
8957 foo ();
8958 else
8959 bar ();
8960 @}
8961 @}
8962 @end group
8963 @end smallexample
8964
8965 This warning is enabled by @option{-Wparentheses}.
8966
8967 @item -Wdangling-pointer
8968 @itemx -Wdangling-pointer=@var{n}
8969 @opindex Wdangling-pointer
8970 @opindex Wno-dangling-pointer
8971 Warn about uses of pointers (or C++ references) to objects with automatic
8972 storage duration after their lifetime has ended. This includes local
8973 variables declared in nested blocks, compound literals and other unnamed
8974 temporary objects. In addition, warn about storing the address of such
8975 objects in escaped pointers. The warning is enabled at all optimization
8976 levels but may yield different results with optimization than without.
8977
8978 @table @gcctabopt
8979 @item -Wdangling-pointer=1
8980 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
8981 For example
8982 @smallexample
8983 int f (int c1, int c2, x)
8984 @{
8985 char *p = strchr ((char[])@{ c1, c2 @}, c3);
8986 return p ? *p : 'x'; // warning: dangling pointer to a compound literal
8987 @}
8988 @end smallexample
8989 In the following function the store of the address of the local variable
8990 @code{x} in the escaped pointer @code{*p} also triggers the warning.
8991 @smallexample
8992 void g (int **p)
8993 @{
8994 int x = 7;
8995 *p = &x; // warning: storing the address of a local variable in *p
8996 @}
8997 @end smallexample
8998
8999 @item -Wdangling-pointer=2
9000 At level 2, in addition to unconditional uses the warning also diagnoses
9001 conditional uses of dangling pointers.
9002
9003 For example, because the array @var{a} in the following function is out of
9004 scope when the pointer @var{s} that was set to point is used, the warning
9005 triggers at this level.
9006
9007 @smallexample
9008 void f (char *s)
9009 @{
9010 if (!s)
9011 @{
9012 char a[12] = "tmpname";
9013 s = a;
9014 @}
9015 strcat (s, ".tmp"); // warning: dangling pointer to a may be used
9016 ...
9017 @}
9018 @end smallexample
9019 @end table
9020
9021 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9022
9023 @item -Wdate-time
9024 @opindex Wdate-time
9025 @opindex Wno-date-time
9026 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9027 are encountered as they might prevent bit-wise-identical reproducible
9028 compilations.
9029
9030 @item -Wempty-body
9031 @opindex Wempty-body
9032 @opindex Wno-empty-body
9033 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9034 while} statement. This warning is also enabled by @option{-Wextra}.
9035
9036 @item -Wno-endif-labels
9037 @opindex Wendif-labels
9038 @opindex Wno-endif-labels
9039 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9040
9041 @item -Wenum-compare
9042 @opindex Wenum-compare
9043 @opindex Wno-enum-compare
9044 Warn about a comparison between values of different enumerated types.
9045 In C++ enumerated type mismatches in conditional expressions are also
9046 diagnosed and the warning is enabled by default. In C this warning is
9047 enabled by @option{-Wall}.
9048
9049 @item -Wenum-conversion
9050 @opindex Wenum-conversion
9051 @opindex Wno-enum-conversion
9052 Warn when a value of enumerated type is implicitly converted to a
9053 different enumerated type. This warning is enabled by @option{-Wextra}
9054 in C@.
9055
9056 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9057 @opindex Wenum-int-mismatch
9058 @opindex Wno-enum-int-mismatch
9059 Warn about mismatches between an enumerated type and an integer type in
9060 declarations. For example:
9061
9062 @smallexample
9063 enum E @{ l = -1, z = 0, g = 1 @};
9064 int foo(void);
9065 enum E foo(void);
9066 @end smallexample
9067
9068 In C, an enumerated type is compatible with @code{char}, a signed
9069 integer type, or an unsigned integer type. However, since the choice
9070 of the underlying type of an enumerated type is implementation-defined,
9071 such mismatches may cause portability issues. In C++, such mismatches
9072 are an error. In C, this warning is enabled by @option{-Wall} and
9073 @option{-Wc++-compat}.
9074
9075 @item -Wjump-misses-init @r{(C, Objective-C only)}
9076 @opindex Wjump-misses-init
9077 @opindex Wno-jump-misses-init
9078 Warn if a @code{goto} statement or a @code{switch} statement jumps
9079 forward across the initialization of a variable, or jumps backward to a
9080 label after the variable has been initialized. This only warns about
9081 variables that are initialized when they are declared. This warning is
9082 only supported for C and Objective-C; in C++ this sort of branch is an
9083 error in any case.
9084
9085 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
9086 can be disabled with the @option{-Wno-jump-misses-init} option.
9087
9088 @item -Wsign-compare
9089 @opindex Wsign-compare
9090 @opindex Wno-sign-compare
9091 @cindex warning for comparison of signed and unsigned values
9092 @cindex comparison of signed and unsigned values, warning
9093 @cindex signed and unsigned values, comparison warning
9094 Warn when a comparison between signed and unsigned values could produce
9095 an incorrect result when the signed value is converted to unsigned.
9096 In C++, this warning is also enabled by @option{-Wall}. In C, it is
9097 also enabled by @option{-Wextra}.
9098
9099 @item -Wsign-conversion
9100 @opindex Wsign-conversion
9101 @opindex Wno-sign-conversion
9102 Warn for implicit conversions that may change the sign of an integer
9103 value, like assigning a signed integer expression to an unsigned
9104 integer variable. An explicit cast silences the warning. In C, this
9105 option is enabled also by @option{-Wconversion}.
9106
9107 @item -Wfloat-conversion
9108 @opindex Wfloat-conversion
9109 @opindex Wno-float-conversion
9110 Warn for implicit conversions that reduce the precision of a real value.
9111 This includes conversions from real to integer, and from higher precision
9112 real to lower precision real values. This option is also enabled by
9113 @option{-Wconversion}.
9114
9115 @item -Wno-scalar-storage-order
9116 @opindex Wno-scalar-storage-order
9117 @opindex Wscalar-storage-order
9118 Do not warn on suspicious constructs involving reverse scalar storage order.
9119
9120 @item -Wsizeof-array-div
9121 @opindex Wsizeof-array-div
9122 @opindex Wno-sizeof-array-div
9123 Warn about divisions of two sizeof operators when the first one is applied
9124 to an array and the divisor does not equal the size of the array element.
9125 In such a case, the computation will not yield the number of elements in the
9126 array, which is likely what the user intended. This warning warns e.g. about
9127 @smallexample
9128 int fn ()
9129 @{
9130 int arr[10];
9131 return sizeof (arr) / sizeof (short);
9132 @}
9133 @end smallexample
9134
9135 This warning is enabled by @option{-Wall}.
9136
9137 @item -Wsizeof-pointer-div
9138 @opindex Wsizeof-pointer-div
9139 @opindex Wno-sizeof-pointer-div
9140 Warn for suspicious divisions of two sizeof expressions that divide
9141 the pointer size by the element size, which is the usual way to compute
9142 the array size but won't work out correctly with pointers. This warning
9143 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9144 not an array, but a pointer. This warning is enabled by @option{-Wall}.
9145
9146 @item -Wsizeof-pointer-memaccess
9147 @opindex Wsizeof-pointer-memaccess
9148 @opindex Wno-sizeof-pointer-memaccess
9149 Warn for suspicious length parameters to certain string and memory built-in
9150 functions if the argument uses @code{sizeof}. This warning triggers for
9151 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9152 an array, but a pointer, and suggests a possible fix, or about
9153 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
9154 also warns about calls to bounded string copy functions like @code{strncat}
9155 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9156 the source array. For example, in the following function the call to
9157 @code{strncat} specifies the size of the source string as the bound. That
9158 is almost certainly a mistake and so the call is diagnosed.
9159 @smallexample
9160 void make_file (const char *name)
9161 @{
9162 char path[PATH_MAX];
9163 strncpy (path, name, sizeof path - 1);
9164 strncat (path, ".text", sizeof ".text");
9165 @dots{}
9166 @}
9167 @end smallexample
9168
9169 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9170
9171 @item -Wno-sizeof-array-argument
9172 @opindex Wsizeof-array-argument
9173 @opindex Wno-sizeof-array-argument
9174 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9175 declared as an array in a function definition. This warning is enabled by
9176 default for C and C++ programs.
9177
9178 @item -Wmemset-elt-size
9179 @opindex Wmemset-elt-size
9180 @opindex Wno-memset-elt-size
9181 Warn for suspicious calls to the @code{memset} built-in function, if the
9182 first argument references an array, and the third argument is a number
9183 equal to the number of elements, but not equal to the size of the array
9184 in memory. This indicates that the user has omitted a multiplication by
9185 the element size. This warning is enabled by @option{-Wall}.
9186
9187 @item -Wmemset-transposed-args
9188 @opindex Wmemset-transposed-args
9189 @opindex Wno-memset-transposed-args
9190 Warn for suspicious calls to the @code{memset} built-in function where
9191 the second argument is not zero and the third argument is zero. For
9192 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9193 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
9194 is only emitted if the third argument is a literal zero. Otherwise, if
9195 it is an expression that is folded to zero, or a cast of zero to some
9196 type, it is far less likely that the arguments have been mistakenly
9197 transposed and no warning is emitted. This warning is enabled
9198 by @option{-Wall}.
9199
9200 @item -Waddress
9201 @opindex Waddress
9202 @opindex Wno-address
9203 Warn about suspicious uses of address expressions. These include comparing
9204 the address of a function or a declared object to the null pointer constant
9205 such as in
9206 @smallexample
9207 void f (void);
9208 void g (void)
9209 @{
9210 if (!f) // warning: expression evaluates to false
9211 abort ();
9212 @}
9213 @end smallexample
9214 comparisons of a pointer to a string literal, such as in
9215 @smallexample
9216 void f (const char *x)
9217 @{
9218 if (x == "abc") // warning: expression evaluates to false
9219 puts ("equal");
9220 @}
9221 @end smallexample
9222 and tests of the results of pointer addition or subtraction for equality
9223 to null, such as in
9224 @smallexample
9225 void f (const int *p, int i)
9226 @{
9227 return p + i == NULL;
9228 @}
9229 @end smallexample
9230 Such uses typically indicate a programmer error: the address of most
9231 functions and objects necessarily evaluates to true (the exception are
9232 weak symbols), so their use in a conditional might indicate missing
9233 parentheses in a function call or a missing dereference in an array
9234 expression. The subset of the warning for object pointers can be
9235 suppressed by casting the pointer operand to an integer type such
9236 as @code{intptr_t} or @code{uintptr_t}.
9237 Comparisons against string literals result in unspecified behavior
9238 and are not portable, and suggest the intent was to call @code{strcmp}.
9239 The warning is suppressed if the suspicious expression is the result
9240 of macro expansion.
9241 @option{-Waddress} warning is enabled by @option{-Wall}.
9242
9243 @item -Wno-address-of-packed-member
9244 @opindex Waddress-of-packed-member
9245 @opindex Wno-address-of-packed-member
9246 Do not warn when the address of packed member of struct or union is taken,
9247 which usually results in an unaligned pointer value. This is
9248 enabled by default.
9249
9250 @item -Wlogical-op
9251 @opindex Wlogical-op
9252 @opindex Wno-logical-op
9253 Warn about suspicious uses of logical operators in expressions.
9254 This includes using logical operators in contexts where a
9255 bit-wise operator is likely to be expected. Also warns when
9256 the operands of a logical operator are the same:
9257 @smallexample
9258 extern int a;
9259 if (a < 0 && a < 0) @{ @dots{} @}
9260 @end smallexample
9261
9262 @item -Wlogical-not-parentheses
9263 @opindex Wlogical-not-parentheses
9264 @opindex Wno-logical-not-parentheses
9265 Warn about logical not used on the left hand side operand of a comparison.
9266 This option does not warn if the right operand is considered to be a boolean
9267 expression. Its purpose is to detect suspicious code like the following:
9268 @smallexample
9269 int a;
9270 @dots{}
9271 if (!a > 1) @{ @dots{} @}
9272 @end smallexample
9273
9274 It is possible to suppress the warning by wrapping the LHS into
9275 parentheses:
9276 @smallexample
9277 if ((!a) > 1) @{ @dots{} @}
9278 @end smallexample
9279
9280 This warning is enabled by @option{-Wall}.
9281
9282 @item -Waggregate-return
9283 @opindex Waggregate-return
9284 @opindex Wno-aggregate-return
9285 Warn if any functions that return structures or unions are defined or
9286 called. (In languages where you can return an array, this also elicits
9287 a warning.)
9288
9289 @item -Wno-aggressive-loop-optimizations
9290 @opindex Wno-aggressive-loop-optimizations
9291 @opindex Waggressive-loop-optimizations
9292 Warn if in a loop with constant number of iterations the compiler detects
9293 undefined behavior in some statement during one or more of the iterations.
9294
9295 @item -Wno-attributes
9296 @opindex Wno-attributes
9297 @opindex Wattributes
9298 Do not warn if an unexpected @code{__attribute__} is used, such as
9299 unrecognized attributes, function attributes applied to variables,
9300 etc. This does not stop errors for incorrect use of supported
9301 attributes.
9302
9303 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9304 warnings about unknown scoped attributes (in C++11 and C2X). For example,
9305 @option{-Wno-attributes=vendor::attr} disables warning about the following
9306 declaration:
9307
9308 @smallexample
9309 [[vendor::attr]] void f();
9310 @end smallexample
9311
9312 It is also possible to disable warning about all attributes in a namespace
9313 using @option{-Wno-attributes=vendor::} which prevents warning about both
9314 of these declarations:
9315
9316 @smallexample
9317 [[vendor::safe]] void f();
9318 [[vendor::unsafe]] void f2();
9319 @end smallexample
9320
9321 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9322
9323 @item -Wno-builtin-declaration-mismatch
9324 @opindex Wno-builtin-declaration-mismatch
9325 @opindex Wbuiltin-declaration-mismatch
9326 Warn if a built-in function is declared with an incompatible signature
9327 or as a non-function, or when a built-in function declared with a type
9328 that does not include a prototype is called with arguments whose promoted
9329 types do not match those expected by the function. When @option{-Wextra}
9330 is specified, also warn when a built-in function that takes arguments is
9331 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
9332 warning is enabled by default. To avoid the warning include the appropriate
9333 header to bring the prototypes of built-in functions into scope.
9334
9335 For example, the call to @code{memset} below is diagnosed by the warning
9336 because the function expects a value of type @code{size_t} as its argument
9337 but the type of @code{32} is @code{int}. With @option{-Wextra},
9338 the declaration of the function is diagnosed as well.
9339 @smallexample
9340 extern void* memset ();
9341 void f (void *d)
9342 @{
9343 memset (d, '\0', 32);
9344 @}
9345 @end smallexample
9346
9347 @item -Wno-builtin-macro-redefined
9348 @opindex Wno-builtin-macro-redefined
9349 @opindex Wbuiltin-macro-redefined
9350 Do not warn if certain built-in macros are redefined. This suppresses
9351 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9352 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9353
9354 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9355 @opindex Wstrict-prototypes
9356 @opindex Wno-strict-prototypes
9357 Warn if a function is declared or defined without specifying the
9358 argument types. (An old-style function definition is permitted without
9359 a warning if preceded by a declaration that specifies the argument
9360 types.)
9361
9362 @item -Wold-style-declaration @r{(C and Objective-C only)}
9363 @opindex Wold-style-declaration
9364 @opindex Wno-old-style-declaration
9365 Warn for obsolescent usages, according to the C Standard, in a
9366 declaration. For example, warn if storage-class specifiers like
9367 @code{static} are not the first things in a declaration. This warning
9368 is also enabled by @option{-Wextra}.
9369
9370 @item -Wold-style-definition @r{(C and Objective-C only)}
9371 @opindex Wold-style-definition
9372 @opindex Wno-old-style-definition
9373 Warn if an old-style function definition is used. A warning is given
9374 even if there is a previous prototype. A definition using @samp{()}
9375 is not considered an old-style definition in C2X mode, because it is
9376 equivalent to @samp{(void)} in that case, but is considered an
9377 old-style definition for older standards.
9378
9379 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9380 @opindex Wmissing-parameter-type
9381 @opindex Wno-missing-parameter-type
9382 A function parameter is declared without a type specifier in K&R-style
9383 functions:
9384
9385 @smallexample
9386 void foo(bar) @{ @}
9387 @end smallexample
9388
9389 This warning is also enabled by @option{-Wextra}.
9390
9391 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9392 @opindex Wmissing-prototypes
9393 @opindex Wno-missing-prototypes
9394 Warn if a global function is defined without a previous prototype
9395 declaration. This warning is issued even if the definition itself
9396 provides a prototype. Use this option to detect global functions
9397 that do not have a matching prototype declaration in a header file.
9398 This option is not valid for C++ because all function declarations
9399 provide prototypes and a non-matching declaration declares an
9400 overload rather than conflict with an earlier declaration.
9401 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9402
9403 @item -Wmissing-declarations
9404 @opindex Wmissing-declarations
9405 @opindex Wno-missing-declarations
9406 Warn if a global function is defined without a previous declaration.
9407 Do so even if the definition itself provides a prototype.
9408 Use this option to detect global functions that are not declared in
9409 header files. In C, no warnings are issued for functions with previous
9410 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9411 missing prototypes. In C++, no warnings are issued for function templates,
9412 or for inline functions, or for functions in anonymous namespaces.
9413
9414 @item -Wmissing-field-initializers
9415 @opindex Wmissing-field-initializers
9416 @opindex Wno-missing-field-initializers
9417 @opindex W
9418 @opindex Wextra
9419 @opindex Wno-extra
9420 Warn if a structure's initializer has some fields missing. For
9421 example, the following code causes such a warning, because
9422 @code{x.h} is implicitly zero:
9423
9424 @smallexample
9425 struct s @{ int f, g, h; @};
9426 struct s x = @{ 3, 4 @};
9427 @end smallexample
9428
9429 This option does not warn about designated initializers, so the following
9430 modification does not trigger a warning:
9431
9432 @smallexample
9433 struct s @{ int f, g, h; @};
9434 struct s x = @{ .f = 3, .g = 4 @};
9435 @end smallexample
9436
9437 In C this option does not warn about the universal zero initializer
9438 @samp{@{ 0 @}}:
9439
9440 @smallexample
9441 struct s @{ int f, g, h; @};
9442 struct s x = @{ 0 @};
9443 @end smallexample
9444
9445 Likewise, in C++ this option does not warn about the empty @{ @}
9446 initializer, for example:
9447
9448 @smallexample
9449 struct s @{ int f, g, h; @};
9450 s x = @{ @};
9451 @end smallexample
9452
9453 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
9454 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9455
9456 @item -Wno-missing-requires
9457 @opindex Wmissing-requires
9458 @opindex Wno-missing-requires
9459
9460 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9461
9462 @smallexample
9463 bool satisfied = requires @{ C<T> @};
9464 @end smallexample
9465
9466 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9467 expression, which it is for all T. Presumably the user meant to write
9468
9469 @smallexample
9470 bool satisfied = requires @{ requires C<T> @};
9471 @end smallexample
9472
9473 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9474 type @samp{T}.
9475
9476 This warning can be disabled with @option{-Wno-missing-requires}.
9477
9478 @item -Wno-missing-template-keyword
9479 @opindex Wmissing-template-keyword
9480 @opindex Wno-missing-template-keyword
9481
9482 The member access tokens ., -> and :: must be followed by the @code{template}
9483 keyword if the parent object is dependent and the member being named is a
9484 template.
9485
9486 @smallexample
9487 template <class X>
9488 void DoStuff (X x)
9489 @{
9490 x.template DoSomeOtherStuff<X>(); // Good.
9491 x.DoMoreStuff<X>(); // Warning, x is dependent.
9492 @}
9493 @end smallexample
9494
9495 In rare cases it is possible to get false positives. To silence this, wrap
9496 the expression in parentheses. For example, the following is treated as a
9497 template, even where m and N are integers:
9498
9499 @smallexample
9500 void NotATemplate (my_class t)
9501 @{
9502 int N = 5;
9503
9504 bool test = t.m < N > (0); // Treated as a template.
9505 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9506 @}
9507 @end smallexample
9508
9509 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9510
9511 @item -Wno-multichar
9512 @opindex Wno-multichar
9513 @opindex Wmultichar
9514 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9515 Usually they indicate a typo in the user's code, as they have
9516 implementation-defined values, and should not be used in portable code.
9517
9518 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9519 @opindex Wnormalized=
9520 @opindex Wnormalized
9521 @opindex Wno-normalized
9522 @cindex NFC
9523 @cindex NFKC
9524 @cindex character set, input normalization
9525 In ISO C and ISO C++, two identifiers are different if they are
9526 different sequences of characters. However, sometimes when characters
9527 outside the basic ASCII character set are used, you can have two
9528 different character sequences that look the same. To avoid confusion,
9529 the ISO 10646 standard sets out some @dfn{normalization rules} which
9530 when applied ensure that two sequences that look the same are turned into
9531 the same sequence. GCC can warn you if you are using identifiers that
9532 have not been normalized; this option controls that warning.
9533
9534 There are four levels of warning supported by GCC@. The default is
9535 @option{-Wnormalized=nfc}, which warns about any identifier that is
9536 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
9537 recommended form for most uses. It is equivalent to
9538 @option{-Wnormalized}.
9539
9540 Unfortunately, there are some characters allowed in identifiers by
9541 ISO C and ISO C++ that, when turned into NFC, are not allowed in
9542 identifiers. That is, there's no way to use these symbols in portable
9543 ISO C or C++ and have all your identifiers in NFC@.
9544 @option{-Wnormalized=id} suppresses the warning for these characters.
9545 It is hoped that future versions of the standards involved will correct
9546 this, which is why this option is not the default.
9547
9548 You can switch the warning off for all characters by writing
9549 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
9550 only do this if you are using some other normalization scheme (like
9551 ``D''), because otherwise you can easily create bugs that are
9552 literally impossible to see.
9553
9554 Some characters in ISO 10646 have distinct meanings but look identical
9555 in some fonts or display methodologies, especially once formatting has
9556 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9557 LETTER N'', displays just like a regular @code{n} that has been
9558 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
9559 normalization scheme to convert all these into a standard form as
9560 well, and GCC warns if your code is not in NFKC if you use
9561 @option{-Wnormalized=nfkc}. This warning is comparable to warning
9562 about every identifier that contains the letter O because it might be
9563 confused with the digit 0, and so is not the default, but may be
9564 useful as a local coding convention if the programming environment
9565 cannot be fixed to display these characters distinctly.
9566
9567 @item -Wno-attribute-warning
9568 @opindex Wno-attribute-warning
9569 @opindex Wattribute-warning
9570 Do not warn about usage of functions (@pxref{Function Attributes})
9571 declared with @code{warning} attribute. By default, this warning is
9572 enabled. @option{-Wno-attribute-warning} can be used to disable the
9573 warning or @option{-Wno-error=attribute-warning} can be used to
9574 disable the error when compiled with @option{-Werror} flag.
9575
9576 @item -Wno-deprecated
9577 @opindex Wno-deprecated
9578 @opindex Wdeprecated
9579 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
9580
9581 @item -Wno-deprecated-declarations
9582 @opindex Wno-deprecated-declarations
9583 @opindex Wdeprecated-declarations
9584 Do not warn about uses of functions (@pxref{Function Attributes}),
9585 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9586 Attributes}) marked as deprecated by using the @code{deprecated}
9587 attribute.
9588
9589 @item -Wno-overflow
9590 @opindex Wno-overflow
9591 @opindex Woverflow
9592 Do not warn about compile-time overflow in constant expressions.
9593
9594 @item -Wno-odr
9595 @opindex Wno-odr
9596 @opindex Wodr
9597 Warn about One Definition Rule violations during link-time optimization.
9598 Enabled by default.
9599
9600 @item -Wopenacc-parallelism
9601 @opindex Wopenacc-parallelism
9602 @opindex Wno-openacc-parallelism
9603 @cindex OpenACC accelerator programming
9604 Warn about potentially suboptimal choices related to OpenACC parallelism.
9605
9606 @item -Wopenmp-simd
9607 @opindex Wopenmp-simd
9608 @opindex Wno-openmp-simd
9609 Warn if the vectorizer cost model overrides the OpenMP
9610 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
9611 option can be used to relax the cost model.
9612
9613 @item -Woverride-init @r{(C and Objective-C only)}
9614 @opindex Woverride-init
9615 @opindex Wno-override-init
9616 @opindex W
9617 @opindex Wextra
9618 @opindex Wno-extra
9619 Warn if an initialized field without side effects is overridden when
9620 using designated initializers (@pxref{Designated Inits, , Designated
9621 Initializers}).
9622
9623 This warning is included in @option{-Wextra}. To get other
9624 @option{-Wextra} warnings without this one, use @option{-Wextra
9625 -Wno-override-init}.
9626
9627 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9628 @opindex Woverride-init-side-effects
9629 @opindex Wno-override-init-side-effects
9630 Do not warn if an initialized field with side effects is overridden when
9631 using designated initializers (@pxref{Designated Inits, , Designated
9632 Initializers}). This warning is enabled by default.
9633
9634 @item -Wpacked
9635 @opindex Wpacked
9636 @opindex Wno-packed
9637 Warn if a structure is given the packed attribute, but the packed
9638 attribute has no effect on the layout or size of the structure.
9639 Such structures may be mis-aligned for little benefit. For
9640 instance, in this code, the variable @code{f.x} in @code{struct bar}
9641 is misaligned even though @code{struct bar} does not itself
9642 have the packed attribute:
9643
9644 @smallexample
9645 @group
9646 struct foo @{
9647 int x;
9648 char a, b, c, d;
9649 @} __attribute__((packed));
9650 struct bar @{
9651 char z;
9652 struct foo f;
9653 @};
9654 @end group
9655 @end smallexample
9656
9657 @item -Wnopacked-bitfield-compat
9658 @opindex Wpacked-bitfield-compat
9659 @opindex Wno-packed-bitfield-compat
9660 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9661 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
9662 the change can lead to differences in the structure layout. GCC
9663 informs you when the offset of such a field has changed in GCC 4.4.
9664 For example there is no longer a 4-bit padding between field @code{a}
9665 and @code{b} in this structure:
9666
9667 @smallexample
9668 struct foo
9669 @{
9670 char a:4;
9671 char b:8;
9672 @} __attribute__ ((packed));
9673 @end smallexample
9674
9675 This warning is enabled by default. Use
9676 @option{-Wno-packed-bitfield-compat} to disable this warning.
9677
9678 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9679 @opindex Wpacked-not-aligned
9680 @opindex Wno-packed-not-aligned
9681 Warn if a structure field with explicitly specified alignment in a
9682 packed struct or union is misaligned. For example, a warning will
9683 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9684 'struct S' is less than 8}, in this code:
9685
9686 @smallexample
9687 @group
9688 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9689 struct __attribute__ ((packed)) S @{
9690 struct S8 s8;
9691 @};
9692 @end group
9693 @end smallexample
9694
9695 This warning is enabled by @option{-Wall}.
9696
9697 @item -Wpadded
9698 @opindex Wpadded
9699 @opindex Wno-padded
9700 Warn if padding is included in a structure, either to align an element
9701 of the structure or to align the whole structure. Sometimes when this
9702 happens it is possible to rearrange the fields of the structure to
9703 reduce the padding and so make the structure smaller.
9704
9705 @item -Wredundant-decls
9706 @opindex Wredundant-decls
9707 @opindex Wno-redundant-decls
9708 Warn if anything is declared more than once in the same scope, even in
9709 cases where multiple declaration is valid and changes nothing.
9710
9711 @item -Wrestrict
9712 @opindex Wrestrict
9713 @opindex Wno-restrict
9714 Warn when an object referenced by a @code{restrict}-qualified parameter
9715 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9716 argument, or when copies between such objects overlap. For example,
9717 the call to the @code{strcpy} function below attempts to truncate the string
9718 by replacing its initial characters with the last four. However, because
9719 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9720 the call is diagnosed.
9721
9722 @smallexample
9723 void foo (void)
9724 @{
9725 char a[] = "abcd1234";
9726 strcpy (a, a + 4);
9727 @dots{}
9728 @}
9729 @end smallexample
9730 The @option{-Wrestrict} option detects some instances of simple overlap
9731 even without optimization but works best at @option{-O2} and above. It
9732 is included in @option{-Wall}.
9733
9734 @item -Wnested-externs @r{(C and Objective-C only)}
9735 @opindex Wnested-externs
9736 @opindex Wno-nested-externs
9737 Warn if an @code{extern} declaration is encountered within a function.
9738
9739 @item -Winline
9740 @opindex Winline
9741 @opindex Wno-inline
9742 Warn if a function that is declared as inline cannot be inlined.
9743 Even with this option, the compiler does not warn about failures to
9744 inline functions declared in system headers.
9745
9746 The compiler uses a variety of heuristics to determine whether or not
9747 to inline a function. For example, the compiler takes into account
9748 the size of the function being inlined and the amount of inlining
9749 that has already been done in the current function. Therefore,
9750 seemingly insignificant changes in the source program can cause the
9751 warnings produced by @option{-Winline} to appear or disappear.
9752
9753 @item -Winterference-size
9754 @opindex Winterference-size
9755 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9756 without specifying its value with @option{--param destructive-interference-size}.
9757 Also warn about questionable values for that option.
9758
9759 This variable is intended to be used for controlling class layout, to
9760 avoid false sharing in concurrent code:
9761
9762 @smallexample
9763 struct independent_fields @{
9764 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9765 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9766 @};
9767 @end smallexample
9768
9769 Here @samp{one} and @samp{two} are intended to be far enough apart
9770 that stores to one won't require accesses to the other to reload the
9771 cache line.
9772
9773 By default, @option{--param destructive-interference-size} and
9774 @option{--param constructive-interference-size} are set based on the
9775 current @option{-mtune} option, typically to the L1 cache line size
9776 for the particular target CPU, sometimes to a range if tuning for a
9777 generic target. So all translation units that depend on ABI
9778 compatibility for the use of these variables must be compiled with
9779 the same @option{-mtune} (or @option{-mcpu}).
9780
9781 If ABI stability is important, such as if the use is in a header for a
9782 library, you should probably not use the hardware interference size
9783 variables at all. Alternatively, you can force a particular value
9784 with @option{--param}.
9785
9786 If you are confident that your use of the variable does not affect ABI
9787 outside a single build of your project, you can turn off the warning
9788 with @option{-Wno-interference-size}.
9789
9790 @item -Wint-in-bool-context
9791 @opindex Wint-in-bool-context
9792 @opindex Wno-int-in-bool-context
9793 Warn for suspicious use of integer values where boolean values are expected,
9794 such as conditional expressions (?:) using non-boolean integer constants in
9795 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9796 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9797 for all kinds of multiplications regardless of the data type.
9798 This warning is enabled by @option{-Wall}.
9799
9800 @item -Wno-int-to-pointer-cast
9801 @opindex Wno-int-to-pointer-cast
9802 @opindex Wint-to-pointer-cast
9803 Suppress warnings from casts to pointer type of an integer of a
9804 different size. In C++, casting to a pointer type of smaller size is
9805 an error. @option{Wint-to-pointer-cast} is enabled by default.
9806
9807
9808 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9809 @opindex Wno-pointer-to-int-cast
9810 @opindex Wpointer-to-int-cast
9811 Suppress warnings from casts from a pointer to an integer type of a
9812 different size.
9813
9814 @item -Winvalid-pch
9815 @opindex Winvalid-pch
9816 @opindex Wno-invalid-pch
9817 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9818 the search path but cannot be used.
9819
9820 @item -Winvalid-utf8
9821 @opindex Winvalid-utf8
9822 @opindex Wno-invalid-utf8
9823 Warn if an invalid UTF-8 character is found.
9824 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
9825 is used and turned into error with @option{-pedantic-errors}.
9826
9827 @item -Wno-unicode
9828 @opindex Wunicode
9829 @opindex Wno-unicode
9830 Don't diagnose invalid forms of delimited or named escape sequences which are
9831 treated as separate tokens. @option{Wunicode} is enabled by default.
9832
9833 @item -Wlong-long
9834 @opindex Wlong-long
9835 @opindex Wno-long-long
9836 Warn if @code{long long} type is used. This is enabled by either
9837 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9838 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9839
9840 @item -Wvariadic-macros
9841 @opindex Wvariadic-macros
9842 @opindex Wno-variadic-macros
9843 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9844 alternate syntax is used in ISO C99 mode. This is enabled by either
9845 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9846 messages, use @option{-Wno-variadic-macros}.
9847
9848 @item -Wno-varargs
9849 @opindex Wvarargs
9850 @opindex Wno-varargs
9851 Do not warn upon questionable usage of the macros used to handle variable
9852 arguments like @code{va_start}. These warnings are enabled by default.
9853
9854 @item -Wvector-operation-performance
9855 @opindex Wvector-operation-performance
9856 @opindex Wno-vector-operation-performance
9857 Warn if vector operation is not implemented via SIMD capabilities of the
9858 architecture. Mainly useful for the performance tuning.
9859 Vector operation can be implemented @code{piecewise}, which means that the
9860 scalar operation is performed on every vector element;
9861 @code{in parallel}, which means that the vector operation is implemented
9862 using scalars of wider type, which normally is more performance efficient;
9863 and @code{as a single scalar}, which means that vector fits into a
9864 scalar type.
9865
9866 @item -Wvla
9867 @opindex Wvla
9868 @opindex Wno-vla
9869 Warn if a variable-length array is used in the code.
9870 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9871 the variable-length array.
9872
9873 @item -Wvla-larger-than=@var{byte-size}
9874 @opindex Wvla-larger-than=
9875 @opindex Wno-vla-larger-than
9876 If this option is used, the compiler warns for declarations of
9877 variable-length arrays whose size is either unbounded, or bounded
9878 by an argument that allows the array size to exceed @var{byte-size}
9879 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9880 works, but with variable-length arrays.
9881
9882 Note that GCC may optimize small variable-length arrays of a known
9883 value into plain arrays, so this warning may not get triggered for
9884 such arrays.
9885
9886 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9887 is typically only effective when @option{-ftree-vrp} is active (default
9888 for @option{-O2} and above).
9889
9890 See also @option{-Walloca-larger-than=@var{byte-size}}.
9891
9892 @item -Wno-vla-larger-than
9893 @opindex Wno-vla-larger-than
9894 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9895 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9896
9897 @item -Wvla-parameter
9898 @opindex Wno-vla-parameter
9899 Warn about redeclarations of functions involving arguments of Variable
9900 Length Array types of inconsistent kinds or forms, and enable the detection
9901 of out-of-bounds accesses to such parameters by warnings such as
9902 @option{-Warray-bounds}.
9903
9904 If the first function declaration uses the VLA form the bound specified
9905 in the array is assumed to be the minimum number of elements expected to
9906 be provided in calls to the function and the maximum number of elements
9907 accessed by it. Failing to provide arguments of sufficient size or
9908 accessing more than the maximum number of elements may be diagnosed.
9909
9910 For example, the warning triggers for the following redeclarations because
9911 the first one allows an array of any size to be passed to @code{f} while
9912 the second one specifies that the array argument must have at least @code{n}
9913 elements. In addition, calling @code{f} with the associated VLA bound
9914 parameter in excess of the actual VLA bound triggers a warning as well.
9915
9916 @smallexample
9917 void f (int n, int[n]);
9918 void f (int, int[]); // warning: argument 2 previously declared as a VLA
9919
9920 void g (int n)
9921 @{
9922 if (n > 4)
9923 return;
9924 int a[n];
9925 f (sizeof a, a); // warning: access to a by f may be out of bounds
9926 @dots{}
9927 @}
9928
9929 @end smallexample
9930
9931 @option{-Wvla-parameter} is included in @option{-Wall}. The
9932 @option{-Warray-parameter} option triggers warnings for similar problems
9933 involving ordinary array arguments.
9934
9935 @item -Wvolatile-register-var
9936 @opindex Wvolatile-register-var
9937 @opindex Wno-volatile-register-var
9938 Warn if a register variable is declared volatile. The volatile
9939 modifier does not inhibit all optimizations that may eliminate reads
9940 and/or writes to register variables. This warning is enabled by
9941 @option{-Wall}.
9942
9943 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
9944 @opindex Wxor-used-as-pow
9945 @opindex Wno-xor-used-as-pow
9946 Warn about uses of @code{^}, the exclusive or operator, where it appears
9947 the user meant exponentiation. Specifically, the warning occurs when the
9948 left-hand side is the decimal constant 2 or 10 and the right-hand side
9949 is also a decimal constant.
9950
9951 In C and C++, @code{^} means exclusive or, whereas in some other languages
9952 (e.g. TeX and some versions of BASIC) it means exponentiation.
9953
9954 This warning is enabled by default. It can be silenced by converting one
9955 of the operands to hexadecimal.
9956
9957 @item -Wdisabled-optimization
9958 @opindex Wdisabled-optimization
9959 @opindex Wno-disabled-optimization
9960 Warn if a requested optimization pass is disabled. This warning does
9961 not generally indicate that there is anything wrong with your code; it
9962 merely indicates that GCC's optimizers are unable to handle the code
9963 effectively. Often, the problem is that your code is too big or too
9964 complex; GCC refuses to optimize programs when the optimization
9965 itself is likely to take inordinate amounts of time.
9966
9967 @item -Wpointer-sign @r{(C and Objective-C only)}
9968 @opindex Wpointer-sign
9969 @opindex Wno-pointer-sign
9970 Warn for pointer argument passing or assignment with different signedness.
9971 This option is only supported for C and Objective-C@. It is implied by
9972 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9973 @option{-Wno-pointer-sign}.
9974
9975 @item -Wstack-protector
9976 @opindex Wstack-protector
9977 @opindex Wno-stack-protector
9978 This option is only active when @option{-fstack-protector} is active. It
9979 warns about functions that are not protected against stack smashing.
9980
9981 @item -Woverlength-strings
9982 @opindex Woverlength-strings
9983 @opindex Wno-overlength-strings
9984 Warn about string constants that are longer than the ``minimum
9985 maximum'' length specified in the C standard. Modern compilers
9986 generally allow string constants that are much longer than the
9987 standard's minimum limit, but very portable programs should avoid
9988 using longer strings.
9989
9990 The limit applies @emph{after} string constant concatenation, and does
9991 not count the trailing NUL@. In C90, the limit was 509 characters; in
9992 C99, it was raised to 4095. C++98 does not specify a normative
9993 minimum maximum, so we do not diagnose overlength strings in C++@.
9994
9995 This option is implied by @option{-Wpedantic}, and can be disabled with
9996 @option{-Wno-overlength-strings}.
9997
9998 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9999 @opindex Wunsuffixed-float-constants
10000 @opindex Wno-unsuffixed-float-constants
10001
10002 Issue a warning for any floating constant that does not have
10003 a suffix. When used together with @option{-Wsystem-headers} it
10004 warns about such constants in system header files. This can be useful
10005 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10006 from the decimal floating-point extension to C99.
10007
10008 @item -Wno-lto-type-mismatch
10009 @opindex Wlto-type-mismatch
10010 @opindex Wno-lto-type-mismatch
10011
10012 During the link-time optimization, do not warn about type mismatches in
10013 global declarations from different compilation units.
10014 Requires @option{-flto} to be enabled. Enabled by default.
10015
10016 @item -Wno-designated-init @r{(C and Objective-C only)}
10017 @opindex Wdesignated-init
10018 @opindex Wno-designated-init
10019 Suppress warnings when a positional initializer is used to initialize
10020 a structure that has been marked with the @code{designated_init}
10021 attribute.
10022
10023 @end table
10024
10025 @node Static Analyzer Options
10026 @section Options That Control Static Analysis
10027
10028 @table @gcctabopt
10029 @item -fanalyzer
10030 @opindex analyzer
10031 @opindex fanalyzer
10032 @opindex fno-analyzer
10033 This option enables an static analysis of program flow which looks
10034 for ``interesting'' interprocedural paths through the
10035 code, and issues warnings for problems found on them.
10036
10037 This analysis is much more expensive than other GCC warnings.
10038
10039 Enabling this option effectively enables the following warnings:
10040
10041 @gccoptlist{ @gol
10042 -Wanalyzer-allocation-size @gol
10043 -Wanalyzer-deref-before-check @gol
10044 -Wanalyzer-double-fclose @gol
10045 -Wanalyzer-double-free @gol
10046 -Wanalyzer-exposure-through-output-file @gol
10047 -Wanalyzer-exposure-through-uninit-copy @gol
10048 -Wanalyzer-fd-access-mode-mismatch @gol
10049 -Wanalyzer-fd-double-close @gol
10050 -Wanalyzer-fd-leak @gol
10051 -Wanalyzer-fd-phase-mismatch @gol
10052 -Wanalyzer-fd-type-mismatch @gol
10053 -Wanalyzer-fd-use-after-close @gol
10054 -Wanalyzer-fd-use-without-check @gol
10055 -Wanalyzer-file-leak @gol
10056 -Wanalyzer-free-of-non-heap @gol
10057 -Wanalyzer-imprecise-fp-arithmetic @gol
10058 -Wanalyzer-infinite-recursion @gol
10059 -Wanalyzer-jump-through-null @gol
10060 -Wanalyzer-malloc-leak @gol
10061 -Wanalyzer-mismatching-deallocation @gol
10062 -Wanalyzer-null-argument @gol
10063 -Wanalyzer-null-dereference @gol
10064 -Wanalyzer-out-of-bounds @gol
10065 -Wanalyzer-possible-null-argument @gol
10066 -Wanalyzer-possible-null-dereference @gol
10067 -Wanalyzer-putenv-of-auto-var @gol
10068 -Wanalyzer-shift-count-negative @gol
10069 -Wanalyzer-shift-count-overflow @gol
10070 -Wanalyzer-stale-setjmp-buffer @gol
10071 -Wanalyzer-unsafe-call-within-signal-handler @gol
10072 -Wanalyzer-use-after-free @gol
10073 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
10074 -Wanalyzer-use-of-uninitialized-value @gol
10075 -Wanalyzer-va-arg-type-mismatch @gol
10076 -Wanalyzer-va-list-exhausted @gol
10077 -Wanalyzer-va-list-leak @gol
10078 -Wanalyzer-va-list-use-after-va-end @gol
10079 -Wanalyzer-write-to-const @gol
10080 -Wanalyzer-write-to-string-literal @gol
10081 }
10082 @ignore
10083 -Wanalyzer-tainted-allocation-size @gol
10084 -Wanalyzer-tainted-array-index @gol
10085 -Wanalyzer-tainted-divisor @gol
10086 -Wanalyzer-tainted-offset @gol
10087 -Wanalyzer-tainted-size @gol
10088 @end ignore
10089
10090 This option is only available if GCC was configured with analyzer
10091 support enabled.
10092
10093 @item -Wanalyzer-too-complex
10094 @opindex Wanalyzer-too-complex
10095 @opindex Wno-analyzer-too-complex
10096 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10097 to attempt to explore the control flow and data flow in the program,
10098 but these can be defeated by sufficiently complicated code.
10099
10100 By default, the analysis silently stops if the code is too
10101 complicated for the analyzer to fully explore and it reaches an internal
10102 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
10103
10104 @item -Wno-analyzer-allocation-size
10105 @opindex Wanalyzer-allocation-size
10106 @opindex Wno-analyzer-allocation-size
10107 This warning requires @option{-fanalyzer}, which enables it; use
10108 @option{-Wno-analyzer-allocation-size}
10109 to disable it.
10110
10111 This diagnostic warns for paths through the code in which a pointer to
10112 a buffer is assigned to point at a buffer with a size that is not a
10113 multiple of @code{sizeof (*pointer)}.
10114
10115 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10116
10117 @item -Wno-analyzer-deref-before-check
10118 @opindex Wanalyzer-deref-before-check
10119 @opindex Wno-analyzer-deref-before-check
10120 This warning requires @option{-fanalyzer}, which enables it; use
10121 @option{-Wno-analyzer-deref-before-check}
10122 to disable it.
10123
10124 This diagnostic warns for paths through the code in which a pointer
10125 is checked for @code{NULL} *after* it has already been
10126 dereferenced, suggesting that the pointer could have been NULL.
10127 Such cases suggest that the check for NULL is either redundant,
10128 or that it needs to be moved to before the pointer is dereferenced.
10129
10130 This diagnostic also considers values passed to a function argument
10131 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10132 value, and thus will complain if such values are checked for @code{NULL}
10133 after returning from such a function call.
10134
10135 This diagnostic is unlikely to be reported when any level of optimization
10136 is enabled, as GCC's optimization logic will typically consider such
10137 checks for NULL as being redundant, and optimize them away before the
10138 analyzer "sees" them. Hence optimization should be disabled when
10139 attempting to trigger this diagnostic.
10140
10141 @item -Wno-analyzer-double-fclose
10142 @opindex Wanalyzer-double-fclose
10143 @opindex Wno-analyzer-double-fclose
10144 This warning requires @option{-fanalyzer}, which enables it; use
10145 @option{-Wno-analyzer-double-fclose} to disable it.
10146
10147 This diagnostic warns for paths through the code in which a @code{FILE *}
10148 can have @code{fclose} called on it more than once.
10149
10150 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10151
10152 @item -Wno-analyzer-double-free
10153 @opindex Wanalyzer-double-free
10154 @opindex Wno-analyzer-double-free
10155 This warning requires @option{-fanalyzer}, which enables it; use
10156 @option{-Wno-analyzer-double-free} to disable it.
10157
10158 This diagnostic warns for paths through the code in which a pointer
10159 can have a deallocator called on it more than once, either @code{free},
10160 or a deallocator referenced by attribute @code{malloc}.
10161
10162 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10163
10164 @item -Wno-analyzer-exposure-through-output-file
10165 @opindex Wanalyzer-exposure-through-output-file
10166 @opindex Wno-analyzer-exposure-through-output-file
10167 This warning requires @option{-fanalyzer}, which enables it; use
10168 @option{-Wno-analyzer-exposure-through-output-file}
10169 to disable it.
10170
10171 This diagnostic warns for paths through the code in which a
10172 security-sensitive value is written to an output file
10173 (such as writing a password to a log file).
10174
10175 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10176
10177 @item -Wanalyzer-exposure-through-uninit-copy
10178 @opindex Wanalyzer-exposure-through-uninit-copy
10179 @opindex Wno-analyzer-exposure-through-uninit-copy
10180 This warning requires both @option{-fanalyzer} and the use of a plugin
10181 to specify a function that copies across a ``trust boundary''. Use
10182 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10183
10184 This diagnostic warns for ``infoleaks'' - paths through the code in which
10185 uninitialized values are copied across a security boundary
10186 (such as code within an OS kernel that copies a partially-initialized
10187 struct on the stack to user space).
10188
10189 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10190
10191 @item -Wno-analyzer-fd-access-mode-mismatch
10192 @opindex Wanalyzer-fd-access-mode-mismatch
10193 @opindex Wno-analyzer-fd-access-mode-mismatch
10194 This warning requires @option{-fanalyzer}, which enables it; use
10195 @option{-Wno-analyzer-fd-access-mode-mismatch}
10196 to disable it.
10197
10198 This diagnostic warns for paths through code in which a
10199 @code{read} on a write-only file descriptor is attempted, or vice versa.
10200
10201 This diagnostic also warns for code paths in a which a function with attribute
10202 @code{fd_arg_read (N)} is called with a file descriptor opened with
10203 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10204 @code{fd_arg_write (N)} is called with a file descriptor opened with
10205 @code{O_RDONLY} at referenced argument @var{N}.
10206
10207 @item -Wno-analyzer-fd-double-close
10208 @opindex Wanalyzer-fd-double-close
10209 @opindex Wno-analyzer-fd-double-close
10210 This warning requires @option{-fanalyzer}, which enables it; use
10211 @option{-Wno-analyzer-fd-double-close}
10212 to disable it.
10213
10214 This diagnostic warns for paths through code in which a
10215 file descriptor can be closed more than once.
10216
10217 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10218
10219 @item -Wno-analyzer-fd-leak
10220 @opindex Wanalyzer-fd-leak
10221 @opindex Wno-analyzer-fd-leak
10222 This warning requires @option{-fanalyzer}, which enables it; use
10223 @option{-Wno-analyzer-fd-leak}
10224 to disable it.
10225
10226 This diagnostic warns for paths through code in which an
10227 open file descriptor is leaked.
10228
10229 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10230
10231 @item -Wno-analyzer-fd-phase-mismatch
10232 @opindex Wanalyzer-fd-phase-mismatch
10233 @opindex Wno-analyzer-fd-phase-mismatch
10234 This warning requires @option{-fanalyzer}, which enables it; use
10235 @option{-Wno-analyzer-fd-phase-mismatch}
10236 to disable it.
10237
10238 This diagnostic warns for paths through code in which an operation is
10239 attempted in the wrong phase of a file descriptor's lifetime.
10240 For example, it will warn on attempts to call @code{accept} on a stream
10241 socket that has not yet had @code{listen} successfully called on it.
10242
10243 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10244
10245 @item -Wno-analyzer-fd-type-mismatch
10246 @opindex Wanalyzer-fd-type-mismatch
10247 @opindex Wno-analyzer-fd-type-mismatch
10248 This warning requires @option{-fanalyzer}, which enables it; use
10249 @option{-Wno-analyzer-fd-type-mismatch}
10250 to disable it.
10251
10252 This diagnostic warns for paths through code in which an
10253 operation is attempted on the wrong type of file descriptor.
10254 For example, it will warn on attempts to use socket operations
10255 on a file descriptor obtained via @code{open}, or when attempting
10256 to use a stream socket operation on a datagram socket.
10257
10258 @item -Wno-analyzer-fd-use-after-close
10259 @opindex Wanalyzer-fd-use-after-close
10260 @opindex Wno-analyzer-fd-use-after-close
10261 This warning requires @option{-fanalyzer}, which enables it; use
10262 @option{-Wno-analyzer-fd-use-after-close}
10263 to disable it.
10264
10265 This diagnostic warns for paths through code in which a
10266 read or write is called on a closed file descriptor.
10267
10268 This diagnostic also warns for paths through code in which
10269 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10270 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10271 referenced argument @code{N}.
10272
10273 @item -Wno-analyzer-fd-use-without-check
10274 @opindex Wanalyzer-fd-use-without-check
10275 @opindex Wno-analyzer-fd-use-without-check
10276 This warning requires @option{-fanalyzer}, which enables it; use
10277 @option{-Wno-analyzer-fd-use-without-check}
10278 to disable it.
10279
10280 This diagnostic warns for paths through code in which a
10281 file descriptor is used without being checked for validity.
10282
10283 This diagnostic also warns for paths through code in which
10284 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10285 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10286 argument @code{N}, without being checked for validity.
10287
10288 @item -Wno-analyzer-file-leak
10289 @opindex Wanalyzer-file-leak
10290 @opindex Wno-analyzer-file-leak
10291 This warning requires @option{-fanalyzer}, which enables it; use
10292 @option{-Wno-analyzer-file-leak}
10293 to disable it.
10294
10295 This diagnostic warns for paths through the code in which a
10296 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10297
10298 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10299
10300 @item -Wno-analyzer-free-of-non-heap
10301 @opindex Wanalyzer-free-of-non-heap
10302 @opindex Wno-analyzer-free-of-non-heap
10303 This warning requires @option{-fanalyzer}, which enables it; use
10304 @option{-Wno-analyzer-free-of-non-heap}
10305 to disable it.
10306
10307 This diagnostic warns for paths through the code in which @code{free}
10308 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10309
10310 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10311
10312 @item -Wno-analyzer-imprecise-fp-arithmetic
10313 @opindex Wanalyzer-imprecise-fp-arithmetic
10314 @opindex Wno-analyzer-imprecise-fp-arithmetic
10315 This warning requires @option{-fanalyzer}, which enables it; use
10316 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10317 to disable it.
10318
10319 This diagnostic warns for paths through the code in which floating-point
10320 arithmetic is used in locations where precise computation is needed. This
10321 diagnostic only warns on use of floating-point operands inside the
10322 calculation of an allocation size at the moment.
10323
10324 @item -Wno-analyzer-infinite-recursion
10325 @opindex Wanalyzer-infinite-recursion
10326 @opindex Wno-analyzer-infinite-recursion
10327 This warning requires @option{-fanalyzer}, which enables it; use
10328 @option{-Wno-analyzer-infinite-recursion} to disable it.
10329
10330 This diagnostics warns for paths through the code which appear to
10331 lead to infinite recursion.
10332
10333 Specifically, when the analyzer "sees" a recursive call, it will compare
10334 the state of memory at the entry to the new frame with that at the entry
10335 to the previous frame of that function on the stack. The warning is
10336 issued if nothing in memory appears to be changing; any changes observed
10337 to parameters or globals are assumed to lead to termination of the
10338 recursion and thus suppress the warning.
10339
10340 This diagnostic is likely to miss cases of infinite recursion that
10341 are convered to iteration by the optimizer before the analyzer "sees"
10342 them. Hence optimization should be disabled when attempting to trigger
10343 this diagnostic.
10344
10345 Compare with @option{-Winfinite-recursion}, which provides a similar
10346 diagnostic, but is implemented in a different way.
10347
10348 @item -Wno-analyzer-jump-through-null
10349 @opindex Wanalyzer-jump-through-null
10350 @opindex Wno-analyzer-jump-through-null
10351 This warning requires @option{-fanalyzer}, which enables it; use
10352 @option{-Wno-analyzer-jump-through-null}
10353 to disable it.
10354
10355 This diagnostic warns for paths through the code in which a @code{NULL}
10356 function pointer is called.
10357
10358 @item -Wno-analyzer-malloc-leak
10359 @opindex Wanalyzer-malloc-leak
10360 @opindex Wno-analyzer-malloc-leak
10361 This warning requires @option{-fanalyzer}, which enables it; use
10362 @option{-Wno-analyzer-malloc-leak}
10363 to disable it.
10364
10365 This diagnostic warns for paths through the code in which a
10366 pointer allocated via an allocator is leaked: either @code{malloc},
10367 or a function marked with attribute @code{malloc}.
10368
10369 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10370
10371 @item -Wno-analyzer-mismatching-deallocation
10372 @opindex Wanalyzer-mismatching-deallocation
10373 @opindex Wno-analyzer-mismatching-deallocation
10374 This warning requires @option{-fanalyzer}, which enables it; use
10375 @option{-Wno-analyzer-mismatching-deallocation}
10376 to disable it.
10377
10378 This diagnostic warns for paths through the code in which the
10379 wrong deallocation function is called on a pointer value, based on
10380 which function was used to allocate the pointer value. The diagnostic
10381 will warn about mismatches between @code{free}, scalar @code{delete}
10382 and vector @code{delete[]}, and those marked as allocator/deallocator
10383 pairs using attribute @code{malloc}.
10384
10385 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10386
10387 @item -Wno-analyzer-out-of-bounds
10388 @opindex Wanalyzer-out-of-bounds
10389 @opindex Wno-analyzer-out-of-bounds
10390 This warning requires @option{-fanalyzer} to enable it; use
10391 @option{-Wno-analyzer-out-of-bounds} to disable it.
10392
10393 This diagnostic warns for path through the code in which a buffer is
10394 definitely read or written out-of-bounds. The diagnostic applies for
10395 cases where the analyzer is able to determine a constant offset and for
10396 accesses past the end of a buffer, also a constant capacity. Further,
10397 the diagnostic does limited checking for accesses past the end when the
10398 offset as well as the capacity is symbolic.
10399
10400 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10401
10402 @item -Wno-analyzer-possible-null-argument
10403 @opindex Wanalyzer-possible-null-argument
10404 @opindex Wno-analyzer-possible-null-argument
10405 This warning requires @option{-fanalyzer}, which enables it; use
10406 @option{-Wno-analyzer-possible-null-argument} to disable it.
10407
10408 This diagnostic warns for paths through the code in which a
10409 possibly-NULL value is passed to a function argument marked
10410 with @code{__attribute__((nonnull))} as requiring a non-NULL
10411 value.
10412
10413 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10414
10415 @item -Wno-analyzer-possible-null-dereference
10416 @opindex Wanalyzer-possible-null-dereference
10417 @opindex Wno-analyzer-possible-null-dereference
10418 This warning requires @option{-fanalyzer}, which enables it; use
10419 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10420
10421 This diagnostic warns for paths through the code in which a
10422 possibly-NULL value is dereferenced.
10423
10424 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10425
10426 @item -Wno-analyzer-null-argument
10427 @opindex Wanalyzer-null-argument
10428 @opindex Wno-analyzer-null-argument
10429 This warning requires @option{-fanalyzer}, which enables it; use
10430 @option{-Wno-analyzer-null-argument} to disable it.
10431
10432 This diagnostic warns for paths through the code in which a
10433 value known to be NULL is passed to a function argument marked
10434 with @code{__attribute__((nonnull))} as requiring a non-NULL
10435 value.
10436
10437 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10438
10439 @item -Wno-analyzer-null-dereference
10440 @opindex Wanalyzer-null-dereference
10441 @opindex Wno-analyzer-null-dereference
10442 This warning requires @option{-fanalyzer}, which enables it; use
10443 @option{-Wno-analyzer-null-dereference} to disable it.
10444
10445 This diagnostic warns for paths through the code in which a
10446 value known to be NULL is dereferenced.
10447
10448 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10449
10450 @item -Wno-analyzer-putenv-of-auto-var
10451 @opindex Wanalyzer-putenv-of-auto-var
10452 @opindex Wno-analyzer-putenv-of-auto-var
10453 This warning requires @option{-fanalyzer}, which enables it; use
10454 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10455
10456 This diagnostic warns for paths through the code in which a
10457 call to @code{putenv} is passed a pointer to an automatic variable
10458 or an on-stack buffer.
10459
10460 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}.
10461
10462 @item -Wno-analyzer-shift-count-negative
10463 @opindex Wanalyzer-shift-count-negative
10464 @opindex Wno-analyzer-shift-count-negative
10465 This warning requires @option{-fanalyzer}, which enables it; use
10466 @option{-Wno-analyzer-shift-count-negative} to disable it.
10467
10468 This diagnostic warns for paths through the code in which a
10469 shift is attempted with a negative count. It is analogous to
10470 the @option{-Wshift-count-negative} diagnostic implemented in
10471 the C/C++ front ends, but is implemented based on analyzing
10472 interprocedural paths, rather than merely parsing the syntax tree.
10473 However, the analyzer does not prioritize detection of such paths, so
10474 false negatives are more likely relative to other warnings.
10475
10476 @item -Wno-analyzer-shift-count-overflow
10477 @opindex Wanalyzer-shift-count-overflow
10478 @opindex Wno-analyzer-shift-count-overflow
10479 This warning requires @option{-fanalyzer}, which enables it; use
10480 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10481
10482 This diagnostic warns for paths through the code in which a
10483 shift is attempted with a count greater than or equal to the
10484 precision of the operand's type. It is analogous to
10485 the @option{-Wshift-count-overflow} diagnostic implemented in
10486 the C/C++ front ends, but is implemented based on analyzing
10487 interprocedural paths, rather than merely parsing the syntax tree.
10488 However, the analyzer does not prioritize detection of such paths, so
10489 false negatives are more likely relative to other warnings.
10490
10491 @item -Wno-analyzer-stale-setjmp-buffer
10492 @opindex Wanalyzer-stale-setjmp-buffer
10493 @opindex Wno-analyzer-stale-setjmp-buffer
10494 This warning requires @option{-fanalyzer}, which enables it; use
10495 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10496
10497 This diagnostic warns for paths through the code in which
10498 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10499 to a @code{setjmp} call in a function that has returned.
10500
10501 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10502 location, it records the stack frame. The stack frame becomes invalid
10503 when the function containing the @code{setjmp} call returns. Attempting
10504 to rewind to it via @code{longjmp} would reference a stack frame that
10505 no longer exists, and likely lead to a crash (or worse).
10506
10507 @item -Wno-analyzer-tainted-allocation-size
10508 @opindex Wanalyzer-tainted-allocation-size
10509 @opindex Wno-analyzer-tainted-allocation-size
10510 This warning requires both @option{-fanalyzer} and
10511 @option{-fanalyzer-checker=taint} to enable it;
10512 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10513
10514 This diagnostic warns for paths through the code in which a value
10515 that could be under an attacker's control is used as the size
10516 of an allocation without being sanitized, so that an attacker could
10517 inject an excessively large allocation and potentially cause a denial
10518 of service attack.
10519
10520 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10521
10522 @item -Wno-analyzer-tainted-assertion
10523 @opindex Wanalyzer-tainted-assertion
10524 @opindex Wno-analyzer-tainted-assertion
10525
10526 This warning requires both @option{-fanalyzer} and
10527 @option{-fanalyzer-checker=taint} to enable it;
10528 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10529
10530 This diagnostic warns for paths through the code in which a value
10531 that could be under an attacker's control is used as part of a
10532 condition without being first sanitized, and that condition guards a
10533 call to a function marked with attribute @code{noreturn}
10534 (such as the function @code{__builtin_unreachable}). Such functions
10535 typically indicate abnormal termination of the program, such as for
10536 assertion failure handlers. For example:
10537
10538 @smallexample
10539 assert (some_tainted_value < SOME_LIMIT);
10540 @end smallexample
10541
10542 In such cases:
10543
10544 @itemize
10545 @item
10546 when assertion-checking is enabled: an attacker could trigger
10547 a denial of service by injecting an assertion failure
10548
10549 @item
10550 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10551 an attacker could inject data that subverts the process, since it
10552 presumably violates a precondition that is being assumed by the code.
10553
10554 @end itemize
10555
10556 Note that when assertion-checking is disabled, the assertions are
10557 typically removed by the preprocessor before the analyzer has a chance
10558 to "see" them, so this diagnostic can only generate warnings on builds
10559 in which assertion-checking is enabled.
10560
10561 For the purpose of this warning, any function marked with attribute
10562 @code{noreturn} is considered as a possible assertion failure
10563 handler, including @code{__builtin_unreachable}. Note that these functions
10564 are sometimes removed by the optimizer before the analyzer "sees" them.
10565 Hence optimization should be disabled when attempting to trigger this
10566 diagnostic.
10567
10568 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10569
10570 The warning can also report problematic constructions such as
10571
10572 @smallexample
10573 switch (some_tainted_value) @{
10574 case 0:
10575 /* [...etc; various valid cases omitted...] */
10576 break;
10577
10578 default:
10579 __builtin_unreachable (); /* BUG: attacker can trigger this */
10580 @}
10581 @end smallexample
10582
10583 despite the above not being an assertion failure, strictly speaking.
10584
10585 @item -Wno-analyzer-tainted-array-index
10586 @opindex Wanalyzer-tainted-array-index
10587 @opindex Wno-analyzer-tainted-array-index
10588 This warning requires both @option{-fanalyzer} and
10589 @option{-fanalyzer-checker=taint} to enable it;
10590 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10591
10592 This diagnostic warns for paths through the code in which a value
10593 that could be under an attacker's control is used as the index
10594 of an array access without being sanitized, so that an attacker
10595 could inject an out-of-bounds access.
10596
10597 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10598
10599 @item -Wno-analyzer-tainted-divisor
10600 @opindex Wanalyzer-tainted-divisor
10601 @opindex Wno-analyzer-tainted-divisor
10602 This warning requires both @option{-fanalyzer} and
10603 @option{-fanalyzer-checker=taint} to enable it;
10604 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10605
10606 This diagnostic warns for paths through the code in which a value
10607 that could be under an attacker's control is used as the divisor
10608 in a division or modulus operation without being sanitized, so that
10609 an attacker could inject a division-by-zero.
10610
10611 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10612
10613 @item -Wno-analyzer-tainted-offset
10614 @opindex Wanalyzer-tainted-offset
10615 @opindex Wno-analyzer-tainted-offset
10616 This warning requires both @option{-fanalyzer} and
10617 @option{-fanalyzer-checker=taint} to enable it;
10618 use @option{-Wno-analyzer-tainted-offset} to disable it.
10619
10620 This diagnostic warns for paths through the code in which a value
10621 that could be under an attacker's control is used as a pointer offset
10622 without being sanitized, so that an attacker could inject an out-of-bounds
10623 access.
10624
10625 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10626
10627 @item -Wno-analyzer-tainted-size
10628 @opindex Wanalyzer-tainted-size
10629 @opindex Wno-analyzer-tainted-size
10630 This warning requires both @option{-fanalyzer} and
10631 @option{-fanalyzer-checker=taint} to enable it;
10632 use @option{-Wno-analyzer-tainted-size} to disable it.
10633
10634 This diagnostic warns for paths through the code in which a value
10635 that could be under an attacker's control is used as the size of
10636 an operation such as @code{memset} without being sanitized, so that an
10637 attacker could inject an out-of-bounds access.
10638
10639 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10640
10641 @item -Wno-analyzer-unsafe-call-within-signal-handler
10642 @opindex Wanalyzer-unsafe-call-within-signal-handler
10643 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10644 This warning requires @option{-fanalyzer}, which enables it; use
10645 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10646
10647 This diagnostic warns for paths through the code in which a
10648 function known to be async-signal-unsafe (such as @code{fprintf}) is
10649 called from a signal handler.
10650
10651 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10652
10653 @item -Wno-analyzer-use-after-free
10654 @opindex Wanalyzer-use-after-free
10655 @opindex Wno-analyzer-use-after-free
10656 This warning requires @option{-fanalyzer}, which enables it; use
10657 @option{-Wno-analyzer-use-after-free} to disable it.
10658
10659 This diagnostic warns for paths through the code in which a
10660 pointer is used after a deallocator is called on it: either @code{free},
10661 or a deallocator referenced by attribute @code{malloc}.
10662
10663 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10664
10665 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10666 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10667 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10668 This warning requires @option{-fanalyzer}, which enables it; use
10669 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10670 to disable it.
10671
10672 This diagnostic warns for paths through the code in which a pointer
10673 is dereferenced that points to a variable in a stale stack frame.
10674
10675 @item -Wno-analyzer-va-arg-type-mismatch
10676 @opindex Wanalyzer-va-arg-type-mismatch
10677 @opindex Wno-analyzer-va-arg-type-mismatch
10678 This warning requires @option{-fanalyzer}, which enables it; use
10679 @option{-Wno-analyzer-va-arg-type-mismatch}
10680 to disable it.
10681
10682 This diagnostic warns for interprocedural paths through the code for which
10683 the analyzer detects an attempt to use @code{va_arg} to extract a value
10684 passed to a variadic call, but uses a type that does not match that of
10685 the expression passed to the call.
10686
10687 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
10688
10689 @item -Wno-analyzer-va-list-exhausted
10690 @opindex Wanalyzer-va-list-exhausted
10691 @opindex Wno-analyzer-va-list-exhausted
10692 This warning requires @option{-fanalyzer}, which enables it; use
10693 @option{-Wno-analyzer-va-list-exhausted}
10694 to disable it.
10695
10696 This diagnostic warns for interprocedural paths through the code for which
10697 the analyzer detects an attempt to use @code{va_arg} to access the next
10698 value passed to a variadic call, but all of the values in the
10699 @code{va_list} have already been consumed.
10700
10701 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
10702
10703 @item -Wno-analyzer-va-list-leak
10704 @opindex Wanalyzer-va-list-leak
10705 @opindex Wno-analyzer-va-list-leak
10706 This warning requires @option{-fanalyzer}, which enables it; use
10707 @option{-Wno-analyzer-va-list-leak}
10708 to disable it.
10709
10710 This diagnostic warns for interprocedural paths through the code for which
10711 the analyzer detects that @code{va_start} or @code{va_copy} has been called
10712 on a @code{va_list} without a corresponding call to @code{va_end}.
10713
10714 @item -Wno-analyzer-va-list-use-after-va-end
10715 @opindex Wanalyzer-va-list-use-after-va-end
10716 @opindex Wno-analyzer-va-list-use-after-va-end
10717 This warning requires @option{-fanalyzer}, which enables it; use
10718 @option{-Wno-analyzer-va-list-use-after-va-end}
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 a @code{va_list} after
10723 @code{va_end} has been called on it.
10724 @code{va_list}.
10725
10726 @item -Wno-analyzer-write-to-const
10727 @opindex Wanalyzer-write-to-const
10728 @opindex Wno-analyzer-write-to-const
10729 This warning requires @option{-fanalyzer}, which enables it; use
10730 @option{-Wno-analyzer-write-to-const}
10731 to disable it.
10732
10733 This diagnostic warns for paths through the code in which the analyzer
10734 detects an attempt to write through a pointer to a @code{const} object.
10735 However, the analyzer does not prioritize detection of such paths, so
10736 false negatives are more likely relative to other warnings.
10737
10738 @item -Wno-analyzer-write-to-string-literal
10739 @opindex Wanalyzer-write-to-string-literal
10740 @opindex Wno-analyzer-write-to-string-literal
10741 This warning requires @option{-fanalyzer}, which enables it; use
10742 @option{-Wno-analyzer-write-to-string-literal}
10743 to disable it.
10744
10745 This diagnostic warns for paths through the code in which the analyzer
10746 detects an attempt to write through a pointer to a string literal.
10747 However, the analyzer does not prioritize detection of such paths, so
10748 false negatives are more likely relative to other warnings.
10749
10750 @item -Wno-analyzer-use-of-uninitialized-value
10751 @opindex Wanalyzer-use-of-uninitialized-value
10752 @opindex Wno-analyzer-use-of-uninitialized-value
10753 This warning requires @option{-fanalyzer}, which enables it; use
10754 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
10755
10756 This diagnostic warns for paths through the code in which an uninitialized
10757 value is used.
10758
10759 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
10760
10761 @end table
10762
10763 The analyzer has hardcoded knowledge about the behavior of the following
10764 memory-management functions:
10765
10766 @itemize @bullet
10767 @item @code{alloca}
10768 @item The built-in functions @code{__builtin_alloc},
10769 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
10770 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
10771 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
10772 @code{__builtin_memset_chk}, @code{__builtin_realloc},
10773 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
10774 @item @code{calloc}
10775 @item @code{free}
10776 @item @code{malloc}
10777 @item @code{memset}
10778 @item @code{operator delete}
10779 @item @code{operator delete []}
10780 @item @code{operator new}
10781 @item @code{operator new []}
10782 @item @code{realloc}
10783 @item @code{strdup}
10784 @item @code{strndup}
10785 @end itemize
10786
10787 of the following functions for working with file descriptors:
10788
10789 @itemize @bullet
10790 @item @code{open}
10791 @item @code{close}
10792 @item @code{creat}
10793 @item @code{dup}, @code{dup2} and @code{dup3}
10794 @item @code{isatty}
10795 @item @code{pipe}, and @code{pipe2}
10796 @item @code{read}
10797 @item @code{write}
10798 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
10799 @end itemize
10800
10801 of the following functions for working with @code{<stdio.h>} streams:
10802 @itemize @bullet
10803 @item The built-in functions @code{__builtin_fprintf},
10804 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
10805 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
10806 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
10807 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
10808 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
10809 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
10810 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
10811 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
10812 @code{__builtin_vprintf}
10813 @item @code{fopen}
10814 @item @code{fclose}
10815 @item @code{ferror}
10816 @item @code{fgets}
10817 @item @code{fgets_unlocked}
10818 @item @code{fileno}
10819 @item @code{fread}
10820 @item @code{getc}
10821 @item @code{getchar}
10822 @item @code{fprintf}
10823 @item @code{printf}
10824 @item @code{fwrite}
10825 @end itemize
10826
10827 and of the following functions:
10828
10829 @itemize @bullet
10830 @item The built-in functions @code{__builtin_expect},
10831 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
10832 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
10833 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
10834 @code{__builtin_va_start}
10835 @item The GNU extensions @code{error} and @code{error_at_line}
10836 @item @code{getpass}
10837 @item @code{longjmp}
10838 @item @code{putenv}
10839 @item @code{setjmp}
10840 @item @code{siglongjmp}
10841 @item @code{signal}
10842 @item @code{sigsetjmp}
10843 @item @code{strchr}
10844 @item @code{strlen}
10845 @end itemize
10846
10847 In addition, various functions with an @code{__analyzer_} prefix have
10848 special meaning to the analyzer, described in the GCC Internals manual.
10849
10850 Pertinent parameters for controlling the exploration are:
10851 @option{--param analyzer-bb-explosion-factor=@var{value}},
10852 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
10853 @option{--param analyzer-max-recursion-depth=@var{value}}, and
10854 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
10855
10856 The following options control the analyzer.
10857
10858 @table @gcctabopt
10859
10860 @item -fanalyzer-call-summaries
10861 @opindex fanalyzer-call-summaries
10862 @opindex fno-analyzer-call-summaries
10863 Simplify interprocedural analysis by computing the effect of certain calls,
10864 rather than exploring all paths through the function from callsite to each
10865 possible return.
10866
10867 If enabled, call summaries are only used for functions with more than one
10868 call site, and that are sufficiently complicated (as per
10869 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
10870
10871 @item -fanalyzer-checker=@var{name}
10872 @opindex fanalyzer-checker
10873 Restrict the analyzer to run just the named checker, and enable it.
10874
10875 Some checkers are disabled by default (even with @option{-fanalyzer}),
10876 such as the @code{taint} checker that implements
10877 @option{-Wanalyzer-tainted-array-index}, and this option is required
10878 to enable them.
10879
10880 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
10881 following warnings from @option{-fanalyzer}:
10882
10883 @gccoptlist{ @gol
10884 -Wanalyzer-deref-before-check @gol
10885 -Wanalyzer-double-fclose @gol
10886 -Wanalyzer-double-free @gol
10887 -Wanalyzer-exposure-through-output-file @gol
10888 -Wanalyzer-fd-access-mode-mismatch @gol
10889 -Wanalyzer-fd-double-close @gol
10890 -Wanalyzer-fd-leak @gol
10891 -Wanalyzer-fd-use-after-close @gol
10892 -Wanalyzer-fd-use-without-check @gol
10893 -Wanalyzer-file-leak @gol
10894 -Wanalyzer-free-of-non-heap @gol
10895 -Wanalyzer-malloc-leak @gol
10896 -Wanalyzer-mismatching-deallocation @gol
10897 -Wanalyzer-null-argument @gol
10898 -Wanalyzer-null-dereference @gol
10899 -Wanalyzer-possible-null-argument @gol
10900 -Wanalyzer-possible-null-dereference @gol
10901 -Wanalyzer-unsafe-call-within-signal-handler @gol
10902 -Wanalyzer-use-after-free @gol
10903 -Wanalyzer-va-list-leak @gol
10904 -Wanalyzer-va-list-use-after-va-end @gol
10905 }
10906
10907 @item -fno-analyzer-feasibility
10908 @opindex fanalyzer-feasibility
10909 @opindex fno-analyzer-feasibility
10910 This option is intended for analyzer developers.
10911
10912 By default the analyzer verifies that there is a feasible control flow path
10913 for each diagnostic it emits: that the conditions that hold are not mutually
10914 exclusive. Diagnostics for which no feasible path can be found are rejected.
10915 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
10916 debugging issues in this code.
10917
10918 @item -fanalyzer-fine-grained
10919 @opindex fanalyzer-fine-grained
10920 @opindex fno-analyzer-fine-grained
10921 This option is intended for analyzer developers.
10922
10923 Internally the analyzer builds an ``exploded graph'' that combines
10924 control flow graphs with data flow information.
10925
10926 By default, an edge in this graph can contain the effects of a run
10927 of multiple statements within a basic block. With
10928 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
10929
10930 @item -fanalyzer-show-duplicate-count
10931 @opindex fanalyzer-show-duplicate-count
10932 @opindex fno-analyzer-show-duplicate-count
10933 This option is intended for analyzer developers: if multiple diagnostics
10934 have been detected as being duplicates of each other, it emits a note when
10935 reporting the best diagnostic, giving the number of additional diagnostics
10936 that were suppressed by the deduplication logic.
10937
10938 @item -fno-analyzer-state-merge
10939 @opindex fanalyzer-state-merge
10940 @opindex fno-analyzer-state-merge
10941 This option is intended for analyzer developers.
10942
10943 By default the analyzer attempts to simplify analysis by merging
10944 sufficiently similar states at each program point as it builds its
10945 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
10946 merging can be suppressed, for debugging state-handling issues.
10947
10948 @item -fno-analyzer-state-purge
10949 @opindex fanalyzer-state-purge
10950 @opindex fno-analyzer-state-purge
10951 This option is intended for analyzer developers.
10952
10953 By default the analyzer attempts to simplify analysis by purging
10954 aspects of state at a program point that appear to no longer be relevant
10955 e.g. the values of locals that aren't accessed later in the function
10956 and which aren't relevant to leak analysis.
10957
10958 With @option{-fno-analyzer-state-purge} this purging of state can
10959 be suppressed, for debugging state-handling issues.
10960
10961 @item -fanalyzer-transitivity
10962 @opindex fanalyzer-transitivity
10963 @opindex fno-analyzer-transitivity
10964 This option enables transitivity of constraints within the analyzer.
10965
10966 @item -fno-analyzer-undo-inlining
10967 @opindex fanalyzer-undo-inlining
10968 @opindex fno-analyzer-undo-inlining
10969 This option is intended for analyzer developers.
10970
10971 @option{-fanalyzer} runs relatively late compared to other code analysis
10972 tools, and some optimizations have already been applied to the code. In
10973 particular function inlining may have occurred, leading to the
10974 interprocedural execution paths emitted by the analyzer containing
10975 function frames that don't correspond to those in the original source
10976 code.
10977
10978 By default the analyzer attempts to reconstruct the original function
10979 frames, and to emit events showing the inlined calls.
10980
10981 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
10982 the original frame information can be be disabled, which may be of help
10983 when debugging issues in the analyzer.
10984
10985 @item -fanalyzer-verbose-edges
10986 This option is intended for analyzer developers. It enables more
10987 verbose, lower-level detail in the descriptions of control flow
10988 within diagnostic paths.
10989
10990 @item -fanalyzer-verbose-state-changes
10991 This option is intended for analyzer developers. It enables more
10992 verbose, lower-level detail in the descriptions of events relating
10993 to state machines within diagnostic paths.
10994
10995 @item -fanalyzer-verbosity=@var{level}
10996 This option controls the complexity of the control flow paths that are
10997 emitted for analyzer diagnostics.
10998
10999 The @var{level} can be one of:
11000
11001 @table @samp
11002 @item 0
11003 At this level, interprocedural call and return events are displayed,
11004 along with the most pertinent state-change events relating to
11005 a diagnostic. For example, for a double-@code{free} diagnostic,
11006 both calls to @code{free} will be shown.
11007
11008 @item 1
11009 As per the previous level, but also show events for the entry
11010 to each function.
11011
11012 @item 2
11013 As per the previous level, but also show events relating to
11014 control flow that are significant to triggering the issue
11015 (e.g. ``true path taken'' at a conditional).
11016
11017 This level is the default.
11018
11019 @item 3
11020 As per the previous level, but show all control flow events, not
11021 just significant ones.
11022
11023 @item 4
11024 This level is intended for analyzer developers; it adds various
11025 other events intended for debugging the analyzer.
11026
11027 @end table
11028
11029 @item -fdump-analyzer
11030 @opindex fdump-analyzer
11031 Dump internal details about what the analyzer is doing to
11032 @file{@var{file}.analyzer.txt}.
11033 This option is overridden by @option{-fdump-analyzer-stderr}.
11034
11035 @item -fdump-analyzer-stderr
11036 @opindex fdump-analyzer-stderr
11037 Dump internal details about what the analyzer is doing to stderr.
11038 This option overrides @option{-fdump-analyzer}.
11039
11040 @item -fdump-analyzer-callgraph
11041 @opindex fdump-analyzer-callgraph
11042 Dump a representation of the call graph suitable for viewing with
11043 GraphViz to @file{@var{file}.callgraph.dot}.
11044
11045 @item -fdump-analyzer-exploded-graph
11046 @opindex fdump-analyzer-exploded-graph
11047 Dump a representation of the ``exploded graph'' suitable for viewing with
11048 GraphViz to @file{@var{file}.eg.dot}.
11049 Nodes are color-coded based on state-machine states to emphasize
11050 state changes.
11051
11052 @item -fdump-analyzer-exploded-nodes
11053 @opindex dump-analyzer-exploded-nodes
11054 Emit diagnostics showing where nodes in the ``exploded graph'' are
11055 in relation to the program source.
11056
11057 @item -fdump-analyzer-exploded-nodes-2
11058 @opindex dump-analyzer-exploded-nodes-2
11059 Dump a textual representation of the ``exploded graph'' to
11060 @file{@var{file}.eg.txt}.
11061
11062 @item -fdump-analyzer-exploded-nodes-3
11063 @opindex dump-analyzer-exploded-nodes-3
11064 Dump a textual representation of the ``exploded graph'' to
11065 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11066 This is typically a large number of dump files.
11067
11068 @item -fdump-analyzer-exploded-paths
11069 @opindex fdump-analyzer-exploded-paths
11070 Dump a textual representation of the ``exploded path'' for each
11071 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11072
11073 @item -fdump-analyzer-feasibility
11074 @opindex dump-analyzer-feasibility
11075 Dump internal details about the analyzer's search for feasible paths.
11076 The details are written in a form suitable for viewing with GraphViz
11077 to filenames of the form @file{@var{file}.*.fg.dot},
11078 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11079
11080 @item -fdump-analyzer-json
11081 @opindex fdump-analyzer-json
11082 Dump a compressed JSON representation of analyzer internals to
11083 @file{@var{file}.analyzer.json.gz}. The precise format is subject
11084 to change.
11085
11086 @item -fdump-analyzer-state-purge
11087 @opindex fdump-analyzer-state-purge
11088 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11089 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11090 graph with information on what state will be purged at each node.
11091 The graph is written to @file{@var{file}.state-purge.dot}.
11092
11093 @item -fdump-analyzer-supergraph
11094 @opindex fdump-analyzer-supergraph
11095 Dump representations of the ``supergraph'' suitable for viewing with
11096 GraphViz to @file{@var{file}.supergraph.dot} and to
11097 @file{@var{file}.supergraph-eg.dot}. These show all of the
11098 control flow graphs in the program, with interprocedural edges for
11099 calls and returns. The second dump contains annotations showing nodes
11100 in the ``exploded graph'' and diagnostics associated with them.
11101
11102 @item -fdump-analyzer-untracked
11103 @opindex fdump-analyzer-untracked
11104 Emit custom warnings with internal details intended for analyzer developers.
11105
11106 @end table
11107
11108 @node Debugging Options
11109 @section Options for Debugging Your Program
11110 @cindex options, debugging
11111 @cindex debugging information options
11112
11113 To tell GCC to emit extra information for use by a debugger, in almost
11114 all cases you need only to add @option{-g} to your other options. Some debug
11115 formats can co-exist (like DWARF with CTF) when each of them is enabled
11116 explicitly by adding the respective command line option to your other options.
11117
11118 GCC allows you to use @option{-g} with
11119 @option{-O}. The shortcuts taken by optimized code may occasionally
11120 be surprising: some variables you declared may not exist
11121 at all; flow of control may briefly move where you did not expect it;
11122 some statements may not be executed because they compute constant
11123 results or their values are already at hand; some statements may
11124 execute in different places because they have been moved out of loops.
11125 Nevertheless it is possible to debug optimized output. This makes
11126 it reasonable to use the optimizer for programs that might have bugs.
11127
11128 If you are not using some other optimization option, consider
11129 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
11130 With no @option{-O} option at all, some compiler passes that collect
11131 information useful for debugging do not run at all, so that
11132 @option{-Og} may result in a better debugging experience.
11133
11134 @table @gcctabopt
11135 @item -g
11136 @opindex g
11137 Produce debugging information in the operating system's native format
11138 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
11139 information.
11140
11141 On most systems that use stabs format, @option{-g} enables use of extra
11142 debugging information that only GDB can use; this extra information
11143 makes debugging work better in GDB but probably makes other debuggers
11144 crash or refuse to read the program. If you want to control for certain whether
11145 to generate the extra information, use @option{-gvms} (see below).
11146
11147 @item -ggdb
11148 @opindex ggdb
11149 Produce debugging information for use by GDB@. This means to use the
11150 most expressive format available (DWARF, stabs, or the native format
11151 if neither of those are supported), including GDB extensions if at all
11152 possible.
11153
11154 @item -gdwarf
11155 @itemx -gdwarf-@var{version}
11156 @opindex gdwarf
11157 Produce debugging information in DWARF format (if that is supported).
11158 The value of @var{version} may be either 2, 3, 4 or 5; the default
11159 version for most targets is 5 (with the exception of VxWorks, TPF and
11160 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
11161 to version 4).
11162
11163 Note that with DWARF Version 2, some ports require and always
11164 use some non-conflicting DWARF 3 extensions in the unwind tables.
11165
11166 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11167 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11168
11169 GCC no longer supports DWARF Version 1, which is substantially
11170 different than Version 2 and later. For historical reasons, some
11171 other DWARF-related options such as
11172 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11173 in their names, but apply to all currently-supported versions of DWARF.
11174
11175 @item -gbtf
11176 @opindex gbtf
11177 Request BTF debug information. BTF is the default debugging format for the
11178 eBPF target. On other targets, like x86, BTF debug information can be
11179 generated along with DWARF debug information when both of the debug formats are
11180 enabled explicitly via their respective command line options.
11181
11182 @item -gctf
11183 @itemx -gctf@var{level}
11184 @opindex gctf
11185 Request CTF debug information and use level to specify how much CTF debug
11186 information should be produced. If @option{-gctf} is specified
11187 without a value for level, the default level of CTF debug information is 2.
11188
11189 CTF debug information can be generated along with DWARF debug information when
11190 both of the debug formats are enabled explicitly via their respective command
11191 line options.
11192
11193 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
11194 negates @option{-gctf}.
11195
11196 Level 1 produces CTF information for tracebacks only. This includes callsite
11197 information, but does not include type information.
11198
11199 Level 2 produces type information for entities (functions, data objects etc.)
11200 at file-scope or global-scope only.
11201
11202 @item -gvms
11203 @opindex gvms
11204 Produce debugging information in Alpha/VMS debug format (if that is
11205 supported). This is the format used by DEBUG on Alpha/VMS systems.
11206
11207 @item -g@var{level}
11208 @itemx -ggdb@var{level}
11209 @itemx -gvms@var{level}
11210 Request debugging information and also use @var{level} to specify how
11211 much information. The default level is 2.
11212
11213 Level 0 produces no debug information at all. Thus, @option{-g0} negates
11214 @option{-g}.
11215
11216 Level 1 produces minimal information, enough for making backtraces in
11217 parts of the program that you don't plan to debug. This includes
11218 descriptions of functions and external variables, and line number
11219 tables, but no information about local variables.
11220
11221 Level 3 includes extra information, such as all the macro definitions
11222 present in the program. Some debuggers support macro expansion when
11223 you use @option{-g3}.
11224
11225 If you use multiple @option{-g} options, with or without level numbers,
11226 the last such option is the one that is effective.
11227
11228 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11229 confusion with @option{-gdwarf-@var{level}}.
11230 Instead use an additional @option{-g@var{level}} option to change the
11231 debug level for DWARF.
11232
11233 @item -fno-eliminate-unused-debug-symbols
11234 @opindex feliminate-unused-debug-symbols
11235 @opindex fno-eliminate-unused-debug-symbols
11236 By default, no debug information is produced for symbols that are not actually
11237 used. Use this option if you want debug information for all symbols.
11238
11239 @item -femit-class-debug-always
11240 @opindex femit-class-debug-always
11241 Instead of emitting debugging information for a C++ class in only one
11242 object file, emit it in all object files using the class. This option
11243 should be used only with debuggers that are unable to handle the way GCC
11244 normally emits debugging information for classes because using this
11245 option increases the size of debugging information by as much as a
11246 factor of two.
11247
11248 @item -fno-merge-debug-strings
11249 @opindex fmerge-debug-strings
11250 @opindex fno-merge-debug-strings
11251 Direct the linker to not merge together strings in the debugging
11252 information that are identical in different object files. Merging is
11253 not supported by all assemblers or linkers. Merging decreases the size
11254 of the debug information in the output file at the cost of increasing
11255 link processing time. Merging is enabled by default.
11256
11257 @item -fdebug-prefix-map=@var{old}=@var{new}
11258 @opindex fdebug-prefix-map
11259 When compiling files residing in directory @file{@var{old}}, record
11260 debugging information describing them as if the files resided in
11261 directory @file{@var{new}} instead. This can be used to replace a
11262 build-time path with an install-time path in the debug info. It can
11263 also be used to change an absolute path to a relative path by using
11264 @file{.} for @var{new}. This can give more reproducible builds, which
11265 are location independent, but may require an extra command to tell GDB
11266 where to find the source files. See also @option{-ffile-prefix-map}.
11267
11268 @item -fvar-tracking
11269 @opindex fvar-tracking
11270 Run variable tracking pass. It computes where variables are stored at each
11271 position in code. Better debugging information is then generated
11272 (if the debugging information format supports this information).
11273
11274 It is enabled by default when compiling with optimization (@option{-Os},
11275 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11276 the debug info format supports it.
11277
11278 @item -fvar-tracking-assignments
11279 @opindex fvar-tracking-assignments
11280 @opindex fno-var-tracking-assignments
11281 Annotate assignments to user variables early in the compilation and
11282 attempt to carry the annotations over throughout the compilation all the
11283 way to the end, in an attempt to improve debug information while
11284 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
11285
11286 It can be enabled even if var-tracking is disabled, in which case
11287 annotations are created and maintained, but discarded at the end.
11288 By default, this flag is enabled together with @option{-fvar-tracking},
11289 except when selective scheduling is enabled.
11290
11291 @item -gsplit-dwarf
11292 @opindex gsplit-dwarf
11293 If DWARF debugging information is enabled, separate as much debugging
11294 information as possible into a separate output file with the extension
11295 @file{.dwo}. This option allows the build system to avoid linking files with
11296 debug information. To be useful, this option requires a debugger capable of
11297 reading @file{.dwo} files.
11298
11299 @item -gdwarf32
11300 @itemx -gdwarf64
11301 @opindex gdwarf32
11302 @opindex gdwarf64
11303 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11304 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11305 DWARF format. The default is target specific, on most targets it is
11306 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
11307 can't support more than 2GiB of debug information in any of the DWARF
11308 debug information sections. The 64-bit DWARF format allows larger debug
11309 information and might not be well supported by all consumers yet.
11310
11311 @item -gdescribe-dies
11312 @opindex gdescribe-dies
11313 Add description attributes to some DWARF DIEs that have no name attribute,
11314 such as artificial variables, external references and call site
11315 parameter DIEs.
11316
11317 @item -gpubnames
11318 @opindex gpubnames
11319 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11320
11321 @item -ggnu-pubnames
11322 @opindex ggnu-pubnames
11323 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11324 suitable for conversion into a GDB@ index. This option is only useful
11325 with a linker that can produce GDB@ index version 7.
11326
11327 @item -fdebug-types-section
11328 @opindex fdebug-types-section
11329 @opindex fno-debug-types-section
11330 When using DWARF Version 4 or higher, type DIEs can be put into
11331 their own @code{.debug_types} section instead of making them part of the
11332 @code{.debug_info} section. It is more efficient to put them in a separate
11333 comdat section since the linker can then remove duplicates.
11334 But not all DWARF consumers support @code{.debug_types} sections yet
11335 and on some objects @code{.debug_types} produces larger instead of smaller
11336 debugging information.
11337
11338 @item -grecord-gcc-switches
11339 @itemx -gno-record-gcc-switches
11340 @opindex grecord-gcc-switches
11341 @opindex gno-record-gcc-switches
11342 This switch causes the command-line options used to invoke the
11343 compiler that may affect code generation to be appended to the
11344 DW_AT_producer attribute in DWARF debugging information. The options
11345 are concatenated with spaces separating them from each other and from
11346 the compiler version.
11347 It is enabled by default.
11348 See also @option{-frecord-gcc-switches} for another
11349 way of storing compiler options into the object file.
11350
11351 @item -gstrict-dwarf
11352 @opindex gstrict-dwarf
11353 Disallow using extensions of later DWARF standard version than selected
11354 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
11355 DWARF extensions from later standard versions is allowed.
11356
11357 @item -gno-strict-dwarf
11358 @opindex gno-strict-dwarf
11359 Allow using extensions of later DWARF standard version than selected with
11360 @option{-gdwarf-@var{version}}.
11361
11362 @item -gas-loc-support
11363 @opindex gas-loc-support
11364 Inform the compiler that the assembler supports @code{.loc} directives.
11365 It may then use them for the assembler to generate DWARF2+ line number
11366 tables.
11367
11368 This is generally desirable, because assembler-generated line-number
11369 tables are a lot more compact than those the compiler can generate
11370 itself.
11371
11372 This option will be enabled by default if, at GCC configure time, the
11373 assembler was found to support such directives.
11374
11375 @item -gno-as-loc-support
11376 @opindex gno-as-loc-support
11377 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11378 line number tables are to be generated.
11379
11380 @item -gas-locview-support
11381 @opindex gas-locview-support
11382 Inform the compiler that the assembler supports @code{view} assignment
11383 and reset assertion checking in @code{.loc} directives.
11384
11385 This option will be enabled by default if, at GCC configure time, the
11386 assembler was found to support them.
11387
11388 @item -gno-as-locview-support
11389 Force GCC to assign view numbers internally, if
11390 @option{-gvariable-location-views} are explicitly requested.
11391
11392 @item -gcolumn-info
11393 @itemx -gno-column-info
11394 @opindex gcolumn-info
11395 @opindex gno-column-info
11396 Emit location column information into DWARF debugging information, rather
11397 than just file and line.
11398 This option is enabled by default.
11399
11400 @item -gstatement-frontiers
11401 @itemx -gno-statement-frontiers
11402 @opindex gstatement-frontiers
11403 @opindex gno-statement-frontiers
11404 This option causes GCC to create markers in the internal representation
11405 at the beginning of statements, and to keep them roughly in place
11406 throughout compilation, using them to guide the output of @code{is_stmt}
11407 markers in the line number table. This is enabled by default when
11408 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11409 @dots{}), and outputting DWARF 2 debug information at the normal level.
11410
11411 @item -gvariable-location-views
11412 @itemx -gvariable-location-views=incompat5
11413 @itemx -gno-variable-location-views
11414 @opindex gvariable-location-views
11415 @opindex gvariable-location-views=incompat5
11416 @opindex gno-variable-location-views
11417 Augment variable location lists with progressive view numbers implied
11418 from the line number table. This enables debug information consumers to
11419 inspect state at certain points of the program, even if no instructions
11420 associated with the corresponding source locations are present at that
11421 point. If the assembler lacks support for view numbers in line number
11422 tables, this will cause the compiler to emit the line number table,
11423 which generally makes them somewhat less compact. The augmented line
11424 number tables and location lists are fully backward-compatible, so they
11425 can be consumed by debug information consumers that are not aware of
11426 these augmentations, but they won't derive any benefit from them either.
11427
11428 This is enabled by default when outputting DWARF 2 debug information at
11429 the normal level, as long as there is assembler support,
11430 @option{-fvar-tracking-assignments} is enabled and
11431 @option{-gstrict-dwarf} is not. When assembler support is not
11432 available, this may still be enabled, but it will force GCC to output
11433 internal line number tables, and if
11434 @option{-ginternal-reset-location-views} is not enabled, that will most
11435 certainly lead to silently mismatching location views.
11436
11437 There is a proposed representation for view numbers that is not backward
11438 compatible with the location list format introduced in DWARF 5, that can
11439 be enabled with @option{-gvariable-location-views=incompat5}. This
11440 option may be removed in the future, is only provided as a reference
11441 implementation of the proposed representation. Debug information
11442 consumers are not expected to support this extended format, and they
11443 would be rendered unable to decode location lists using it.
11444
11445 @item -ginternal-reset-location-views
11446 @itemx -gno-internal-reset-location-views
11447 @opindex ginternal-reset-location-views
11448 @opindex gno-internal-reset-location-views
11449 Attempt to determine location views that can be omitted from location
11450 view lists. This requires the compiler to have very accurate insn
11451 length estimates, which isn't always the case, and it may cause
11452 incorrect view lists to be generated silently when using an assembler
11453 that does not support location view lists. The GNU assembler will flag
11454 any such error as a @code{view number mismatch}. This is only enabled
11455 on ports that define a reliable estimation function.
11456
11457 @item -ginline-points
11458 @itemx -gno-inline-points
11459 @opindex ginline-points
11460 @opindex gno-inline-points
11461 Generate extended debug information for inlined functions. Location
11462 view tracking markers are inserted at inlined entry points, so that
11463 address and view numbers can be computed and output in debug
11464 information. This can be enabled independently of location views, in
11465 which case the view numbers won't be output, but it can only be enabled
11466 along with statement frontiers, and it is only enabled by default if
11467 location views are enabled.
11468
11469 @item -gz@r{[}=@var{type}@r{]}
11470 @opindex gz
11471 Produce compressed debug sections in DWARF format, if that is supported.
11472 If @var{type} is not given, the default type depends on the capabilities
11473 of the assembler and linker used. @var{type} may be one of
11474 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11475 compression in ELF gABI format). If the linker doesn't support writing
11476 compressed debug sections, the option is rejected. Otherwise, if the
11477 assembler does not support them, @option{-gz} is silently ignored when
11478 producing object files.
11479
11480 @item -femit-struct-debug-baseonly
11481 @opindex femit-struct-debug-baseonly
11482 Emit debug information for struct-like types
11483 only when the base name of the compilation source file
11484 matches the base name of file in which the struct is defined.
11485
11486 This option substantially reduces the size of debugging information,
11487 but at significant potential loss in type information to the debugger.
11488 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11489 See @option{-femit-struct-debug-detailed} for more detailed control.
11490
11491 This option works only with DWARF debug output.
11492
11493 @item -femit-struct-debug-reduced
11494 @opindex femit-struct-debug-reduced
11495 Emit debug information for struct-like types
11496 only when the base name of the compilation source file
11497 matches the base name of file in which the type is defined,
11498 unless the struct is a template or defined in a system header.
11499
11500 This option significantly reduces the size of debugging information,
11501 with some potential loss in type information to the debugger.
11502 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11503 See @option{-femit-struct-debug-detailed} for more detailed control.
11504
11505 This option works only with DWARF debug output.
11506
11507 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11508 @opindex femit-struct-debug-detailed
11509 Specify the struct-like types
11510 for which the compiler generates debug information.
11511 The intent is to reduce duplicate struct debug information
11512 between different object files within the same program.
11513
11514 This option is a detailed version of
11515 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11516 which serves for most needs.
11517
11518 A specification has the syntax@*
11519 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11520
11521 The optional first word limits the specification to
11522 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11523 A struct type is used directly when it is the type of a variable, member.
11524 Indirect uses arise through pointers to structs.
11525 That is, when use of an incomplete struct is valid, the use is indirect.
11526 An example is
11527 @samp{struct one direct; struct two * indirect;}.
11528
11529 The optional second word limits the specification to
11530 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11531 Generic structs are a bit complicated to explain.
11532 For C++, these are non-explicit specializations of template classes,
11533 or non-template classes within the above.
11534 Other programming languages have generics,
11535 but @option{-femit-struct-debug-detailed} does not yet implement them.
11536
11537 The third word specifies the source files for those
11538 structs for which the compiler should emit debug information.
11539 The values @samp{none} and @samp{any} have the normal meaning.
11540 The value @samp{base} means that
11541 the base of name of the file in which the type declaration appears
11542 must match the base of the name of the main compilation file.
11543 In practice, this means that when compiling @file{foo.c}, debug information
11544 is generated for types declared in that file and @file{foo.h},
11545 but not other header files.
11546 The value @samp{sys} means those types satisfying @samp{base}
11547 or declared in system or compiler headers.
11548
11549 You may need to experiment to determine the best settings for your application.
11550
11551 The default is @option{-femit-struct-debug-detailed=all}.
11552
11553 This option works only with DWARF debug output.
11554
11555 @item -fno-dwarf2-cfi-asm
11556 @opindex fdwarf2-cfi-asm
11557 @opindex fno-dwarf2-cfi-asm
11558 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11559 instead of using GAS @code{.cfi_*} directives.
11560
11561 @item -fno-eliminate-unused-debug-types
11562 @opindex feliminate-unused-debug-types
11563 @opindex fno-eliminate-unused-debug-types
11564 Normally, when producing DWARF output, GCC avoids producing debug symbol
11565 output for types that are nowhere used in the source file being compiled.
11566 Sometimes it is useful to have GCC emit debugging
11567 information for all types declared in a compilation
11568 unit, regardless of whether or not they are actually used
11569 in that compilation unit, for example
11570 if, in the debugger, you want to cast a value to a type that is
11571 not actually used in your program (but is declared). More often,
11572 however, this results in a significant amount of wasted space.
11573 @end table
11574
11575 @node Optimize Options
11576 @section Options That Control Optimization
11577 @cindex optimize options
11578 @cindex options, optimization
11579
11580 These options control various sorts of optimizations.
11581
11582 Without any optimization option, the compiler's goal is to reduce the
11583 cost of compilation and to make debugging produce the expected
11584 results. Statements are independent: if you stop the program with a
11585 breakpoint between statements, you can then assign a new value to any
11586 variable or change the program counter to any other statement in the
11587 function and get exactly the results you expect from the source
11588 code.
11589
11590 Turning on optimization flags makes the compiler attempt to improve
11591 the performance and/or code size at the expense of compilation time
11592 and possibly the ability to debug the program.
11593
11594 The compiler performs optimization based on the knowledge it has of the
11595 program. Compiling multiple files at once to a single output file mode allows
11596 the compiler to use information gained from all of the files when compiling
11597 each of them.
11598
11599 Not all optimizations are controlled directly by a flag. Only
11600 optimizations that have a flag are listed in this section.
11601
11602 Most optimizations are completely disabled at @option{-O0} or if an
11603 @option{-O} level is not set on the command line, even if individual
11604 optimization flags are specified. Similarly, @option{-Og} suppresses
11605 many optimization passes.
11606
11607 Depending on the target and how GCC was configured, a slightly different
11608 set of optimizations may be enabled at each @option{-O} level than
11609 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
11610 to find out the exact set of optimizations that are enabled at each level.
11611 @xref{Overall Options}, for examples.
11612
11613 @table @gcctabopt
11614 @item -O
11615 @itemx -O1
11616 @opindex O
11617 @opindex O1
11618 Optimize. Optimizing compilation takes somewhat more time, and a lot
11619 more memory for a large function.
11620
11621 With @option{-O}, the compiler tries to reduce code size and execution
11622 time, without performing any optimizations that take a great deal of
11623 compilation time.
11624
11625 @c Note that in addition to the default_options_table list in opts.cc,
11626 @c several optimization flags default to true but control optimization
11627 @c passes that are explicitly disabled at -O0.
11628
11629 @option{-O} turns on the following optimization flags:
11630
11631 @c Please keep the following list alphabetized.
11632 @gccoptlist{-fauto-inc-dec @gol
11633 -fbranch-count-reg @gol
11634 -fcombine-stack-adjustments @gol
11635 -fcompare-elim @gol
11636 -fcprop-registers @gol
11637 -fdce @gol
11638 -fdefer-pop @gol
11639 -fdelayed-branch @gol
11640 -fdse @gol
11641 -fforward-propagate @gol
11642 -fguess-branch-probability @gol
11643 -fif-conversion @gol
11644 -fif-conversion2 @gol
11645 -finline-functions-called-once @gol
11646 -fipa-modref @gol
11647 -fipa-profile @gol
11648 -fipa-pure-const @gol
11649 -fipa-reference @gol
11650 -fipa-reference-addressable @gol
11651 -fmerge-constants @gol
11652 -fmove-loop-invariants @gol
11653 -fmove-loop-stores@gol
11654 -fomit-frame-pointer @gol
11655 -freorder-blocks @gol
11656 -fshrink-wrap @gol
11657 -fshrink-wrap-separate @gol
11658 -fsplit-wide-types @gol
11659 -fssa-backprop @gol
11660 -fssa-phiopt @gol
11661 -ftree-bit-ccp @gol
11662 -ftree-ccp @gol
11663 -ftree-ch @gol
11664 -ftree-coalesce-vars @gol
11665 -ftree-copy-prop @gol
11666 -ftree-dce @gol
11667 -ftree-dominator-opts @gol
11668 -ftree-dse @gol
11669 -ftree-forwprop @gol
11670 -ftree-fre @gol
11671 -ftree-phiprop @gol
11672 -ftree-pta @gol
11673 -ftree-scev-cprop @gol
11674 -ftree-sink @gol
11675 -ftree-slsr @gol
11676 -ftree-sra @gol
11677 -ftree-ter @gol
11678 -funit-at-a-time}
11679
11680 @item -O2
11681 @opindex O2
11682 Optimize even more. GCC performs nearly all supported optimizations
11683 that do not involve a space-speed tradeoff.
11684 As compared to @option{-O}, this option increases both compilation time
11685 and the performance of the generated code.
11686
11687 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
11688 also turns on the following optimization flags:
11689
11690 @c Please keep the following list alphabetized!
11691 @gccoptlist{-falign-functions -falign-jumps @gol
11692 -falign-labels -falign-loops @gol
11693 -fcaller-saves @gol
11694 -fcode-hoisting @gol
11695 -fcrossjumping @gol
11696 -fcse-follow-jumps -fcse-skip-blocks @gol
11697 -fdelete-null-pointer-checks @gol
11698 -fdevirtualize -fdevirtualize-speculatively @gol
11699 -fexpensive-optimizations @gol
11700 -ffinite-loops @gol
11701 -fgcse -fgcse-lm @gol
11702 -fhoist-adjacent-loads @gol
11703 -finline-functions @gol
11704 -finline-small-functions @gol
11705 -findirect-inlining @gol
11706 -fipa-bit-cp -fipa-cp -fipa-icf @gol
11707 -fipa-ra -fipa-sra -fipa-vrp @gol
11708 -fisolate-erroneous-paths-dereference @gol
11709 -flra-remat @gol
11710 -foptimize-sibling-calls @gol
11711 -foptimize-strlen @gol
11712 -fpartial-inlining @gol
11713 -fpeephole2 @gol
11714 -freorder-blocks-algorithm=stc @gol
11715 -freorder-blocks-and-partition -freorder-functions @gol
11716 -frerun-cse-after-loop @gol
11717 -fschedule-insns -fschedule-insns2 @gol
11718 -fsched-interblock -fsched-spec @gol
11719 -fstore-merging @gol
11720 -fstrict-aliasing @gol
11721 -fthread-jumps @gol
11722 -ftree-builtin-call-dce @gol
11723 -ftree-loop-vectorize @gol
11724 -ftree-pre @gol
11725 -ftree-slp-vectorize @gol
11726 -ftree-switch-conversion -ftree-tail-merge @gol
11727 -ftree-vrp @gol
11728 -fvect-cost-model=very-cheap}
11729
11730 Please note the warning under @option{-fgcse} about
11731 invoking @option{-O2} on programs that use computed gotos.
11732
11733 @item -O3
11734 @opindex O3
11735 Optimize yet more. @option{-O3} turns on all optimizations specified
11736 by @option{-O2} and also turns on the following optimization flags:
11737
11738 @c Please keep the following list alphabetized!
11739 @gccoptlist{-fgcse-after-reload @gol
11740 -fipa-cp-clone
11741 -floop-interchange @gol
11742 -floop-unroll-and-jam @gol
11743 -fpeel-loops @gol
11744 -fpredictive-commoning @gol
11745 -fsplit-loops @gol
11746 -fsplit-paths @gol
11747 -ftree-loop-distribution @gol
11748 -ftree-partial-pre @gol
11749 -funswitch-loops @gol
11750 -fvect-cost-model=dynamic @gol
11751 -fversion-loops-for-strides}
11752
11753 @item -O0
11754 @opindex O0
11755 Reduce compilation time and make debugging produce the expected
11756 results. This is the default.
11757
11758 @item -Os
11759 @opindex Os
11760 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
11761 except those that often increase code size:
11762
11763 @gccoptlist{-falign-functions -falign-jumps @gol
11764 -falign-labels -falign-loops @gol
11765 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
11766
11767 It also enables @option{-finline-functions}, causes the compiler to tune for
11768 code size rather than execution speed, and performs further optimizations
11769 designed to reduce code size.
11770
11771 @item -Ofast
11772 @opindex Ofast
11773 Disregard strict standards compliance. @option{-Ofast} enables all
11774 @option{-O3} optimizations. It also enables optimizations that are not
11775 valid for all standard-compliant programs.
11776 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
11777 and the Fortran-specific @option{-fstack-arrays}, unless
11778 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
11779 It turns off @option{-fsemantic-interposition}.
11780
11781 @item -Og
11782 @opindex Og
11783 Optimize debugging experience. @option{-Og} should be the optimization
11784 level of choice for the standard edit-compile-debug cycle, offering
11785 a reasonable level of optimization while maintaining fast compilation
11786 and a good debugging experience. It is a better choice than @option{-O0}
11787 for producing debuggable code because some compiler passes
11788 that collect debug information are disabled at @option{-O0}.
11789
11790 Like @option{-O0}, @option{-Og} completely disables a number of
11791 optimization passes so that individual options controlling them have
11792 no effect. Otherwise @option{-Og} enables all @option{-O1}
11793 optimization flags except for those that may interfere with debugging:
11794
11795 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
11796 -fdse -fif-conversion -fif-conversion2 @gol
11797 -finline-functions-called-once @gol
11798 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol
11799 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
11800
11801 @item -Oz
11802 @opindex Oz
11803 Optimize aggressively for size rather than speed. This may increase
11804 the number of instructions executed if those instructions require
11805 fewer bytes to encode. @option{-Oz} behaves similarly to @option{-Os}
11806 including enabling most @option{-O2} optimizations.
11807
11808 @end table
11809
11810 If you use multiple @option{-O} options, with or without level numbers,
11811 the last such option is the one that is effective.
11812
11813 Options of the form @option{-f@var{flag}} specify machine-independent
11814 flags. Most flags have both positive and negative forms; the negative
11815 form of @option{-ffoo} is @option{-fno-foo}. In the table
11816 below, only one of the forms is listed---the one you typically
11817 use. You can figure out the other form by either removing @samp{no-}
11818 or adding it.
11819
11820 The following options control specific optimizations. They are either
11821 activated by @option{-O} options or are related to ones that are. You
11822 can use the following flags in the rare cases when ``fine-tuning'' of
11823 optimizations to be performed is desired.
11824
11825 @table @gcctabopt
11826 @item -fno-defer-pop
11827 @opindex fno-defer-pop
11828 @opindex fdefer-pop
11829 For machines that must pop arguments after a function call, always pop
11830 the arguments as soon as each function returns.
11831 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
11832 this allows the compiler to let arguments accumulate on the stack for several
11833 function calls and pop them all at once.
11834
11835 @item -fforward-propagate
11836 @opindex fforward-propagate
11837 Perform a forward propagation pass on RTL@. The pass tries to combine two
11838 instructions and checks if the result can be simplified. If loop unrolling
11839 is active, two passes are performed and the second is scheduled after
11840 loop unrolling.
11841
11842 This option is enabled by default at optimization levels @option{-O1},
11843 @option{-O2}, @option{-O3}, @option{-Os}.
11844
11845 @item -ffp-contract=@var{style}
11846 @opindex ffp-contract
11847 @option{-ffp-contract=off} disables floating-point expression contraction.
11848 @option{-ffp-contract=fast} enables floating-point expression contraction
11849 such as forming of fused multiply-add operations if the target has
11850 native support for them.
11851 @option{-ffp-contract=on} enables floating-point expression contraction
11852 if allowed by the language standard. This is currently not implemented
11853 and treated equal to @option{-ffp-contract=off}.
11854
11855 The default is @option{-ffp-contract=fast}.
11856
11857 @item -fomit-frame-pointer
11858 @opindex fomit-frame-pointer
11859 Omit the frame pointer in functions that don't need one. This avoids the
11860 instructions to save, set up and restore the frame pointer; on many targets
11861 it also makes an extra register available.
11862
11863 On some targets this flag has no effect because the standard calling sequence
11864 always uses a frame pointer, so it cannot be omitted.
11865
11866 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
11867 is used in all functions. Several targets always omit the frame pointer in
11868 leaf functions.
11869
11870 Enabled by default at @option{-O1} and higher.
11871
11872 @item -foptimize-sibling-calls
11873 @opindex foptimize-sibling-calls
11874 Optimize sibling and tail recursive calls.
11875
11876 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11877
11878 @item -foptimize-strlen
11879 @opindex foptimize-strlen
11880 Optimize various standard C string functions (e.g.@: @code{strlen},
11881 @code{strchr} or @code{strcpy}) and
11882 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
11883
11884 Enabled at levels @option{-O2}, @option{-O3}.
11885
11886 @item -fno-inline
11887 @opindex fno-inline
11888 @opindex finline
11889 Do not expand any functions inline apart from those marked with
11890 the @code{always_inline} attribute. This is the default when not
11891 optimizing.
11892
11893 Single functions can be exempted from inlining by marking them
11894 with the @code{noinline} attribute.
11895
11896 @item -finline-small-functions
11897 @opindex finline-small-functions
11898 Integrate functions into their callers when their body is smaller than expected
11899 function call code (so overall size of program gets smaller). The compiler
11900 heuristically decides which functions are simple enough to be worth integrating
11901 in this way. This inlining applies to all functions, even those not declared
11902 inline.
11903
11904 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11905
11906 @item -findirect-inlining
11907 @opindex findirect-inlining
11908 Inline also indirect calls that are discovered to be known at compile
11909 time thanks to previous inlining. This option has any effect only
11910 when inlining itself is turned on by the @option{-finline-functions}
11911 or @option{-finline-small-functions} options.
11912
11913 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11914
11915 @item -finline-functions
11916 @opindex finline-functions
11917 Consider all functions for inlining, even if they are not declared inline.
11918 The compiler heuristically decides which functions are worth integrating
11919 in this way.
11920
11921 If all calls to a given function are integrated, and the function is
11922 declared @code{static}, then the function is normally not output as
11923 assembler code in its own right.
11924
11925 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
11926 by @option{-fprofile-use} and @option{-fauto-profile}.
11927
11928 @item -finline-functions-called-once
11929 @opindex finline-functions-called-once
11930 Consider all @code{static} functions called once for inlining into their
11931 caller even if they are not marked @code{inline}. If a call to a given
11932 function is integrated, then the function is not output as assembler code
11933 in its own right.
11934
11935 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
11936 but not @option{-Og}.
11937
11938 @item -fearly-inlining
11939 @opindex fearly-inlining
11940 Inline functions marked by @code{always_inline} and functions whose body seems
11941 smaller than the function call overhead early before doing
11942 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
11943 makes profiling significantly cheaper and usually inlining faster on programs
11944 having large chains of nested wrapper functions.
11945
11946 Enabled by default.
11947
11948 @item -fipa-sra
11949 @opindex fipa-sra
11950 Perform interprocedural scalar replacement of aggregates, removal of
11951 unused parameters and replacement of parameters passed by reference
11952 by parameters passed by value.
11953
11954 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
11955
11956 @item -finline-limit=@var{n}
11957 @opindex finline-limit
11958 By default, GCC limits the size of functions that can be inlined. This flag
11959 allows coarse control of this limit. @var{n} is the size of functions that
11960 can be inlined in number of pseudo instructions.
11961
11962 Inlining is actually controlled by a number of parameters, which may be
11963 specified individually by using @option{--param @var{name}=@var{value}}.
11964 The @option{-finline-limit=@var{n}} option sets some of these parameters
11965 as follows:
11966
11967 @table @gcctabopt
11968 @item max-inline-insns-single
11969 is set to @var{n}/2.
11970 @item max-inline-insns-auto
11971 is set to @var{n}/2.
11972 @end table
11973
11974 See below for a documentation of the individual
11975 parameters controlling inlining and for the defaults of these parameters.
11976
11977 @emph{Note:} there may be no value to @option{-finline-limit} that results
11978 in default behavior.
11979
11980 @emph{Note:} pseudo instruction represents, in this particular context, an
11981 abstract measurement of function's size. In no way does it represent a count
11982 of assembly instructions and as such its exact meaning might change from one
11983 release to an another.
11984
11985 @item -fno-keep-inline-dllexport
11986 @opindex fno-keep-inline-dllexport
11987 @opindex fkeep-inline-dllexport
11988 This is a more fine-grained version of @option{-fkeep-inline-functions},
11989 which applies only to functions that are declared using the @code{dllexport}
11990 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
11991 Functions}.
11992
11993 @item -fkeep-inline-functions
11994 @opindex fkeep-inline-functions
11995 In C, emit @code{static} functions that are declared @code{inline}
11996 into the object file, even if the function has been inlined into all
11997 of its callers. This switch does not affect functions using the
11998 @code{extern inline} extension in GNU C90@. In C++, emit any and all
11999 inline functions into the object file.
12000
12001 @item -fkeep-static-functions
12002 @opindex fkeep-static-functions
12003 Emit @code{static} functions into the object file, even if the function
12004 is never used.
12005
12006 @item -fkeep-static-consts
12007 @opindex fkeep-static-consts
12008 Emit variables declared @code{static const} when optimization isn't turned
12009 on, even if the variables aren't referenced.
12010
12011 GCC enables this option by default. If you want to force the compiler to
12012 check if a variable is referenced, regardless of whether or not
12013 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12014
12015 @item -fmerge-constants
12016 @opindex fmerge-constants
12017 Attempt to merge identical constants (string constants and floating-point
12018 constants) across compilation units.
12019
12020 This option is the default for optimized compilation if the assembler and
12021 linker support it. Use @option{-fno-merge-constants} to inhibit this
12022 behavior.
12023
12024 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12025
12026 @item -fmerge-all-constants
12027 @opindex fmerge-all-constants
12028 Attempt to merge identical constants and identical variables.
12029
12030 This option implies @option{-fmerge-constants}. In addition to
12031 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12032 arrays or initialized constant variables with integral or floating-point
12033 types. Languages like C or C++ require each variable, including multiple
12034 instances of the same variable in recursive calls, to have distinct locations,
12035 so using this option results in non-conforming
12036 behavior.
12037
12038 @item -fmodulo-sched
12039 @opindex fmodulo-sched
12040 Perform swing modulo scheduling immediately before the first scheduling
12041 pass. This pass looks at innermost loops and reorders their
12042 instructions by overlapping different iterations.
12043
12044 @item -fmodulo-sched-allow-regmoves
12045 @opindex fmodulo-sched-allow-regmoves
12046 Perform more aggressive SMS-based modulo scheduling with register moves
12047 allowed. By setting this flag certain anti-dependences edges are
12048 deleted, which triggers the generation of reg-moves based on the
12049 life-range analysis. This option is effective only with
12050 @option{-fmodulo-sched} enabled.
12051
12052 @item -fno-branch-count-reg
12053 @opindex fno-branch-count-reg
12054 @opindex fbranch-count-reg
12055 Disable the optimization pass that scans for opportunities to use
12056 ``decrement and branch'' instructions on a count register instead of
12057 instruction sequences that decrement a register, compare it against zero, and
12058 then branch based upon the result. This option is only meaningful on
12059 architectures that support such instructions, which include x86, PowerPC,
12060 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
12061 doesn't remove the decrement and branch instructions from the generated
12062 instruction stream introduced by other optimization passes.
12063
12064 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12065 except for @option{-Og}.
12066
12067 @item -fno-function-cse
12068 @opindex fno-function-cse
12069 @opindex ffunction-cse
12070 Do not put function addresses in registers; make each instruction that
12071 calls a constant function contain the function's address explicitly.
12072
12073 This option results in less efficient code, but some strange hacks
12074 that alter the assembler output may be confused by the optimizations
12075 performed when this option is not used.
12076
12077 The default is @option{-ffunction-cse}
12078
12079 @item -fno-zero-initialized-in-bss
12080 @opindex fno-zero-initialized-in-bss
12081 @opindex fzero-initialized-in-bss
12082 If the target supports a BSS section, GCC by default puts variables that
12083 are initialized to zero into BSS@. This can save space in the resulting
12084 code.
12085
12086 This option turns off this behavior because some programs explicitly
12087 rely on variables going to the data section---e.g., so that the
12088 resulting executable can find the beginning of that section and/or make
12089 assumptions based on that.
12090
12091 The default is @option{-fzero-initialized-in-bss}.
12092
12093 @item -fthread-jumps
12094 @opindex fthread-jumps
12095 Perform optimizations that check to see if a jump branches to a
12096 location where another comparison subsumed by the first is found. If
12097 so, the first branch is redirected to either the destination of the
12098 second branch or a point immediately following it, depending on whether
12099 the condition is known to be true or false.
12100
12101 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12102
12103 @item -fsplit-wide-types
12104 @opindex fsplit-wide-types
12105 When using a type that occupies multiple registers, such as @code{long
12106 long} on a 32-bit system, split the registers apart and allocate them
12107 independently. This normally generates better code for those types,
12108 but may make debugging more difficult.
12109
12110 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12111 @option{-Os}.
12112
12113 @item -fsplit-wide-types-early
12114 @opindex fsplit-wide-types-early
12115 Fully split wide types early, instead of very late.
12116 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12117
12118 This is the default on some targets.
12119
12120 @item -fcse-follow-jumps
12121 @opindex fcse-follow-jumps
12122 In common subexpression elimination (CSE), scan through jump instructions
12123 when the target of the jump is not reached by any other path. For
12124 example, when CSE encounters an @code{if} statement with an
12125 @code{else} clause, CSE follows the jump when the condition
12126 tested is false.
12127
12128 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12129
12130 @item -fcse-skip-blocks
12131 @opindex fcse-skip-blocks
12132 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12133 follow jumps that conditionally skip over blocks. When CSE
12134 encounters a simple @code{if} statement with no else clause,
12135 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12136 body of the @code{if}.
12137
12138 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12139
12140 @item -frerun-cse-after-loop
12141 @opindex frerun-cse-after-loop
12142 Re-run common subexpression elimination after loop optimizations are
12143 performed.
12144
12145 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12146
12147 @item -fgcse
12148 @opindex fgcse
12149 Perform a global common subexpression elimination pass.
12150 This pass also performs global constant and copy propagation.
12151
12152 @emph{Note:} When compiling a program using computed gotos, a GCC
12153 extension, you may get better run-time performance if you disable
12154 the global common subexpression elimination pass by adding
12155 @option{-fno-gcse} to the command line.
12156
12157 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12158
12159 @item -fgcse-lm
12160 @opindex fgcse-lm
12161 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12162 attempts to move loads that are only killed by stores into themselves. This
12163 allows a loop containing a load/store sequence to be changed to a load outside
12164 the loop, and a copy/store within the loop.
12165
12166 Enabled by default when @option{-fgcse} is enabled.
12167
12168 @item -fgcse-sm
12169 @opindex fgcse-sm
12170 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12171 global common subexpression elimination. This pass attempts to move
12172 stores out of loops. When used in conjunction with @option{-fgcse-lm},
12173 loops containing a load/store sequence can be changed to a load before
12174 the loop and a store after the loop.
12175
12176 Not enabled at any optimization level.
12177
12178 @item -fgcse-las
12179 @opindex fgcse-las
12180 When @option{-fgcse-las} is enabled, the global common subexpression
12181 elimination pass eliminates redundant loads that come after stores to the
12182 same memory location (both partial and full redundancies).
12183
12184 Not enabled at any optimization level.
12185
12186 @item -fgcse-after-reload
12187 @opindex fgcse-after-reload
12188 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12189 pass is performed after reload. The purpose of this pass is to clean up
12190 redundant spilling.
12191
12192 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12193
12194 @item -faggressive-loop-optimizations
12195 @opindex faggressive-loop-optimizations
12196 This option tells the loop optimizer to use language constraints to
12197 derive bounds for the number of iterations of a loop. This assumes that
12198 loop code does not invoke undefined behavior by for example causing signed
12199 integer overflows or out-of-bound array accesses. The bounds for the
12200 number of iterations of a loop are used to guide loop unrolling and peeling
12201 and loop exit test optimizations.
12202 This option is enabled by default.
12203
12204 @item -funconstrained-commons
12205 @opindex funconstrained-commons
12206 This option tells the compiler that variables declared in common blocks
12207 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12208 prevents certain optimizations that depend on knowing the array bounds.
12209
12210 @item -fcrossjumping
12211 @opindex fcrossjumping
12212 Perform cross-jumping transformation.
12213 This transformation unifies equivalent code and saves code size. The
12214 resulting code may or may not perform better than without cross-jumping.
12215
12216 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12217
12218 @item -fauto-inc-dec
12219 @opindex fauto-inc-dec
12220 Combine increments or decrements of addresses with memory accesses.
12221 This pass is always skipped on architectures that do not have
12222 instructions to support this. Enabled by default at @option{-O1} and
12223 higher on architectures that support this.
12224
12225 @item -fdce
12226 @opindex fdce
12227 Perform dead code elimination (DCE) on RTL@.
12228 Enabled by default at @option{-O1} and higher.
12229
12230 @item -fdse
12231 @opindex fdse
12232 Perform dead store elimination (DSE) on RTL@.
12233 Enabled by default at @option{-O1} and higher.
12234
12235 @item -fif-conversion
12236 @opindex fif-conversion
12237 Attempt to transform conditional jumps into branch-less equivalents. This
12238 includes use of conditional moves, min, max, set flags and abs instructions, and
12239 some tricks doable by standard arithmetics. The use of conditional execution
12240 on chips where it is available is controlled by @option{-fif-conversion2}.
12241
12242 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12243 not with @option{-Og}.
12244
12245 @item -fif-conversion2
12246 @opindex fif-conversion2
12247 Use conditional execution (where available) to transform conditional jumps into
12248 branch-less equivalents.
12249
12250 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12251 not with @option{-Og}.
12252
12253 @item -fdeclone-ctor-dtor
12254 @opindex fdeclone-ctor-dtor
12255 The C++ ABI requires multiple entry points for constructors and
12256 destructors: one for a base subobject, one for a complete object, and
12257 one for a virtual destructor that calls operator delete afterwards.
12258 For a hierarchy with virtual bases, the base and complete variants are
12259 clones, which means two copies of the function. With this option, the
12260 base and complete variants are changed to be thunks that call a common
12261 implementation.
12262
12263 Enabled by @option{-Os}.
12264
12265 @item -fdelete-null-pointer-checks
12266 @opindex fdelete-null-pointer-checks
12267 Assume that programs cannot safely dereference null pointers, and that
12268 no code or data element resides at address zero.
12269 This option enables simple constant
12270 folding optimizations at all optimization levels. In addition, other
12271 optimization passes in GCC use this flag to control global dataflow
12272 analyses that eliminate useless checks for null pointers; these assume
12273 that a memory access to address zero always results in a trap, so
12274 that if a pointer is checked after it has already been dereferenced,
12275 it cannot be null.
12276
12277 Note however that in some environments this assumption is not true.
12278 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12279 for programs that depend on that behavior.
12280
12281 This option is enabled by default on most targets. On Nios II ELF, it
12282 defaults to off. On AVR and MSP430, this option is completely disabled.
12283
12284 Passes that use the dataflow information
12285 are enabled independently at different optimization levels.
12286
12287 @item -fdevirtualize
12288 @opindex fdevirtualize
12289 Attempt to convert calls to virtual functions to direct calls. This
12290 is done both within a procedure and interprocedurally as part of
12291 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12292 propagation (@option{-fipa-cp}).
12293 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12294
12295 @item -fdevirtualize-speculatively
12296 @opindex fdevirtualize-speculatively
12297 Attempt to convert calls to virtual functions to speculative direct calls.
12298 Based on the analysis of the type inheritance graph, determine for a given call
12299 the set of likely targets. If the set is small, preferably of size 1, change
12300 the call into a conditional deciding between direct and indirect calls. The
12301 speculative calls enable more optimizations, such as inlining. When they seem
12302 useless after further optimization, they are converted back into original form.
12303
12304 @item -fdevirtualize-at-ltrans
12305 @opindex fdevirtualize-at-ltrans
12306 Stream extra information needed for aggressive devirtualization when running
12307 the link-time optimizer in local transformation mode.
12308 This option enables more devirtualization but
12309 significantly increases the size of streamed data. For this reason it is
12310 disabled by default.
12311
12312 @item -fexpensive-optimizations
12313 @opindex fexpensive-optimizations
12314 Perform a number of minor optimizations that are relatively expensive.
12315
12316 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12317
12318 @item -free
12319 @opindex free
12320 Attempt to remove redundant extension instructions. This is especially
12321 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12322 registers after writing to their lower 32-bit half.
12323
12324 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
12325 @option{-O3}, @option{-Os}.
12326
12327 @item -fno-lifetime-dse
12328 @opindex fno-lifetime-dse
12329 @opindex flifetime-dse
12330 In C++ the value of an object is only affected by changes within its
12331 lifetime: when the constructor begins, the object has an indeterminate
12332 value, and any changes during the lifetime of the object are dead when
12333 the object is destroyed. Normally dead store elimination will take
12334 advantage of this; if your code relies on the value of the object
12335 storage persisting beyond the lifetime of the object, you can use this
12336 flag to disable this optimization. To preserve stores before the
12337 constructor starts (e.g.@: because your operator new clears the object
12338 storage) but still treat the object as dead after the destructor, you
12339 can use @option{-flifetime-dse=1}. The default behavior can be
12340 explicitly selected with @option{-flifetime-dse=2}.
12341 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12342
12343 @item -flive-range-shrinkage
12344 @opindex flive-range-shrinkage
12345 Attempt to decrease register pressure through register live range
12346 shrinkage. This is helpful for fast processors with small or moderate
12347 size register sets.
12348
12349 @item -fira-algorithm=@var{algorithm}
12350 @opindex fira-algorithm
12351 Use the specified coloring algorithm for the integrated register
12352 allocator. The @var{algorithm} argument can be @samp{priority}, which
12353 specifies Chow's priority coloring, or @samp{CB}, which specifies
12354 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
12355 for all architectures, but for those targets that do support it, it is
12356 the default because it generates better code.
12357
12358 @item -fira-region=@var{region}
12359 @opindex fira-region
12360 Use specified regions for the integrated register allocator. The
12361 @var{region} argument should be one of the following:
12362
12363 @table @samp
12364
12365 @item all
12366 Use all loops as register allocation regions.
12367 This can give the best results for machines with a small and/or
12368 irregular register set.
12369
12370 @item mixed
12371 Use all loops except for loops with small register pressure
12372 as the regions. This value usually gives
12373 the best results in most cases and for most architectures,
12374 and is enabled by default when compiling with optimization for speed
12375 (@option{-O}, @option{-O2}, @dots{}).
12376
12377 @item one
12378 Use all functions as a single region.
12379 This typically results in the smallest code size, and is enabled by default for
12380 @option{-Os} or @option{-O0}.
12381
12382 @end table
12383
12384 @item -fira-hoist-pressure
12385 @opindex fira-hoist-pressure
12386 Use IRA to evaluate register pressure in the code hoisting pass for
12387 decisions to hoist expressions. This option usually results in smaller
12388 code, but it can slow the compiler down.
12389
12390 This option is enabled at level @option{-Os} for all targets.
12391
12392 @item -fira-loop-pressure
12393 @opindex fira-loop-pressure
12394 Use IRA to evaluate register pressure in loops for decisions to move
12395 loop invariants. This option usually results in generation
12396 of faster and smaller code on machines with large register files (>= 32
12397 registers), but it can slow the compiler down.
12398
12399 This option is enabled at level @option{-O3} for some targets.
12400
12401 @item -fno-ira-share-save-slots
12402 @opindex fno-ira-share-save-slots
12403 @opindex fira-share-save-slots
12404 Disable sharing of stack slots used for saving call-used hard
12405 registers living through a call. Each hard register gets a
12406 separate stack slot, and as a result function stack frames are
12407 larger.
12408
12409 @item -fno-ira-share-spill-slots
12410 @opindex fno-ira-share-spill-slots
12411 @opindex fira-share-spill-slots
12412 Disable sharing of stack slots allocated for pseudo-registers. Each
12413 pseudo-register that does not get a hard register gets a separate
12414 stack slot, and as a result function stack frames are larger.
12415
12416 @item -flra-remat
12417 @opindex flra-remat
12418 Enable CFG-sensitive rematerialization in LRA. Instead of loading
12419 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12420 values if it is profitable.
12421
12422 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12423
12424 @item -fdelayed-branch
12425 @opindex fdelayed-branch
12426 If supported for the target machine, attempt to reorder instructions
12427 to exploit instruction slots available after delayed branch
12428 instructions.
12429
12430 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12431 but not at @option{-Og}.
12432
12433 @item -fschedule-insns
12434 @opindex fschedule-insns
12435 If supported for the target machine, attempt to reorder instructions to
12436 eliminate execution stalls due to required data being unavailable. This
12437 helps machines that have slow floating point or memory load instructions
12438 by allowing other instructions to be issued until the result of the load
12439 or floating-point instruction is required.
12440
12441 Enabled at levels @option{-O2}, @option{-O3}.
12442
12443 @item -fschedule-insns2
12444 @opindex fschedule-insns2
12445 Similar to @option{-fschedule-insns}, but requests an additional pass of
12446 instruction scheduling after register allocation has been done. This is
12447 especially useful on machines with a relatively small number of
12448 registers and where memory load instructions take more than one cycle.
12449
12450 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12451
12452 @item -fno-sched-interblock
12453 @opindex fno-sched-interblock
12454 @opindex fsched-interblock
12455 Disable instruction scheduling across basic blocks, which
12456 is normally enabled when scheduling before register allocation, i.e.@:
12457 with @option{-fschedule-insns} or at @option{-O2} or higher.
12458
12459 @item -fno-sched-spec
12460 @opindex fno-sched-spec
12461 @opindex fsched-spec
12462 Disable speculative motion of non-load instructions, which
12463 is normally enabled when scheduling before register allocation, i.e.@:
12464 with @option{-fschedule-insns} or at @option{-O2} or higher.
12465
12466 @item -fsched-pressure
12467 @opindex fsched-pressure
12468 Enable register pressure sensitive insn scheduling before register
12469 allocation. This only makes sense when scheduling before register
12470 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12471 @option{-O2} or higher. Usage of this option can improve the
12472 generated code and decrease its size by preventing register pressure
12473 increase above the number of available hard registers and subsequent
12474 spills in register allocation.
12475
12476 @item -fsched-spec-load
12477 @opindex fsched-spec-load
12478 Allow speculative motion of some load instructions. This only makes
12479 sense when scheduling before register allocation, i.e.@: with
12480 @option{-fschedule-insns} or at @option{-O2} or higher.
12481
12482 @item -fsched-spec-load-dangerous
12483 @opindex fsched-spec-load-dangerous
12484 Allow speculative motion of more load instructions. This only makes
12485 sense when scheduling before register allocation, i.e.@: with
12486 @option{-fschedule-insns} or at @option{-O2} or higher.
12487
12488 @item -fsched-stalled-insns
12489 @itemx -fsched-stalled-insns=@var{n}
12490 @opindex fsched-stalled-insns
12491 Define how many insns (if any) can be moved prematurely from the queue
12492 of stalled insns into the ready list during the second scheduling pass.
12493 @option{-fno-sched-stalled-insns} means that no insns are moved
12494 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12495 on how many queued insns can be moved prematurely.
12496 @option{-fsched-stalled-insns} without a value is equivalent to
12497 @option{-fsched-stalled-insns=1}.
12498
12499 @item -fsched-stalled-insns-dep
12500 @itemx -fsched-stalled-insns-dep=@var{n}
12501 @opindex fsched-stalled-insns-dep
12502 Define how many insn groups (cycles) are examined for a dependency
12503 on a stalled insn that is a candidate for premature removal from the queue
12504 of stalled insns. This has an effect only during the second scheduling pass,
12505 and only if @option{-fsched-stalled-insns} is used.
12506 @option{-fno-sched-stalled-insns-dep} is equivalent to
12507 @option{-fsched-stalled-insns-dep=0}.
12508 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12509 @option{-fsched-stalled-insns-dep=1}.
12510
12511 @item -fsched2-use-superblocks
12512 @opindex fsched2-use-superblocks
12513 When scheduling after register allocation, use superblock scheduling.
12514 This allows motion across basic block boundaries,
12515 resulting in faster schedules. This option is experimental, as not all machine
12516 descriptions used by GCC model the CPU closely enough to avoid unreliable
12517 results from the algorithm.
12518
12519 This only makes sense when scheduling after register allocation, i.e.@: with
12520 @option{-fschedule-insns2} or at @option{-O2} or higher.
12521
12522 @item -fsched-group-heuristic
12523 @opindex fsched-group-heuristic
12524 Enable the group heuristic in the scheduler. This heuristic favors
12525 the instruction that belongs to a schedule group. This is enabled
12526 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12527 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12528
12529 @item -fsched-critical-path-heuristic
12530 @opindex fsched-critical-path-heuristic
12531 Enable the critical-path heuristic in the scheduler. This heuristic favors
12532 instructions on the critical path. This is enabled by default when
12533 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12534 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12535
12536 @item -fsched-spec-insn-heuristic
12537 @opindex fsched-spec-insn-heuristic
12538 Enable the speculative instruction heuristic in the scheduler. This
12539 heuristic favors speculative instructions with greater dependency weakness.
12540 This is enabled by default when scheduling is enabled, i.e.@:
12541 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12542 or at @option{-O2} or higher.
12543
12544 @item -fsched-rank-heuristic
12545 @opindex fsched-rank-heuristic
12546 Enable the rank heuristic in the scheduler. This heuristic favors
12547 the instruction belonging to a basic block with greater size or frequency.
12548 This is enabled by default when scheduling is enabled, i.e.@:
12549 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12550 at @option{-O2} or higher.
12551
12552 @item -fsched-last-insn-heuristic
12553 @opindex fsched-last-insn-heuristic
12554 Enable the last-instruction heuristic in the scheduler. This heuristic
12555 favors the instruction that is less dependent on the last instruction
12556 scheduled. This is enabled by default when scheduling is enabled,
12557 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12558 at @option{-O2} or higher.
12559
12560 @item -fsched-dep-count-heuristic
12561 @opindex fsched-dep-count-heuristic
12562 Enable the dependent-count heuristic in the scheduler. This heuristic
12563 favors the instruction that has more instructions depending on it.
12564 This is enabled by default when scheduling is enabled, i.e.@:
12565 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12566 at @option{-O2} or higher.
12567
12568 @item -freschedule-modulo-scheduled-loops
12569 @opindex freschedule-modulo-scheduled-loops
12570 Modulo scheduling is performed before traditional scheduling. If a loop
12571 is modulo scheduled, later scheduling passes may change its schedule.
12572 Use this option to control that behavior.
12573
12574 @item -fselective-scheduling
12575 @opindex fselective-scheduling
12576 Schedule instructions using selective scheduling algorithm. Selective
12577 scheduling runs instead of the first scheduler pass.
12578
12579 @item -fselective-scheduling2
12580 @opindex fselective-scheduling2
12581 Schedule instructions using selective scheduling algorithm. Selective
12582 scheduling runs instead of the second scheduler pass.
12583
12584 @item -fsel-sched-pipelining
12585 @opindex fsel-sched-pipelining
12586 Enable software pipelining of innermost loops during selective scheduling.
12587 This option has no effect unless one of @option{-fselective-scheduling} or
12588 @option{-fselective-scheduling2} is turned on.
12589
12590 @item -fsel-sched-pipelining-outer-loops
12591 @opindex fsel-sched-pipelining-outer-loops
12592 When pipelining loops during selective scheduling, also pipeline outer loops.
12593 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12594
12595 @item -fsemantic-interposition
12596 @opindex fsemantic-interposition
12597 Some object formats, like ELF, allow interposing of symbols by the
12598 dynamic linker.
12599 This means that for symbols exported from the DSO, the compiler cannot perform
12600 interprocedural propagation, inlining and other optimizations in anticipation
12601 that the function or variable in question may change. While this feature is
12602 useful, for example, to rewrite memory allocation functions by a debugging
12603 implementation, it is expensive in the terms of code quality.
12604 With @option{-fno-semantic-interposition} the compiler assumes that
12605 if interposition happens for functions the overwriting function will have
12606 precisely the same semantics (and side effects).
12607 Similarly if interposition happens
12608 for variables, the constructor of the variable will be the same. The flag
12609 has no effect for functions explicitly declared inline
12610 (where it is never allowed for interposition to change semantics)
12611 and for symbols explicitly declared weak.
12612
12613 @item -fshrink-wrap
12614 @opindex fshrink-wrap
12615 Emit function prologues only before parts of the function that need it,
12616 rather than at the top of the function. This flag is enabled by default at
12617 @option{-O} and higher.
12618
12619 @item -fshrink-wrap-separate
12620 @opindex fshrink-wrap-separate
12621 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12622 those parts are only executed when needed.
12623 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12624 is also turned on and the target supports this.
12625
12626 @item -fcaller-saves
12627 @opindex fcaller-saves
12628 Enable allocation of values to registers that are clobbered by
12629 function calls, by emitting extra instructions to save and restore the
12630 registers around such calls. Such allocation is done only when it
12631 seems to result in better code.
12632
12633 This option is always enabled by default on certain machines, usually
12634 those which have no call-preserved registers to use instead.
12635
12636 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12637
12638 @item -fcombine-stack-adjustments
12639 @opindex fcombine-stack-adjustments
12640 Tracks stack adjustments (pushes and pops) and stack memory references
12641 and then tries to find ways to combine them.
12642
12643 Enabled by default at @option{-O1} and higher.
12644
12645 @item -fipa-ra
12646 @opindex fipa-ra
12647 Use caller save registers for allocation if those registers are not used by
12648 any called function. In that case it is not necessary to save and restore
12649 them around calls. This is only possible if called functions are part of
12650 same compilation unit as current function and they are compiled before it.
12651
12652 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
12653 is disabled if generated code will be instrumented for profiling
12654 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
12655 exactly (this happens on targets that do not expose prologues
12656 and epilogues in RTL).
12657
12658 @item -fconserve-stack
12659 @opindex fconserve-stack
12660 Attempt to minimize stack usage. The compiler attempts to use less
12661 stack space, even if that makes the program slower. This option
12662 implies setting the @option{large-stack-frame} parameter to 100
12663 and the @option{large-stack-frame-growth} parameter to 400.
12664
12665 @item -ftree-reassoc
12666 @opindex ftree-reassoc
12667 Perform reassociation on trees. This flag is enabled by default
12668 at @option{-O1} and higher.
12669
12670 @item -fcode-hoisting
12671 @opindex fcode-hoisting
12672 Perform code hoisting. Code hoisting tries to move the
12673 evaluation of expressions executed on all paths to the function exit
12674 as early as possible. This is especially useful as a code size
12675 optimization, but it often helps for code speed as well.
12676 This flag is enabled by default at @option{-O2} and higher.
12677
12678 @item -ftree-pre
12679 @opindex ftree-pre
12680 Perform partial redundancy elimination (PRE) on trees. This flag is
12681 enabled by default at @option{-O2} and @option{-O3}.
12682
12683 @item -ftree-partial-pre
12684 @opindex ftree-partial-pre
12685 Make partial redundancy elimination (PRE) more aggressive. This flag is
12686 enabled by default at @option{-O3}.
12687
12688 @item -ftree-forwprop
12689 @opindex ftree-forwprop
12690 Perform forward propagation on trees. This flag is enabled by default
12691 at @option{-O1} and higher.
12692
12693 @item -ftree-fre
12694 @opindex ftree-fre
12695 Perform full redundancy elimination (FRE) on trees. The difference
12696 between FRE and PRE is that FRE only considers expressions
12697 that are computed on all paths leading to the redundant computation.
12698 This analysis is faster than PRE, though it exposes fewer redundancies.
12699 This flag is enabled by default at @option{-O1} and higher.
12700
12701 @item -ftree-phiprop
12702 @opindex ftree-phiprop
12703 Perform hoisting of loads from conditional pointers on trees. This
12704 pass is enabled by default at @option{-O1} and higher.
12705
12706 @item -fhoist-adjacent-loads
12707 @opindex fhoist-adjacent-loads
12708 Speculatively hoist loads from both branches of an if-then-else if the
12709 loads are from adjacent locations in the same structure and the target
12710 architecture has a conditional move instruction. This flag is enabled
12711 by default at @option{-O2} and higher.
12712
12713 @item -ftree-copy-prop
12714 @opindex ftree-copy-prop
12715 Perform copy propagation on trees. This pass eliminates unnecessary
12716 copy operations. This flag is enabled by default at @option{-O1} and
12717 higher.
12718
12719 @item -fipa-pure-const
12720 @opindex fipa-pure-const
12721 Discover which functions are pure or constant.
12722 Enabled by default at @option{-O1} and higher.
12723
12724 @item -fipa-reference
12725 @opindex fipa-reference
12726 Discover which static variables do not escape the
12727 compilation unit.
12728 Enabled by default at @option{-O1} and higher.
12729
12730 @item -fipa-reference-addressable
12731 @opindex fipa-reference-addressable
12732 Discover read-only, write-only and non-addressable static variables.
12733 Enabled by default at @option{-O1} and higher.
12734
12735 @item -fipa-stack-alignment
12736 @opindex fipa-stack-alignment
12737 Reduce stack alignment on call sites if possible.
12738 Enabled by default.
12739
12740 @item -fipa-pta
12741 @opindex fipa-pta
12742 Perform interprocedural pointer analysis and interprocedural modification
12743 and reference analysis. This option can cause excessive memory and
12744 compile-time usage on large compilation units. It is not enabled by
12745 default at any optimization level.
12746
12747 @item -fipa-profile
12748 @opindex fipa-profile
12749 Perform interprocedural profile propagation. The functions called only from
12750 cold functions are marked as cold. Also functions executed once (such as
12751 @code{cold}, @code{noreturn}, static constructors or destructors) are
12752 identified. Cold functions and loop less parts of functions executed once are
12753 then optimized for size.
12754 Enabled by default at @option{-O1} and higher.
12755
12756 @item -fipa-modref
12757 @opindex fipa-modref
12758 Perform interprocedural mod/ref analysis. This optimization analyzes the side
12759 effects of functions (memory locations that are modified or referenced) and
12760 enables better optimization across the function call boundary. This flag is
12761 enabled by default at @option{-O1} and higher.
12762
12763 @item -fipa-cp
12764 @opindex fipa-cp
12765 Perform interprocedural constant propagation.
12766 This optimization analyzes the program to determine when values passed
12767 to functions are constants and then optimizes accordingly.
12768 This optimization can substantially increase performance
12769 if the application has constants passed to functions.
12770 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
12771 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12772
12773 @item -fipa-cp-clone
12774 @opindex fipa-cp-clone
12775 Perform function cloning to make interprocedural constant propagation stronger.
12776 When enabled, interprocedural constant propagation performs function cloning
12777 when externally visible function can be called with constant arguments.
12778 Because this optimization can create multiple copies of functions,
12779 it may significantly increase code size
12780 (see @option{--param ipa-cp-unit-growth=@var{value}}).
12781 This flag is enabled by default at @option{-O3}.
12782 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12783
12784 @item -fipa-bit-cp
12785 @opindex fipa-bit-cp
12786 When enabled, perform interprocedural bitwise constant
12787 propagation. This flag is enabled by default at @option{-O2} and
12788 by @option{-fprofile-use} and @option{-fauto-profile}.
12789 It requires that @option{-fipa-cp} is enabled.
12790
12791 @item -fipa-vrp
12792 @opindex fipa-vrp
12793 When enabled, perform interprocedural propagation of value
12794 ranges. This flag is enabled by default at @option{-O2}. It requires
12795 that @option{-fipa-cp} is enabled.
12796
12797 @item -fipa-icf
12798 @opindex fipa-icf
12799 Perform Identical Code Folding for functions and read-only variables.
12800 The optimization reduces code size and may disturb unwind stacks by replacing
12801 a function by equivalent one with a different name. The optimization works
12802 more effectively with link-time optimization enabled.
12803
12804 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
12805 works on different levels and thus the optimizations are not same - there are
12806 equivalences that are found only by GCC and equivalences found only by Gold.
12807
12808 This flag is enabled by default at @option{-O2} and @option{-Os}.
12809
12810 @item -flive-patching=@var{level}
12811 @opindex flive-patching
12812 Control GCC's optimizations to produce output suitable for live-patching.
12813
12814 If the compiler's optimization uses a function's body or information extracted
12815 from its body to optimize/change another function, the latter is called an
12816 impacted function of the former. If a function is patched, its impacted
12817 functions should be patched too.
12818
12819 The impacted functions are determined by the compiler's interprocedural
12820 optimizations. For example, a caller is impacted when inlining a function
12821 into its caller,
12822 cloning a function and changing its caller to call this new clone,
12823 or extracting a function's pureness/constness information to optimize
12824 its direct or indirect callers, etc.
12825
12826 Usually, the more IPA optimizations enabled, the larger the number of
12827 impacted functions for each function. In order to control the number of
12828 impacted functions and more easily compute the list of impacted function,
12829 IPA optimizations can be partially enabled at two different levels.
12830
12831 The @var{level} argument should be one of the following:
12832
12833 @table @samp
12834
12835 @item inline-clone
12836
12837 Only enable inlining and cloning optimizations, which includes inlining,
12838 cloning, interprocedural scalar replacement of aggregates and partial inlining.
12839 As a result, when patching a function, all its callers and its clones'
12840 callers are impacted, therefore need to be patched as well.
12841
12842 @option{-flive-patching=inline-clone} disables the following optimization flags:
12843 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
12844 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
12845 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
12846 -fipa-stack-alignment -fipa-modref}
12847
12848 @item inline-only-static
12849
12850 Only enable inlining of static functions.
12851 As a result, when patching a static function, all its callers are impacted
12852 and so need to be patched as well.
12853
12854 In addition to all the flags that @option{-flive-patching=inline-clone}
12855 disables,
12856 @option{-flive-patching=inline-only-static} disables the following additional
12857 optimization flags:
12858 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
12859
12860 @end table
12861
12862 When @option{-flive-patching} is specified without any value, the default value
12863 is @var{inline-clone}.
12864
12865 This flag is disabled by default.
12866
12867 Note that @option{-flive-patching} is not supported with link-time optimization
12868 (@option{-flto}).
12869
12870 @item -fisolate-erroneous-paths-dereference
12871 @opindex fisolate-erroneous-paths-dereference
12872 Detect paths that trigger erroneous or undefined behavior due to
12873 dereferencing a null pointer. Isolate those paths from the main control
12874 flow and turn the statement with erroneous or undefined behavior into a trap.
12875 This flag is enabled by default at @option{-O2} and higher and depends on
12876 @option{-fdelete-null-pointer-checks} also being enabled.
12877
12878 @item -fisolate-erroneous-paths-attribute
12879 @opindex fisolate-erroneous-paths-attribute
12880 Detect paths that trigger erroneous or undefined behavior due to a null value
12881 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
12882 attribute. Isolate those paths from the main control flow and turn the
12883 statement with erroneous or undefined behavior into a trap. This is not
12884 currently enabled, but may be enabled by @option{-O2} in the future.
12885
12886 @item -ftree-sink
12887 @opindex ftree-sink
12888 Perform forward store motion on trees. This flag is
12889 enabled by default at @option{-O1} and higher.
12890
12891 @item -ftree-bit-ccp
12892 @opindex ftree-bit-ccp
12893 Perform sparse conditional bit constant propagation on trees and propagate
12894 pointer alignment information.
12895 This pass only operates on local scalar variables and is enabled by default
12896 at @option{-O1} and higher, except for @option{-Og}.
12897 It requires that @option{-ftree-ccp} is enabled.
12898
12899 @item -ftree-ccp
12900 @opindex ftree-ccp
12901 Perform sparse conditional constant propagation (CCP) on trees. This
12902 pass only operates on local scalar variables and is enabled by default
12903 at @option{-O1} and higher.
12904
12905 @item -fssa-backprop
12906 @opindex fssa-backprop
12907 Propagate information about uses of a value up the definition chain
12908 in order to simplify the definitions. For example, this pass strips
12909 sign operations if the sign of a value never matters. The flag is
12910 enabled by default at @option{-O1} and higher.
12911
12912 @item -fssa-phiopt
12913 @opindex fssa-phiopt
12914 Perform pattern matching on SSA PHI nodes to optimize conditional
12915 code. This pass is enabled by default at @option{-O1} and higher,
12916 except for @option{-Og}.
12917
12918 @item -ftree-switch-conversion
12919 @opindex ftree-switch-conversion
12920 Perform conversion of simple initializations in a switch to
12921 initializations from a scalar array. This flag is enabled by default
12922 at @option{-O2} and higher.
12923
12924 @item -ftree-tail-merge
12925 @opindex ftree-tail-merge
12926 Look for identical code sequences. When found, replace one with a jump to the
12927 other. This optimization is known as tail merging or cross jumping. This flag
12928 is enabled by default at @option{-O2} and higher. The compilation time
12929 in this pass can
12930 be limited using @option{max-tail-merge-comparisons} parameter and
12931 @option{max-tail-merge-iterations} parameter.
12932
12933 @item -ftree-dce
12934 @opindex ftree-dce
12935 Perform dead code elimination (DCE) on trees. This flag is enabled by
12936 default at @option{-O1} and higher.
12937
12938 @item -ftree-builtin-call-dce
12939 @opindex ftree-builtin-call-dce
12940 Perform conditional dead code elimination (DCE) for calls to built-in functions
12941 that may set @code{errno} but are otherwise free of side effects. This flag is
12942 enabled by default at @option{-O2} and higher if @option{-Os} is not also
12943 specified.
12944
12945 @item -ffinite-loops
12946 @opindex ffinite-loops
12947 @opindex fno-finite-loops
12948 Assume that a loop with an exit will eventually take the exit and not loop
12949 indefinitely. This allows the compiler to remove loops that otherwise have
12950 no side-effects, not considering eventual endless looping as such.
12951
12952 This option is enabled by default at @option{-O2} for C++ with -std=c++11
12953 or higher.
12954
12955 @item -ftree-dominator-opts
12956 @opindex ftree-dominator-opts
12957 Perform a variety of simple scalar cleanups (constant/copy
12958 propagation, redundancy elimination, range propagation and expression
12959 simplification) based on a dominator tree traversal. This also
12960 performs jump threading (to reduce jumps to jumps). This flag is
12961 enabled by default at @option{-O1} and higher.
12962
12963 @item -ftree-dse
12964 @opindex ftree-dse
12965 Perform dead store elimination (DSE) on trees. A dead store is a store into
12966 a memory location that is later overwritten by another store without
12967 any intervening loads. In this case the earlier store can be deleted. This
12968 flag is enabled by default at @option{-O1} and higher.
12969
12970 @item -ftree-ch
12971 @opindex ftree-ch
12972 Perform loop header copying on trees. This is beneficial since it increases
12973 effectiveness of code motion optimizations. It also saves one jump. This flag
12974 is enabled by default at @option{-O1} and higher. It is not enabled
12975 for @option{-Os}, since it usually increases code size.
12976
12977 @item -ftree-loop-optimize
12978 @opindex ftree-loop-optimize
12979 Perform loop optimizations on trees. This flag is enabled by default
12980 at @option{-O1} and higher.
12981
12982 @item -ftree-loop-linear
12983 @itemx -floop-strip-mine
12984 @itemx -floop-block
12985 @opindex ftree-loop-linear
12986 @opindex floop-strip-mine
12987 @opindex floop-block
12988 Perform loop nest optimizations. Same as
12989 @option{-floop-nest-optimize}. To use this code transformation, GCC has
12990 to be configured with @option{--with-isl} to enable the Graphite loop
12991 transformation infrastructure.
12992
12993 @item -fgraphite-identity
12994 @opindex fgraphite-identity
12995 Enable the identity transformation for graphite. For every SCoP we generate
12996 the polyhedral representation and transform it back to gimple. Using
12997 @option{-fgraphite-identity} we can check the costs or benefits of the
12998 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
12999 are also performed by the code generator isl, like index splitting and
13000 dead code elimination in loops.
13001
13002 @item -floop-nest-optimize
13003 @opindex floop-nest-optimize
13004 Enable the isl based loop nest optimizer. This is a generic loop nest
13005 optimizer based on the Pluto optimization algorithms. It calculates a loop
13006 structure optimized for data-locality and parallelism. This option
13007 is experimental.
13008
13009 @item -floop-parallelize-all
13010 @opindex floop-parallelize-all
13011 Use the Graphite data dependence analysis to identify loops that can
13012 be parallelized. Parallelize all the loops that can be analyzed to
13013 not contain loop carried dependences without checking that it is
13014 profitable to parallelize the loops.
13015
13016 @item -ftree-coalesce-vars
13017 @opindex ftree-coalesce-vars
13018 While transforming the program out of the SSA representation, attempt to
13019 reduce copying by coalescing versions of different user-defined
13020 variables, instead of just compiler temporaries. This may severely
13021 limit the ability to debug an optimized program compiled with
13022 @option{-fno-var-tracking-assignments}. In the negated form, this flag
13023 prevents SSA coalescing of user variables. This option is enabled by
13024 default if optimization is enabled, and it does very little otherwise.
13025
13026 @item -ftree-loop-if-convert
13027 @opindex ftree-loop-if-convert
13028 Attempt to transform conditional jumps in the innermost loops to
13029 branch-less equivalents. The intent is to remove control-flow from
13030 the innermost loops in order to improve the ability of the
13031 vectorization pass to handle these loops. This is enabled by default
13032 if vectorization is enabled.
13033
13034 @item -ftree-loop-distribution
13035 @opindex ftree-loop-distribution
13036 Perform loop distribution. This flag can improve cache performance on
13037 big loop bodies and allow further loop optimizations, like
13038 parallelization or vectorization, to take place. For example, the loop
13039 @smallexample
13040 DO I = 1, N
13041 A(I) = B(I) + C
13042 D(I) = E(I) * F
13043 ENDDO
13044 @end smallexample
13045 is transformed to
13046 @smallexample
13047 DO I = 1, N
13048 A(I) = B(I) + C
13049 ENDDO
13050 DO I = 1, N
13051 D(I) = E(I) * F
13052 ENDDO
13053 @end smallexample
13054 This flag is enabled by default at @option{-O3}.
13055 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13056
13057 @item -ftree-loop-distribute-patterns
13058 @opindex ftree-loop-distribute-patterns
13059 Perform loop distribution of patterns that can be code generated with
13060 calls to a library. This flag is enabled by default at @option{-O2} and
13061 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13062
13063 This pass distributes the initialization loops and generates a call to
13064 memset zero. For example, the loop
13065 @smallexample
13066 DO I = 1, N
13067 A(I) = 0
13068 B(I) = A(I) + I
13069 ENDDO
13070 @end smallexample
13071 is transformed to
13072 @smallexample
13073 DO I = 1, N
13074 A(I) = 0
13075 ENDDO
13076 DO I = 1, N
13077 B(I) = A(I) + I
13078 ENDDO
13079 @end smallexample
13080 and the initialization loop is transformed into a call to memset zero.
13081 This flag is enabled by default at @option{-O3}.
13082 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13083
13084 @item -floop-interchange
13085 @opindex floop-interchange
13086 Perform loop interchange outside of graphite. This flag can improve cache
13087 performance on loop nest and allow further loop optimizations, like
13088 vectorization, to take place. For example, the loop
13089 @smallexample
13090 for (int i = 0; i < N; i++)
13091 for (int j = 0; j < N; j++)
13092 for (int k = 0; k < N; k++)
13093 c[i][j] = c[i][j] + a[i][k]*b[k][j];
13094 @end smallexample
13095 is transformed to
13096 @smallexample
13097 for (int i = 0; i < N; i++)
13098 for (int k = 0; k < N; k++)
13099 for (int j = 0; j < N; j++)
13100 c[i][j] = c[i][j] + a[i][k]*b[k][j];
13101 @end smallexample
13102 This flag is enabled by default at @option{-O3}.
13103 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13104
13105 @item -floop-unroll-and-jam
13106 @opindex floop-unroll-and-jam
13107 Apply unroll and jam transformations on feasible loops. In a loop
13108 nest this unrolls the outer loop by some factor and fuses the resulting
13109 multiple inner loops. This flag is enabled by default at @option{-O3}.
13110 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13111
13112 @item -ftree-loop-im
13113 @opindex ftree-loop-im
13114 Perform loop invariant motion on trees. This pass moves only invariants that
13115 are hard to handle at RTL level (function calls, operations that expand to
13116 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
13117 operands of conditions that are invariant out of the loop, so that we can use
13118 just trivial invariantness analysis in loop unswitching. The pass also includes
13119 store motion.
13120
13121 @item -ftree-loop-ivcanon
13122 @opindex ftree-loop-ivcanon
13123 Create a canonical counter for number of iterations in loops for which
13124 determining number of iterations requires complicated analysis. Later
13125 optimizations then may determine the number easily. Useful especially
13126 in connection with unrolling.
13127
13128 @item -ftree-scev-cprop
13129 @opindex ftree-scev-cprop
13130 Perform final value replacement. If a variable is modified in a loop
13131 in such a way that its value when exiting the loop can be determined using
13132 only its initial value and the number of loop iterations, replace uses of
13133 the final value by such a computation, provided it is sufficiently cheap.
13134 This reduces data dependencies and may allow further simplifications.
13135 Enabled by default at @option{-O1} and higher.
13136
13137 @item -fivopts
13138 @opindex fivopts
13139 Perform induction variable optimizations (strength reduction, induction
13140 variable merging and induction variable elimination) on trees.
13141
13142 @item -ftree-parallelize-loops=n
13143 @opindex ftree-parallelize-loops
13144 Parallelize loops, i.e., split their iteration space to run in n threads.
13145 This is only possible for loops whose iterations are independent
13146 and can be arbitrarily reordered. The optimization is only
13147 profitable on multiprocessor machines, for loops that are CPU-intensive,
13148 rather than constrained e.g.@: by memory bandwidth. This option
13149 implies @option{-pthread}, and thus is only supported on targets
13150 that have support for @option{-pthread}.
13151
13152 @item -ftree-pta
13153 @opindex ftree-pta
13154 Perform function-local points-to analysis on trees. This flag is
13155 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13156
13157 @item -ftree-sra
13158 @opindex ftree-sra
13159 Perform scalar replacement of aggregates. This pass replaces structure
13160 references with scalars to prevent committing structures to memory too
13161 early. This flag is enabled by default at @option{-O1} and higher,
13162 except for @option{-Og}.
13163
13164 @item -fstore-merging
13165 @opindex fstore-merging
13166 Perform merging of narrow stores to consecutive memory addresses. This pass
13167 merges contiguous stores of immediate values narrower than a word into fewer
13168 wider stores to reduce the number of instructions. This is enabled by default
13169 at @option{-O2} and higher as well as @option{-Os}.
13170
13171 @item -ftree-ter
13172 @opindex ftree-ter
13173 Perform temporary expression replacement during the SSA->normal phase. Single
13174 use/single def temporaries are replaced at their use location with their
13175 defining expression. This results in non-GIMPLE code, but gives the expanders
13176 much more complex trees to work on resulting in better RTL generation. This is
13177 enabled by default at @option{-O1} and higher.
13178
13179 @item -ftree-slsr
13180 @opindex ftree-slsr
13181 Perform straight-line strength reduction on trees. This recognizes related
13182 expressions involving multiplications and replaces them by less expensive
13183 calculations when possible. This is enabled by default at @option{-O1} and
13184 higher.
13185
13186 @item -ftree-vectorize
13187 @opindex ftree-vectorize
13188 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13189 and @option{-ftree-slp-vectorize} if not explicitly specified.
13190
13191 @item -ftree-loop-vectorize
13192 @opindex ftree-loop-vectorize
13193 Perform loop vectorization on trees. This flag is enabled by default at
13194 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13195 and @option{-fauto-profile}.
13196
13197 @item -ftree-slp-vectorize
13198 @opindex ftree-slp-vectorize
13199 Perform basic block vectorization on trees. This flag is enabled by default at
13200 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13201 and @option{-fauto-profile}.
13202
13203 @item -ftrivial-auto-var-init=@var{choice}
13204 @opindex ftrivial-auto-var-init
13205 Initialize automatic variables with either a pattern or with zeroes to increase
13206 the security and predictability of a program by preventing uninitialized memory
13207 disclosure and use.
13208 GCC still considers an automatic variable that doesn't have an explicit
13209 initializer as uninitialized, @option{-Wuninitialized} and
13210 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13211 warning messages on such automatic variables.
13212 With this option, GCC will also initialize any padding of automatic variables
13213 that have structure or union types to zeroes.
13214 However, the current implementation cannot initialize automatic variables that
13215 are declared between the controlling expression and the first case of a
13216 @code{switch} statement. Using @option{-Wtrivial-auto-var-init} to report all
13217 such cases.
13218
13219 The three values of @var{choice} are:
13220
13221 @itemize @bullet
13222 @item
13223 @samp{uninitialized} doesn't initialize any automatic variables.
13224 This is C and C++'s default.
13225
13226 @item
13227 @samp{pattern} Initialize automatic variables with values which will likely
13228 transform logic bugs into crashes down the line, are easily recognized in a
13229 crash dump and without being values that programmers can rely on for useful
13230 program semantics.
13231 The current value is byte-repeatable pattern with byte "0xFE".
13232 The values used for pattern initialization might be changed in the future.
13233
13234 @item
13235 @samp{zero} Initialize automatic variables with zeroes.
13236 @end itemize
13237
13238 The default is @samp{uninitialized}.
13239
13240 You can control this behavior for a specific variable by using the variable
13241 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13242
13243 @item -fvect-cost-model=@var{model}
13244 @opindex fvect-cost-model
13245 Alter the cost model used for vectorization. The @var{model} argument
13246 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13247 @samp{very-cheap}.
13248 With the @samp{unlimited} model the vectorized code-path is assumed
13249 to be profitable while with the @samp{dynamic} model a runtime check
13250 guards the vectorized code-path to enable it only for iteration
13251 counts that will likely execute faster than when executing the original
13252 scalar loop. The @samp{cheap} model disables vectorization of
13253 loops where doing so would be cost prohibitive for example due to
13254 required runtime checks for data dependence or alignment but otherwise
13255 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
13256 allows vectorization if the vector code would entirely replace the
13257 scalar code that is being vectorized. For example, if each iteration
13258 of a vectorized loop would only be able to handle exactly four iterations
13259 of the scalar loop, the @samp{very-cheap} model would only allow
13260 vectorization if the scalar iteration count is known to be a multiple
13261 of four.
13262
13263 The default cost model depends on other optimization flags and is
13264 either @samp{dynamic} or @samp{cheap}.
13265
13266 @item -fsimd-cost-model=@var{model}
13267 @opindex fsimd-cost-model
13268 Alter the cost model used for vectorization of loops marked with the OpenMP
13269 simd directive. The @var{model} argument should be one of
13270 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
13271 have the same meaning as described in @option{-fvect-cost-model} and by
13272 default a cost model defined with @option{-fvect-cost-model} is used.
13273
13274 @item -ftree-vrp
13275 @opindex ftree-vrp
13276 Perform Value Range Propagation on trees. This is similar to the
13277 constant propagation pass, but instead of values, ranges of values are
13278 propagated. This allows the optimizers to remove unnecessary range
13279 checks like array bound checks and null pointer checks. This is
13280 enabled by default at @option{-O2} and higher. Null pointer check
13281 elimination is only done if @option{-fdelete-null-pointer-checks} is
13282 enabled.
13283
13284 @item -fsplit-paths
13285 @opindex fsplit-paths
13286 Split paths leading to loop backedges. This can improve dead code
13287 elimination and common subexpression elimination. This is enabled by
13288 default at @option{-O3} and above.
13289
13290 @item -fsplit-ivs-in-unroller
13291 @opindex fsplit-ivs-in-unroller
13292 Enables expression of values of induction variables in later iterations
13293 of the unrolled loop using the value in the first iteration. This breaks
13294 long dependency chains, thus improving efficiency of the scheduling passes.
13295
13296 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13297 same effect. However, that is not reliable in cases where the loop body
13298 is more complicated than a single basic block. It also does not work at all
13299 on some architectures due to restrictions in the CSE pass.
13300
13301 This optimization is enabled by default.
13302
13303 @item -fvariable-expansion-in-unroller
13304 @opindex fvariable-expansion-in-unroller
13305 With this option, the compiler creates multiple copies of some
13306 local variables when unrolling a loop, which can result in superior code.
13307
13308 This optimization is enabled by default for PowerPC targets, but disabled
13309 by default otherwise.
13310
13311 @item -fpartial-inlining
13312 @opindex fpartial-inlining
13313 Inline parts of functions. This option has any effect only
13314 when inlining itself is turned on by the @option{-finline-functions}
13315 or @option{-finline-small-functions} options.
13316
13317 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13318
13319 @item -fpredictive-commoning
13320 @opindex fpredictive-commoning
13321 Perform predictive commoning optimization, i.e., reusing computations
13322 (especially memory loads and stores) performed in previous
13323 iterations of loops.
13324
13325 This option is enabled at level @option{-O3}.
13326 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13327
13328 @item -fprefetch-loop-arrays
13329 @opindex fprefetch-loop-arrays
13330 If supported by the target machine, generate instructions to prefetch
13331 memory to improve the performance of loops that access large arrays.
13332
13333 This option may generate better or worse code; results are highly
13334 dependent on the structure of loops within the source code.
13335
13336 Disabled at level @option{-Os}.
13337
13338 @item -fno-printf-return-value
13339 @opindex fno-printf-return-value
13340 @opindex fprintf-return-value
13341 Do not substitute constants for known return value of formatted output
13342 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13343 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
13344 transformation allows GCC to optimize or even eliminate branches based
13345 on the known return value of these functions called with arguments that
13346 are either constant, or whose values are known to be in a range that
13347 makes determining the exact return value possible. For example, when
13348 @option{-fprintf-return-value} is in effect, both the branch and the
13349 body of the @code{if} statement (but not the call to @code{snprint})
13350 can be optimized away when @code{i} is a 32-bit or smaller integer
13351 because the return value is guaranteed to be at most 8.
13352
13353 @smallexample
13354 char buf[9];
13355 if (snprintf (buf, "%08x", i) >= sizeof buf)
13356 @dots{}
13357 @end smallexample
13358
13359 The @option{-fprintf-return-value} option relies on other optimizations
13360 and yields best results with @option{-O2} and above. It works in tandem
13361 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13362 options. The @option{-fprintf-return-value} option is enabled by default.
13363
13364 @item -fno-peephole
13365 @itemx -fno-peephole2
13366 @opindex fno-peephole
13367 @opindex fpeephole
13368 @opindex fno-peephole2
13369 @opindex fpeephole2
13370 Disable any machine-specific peephole optimizations. The difference
13371 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13372 are implemented in the compiler; some targets use one, some use the
13373 other, a few use both.
13374
13375 @option{-fpeephole} is enabled by default.
13376 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13377
13378 @item -fno-guess-branch-probability
13379 @opindex fno-guess-branch-probability
13380 @opindex fguess-branch-probability
13381 Do not guess branch probabilities using heuristics.
13382
13383 GCC uses heuristics to guess branch probabilities if they are
13384 not provided by profiling feedback (@option{-fprofile-arcs}). These
13385 heuristics are based on the control flow graph. If some branch probabilities
13386 are specified by @code{__builtin_expect}, then the heuristics are
13387 used to guess branch probabilities for the rest of the control flow graph,
13388 taking the @code{__builtin_expect} info into account. The interactions
13389 between the heuristics and @code{__builtin_expect} can be complex, and in
13390 some cases, it may be useful to disable the heuristics so that the effects
13391 of @code{__builtin_expect} are easier to understand.
13392
13393 It is also possible to specify expected probability of the expression
13394 with @code{__builtin_expect_with_probability} built-in function.
13395
13396 The default is @option{-fguess-branch-probability} at levels
13397 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13398
13399 @item -freorder-blocks
13400 @opindex freorder-blocks
13401 Reorder basic blocks in the compiled function in order to reduce number of
13402 taken branches and improve code locality.
13403
13404 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13405
13406 @item -freorder-blocks-algorithm=@var{algorithm}
13407 @opindex freorder-blocks-algorithm
13408 Use the specified algorithm for basic block reordering. The
13409 @var{algorithm} argument can be @samp{simple}, which does not increase
13410 code size (except sometimes due to secondary effects like alignment),
13411 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13412 put all often executed code together, minimizing the number of branches
13413 executed by making extra copies of code.
13414
13415 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13416 @samp{stc} at levels @option{-O2}, @option{-O3}.
13417
13418 @item -freorder-blocks-and-partition
13419 @opindex freorder-blocks-and-partition
13420 In addition to reordering basic blocks in the compiled function, in order
13421 to reduce number of taken branches, partitions hot and cold basic blocks
13422 into separate sections of the assembly and @file{.o} files, to improve
13423 paging and cache locality performance.
13424
13425 This optimization is automatically turned off in the presence of
13426 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13427 section attribute and on any architecture that does not support named
13428 sections. When @option{-fsplit-stack} is used this option is not
13429 enabled by default (to avoid linker errors), but may be enabled
13430 explicitly (if using a working linker).
13431
13432 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13433
13434 @item -freorder-functions
13435 @opindex freorder-functions
13436 Reorder functions in the object file in order to
13437 improve code locality. This is implemented by using special
13438 subsections @code{.text.hot} for most frequently executed functions and
13439 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
13440 the linker so object file format must support named sections and linker must
13441 place them in a reasonable way.
13442
13443 This option isn't effective unless you either provide profile feedback
13444 (see @option{-fprofile-arcs} for details) or manually annotate functions with
13445 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13446
13447 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13448
13449 @item -fstrict-aliasing
13450 @opindex fstrict-aliasing
13451 Allow the compiler to assume the strictest aliasing rules applicable to
13452 the language being compiled. For C (and C++), this activates
13453 optimizations based on the type of expressions. In particular, an
13454 object of one type is assumed never to reside at the same address as an
13455 object of a different type, unless the types are almost the same. For
13456 example, an @code{unsigned int} can alias an @code{int}, but not a
13457 @code{void*} or a @code{double}. A character type may alias any other
13458 type.
13459
13460 @anchor{Type-punning}Pay special attention to code like this:
13461 @smallexample
13462 union a_union @{
13463 int i;
13464 double d;
13465 @};
13466
13467 int f() @{
13468 union a_union t;
13469 t.d = 3.0;
13470 return t.i;
13471 @}
13472 @end smallexample
13473 The practice of reading from a different union member than the one most
13474 recently written to (called ``type-punning'') is common. Even with
13475 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13476 is accessed through the union type. So, the code above works as
13477 expected. @xref{Structures unions enumerations and bit-fields
13478 implementation}. However, this code might not:
13479 @smallexample
13480 int f() @{
13481 union a_union t;
13482 int* ip;
13483 t.d = 3.0;
13484 ip = &t.i;
13485 return *ip;
13486 @}
13487 @end smallexample
13488
13489 Similarly, access by taking the address, casting the resulting pointer
13490 and dereferencing the result has undefined behavior, even if the cast
13491 uses a union type, e.g.:
13492 @smallexample
13493 int f() @{
13494 double d = 3.0;
13495 return ((union a_union *) &d)->i;
13496 @}
13497 @end smallexample
13498
13499 The @option{-fstrict-aliasing} option is enabled at levels
13500 @option{-O2}, @option{-O3}, @option{-Os}.
13501
13502 @item -fipa-strict-aliasing
13503 @opindex fipa-strict-aliasing
13504 Controls whether rules of @option{-fstrict-aliasing} are applied across
13505 function boundaries. Note that if multiple functions gets inlined into a
13506 single function the memory accesses are no longer considered to be crossing a
13507 function boundary.
13508
13509 The @option{-fipa-strict-aliasing} option is enabled by default and is
13510 effective only in combination with @option{-fstrict-aliasing}.
13511
13512 @item -falign-functions
13513 @itemx -falign-functions=@var{n}
13514 @itemx -falign-functions=@var{n}:@var{m}
13515 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13516 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13517 @opindex falign-functions
13518 Align the start of functions to the next power-of-two greater than or
13519 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
13520 least the first @var{m} bytes of the function can be fetched by the CPU
13521 without crossing an @var{n}-byte alignment boundary.
13522
13523 If @var{m} is not specified, it defaults to @var{n}.
13524
13525 Examples: @option{-falign-functions=32} aligns functions to the next
13526 32-byte boundary, @option{-falign-functions=24} aligns to the next
13527 32-byte boundary only if this can be done by skipping 23 bytes or less,
13528 @option{-falign-functions=32:7} aligns to the next
13529 32-byte boundary only if this can be done by skipping 6 bytes or less.
13530
13531 The second pair of @var{n2}:@var{m2} values allows you to specify
13532 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13533 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13534 otherwise aligns to the next 32-byte boundary if this can be done
13535 by skipping 2 bytes or less.
13536 If @var{m2} is not specified, it defaults to @var{n2}.
13537
13538 Some assemblers only support this flag when @var{n} is a power of two;
13539 in that case, it is rounded up.
13540
13541 @option{-fno-align-functions} and @option{-falign-functions=1} are
13542 equivalent and mean that functions are not aligned.
13543
13544 If @var{n} is not specified or is zero, use a machine-dependent default.
13545 The maximum allowed @var{n} option value is 65536.
13546
13547 Enabled at levels @option{-O2}, @option{-O3}.
13548
13549 @item -flimit-function-alignment
13550 If this option is enabled, the compiler tries to avoid unnecessarily
13551 overaligning functions. It attempts to instruct the assembler to align
13552 by the amount specified by @option{-falign-functions}, but not to
13553 skip more bytes than the size of the function.
13554
13555 @item -falign-labels
13556 @itemx -falign-labels=@var{n}
13557 @itemx -falign-labels=@var{n}:@var{m}
13558 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13559 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13560 @opindex falign-labels
13561 Align all branch targets to a power-of-two boundary.
13562
13563 Parameters of this option are analogous to the @option{-falign-functions} option.
13564 @option{-fno-align-labels} and @option{-falign-labels=1} are
13565 equivalent and mean that labels are not aligned.
13566
13567 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13568 are greater than this value, then their values are used instead.
13569
13570 If @var{n} is not specified or is zero, use a machine-dependent default
13571 which is very likely to be @samp{1}, meaning no alignment.
13572 The maximum allowed @var{n} option value is 65536.
13573
13574 Enabled at levels @option{-O2}, @option{-O3}.
13575
13576 @item -falign-loops
13577 @itemx -falign-loops=@var{n}
13578 @itemx -falign-loops=@var{n}:@var{m}
13579 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13580 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13581 @opindex falign-loops
13582 Align loops to a power-of-two boundary. If the loops are executed
13583 many times, this makes up for any execution of the dummy padding
13584 instructions.
13585
13586 If @option{-falign-labels} is greater than this value, then its value
13587 is used instead.
13588
13589 Parameters of this option are analogous to the @option{-falign-functions} option.
13590 @option{-fno-align-loops} and @option{-falign-loops=1} are
13591 equivalent and mean that loops are not aligned.
13592 The maximum allowed @var{n} option value is 65536.
13593
13594 If @var{n} is not specified or is zero, use a machine-dependent default.
13595
13596 Enabled at levels @option{-O2}, @option{-O3}.
13597
13598 @item -falign-jumps
13599 @itemx -falign-jumps=@var{n}
13600 @itemx -falign-jumps=@var{n}:@var{m}
13601 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13602 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13603 @opindex falign-jumps
13604 Align branch targets to a power-of-two boundary, for branch targets
13605 where the targets can only be reached by jumping. In this case,
13606 no dummy operations need be executed.
13607
13608 If @option{-falign-labels} is greater than this value, then its value
13609 is used instead.
13610
13611 Parameters of this option are analogous to the @option{-falign-functions} option.
13612 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13613 equivalent and mean that loops are not aligned.
13614
13615 If @var{n} is not specified or is zero, use a machine-dependent default.
13616 The maximum allowed @var{n} option value is 65536.
13617
13618 Enabled at levels @option{-O2}, @option{-O3}.
13619
13620 @item -fno-allocation-dce
13621 @opindex fno-allocation-dce
13622 Do not remove unused C++ allocations in dead code elimination.
13623
13624 @item -fallow-store-data-races
13625 @opindex fallow-store-data-races
13626 Allow the compiler to perform optimizations that may introduce new data races
13627 on stores, without proving that the variable cannot be concurrently accessed
13628 by other threads. Does not affect optimization of local data. It is safe to
13629 use this option if it is known that global data will not be accessed by
13630 multiple threads.
13631
13632 Examples of optimizations enabled by @option{-fallow-store-data-races} include
13633 hoisting or if-conversions that may cause a value that was already in memory
13634 to be re-written with that same value. Such re-writing is safe in a single
13635 threaded context but may be unsafe in a multi-threaded context. Note that on
13636 some processors, if-conversions may be required in order to enable
13637 vectorization.
13638
13639 Enabled at level @option{-Ofast}.
13640
13641 @item -funit-at-a-time
13642 @opindex funit-at-a-time
13643 This option is left for compatibility reasons. @option{-funit-at-a-time}
13644 has no effect, while @option{-fno-unit-at-a-time} implies
13645 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
13646
13647 Enabled by default.
13648
13649 @item -fno-toplevel-reorder
13650 @opindex fno-toplevel-reorder
13651 @opindex ftoplevel-reorder
13652 Do not reorder top-level functions, variables, and @code{asm}
13653 statements. Output them in the same order that they appear in the
13654 input file. When this option is used, unreferenced static variables
13655 are not removed. This option is intended to support existing code
13656 that relies on a particular ordering. For new code, it is better to
13657 use attributes when possible.
13658
13659 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
13660 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
13661 Additionally @option{-fno-toplevel-reorder} implies
13662 @option{-fno-section-anchors}.
13663
13664 @item -funreachable-traps
13665 @opindex funreachable-traps
13666 With this option, the compiler turns calls to
13667 @code{__builtin_unreachable} into traps, instead of using them for
13668 optimization. This also affects any such calls implicitly generated
13669 by the compiler.
13670
13671 This option has the same effect as @option{-fsanitize=unreachable
13672 -fsanitize-trap=unreachable}, but does not affect the values of those
13673 options. If @option{-fsanitize=unreachable} is enabled, that option
13674 takes priority over this one.
13675
13676 This option is enabled by default at @option{-O0} and @option{-Og}.
13677
13678 @item -fweb
13679 @opindex fweb
13680 Constructs webs as commonly used for register allocation purposes and assign
13681 each web individual pseudo register. This allows the register allocation pass
13682 to operate on pseudos directly, but also strengthens several other optimization
13683 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
13684 however, make debugging impossible, since variables no longer stay in a
13685 ``home register''.
13686
13687 Enabled by default with @option{-funroll-loops}.
13688
13689 @item -fwhole-program
13690 @opindex fwhole-program
13691 Assume that the current compilation unit represents the whole program being
13692 compiled. All public functions and variables with the exception of @code{main}
13693 and those merged by attribute @code{externally_visible} become static functions
13694 and in effect are optimized more aggressively by interprocedural optimizers.
13695
13696 This option should not be used in combination with @option{-flto}.
13697 Instead relying on a linker plugin should provide safer and more precise
13698 information.
13699
13700 @item -flto[=@var{n}]
13701 @opindex flto
13702 This option runs the standard link-time optimizer. When invoked
13703 with source code, it generates GIMPLE (one of GCC's internal
13704 representations) and writes it to special ELF sections in the object
13705 file. When the object files are linked together, all the function
13706 bodies are read from these ELF sections and instantiated as if they
13707 had been part of the same translation unit.
13708
13709 To use the link-time optimizer, @option{-flto} and optimization
13710 options should be specified at compile time and during the final link.
13711 It is recommended that you compile all the files participating in the
13712 same link with the same options and also specify those options at
13713 link time.
13714 For example:
13715
13716 @smallexample
13717 gcc -c -O2 -flto foo.c
13718 gcc -c -O2 -flto bar.c
13719 gcc -o myprog -flto -O2 foo.o bar.o
13720 @end smallexample
13721
13722 The first two invocations to GCC save a bytecode representation
13723 of GIMPLE into special ELF sections inside @file{foo.o} and
13724 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
13725 @file{foo.o} and @file{bar.o}, merges the two files into a single
13726 internal image, and compiles the result as usual. Since both
13727 @file{foo.o} and @file{bar.o} are merged into a single image, this
13728 causes all the interprocedural analyses and optimizations in GCC to
13729 work across the two files as if they were a single one. This means,
13730 for example, that the inliner is able to inline functions in
13731 @file{bar.o} into functions in @file{foo.o} and vice-versa.
13732
13733 Another (simpler) way to enable link-time optimization is:
13734
13735 @smallexample
13736 gcc -o myprog -flto -O2 foo.c bar.c
13737 @end smallexample
13738
13739 The above generates bytecode for @file{foo.c} and @file{bar.c},
13740 merges them together into a single GIMPLE representation and optimizes
13741 them as usual to produce @file{myprog}.
13742
13743 The important thing to keep in mind is that to enable link-time
13744 optimizations you need to use the GCC driver to perform the link step.
13745 GCC automatically performs link-time optimization if any of the
13746 objects involved were compiled with the @option{-flto} command-line option.
13747 You can always override
13748 the automatic decision to do link-time optimization
13749 by passing @option{-fno-lto} to the link command.
13750
13751 To make whole program optimization effective, it is necessary to make
13752 certain whole program assumptions. The compiler needs to know
13753 what functions and variables can be accessed by libraries and runtime
13754 outside of the link-time optimized unit. When supported by the linker,
13755 the linker plugin (see @option{-fuse-linker-plugin}) passes information
13756 to the compiler about used and externally visible symbols. When
13757 the linker plugin is not available, @option{-fwhole-program} should be
13758 used to allow the compiler to make these assumptions, which leads
13759 to more aggressive optimization decisions.
13760
13761 When a file is compiled with @option{-flto} without
13762 @option{-fuse-linker-plugin}, the generated object file is larger than
13763 a regular object file because it contains GIMPLE bytecodes and the usual
13764 final code (see @option{-ffat-lto-objects}). This means that
13765 object files with LTO information can be linked as normal object
13766 files; if @option{-fno-lto} is passed to the linker, no
13767 interprocedural optimizations are applied. Note that when
13768 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
13769 but you cannot perform a regular, non-LTO link on them.
13770
13771 When producing the final binary, GCC only
13772 applies link-time optimizations to those files that contain bytecode.
13773 Therefore, you can mix and match object files and libraries with
13774 GIMPLE bytecodes and final object code. GCC automatically selects
13775 which files to optimize in LTO mode and which files to link without
13776 further processing.
13777
13778 Generally, options specified at link time override those
13779 specified at compile time, although in some cases GCC attempts to infer
13780 link-time options from the settings used to compile the input files.
13781
13782 If you do not specify an optimization level option @option{-O} at
13783 link time, then GCC uses the highest optimization level
13784 used when compiling the object files. Note that it is generally
13785 ineffective to specify an optimization level option only at link time and
13786 not at compile time, for two reasons. First, compiling without
13787 optimization suppresses compiler passes that gather information
13788 needed for effective optimization at link time. Second, some early
13789 optimization passes can be performed only at compile time and
13790 not at link time.
13791
13792 There are some code generation flags preserved by GCC when
13793 generating bytecodes, as they need to be used during the final link.
13794 Currently, the following options and their settings are taken from
13795 the first object file that explicitly specifies them:
13796 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
13797 @option{-fgnu-tm} and all the @option{-m} target flags.
13798
13799 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
13800 @option{-fPIE} are combined based on the following scheme:
13801
13802 @smallexample
13803 @option{-fPIC} + @option{-fpic} = @option{-fpic}
13804 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
13805 @option{-fpic/-fPIC} + (no option) = (no option)
13806 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
13807 @option{-fpic} + @option{-fPIE} = @option{-fpie}
13808 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
13809 @end smallexample
13810
13811 Certain ABI-changing flags are required to match in all compilation units,
13812 and trying to override this at link time with a conflicting value
13813 is ignored. This includes options such as @option{-freg-struct-return}
13814 and @option{-fpcc-struct-return}.
13815
13816 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
13817 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
13818 are passed through to the link stage and merged conservatively for
13819 conflicting translation units. Specifically
13820 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
13821 precedence; and for example @option{-ffp-contract=off} takes precedence
13822 over @option{-ffp-contract=fast}. You can override them at link time.
13823
13824 Diagnostic options such as @option{-Wstringop-overflow} are passed
13825 through to the link stage and their setting matches that of the
13826 compile-step at function granularity. Note that this matters only
13827 for diagnostics emitted during optimization. Note that code
13828 transforms such as inlining can lead to warnings being enabled
13829 or disabled for regions if code not consistent with the setting
13830 at compile time.
13831
13832 When you need to pass options to the assembler via @option{-Wa} or
13833 @option{-Xassembler} make sure to either compile such translation
13834 units with @option{-fno-lto} or consistently use the same assembler
13835 options on all translation units. You can alternatively also
13836 specify assembler options at LTO link time.
13837
13838 To enable debug info generation you need to supply @option{-g} at
13839 compile time. If any of the input files at link time were built
13840 with debug info generation enabled the link will enable debug info
13841 generation as well. Any elaborate debug info settings
13842 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
13843 at the linker command line and mixing different settings in different
13844 translation units is discouraged.
13845
13846 If LTO encounters objects with C linkage declared with incompatible
13847 types in separate translation units to be linked together (undefined
13848 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
13849 issued. The behavior is still undefined at run time. Similar
13850 diagnostics may be raised for other languages.
13851
13852 Another feature of LTO is that it is possible to apply interprocedural
13853 optimizations on files written in different languages:
13854
13855 @smallexample
13856 gcc -c -flto foo.c
13857 g++ -c -flto bar.cc
13858 gfortran -c -flto baz.f90
13859 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
13860 @end smallexample
13861
13862 Notice that the final link is done with @command{g++} to get the C++
13863 runtime libraries and @option{-lgfortran} is added to get the Fortran
13864 runtime libraries. In general, when mixing languages in LTO mode, you
13865 should use the same link command options as when mixing languages in a
13866 regular (non-LTO) compilation.
13867
13868 If object files containing GIMPLE bytecode are stored in a library archive, say
13869 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
13870 are using a linker with plugin support. To create static libraries suitable
13871 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
13872 and @command{ranlib};
13873 to show the symbols of object files with GIMPLE bytecode, use
13874 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
13875 and @command{nm} have been compiled with plugin support. At link time, use the
13876 flag @option{-fuse-linker-plugin} to ensure that the library participates in
13877 the LTO optimization process:
13878
13879 @smallexample
13880 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
13881 @end smallexample
13882
13883 With the linker plugin enabled, the linker extracts the needed
13884 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
13885 to make them part of the aggregated GIMPLE image to be optimized.
13886
13887 If you are not using a linker with plugin support and/or do not
13888 enable the linker plugin, then the objects inside @file{libfoo.a}
13889 are extracted and linked as usual, but they do not participate
13890 in the LTO optimization process. In order to make a static library suitable
13891 for both LTO optimization and usual linkage, compile its object files with
13892 @option{-flto} @option{-ffat-lto-objects}.
13893
13894 Link-time optimizations do not require the presence of the whole program to
13895 operate. If the program does not require any symbols to be exported, it is
13896 possible to combine @option{-flto} and @option{-fwhole-program} to allow
13897 the interprocedural optimizers to use more aggressive assumptions which may
13898 lead to improved optimization opportunities.
13899 Use of @option{-fwhole-program} is not needed when linker plugin is
13900 active (see @option{-fuse-linker-plugin}).
13901
13902 The current implementation of LTO makes no
13903 attempt to generate bytecode that is portable between different
13904 types of hosts. The bytecode files are versioned and there is a
13905 strict version check, so bytecode files generated in one version of
13906 GCC do not work with an older or newer version of GCC.
13907
13908 Link-time optimization does not work well with generation of debugging
13909 information on systems other than those using a combination of ELF and
13910 DWARF.
13911
13912 If you specify the optional @var{n}, the optimization and code
13913 generation done at link time is executed in parallel using @var{n}
13914 parallel jobs by utilizing an installed @command{make} program. The
13915 environment variable @env{MAKE} may be used to override the program
13916 used.
13917
13918 You can also specify @option{-flto=jobserver} to use GNU make's
13919 job server mode to determine the number of parallel jobs. This
13920 is useful when the Makefile calling GCC is already executing in parallel.
13921 You must prepend a @samp{+} to the command recipe in the parent Makefile
13922 for this to work. This option likely only works if @env{MAKE} is
13923 GNU make. Even without the option value, GCC tries to automatically
13924 detect a running GNU make's job server.
13925
13926 Use @option{-flto=auto} to use GNU make's job server, if available,
13927 or otherwise fall back to autodetection of the number of CPU threads
13928 present in your system.
13929
13930 @item -flto-partition=@var{alg}
13931 @opindex flto-partition
13932 Specify the partitioning algorithm used by the link-time optimizer.
13933 The value is either @samp{1to1} to specify a partitioning mirroring
13934 the original source files or @samp{balanced} to specify partitioning
13935 into equally sized chunks (whenever possible) or @samp{max} to create
13936 new partition for every symbol where possible. Specifying @samp{none}
13937 as an algorithm disables partitioning and streaming completely.
13938 The default value is @samp{balanced}. While @samp{1to1} can be used
13939 as an workaround for various code ordering issues, the @samp{max}
13940 partitioning is intended for internal testing only.
13941 The value @samp{one} specifies that exactly one partition should be
13942 used while the value @samp{none} bypasses partitioning and executes
13943 the link-time optimization step directly from the WPA phase.
13944
13945 @item -flto-compression-level=@var{n}
13946 @opindex flto-compression-level
13947 This option specifies the level of compression used for intermediate
13948 language written to LTO object files, and is only meaningful in
13949 conjunction with LTO mode (@option{-flto}). GCC currently supports two
13950 LTO compression algorithms. For zstd, valid values are 0 (no compression)
13951 to 19 (maximum compression), while zlib supports values from 0 to 9.
13952 Values outside this range are clamped to either minimum or maximum
13953 of the supported values. If the option is not given,
13954 a default balanced compression setting is used.
13955
13956 @item -fuse-linker-plugin
13957 @opindex fuse-linker-plugin
13958 Enables the use of a linker plugin during link-time optimization. This
13959 option relies on plugin support in the linker, which is available in gold
13960 or in GNU ld 2.21 or newer.
13961
13962 This option enables the extraction of object files with GIMPLE bytecode out
13963 of library archives. This improves the quality of optimization by exposing
13964 more code to the link-time optimizer. This information specifies what
13965 symbols can be accessed externally (by non-LTO object or during dynamic
13966 linking). Resulting code quality improvements on binaries (and shared
13967 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
13968 See @option{-flto} for a description of the effect of this flag and how to
13969 use it.
13970
13971 This option is enabled by default when LTO support in GCC is enabled
13972 and GCC was configured for use with
13973 a linker supporting plugins (GNU ld 2.21 or newer or gold).
13974
13975 @item -ffat-lto-objects
13976 @opindex ffat-lto-objects
13977 Fat LTO objects are object files that contain both the intermediate language
13978 and the object code. This makes them usable for both LTO linking and normal
13979 linking. This option is effective only when compiling with @option{-flto}
13980 and is ignored at link time.
13981
13982 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
13983 requires the complete toolchain to be aware of LTO. It requires a linker with
13984 linker plugin support for basic functionality. Additionally,
13985 @command{nm}, @command{ar} and @command{ranlib}
13986 need to support linker plugins to allow a full-featured build environment
13987 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
13988 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
13989 to these tools. With non fat LTO makefiles need to be modified to use them.
13990
13991 Note that modern binutils provide plugin auto-load mechanism.
13992 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
13993 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
13994 @command{gcc-ranlib}).
13995
13996 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
13997 support.
13998
13999 @item -fcompare-elim
14000 @opindex fcompare-elim
14001 After register allocation and post-register allocation instruction splitting,
14002 identify arithmetic instructions that compute processor flags similar to a
14003 comparison operation based on that arithmetic. If possible, eliminate the
14004 explicit comparison operation.
14005
14006 This pass only applies to certain targets that cannot explicitly represent
14007 the comparison operation before register allocation is complete.
14008
14009 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14010
14011 @item -fcprop-registers
14012 @opindex fcprop-registers
14013 After register allocation and post-register allocation instruction splitting,
14014 perform a copy-propagation pass to try to reduce scheduling dependencies
14015 and occasionally eliminate the copy.
14016
14017 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14018
14019 @item -fprofile-correction
14020 @opindex fprofile-correction
14021 Profiles collected using an instrumented binary for multi-threaded programs may
14022 be inconsistent due to missed counter updates. When this option is specified,
14023 GCC uses heuristics to correct or smooth out such inconsistencies. By
14024 default, GCC emits an error message when an inconsistent profile is detected.
14025
14026 This option is enabled by @option{-fauto-profile}.
14027
14028 @item -fprofile-partial-training
14029 @opindex fprofile-partial-training
14030 With @code{-fprofile-use} all portions of programs not executed during train
14031 run are optimized agressively for size rather than speed. In some cases it is
14032 not practical to train all possible hot paths in the program. (For
14033 example, program may contain functions specific for a given hardware and
14034 trianing may not cover all hardware configurations program is run on.) With
14035 @code{-fprofile-partial-training} profile feedback will be ignored for all
14036 functions not executed during the train run leading them to be optimized as if
14037 they were compiled without profile feedback. This leads to better performance
14038 when train run is not representative but also leads to significantly bigger
14039 code.
14040
14041 @item -fprofile-use
14042 @itemx -fprofile-use=@var{path}
14043 @opindex fprofile-use
14044 Enable profile feedback-directed optimizations,
14045 and the following optimizations, many of which
14046 are generally profitable only with profile feedback available:
14047
14048 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
14049 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
14050 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
14051 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
14052 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
14053 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
14054 -fprofile-reorder-functions}
14055
14056 Before you can use this option, you must first generate profiling information.
14057 @xref{Instrumentation Options}, for information about the
14058 @option{-fprofile-generate} option.
14059
14060 By default, GCC emits an error message if the feedback profiles do not
14061 match the source code. This error can be turned into a warning by using
14062 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
14063 optimized code. Additionally, by default, GCC also emits a warning message if
14064 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14065
14066 If @var{path} is specified, GCC looks at the @var{path} to find
14067 the profile feedback data files. See @option{-fprofile-dir}.
14068
14069 @item -fauto-profile
14070 @itemx -fauto-profile=@var{path}
14071 @opindex fauto-profile
14072 Enable sampling-based feedback-directed optimizations,
14073 and the following optimizations,
14074 many of which are generally profitable only with profile feedback available:
14075
14076 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
14077 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
14078 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
14079 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
14080 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
14081 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
14082 -fprofile-correction}
14083
14084 @var{path} is the name of a file containing AutoFDO profile information.
14085 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14086
14087 Producing an AutoFDO profile data file requires running your program
14088 with the @command{perf} utility on a supported GNU/Linux target system.
14089 For more information, see @uref{https://perf.wiki.kernel.org/}.
14090
14091 E.g.
14092 @smallexample
14093 perf record -e br_inst_retired:near_taken -b -o perf.data \
14094 -- your_program
14095 @end smallexample
14096
14097 Then use the @command{create_gcov} tool to convert the raw profile data
14098 to a format that can be used by GCC.@ You must also supply the
14099 unstripped binary for your program to this tool.
14100 See @uref{https://github.com/google/autofdo}.
14101
14102 E.g.
14103 @smallexample
14104 create_gcov --binary=your_program.unstripped --profile=perf.data \
14105 --gcov=profile.afdo
14106 @end smallexample
14107 @end table
14108
14109 The following options control compiler behavior regarding floating-point
14110 arithmetic. These options trade off between speed and
14111 correctness. All must be specifically enabled.
14112
14113 @table @gcctabopt
14114 @item -ffloat-store
14115 @opindex ffloat-store
14116 Do not store floating-point variables in registers, and inhibit other
14117 options that might change whether a floating-point value is taken from a
14118 register or memory.
14119
14120 @cindex floating-point precision
14121 This option prevents undesirable excess precision on machines such as
14122 the 68000 where the floating registers (of the 68881) keep more
14123 precision than a @code{double} is supposed to have. Similarly for the
14124 x86 architecture. For most programs, the excess precision does only
14125 good, but a few programs rely on the precise definition of IEEE floating
14126 point. Use @option{-ffloat-store} for such programs, after modifying
14127 them to store all pertinent intermediate computations into variables.
14128
14129 @item -fexcess-precision=@var{style}
14130 @opindex fexcess-precision
14131 This option allows further control over excess precision on machines
14132 where floating-point operations occur in a format with more precision or
14133 range than the IEEE standard and interchange floating-point types. By
14134 default, @option{-fexcess-precision=fast} is in effect; this means that
14135 operations may be carried out in a wider precision than the types specified
14136 in the source if that would result in faster code, and it is unpredictable
14137 when rounding to the types specified in the source code takes place.
14138 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14139 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14140 both casts and assignments cause values to be rounded to their
14141 semantic types (whereas @option{-ffloat-store} only affects
14142 assignments). This option is enabled by default for C or C++ if a strict
14143 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14144 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14145 regardless of whether a strict conformance option is used.
14146
14147 @opindex mfpmath
14148 @option{-fexcess-precision=standard} is not implemented for languages
14149 other than C or C++. On the x86, it has no effect if @option{-mfpmath=sse}
14150 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14151 semantics apply without excess precision, and in the latter, rounding
14152 is unpredictable.
14153
14154 @item -ffast-math
14155 @opindex ffast-math
14156 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14157 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14158 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14159 @option{-fexcess-precision=fast}.
14160
14161 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14162
14163 This option is not turned on by any @option{-O} option besides
14164 @option{-Ofast} since it can result in incorrect output for programs
14165 that depend on an exact implementation of IEEE or ISO rules/specifications
14166 for math functions. It may, however, yield faster code for programs
14167 that do not require the guarantees of these specifications.
14168
14169 @item -fno-math-errno
14170 @opindex fno-math-errno
14171 @opindex fmath-errno
14172 Do not set @code{errno} after calling math functions that are executed
14173 with a single instruction, e.g., @code{sqrt}. A program that relies on
14174 IEEE exceptions for math error handling may want to use this flag
14175 for speed while maintaining IEEE arithmetic compatibility.
14176
14177 This option is not turned on by any @option{-O} option since
14178 it can result in incorrect output for programs that depend on
14179 an exact implementation of IEEE or ISO rules/specifications for
14180 math functions. It may, however, yield faster code for programs
14181 that do not require the guarantees of these specifications.
14182
14183 The default is @option{-fmath-errno}.
14184
14185 On Darwin systems, the math library never sets @code{errno}. There is
14186 therefore no reason for the compiler to consider the possibility that
14187 it might, and @option{-fno-math-errno} is the default.
14188
14189 @item -funsafe-math-optimizations
14190 @opindex funsafe-math-optimizations
14191
14192 Allow optimizations for floating-point arithmetic that (a) assume
14193 that arguments and results are valid and (b) may violate IEEE or
14194 ANSI standards. When used at link time, it may include libraries
14195 or startup files that change the default FPU control word or other
14196 similar optimizations.
14197
14198 This option is not turned on by any @option{-O} option since
14199 it can result in incorrect output for programs that depend on
14200 an exact implementation of IEEE or ISO rules/specifications for
14201 math functions. It may, however, yield faster code for programs
14202 that do not require the guarantees of these specifications.
14203 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14204 @option{-fassociative-math} and @option{-freciprocal-math}.
14205
14206 The default is @option{-fno-unsafe-math-optimizations}.
14207
14208 @item -fassociative-math
14209 @opindex fassociative-math
14210
14211 Allow re-association of operands in series of floating-point operations.
14212 This violates the ISO C and C++ language standard by possibly changing
14213 computation result. NOTE: re-ordering may change the sign of zero as
14214 well as ignore NaNs and inhibit or create underflow or overflow (and
14215 thus cannot be used on code that relies on rounding behavior like
14216 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
14217 and thus may not be used when ordered comparisons are required.
14218 This option requires that both @option{-fno-signed-zeros} and
14219 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
14220 much sense with @option{-frounding-math}. For Fortran the option
14221 is automatically enabled when both @option{-fno-signed-zeros} and
14222 @option{-fno-trapping-math} are in effect.
14223
14224 The default is @option{-fno-associative-math}.
14225
14226 @item -freciprocal-math
14227 @opindex freciprocal-math
14228
14229 Allow the reciprocal of a value to be used instead of dividing by
14230 the value if this enables optimizations. For example @code{x / y}
14231 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14232 is subject to common subexpression elimination. Note that this loses
14233 precision and increases the number of flops operating on the value.
14234
14235 The default is @option{-fno-reciprocal-math}.
14236
14237 @item -ffinite-math-only
14238 @opindex ffinite-math-only
14239 Allow optimizations for floating-point arithmetic that assume
14240 that arguments and results are not NaNs or +-Infs.
14241
14242 This option is not turned on by any @option{-O} option since
14243 it can result in incorrect output for programs that depend on
14244 an exact implementation of IEEE or ISO rules/specifications for
14245 math functions. It may, however, yield faster code for programs
14246 that do not require the guarantees of these specifications.
14247
14248 The default is @option{-fno-finite-math-only}.
14249
14250 @item -fno-signed-zeros
14251 @opindex fno-signed-zeros
14252 @opindex fsigned-zeros
14253 Allow optimizations for floating-point arithmetic that ignore the
14254 signedness of zero. IEEE arithmetic specifies the behavior of
14255 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14256 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14257 This option implies that the sign of a zero result isn't significant.
14258
14259 The default is @option{-fsigned-zeros}.
14260
14261 @item -fno-trapping-math
14262 @opindex fno-trapping-math
14263 @opindex ftrapping-math
14264 Compile code assuming that floating-point operations cannot generate
14265 user-visible traps. These traps include division by zero, overflow,
14266 underflow, inexact result and invalid operation. This option requires
14267 that @option{-fno-signaling-nans} be in effect. Setting this option may
14268 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14269
14270 This option should never be turned on by any @option{-O} option since
14271 it can result in incorrect output for programs that depend on
14272 an exact implementation of IEEE or ISO rules/specifications for
14273 math functions.
14274
14275 The default is @option{-ftrapping-math}.
14276
14277 Future versions of GCC may provide finer control of this setting
14278 using C99's @code{FENV_ACCESS} pragma. This command-line option
14279 will be used along with @option{-frounding-math} to specify the
14280 default state for @code{FENV_ACCESS}.
14281
14282 @item -frounding-math
14283 @opindex frounding-math
14284 Disable transformations and optimizations that assume default floating-point
14285 rounding behavior. This is round-to-zero for all floating point
14286 to integer conversions, and round-to-nearest for all other arithmetic
14287 truncations. This option should be specified for programs that change
14288 the FP rounding mode dynamically, or that may be executed with a
14289 non-default rounding mode. This option disables constant folding of
14290 floating-point expressions at compile time (which may be affected by
14291 rounding mode) and arithmetic transformations that are unsafe in the
14292 presence of sign-dependent rounding modes.
14293
14294 The default is @option{-fno-rounding-math}.
14295
14296 This option is experimental and does not currently guarantee to
14297 disable all GCC optimizations that are affected by rounding mode.
14298 Future versions of GCC may provide finer control of this setting
14299 using C99's @code{FENV_ACCESS} pragma. This command-line option
14300 will be used along with @option{-ftrapping-math} to specify the
14301 default state for @code{FENV_ACCESS}.
14302
14303 @item -fsignaling-nans
14304 @opindex fsignaling-nans
14305 Compile code assuming that IEEE signaling NaNs may generate user-visible
14306 traps during floating-point operations. Setting this option disables
14307 optimizations that may change the number of exceptions visible with
14308 signaling NaNs. This option implies @option{-ftrapping-math}.
14309
14310 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14311 be defined.
14312
14313 The default is @option{-fno-signaling-nans}.
14314
14315 This option is experimental and does not currently guarantee to
14316 disable all GCC optimizations that affect signaling NaN behavior.
14317
14318 @item -fno-fp-int-builtin-inexact
14319 @opindex fno-fp-int-builtin-inexact
14320 @opindex ffp-int-builtin-inexact
14321 Do not allow the built-in functions @code{ceil}, @code{floor},
14322 @code{round} and @code{trunc}, and their @code{float} and @code{long
14323 double} variants, to generate code that raises the ``inexact''
14324 floating-point exception for noninteger arguments. ISO C99 and C11
14325 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14326 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14327 ISO C2X, does not allow these functions to do so.
14328
14329 The default is @option{-ffp-int-builtin-inexact}, allowing the
14330 exception to be raised, unless C2X or a later C standard is selected.
14331 This option does nothing unless @option{-ftrapping-math} is in effect.
14332
14333 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14334 generate a call to a library function then the ``inexact'' exception
14335 may be raised if the library implementation does not follow TS 18661.
14336
14337 @item -fsingle-precision-constant
14338 @opindex fsingle-precision-constant
14339 Treat floating-point constants as single precision instead of
14340 implicitly converting them to double-precision constants.
14341
14342 @item -fcx-limited-range
14343 @opindex fcx-limited-range
14344 When enabled, this option states that a range reduction step is not
14345 needed when performing complex division. Also, there is no checking
14346 whether the result of a complex multiplication or division is @code{NaN
14347 + I*NaN}, with an attempt to rescue the situation in that case. The
14348 default is @option{-fno-cx-limited-range}, but is enabled by
14349 @option{-ffast-math}.
14350
14351 This option controls the default setting of the ISO C99
14352 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
14353 all languages.
14354
14355 @item -fcx-fortran-rules
14356 @opindex fcx-fortran-rules
14357 Complex multiplication and division follow Fortran rules. Range
14358 reduction is done as part of complex division, but there is no checking
14359 whether the result of a complex multiplication or division is @code{NaN
14360 + I*NaN}, with an attempt to rescue the situation in that case.
14361
14362 The default is @option{-fno-cx-fortran-rules}.
14363
14364 @end table
14365
14366 The following options control optimizations that may improve
14367 performance, but are not enabled by any @option{-O} options. This
14368 section includes experimental options that may produce broken code.
14369
14370 @table @gcctabopt
14371 @item -fbranch-probabilities
14372 @opindex fbranch-probabilities
14373 After running a program compiled with @option{-fprofile-arcs}
14374 (@pxref{Instrumentation Options}),
14375 you can compile it a second time using
14376 @option{-fbranch-probabilities}, to improve optimizations based on
14377 the number of times each branch was taken. When a program
14378 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14379 counts to a file called @file{@var{sourcename}.gcda} for each source
14380 file. The information in this data file is very dependent on the
14381 structure of the generated code, so you must use the same source code
14382 and the same optimization options for both compilations.
14383 See details about the file naming in @option{-fprofile-arcs}.
14384
14385 With @option{-fbranch-probabilities}, GCC puts a
14386 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14387 These can be used to improve optimization. Currently, they are only
14388 used in one place: in @file{reorg.cc}, instead of guessing which path a
14389 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14390 exactly determine which path is taken more often.
14391
14392 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14393
14394 @item -fprofile-values
14395 @opindex fprofile-values
14396 If combined with @option{-fprofile-arcs}, it adds code so that some
14397 data about values of expressions in the program is gathered.
14398
14399 With @option{-fbranch-probabilities}, it reads back the data gathered
14400 from profiling values of expressions for usage in optimizations.
14401
14402 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14403 @option{-fauto-profile}.
14404
14405 @item -fprofile-reorder-functions
14406 @opindex fprofile-reorder-functions
14407 Function reordering based on profile instrumentation collects
14408 first time of execution of a function and orders these functions
14409 in ascending order.
14410
14411 Enabled with @option{-fprofile-use}.
14412
14413 @item -fvpt
14414 @opindex fvpt
14415 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14416 to add code to gather information about values of expressions.
14417
14418 With @option{-fbranch-probabilities}, it reads back the data gathered
14419 and actually performs the optimizations based on them.
14420 Currently the optimizations include specialization of division operations
14421 using the knowledge about the value of the denominator.
14422
14423 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14424
14425 @item -frename-registers
14426 @opindex frename-registers
14427 Attempt to avoid false dependencies in scheduled code by making use
14428 of registers left over after register allocation. This optimization
14429 most benefits processors with lots of registers. Depending on the
14430 debug information format adopted by the target, however, it can
14431 make debugging impossible, since variables no longer stay in
14432 a ``home register''.
14433
14434 Enabled by default with @option{-funroll-loops}.
14435
14436 @item -fschedule-fusion
14437 @opindex fschedule-fusion
14438 Performs a target dependent pass over the instruction stream to schedule
14439 instructions of same type together because target machine can execute them
14440 more efficiently if they are adjacent to each other in the instruction flow.
14441
14442 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14443
14444 @item -ftracer
14445 @opindex ftracer
14446 Perform tail duplication to enlarge superblock size. This transformation
14447 simplifies the control flow of the function allowing other optimizations to do
14448 a better job.
14449
14450 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14451
14452 @item -funroll-loops
14453 @opindex funroll-loops
14454 Unroll loops whose number of iterations can be determined at compile time or
14455 upon entry to the loop. @option{-funroll-loops} implies
14456 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14457 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14458 a small constant number of iterations). This option makes code larger, and may
14459 or may not make it run faster.
14460
14461 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14462
14463 @item -funroll-all-loops
14464 @opindex funroll-all-loops
14465 Unroll all loops, even if their number of iterations is uncertain when
14466 the loop is entered. This usually makes programs run more slowly.
14467 @option{-funroll-all-loops} implies the same options as
14468 @option{-funroll-loops}.
14469
14470 @item -fpeel-loops
14471 @opindex fpeel-loops
14472 Peels loops for which there is enough information that they do not
14473 roll much (from profile feedback or static analysis). It also turns on
14474 complete loop peeling (i.e.@: complete removal of loops with small constant
14475 number of iterations).
14476
14477 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14478
14479 @item -fmove-loop-invariants
14480 @opindex fmove-loop-invariants
14481 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
14482 at level @option{-O1} and higher, except for @option{-Og}.
14483
14484 @item -fmove-loop-stores
14485 @opindex fmove-loop-stores
14486 Enables the loop store motion pass in the GIMPLE loop optimizer. This
14487 moves invariant stores to after the end of the loop in exchange for
14488 carrying the stored value in a register across the iteration.
14489 Note for this option to have an effect @option{-ftree-loop-im} has to
14490 be enabled as well. Enabled at level @option{-O1} and higher, except
14491 for @option{-Og}.
14492
14493 @item -fsplit-loops
14494 @opindex fsplit-loops
14495 Split a loop into two if it contains a condition that's always true
14496 for one side of the iteration space and false for the other.
14497
14498 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14499
14500 @item -funswitch-loops
14501 @opindex funswitch-loops
14502 Move branches with loop invariant conditions out of the loop, with duplicates
14503 of the loop on both branches (modified according to result of the condition).
14504
14505 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14506
14507 @item -fversion-loops-for-strides
14508 @opindex fversion-loops-for-strides
14509 If a loop iterates over an array with a variable stride, create another
14510 version of the loop that assumes the stride is always one. For example:
14511
14512 @smallexample
14513 for (int i = 0; i < n; ++i)
14514 x[i * stride] = @dots{};
14515 @end smallexample
14516
14517 becomes:
14518
14519 @smallexample
14520 if (stride == 1)
14521 for (int i = 0; i < n; ++i)
14522 x[i] = @dots{};
14523 else
14524 for (int i = 0; i < n; ++i)
14525 x[i * stride] = @dots{};
14526 @end smallexample
14527
14528 This is particularly useful for assumed-shape arrays in Fortran where
14529 (for example) it allows better vectorization assuming contiguous accesses.
14530 This flag is enabled by default at @option{-O3}.
14531 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14532
14533 @item -ffunction-sections
14534 @itemx -fdata-sections
14535 @opindex ffunction-sections
14536 @opindex fdata-sections
14537 Place each function or data item into its own section in the output
14538 file if the target supports arbitrary sections. The name of the
14539 function or the name of the data item determines the section's name
14540 in the output file.
14541
14542 Use these options on systems where the linker can perform optimizations to
14543 improve locality of reference in the instruction space. Most systems using the
14544 ELF object format have linkers with such optimizations. On AIX, the linker
14545 rearranges sections (CSECTs) based on the call graph. The performance impact
14546 varies.
14547
14548 Together with a linker garbage collection (linker @option{--gc-sections}
14549 option) these options may lead to smaller statically-linked executables (after
14550 stripping).
14551
14552 On ELF/DWARF systems these options do not degenerate the quality of the debug
14553 information. There could be issues with other object files/debug info formats.
14554
14555 Only use these options when there are significant benefits from doing so. When
14556 you specify these options, the assembler and linker create larger object and
14557 executable files and are also slower. These options affect code generation.
14558 They prevent optimizations by the compiler and assembler using relative
14559 locations inside a translation unit since the locations are unknown until
14560 link time. An example of such an optimization is relaxing calls to short call
14561 instructions.
14562
14563 @item -fstdarg-opt
14564 @opindex fstdarg-opt
14565 Optimize the prologue of variadic argument functions with respect to usage of
14566 those arguments.
14567
14568 @item -fsection-anchors
14569 @opindex fsection-anchors
14570 Try to reduce the number of symbolic address calculations by using
14571 shared ``anchor'' symbols to address nearby objects. This transformation
14572 can help to reduce the number of GOT entries and GOT accesses on some
14573 targets.
14574
14575 For example, the implementation of the following function @code{foo}:
14576
14577 @smallexample
14578 static int a, b, c;
14579 int foo (void) @{ return a + b + c; @}
14580 @end smallexample
14581
14582 @noindent
14583 usually calculates the addresses of all three variables, but if you
14584 compile it with @option{-fsection-anchors}, it accesses the variables
14585 from a common anchor point instead. The effect is similar to the
14586 following pseudocode (which isn't valid C):
14587
14588 @smallexample
14589 int foo (void)
14590 @{
14591 register int *xr = &x;
14592 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14593 @}
14594 @end smallexample
14595
14596 Not all targets support this option.
14597
14598 @item -fzero-call-used-regs=@var{choice}
14599 @opindex fzero-call-used-regs
14600 Zero call-used registers at function return to increase program
14601 security by either mitigating Return-Oriented Programming (ROP)
14602 attacks or preventing information leakage through registers.
14603
14604 The possible values of @var{choice} are the same as for the
14605 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14606 The default is @samp{skip}.
14607
14608 You can control this behavior for a specific function by using the function
14609 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14610
14611 @item --param @var{name}=@var{value}
14612 @opindex param
14613 In some places, GCC uses various constants to control the amount of
14614 optimization that is done. For example, GCC does not inline functions
14615 that contain more than a certain number of instructions. You can
14616 control some of these constants on the command line using the
14617 @option{--param} option.
14618
14619 The names of specific parameters, and the meaning of the values, are
14620 tied to the internals of the compiler, and are subject to change
14621 without notice in future releases.
14622
14623 In order to get minimal, maximal and default value of a parameter,
14624 one can use @option{--help=param -Q} options.
14625
14626 In each case, the @var{value} is an integer. The following choices
14627 of @var{name} are recognized for all targets:
14628
14629 @table @gcctabopt
14630 @item predictable-branch-outcome
14631 When branch is predicted to be taken with probability lower than this threshold
14632 (in percent), then it is considered well predictable.
14633
14634 @item max-rtl-if-conversion-insns
14635 RTL if-conversion tries to remove conditional branches around a block and
14636 replace them with conditionally executed instructions. This parameter
14637 gives the maximum number of instructions in a block which should be
14638 considered for if-conversion. The compiler will
14639 also use other heuristics to decide whether if-conversion is likely to be
14640 profitable.
14641
14642 @item max-rtl-if-conversion-predictable-cost
14643 RTL if-conversion will try to remove conditional branches around a block
14644 and replace them with conditionally executed instructions. These parameters
14645 give the maximum permissible cost for the sequence that would be generated
14646 by if-conversion depending on whether the branch is statically determined
14647 to be predictable or not. The units for this parameter are the same as
14648 those for the GCC internal seq_cost metric. The compiler will try to
14649 provide a reasonable default for this parameter using the BRANCH_COST
14650 target macro.
14651
14652 @item max-crossjump-edges
14653 The maximum number of incoming edges to consider for cross-jumping.
14654 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
14655 the number of edges incoming to each block. Increasing values mean
14656 more aggressive optimization, making the compilation time increase with
14657 probably small improvement in executable size.
14658
14659 @item min-crossjump-insns
14660 The minimum number of instructions that must be matched at the end
14661 of two blocks before cross-jumping is performed on them. This
14662 value is ignored in the case where all instructions in the block being
14663 cross-jumped from are matched.
14664
14665 @item max-grow-copy-bb-insns
14666 The maximum code size expansion factor when copying basic blocks
14667 instead of jumping. The expansion is relative to a jump instruction.
14668
14669 @item max-goto-duplication-insns
14670 The maximum number of instructions to duplicate to a block that jumps
14671 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
14672 passes, GCC factors computed gotos early in the compilation process,
14673 and unfactors them as late as possible. Only computed jumps at the
14674 end of a basic blocks with no more than max-goto-duplication-insns are
14675 unfactored.
14676
14677 @item max-delay-slot-insn-search
14678 The maximum number of instructions to consider when looking for an
14679 instruction to fill a delay slot. If more than this arbitrary number of
14680 instructions are searched, the time savings from filling the delay slot
14681 are minimal, so stop searching. Increasing values mean more
14682 aggressive optimization, making the compilation time increase with probably
14683 small improvement in execution time.
14684
14685 @item max-delay-slot-live-search
14686 When trying to fill delay slots, the maximum number of instructions to
14687 consider when searching for a block with valid live register
14688 information. Increasing this arbitrarily chosen value means more
14689 aggressive optimization, increasing the compilation time. This parameter
14690 should be removed when the delay slot code is rewritten to maintain the
14691 control-flow graph.
14692
14693 @item max-gcse-memory
14694 The approximate maximum amount of memory in @code{kB} that can be allocated in
14695 order to perform the global common subexpression elimination
14696 optimization. If more memory than specified is required, the
14697 optimization is not done.
14698
14699 @item max-gcse-insertion-ratio
14700 If the ratio of expression insertions to deletions is larger than this value
14701 for any expression, then RTL PRE inserts or removes the expression and thus
14702 leaves partially redundant computations in the instruction stream.
14703
14704 @item max-pending-list-length
14705 The maximum number of pending dependencies scheduling allows
14706 before flushing the current state and starting over. Large functions
14707 with few branches or calls can create excessively large lists which
14708 needlessly consume memory and resources.
14709
14710 @item max-modulo-backtrack-attempts
14711 The maximum number of backtrack attempts the scheduler should make
14712 when modulo scheduling a loop. Larger values can exponentially increase
14713 compilation time.
14714
14715 @item max-inline-functions-called-once-loop-depth
14716 Maximal loop depth of a call considered by inline heuristics that tries to
14717 inline all functions called once.
14718
14719 @item max-inline-functions-called-once-insns
14720 Maximal estimated size of functions produced while inlining functions called
14721 once.
14722
14723 @item max-inline-insns-single
14724 Several parameters control the tree inliner used in GCC@. This number sets the
14725 maximum number of instructions (counted in GCC's internal representation) in a
14726 single function that the tree inliner considers for inlining. This only
14727 affects functions declared inline and methods implemented in a class
14728 declaration (C++).
14729
14730
14731 @item max-inline-insns-auto
14732 When you use @option{-finline-functions} (included in @option{-O3}),
14733 a lot of functions that would otherwise not be considered for inlining
14734 by the compiler are investigated. To those functions, a different
14735 (more restrictive) limit compared to functions declared inline can
14736 be applied (@option{--param max-inline-insns-auto}).
14737
14738 @item max-inline-insns-small
14739 This is bound applied to calls which are considered relevant with
14740 @option{-finline-small-functions}.
14741
14742 @item max-inline-insns-size
14743 This is bound applied to calls which are optimized for size. Small growth
14744 may be desirable to anticipate optimization oppurtunities exposed by inlining.
14745
14746 @item uninlined-function-insns
14747 Number of instructions accounted by inliner for function overhead such as
14748 function prologue and epilogue.
14749
14750 @item uninlined-function-time
14751 Extra time accounted by inliner for function overhead such as time needed to
14752 execute function prologue and epilogue.
14753
14754 @item inline-heuristics-hint-percent
14755 The scale (in percents) applied to @option{inline-insns-single},
14756 @option{inline-insns-single-O2}, @option{inline-insns-auto}
14757 when inline heuristics hints that inlining is
14758 very profitable (will enable later optimizations).
14759
14760 @item uninlined-thunk-insns
14761 @item uninlined-thunk-time
14762 Same as @option{--param uninlined-function-insns} and
14763 @option{--param uninlined-function-time} but applied to function thunks.
14764
14765 @item inline-min-speedup
14766 When estimated performance improvement of caller + callee runtime exceeds this
14767 threshold (in percent), the function can be inlined regardless of the limit on
14768 @option{--param max-inline-insns-single} and @option{--param
14769 max-inline-insns-auto}.
14770
14771 @item large-function-insns
14772 The limit specifying really large functions. For functions larger than this
14773 limit after inlining, inlining is constrained by
14774 @option{--param large-function-growth}. This parameter is useful primarily
14775 to avoid extreme compilation time caused by non-linear algorithms used by the
14776 back end.
14777
14778 @item large-function-growth
14779 Specifies maximal growth of large function caused by inlining in percents.
14780 For example, parameter value 100 limits large function growth to 2.0 times
14781 the original size.
14782
14783 @item large-unit-insns
14784 The limit specifying large translation unit. Growth caused by inlining of
14785 units larger than this limit is limited by @option{--param inline-unit-growth}.
14786 For small units this might be too tight.
14787 For example, consider a unit consisting of function A
14788 that is inline and B that just calls A three times. If B is small relative to
14789 A, the growth of unit is 300\% and yet such inlining is very sane. For very
14790 large units consisting of small inlineable functions, however, the overall unit
14791 growth limit is needed to avoid exponential explosion of code size. Thus for
14792 smaller units, the size is increased to @option{--param large-unit-insns}
14793 before applying @option{--param inline-unit-growth}.
14794
14795 @item lazy-modules
14796 Maximum number of concurrently open C++ module files when lazy loading.
14797
14798 @item inline-unit-growth
14799 Specifies maximal overall growth of the compilation unit caused by inlining.
14800 For example, parameter value 20 limits unit growth to 1.2 times the original
14801 size. Cold functions (either marked cold via an attribute or by profile
14802 feedback) are not accounted into the unit size.
14803
14804 @item ipa-cp-unit-growth
14805 Specifies maximal overall growth of the compilation unit caused by
14806 interprocedural constant propagation. For example, parameter value 10 limits
14807 unit growth to 1.1 times the original size.
14808
14809 @item ipa-cp-large-unit-insns
14810 The size of translation unit that IPA-CP pass considers large.
14811
14812 @item large-stack-frame
14813 The limit specifying large stack frames. While inlining the algorithm is trying
14814 to not grow past this limit too much.
14815
14816 @item large-stack-frame-growth
14817 Specifies maximal growth of large stack frames caused by inlining in percents.
14818 For example, parameter value 1000 limits large stack frame growth to 11 times
14819 the original size.
14820
14821 @item max-inline-insns-recursive
14822 @itemx max-inline-insns-recursive-auto
14823 Specifies the maximum number of instructions an out-of-line copy of a
14824 self-recursive inline
14825 function can grow into by performing recursive inlining.
14826
14827 @option{--param max-inline-insns-recursive} applies to functions
14828 declared inline.
14829 For functions not declared inline, recursive inlining
14830 happens only when @option{-finline-functions} (included in @option{-O3}) is
14831 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
14832
14833 @item max-inline-recursive-depth
14834 @itemx max-inline-recursive-depth-auto
14835 Specifies the maximum recursion depth used for recursive inlining.
14836
14837 @option{--param max-inline-recursive-depth} applies to functions
14838 declared inline. For functions not declared inline, recursive inlining
14839 happens only when @option{-finline-functions} (included in @option{-O3}) is
14840 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
14841
14842 @item min-inline-recursive-probability
14843 Recursive inlining is profitable only for function having deep recursion
14844 in average and can hurt for function having little recursion depth by
14845 increasing the prologue size or complexity of function body to other
14846 optimizers.
14847
14848 When profile feedback is available (see @option{-fprofile-generate}) the actual
14849 recursion depth can be guessed from the probability that function recurses
14850 via a given call expression. This parameter limits inlining only to call
14851 expressions whose probability exceeds the given threshold (in percents).
14852
14853 @item early-inlining-insns
14854 Specify growth that the early inliner can make. In effect it increases
14855 the amount of inlining for code having a large abstraction penalty.
14856
14857 @item max-early-inliner-iterations
14858 Limit of iterations of the early inliner. This basically bounds
14859 the number of nested indirect calls the early inliner can resolve.
14860 Deeper chains are still handled by late inlining.
14861
14862 @item comdat-sharing-probability
14863 Probability (in percent) that C++ inline function with comdat visibility
14864 are shared across multiple compilation units.
14865
14866 @item modref-max-bases
14867 @item modref-max-refs
14868 @item modref-max-accesses
14869 Specifies the maximal number of base pointers, references and accesses stored
14870 for a single function by mod/ref analysis.
14871
14872 @item modref-max-tests
14873 Specifies the maxmal number of tests alias oracle can perform to disambiguate
14874 memory locations using the mod/ref information. This parameter ought to be
14875 bigger than @option{--param modref-max-bases} and @option{--param
14876 modref-max-refs}.
14877
14878 @item modref-max-depth
14879 Specifies the maximum depth of DFS walk used by modref escape analysis.
14880 Setting to 0 disables the analysis completely.
14881
14882 @item modref-max-escape-points
14883 Specifies the maximum number of escape points tracked by modref per SSA-name.
14884
14885 @item modref-max-adjustments
14886 Specifies the maximum number the access range is enlarged during modref dataflow
14887 analysis.
14888
14889 @item profile-func-internal-id
14890 A parameter to control whether to use function internal id in profile
14891 database lookup. If the value is 0, the compiler uses an id that
14892 is based on function assembler name and filename, which makes old profile
14893 data more tolerant to source changes such as function reordering etc.
14894
14895 @item min-vect-loop-bound
14896 The minimum number of iterations under which loops are not vectorized
14897 when @option{-ftree-vectorize} is used. The number of iterations after
14898 vectorization needs to be greater than the value specified by this option
14899 to allow vectorization.
14900
14901 @item gcse-cost-distance-ratio
14902 Scaling factor in calculation of maximum distance an expression
14903 can be moved by GCSE optimizations. This is currently supported only in the
14904 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
14905 is with simple expressions, i.e., the expressions that have cost
14906 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
14907 hoisting of simple expressions.
14908
14909 @item gcse-unrestricted-cost
14910 Cost, roughly measured as the cost of a single typical machine
14911 instruction, at which GCSE optimizations do not constrain
14912 the distance an expression can travel. This is currently
14913 supported only in the code hoisting pass. The lesser the cost,
14914 the more aggressive code hoisting is. Specifying 0
14915 allows all expressions to travel unrestricted distances.
14916
14917 @item max-hoist-depth
14918 The depth of search in the dominator tree for expressions to hoist.
14919 This is used to avoid quadratic behavior in hoisting algorithm.
14920 The value of 0 does not limit on the search, but may slow down compilation
14921 of huge functions.
14922
14923 @item max-tail-merge-comparisons
14924 The maximum amount of similar bbs to compare a bb with. This is used to
14925 avoid quadratic behavior in tree tail merging.
14926
14927 @item max-tail-merge-iterations
14928 The maximum amount of iterations of the pass over the function. This is used to
14929 limit compilation time in tree tail merging.
14930
14931 @item store-merging-allow-unaligned
14932 Allow the store merging pass to introduce unaligned stores if it is legal to
14933 do so.
14934
14935 @item max-stores-to-merge
14936 The maximum number of stores to attempt to merge into wider stores in the store
14937 merging pass.
14938
14939 @item max-store-chains-to-track
14940 The maximum number of store chains to track at the same time in the attempt
14941 to merge them into wider stores in the store merging pass.
14942
14943 @item max-stores-to-track
14944 The maximum number of stores to track at the same time in the attemt to
14945 to merge them into wider stores in the store merging pass.
14946
14947 @item max-unrolled-insns
14948 The maximum number of instructions that a loop may have to be unrolled.
14949 If a loop is unrolled, this parameter also determines how many times
14950 the loop code is unrolled.
14951
14952 @item max-average-unrolled-insns
14953 The maximum number of instructions biased by probabilities of their execution
14954 that a loop may have to be unrolled. If a loop is unrolled,
14955 this parameter also determines how many times the loop code is unrolled.
14956
14957 @item max-unroll-times
14958 The maximum number of unrollings of a single loop.
14959
14960 @item max-peeled-insns
14961 The maximum number of instructions that a loop may have to be peeled.
14962 If a loop is peeled, this parameter also determines how many times
14963 the loop code is peeled.
14964
14965 @item max-peel-times
14966 The maximum number of peelings of a single loop.
14967
14968 @item max-peel-branches
14969 The maximum number of branches on the hot path through the peeled sequence.
14970
14971 @item max-completely-peeled-insns
14972 The maximum number of insns of a completely peeled loop.
14973
14974 @item max-completely-peel-times
14975 The maximum number of iterations of a loop to be suitable for complete peeling.
14976
14977 @item max-completely-peel-loop-nest-depth
14978 The maximum depth of a loop nest suitable for complete peeling.
14979
14980 @item max-unswitch-insns
14981 The maximum number of insns of an unswitched loop.
14982
14983 @item max-unswitch-depth
14984 The maximum depth of a loop nest to be unswitched.
14985
14986 @item lim-expensive
14987 The minimum cost of an expensive expression in the loop invariant motion.
14988
14989 @item min-loop-cond-split-prob
14990 When FDO profile information is available, @option{min-loop-cond-split-prob}
14991 specifies minimum threshold for probability of semi-invariant condition
14992 statement to trigger loop split.
14993
14994 @item iv-consider-all-candidates-bound
14995 Bound on number of candidates for induction variables, below which
14996 all candidates are considered for each use in induction variable
14997 optimizations. If there are more candidates than this,
14998 only the most relevant ones are considered to avoid quadratic time complexity.
14999
15000 @item iv-max-considered-uses
15001 The induction variable optimizations give up on loops that contain more
15002 induction variable uses.
15003
15004 @item iv-always-prune-cand-set-bound
15005 If the number of candidates in the set is smaller than this value,
15006 always try to remove unnecessary ivs from the set
15007 when adding a new one.
15008
15009 @item avg-loop-niter
15010 Average number of iterations of a loop.
15011
15012 @item dse-max-object-size
15013 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15014 Larger values may result in larger compilation times.
15015
15016 @item dse-max-alias-queries-per-store
15017 Maximum number of queries into the alias oracle per store.
15018 Larger values result in larger compilation times and may result in more
15019 removed dead stores.
15020
15021 @item scev-max-expr-size
15022 Bound on size of expressions used in the scalar evolutions analyzer.
15023 Large expressions slow the analyzer.
15024
15025 @item scev-max-expr-complexity
15026 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15027 Complex expressions slow the analyzer.
15028
15029 @item max-tree-if-conversion-phi-args
15030 Maximum number of arguments in a PHI supported by TREE if conversion
15031 unless the loop is marked with simd pragma.
15032
15033 @item vect-max-layout-candidates
15034 The maximum number of possible vector layouts (such as permutations)
15035 to consider when optimizing to-be-vectorized code.
15036
15037 @item vect-max-version-for-alignment-checks
15038 The maximum number of run-time checks that can be performed when
15039 doing loop versioning for alignment in the vectorizer.
15040
15041 @item vect-max-version-for-alias-checks
15042 The maximum number of run-time checks that can be performed when
15043 doing loop versioning for alias in the vectorizer.
15044
15045 @item vect-max-peeling-for-alignment
15046 The maximum number of loop peels to enhance access alignment
15047 for vectorizer. Value -1 means no limit.
15048
15049 @item max-iterations-to-track
15050 The maximum number of iterations of a loop the brute-force algorithm
15051 for analysis of the number of iterations of the loop tries to evaluate.
15052
15053 @item hot-bb-count-fraction
15054 The denominator n of fraction 1/n of the maximal execution count of a
15055 basic block in the entire program that a basic block needs to at least
15056 have in order to be considered hot. The default is 10000, which means
15057 that a basic block is considered hot if its execution count is greater
15058 than 1/10000 of the maximal execution count. 0 means that it is never
15059 considered hot. Used in non-LTO mode.
15060
15061 @item hot-bb-count-ws-permille
15062 The number of most executed permilles, ranging from 0 to 1000, of the
15063 profiled execution of the entire program to which the execution count
15064 of a basic block must be part of in order to be considered hot. The
15065 default is 990, which means that a basic block is considered hot if
15066 its execution count contributes to the upper 990 permilles, or 99.0%,
15067 of the profiled execution of the entire program. 0 means that it is
15068 never considered hot. Used in LTO mode.
15069
15070 @item hot-bb-frequency-fraction
15071 The denominator n of fraction 1/n of the execution frequency of the
15072 entry block of a function that a basic block of this function needs
15073 to at least have in order to be considered hot. The default is 1000,
15074 which means that a basic block is considered hot in a function if it
15075 is executed more frequently than 1/1000 of the frequency of the entry
15076 block of the function. 0 means that it is never considered hot.
15077
15078 @item unlikely-bb-count-fraction
15079 The denominator n of fraction 1/n of the number of profiled runs of
15080 the entire program below which the execution count of a basic block
15081 must be in order for the basic block to be considered unlikely executed.
15082 The default is 20, which means that a basic block is considered unlikely
15083 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15084 the program. 0 means that it is always considered unlikely executed.
15085
15086 @item max-predicted-iterations
15087 The maximum number of loop iterations we predict statically. This is useful
15088 in cases where a function contains a single loop with known bound and
15089 another loop with unknown bound.
15090 The known number of iterations is predicted correctly, while
15091 the unknown number of iterations average to roughly 10. This means that the
15092 loop without bounds appears artificially cold relative to the other one.
15093
15094 @item builtin-expect-probability
15095 Control the probability of the expression having the specified value. This
15096 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15097
15098 @item builtin-string-cmp-inline-length
15099 The maximum length of a constant string for a builtin string cmp call
15100 eligible for inlining.
15101
15102 @item align-threshold
15103
15104 Select fraction of the maximal frequency of executions of a basic block in
15105 a function to align the basic block.
15106
15107 @item align-loop-iterations
15108
15109 A loop expected to iterate at least the selected number of iterations is
15110 aligned.
15111
15112 @item tracer-dynamic-coverage
15113 @itemx tracer-dynamic-coverage-feedback
15114
15115 This value is used to limit superblock formation once the given percentage of
15116 executed instructions is covered. This limits unnecessary code size
15117 expansion.
15118
15119 The @option{tracer-dynamic-coverage-feedback} parameter
15120 is used only when profile
15121 feedback is available. The real profiles (as opposed to statically estimated
15122 ones) are much less balanced allowing the threshold to be larger value.
15123
15124 @item tracer-max-code-growth
15125 Stop tail duplication once code growth has reached given percentage. This is
15126 a rather artificial limit, as most of the duplicates are eliminated later in
15127 cross jumping, so it may be set to much higher values than is the desired code
15128 growth.
15129
15130 @item tracer-min-branch-ratio
15131
15132 Stop reverse growth when the reverse probability of best edge is less than this
15133 threshold (in percent).
15134
15135 @item tracer-min-branch-probability
15136 @itemx tracer-min-branch-probability-feedback
15137
15138 Stop forward growth if the best edge has probability lower than this
15139 threshold.
15140
15141 Similarly to @option{tracer-dynamic-coverage} two parameters are
15142 provided. @option{tracer-min-branch-probability-feedback} is used for
15143 compilation with profile feedback and @option{tracer-min-branch-probability}
15144 compilation without. The value for compilation with profile feedback
15145 needs to be more conservative (higher) in order to make tracer
15146 effective.
15147
15148 @item stack-clash-protection-guard-size
15149 Specify the size of the operating system provided stack guard as
15150 2 raised to @var{num} bytes. Higher values may reduce the
15151 number of explicit probes, but a value larger than the operating system
15152 provided guard will leave code vulnerable to stack clash style attacks.
15153
15154 @item stack-clash-protection-probe-interval
15155 Stack clash protection involves probing stack space as it is allocated. This
15156 param controls the maximum distance between probes into the stack as 2 raised
15157 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
15158 larger than the operating system provided guard will leave code vulnerable to
15159 stack clash style attacks.
15160
15161 @item max-cse-path-length
15162
15163 The maximum number of basic blocks on path that CSE considers.
15164
15165 @item max-cse-insns
15166 The maximum number of instructions CSE processes before flushing.
15167
15168 @item ggc-min-expand
15169
15170 GCC uses a garbage collector to manage its own memory allocation. This
15171 parameter specifies the minimum percentage by which the garbage
15172 collector's heap should be allowed to expand between collections.
15173 Tuning this may improve compilation speed; it has no effect on code
15174 generation.
15175
15176 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15177 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
15178 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
15179 GCC is not able to calculate RAM on a particular platform, the lower
15180 bound of 30% is used. Setting this parameter and
15181 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15182 every opportunity. This is extremely slow, but can be useful for
15183 debugging.
15184
15185 @item ggc-min-heapsize
15186
15187 Minimum size of the garbage collector's heap before it begins bothering
15188 to collect garbage. The first collection occurs after the heap expands
15189 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
15190 tuning this may improve compilation speed, and has no effect on code
15191 generation.
15192
15193 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15194 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15195 with a lower bound of 4096 (four megabytes) and an upper bound of
15196 131072 (128 megabytes). If GCC is not able to calculate RAM on a
15197 particular platform, the lower bound is used. Setting this parameter
15198 very large effectively disables garbage collection. Setting this
15199 parameter and @option{ggc-min-expand} to zero causes a full collection
15200 to occur at every opportunity.
15201
15202 @item max-reload-search-insns
15203 The maximum number of instruction reload should look backward for equivalent
15204 register. Increasing values mean more aggressive optimization, making the
15205 compilation time increase with probably slightly better performance.
15206
15207 @item max-cselib-memory-locations
15208 The maximum number of memory locations cselib should take into account.
15209 Increasing values mean more aggressive optimization, making the compilation time
15210 increase with probably slightly better performance.
15211
15212 @item max-sched-ready-insns
15213 The maximum number of instructions ready to be issued the scheduler should
15214 consider at any given time during the first scheduling pass. Increasing
15215 values mean more thorough searches, making the compilation time increase
15216 with probably little benefit.
15217
15218 @item max-sched-region-blocks
15219 The maximum number of blocks in a region to be considered for
15220 interblock scheduling.
15221
15222 @item max-pipeline-region-blocks
15223 The maximum number of blocks in a region to be considered for
15224 pipelining in the selective scheduler.
15225
15226 @item max-sched-region-insns
15227 The maximum number of insns in a region to be considered for
15228 interblock scheduling.
15229
15230 @item max-pipeline-region-insns
15231 The maximum number of insns in a region to be considered for
15232 pipelining in the selective scheduler.
15233
15234 @item min-spec-prob
15235 The minimum probability (in percents) of reaching a source block
15236 for interblock speculative scheduling.
15237
15238 @item max-sched-extend-regions-iters
15239 The maximum number of iterations through CFG to extend regions.
15240 A value of 0 disables region extensions.
15241
15242 @item max-sched-insn-conflict-delay
15243 The maximum conflict delay for an insn to be considered for speculative motion.
15244
15245 @item sched-spec-prob-cutoff
15246 The minimal probability of speculation success (in percents), so that
15247 speculative insns are scheduled.
15248
15249 @item sched-state-edge-prob-cutoff
15250 The minimum probability an edge must have for the scheduler to save its
15251 state across it.
15252
15253 @item sched-mem-true-dep-cost
15254 Minimal distance (in CPU cycles) between store and load targeting same
15255 memory locations.
15256
15257 @item selsched-max-lookahead
15258 The maximum size of the lookahead window of selective scheduling. It is a
15259 depth of search for available instructions.
15260
15261 @item selsched-max-sched-times
15262 The maximum number of times that an instruction is scheduled during
15263 selective scheduling. This is the limit on the number of iterations
15264 through which the instruction may be pipelined.
15265
15266 @item selsched-insns-to-rename
15267 The maximum number of best instructions in the ready list that are considered
15268 for renaming in the selective scheduler.
15269
15270 @item sms-min-sc
15271 The minimum value of stage count that swing modulo scheduler
15272 generates.
15273
15274 @item max-last-value-rtl
15275 The maximum size measured as number of RTLs that can be recorded in an expression
15276 in combiner for a pseudo register as last known value of that register.
15277
15278 @item max-combine-insns
15279 The maximum number of instructions the RTL combiner tries to combine.
15280
15281 @item integer-share-limit
15282 Small integer constants can use a shared data structure, reducing the
15283 compiler's memory usage and increasing its speed. This sets the maximum
15284 value of a shared integer constant.
15285
15286 @item ssp-buffer-size
15287 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15288 protection when @option{-fstack-protector} is used.
15289
15290 @item min-size-for-stack-sharing
15291 The minimum size of variables taking part in stack slot sharing when not
15292 optimizing.
15293
15294 @item max-jump-thread-duplication-stmts
15295 Maximum number of statements allowed in a block that needs to be
15296 duplicated when threading jumps.
15297
15298 @item max-jump-thread-paths
15299 The maximum number of paths to consider when searching for jump threading
15300 opportunities. When arriving at a block, incoming edges are only considered
15301 if the number of paths to be searched so far multiplied by the number of
15302 incoming edges does not exhaust the specified maximum number of paths to
15303 consider.
15304
15305 @item max-fields-for-field-sensitive
15306 Maximum number of fields in a structure treated in
15307 a field sensitive manner during pointer analysis.
15308
15309 @item prefetch-latency
15310 Estimate on average number of instructions that are executed before
15311 prefetch finishes. The distance prefetched ahead is proportional
15312 to this constant. Increasing this number may also lead to less
15313 streams being prefetched (see @option{simultaneous-prefetches}).
15314
15315 @item simultaneous-prefetches
15316 Maximum number of prefetches that can run at the same time.
15317
15318 @item l1-cache-line-size
15319 The size of cache line in L1 data cache, in bytes.
15320
15321 @item l1-cache-size
15322 The size of L1 data cache, in kilobytes.
15323
15324 @item l2-cache-size
15325 The size of L2 data cache, in kilobytes.
15326
15327 @item prefetch-dynamic-strides
15328 Whether the loop array prefetch pass should issue software prefetch hints
15329 for strides that are non-constant. In some cases this may be
15330 beneficial, though the fact the stride is non-constant may make it
15331 hard to predict when there is clear benefit to issuing these hints.
15332
15333 Set to 1 if the prefetch hints should be issued for non-constant
15334 strides. Set to 0 if prefetch hints should be issued only for strides that
15335 are known to be constant and below @option{prefetch-minimum-stride}.
15336
15337 @item prefetch-minimum-stride
15338 Minimum constant stride, in bytes, to start using prefetch hints for. If
15339 the stride is less than this threshold, prefetch hints will not be issued.
15340
15341 This setting is useful for processors that have hardware prefetchers, in
15342 which case there may be conflicts between the hardware prefetchers and
15343 the software prefetchers. If the hardware prefetchers have a maximum
15344 stride they can handle, it should be used here to improve the use of
15345 software prefetchers.
15346
15347 A value of -1 means we don't have a threshold and therefore
15348 prefetch hints can be issued for any constant stride.
15349
15350 This setting is only useful for strides that are known and constant.
15351
15352 @item destructive-interference-size
15353 @item constructive-interference-size
15354 The values for the C++17 variables
15355 @code{std::hardware_destructive_interference_size} and
15356 @code{std::hardware_constructive_interference_size}. The destructive
15357 interference size is the minimum recommended offset between two
15358 independent concurrently-accessed objects; the constructive
15359 interference size is the maximum recommended size of contiguous memory
15360 accessed together. Typically both will be the size of an L1 cache
15361 line for the target, in bytes. For a generic target covering a range of L1
15362 cache line sizes, typically the constructive interference size will be
15363 the small end of the range and the destructive size will be the large
15364 end.
15365
15366 The destructive interference size is intended to be used for layout,
15367 and thus has ABI impact. The default value is not expected to be
15368 stable, and on some targets varies with @option{-mtune}, so use of
15369 this variable in a context where ABI stability is important, such as
15370 the public interface of a library, is strongly discouraged; if it is
15371 used in that context, users can stabilize the value using this
15372 option.
15373
15374 The constructive interference size is less sensitive, as it is
15375 typically only used in a @samp{static_assert} to make sure that a type
15376 fits within a cache line.
15377
15378 See also @option{-Winterference-size}.
15379
15380 @item loop-interchange-max-num-stmts
15381 The maximum number of stmts in a loop to be interchanged.
15382
15383 @item loop-interchange-stride-ratio
15384 The minimum ratio between stride of two loops for interchange to be profitable.
15385
15386 @item min-insn-to-prefetch-ratio
15387 The minimum ratio between the number of instructions and the
15388 number of prefetches to enable prefetching in a loop.
15389
15390 @item prefetch-min-insn-to-mem-ratio
15391 The minimum ratio between the number of instructions and the
15392 number of memory references to enable prefetching in a loop.
15393
15394 @item use-canonical-types
15395 Whether the compiler should use the ``canonical'' type system.
15396 Should always be 1, which uses a more efficient internal
15397 mechanism for comparing types in C++ and Objective-C++. However, if
15398 bugs in the canonical type system are causing compilation failures,
15399 set this value to 0 to disable canonical types.
15400
15401 @item switch-conversion-max-branch-ratio
15402 Switch initialization conversion refuses to create arrays that are
15403 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15404 branches in the switch.
15405
15406 @item max-partial-antic-length
15407 Maximum length of the partial antic set computed during the tree
15408 partial redundancy elimination optimization (@option{-ftree-pre}) when
15409 optimizing at @option{-O3} and above. For some sorts of source code
15410 the enhanced partial redundancy elimination optimization can run away,
15411 consuming all of the memory available on the host machine. This
15412 parameter sets a limit on the length of the sets that are computed,
15413 which prevents the runaway behavior. Setting a value of 0 for
15414 this parameter allows an unlimited set length.
15415
15416 @item rpo-vn-max-loop-depth
15417 Maximum loop depth that is value-numbered optimistically.
15418 When the limit hits the innermost
15419 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15420 loop nest are value-numbered optimistically and the remaining ones not.
15421
15422 @item sccvn-max-alias-queries-per-access
15423 Maximum number of alias-oracle queries we perform when looking for
15424 redundancies for loads and stores. If this limit is hit the search
15425 is aborted and the load or store is not considered redundant. The
15426 number of queries is algorithmically limited to the number of
15427 stores on all paths from the load to the function entry.
15428
15429 @item ira-max-loops-num
15430 IRA uses regional register allocation by default. If a function
15431 contains more loops than the number given by this parameter, only at most
15432 the given number of the most frequently-executed loops form regions
15433 for regional register allocation.
15434
15435 @item ira-max-conflict-table-size
15436 Although IRA uses a sophisticated algorithm to compress the conflict
15437 table, the table can still require excessive amounts of memory for
15438 huge functions. If the conflict table for a function could be more
15439 than the size in MB given by this parameter, the register allocator
15440 instead uses a faster, simpler, and lower-quality
15441 algorithm that does not require building a pseudo-register conflict table.
15442
15443 @item ira-loop-reserved-regs
15444 IRA can be used to evaluate more accurate register pressure in loops
15445 for decisions to move loop invariants (see @option{-O3}). The number
15446 of available registers reserved for some other purposes is given
15447 by this parameter. Default of the parameter
15448 is the best found from numerous experiments.
15449
15450 @item ira-consider-dup-in-all-alts
15451 Make IRA to consider matching constraint (duplicated operand number)
15452 heavily in all available alternatives for preferred register class.
15453 If it is set as zero, it means IRA only respects the matching
15454 constraint when it's in the only available alternative with an
15455 appropriate register class. Otherwise, it means IRA will check all
15456 available alternatives for preferred register class even if it has
15457 found some choice with an appropriate register class and respect the
15458 found qualified matching constraint.
15459
15460 @item lra-inheritance-ebb-probability-cutoff
15461 LRA tries to reuse values reloaded in registers in subsequent insns.
15462 This optimization is called inheritance. EBB is used as a region to
15463 do this optimization. The parameter defines a minimal fall-through
15464 edge probability in percentage used to add BB to inheritance EBB in
15465 LRA. The default value was chosen
15466 from numerous runs of SPEC2000 on x86-64.
15467
15468 @item loop-invariant-max-bbs-in-loop
15469 Loop invariant motion can be very expensive, both in compilation time and
15470 in amount of needed compile-time memory, with very large loops. Loops
15471 with more basic blocks than this parameter won't have loop invariant
15472 motion optimization performed on them.
15473
15474 @item loop-max-datarefs-for-datadeps
15475 Building data dependencies is expensive for very large loops. This
15476 parameter limits the number of data references in loops that are
15477 considered for data dependence analysis. These large loops are no
15478 handled by the optimizations using loop data dependencies.
15479
15480 @item max-vartrack-size
15481 Sets a maximum number of hash table slots to use during variable
15482 tracking dataflow analysis of any function. If this limit is exceeded
15483 with variable tracking at assignments enabled, analysis for that
15484 function is retried without it, after removing all debug insns from
15485 the function. If the limit is exceeded even without debug insns, var
15486 tracking analysis is completely disabled for the function. Setting
15487 the parameter to zero makes it unlimited.
15488
15489 @item max-vartrack-expr-depth
15490 Sets a maximum number of recursion levels when attempting to map
15491 variable names or debug temporaries to value expressions. This trades
15492 compilation time for more complete debug information. If this is set too
15493 low, value expressions that are available and could be represented in
15494 debug information may end up not being used; setting this higher may
15495 enable the compiler to find more complex debug expressions, but compile
15496 time and memory use may grow.
15497
15498 @item max-debug-marker-count
15499 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15500 markers) to avoid complexity explosion at inlining or expanding to RTL.
15501 If a function has more such gimple stmts than the set limit, such stmts
15502 will be dropped from the inlined copy of a function, and from its RTL
15503 expansion.
15504
15505 @item min-nondebug-insn-uid
15506 Use uids starting at this parameter for nondebug insns. The range below
15507 the parameter is reserved exclusively for debug insns created by
15508 @option{-fvar-tracking-assignments}, but debug insns may get
15509 (non-overlapping) uids above it if the reserved range is exhausted.
15510
15511 @item ipa-sra-ptr-growth-factor
15512 IPA-SRA replaces a pointer to an aggregate with one or more new
15513 parameters only when their cumulative size is less or equal to
15514 @option{ipa-sra-ptr-growth-factor} times the size of the original
15515 pointer parameter.
15516
15517 @item ipa-sra-max-replacements
15518 Maximum pieces of an aggregate that IPA-SRA tracks. As a
15519 consequence, it is also the maximum number of replacements of a formal
15520 parameter.
15521
15522 @item sra-max-scalarization-size-Ospeed
15523 @itemx sra-max-scalarization-size-Osize
15524 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15525 replace scalar parts of aggregates with uses of independent scalar
15526 variables. These parameters control the maximum size, in storage units,
15527 of aggregate which is considered for replacement when compiling for
15528 speed
15529 (@option{sra-max-scalarization-size-Ospeed}) or size
15530 (@option{sra-max-scalarization-size-Osize}) respectively.
15531
15532 @item sra-max-propagations
15533 The maximum number of artificial accesses that Scalar Replacement of
15534 Aggregates (SRA) will track, per one local variable, in order to
15535 facilitate copy propagation.
15536
15537 @item tm-max-aggregate-size
15538 When making copies of thread-local variables in a transaction, this
15539 parameter specifies the size in bytes after which variables are
15540 saved with the logging functions as opposed to save/restore code
15541 sequence pairs. This option only applies when using
15542 @option{-fgnu-tm}.
15543
15544 @item graphite-max-nb-scop-params
15545 To avoid exponential effects in the Graphite loop transforms, the
15546 number of parameters in a Static Control Part (SCoP) is bounded.
15547 A value of zero can be used to lift
15548 the bound. A variable whose value is unknown at compilation time and
15549 defined outside a SCoP is a parameter of the SCoP.
15550
15551 @item loop-block-tile-size
15552 Loop blocking or strip mining transforms, enabled with
15553 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15554 loop in the loop nest by a given number of iterations. The strip
15555 length can be changed using the @option{loop-block-tile-size}
15556 parameter.
15557
15558 @item ipa-jump-function-lookups
15559 Specifies number of statements visited during jump function offset discovery.
15560
15561 @item ipa-cp-value-list-size
15562 IPA-CP attempts to track all possible values and types passed to a function's
15563 parameter in order to propagate them and perform devirtualization.
15564 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15565 stores per one formal parameter of a function.
15566
15567 @item ipa-cp-eval-threshold
15568 IPA-CP calculates its own score of cloning profitability heuristics
15569 and performs those cloning opportunities with scores that exceed
15570 @option{ipa-cp-eval-threshold}.
15571
15572 @item ipa-cp-max-recursive-depth
15573 Maximum depth of recursive cloning for self-recursive function.
15574
15575 @item ipa-cp-min-recursive-probability
15576 Recursive cloning only when the probability of call being executed exceeds
15577 the parameter.
15578
15579 @item ipa-cp-profile-count-base
15580 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15581 execution count of a call graph edge at this percentage position in their
15582 histogram as the basis for its heuristics calculation.
15583
15584 @item ipa-cp-recursive-freq-factor
15585 The number of times interprocedural copy propagation expects recursive
15586 functions to call themselves.
15587
15588 @item ipa-cp-recursion-penalty
15589 Percentage penalty the recursive functions will receive when they
15590 are evaluated for cloning.
15591
15592 @item ipa-cp-single-call-penalty
15593 Percentage penalty functions containing a single call to another
15594 function will receive when they are evaluated for cloning.
15595
15596 @item ipa-max-agg-items
15597 IPA-CP is also capable to propagate a number of scalar values passed
15598 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15599 number of such values per one parameter.
15600
15601 @item ipa-cp-loop-hint-bonus
15602 When IPA-CP determines that a cloning candidate would make the number
15603 of iterations of a loop known, it adds a bonus of
15604 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15605 the candidate.
15606
15607 @item ipa-max-loop-predicates
15608 The maximum number of different predicates IPA will use to describe when
15609 loops in a function have known properties.
15610
15611 @item ipa-max-aa-steps
15612 During its analysis of function bodies, IPA-CP employs alias analysis
15613 in order to track values pointed to by function parameters. In order
15614 not spend too much time analyzing huge functions, it gives up and
15615 consider all memory clobbered after examining
15616 @option{ipa-max-aa-steps} statements modifying memory.
15617
15618 @item ipa-max-switch-predicate-bounds
15619 Maximal number of boundary endpoints of case ranges of switch statement.
15620 For switch exceeding this limit, IPA-CP will not construct cloning cost
15621 predicate, which is used to estimate cloning benefit, for default case
15622 of the switch statement.
15623
15624 @item ipa-max-param-expr-ops
15625 IPA-CP will analyze conditional statement that references some function
15626 parameter to estimate benefit for cloning upon certain constant value.
15627 But if number of operations in a parameter expression exceeds
15628 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
15629 one, and is not handled by IPA analysis.
15630
15631 @item lto-partitions
15632 Specify desired number of partitions produced during WHOPR compilation.
15633 The number of partitions should exceed the number of CPUs used for compilation.
15634
15635 @item lto-min-partition
15636 Size of minimal partition for WHOPR (in estimated instructions).
15637 This prevents expenses of splitting very small programs into too many
15638 partitions.
15639
15640 @item lto-max-partition
15641 Size of max partition for WHOPR (in estimated instructions).
15642 to provide an upper bound for individual size of partition.
15643 Meant to be used only with balanced partitioning.
15644
15645 @item lto-max-streaming-parallelism
15646 Maximal number of parallel processes used for LTO streaming.
15647
15648 @item cxx-max-namespaces-for-diagnostic-help
15649 The maximum number of namespaces to consult for suggestions when C++
15650 name lookup fails for an identifier.
15651
15652 @item sink-frequency-threshold
15653 The maximum relative execution frequency (in percents) of the target block
15654 relative to a statement's original block to allow statement sinking of a
15655 statement. Larger numbers result in more aggressive statement sinking.
15656 A small positive adjustment is applied for
15657 statements with memory operands as those are even more profitable so sink.
15658
15659 @item max-stores-to-sink
15660 The maximum number of conditional store pairs that can be sunk. Set to 0
15661 if either vectorization (@option{-ftree-vectorize}) or if-conversion
15662 (@option{-ftree-loop-if-convert}) is disabled.
15663
15664 @item case-values-threshold
15665 The smallest number of different values for which it is best to use a
15666 jump-table instead of a tree of conditional branches. If the value is
15667 0, use the default for the machine.
15668
15669 @item jump-table-max-growth-ratio-for-size
15670 The maximum code size growth ratio when expanding
15671 into a jump table (in percent). The parameter is used when
15672 optimizing for size.
15673
15674 @item jump-table-max-growth-ratio-for-speed
15675 The maximum code size growth ratio when expanding
15676 into a jump table (in percent). The parameter is used when
15677 optimizing for speed.
15678
15679 @item tree-reassoc-width
15680 Set the maximum number of instructions executed in parallel in
15681 reassociated tree. This parameter overrides target dependent
15682 heuristics used by default if has non zero value.
15683
15684 @item sched-pressure-algorithm
15685 Choose between the two available implementations of
15686 @option{-fsched-pressure}. Algorithm 1 is the original implementation
15687 and is the more likely to prevent instructions from being reordered.
15688 Algorithm 2 was designed to be a compromise between the relatively
15689 conservative approach taken by algorithm 1 and the rather aggressive
15690 approach taken by the default scheduler. It relies more heavily on
15691 having a regular register file and accurate register pressure classes.
15692 See @file{haifa-sched.cc} in the GCC sources for more details.
15693
15694 The default choice depends on the target.
15695
15696 @item max-slsr-cand-scan
15697 Set the maximum number of existing candidates that are considered when
15698 seeking a basis for a new straight-line strength reduction candidate.
15699
15700 @item asan-globals
15701 Enable buffer overflow detection for global objects. This kind
15702 of protection is enabled by default if you are using
15703 @option{-fsanitize=address} option.
15704 To disable global objects protection use @option{--param asan-globals=0}.
15705
15706 @item asan-stack
15707 Enable buffer overflow detection for stack objects. This kind of
15708 protection is enabled by default when using @option{-fsanitize=address}.
15709 To disable stack protection use @option{--param asan-stack=0} option.
15710
15711 @item asan-instrument-reads
15712 Enable buffer overflow detection for memory reads. This kind of
15713 protection is enabled by default when using @option{-fsanitize=address}.
15714 To disable memory reads protection use
15715 @option{--param asan-instrument-reads=0}.
15716
15717 @item asan-instrument-writes
15718 Enable buffer overflow detection for memory writes. This kind of
15719 protection is enabled by default when using @option{-fsanitize=address}.
15720 To disable memory writes protection use
15721 @option{--param asan-instrument-writes=0} option.
15722
15723 @item asan-memintrin
15724 Enable detection for built-in functions. This kind of protection
15725 is enabled by default when using @option{-fsanitize=address}.
15726 To disable built-in functions protection use
15727 @option{--param asan-memintrin=0}.
15728
15729 @item asan-use-after-return
15730 Enable detection of use-after-return. This kind of protection
15731 is enabled by default when using the @option{-fsanitize=address} option.
15732 To disable it use @option{--param asan-use-after-return=0}.
15733
15734 Note: By default the check is disabled at run time. To enable it,
15735 add @code{detect_stack_use_after_return=1} to the environment variable
15736 @env{ASAN_OPTIONS}.
15737
15738 @item asan-instrumentation-with-call-threshold
15739 If number of memory accesses in function being instrumented
15740 is greater or equal to this number, use callbacks instead of inline checks.
15741 E.g. to disable inline code use
15742 @option{--param asan-instrumentation-with-call-threshold=0}.
15743
15744 @item hwasan-instrument-stack
15745 Enable hwasan instrumentation of statically sized stack-allocated variables.
15746 This kind of instrumentation is enabled by default when using
15747 @option{-fsanitize=hwaddress} and disabled by default when using
15748 @option{-fsanitize=kernel-hwaddress}.
15749 To disable stack instrumentation use
15750 @option{--param hwasan-instrument-stack=0}, and to enable it use
15751 @option{--param hwasan-instrument-stack=1}.
15752
15753 @item hwasan-random-frame-tag
15754 When using stack instrumentation, decide tags for stack variables using a
15755 deterministic sequence beginning at a random tag for each frame. With this
15756 parameter unset tags are chosen using the same sequence but beginning from 1.
15757 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
15758 for @option{-fsanitize=kernel-hwaddress}.
15759 To disable it use @option{--param hwasan-random-frame-tag=0}.
15760
15761 @item hwasan-instrument-allocas
15762 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
15763 This kind of instrumentation is enabled by default when using
15764 @option{-fsanitize=hwaddress} and disabled by default when using
15765 @option{-fsanitize=kernel-hwaddress}.
15766 To disable instrumentation of such variables use
15767 @option{--param hwasan-instrument-allocas=0}, and to enable it use
15768 @option{--param hwasan-instrument-allocas=1}.
15769
15770 @item hwasan-instrument-reads
15771 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
15772 default for both @option{-fsanitize=hwaddress} and
15773 @option{-fsanitize=kernel-hwaddress}.
15774 To disable checking memory reads use
15775 @option{--param hwasan-instrument-reads=0}.
15776
15777 @item hwasan-instrument-writes
15778 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
15779 default for both @option{-fsanitize=hwaddress} and
15780 @option{-fsanitize=kernel-hwaddress}.
15781 To disable checking memory writes use
15782 @option{--param hwasan-instrument-writes=0}.
15783
15784 @item hwasan-instrument-mem-intrinsics
15785 Enable hwasan instrumentation of builtin functions. Instrumentation of these
15786 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
15787 and @option{-fsanitize=kernel-hwaddress}.
15788 To disable instrumentation of builtin functions use
15789 @option{--param hwasan-instrument-mem-intrinsics=0}.
15790
15791 @item use-after-scope-direct-emission-threshold
15792 If the size of a local variable in bytes is smaller or equal to this
15793 number, directly poison (or unpoison) shadow memory instead of using
15794 run-time callbacks.
15795
15796 @item tsan-distinguish-volatile
15797 Emit special instrumentation for accesses to volatiles.
15798
15799 @item tsan-instrument-func-entry-exit
15800 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
15801
15802 @item max-fsm-thread-path-insns
15803 Maximum number of instructions to copy when duplicating blocks on a
15804 finite state automaton jump thread path.
15805
15806 @item threader-debug
15807 threader-debug=[none|all] Enables verbose dumping of the threader solver.
15808
15809 @item parloops-chunk-size
15810 Chunk size of omp schedule for loops parallelized by parloops.
15811
15812 @item parloops-schedule
15813 Schedule type of omp schedule for loops parallelized by parloops (static,
15814 dynamic, guided, auto, runtime).
15815
15816 @item parloops-min-per-thread
15817 The minimum number of iterations per thread of an innermost parallelized
15818 loop for which the parallelized variant is preferred over the single threaded
15819 one. Note that for a parallelized loop nest the
15820 minimum number of iterations of the outermost loop per thread is two.
15821
15822 @item max-ssa-name-query-depth
15823 Maximum depth of recursion when querying properties of SSA names in things
15824 like fold routines. One level of recursion corresponds to following a
15825 use-def chain.
15826
15827 @item max-speculative-devirt-maydefs
15828 The maximum number of may-defs we analyze when looking for a must-def
15829 specifying the dynamic type of an object that invokes a virtual call
15830 we may be able to devirtualize speculatively.
15831
15832 @item evrp-sparse-threshold
15833 Maximum number of basic blocks before EVRP uses a sparse cache.
15834
15835 @item ranger-debug
15836 Specifies the type of debug output to be issued for ranges.
15837
15838 @item evrp-switch-limit
15839 Specifies the maximum number of switch cases before EVRP ignores a switch.
15840
15841 @item unroll-jam-min-percent
15842 The minimum percentage of memory references that must be optimized
15843 away for the unroll-and-jam transformation to be considered profitable.
15844
15845 @item unroll-jam-max-unroll
15846 The maximum number of times the outer loop should be unrolled by
15847 the unroll-and-jam transformation.
15848
15849 @item max-rtl-if-conversion-unpredictable-cost
15850 Maximum permissible cost for the sequence that would be generated
15851 by the RTL if-conversion pass for a branch that is considered unpredictable.
15852
15853 @item max-variable-expansions-in-unroller
15854 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
15855 of times that an individual variable will be expanded during loop unrolling.
15856
15857 @item partial-inlining-entry-probability
15858 Maximum probability of the entry BB of split region
15859 (in percent relative to entry BB of the function)
15860 to make partial inlining happen.
15861
15862 @item max-tracked-strlens
15863 Maximum number of strings for which strlen optimization pass will
15864 track string lengths.
15865
15866 @item gcse-after-reload-partial-fraction
15867 The threshold ratio for performing partial redundancy
15868 elimination after reload.
15869
15870 @item gcse-after-reload-critical-fraction
15871 The threshold ratio of critical edges execution count that
15872 permit performing redundancy elimination after reload.
15873
15874 @item max-loop-header-insns
15875 The maximum number of insns in loop header duplicated
15876 by the copy loop headers pass.
15877
15878 @item vect-epilogues-nomask
15879 Enable loop epilogue vectorization using smaller vector size.
15880
15881 @item vect-partial-vector-usage
15882 Controls when the loop vectorizer considers using partial vector loads
15883 and stores as an alternative to falling back to scalar code. 0 stops
15884 the vectorizer from ever using partial vector loads and stores. 1 allows
15885 partial vector loads and stores if vectorization removes the need for the
15886 code to iterate. 2 allows partial vector loads and stores in all loops.
15887 The parameter only has an effect on targets that support partial
15888 vector loads and stores.
15889
15890 @item vect-inner-loop-cost-factor
15891 The maximum factor which the loop vectorizer applies to the cost of statements
15892 in an inner loop relative to the loop being vectorized. The factor applied
15893 is the maximum of the estimated number of iterations of the inner loop and
15894 this parameter. The default value of this parameter is 50.
15895
15896 @item vect-induction-float
15897 Enable loop vectorization of floating point inductions.
15898
15899 @item avoid-fma-max-bits
15900 Maximum number of bits for which we avoid creating FMAs.
15901
15902 @item sms-loop-average-count-threshold
15903 A threshold on the average loop count considered by the swing modulo scheduler.
15904
15905 @item sms-dfa-history
15906 The number of cycles the swing modulo scheduler considers when checking
15907 conflicts using DFA.
15908
15909 @item graphite-allow-codegen-errors
15910 Whether codegen errors should be ICEs when @option{-fchecking}.
15911
15912 @item sms-max-ii-factor
15913 A factor for tuning the upper bound that swing modulo scheduler
15914 uses for scheduling a loop.
15915
15916 @item lra-max-considered-reload-pseudos
15917 The max number of reload pseudos which are considered during
15918 spilling a non-reload pseudo.
15919
15920 @item max-pow-sqrt-depth
15921 Maximum depth of sqrt chains to use when synthesizing exponentiation
15922 by a real constant.
15923
15924 @item max-dse-active-local-stores
15925 Maximum number of active local stores in RTL dead store elimination.
15926
15927 @item asan-instrument-allocas
15928 Enable asan allocas/VLAs protection.
15929
15930 @item max-iterations-computation-cost
15931 Bound on the cost of an expression to compute the number of iterations.
15932
15933 @item max-isl-operations
15934 Maximum number of isl operations, 0 means unlimited.
15935
15936 @item graphite-max-arrays-per-scop
15937 Maximum number of arrays per scop.
15938
15939 @item max-vartrack-reverse-op-size
15940 Max. size of loc list for which reverse ops should be added.
15941
15942 @item fsm-scale-path-stmts
15943 Scale factor to apply to the number of statements in a threading path
15944 when comparing to the number of (scaled) blocks.
15945
15946 @item uninit-control-dep-attempts
15947 Maximum number of nested calls to search for control dependencies
15948 during uninitialized variable analysis.
15949
15950 @item fsm-scale-path-blocks
15951 Scale factor to apply to the number of blocks in a threading path
15952 when comparing to the number of (scaled) statements.
15953
15954 @item sched-autopref-queue-depth
15955 Hardware autoprefetcher scheduler model control flag.
15956 Number of lookahead cycles the model looks into; at '
15957 ' only enable instruction sorting heuristic.
15958
15959 @item loop-versioning-max-inner-insns
15960 The maximum number of instructions that an inner loop can have
15961 before the loop versioning pass considers it too big to copy.
15962
15963 @item loop-versioning-max-outer-insns
15964 The maximum number of instructions that an outer loop can have
15965 before the loop versioning pass considers it too big to copy,
15966 discounting any instructions in inner loops that directly benefit
15967 from versioning.
15968
15969 @item ssa-name-def-chain-limit
15970 The maximum number of SSA_NAME assignments to follow in determining
15971 a property of a variable such as its value. This limits the number
15972 of iterations or recursive calls GCC performs when optimizing certain
15973 statements or when determining their validity prior to issuing
15974 diagnostics.
15975
15976 @item store-merging-max-size
15977 Maximum size of a single store merging region in bytes.
15978
15979 @item hash-table-verification-limit
15980 The number of elements for which hash table verification is done
15981 for each searched element.
15982
15983 @item max-find-base-term-values
15984 Maximum number of VALUEs handled during a single find_base_term call.
15985
15986 @item analyzer-max-enodes-per-program-point
15987 The maximum number of exploded nodes per program point within
15988 the analyzer, before terminating analysis of that point.
15989
15990 @item analyzer-max-constraints
15991 The maximum number of constraints per state.
15992
15993 @item analyzer-min-snodes-for-call-summary
15994 The minimum number of supernodes within a function for the
15995 analyzer to consider summarizing its effects at call sites.
15996
15997 @item analyzer-max-enodes-for-full-dump
15998 The maximum depth of exploded nodes that should appear in a dot dump
15999 before switching to a less verbose format.
16000
16001 @item analyzer-max-recursion-depth
16002 The maximum number of times a callsite can appear in a call stack
16003 within the analyzer, before terminating analysis of a call that would
16004 recurse deeper.
16005
16006 @item analyzer-max-svalue-depth
16007 The maximum depth of a symbolic value, before approximating
16008 the value as unknown.
16009
16010 @item analyzer-max-infeasible-edges
16011 The maximum number of infeasible edges to reject before declaring
16012 a diagnostic as infeasible.
16013
16014 @item gimple-fe-computed-hot-bb-threshold
16015 The number of executions of a basic block which is considered hot.
16016 The parameter is used only in GIMPLE FE.
16017
16018 @item analyzer-bb-explosion-factor
16019 The maximum number of 'after supernode' exploded nodes within the analyzer
16020 per supernode, before terminating analysis.
16021
16022 @item ranger-logical-depth
16023 Maximum depth of logical expression evaluation ranger will look through
16024 when evaluating outgoing edge ranges.
16025
16026 @item relation-block-limit
16027 Maximum number of relations the oracle will register in a basic block.
16028
16029 @item min-pagesize
16030 Minimum page size for warning purposes.
16031
16032 @item openacc-kernels
16033 Specify mode of OpenACC `kernels' constructs handling.
16034 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16035 constructs are decomposed into parts, a sequence of compute
16036 constructs, each then handled individually.
16037 This is work in progress.
16038 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16039 constructs are handled by the @samp{parloops} pass, en bloc.
16040 This is the current default.
16041
16042 @item openacc-privatization
16043 Specify mode of OpenACC privatization diagnostics for
16044 @option{-fopt-info-omp-note} and applicable
16045 @option{-fdump-tree-*-details}.
16046 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16047 This is the current default.
16048 With @option{--param=openacc-privatization=noisy}, do diagnose.
16049
16050 @end table
16051
16052 The following choices of @var{name} are available on AArch64 targets:
16053
16054 @table @gcctabopt
16055 @item aarch64-sve-compare-costs
16056 When vectorizing for SVE, consider using ``unpacked'' vectors for
16057 smaller elements and use the cost model to pick the cheapest approach.
16058 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16059
16060 Using unpacked vectors includes storing smaller elements in larger
16061 containers and accessing elements with extending loads and truncating
16062 stores.
16063
16064 @item aarch64-float-recp-precision
16065 The number of Newton iterations for calculating the reciprocal for float type.
16066 The precision of division is proportional to this param when division
16067 approximation is enabled. The default value is 1.
16068
16069 @item aarch64-double-recp-precision
16070 The number of Newton iterations for calculating the reciprocal for double type.
16071 The precision of division is propotional to this param when division
16072 approximation is enabled. The default value is 2.
16073
16074 @item aarch64-autovec-preference
16075 Force an ISA selection strategy for auto-vectorization. Accepts values from
16076 0 to 4, inclusive.
16077 @table @samp
16078 @item 0
16079 Use the default heuristics.
16080 @item 1
16081 Use only Advanced SIMD for auto-vectorization.
16082 @item 2
16083 Use only SVE for auto-vectorization.
16084 @item 3
16085 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
16086 deemed equal.
16087 @item 4
16088 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
16089 @end table
16090 The default value is 0.
16091
16092 @item aarch64-loop-vect-issue-rate-niters
16093 The tuning for some AArch64 CPUs tries to take both latencies and issue
16094 rates into account when deciding whether a loop should be vectorized
16095 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16096 If this parameter is set to @var{n}, GCC will not use this heuristic
16097 for loops that are known to execute in fewer than @var{n} Advanced
16098 SIMD iterations.
16099
16100 @item aarch64-vect-unroll-limit
16101 The vectorizer will use available tuning information to determine whether it
16102 would be beneficial to unroll the main vectorized loop and by how much. This
16103 parameter set's the upper bound of how much the vectorizer will unroll the main
16104 loop. The default value is four.
16105
16106 @end table
16107
16108 The following choices of @var{name} are available on i386 and x86_64 targets:
16109
16110 @table @gcctabopt
16111 @item x86-stlf-window-ninsns
16112 Instructions number above which STFL stall penalty can be compensated.
16113
16114 @end table
16115
16116 @end table
16117
16118 @node Instrumentation Options
16119 @section Program Instrumentation Options
16120 @cindex instrumentation options
16121 @cindex program instrumentation options
16122 @cindex run-time error checking options
16123 @cindex profiling options
16124 @cindex options, program instrumentation
16125 @cindex options, run-time error checking
16126 @cindex options, profiling
16127
16128 GCC supports a number of command-line options that control adding
16129 run-time instrumentation to the code it normally generates.
16130 For example, one purpose of instrumentation is collect profiling
16131 statistics for use in finding program hot spots, code coverage
16132 analysis, or profile-guided optimizations.
16133 Another class of program instrumentation is adding run-time checking
16134 to detect programming errors like invalid pointer
16135 dereferences or out-of-bounds array accesses, as well as deliberately
16136 hostile attacks such as stack smashing or C++ vtable hijacking.
16137 There is also a general hook which can be used to implement other
16138 forms of tracing or function-level instrumentation for debug or
16139 program analysis purposes.
16140
16141 @table @gcctabopt
16142 @cindex @command{prof}
16143 @cindex @command{gprof}
16144 @item -p
16145 @itemx -pg
16146 @opindex p
16147 @opindex pg
16148 Generate extra code to write profile information suitable for the
16149 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16150 (for @option{-pg}). You must use this option when compiling
16151 the source files you want data about, and you must also use it when
16152 linking.
16153
16154 You can use the function attribute @code{no_instrument_function} to
16155 suppress profiling of individual functions when compiling with these options.
16156 @xref{Common Function Attributes}.
16157
16158 @item -fprofile-arcs
16159 @opindex fprofile-arcs
16160 Add code so that program flow @dfn{arcs} are instrumented. During
16161 execution the program records how many times each branch and call is
16162 executed and how many times it is taken or returns. On targets that support
16163 constructors with priority support, profiling properly handles constructors,
16164 destructors and C++ constructors (and destructors) of classes which are used
16165 as a type of a global variable.
16166
16167 When the compiled
16168 program exits it saves this data to a file called
16169 @file{@var{auxname}.gcda} for each source file. The data may be used for
16170 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16171 test coverage analysis (@option{-ftest-coverage}). Each object file's
16172 @var{auxname} is generated from the name of the output file, if
16173 explicitly specified and it is not the final executable, otherwise it is
16174 the basename of the source file. In both cases any suffix is removed
16175 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16176 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16177
16178 Note that if a command line directly links source files, the corresponding
16179 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16180 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16181 @file{binary-b.gcda} files.
16182
16183 @xref{Cross-profiling}.
16184
16185 @cindex @command{gcov}
16186 @item --coverage
16187 @opindex coverage
16188
16189 This option is used to compile and link code instrumented for coverage
16190 analysis. The option is a synonym for @option{-fprofile-arcs}
16191 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16192 linking). See the documentation for those options for more details.
16193
16194 @itemize
16195
16196 @item
16197 Compile the source files with @option{-fprofile-arcs} plus optimization
16198 and code generation options. For test coverage analysis, use the
16199 additional @option{-ftest-coverage} option. You do not need to profile
16200 every source file in a program.
16201
16202 @item
16203 Compile the source files additionally with @option{-fprofile-abs-path}
16204 to create absolute path names in the @file{.gcno} files. This allows
16205 @command{gcov} to find the correct sources in projects where compilations
16206 occur with different working directories.
16207
16208 @item
16209 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16210 (the latter implies the former).
16211
16212 @item
16213 Run the program on a representative workload to generate the arc profile
16214 information. This may be repeated any number of times. You can run
16215 concurrent instances of your program, and provided that the file system
16216 supports locking, the data files will be correctly updated. Unless
16217 a strict ISO C dialect option is in effect, @code{fork} calls are
16218 detected and correctly handled without double counting.
16219
16220 Moreover, an object file can be recompiled multiple times
16221 and the corresponding @file{.gcda} file merges as long as
16222 the source file and the compiler options are unchanged.
16223
16224 @item
16225 For profile-directed optimizations, compile the source files again with
16226 the same optimization and code generation options plus
16227 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16228 Control Optimization}).
16229
16230 @item
16231 For test coverage analysis, use @command{gcov} to produce human readable
16232 information from the @file{.gcno} and @file{.gcda} files. Refer to the
16233 @command{gcov} documentation for further information.
16234
16235 @end itemize
16236
16237 With @option{-fprofile-arcs}, for each function of your program GCC
16238 creates a program flow graph, then finds a spanning tree for the graph.
16239 Only arcs that are not on the spanning tree have to be instrumented: the
16240 compiler adds code to count the number of times that these arcs are
16241 executed. When an arc is the only exit or only entrance to a block, the
16242 instrumentation code can be added to the block; otherwise, a new basic
16243 block must be created to hold the instrumentation code.
16244
16245 @need 2000
16246 @item -ftest-coverage
16247 @opindex ftest-coverage
16248 Produce a notes file that the @command{gcov} code-coverage utility
16249 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16250 show program coverage. Each source file's note file is called
16251 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
16252 above for a description of @var{auxname} and instructions on how to
16253 generate test coverage data. Coverage data matches the source files
16254 more closely if you do not optimize.
16255
16256 @item -fprofile-abs-path
16257 @opindex fprofile-abs-path
16258 Automatically convert relative source file names to absolute path names
16259 in the @file{.gcno} files. This allows @command{gcov} to find the correct
16260 sources in projects where compilations occur with different working
16261 directories.
16262
16263 @item -fprofile-dir=@var{path}
16264 @opindex fprofile-dir
16265
16266 Set the directory to search for the profile data files in to @var{path}.
16267 This option affects only the profile data generated by
16268 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16269 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16270 and its related options. Both absolute and relative paths can be used.
16271 By default, GCC uses the current directory as @var{path}, thus the
16272 profile data file appears in the same directory as the object file.
16273 In order to prevent the file name clashing, if the object file name is
16274 not an absolute path, we mangle the absolute path of the
16275 @file{@var{sourcename}.gcda} file and use it as the file name of a
16276 @file{.gcda} file. See details about the file naming in @option{-fprofile-arcs}.
16277 See similar option @option{-fprofile-note}.
16278
16279 When an executable is run in a massive parallel environment, it is recommended
16280 to save profile to different folders. That can be done with variables
16281 in @var{path} that are exported during run-time:
16282
16283 @table @gcctabopt
16284
16285 @item %p
16286 process ID.
16287
16288 @item %q@{VAR@}
16289 value of environment variable @var{VAR}
16290
16291 @end table
16292
16293 @item -fprofile-generate
16294 @itemx -fprofile-generate=@var{path}
16295 @opindex fprofile-generate
16296
16297 Enable options usually used for instrumenting application to produce
16298 profile useful for later recompilation with profile feedback based
16299 optimization. You must use @option{-fprofile-generate} both when
16300 compiling and when linking your program.
16301
16302 The following options are enabled:
16303 @option{-fprofile-arcs}, @option{-fprofile-values},
16304 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16305
16306 If @var{path} is specified, GCC looks at the @var{path} to find
16307 the profile feedback data files. See @option{-fprofile-dir}.
16308
16309 To optimize the program based on the collected profile information, use
16310 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
16311
16312 @item -fprofile-info-section
16313 @itemx -fprofile-info-section=@var{name}
16314 @opindex fprofile-info-section
16315
16316 Register the profile information in the specified section instead of using a
16317 constructor/destructor. The section name is @var{name} if it is specified,
16318 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
16319 profile information generated by @option{-fprofile-arcs} is placed in the
16320 specified section for each translation unit. This option disables the profile
16321 information registration through a constructor and it disables the profile
16322 information processing through a destructor. This option is not intended to be
16323 used in hosted environments such as GNU/Linux. It targets freestanding
16324 environments (for example embedded systems) with limited resources which do not
16325 support constructors/destructors or the C library file I/O.
16326
16327 The linker could collect the input sections in a continuous memory block and
16328 define start and end symbols. A GNU linker script example which defines a
16329 linker output section follows:
16330
16331 @smallexample
16332 .gcov_info :
16333 @{
16334 PROVIDE (__gcov_info_start = .);
16335 KEEP (*(.gcov_info))
16336 PROVIDE (__gcov_info_end = .);
16337 @}
16338 @end smallexample
16339
16340 The program could dump the profiling information registered in this linker set
16341 for example like this:
16342
16343 @smallexample
16344 #include <gcov.h>
16345 #include <stdio.h>
16346 #include <stdlib.h>
16347
16348 extern const struct gcov_info *const __gcov_info_start[];
16349 extern const struct gcov_info *const __gcov_info_end[];
16350
16351 static void
16352 dump (const void *d, unsigned n, void *arg)
16353 @{
16354 const unsigned char *c = d;
16355
16356 for (unsigned i = 0; i < n; ++i)
16357 printf ("%02x", c[i]);
16358 @}
16359
16360 static void
16361 filename (const char *f, void *arg)
16362 @{
16363 __gcov_filename_to_gcfn (f, dump, arg );
16364 @}
16365
16366 static void *
16367 allocate (unsigned length, void *arg)
16368 @{
16369 return malloc (length);
16370 @}
16371
16372 static void
16373 dump_gcov_info (void)
16374 @{
16375 const struct gcov_info *const *info = __gcov_info_start;
16376 const struct gcov_info *const *end = __gcov_info_end;
16377
16378 /* Obfuscate variable to prevent compiler optimizations. */
16379 __asm__ ("" : "+r" (info));
16380
16381 while (info != end)
16382 @{
16383 void *arg = NULL;
16384 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16385 putchar ('\n');
16386 ++info;
16387 @}
16388 @}
16389
16390 int
16391 main (void)
16392 @{
16393 dump_gcov_info ();
16394 return 0;
16395 @}
16396 @end smallexample
16397
16398 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16399 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16400 @code{__gcov_info_to_gcda} functions and merge the profile information into
16401 @file{.gcda} files on the host filesystem.
16402
16403 @item -fprofile-note=@var{path}
16404 @opindex fprofile-note
16405
16406 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16407 location. If you combine the option with multiple source files,
16408 the @file{.gcno} file will be overwritten.
16409
16410 @item -fprofile-prefix-path=@var{path}
16411 @opindex fprofile-prefix-path
16412
16413 This option can be used in combination with
16414 @option{profile-generate=}@var{profile_dir} and
16415 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16416 directory of built source tree. By default @var{profile_dir} will contain
16417 files with mangled absolute paths of all object files in the built project.
16418 This is not desirable when directory used to build the instrumented binary
16419 differs from the directory used to build the binary optimized with profile
16420 feedback because the profile data will not be found during the optimized build.
16421 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16422 pointing to the base directory of the build can be used to strip the irrelevant
16423 part of the path and keep all file names relative to the main build directory.
16424
16425 @item -fprofile-prefix-map=@var{old}=@var{new}
16426 @opindex fprofile-prefix-map
16427 When compiling files residing in directory @file{@var{old}}, record
16428 profiling information (with @option{--coverage})
16429 describing them as if the files resided in
16430 directory @file{@var{new}} instead.
16431 See also @option{-ffile-prefix-map}.
16432
16433 @item -fprofile-update=@var{method}
16434 @opindex fprofile-update
16435
16436 Alter the update method for an application instrumented for profile
16437 feedback based optimization. The @var{method} argument should be one of
16438 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16439 The first one is useful for single-threaded applications,
16440 while the second one prevents profile corruption by emitting thread-safe code.
16441
16442 @strong{Warning:} When an application does not properly join all threads
16443 (or creates an detached thread), a profile file can be still corrupted.
16444
16445 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16446 when supported by a target, or to @samp{single} otherwise. The GCC driver
16447 automatically selects @samp{prefer-atomic} when @option{-pthread}
16448 is present in the command line.
16449
16450 @item -fprofile-filter-files=@var{regex}
16451 @opindex fprofile-filter-files
16452
16453 Instrument only functions from files whose name matches
16454 any of the regular expressions (separated by semi-colons).
16455
16456 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16457 only @file{main.c} and all C files starting with 'module'.
16458
16459 @item -fprofile-exclude-files=@var{regex}
16460 @opindex fprofile-exclude-files
16461
16462 Instrument only functions from files whose name does not match
16463 any of the regular expressions (separated by semi-colons).
16464
16465 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16466 of all files that are located in the @file{/usr/} folder.
16467
16468 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16469 @opindex fprofile-reproducible
16470 Control level of reproducibility of profile gathered by
16471 @code{-fprofile-generate}. This makes it possible to rebuild program
16472 with same outcome which is useful, for example, for distribution
16473 packages.
16474
16475 With @option{-fprofile-reproducible=serial} the profile gathered by
16476 @option{-fprofile-generate} is reproducible provided the trained program
16477 behaves the same at each invocation of the train run, it is not
16478 multi-threaded and profile data streaming is always done in the same
16479 order. Note that profile streaming happens at the end of program run but
16480 also before @code{fork} function is invoked.
16481
16482 Note that it is quite common that execution counts of some part of
16483 programs depends, for example, on length of temporary file names or
16484 memory space randomization (that may affect hash-table collision rate).
16485 Such non-reproducible part of programs may be annotated by
16486 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16487 @option{-l} can be used to dump gathered data and verify that they are
16488 indeed reproducible.
16489
16490 With @option{-fprofile-reproducible=parallel-runs} collected profile
16491 stays reproducible regardless the order of streaming of the data into
16492 gcda files. This setting makes it possible to run multiple instances of
16493 instrumented program in parallel (such as with @code{make -j}). This
16494 reduces quality of gathered data, in particular of indirect call
16495 profiling.
16496
16497 @item -fsanitize=address
16498 @opindex fsanitize=address
16499 Enable AddressSanitizer, a fast memory error detector.
16500 Memory access instructions are instrumented to detect
16501 out-of-bounds and use-after-free bugs.
16502 The option enables @option{-fsanitize-address-use-after-scope}.
16503 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16504 more details. The run-time behavior can be influenced using the
16505 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
16506 the available options are shown at startup of the instrumented program. See
16507 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16508 for a list of supported options.
16509 The option cannot be combined with @option{-fsanitize=thread} or
16510 @option{-fsanitize=hwaddress}. Note that the only target
16511 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16512
16513 To get more accurate stack traces, it is possible to use options such as
16514 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16515 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16516 optimizing sibling and tail recursive calls; this option is implicit for
16517 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16518 disables Identical Code Folding for functions). Since multiple runs of the
16519 program may yield backtraces with different addresses due to ASLR (Address
16520 Space Layout Randomization), it may be desirable to turn ASLR off. On Linux,
16521 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16522
16523 @item -fsanitize=kernel-address
16524 @opindex fsanitize=kernel-address
16525 Enable AddressSanitizer for Linux kernel.
16526 See @uref{https://github.com/google/kasan} for more details.
16527
16528 @item -fsanitize=hwaddress
16529 @opindex fsanitize=hwaddress
16530 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16531 ignore the top byte of a pointer to allow the detection of memory errors with
16532 a low memory overhead.
16533 Memory access instructions are instrumented to detect out-of-bounds and
16534 use-after-free bugs.
16535 The option enables @option{-fsanitize-address-use-after-scope}.
16536 See
16537 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16538 for more details. The run-time behavior can be influenced using the
16539 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
16540 the available options are shown at startup of the instrumented program.
16541 The option cannot be combined with @option{-fsanitize=thread} or
16542 @option{-fsanitize=address}, and is currently only available on AArch64.
16543
16544 @item -fsanitize=kernel-hwaddress
16545 @opindex fsanitize=kernel-hwaddress
16546 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16547 Similar to @option{-fsanitize=kernel-address} but using an alternate
16548 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16549 instrumentation differences necessary for compiling the Linux kernel.
16550 These differences are to avoid hwasan library initialization calls and to
16551 account for the stack pointer having a different value in its top byte.
16552
16553 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16554 Instrumenting the stack and alloca calls are not on by default but are still
16555 possible by specifying the command-line options
16556 @option{--param hwasan-instrument-stack=1} and
16557 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16558 tag is not implemented for kernel instrumentation.
16559
16560 @item -fsanitize=pointer-compare
16561 @opindex fsanitize=pointer-compare
16562 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16563 The option must be combined with either @option{-fsanitize=kernel-address} or
16564 @option{-fsanitize=address}
16565 The option cannot be combined with @option{-fsanitize=thread}.
16566 Note: By default the check is disabled at run time. To enable it,
16567 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16568 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16569 invalid operation only when both pointers are non-null.
16570
16571 @item -fsanitize=pointer-subtract
16572 @opindex fsanitize=pointer-subtract
16573 Instrument subtraction with pointer operands.
16574 The option must be combined with either @option{-fsanitize=kernel-address} or
16575 @option{-fsanitize=address}
16576 The option cannot be combined with @option{-fsanitize=thread}.
16577 Note: By default the check is disabled at run time. To enable it,
16578 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16579 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16580 invalid operation only when both pointers are non-null.
16581
16582 @item -fsanitize=shadow-call-stack
16583 @opindex fsanitize=shadow-call-stack
16584 Enable ShadowCallStack, a security enhancement mechanism used to protect
16585 programs against return address overwrites (e.g. stack buffer overflows.)
16586 It works by saving a function's return address to a separately allocated
16587 shadow call stack in the function prologue and restoring the return address
16588 from the shadow call stack in the function epilogue. Instrumentation only
16589 occurs in functions that need to save the return address to the stack.
16590
16591 Currently it only supports the aarch64 platform. It is specifically
16592 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
16593 For the user space programs, runtime support is not currently provided
16594 in libc and libgcc. Users who want to use this feature in user space need
16595 to provide their own support for the runtime. It should be noted that
16596 this may cause the ABI rules to be broken.
16597
16598 On aarch64, the instrumentation makes use of the platform register @code{x18}.
16599 This generally means that any code that may run on the same thread as code
16600 compiled with ShadowCallStack must be compiled with the flag
16601 @option{-ffixed-x18}, otherwise functions compiled without
16602 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
16603 stack pointer.
16604
16605 Also, because there is no userspace runtime support, code compiled with
16606 ShadowCallStack cannot use exception handling. Use @option{-fno-exceptions}
16607 to turn off exceptions.
16608
16609 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
16610 details.
16611
16612 @item -fsanitize=thread
16613 @opindex fsanitize=thread
16614 Enable ThreadSanitizer, a fast data race detector.
16615 Memory access instructions are instrumented to detect
16616 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
16617 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
16618 environment variable; see
16619 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
16620 supported options.
16621 The option cannot be combined with @option{-fsanitize=address},
16622 @option{-fsanitize=leak}.
16623
16624 Note that sanitized atomic builtins cannot throw exceptions when
16625 operating on invalid memory addresses with non-call exceptions
16626 (@option{-fnon-call-exceptions}).
16627
16628 @item -fsanitize=leak
16629 @opindex fsanitize=leak
16630 Enable LeakSanitizer, a memory leak detector.
16631 This option only matters for linking of executables and
16632 the executable is linked against a library that overrides @code{malloc}
16633 and other allocator functions. See
16634 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
16635 details. The run-time behavior can be influenced using the
16636 @env{LSAN_OPTIONS} environment variable.
16637 The option cannot be combined with @option{-fsanitize=thread}.
16638
16639 @item -fsanitize=undefined
16640 @opindex fsanitize=undefined
16641 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
16642 Various computations are instrumented to detect undefined behavior
16643 at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the
16644 @env{UBSAN_OPTIONS} environment variable. Current suboptions are:
16645
16646 @table @gcctabopt
16647
16648 @item -fsanitize=shift
16649 @opindex fsanitize=shift
16650 This option enables checking that the result of a shift operation is
16651 not undefined. Note that what exactly is considered undefined differs
16652 slightly between C and C++, as well as between ISO C90 and C99, etc.
16653 This option has two suboptions, @option{-fsanitize=shift-base} and
16654 @option{-fsanitize=shift-exponent}.
16655
16656 @item -fsanitize=shift-exponent
16657 @opindex fsanitize=shift-exponent
16658 This option enables checking that the second argument of a shift operation
16659 is not negative and is smaller than the precision of the promoted first
16660 argument.
16661
16662 @item -fsanitize=shift-base
16663 @opindex fsanitize=shift-base
16664 If the second argument of a shift operation is within range, check that the
16665 result of a shift operation is not undefined. Note that what exactly is
16666 considered undefined differs slightly between C and C++, as well as between
16667 ISO C90 and C99, etc.
16668
16669 @item -fsanitize=integer-divide-by-zero
16670 @opindex fsanitize=integer-divide-by-zero
16671 Detect integer division by zero.
16672
16673 @item -fsanitize=unreachable
16674 @opindex fsanitize=unreachable
16675 With this option, the compiler turns the @code{__builtin_unreachable}
16676 call into a diagnostics message call instead. When reaching the
16677 @code{__builtin_unreachable} call, the behavior is undefined.
16678
16679 @item -fsanitize=vla-bound
16680 @opindex fsanitize=vla-bound
16681 This option instructs the compiler to check that the size of a variable
16682 length array is positive.
16683
16684 @item -fsanitize=null
16685 @opindex fsanitize=null
16686 This option enables pointer checking. Particularly, the application
16687 built with this option turned on will issue an error message when it
16688 tries to dereference a NULL pointer, or if a reference (possibly an
16689 rvalue reference) is bound to a NULL pointer, or if a method is invoked
16690 on an object pointed by a NULL pointer.
16691
16692 @item -fsanitize=return
16693 @opindex fsanitize=return
16694 This option enables return statement checking. Programs
16695 built with this option turned on will issue an error message
16696 when the end of a non-void function is reached without actually
16697 returning a value. This option works in C++ only.
16698
16699 @item -fsanitize=signed-integer-overflow
16700 @opindex fsanitize=signed-integer-overflow
16701 This option enables signed integer overflow checking. We check that
16702 the result of @code{+}, @code{*}, and both unary and binary @code{-}
16703 does not overflow in the signed arithmetics. This also detects
16704 @code{INT_MIN / -1} signed division. Note, integer promotion
16705 rules must be taken into account. That is, the following is not an
16706 overflow:
16707 @smallexample
16708 signed char a = SCHAR_MAX;
16709 a++;
16710 @end smallexample
16711
16712 @item -fsanitize=bounds
16713 @opindex fsanitize=bounds
16714 This option enables instrumentation of array bounds. Various out of bounds
16715 accesses are detected. Flexible array members, flexible array member-like
16716 arrays, and initializers of variables with static storage are not instrumented.
16717
16718 @item -fsanitize=bounds-strict
16719 @opindex fsanitize=bounds-strict
16720 This option enables strict instrumentation of array bounds. Most out of bounds
16721 accesses are detected, including flexible array members and flexible array
16722 member-like arrays. Initializers of variables with static storage are not
16723 instrumented.
16724
16725 @item -fsanitize=alignment
16726 @opindex fsanitize=alignment
16727
16728 This option enables checking of alignment of pointers when they are
16729 dereferenced, or when a reference is bound to insufficiently aligned target,
16730 or when a method or constructor is invoked on insufficiently aligned object.
16731
16732 @item -fsanitize=object-size
16733 @opindex fsanitize=object-size
16734 This option enables instrumentation of memory references using the
16735 @code{__builtin_object_size} function. Various out of bounds pointer
16736 accesses are detected.
16737
16738 @item -fsanitize=float-divide-by-zero
16739 @opindex fsanitize=float-divide-by-zero
16740 Detect floating-point division by zero. Unlike other similar options,
16741 @option{-fsanitize=float-divide-by-zero} is not enabled by
16742 @option{-fsanitize=undefined}, since floating-point division by zero can
16743 be a legitimate way of obtaining infinities and NaNs.
16744
16745 @item -fsanitize=float-cast-overflow
16746 @opindex fsanitize=float-cast-overflow
16747 This option enables floating-point type to integer conversion checking.
16748 We check that the result of the conversion does not overflow.
16749 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
16750 not enabled by @option{-fsanitize=undefined}.
16751 This option does not work well with @code{FE_INVALID} exceptions enabled.
16752
16753 @item -fsanitize=nonnull-attribute
16754 @opindex fsanitize=nonnull-attribute
16755
16756 This option enables instrumentation of calls, checking whether null values
16757 are not passed to arguments marked as requiring a non-null value by the
16758 @code{nonnull} function attribute.
16759
16760 @item -fsanitize=returns-nonnull-attribute
16761 @opindex fsanitize=returns-nonnull-attribute
16762
16763 This option enables instrumentation of return statements in functions
16764 marked with @code{returns_nonnull} function attribute, to detect returning
16765 of null values from such functions.
16766
16767 @item -fsanitize=bool
16768 @opindex fsanitize=bool
16769
16770 This option enables instrumentation of loads from bool. If a value other
16771 than 0/1 is loaded, a run-time error is issued.
16772
16773 @item -fsanitize=enum
16774 @opindex fsanitize=enum
16775
16776 This option enables instrumentation of loads from an enum type. If
16777 a value outside the range of values for the enum type is loaded,
16778 a run-time error is issued.
16779
16780 @item -fsanitize=vptr
16781 @opindex fsanitize=vptr
16782
16783 This option enables instrumentation of C++ member function calls, member
16784 accesses and some conversions between pointers to base and derived classes,
16785 to verify the referenced object has the correct dynamic type.
16786
16787 @item -fsanitize=pointer-overflow
16788 @opindex fsanitize=pointer-overflow
16789
16790 This option enables instrumentation of pointer arithmetics. If the pointer
16791 arithmetics overflows, a run-time error is issued.
16792
16793 @item -fsanitize=builtin
16794 @opindex fsanitize=builtin
16795
16796 This option enables instrumentation of arguments to selected builtin
16797 functions. If an invalid value is passed to such arguments, a run-time
16798 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
16799 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
16800 by this option.
16801
16802 @end table
16803
16804 Note that sanitizers tend to increase the rate of false positive
16805 warnings, most notably those around @option{-Wmaybe-uninitialized}.
16806 We recommend against combining @option{-Werror} and [the use of]
16807 sanitizers.
16808
16809 While @option{-ftrapv} causes traps for signed overflows to be emitted,
16810 @option{-fsanitize=undefined} gives a diagnostic message.
16811 This currently works only for the C family of languages.
16812
16813 @item -fno-sanitize=all
16814 @opindex fno-sanitize=all
16815
16816 This option disables all previously enabled sanitizers.
16817 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
16818 together.
16819
16820 @item -fasan-shadow-offset=@var{number}
16821 @opindex fasan-shadow-offset
16822 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
16823 It is useful for experimenting with different shadow memory layouts in
16824 Kernel AddressSanitizer.
16825
16826 @item -fsanitize-sections=@var{s1},@var{s2},...
16827 @opindex fsanitize-sections
16828 Sanitize global variables in selected user-defined sections. @var{si} may
16829 contain wildcards.
16830
16831 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
16832 @opindex fsanitize-recover
16833 @opindex fno-sanitize-recover
16834 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
16835 mentioned in comma-separated list of @var{opts}. Enabling this option
16836 for a sanitizer component causes it to attempt to continue
16837 running the program as if no error happened. This means multiple
16838 runtime errors can be reported in a single program run, and the exit
16839 code of the program may indicate success even when errors
16840 have been reported. The @option{-fno-sanitize-recover=} option
16841 can be used to alter
16842 this behavior: only the first detected error is reported
16843 and program then exits with a non-zero exit code.
16844
16845 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
16846 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
16847 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
16848 @option{-fsanitize=bounds-strict},
16849 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
16850 For these sanitizers error recovery is turned on by default,
16851 except @option{-fsanitize=address}, for which this feature is experimental.
16852 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
16853 accepted, the former enables recovery for all sanitizers that support it,
16854 the latter disables recovery for all sanitizers that support it.
16855
16856 Even if a recovery mode is turned on the compiler side, it needs to be also
16857 enabled on the runtime library side, otherwise the failures are still fatal.
16858 The runtime library defaults to @code{halt_on_error=0} for
16859 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
16860 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
16861 setting the @code{halt_on_error} flag in the corresponding environment variable.
16862
16863 Syntax without an explicit @var{opts} parameter is deprecated. It is
16864 equivalent to specifying an @var{opts} list of:
16865
16866 @smallexample
16867 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
16868 @end smallexample
16869
16870 @item -fsanitize-address-use-after-scope
16871 @opindex fsanitize-address-use-after-scope
16872 Enable sanitization of local variables to detect use-after-scope bugs.
16873 The option sets @option{-fstack-reuse} to @samp{none}.
16874
16875 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
16876 @opindex fsanitize-trap
16877 @opindex fno-sanitize-trap
16878 The @option{-fsanitize-trap=} option instructs the compiler to
16879 report for sanitizers mentioned in comma-separated list of @var{opts}
16880 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
16881 library routine. If this option is enabled for certain sanitizer,
16882 it takes precedence over the @option{-fsanitizer-recover=} for that
16883 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
16884 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
16885
16886 The advantage of this is that the @code{libubsan} library is not needed
16887 and is not linked in, so this is usable even in freestanding environments.
16888
16889 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
16890 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
16891 @option{-fsanitize=float-divide-by-zero} and
16892 @option{-fsanitize=bounds-strict}. @code{-fsanitize-trap=all} can be also
16893 specified, which enables it for @code{undefined} suboptions,
16894 @option{-fsanitize=float-cast-overflow},
16895 @option{-fsanitize=float-divide-by-zero} and
16896 @option{-fsanitize=bounds-strict}.
16897 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
16898 and @code{-fsanitize=vptr} is enabled on the command line, the
16899 instrumentation is silently ignored as the instrumentation always needs
16900 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
16901
16902 @item -fsanitize-undefined-trap-on-error
16903 @opindex fsanitize-undefined-trap-on-error
16904 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
16905 equivalent of @option{-fsanitize-trap=all}.
16906
16907 @item -fsanitize-coverage=trace-pc
16908 @opindex fsanitize-coverage=trace-pc
16909 Enable coverage-guided fuzzing code instrumentation.
16910 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
16911
16912 @item -fsanitize-coverage=trace-cmp
16913 @opindex fsanitize-coverage=trace-cmp
16914 Enable dataflow guided fuzzing code instrumentation.
16915 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
16916 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
16917 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
16918 variable or @code{__sanitizer_cov_trace_const_cmp1},
16919 @code{__sanitizer_cov_trace_const_cmp2},
16920 @code{__sanitizer_cov_trace_const_cmp4} or
16921 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
16922 operand constant, @code{__sanitizer_cov_trace_cmpf} or
16923 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
16924 @code{__sanitizer_cov_trace_switch} for switch statements.
16925
16926 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
16927 @opindex fcf-protection
16928 Enable code instrumentation of control-flow transfers to increase
16929 program security by checking that target addresses of control-flow
16930 transfer instructions (such as indirect function call, function return,
16931 indirect jump) are valid. This prevents diverting the flow of control
16932 to an unexpected target. This is intended to protect against such
16933 threats as Return-oriented Programming (ROP), and similarly
16934 call/jmp-oriented programming (COP/JOP).
16935
16936 The value @code{branch} tells the compiler to implement checking of
16937 validity of control-flow transfer at the point of indirect branch
16938 instructions, i.e.@: call/jmp instructions. The value @code{return}
16939 implements checking of validity at the point of returning from a
16940 function. The value @code{full} is an alias for specifying both
16941 @code{branch} and @code{return}. The value @code{none} turns off
16942 instrumentation.
16943
16944 The value @code{check} is used for the final link with link-time
16945 optimization (LTO). An error is issued if LTO object files are
16946 compiled with different @option{-fcf-protection} values. The
16947 value @code{check} is ignored at the compile time.
16948
16949 The macro @code{__CET__} is defined when @option{-fcf-protection} is
16950 used. The first bit of @code{__CET__} is set to 1 for the value
16951 @code{branch} and the second bit of @code{__CET__} is set to 1 for
16952 the @code{return}.
16953
16954 You can also use the @code{nocf_check} attribute to identify
16955 which functions and calls should be skipped from instrumentation
16956 (@pxref{Function Attributes}).
16957
16958 Currently the x86 GNU/Linux target provides an implementation based
16959 on Intel Control-flow Enforcement Technology (CET) which works for
16960 i686 processor or newer.
16961
16962 @item -fharden-compares
16963 @opindex fharden-compares
16964 For every logical test that survives gimple optimizations and is
16965 @emph{not} the condition in a conditional branch (for example,
16966 conditions tested for conditional moves, or to store in boolean
16967 variables), emit extra code to compute and verify the reversed
16968 condition, and to call @code{__builtin_trap} if the results do not
16969 match. Use with @samp{-fharden-conditional-branches} to cover all
16970 conditionals.
16971
16972 @item -fharden-conditional-branches
16973 @opindex fharden-conditional-branches
16974 For every non-vectorized conditional branch that survives gimple
16975 optimizations, emit extra code to compute and verify the reversed
16976 condition, and to call @code{__builtin_trap} if the result is
16977 unexpected. Use with @samp{-fharden-compares} to cover all
16978 conditionals.
16979
16980 @item -fstack-protector
16981 @opindex fstack-protector
16982 Emit extra code to check for buffer overflows, such as stack smashing
16983 attacks. This is done by adding a guard variable to functions with
16984 vulnerable objects. This includes functions that call @code{alloca}, and
16985 functions with buffers larger than or equal to 8 bytes. The guards are
16986 initialized when a function is entered and then checked when the function
16987 exits. If a guard check fails, an error message is printed and the program
16988 exits. Only variables that are actually allocated on the stack are
16989 considered, optimized away variables or variables allocated in registers
16990 don't count.
16991
16992 @item -fstack-protector-all
16993 @opindex fstack-protector-all
16994 Like @option{-fstack-protector} except that all functions are protected.
16995
16996 @item -fstack-protector-strong
16997 @opindex fstack-protector-strong
16998 Like @option{-fstack-protector} but includes additional functions to
16999 be protected --- those that have local array definitions, or have
17000 references to local frame addresses. Only variables that are actually
17001 allocated on the stack are considered, optimized away variables or variables
17002 allocated in registers don't count.
17003
17004 @item -fstack-protector-explicit
17005 @opindex fstack-protector-explicit
17006 Like @option{-fstack-protector} but only protects those functions which
17007 have the @code{stack_protect} attribute.
17008
17009 @item -fstack-check
17010 @opindex fstack-check
17011 Generate code to verify that you do not go beyond the boundary of the
17012 stack. You should specify this flag if you are running in an
17013 environment with multiple threads, but you only rarely need to specify it in
17014 a single-threaded environment since stack overflow is automatically
17015 detected on nearly all systems if there is only one stack.
17016
17017 Note that this switch does not actually cause checking to be done; the
17018 operating system or the language runtime must do that. The switch causes
17019 generation of code to ensure that they see the stack being extended.
17020
17021 You can additionally specify a string parameter: @samp{no} means no
17022 checking, @samp{generic} means force the use of old-style checking,
17023 @samp{specific} means use the best checking method and is equivalent
17024 to bare @option{-fstack-check}.
17025
17026 Old-style checking is a generic mechanism that requires no specific
17027 target support in the compiler but comes with the following drawbacks:
17028
17029 @enumerate
17030 @item
17031 Modified allocation strategy for large objects: they are always
17032 allocated dynamically if their size exceeds a fixed threshold. Note this
17033 may change the semantics of some code.
17034
17035 @item
17036 Fixed limit on the size of the static frame of functions: when it is
17037 topped by a particular function, stack checking is not reliable and
17038 a warning is issued by the compiler.
17039
17040 @item
17041 Inefficiency: because of both the modified allocation strategy and the
17042 generic implementation, code performance is hampered.
17043 @end enumerate
17044
17045 Note that old-style stack checking is also the fallback method for
17046 @samp{specific} if no target support has been added in the compiler.
17047
17048 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17049 and stack overflows. @samp{specific} is an excellent choice when compiling
17050 Ada code. It is not generally sufficient to protect against stack-clash
17051 attacks. To protect against those you want @samp{-fstack-clash-protection}.
17052
17053 @item -fstack-clash-protection
17054 @opindex fstack-clash-protection
17055 Generate code to prevent stack clash style attacks. When this option is
17056 enabled, the compiler will only allocate one page of stack space at a time
17057 and each page is accessed immediately after allocation. Thus, it prevents
17058 allocations from jumping over any stack guard page provided by the
17059 operating system.
17060
17061 Most targets do not fully support stack clash protection. However, on
17062 those targets @option{-fstack-clash-protection} will protect dynamic stack
17063 allocations. @option{-fstack-clash-protection} may also provide limited
17064 protection for static stack allocations if the target supports
17065 @option{-fstack-check=specific}.
17066
17067 @item -fstack-limit-register=@var{reg}
17068 @itemx -fstack-limit-symbol=@var{sym}
17069 @itemx -fno-stack-limit
17070 @opindex fstack-limit-register
17071 @opindex fstack-limit-symbol
17072 @opindex fno-stack-limit
17073 Generate code to ensure that the stack does not grow beyond a certain value,
17074 either the value of a register or the address of a symbol. If a larger
17075 stack is required, a signal is raised at run time. For most targets,
17076 the signal is raised before the stack overruns the boundary, so
17077 it is possible to catch the signal without taking special precautions.
17078
17079 For instance, if the stack starts at absolute address @samp{0x80000000}
17080 and grows downwards, you can use the flags
17081 @option{-fstack-limit-symbol=__stack_limit} and
17082 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17083 of 128KB@. Note that this may only work with the GNU linker.
17084
17085 You can locally override stack limit checking by using the
17086 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17087
17088 @item -fsplit-stack
17089 @opindex fsplit-stack
17090 Generate code to automatically split the stack before it overflows.
17091 The resulting program has a discontiguous stack which can only
17092 overflow if the program is unable to allocate any more memory. This
17093 is most useful when running threaded programs, as it is no longer
17094 necessary to calculate a good stack size to use for each thread. This
17095 is currently only implemented for the x86 targets running
17096 GNU/Linux.
17097
17098 When code compiled with @option{-fsplit-stack} calls code compiled
17099 without @option{-fsplit-stack}, there may not be much stack space
17100 available for the latter code to run. If compiling all code,
17101 including library code, with @option{-fsplit-stack} is not an option,
17102 then the linker can fix up these calls so that the code compiled
17103 without @option{-fsplit-stack} always has a large stack. Support for
17104 this is implemented in the gold linker in GNU binutils release 2.21
17105 and later.
17106
17107 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17108 @opindex fvtable-verify
17109 This option is only available when compiling C++ code.
17110 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17111 feature that verifies at run time, for every virtual call, that
17112 the vtable pointer through which the call is made is valid for the type of
17113 the object, and has not been corrupted or overwritten. If an invalid vtable
17114 pointer is detected at run time, an error is reported and execution of the
17115 program is immediately halted.
17116
17117 This option causes run-time data structures to be built at program startup,
17118 which are used for verifying the vtable pointers.
17119 The options @samp{std} and @samp{preinit}
17120 control the timing of when these data structures are built. In both cases the
17121 data structures are built before execution reaches @code{main}. Using
17122 @option{-fvtable-verify=std} causes the data structures to be built after
17123 shared libraries have been loaded and initialized.
17124 @option{-fvtable-verify=preinit} causes them to be built before shared
17125 libraries have been loaded and initialized.
17126
17127 If this option appears multiple times in the command line with different
17128 values specified, @samp{none} takes highest priority over both @samp{std} and
17129 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17130
17131 @item -fvtv-debug
17132 @opindex fvtv-debug
17133 When used in conjunction with @option{-fvtable-verify=std} or
17134 @option{-fvtable-verify=preinit}, causes debug versions of the
17135 runtime functions for the vtable verification feature to be called.
17136 This flag also causes the compiler to log information about which
17137 vtable pointers it finds for each class.
17138 This information is written to a file named @file{vtv_set_ptr_data.log}
17139 in the directory named by the environment variable @env{VTV_LOGS_DIR}
17140 if that is defined or the current working directory otherwise.
17141
17142 Note: This feature @emph{appends} data to the log file. If you want a fresh log
17143 file, be sure to delete any existing one.
17144
17145 @item -fvtv-counts
17146 @opindex fvtv-counts
17147 This is a debugging flag. When used in conjunction with
17148 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17149 causes the compiler to keep track of the total number of virtual calls
17150 it encounters and the number of verifications it inserts. It also
17151 counts the number of calls to certain run-time library functions
17152 that it inserts and logs this information for each compilation unit.
17153 The compiler writes this information to a file named
17154 @file{vtv_count_data.log} in the directory named by the environment
17155 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17156 directory otherwise. It also counts the size of the vtable pointer sets
17157 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17158 in the same directory.
17159
17160 Note: This feature @emph{appends} data to the log files. To get fresh log
17161 files, be sure to delete any existing ones.
17162
17163 @item -finstrument-functions
17164 @opindex finstrument-functions
17165 Generate instrumentation calls for entry and exit to functions. Just
17166 after function entry and just before function exit, the following
17167 profiling functions are called with the address of the current
17168 function and its call site. (On some platforms,
17169 @code{__builtin_return_address} does not work beyond the current
17170 function, so the call site information may not be available to the
17171 profiling functions otherwise.)
17172
17173 @smallexample
17174 void __cyg_profile_func_enter (void *this_fn,
17175 void *call_site);
17176 void __cyg_profile_func_exit (void *this_fn,
17177 void *call_site);
17178 @end smallexample
17179
17180 The first argument is the address of the start of the current function,
17181 which may be looked up exactly in the symbol table.
17182
17183 This instrumentation is also done for functions expanded inline in other
17184 functions. The profiling calls indicate where, conceptually, the
17185 inline function is entered and exited. This means that addressable
17186 versions of such functions must be available. If all your uses of a
17187 function are expanded inline, this may mean an additional expansion of
17188 code size. If you use @code{extern inline} in your C code, an
17189 addressable version of such functions must be provided. (This is
17190 normally the case anyway, but if you get lucky and the optimizer always
17191 expands the functions inline, you might have gotten away without
17192 providing static copies.)
17193
17194 A function may be given the attribute @code{no_instrument_function}, in
17195 which case this instrumentation is not done. This can be used, for
17196 example, for the profiling functions listed above, high-priority
17197 interrupt routines, and any functions from which the profiling functions
17198 cannot safely be called (perhaps signal handlers, if the profiling
17199 routines generate output or allocate memory).
17200 @xref{Common Function Attributes}.
17201
17202 @item -finstrument-functions-once
17203 @opindex finstrument-functions-once
17204 This is similar to @option{-finstrument-functions}, but the profiling
17205 functions are called only once per instrumented function, i.e. the first
17206 profiling function is called after the first entry into the instrumented
17207 function and the second profiling function is called before the exit
17208 corresponding to this first entry.
17209
17210 The definition of @code{once} for the purpose of this option is a little
17211 vague because the implementation is not protected against data races.
17212 As a result, the implementation only guarantees that the profiling
17213 functions are called at @emph{least} once per process and at @emph{most}
17214 once per thread, but the calls are always paired, that is to say, if a
17215 thread calls the first function, then it will call the second function,
17216 unless it never reaches the exit of the instrumented function.
17217
17218 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17219 @opindex finstrument-functions-exclude-file-list
17220
17221 Set the list of functions that are excluded from instrumentation (see
17222 the description of @option{-finstrument-functions}). If the file that
17223 contains a function definition matches with one of @var{file}, then
17224 that function is not instrumented. The match is done on substrings:
17225 if the @var{file} parameter is a substring of the file name, it is
17226 considered to be a match.
17227
17228 For example:
17229
17230 @smallexample
17231 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17232 @end smallexample
17233
17234 @noindent
17235 excludes any inline function defined in files whose pathnames
17236 contain @file{/bits/stl} or @file{include/sys}.
17237
17238 If, for some reason, you want to include letter @samp{,} in one of
17239 @var{sym}, write @samp{\,}. For example,
17240 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17241 (note the single quote surrounding the option).
17242
17243 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17244 @opindex finstrument-functions-exclude-function-list
17245
17246 This is similar to @option{-finstrument-functions-exclude-file-list},
17247 but this option sets the list of function names to be excluded from
17248 instrumentation. The function name to be matched is its user-visible
17249 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17250 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
17251 match is done on substrings: if the @var{sym} parameter is a substring
17252 of the function name, it is considered to be a match. For C99 and C++
17253 extended identifiers, the function name must be given in UTF-8, not
17254 using universal character names.
17255
17256 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17257 @opindex fpatchable-function-entry
17258 Generate @var{N} NOPs right at the beginning
17259 of each function, with the function entry point before the @var{M}th NOP.
17260 If @var{M} is omitted, it defaults to @code{0} so the
17261 function entry points to the address just at the first NOP.
17262 The NOP instructions reserve extra space which can be used to patch in
17263 any desired instrumentation at run time, provided that the code segment
17264 is writable. The amount of space is controllable indirectly via
17265 the number of NOPs; the NOP instruction used corresponds to the instruction
17266 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
17267 is target-specific and may also depend on the architecture variant and/or
17268 other compilation options.
17269
17270 For run-time identification, the starting addresses of these areas,
17271 which correspond to their respective function entries minus @var{M},
17272 are additionally collected in the @code{__patchable_function_entries}
17273 section of the resulting binary.
17274
17275 Note that the value of @code{__attribute__ ((patchable_function_entry
17276 (N,M)))} takes precedence over command-line option
17277 @option{-fpatchable-function-entry=N,M}. This can be used to increase
17278 the area size or to remove it completely on a single function.
17279 If @code{N=0}, no pad location is recorded.
17280
17281 The NOP instructions are inserted at---and maybe before, depending on
17282 @var{M}---the function entry address, even before the prologue. On
17283 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17284 the local entry point is this function entry address.
17285
17286 The maximum value of @var{N} and @var{M} is 65535. On PowerPC with the
17287 ELFv2 ABI, for a function with dual entry points, the supported values
17288 for @var{M} are 0, 2, 6 and 14.
17289 @end table
17290
17291
17292 @node Preprocessor Options
17293 @section Options Controlling the Preprocessor
17294 @cindex preprocessor options
17295 @cindex options, preprocessor
17296
17297 These options control the C preprocessor, which is run on each C source
17298 file before actual compilation.
17299
17300 If you use the @option{-E} option, nothing is done except preprocessing.
17301 Some of these options make sense only together with @option{-E} because
17302 they cause the preprocessor output to be unsuitable for actual
17303 compilation.
17304
17305 In addition to the options listed here, there are a number of options
17306 to control search paths for include files documented in
17307 @ref{Directory Options}.
17308 Options to control preprocessor diagnostics are listed in
17309 @ref{Warning Options}.
17310
17311 @table @gcctabopt
17312 @include cppopts.texi
17313
17314 @item -Wp,@var{option}
17315 @opindex Wp
17316 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17317 and pass @var{option} directly through to the preprocessor. If
17318 @var{option} contains commas, it is split into multiple options at the
17319 commas. However, many options are modified, translated or interpreted
17320 by the compiler driver before being passed to the preprocessor, and
17321 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
17322 interface is undocumented and subject to change, so whenever possible
17323 you should avoid using @option{-Wp} and let the driver handle the
17324 options instead.
17325
17326 @item -Xpreprocessor @var{option}
17327 @opindex Xpreprocessor
17328 Pass @var{option} as an option to the preprocessor. You can use this to
17329 supply system-specific preprocessor options that GCC does not
17330 recognize.
17331
17332 If you want to pass an option that takes an argument, you must use
17333 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17334
17335 @item -no-integrated-cpp
17336 @opindex no-integrated-cpp
17337 Perform preprocessing as a separate pass before compilation.
17338 By default, GCC performs preprocessing as an integrated part of
17339 input tokenization and parsing.
17340 If this option is provided, the appropriate language front end
17341 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17342 and Objective-C, respectively) is instead invoked twice,
17343 once for preprocessing only and once for actual compilation
17344 of the preprocessed input.
17345 This option may be useful in conjunction with the @option{-B} or
17346 @option{-wrapper} options to specify an alternate preprocessor or
17347 perform additional processing of the program source between
17348 normal preprocessing and compilation.
17349
17350 @item -flarge-source-files
17351 @opindex flarge-source-files
17352 Adjust GCC to expect large source files, at the expense of slower
17353 compilation and higher memory usage.
17354
17355 Specifically, GCC normally tracks both column numbers and line numbers
17356 within source files and it normally prints both of these numbers in
17357 diagnostics. However, once it has processed a certain number of source
17358 lines, it stops tracking column numbers and only tracks line numbers.
17359 This means that diagnostics for later lines do not include column numbers.
17360 It also means that options like @option{-Wmisleading-indentation} cease to work
17361 at that point, although the compiler prints a note if this happens.
17362 Passing @option{-flarge-source-files} significantly increases the number
17363 of source lines that GCC can process before it stops tracking columns.
17364
17365 @end table
17366
17367 @node Assembler Options
17368 @section Passing Options to the Assembler
17369
17370 @c prevent bad page break with this line
17371 You can pass options to the assembler.
17372
17373 @table @gcctabopt
17374 @item -Wa,@var{option}
17375 @opindex Wa
17376 Pass @var{option} as an option to the assembler. If @var{option}
17377 contains commas, it is split into multiple options at the commas.
17378
17379 @item -Xassembler @var{option}
17380 @opindex Xassembler
17381 Pass @var{option} as an option to the assembler. You can use this to
17382 supply system-specific assembler options that GCC does not
17383 recognize.
17384
17385 If you want to pass an option that takes an argument, you must use
17386 @option{-Xassembler} twice, once for the option and once for the argument.
17387
17388 @end table
17389
17390 @node Link Options
17391 @section Options for Linking
17392 @cindex link options
17393 @cindex options, linking
17394
17395 These options come into play when the compiler links object files into
17396 an executable output file. They are meaningless if the compiler is
17397 not doing a link step.
17398
17399 @table @gcctabopt
17400 @cindex file names
17401 @item @var{object-file-name}
17402 A file name that does not end in a special recognized suffix is
17403 considered to name an object file or library. (Object files are
17404 distinguished from libraries by the linker according to the file
17405 contents.) If linking is done, these object files are used as input
17406 to the linker.
17407
17408 @item -c
17409 @itemx -S
17410 @itemx -E
17411 @opindex c
17412 @opindex S
17413 @opindex E
17414 If any of these options is used, then the linker is not run, and
17415 object file names should not be used as arguments. @xref{Overall
17416 Options}.
17417
17418 @item -flinker-output=@var{type}
17419 @opindex flinker-output
17420 This option controls code generation of the link-time optimizer. By
17421 default the linker output is automatically determined by the linker
17422 plugin. For debugging the compiler and if incremental linking with a
17423 non-LTO object file is desired, it may be useful to control the type
17424 manually.
17425
17426 If @var{type} is @samp{exec}, code generation produces a static
17427 binary. In this case @option{-fpic} and @option{-fpie} are both
17428 disabled.
17429
17430 If @var{type} is @samp{dyn}, code generation produces a shared
17431 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
17432 but not enabled automatically. This allows to build shared libraries
17433 without position-independent code on architectures where this is
17434 possible, i.e.@: on x86.
17435
17436 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17437 executable. This results in similar optimizations as @samp{exec}
17438 except that @option{-fpie} is not disabled if specified at compilation
17439 time.
17440
17441 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17442 done. The sections containing intermediate code for link-time optimization are
17443 merged, pre-optimized, and output to the resulting object file. In addition, if
17444 @option{-ffat-lto-objects} is specified, binary code is produced for future
17445 non-LTO linking. The object file produced by incremental linking is smaller
17446 than a static library produced from the same object files. At link time the
17447 result of incremental linking also loads faster than a static
17448 library assuming that the majority of objects in the library are used.
17449
17450 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17451 code generation is forced, a final binary is produced, and the intermediate
17452 code for later link-time optimization is stripped. When multiple object files
17453 are linked together the resulting code is better optimized than with
17454 link-time optimizations disabled (for example, cross-module inlining
17455 happens), but most of benefits of whole program optimizations are lost.
17456
17457 During the incremental link (by @option{-r}) the linker plugin defaults to
17458 @option{rel}. With current interfaces to GNU Binutils it is however not
17459 possible to incrementally link LTO objects and non-LTO objects into a single
17460 mixed object file. If any of object files in incremental link cannot
17461 be used for link-time optimization, the linker plugin issues a warning and
17462 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17463 recommended to link such objects into static library instead. Alternatively it
17464 is possible to use H.J. Lu's binutils with support for mixed objects.
17465
17466 @item -fuse-ld=bfd
17467 @opindex fuse-ld=bfd
17468 Use the @command{bfd} linker instead of the default linker.
17469
17470 @item -fuse-ld=gold
17471 @opindex fuse-ld=gold
17472 Use the @command{gold} linker instead of the default linker.
17473
17474 @item -fuse-ld=lld
17475 @opindex fuse-ld=lld
17476 Use the LLVM @command{lld} linker instead of the default linker.
17477
17478 @item -fuse-ld=mold
17479 @opindex fuse-ld=mold
17480 Use the Modern Linker (@command{mold}) instead of the default linker.
17481
17482 @cindex Libraries
17483 @item -l@var{library}
17484 @itemx -l @var{library}
17485 @opindex l
17486 Search the library named @var{library} when linking. (The second
17487 alternative with the library as a separate argument is only for
17488 POSIX compliance and is not recommended.)
17489
17490 The @option{-l} option is passed directly to the linker by GCC. Refer
17491 to your linker documentation for exact details. The general
17492 description below applies to the GNU linker.
17493
17494 The linker searches a standard list of directories for the library.
17495 The directories searched include several standard system directories
17496 plus any that you specify with @option{-L}.
17497
17498 Static libraries are archives of object files, and have file names
17499 like @file{lib@var{library}.a}. Some targets also support shared
17500 libraries, which typically have names like @file{lib@var{library}.so}.
17501 If both static and shared libraries are found, the linker gives
17502 preference to linking with the shared library unless the
17503 @option{-static} option is used.
17504
17505 It makes a difference where in the command you write this option; the
17506 linker searches and processes libraries and object files in the order they
17507 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17508 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
17509 to functions in @samp{z}, those functions may not be loaded.
17510
17511 @item -lobjc
17512 @opindex lobjc
17513 You need this special case of the @option{-l} option in order to
17514 link an Objective-C or Objective-C++ program.
17515
17516 @item -nostartfiles
17517 @opindex nostartfiles
17518 Do not use the standard system startup files when linking.
17519 The standard system libraries are used normally, unless @option{-nostdlib},
17520 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17521
17522 @item -nodefaultlibs
17523 @opindex nodefaultlibs
17524 Do not use the standard system libraries when linking.
17525 Only the libraries you specify are passed to the linker, and options
17526 specifying linkage of the system libraries, such as @option{-static-libgcc}
17527 or @option{-shared-libgcc}, are ignored.
17528 The standard startup files are used normally, unless @option{-nostartfiles}
17529 is used.
17530
17531 The compiler may generate calls to @code{memcmp},
17532 @code{memset}, @code{memcpy} and @code{memmove}.
17533 These entries are usually resolved by entries in
17534 libc. These entry points should be supplied through some other
17535 mechanism when this option is specified.
17536
17537 @item -nolibc
17538 @opindex nolibc
17539 Do not use the C library or system libraries tightly coupled with it when
17540 linking. Still link with the startup files, @file{libgcc} or toolchain
17541 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17542 or @file{libstdc++} unless options preventing their inclusion are used as
17543 well. This typically removes @option{-lc} from the link command line, as well
17544 as system libraries that normally go with it and become meaningless when
17545 absence of a C library is assumed, for example @option{-lpthread} or
17546 @option{-lm} in some configurations. This is intended for bare-board
17547 targets when there is indeed no C library available.
17548
17549 @item -nostdlib
17550 @opindex nostdlib
17551 Do not use the standard system startup files or libraries when linking.
17552 No startup files and only the libraries you specify are passed to
17553 the linker, and options specifying linkage of the system libraries, such as
17554 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17555
17556 The compiler may generate calls to @code{memcmp}, @code{memset},
17557 @code{memcpy} and @code{memmove}.
17558 These entries are usually resolved by entries in
17559 libc. These entry points should be supplied through some other
17560 mechanism when this option is specified.
17561
17562 @cindex @option{-lgcc}, use with @option{-nostdlib}
17563 @cindex @option{-nostdlib} and unresolved references
17564 @cindex unresolved references and @option{-nostdlib}
17565 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17566 @cindex @option{-nodefaultlibs} and unresolved references
17567 @cindex unresolved references and @option{-nodefaultlibs}
17568 One of the standard libraries bypassed by @option{-nostdlib} and
17569 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17570 which GCC uses to overcome shortcomings of particular machines, or special
17571 needs for some languages.
17572 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17573 Collection (GCC) Internals},
17574 for more discussion of @file{libgcc.a}.)
17575 In most cases, you need @file{libgcc.a} even when you want to avoid
17576 other standard libraries. In other words, when you specify @option{-nostdlib}
17577 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17578 This ensures that you have no unresolved references to internal GCC
17579 library subroutines.
17580 (An example of such an internal subroutine is @code{__main}, used to ensure C++
17581 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
17582 GNU Compiler Collection (GCC) Internals}.)
17583
17584 @item -nostdlib++
17585 @opindex nostdlib++
17586 Do not implicitly link with standard C++ libraries.
17587
17588 @item -e @var{entry}
17589 @itemx --entry=@var{entry}
17590 @opindex e
17591 @opindex entry
17592
17593 Specify that the program entry point is @var{entry}. The argument is
17594 interpreted by the linker; the GNU linker accepts either a symbol name
17595 or an address.
17596
17597 @item -pie
17598 @opindex pie
17599 Produce a dynamically linked position independent executable on targets
17600 that support it. For predictable results, you must also specify the same
17601 set of options used for compilation (@option{-fpie}, @option{-fPIE},
17602 or model suboptions) when you specify this linker option.
17603
17604 @item -no-pie
17605 @opindex no-pie
17606 Don't produce a dynamically linked position independent executable.
17607
17608 @item -static-pie
17609 @opindex static-pie
17610 Produce a static position independent executable on targets that support
17611 it. A static position independent executable is similar to a static
17612 executable, but can be loaded at any address without a dynamic linker.
17613 For predictable results, you must also specify the same set of options
17614 used for compilation (@option{-fpie}, @option{-fPIE}, or model
17615 suboptions) when you specify this linker option.
17616
17617 @item -pthread
17618 @opindex pthread
17619 Link with the POSIX threads library. This option is supported on
17620 GNU/Linux targets, most other Unix derivatives, and also on
17621 x86 Cygwin and MinGW targets. On some targets this option also sets
17622 flags for the preprocessor, so it should be used consistently for both
17623 compilation and linking.
17624
17625 @item -r
17626 @opindex r
17627 Produce a relocatable object as output. This is also known as partial
17628 linking.
17629
17630 @item -rdynamic
17631 @opindex rdynamic
17632 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
17633 that support it. This instructs the linker to add all symbols, not
17634 only used ones, to the dynamic symbol table. This option is needed
17635 for some uses of @code{dlopen} or to allow obtaining backtraces
17636 from within a program.
17637
17638 @item -s
17639 @opindex s
17640 Remove all symbol table and relocation information from the executable.
17641
17642 @item -static
17643 @opindex static
17644 On systems that support dynamic linking, this overrides @option{-pie}
17645 and prevents linking with the shared libraries. On other systems, this
17646 option has no effect.
17647
17648 @item -shared
17649 @opindex shared
17650 Produce a shared object which can then be linked with other objects to
17651 form an executable. Not all systems support this option. For predictable
17652 results, you must also specify the same set of options used for compilation
17653 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
17654 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
17655 needs to build supplementary stub code for constructors to work. On
17656 multi-libbed systems, @samp{gcc -shared} must select the correct support
17657 libraries to link against. Failing to supply the correct flags may lead
17658 to subtle defects. Supplying them in cases where they are not necessary
17659 is innocuous.}
17660
17661 @item -shared-libgcc
17662 @itemx -static-libgcc
17663 @opindex shared-libgcc
17664 @opindex static-libgcc
17665 On systems that provide @file{libgcc} as a shared library, these options
17666 force the use of either the shared or static version, respectively.
17667 If no shared version of @file{libgcc} was built when the compiler was
17668 configured, these options have no effect.
17669
17670 There are several situations in which an application should use the
17671 shared @file{libgcc} instead of the static version. The most common
17672 of these is when the application wishes to throw and catch exceptions
17673 across different shared libraries. In that case, each of the libraries
17674 as well as the application itself should use the shared @file{libgcc}.
17675
17676 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
17677 whenever you build a shared library or a main executable, because C++
17678 programs typically use exceptions, so this is the right thing to do.
17679
17680 If, instead, you use the GCC driver to create shared libraries, you may
17681 find that they are not always linked with the shared @file{libgcc}.
17682 If GCC finds, at its configuration time, that you have a non-GNU linker
17683 or a GNU linker that does not support option @option{--eh-frame-hdr},
17684 it links the shared version of @file{libgcc} into shared libraries
17685 by default. Otherwise, it takes advantage of the linker and optimizes
17686 away the linking with the shared version of @file{libgcc}, linking with
17687 the static version of libgcc by default. This allows exceptions to
17688 propagate through such shared libraries, without incurring relocation
17689 costs at library load time.
17690
17691 However, if a library or main executable is supposed to throw or catch
17692 exceptions, you must link it using the G++ driver, or using the option
17693 @option{-shared-libgcc}, such that it is linked with the shared
17694 @file{libgcc}.
17695
17696 @item -static-libasan
17697 @opindex static-libasan
17698 When the @option{-fsanitize=address} option is used to link a program,
17699 the GCC driver automatically links against @option{libasan}. If
17700 @file{libasan} is available as a shared library, and the @option{-static}
17701 option is not used, then this links against the shared version of
17702 @file{libasan}. The @option{-static-libasan} option directs the GCC
17703 driver to link @file{libasan} statically, without necessarily linking
17704 other libraries statically.
17705
17706 @item -static-libtsan
17707 @opindex static-libtsan
17708 When the @option{-fsanitize=thread} option is used to link a program,
17709 the GCC driver automatically links against @option{libtsan}. If
17710 @file{libtsan} is available as a shared library, and the @option{-static}
17711 option is not used, then this links against the shared version of
17712 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
17713 driver to link @file{libtsan} statically, without necessarily linking
17714 other libraries statically.
17715
17716 @item -static-liblsan
17717 @opindex static-liblsan
17718 When the @option{-fsanitize=leak} option is used to link a program,
17719 the GCC driver automatically links against @option{liblsan}. If
17720 @file{liblsan} is available as a shared library, and the @option{-static}
17721 option is not used, then this links against the shared version of
17722 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
17723 driver to link @file{liblsan} statically, without necessarily linking
17724 other libraries statically.
17725
17726 @item -static-libubsan
17727 @opindex static-libubsan
17728 When the @option{-fsanitize=undefined} option is used to link a program,
17729 the GCC driver automatically links against @option{libubsan}. If
17730 @file{libubsan} is available as a shared library, and the @option{-static}
17731 option is not used, then this links against the shared version of
17732 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
17733 driver to link @file{libubsan} statically, without necessarily linking
17734 other libraries statically.
17735
17736 @item -static-libstdc++
17737 @opindex static-libstdc++
17738 When the @command{g++} program is used to link a C++ program, it
17739 normally automatically links against @option{libstdc++}. If
17740 @file{libstdc++} is available as a shared library, and the
17741 @option{-static} option is not used, then this links against the
17742 shared version of @file{libstdc++}. That is normally fine. However, it
17743 is sometimes useful to freeze the version of @file{libstdc++} used by
17744 the program without going all the way to a fully static link. The
17745 @option{-static-libstdc++} option directs the @command{g++} driver to
17746 link @file{libstdc++} statically, without necessarily linking other
17747 libraries statically.
17748
17749 @item -symbolic
17750 @opindex symbolic
17751 Bind references to global symbols when building a shared object. Warn
17752 about any unresolved references (unless overridden by the link editor
17753 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
17754 this option.
17755
17756 @item -T @var{script}
17757 @opindex T
17758 @cindex linker script
17759 Use @var{script} as the linker script. This option is supported by most
17760 systems using the GNU linker. On some targets, such as bare-board
17761 targets without an operating system, the @option{-T} option may be required
17762 when linking to avoid references to undefined symbols.
17763
17764 @item -Xlinker @var{option}
17765 @opindex Xlinker
17766 Pass @var{option} as an option to the linker. You can use this to
17767 supply system-specific linker options that GCC does not recognize.
17768
17769 If you want to pass an option that takes a separate argument, you must use
17770 @option{-Xlinker} twice, once for the option and once for the argument.
17771 For example, to pass @option{-assert definitions}, you must write
17772 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
17773 @option{-Xlinker "-assert definitions"}, because this passes the entire
17774 string as a single argument, which is not what the linker expects.
17775
17776 When using the GNU linker, it is usually more convenient to pass
17777 arguments to linker options using the @option{@var{option}=@var{value}}
17778 syntax than as separate arguments. For example, you can specify
17779 @option{-Xlinker -Map=output.map} rather than
17780 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
17781 this syntax for command-line options.
17782
17783 @item -Wl,@var{option}
17784 @opindex Wl
17785 Pass @var{option} as an option to the linker. If @var{option} contains
17786 commas, it is split into multiple options at the commas. You can use this
17787 syntax to pass an argument to the option.
17788 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
17789 linker. When using the GNU linker, you can also get the same effect with
17790 @option{-Wl,-Map=output.map}.
17791
17792 @item -u @var{symbol}
17793 @opindex u
17794 Pretend the symbol @var{symbol} is undefined, to force linking of
17795 library modules to define it. You can use @option{-u} multiple times with
17796 different symbols to force loading of additional library modules.
17797
17798 @item -z @var{keyword}
17799 @opindex z
17800 @option{-z} is passed directly on to the linker along with the keyword
17801 @var{keyword}. See the section in the documentation of your linker for
17802 permitted values and their meanings.
17803 @end table
17804
17805 @node Directory Options
17806 @section Options for Directory Search
17807 @cindex directory options
17808 @cindex options, directory search
17809 @cindex search path
17810
17811 These options specify directories to search for header files, for
17812 libraries and for parts of the compiler:
17813
17814 @table @gcctabopt
17815 @include cppdiropts.texi
17816
17817 @item -iplugindir=@var{dir}
17818 @opindex iplugindir=
17819 Set the directory to search for plugins that are passed
17820 by @option{-fplugin=@var{name}} instead of
17821 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
17822 to be used by the user, but only passed by the driver.
17823
17824 @item -L@var{dir}
17825 @opindex L
17826 Add directory @var{dir} to the list of directories to be searched
17827 for @option{-l}.
17828
17829 @item -B@var{prefix}
17830 @opindex B
17831 This option specifies where to find the executables, libraries,
17832 include files, and data files of the compiler itself.
17833
17834 The compiler driver program runs one or more of the subprograms
17835 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
17836 @var{prefix} as a prefix for each program it tries to run, both with and
17837 without @samp{@var{machine}/@var{version}/} for the corresponding target
17838 machine and compiler version.
17839
17840 For each subprogram to be run, the compiler driver first tries the
17841 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
17842 is not specified, the driver tries two standard prefixes,
17843 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
17844 those results in a file name that is found, the unmodified program
17845 name is searched for using the directories specified in your
17846 @env{PATH} environment variable.
17847
17848 The compiler checks to see if the path provided by @option{-B}
17849 refers to a directory, and if necessary it adds a directory
17850 separator character at the end of the path.
17851
17852 @option{-B} prefixes that effectively specify directory names also apply
17853 to libraries in the linker, because the compiler translates these
17854 options into @option{-L} options for the linker. They also apply to
17855 include files in the preprocessor, because the compiler translates these
17856 options into @option{-isystem} options for the preprocessor. In this case,
17857 the compiler appends @samp{include} to the prefix.
17858
17859 The runtime support file @file{libgcc.a} can also be searched for using
17860 the @option{-B} prefix, if needed. If it is not found there, the two
17861 standard prefixes above are tried, and that is all. The file is left
17862 out of the link if it is not found by those means.
17863
17864 Another way to specify a prefix much like the @option{-B} prefix is to use
17865 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
17866 Variables}.
17867
17868 As a special kludge, if the path provided by @option{-B} is
17869 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
17870 9, then it is replaced by @file{[dir/]include}. This is to help
17871 with boot-strapping the compiler.
17872
17873 @item -no-canonical-prefixes
17874 @opindex no-canonical-prefixes
17875 Do not expand any symbolic links, resolve references to @samp{/../}
17876 or @samp{/./}, or make the path absolute when generating a relative
17877 prefix.
17878
17879 @item --sysroot=@var{dir}
17880 @opindex sysroot
17881 Use @var{dir} as the logical root directory for headers and libraries.
17882 For example, if the compiler normally searches for headers in
17883 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
17884 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
17885
17886 If you use both this option and the @option{-isysroot} option, then
17887 the @option{--sysroot} option applies to libraries, but the
17888 @option{-isysroot} option applies to header files.
17889
17890 The GNU linker (beginning with version 2.16) has the necessary support
17891 for this option. If your linker does not support this option, the
17892 header file aspect of @option{--sysroot} still works, but the
17893 library aspect does not.
17894
17895 @item --no-sysroot-suffix
17896 @opindex no-sysroot-suffix
17897 For some targets, a suffix is added to the root directory specified
17898 with @option{--sysroot}, depending on the other options used, so that
17899 headers may for example be found in
17900 @file{@var{dir}/@var{suffix}/usr/include} instead of
17901 @file{@var{dir}/usr/include}. This option disables the addition of
17902 such a suffix.
17903
17904 @end table
17905
17906 @node Code Gen Options
17907 @section Options for Code Generation Conventions
17908 @cindex code generation conventions
17909 @cindex options, code generation
17910 @cindex run-time options
17911
17912 These machine-independent options control the interface conventions
17913 used in code generation.
17914
17915 Most of them have both positive and negative forms; the negative form
17916 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
17917 one of the forms is listed---the one that is not the default. You
17918 can figure out the other form by either removing @samp{no-} or adding
17919 it.
17920
17921 @table @gcctabopt
17922 @item -fstack-reuse=@var{reuse-level}
17923 @opindex fstack_reuse
17924 This option controls stack space reuse for user declared local/auto variables
17925 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
17926 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
17927 local variables and temporaries, @samp{named_vars} enables the reuse only for
17928 user defined local variables with names, and @samp{none} disables stack reuse
17929 completely. The default value is @samp{all}. The option is needed when the
17930 program extends the lifetime of a scoped local variable or a compiler generated
17931 temporary beyond the end point defined by the language. When a lifetime of
17932 a variable ends, and if the variable lives in memory, the optimizing compiler
17933 has the freedom to reuse its stack space with other temporaries or scoped
17934 local variables whose live range does not overlap with it. Legacy code extending
17935 local lifetime is likely to break with the stack reuse optimization.
17936
17937 For example,
17938
17939 @smallexample
17940 int *p;
17941 @{
17942 int local1;
17943
17944 p = &local1;
17945 local1 = 10;
17946 ....
17947 @}
17948 @{
17949 int local2;
17950 local2 = 20;
17951 ...
17952 @}
17953
17954 if (*p == 10) // out of scope use of local1
17955 @{
17956
17957 @}
17958 @end smallexample
17959
17960 Another example:
17961 @smallexample
17962
17963 struct A
17964 @{
17965 A(int k) : i(k), j(k) @{ @}
17966 int i;
17967 int j;
17968 @};
17969
17970 A *ap;
17971
17972 void foo(const A& ar)
17973 @{
17974 ap = &ar;
17975 @}
17976
17977 void bar()
17978 @{
17979 foo(A(10)); // temp object's lifetime ends when foo returns
17980
17981 @{
17982 A a(20);
17983 ....
17984 @}
17985 ap->i+= 10; // ap references out of scope temp whose space
17986 // is reused with a. What is the value of ap->i?
17987 @}
17988
17989 @end smallexample
17990
17991 The lifetime of a compiler generated temporary is well defined by the C++
17992 standard. When a lifetime of a temporary ends, and if the temporary lives
17993 in memory, the optimizing compiler has the freedom to reuse its stack
17994 space with other temporaries or scoped local variables whose live range
17995 does not overlap with it. However some of the legacy code relies on
17996 the behavior of older compilers in which temporaries' stack space is
17997 not reused, the aggressive stack reuse can lead to runtime errors. This
17998 option is used to control the temporary stack reuse optimization.
17999
18000 @item -ftrapv
18001 @opindex ftrapv
18002 This option generates traps for signed overflow on addition, subtraction,
18003 multiplication operations.
18004 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18005 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18006 @option{-fwrapv} being effective. Note that only active options override, so
18007 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18008 results in @option{-ftrapv} being effective.
18009
18010 @item -fwrapv
18011 @opindex fwrapv
18012 This option instructs the compiler to assume that signed arithmetic
18013 overflow of addition, subtraction and multiplication wraps around
18014 using twos-complement representation. This flag enables some optimizations
18015 and disables others.
18016 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18017 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18018 @option{-fwrapv} being effective. Note that only active options override, so
18019 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18020 results in @option{-ftrapv} being effective.
18021
18022 @item -fwrapv-pointer
18023 @opindex fwrapv-pointer
18024 This option instructs the compiler to assume that pointer arithmetic
18025 overflow on addition and subtraction wraps around using twos-complement
18026 representation. This flag disables some optimizations which assume
18027 pointer overflow is invalid.
18028
18029 @item -fstrict-overflow
18030 @opindex fstrict-overflow
18031 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18032 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18033
18034 @item -fexceptions
18035 @opindex fexceptions
18036 Enable exception handling. Generates extra code needed to propagate
18037 exceptions. For some targets, this implies GCC generates frame
18038 unwind information for all functions, which can produce significant data
18039 size overhead, although it does not affect execution. If you do not
18040 specify this option, GCC enables it by default for languages like
18041 C++ that normally require exception handling, and disables it for
18042 languages like C that do not normally require it. However, you may need
18043 to enable this option when compiling C code that needs to interoperate
18044 properly with exception handlers written in C++. You may also wish to
18045 disable this option if you are compiling older C++ programs that don't
18046 use exception handling.
18047
18048 @item -fnon-call-exceptions
18049 @opindex fnon-call-exceptions
18050 Generate code that allows trapping instructions to throw exceptions.
18051 Note that this requires platform-specific runtime support that does
18052 not exist everywhere. Moreover, it only allows @emph{trapping}
18053 instructions to throw exceptions, i.e.@: memory references or floating-point
18054 instructions. It does not allow exceptions to be thrown from
18055 arbitrary signal handlers such as @code{SIGALRM}. This enables
18056 @option{-fexceptions}.
18057
18058 @item -fdelete-dead-exceptions
18059 @opindex fdelete-dead-exceptions
18060 Consider that instructions that may throw exceptions but don't otherwise
18061 contribute to the execution of the program can be optimized away.
18062 This does not affect calls to functions except those with the
18063 @code{pure} or @code{const} attributes.
18064 This option is enabled by default for the Ada and C++ compilers, as permitted by
18065 the language specifications.
18066 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18067
18068 @item -funwind-tables
18069 @opindex funwind-tables
18070 Similar to @option{-fexceptions}, except that it just generates any needed
18071 static data, but does not affect the generated code in any other way.
18072 You normally do not need to enable this option; instead, a language processor
18073 that needs this handling enables it on your behalf.
18074
18075 @item -fasynchronous-unwind-tables
18076 @opindex fasynchronous-unwind-tables
18077 Generate unwind table in DWARF format, if supported by target machine. The
18078 table is exact at each instruction boundary, so it can be used for stack
18079 unwinding from asynchronous events (such as debugger or garbage collector).
18080
18081 @item -fno-gnu-unique
18082 @opindex fno-gnu-unique
18083 @opindex fgnu-unique
18084 On systems with recent GNU assembler and C library, the C++ compiler
18085 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18086 of template static data members and static local variables in inline
18087 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18088 is necessary to avoid problems with a library used by two different
18089 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18090 therefore disagreeing with the other one about the binding of the
18091 symbol. But this causes @code{dlclose} to be ignored for affected
18092 DSOs; if your program relies on reinitialization of a DSO via
18093 @code{dlclose} and @code{dlopen}, you can use
18094 @option{-fno-gnu-unique}.
18095
18096 @item -fpcc-struct-return
18097 @opindex fpcc-struct-return
18098 Return ``short'' @code{struct} and @code{union} values in memory like
18099 longer ones, rather than in registers. This convention is less
18100 efficient, but it has the advantage of allowing intercallability between
18101 GCC-compiled files and files compiled with other compilers, particularly
18102 the Portable C Compiler (pcc).
18103
18104 The precise convention for returning structures in memory depends
18105 on the target configuration macros.
18106
18107 Short structures and unions are those whose size and alignment match
18108 that of some integer type.
18109
18110 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18111 switch is not binary compatible with code compiled with the
18112 @option{-freg-struct-return} switch.
18113 Use it to conform to a non-default application binary interface.
18114
18115 @item -freg-struct-return
18116 @opindex freg-struct-return
18117 Return @code{struct} and @code{union} values in registers when possible.
18118 This is more efficient for small structures than
18119 @option{-fpcc-struct-return}.
18120
18121 If you specify neither @option{-fpcc-struct-return} nor
18122 @option{-freg-struct-return}, GCC defaults to whichever convention is
18123 standard for the target. If there is no standard convention, GCC
18124 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18125 the principal compiler. In those cases, we can choose the standard, and
18126 we chose the more efficient register return alternative.
18127
18128 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18129 switch is not binary compatible with code compiled with the
18130 @option{-fpcc-struct-return} switch.
18131 Use it to conform to a non-default application binary interface.
18132
18133 @item -fshort-enums
18134 @opindex fshort-enums
18135 Allocate to an @code{enum} type only as many bytes as it needs for the
18136 declared range of possible values. Specifically, the @code{enum} type
18137 is equivalent to the smallest integer type that has enough room.
18138
18139 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18140 code that is not binary compatible with code generated without that switch.
18141 Use it to conform to a non-default application binary interface.
18142
18143 @item -fshort-wchar
18144 @opindex fshort-wchar
18145 Override the underlying type for @code{wchar_t} to be @code{short
18146 unsigned int} instead of the default for the target. This option is
18147 useful for building programs to run under WINE@.
18148
18149 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18150 code that is not binary compatible with code generated without that switch.
18151 Use it to conform to a non-default application binary interface.
18152
18153 @item -fcommon
18154 @opindex fcommon
18155 @opindex fno-common
18156 @cindex tentative definitions
18157 In C code, this option controls the placement of global variables
18158 defined without an initializer, known as @dfn{tentative definitions}
18159 in the C standard. Tentative definitions are distinct from declarations
18160 of a variable with the @code{extern} keyword, which do not allocate storage.
18161
18162 The default is @option{-fno-common}, which specifies that the compiler places
18163 uninitialized global variables in the BSS section of the object file.
18164 This inhibits the merging of tentative definitions by the linker so you get a
18165 multiple-definition error if the same variable is accidentally defined in more
18166 than one compilation unit.
18167
18168 The @option{-fcommon} places uninitialized global variables in a common block.
18169 This allows the linker to resolve all tentative definitions of the same variable
18170 in different compilation units to the same object, or to a non-tentative
18171 definition. This behavior is inconsistent with C++, and on many targets implies
18172 a speed and code size penalty on global variable references. It is mainly
18173 useful to enable legacy code to link without errors.
18174
18175 @item -fno-ident
18176 @opindex fno-ident
18177 @opindex fident
18178 Ignore the @code{#ident} directive.
18179
18180 @item -finhibit-size-directive
18181 @opindex finhibit-size-directive
18182 Don't output a @code{.size} assembler directive, or anything else that
18183 would cause trouble if the function is split in the middle, and the
18184 two halves are placed at locations far apart in memory. This option is
18185 used when compiling @file{crtstuff.c}; you should not need to use it
18186 for anything else.
18187
18188 @item -fverbose-asm
18189 @opindex fverbose-asm
18190 Put extra commentary information in the generated assembly code to
18191 make it more readable. This option is generally only of use to those
18192 who actually need to read the generated assembly code (perhaps while
18193 debugging the compiler itself).
18194
18195 @option{-fno-verbose-asm}, the default, causes the
18196 extra information to be omitted and is useful when comparing two assembler
18197 files.
18198
18199 The added comments include:
18200
18201 @itemize @bullet
18202
18203 @item
18204 information on the compiler version and command-line options,
18205
18206 @item
18207 the source code lines associated with the assembly instructions,
18208 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18209
18210 @item
18211 hints on which high-level expressions correspond to
18212 the various assembly instruction operands.
18213
18214 @end itemize
18215
18216 For example, given this C source file:
18217
18218 @smallexample
18219 int test (int n)
18220 @{
18221 int i;
18222 int total = 0;
18223
18224 for (i = 0; i < n; i++)
18225 total += i * i;
18226
18227 return total;
18228 @}
18229 @end smallexample
18230
18231 compiling to (x86_64) assembly via @option{-S} and emitting the result
18232 direct to stdout via @option{-o} @option{-}
18233
18234 @smallexample
18235 gcc -S test.c -fverbose-asm -Os -o -
18236 @end smallexample
18237
18238 gives output similar to this:
18239
18240 @smallexample
18241 .file "test.c"
18242 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18243 [...snip...]
18244 # options passed:
18245 [...snip...]
18246
18247 .text
18248 .globl test
18249 .type test, @@function
18250 test:
18251 .LFB0:
18252 .cfi_startproc
18253 # test.c:4: int total = 0;
18254 xorl %eax, %eax # <retval>
18255 # test.c:6: for (i = 0; i < n; i++)
18256 xorl %edx, %edx # i
18257 .L2:
18258 # test.c:6: for (i = 0; i < n; i++)
18259 cmpl %edi, %edx # n, i
18260 jge .L5 #,
18261 # test.c:7: total += i * i;
18262 movl %edx, %ecx # i, tmp92
18263 imull %edx, %ecx # i, tmp92
18264 # test.c:6: for (i = 0; i < n; i++)
18265 incl %edx # i
18266 # test.c:7: total += i * i;
18267 addl %ecx, %eax # tmp92, <retval>
18268 jmp .L2 #
18269 .L5:
18270 # test.c:10: @}
18271 ret
18272 .cfi_endproc
18273 .LFE0:
18274 .size test, .-test
18275 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
18276 .section .note.GNU-stack,"",@@progbits
18277 @end smallexample
18278
18279 The comments are intended for humans rather than machines and hence the
18280 precise format of the comments is subject to change.
18281
18282 @item -frecord-gcc-switches
18283 @opindex frecord-gcc-switches
18284 This switch causes the command line used to invoke the
18285 compiler to be recorded into the object file that is being created.
18286 This switch is only implemented on some targets and the exact format
18287 of the recording is target and binary file format dependent, but it
18288 usually takes the form of a section containing ASCII text. This
18289 switch is related to the @option{-fverbose-asm} switch, but that
18290 switch only records information in the assembler output file as
18291 comments, so it never reaches the object file.
18292 See also @option{-grecord-gcc-switches} for another
18293 way of storing compiler options into the object file.
18294
18295 @item -fpic
18296 @opindex fpic
18297 @cindex global offset table
18298 @cindex PIC
18299 Generate position-independent code (PIC) suitable for use in a shared
18300 library, if supported for the target machine. Such code accesses all
18301 constant addresses through a global offset table (GOT)@. The dynamic
18302 loader resolves the GOT entries when the program starts (the dynamic
18303 loader is not part of GCC; it is part of the operating system). If
18304 the GOT size for the linked executable exceeds a machine-specific
18305 maximum size, you get an error message from the linker indicating that
18306 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18307 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18308 on the m68k and RS/6000. The x86 has no such limit.)
18309
18310 Position-independent code requires special support, and therefore works
18311 only on certain machines. For the x86, GCC supports PIC for System V
18312 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
18313 position-independent.
18314
18315 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18316 are defined to 1.
18317
18318 @item -fPIC
18319 @opindex fPIC
18320 If supported for the target machine, emit position-independent code,
18321 suitable for dynamic linking and avoiding any limit on the size of the
18322 global offset table. This option makes a difference on AArch64, m68k,
18323 PowerPC and SPARC@.
18324
18325 Position-independent code requires special support, and therefore works
18326 only on certain machines.
18327
18328 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18329 are defined to 2.
18330
18331 @item -fpie
18332 @itemx -fPIE
18333 @opindex fpie
18334 @opindex fPIE
18335 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18336 generated position-independent code can be only linked into executables.
18337 Usually these options are used to compile code that will be linked using
18338 the @option{-pie} GCC option.
18339
18340 @option{-fpie} and @option{-fPIE} both define the macros
18341 @code{__pie__} and @code{__PIE__}. The macros have the value 1
18342 for @option{-fpie} and 2 for @option{-fPIE}.
18343
18344 @item -fno-plt
18345 @opindex fno-plt
18346 @opindex fplt
18347 Do not use the PLT for external function calls in position-independent code.
18348 Instead, load the callee address at call sites from the GOT and branch to it.
18349 This leads to more efficient code by eliminating PLT stubs and exposing
18350 GOT loads to optimizations. On architectures such as 32-bit x86 where
18351 PLT stubs expect the GOT pointer in a specific register, this gives more
18352 register allocation freedom to the compiler.
18353 Lazy binding requires use of the PLT;
18354 with @option{-fno-plt} all external symbols are resolved at load time.
18355
18356 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18357 through the PLT for specific external functions.
18358
18359 In position-dependent code, a few targets also convert calls to
18360 functions that are marked to not use the PLT to use the GOT instead.
18361
18362 @item -fno-jump-tables
18363 @opindex fno-jump-tables
18364 @opindex fjump-tables
18365 Do not use jump tables for switch statements even where it would be
18366 more efficient than other code generation strategies. This option is
18367 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18368 building code that forms part of a dynamic linker and cannot
18369 reference the address of a jump table. On some targets, jump tables
18370 do not require a GOT and this option is not needed.
18371
18372 @item -fno-bit-tests
18373 @opindex fno-bit-tests
18374 @opindex fbit-tests
18375 Do not use bit tests for switch statements even where it would be
18376 more efficient than other code generation strategies.
18377
18378 @item -ffixed-@var{reg}
18379 @opindex ffixed
18380 Treat the register named @var{reg} as a fixed register; generated code
18381 should never refer to it (except perhaps as a stack pointer, frame
18382 pointer or in some other fixed role).
18383
18384 @var{reg} must be the name of a register. The register names accepted
18385 are machine-specific and are defined in the @code{REGISTER_NAMES}
18386 macro in the machine description macro file.
18387
18388 This flag does not have a negative form, because it specifies a
18389 three-way choice.
18390
18391 @item -fcall-used-@var{reg}
18392 @opindex fcall-used
18393 Treat the register named @var{reg} as an allocable register that is
18394 clobbered by function calls. It may be allocated for temporaries or
18395 variables that do not live across a call. Functions compiled this way
18396 do not save and restore the register @var{reg}.
18397
18398 It is an error to use this flag with the frame pointer or stack pointer.
18399 Use of this flag for other registers that have fixed pervasive roles in
18400 the machine's execution model produces disastrous results.
18401
18402 This flag does not have a negative form, because it specifies a
18403 three-way choice.
18404
18405 @item -fcall-saved-@var{reg}
18406 @opindex fcall-saved
18407 Treat the register named @var{reg} as an allocable register saved by
18408 functions. It may be allocated even for temporaries or variables that
18409 live across a call. Functions compiled this way save and restore
18410 the register @var{reg} if they use it.
18411
18412 It is an error to use this flag with the frame pointer or stack pointer.
18413 Use of this flag for other registers that have fixed pervasive roles in
18414 the machine's execution model produces disastrous results.
18415
18416 A different sort of disaster results from the use of this flag for
18417 a register in which function values may be returned.
18418
18419 This flag does not have a negative form, because it specifies a
18420 three-way choice.
18421
18422 @item -fpack-struct[=@var{n}]
18423 @opindex fpack-struct
18424 Without a value specified, pack all structure members together without
18425 holes. When a value is specified (which must be a small power of two), pack
18426 structure members according to this value, representing the maximum
18427 alignment (that is, objects with default alignment requirements larger than
18428 this are output potentially unaligned at the next fitting location.
18429
18430 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18431 code that is not binary compatible with code generated without that switch.
18432 Additionally, it makes the code suboptimal.
18433 Use it to conform to a non-default application binary interface.
18434
18435 @item -fleading-underscore
18436 @opindex fleading-underscore
18437 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18438 change the way C symbols are represented in the object file. One use
18439 is to help link with legacy assembly code.
18440
18441 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18442 generate code that is not binary compatible with code generated without that
18443 switch. Use it to conform to a non-default application binary interface.
18444 Not all targets provide complete support for this switch.
18445
18446 @item -ftls-model=@var{model}
18447 @opindex ftls-model
18448 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18449 The @var{model} argument should be one of @samp{global-dynamic},
18450 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18451 Note that the choice is subject to optimization: the compiler may use
18452 a more efficient model for symbols not visible outside of the translation
18453 unit, or if @option{-fpic} is not given on the command line.
18454
18455 The default without @option{-fpic} is @samp{initial-exec}; with
18456 @option{-fpic} the default is @samp{global-dynamic}.
18457
18458 @item -ftrampolines
18459 @opindex ftrampolines
18460 For targets that normally need trampolines for nested functions, always
18461 generate them instead of using descriptors. Otherwise, for targets that
18462 do not need them, like for example HP-PA or IA-64, do nothing.
18463
18464 A trampoline is a small piece of code that is created at run time on the
18465 stack when the address of a nested function is taken, and is used to call
18466 the nested function indirectly. Therefore, it requires the stack to be
18467 made executable in order for the program to work properly.
18468
18469 @option{-fno-trampolines} is enabled by default on a language by language
18470 basis to let the compiler avoid generating them, if it computes that this
18471 is safe, and replace them with descriptors. Descriptors are made up of data
18472 only, but the generated code must be prepared to deal with them. As of this
18473 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18474
18475 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18476 @option{-fno-trampolines} are not binary compatible if nested functions are
18477 present. This option must therefore be used on a program-wide basis and be
18478 manipulated with extreme care.
18479
18480 For languages other than Ada, the @code{-ftrampolines} and
18481 @code{-fno-trampolines} options currently have no effect, and
18482 trampolines are always generated on platforms that need them
18483 for nested functions.
18484
18485 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18486 @opindex fvisibility
18487 Set the default ELF image symbol visibility to the specified option---all
18488 symbols are marked with this unless overridden within the code.
18489 Using this feature can very substantially improve linking and
18490 load times of shared object libraries, produce more optimized
18491 code, provide near-perfect API export and prevent symbol clashes.
18492 It is @strong{strongly} recommended that you use this in any shared objects
18493 you distribute.
18494
18495 Despite the nomenclature, @samp{default} always means public; i.e.,
18496 available to be linked against from outside the shared object.
18497 @samp{protected} and @samp{internal} are pretty useless in real-world
18498 usage so the only other commonly used option is @samp{hidden}.
18499 The default if @option{-fvisibility} isn't specified is
18500 @samp{default}, i.e., make every symbol public.
18501
18502 A good explanation of the benefits offered by ensuring ELF
18503 symbols have the correct visibility is given by ``How To Write
18504 Shared Libraries'' by Ulrich Drepper (which can be found at
18505 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18506 solution made possible by this option to marking things hidden when
18507 the default is public is to make the default hidden and mark things
18508 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18509 and @code{__attribute__ ((visibility("default")))} instead of
18510 @code{__declspec(dllexport)} you get almost identical semantics with
18511 identical syntax. This is a great boon to those working with
18512 cross-platform projects.
18513
18514 For those adding visibility support to existing code, you may find
18515 @code{#pragma GCC visibility} of use. This works by you enclosing
18516 the declarations you wish to set visibility for with (for example)
18517 @code{#pragma GCC visibility push(hidden)} and
18518 @code{#pragma GCC visibility pop}.
18519 Bear in mind that symbol visibility should be viewed @strong{as
18520 part of the API interface contract} and thus all new code should
18521 always specify visibility when it is not the default; i.e., declarations
18522 only for use within the local DSO should @strong{always} be marked explicitly
18523 as hidden as so to avoid PLT indirection overheads---making this
18524 abundantly clear also aids readability and self-documentation of the code.
18525 Note that due to ISO C++ specification requirements, @code{operator new} and
18526 @code{operator delete} must always be of default visibility.
18527
18528 Be aware that headers from outside your project, in particular system
18529 headers and headers from any other library you use, may not be
18530 expecting to be compiled with visibility other than the default. You
18531 may need to explicitly say @code{#pragma GCC visibility push(default)}
18532 before including any such headers.
18533
18534 @code{extern} declarations are not affected by @option{-fvisibility}, so
18535 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18536 no modifications. However, this means that calls to @code{extern}
18537 functions with no explicit visibility use the PLT, so it is more
18538 effective to use @code{__attribute ((visibility))} and/or
18539 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18540 declarations should be treated as hidden.
18541
18542 Note that @option{-fvisibility} does affect C++ vague linkage
18543 entities. This means that, for instance, an exception class that is
18544 be thrown between DSOs must be explicitly marked with default
18545 visibility so that the @samp{type_info} nodes are unified between
18546 the DSOs.
18547
18548 An overview of these techniques, their benefits and how to use them
18549 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18550
18551 @item -fstrict-volatile-bitfields
18552 @opindex fstrict-volatile-bitfields
18553 This option should be used if accesses to volatile bit-fields (or other
18554 structure fields, although the compiler usually honors those types
18555 anyway) should use a single access of the width of the
18556 field's type, aligned to a natural alignment if possible. For
18557 example, targets with memory-mapped peripheral registers might require
18558 all such accesses to be 16 bits wide; with this flag you can
18559 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18560 is 16 bits on these targets) to force GCC to use 16-bit accesses
18561 instead of, perhaps, a more efficient 32-bit access.
18562
18563 If this option is disabled, the compiler uses the most efficient
18564 instruction. In the previous example, that might be a 32-bit load
18565 instruction, even though that accesses bytes that do not contain
18566 any portion of the bit-field, or memory-mapped registers unrelated to
18567 the one being updated.
18568
18569 In some cases, such as when the @code{packed} attribute is applied to a
18570 structure field, it may not be possible to access the field with a single
18571 read or write that is correctly aligned for the target machine. In this
18572 case GCC falls back to generating multiple accesses rather than code that
18573 will fault or truncate the result at run time.
18574
18575 Note: Due to restrictions of the C/C++11 memory model, write accesses are
18576 not allowed to touch non bit-field members. It is therefore recommended
18577 to define all bits of the field's type as bit-field members.
18578
18579 The default value of this option is determined by the application binary
18580 interface for the target processor.
18581
18582 @item -fsync-libcalls
18583 @opindex fsync-libcalls
18584 This option controls whether any out-of-line instance of the @code{__sync}
18585 family of functions may be used to implement the C++11 @code{__atomic}
18586 family of functions.
18587
18588 The default value of this option is enabled, thus the only useful form
18589 of the option is @option{-fno-sync-libcalls}. This option is used in
18590 the implementation of the @file{libatomic} runtime library.
18591
18592 @end table
18593
18594 @node Developer Options
18595 @section GCC Developer Options
18596 @cindex developer options
18597 @cindex debugging GCC
18598 @cindex debug dump options
18599 @cindex dump options
18600 @cindex compilation statistics
18601
18602 This section describes command-line options that are primarily of
18603 interest to GCC developers, including options to support compiler
18604 testing and investigation of compiler bugs and compile-time
18605 performance problems. This includes options that produce debug dumps
18606 at various points in the compilation; that print statistics such as
18607 memory use and execution time; and that print information about GCC's
18608 configuration, such as where it searches for libraries. You should
18609 rarely need to use any of these options for ordinary compilation and
18610 linking tasks.
18611
18612 Many developer options that cause GCC to dump output to a file take an
18613 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
18614 or @samp{-} to dump to standard output, and @samp{stderr} for standard
18615 error.
18616
18617 If @samp{=@var{filename}} is omitted, a default dump file name is
18618 constructed by concatenating the base dump file name, a pass number,
18619 phase letter, and pass name. The base dump file name is the name of
18620 output file produced by the compiler if explicitly specified and not
18621 an executable; otherwise it is the source file name.
18622 The pass number is determined by the order passes are registered with
18623 the compiler's pass manager.
18624 This is generally the same as the order of execution, but passes
18625 registered by plugins, target-specific passes, or passes that are
18626 otherwise registered late are numbered higher than the pass named
18627 @samp{final}, even if they are executed earlier. The phase letter is
18628 one of @samp{i} (inter-procedural analysis), @samp{l}
18629 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
18630 The files are created in the directory of the output file.
18631
18632 @table @gcctabopt
18633
18634 @item -fcallgraph-info
18635 @itemx -fcallgraph-info=@var{MARKERS}
18636 @opindex fcallgraph-info
18637 Makes the compiler output callgraph information for the program, on a
18638 per-object-file basis. The information is generated in the common VCG
18639 format. It can be decorated with additional, per-node and/or per-edge
18640 information, if a list of comma-separated markers is additionally
18641 specified. When the @code{su} marker is specified, the callgraph is
18642 decorated with stack usage information; it is equivalent to
18643 @option{-fstack-usage}. When the @code{da} marker is specified, the
18644 callgraph is decorated with information about dynamically allocated
18645 objects.
18646
18647 When compiling with @option{-flto}, no callgraph information is output
18648 along with the object file. At LTO link time, @option{-fcallgraph-info}
18649 may generate multiple callgraph information files next to intermediate
18650 LTO output files.
18651
18652 @item -d@var{letters}
18653 @itemx -fdump-rtl-@var{pass}
18654 @itemx -fdump-rtl-@var{pass}=@var{filename}
18655 @opindex d
18656 @opindex fdump-rtl-@var{pass}
18657 Says to make debugging dumps during compilation at times specified by
18658 @var{letters}. This is used for debugging the RTL-based passes of the
18659 compiler.
18660
18661 Some @option{-d@var{letters}} switches have different meaning when
18662 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
18663 for information about preprocessor-specific dump options.
18664
18665 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
18666 @option{-d} option @var{letters}. Here are the possible
18667 letters for use in @var{pass} and @var{letters}, and their meanings:
18668
18669 @table @gcctabopt
18670
18671 @item -fdump-rtl-alignments
18672 @opindex fdump-rtl-alignments
18673 Dump after branch alignments have been computed.
18674
18675 @item -fdump-rtl-asmcons
18676 @opindex fdump-rtl-asmcons
18677 Dump after fixing rtl statements that have unsatisfied in/out constraints.
18678
18679 @item -fdump-rtl-auto_inc_dec
18680 @opindex fdump-rtl-auto_inc_dec
18681 Dump after auto-inc-dec discovery. This pass is only run on
18682 architectures that have auto inc or auto dec instructions.
18683
18684 @item -fdump-rtl-barriers
18685 @opindex fdump-rtl-barriers
18686 Dump after cleaning up the barrier instructions.
18687
18688 @item -fdump-rtl-bbpart
18689 @opindex fdump-rtl-bbpart
18690 Dump after partitioning hot and cold basic blocks.
18691
18692 @item -fdump-rtl-bbro
18693 @opindex fdump-rtl-bbro
18694 Dump after block reordering.
18695
18696 @item -fdump-rtl-btl1
18697 @itemx -fdump-rtl-btl2
18698 @opindex fdump-rtl-btl2
18699 @opindex fdump-rtl-btl2
18700 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
18701 after the two branch
18702 target load optimization passes.
18703
18704 @item -fdump-rtl-bypass
18705 @opindex fdump-rtl-bypass
18706 Dump after jump bypassing and control flow optimizations.
18707
18708 @item -fdump-rtl-combine
18709 @opindex fdump-rtl-combine
18710 Dump after the RTL instruction combination pass.
18711
18712 @item -fdump-rtl-compgotos
18713 @opindex fdump-rtl-compgotos
18714 Dump after duplicating the computed gotos.
18715
18716 @item -fdump-rtl-ce1
18717 @itemx -fdump-rtl-ce2
18718 @itemx -fdump-rtl-ce3
18719 @opindex fdump-rtl-ce1
18720 @opindex fdump-rtl-ce2
18721 @opindex fdump-rtl-ce3
18722 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
18723 @option{-fdump-rtl-ce3} enable dumping after the three
18724 if conversion passes.
18725
18726 @item -fdump-rtl-cprop_hardreg
18727 @opindex fdump-rtl-cprop_hardreg
18728 Dump after hard register copy propagation.
18729
18730 @item -fdump-rtl-csa
18731 @opindex fdump-rtl-csa
18732 Dump after combining stack adjustments.
18733
18734 @item -fdump-rtl-cse1
18735 @itemx -fdump-rtl-cse2
18736 @opindex fdump-rtl-cse1
18737 @opindex fdump-rtl-cse2
18738 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
18739 the two common subexpression elimination passes.
18740
18741 @item -fdump-rtl-dce
18742 @opindex fdump-rtl-dce
18743 Dump after the standalone dead code elimination passes.
18744
18745 @item -fdump-rtl-dbr
18746 @opindex fdump-rtl-dbr
18747 Dump after delayed branch scheduling.
18748
18749 @item -fdump-rtl-dce1
18750 @itemx -fdump-rtl-dce2
18751 @opindex fdump-rtl-dce1
18752 @opindex fdump-rtl-dce2
18753 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
18754 the two dead store elimination passes.
18755
18756 @item -fdump-rtl-eh
18757 @opindex fdump-rtl-eh
18758 Dump after finalization of EH handling code.
18759
18760 @item -fdump-rtl-eh_ranges
18761 @opindex fdump-rtl-eh_ranges
18762 Dump after conversion of EH handling range regions.
18763
18764 @item -fdump-rtl-expand
18765 @opindex fdump-rtl-expand
18766 Dump after RTL generation.
18767
18768 @item -fdump-rtl-fwprop1
18769 @itemx -fdump-rtl-fwprop2
18770 @opindex fdump-rtl-fwprop1
18771 @opindex fdump-rtl-fwprop2
18772 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
18773 dumping after the two forward propagation passes.
18774
18775 @item -fdump-rtl-gcse1
18776 @itemx -fdump-rtl-gcse2
18777 @opindex fdump-rtl-gcse1
18778 @opindex fdump-rtl-gcse2
18779 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
18780 after global common subexpression elimination.
18781
18782 @item -fdump-rtl-init-regs
18783 @opindex fdump-rtl-init-regs
18784 Dump after the initialization of the registers.
18785
18786 @item -fdump-rtl-initvals
18787 @opindex fdump-rtl-initvals
18788 Dump after the computation of the initial value sets.
18789
18790 @item -fdump-rtl-into_cfglayout
18791 @opindex fdump-rtl-into_cfglayout
18792 Dump after converting to cfglayout mode.
18793
18794 @item -fdump-rtl-ira
18795 @opindex fdump-rtl-ira
18796 Dump after iterated register allocation.
18797
18798 @item -fdump-rtl-jump
18799 @opindex fdump-rtl-jump
18800 Dump after the second jump optimization.
18801
18802 @item -fdump-rtl-loop2
18803 @opindex fdump-rtl-loop2
18804 @option{-fdump-rtl-loop2} enables dumping after the rtl
18805 loop optimization passes.
18806
18807 @item -fdump-rtl-mach
18808 @opindex fdump-rtl-mach
18809 Dump after performing the machine dependent reorganization pass, if that
18810 pass exists.
18811
18812 @item -fdump-rtl-mode_sw
18813 @opindex fdump-rtl-mode_sw
18814 Dump after removing redundant mode switches.
18815
18816 @item -fdump-rtl-rnreg
18817 @opindex fdump-rtl-rnreg
18818 Dump after register renumbering.
18819
18820 @item -fdump-rtl-outof_cfglayout
18821 @opindex fdump-rtl-outof_cfglayout
18822 Dump after converting from cfglayout mode.
18823
18824 @item -fdump-rtl-peephole2
18825 @opindex fdump-rtl-peephole2
18826 Dump after the peephole pass.
18827
18828 @item -fdump-rtl-postreload
18829 @opindex fdump-rtl-postreload
18830 Dump after post-reload optimizations.
18831
18832 @item -fdump-rtl-pro_and_epilogue
18833 @opindex fdump-rtl-pro_and_epilogue
18834 Dump after generating the function prologues and epilogues.
18835
18836 @item -fdump-rtl-sched1
18837 @itemx -fdump-rtl-sched2
18838 @opindex fdump-rtl-sched1
18839 @opindex fdump-rtl-sched2
18840 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
18841 after the basic block scheduling passes.
18842
18843 @item -fdump-rtl-ree
18844 @opindex fdump-rtl-ree
18845 Dump after sign/zero extension elimination.
18846
18847 @item -fdump-rtl-seqabstr
18848 @opindex fdump-rtl-seqabstr
18849 Dump after common sequence discovery.
18850
18851 @item -fdump-rtl-shorten
18852 @opindex fdump-rtl-shorten
18853 Dump after shortening branches.
18854
18855 @item -fdump-rtl-sibling
18856 @opindex fdump-rtl-sibling
18857 Dump after sibling call optimizations.
18858
18859 @item -fdump-rtl-split1
18860 @itemx -fdump-rtl-split2
18861 @itemx -fdump-rtl-split3
18862 @itemx -fdump-rtl-split4
18863 @itemx -fdump-rtl-split5
18864 @opindex fdump-rtl-split1
18865 @opindex fdump-rtl-split2
18866 @opindex fdump-rtl-split3
18867 @opindex fdump-rtl-split4
18868 @opindex fdump-rtl-split5
18869 These options enable dumping after five rounds of
18870 instruction splitting.
18871
18872 @item -fdump-rtl-sms
18873 @opindex fdump-rtl-sms
18874 Dump after modulo scheduling. This pass is only run on some
18875 architectures.
18876
18877 @item -fdump-rtl-stack
18878 @opindex fdump-rtl-stack
18879 Dump after conversion from GCC's ``flat register file'' registers to the
18880 x87's stack-like registers. This pass is only run on x86 variants.
18881
18882 @item -fdump-rtl-subreg1
18883 @itemx -fdump-rtl-subreg2
18884 @opindex fdump-rtl-subreg1
18885 @opindex fdump-rtl-subreg2
18886 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
18887 the two subreg expansion passes.
18888
18889 @item -fdump-rtl-unshare
18890 @opindex fdump-rtl-unshare
18891 Dump after all rtl has been unshared.
18892
18893 @item -fdump-rtl-vartrack
18894 @opindex fdump-rtl-vartrack
18895 Dump after variable tracking.
18896
18897 @item -fdump-rtl-vregs
18898 @opindex fdump-rtl-vregs
18899 Dump after converting virtual registers to hard registers.
18900
18901 @item -fdump-rtl-web
18902 @opindex fdump-rtl-web
18903 Dump after live range splitting.
18904
18905 @item -fdump-rtl-regclass
18906 @itemx -fdump-rtl-subregs_of_mode_init
18907 @itemx -fdump-rtl-subregs_of_mode_finish
18908 @itemx -fdump-rtl-dfinit
18909 @itemx -fdump-rtl-dfinish
18910 @opindex fdump-rtl-regclass
18911 @opindex fdump-rtl-subregs_of_mode_init
18912 @opindex fdump-rtl-subregs_of_mode_finish
18913 @opindex fdump-rtl-dfinit
18914 @opindex fdump-rtl-dfinish
18915 These dumps are defined but always produce empty files.
18916
18917 @item -da
18918 @itemx -fdump-rtl-all
18919 @opindex da
18920 @opindex fdump-rtl-all
18921 Produce all the dumps listed above.
18922
18923 @item -dA
18924 @opindex dA
18925 Annotate the assembler output with miscellaneous debugging information.
18926
18927 @item -dD
18928 @opindex dD
18929 Dump all macro definitions, at the end of preprocessing, in addition to
18930 normal output.
18931
18932 @item -dH
18933 @opindex dH
18934 Produce a core dump whenever an error occurs.
18935
18936 @item -dp
18937 @opindex dp
18938 Annotate the assembler output with a comment indicating which
18939 pattern and alternative is used. The length and cost of each instruction are
18940 also printed.
18941
18942 @item -dP
18943 @opindex dP
18944 Dump the RTL in the assembler output as a comment before each instruction.
18945 Also turns on @option{-dp} annotation.
18946
18947 @item -dx
18948 @opindex dx
18949 Just generate RTL for a function instead of compiling it. Usually used
18950 with @option{-fdump-rtl-expand}.
18951 @end table
18952
18953 @item -fdump-debug
18954 @opindex fdump-debug
18955 Dump debugging information generated during the debug
18956 generation phase.
18957
18958 @item -fdump-earlydebug
18959 @opindex fdump-earlydebug
18960 Dump debugging information generated during the early debug
18961 generation phase.
18962
18963 @item -fdump-noaddr
18964 @opindex fdump-noaddr
18965 When doing debugging dumps, suppress address output. This makes it more
18966 feasible to use diff on debugging dumps for compiler invocations with
18967 different compiler binaries and/or different
18968 text / bss / data / heap / stack / dso start locations.
18969
18970 @item -freport-bug
18971 @opindex freport-bug
18972 Collect and dump debug information into a temporary file if an
18973 internal compiler error (ICE) occurs.
18974
18975 @item -fdump-unnumbered
18976 @opindex fdump-unnumbered
18977 When doing debugging dumps, suppress instruction numbers and address output.
18978 This makes it more feasible to use diff on debugging dumps for compiler
18979 invocations with different options, in particular with and without
18980 @option{-g}.
18981
18982 @item -fdump-unnumbered-links
18983 @opindex fdump-unnumbered-links
18984 When doing debugging dumps (see @option{-d} option above), suppress
18985 instruction numbers for the links to the previous and next instructions
18986 in a sequence.
18987
18988 @item -fdump-ipa-@var{switch}
18989 @itemx -fdump-ipa-@var{switch}-@var{options}
18990 @opindex fdump-ipa
18991 Control the dumping at various stages of inter-procedural analysis
18992 language tree to a file. The file name is generated by appending a
18993 switch specific suffix to the source file name, and the file is created
18994 in the same directory as the output file. The following dumps are
18995 possible:
18996
18997 @table @samp
18998 @item all
18999 Enables all inter-procedural analysis dumps.
19000
19001 @item cgraph
19002 Dumps information about call-graph optimization, unused function removal,
19003 and inlining decisions.
19004
19005 @item inline
19006 Dump after function inlining.
19007
19008 @end table
19009
19010 Additionally, the options @option{-optimized}, @option{-missed},
19011 @option{-note}, and @option{-all} can be provided, with the same meaning
19012 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19013
19014 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19015 information on callsites that were inlined, along with callsites
19016 that were not inlined.
19017
19018 By default, the dump will contain messages about successful
19019 optimizations (equivalent to @option{-optimized}) together with
19020 low-level details about the analysis.
19021
19022 @item -fdump-lang
19023 @opindex fdump-lang
19024 Dump language-specific information. The file name is made by appending
19025 @file{.lang} to the source file name.
19026
19027 @item -fdump-lang-all
19028 @itemx -fdump-lang-@var{switch}
19029 @itemx -fdump-lang-@var{switch}-@var{options}
19030 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19031 @opindex fdump-lang-all
19032 @opindex fdump-lang
19033 Control the dumping of language-specific information. The @var{options}
19034 and @var{filename} portions behave as described in the
19035 @option{-fdump-tree} option. The following @var{switch} values are
19036 accepted:
19037
19038 @table @samp
19039 @item all
19040
19041 Enable all language-specific dumps.
19042
19043 @item class
19044 Dump class hierarchy information. Virtual table information is emitted
19045 unless '@option{slim}' is specified. This option is applicable to C++ only.
19046
19047 @item module
19048 Dump module information. Options @option{lineno} (locations),
19049 @option{graph} (reachability), @option{blocks} (clusters),
19050 @option{uid} (serialization), @option{alias} (mergeable),
19051 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19052 (macros) may provide additional information. This option is
19053 applicable to C++ only.
19054
19055 @item raw
19056 Dump the raw internal tree data. This option is applicable to C++ only.
19057
19058 @end table
19059
19060 @item -fdump-passes
19061 @opindex fdump-passes
19062 Print on @file{stderr} the list of optimization passes that are turned
19063 on and off by the current command-line options.
19064
19065 @item -fdump-statistics-@var{option}
19066 @opindex fdump-statistics
19067 Enable and control dumping of pass statistics in a separate file. The
19068 file name is generated by appending a suffix ending in
19069 @samp{.statistics} to the source file name, and the file is created in
19070 the same directory as the output file. If the @samp{-@var{option}}
19071 form is used, @samp{-stats} causes counters to be summed over the
19072 whole compilation unit while @samp{-details} dumps every event as
19073 the passes generate them. The default with no option is to sum
19074 counters for each function compiled.
19075
19076 @item -fdump-tree-all
19077 @itemx -fdump-tree-@var{switch}
19078 @itemx -fdump-tree-@var{switch}-@var{options}
19079 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19080 @opindex fdump-tree-all
19081 @opindex fdump-tree
19082 Control the dumping at various stages of processing the intermediate
19083 language tree to a file. If the @samp{-@var{options}}
19084 form is used, @var{options} is a list of @samp{-} separated options
19085 which control the details of the dump. Not all options are applicable
19086 to all dumps; those that are not meaningful are ignored. The
19087 following options are available
19088
19089 @table @samp
19090 @item address
19091 Print the address of each node. Usually this is not meaningful as it
19092 changes according to the environment and source file. Its primary use
19093 is for tying up a dump file with a debug environment.
19094 @item asmname
19095 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19096 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
19097 use working backward from mangled names in the assembly file.
19098 @item slim
19099 When dumping front-end intermediate representations, inhibit dumping
19100 of members of a scope or body of a function merely because that scope
19101 has been reached. Only dump such items when they are directly reachable
19102 by some other path.
19103
19104 When dumping pretty-printed trees, this option inhibits dumping the
19105 bodies of control structures.
19106
19107 When dumping RTL, print the RTL in slim (condensed) form instead of
19108 the default LISP-like representation.
19109 @item raw
19110 Print a raw representation of the tree. By default, trees are
19111 pretty-printed into a C-like representation.
19112 @item details
19113 Enable more detailed dumps (not honored by every dump option). Also
19114 include information from the optimization passes.
19115 @item stats
19116 Enable dumping various statistics about the pass (not honored by every dump
19117 option).
19118 @item blocks
19119 Enable showing basic block boundaries (disabled in raw dumps).
19120 @item graph
19121 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19122 dump a representation of the control flow graph suitable for viewing with
19123 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
19124 the file is pretty-printed as a subgraph, so that GraphViz can render them
19125 all in a single plot.
19126
19127 This option currently only works for RTL dumps, and the RTL is always
19128 dumped in slim form.
19129 @item vops
19130 Enable showing virtual operands for every statement.
19131 @item lineno
19132 Enable showing line numbers for statements.
19133 @item uid
19134 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19135 @item verbose
19136 Enable showing the tree dump for each statement.
19137 @item eh
19138 Enable showing the EH region number holding each statement.
19139 @item scev
19140 Enable showing scalar evolution analysis details.
19141 @item optimized
19142 Enable showing optimization information (only available in certain
19143 passes).
19144 @item missed
19145 Enable showing missed optimization information (only available in certain
19146 passes).
19147 @item note
19148 Enable other detailed optimization information (only available in
19149 certain passes).
19150 @item all
19151 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19152 and @option{lineno}.
19153 @item optall
19154 Turn on all optimization options, i.e., @option{optimized},
19155 @option{missed}, and @option{note}.
19156 @end table
19157
19158 To determine what tree dumps are available or find the dump for a pass
19159 of interest follow the steps below.
19160
19161 @enumerate
19162 @item
19163 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19164 look for a code that corresponds to the pass you are interested in.
19165 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19166 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19167 The number at the end distinguishes distinct invocations of the same pass.
19168 @item
19169 To enable the creation of the dump file, append the pass code to
19170 the @option{-fdump-} option prefix and invoke GCC with it. For example,
19171 to enable the dump from the Early Value Range Propagation pass, invoke
19172 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
19173 specify the name of the dump file. If you don't specify one, GCC
19174 creates as described below.
19175 @item
19176 Find the pass dump in a file whose name is composed of three components
19177 separated by a period: the name of the source file GCC was invoked to
19178 compile, a numeric suffix indicating the pass number followed by the
19179 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19180 and finally the pass code. For example, the Early VRP pass dump might
19181 be in a file named @file{myfile.c.038t.evrp} in the current working
19182 directory. Note that the numeric codes are not stable and may change
19183 from one version of GCC to another.
19184 @end enumerate
19185
19186 @item -fopt-info
19187 @itemx -fopt-info-@var{options}
19188 @itemx -fopt-info-@var{options}=@var{filename}
19189 @opindex fopt-info
19190 Controls optimization dumps from various optimization passes. If the
19191 @samp{-@var{options}} form is used, @var{options} is a list of
19192 @samp{-} separated option keywords to select the dump details and
19193 optimizations.
19194
19195 The @var{options} can be divided into three groups:
19196 @enumerate
19197 @item
19198 options describing what kinds of messages should be emitted,
19199 @item
19200 options describing the verbosity of the dump, and
19201 @item
19202 options describing which optimizations should be included.
19203 @end enumerate
19204 The options from each group can be freely mixed as they are
19205 non-overlapping. However, in case of any conflicts,
19206 the later options override the earlier options on the command
19207 line.
19208
19209 The following options control which kinds of messages should be emitted:
19210
19211 @table @samp
19212 @item optimized
19213 Print information when an optimization is successfully applied. It is
19214 up to a pass to decide which information is relevant. For example, the
19215 vectorizer passes print the source location of loops which are
19216 successfully vectorized.
19217 @item missed
19218 Print information about missed optimizations. Individual passes
19219 control which information to include in the output.
19220 @item note
19221 Print verbose information about optimizations, such as certain
19222 transformations, more detailed messages about decisions etc.
19223 @item all
19224 Print detailed optimization information. This includes
19225 @samp{optimized}, @samp{missed}, and @samp{note}.
19226 @end table
19227
19228 The following option controls the dump verbosity:
19229
19230 @table @samp
19231 @item internals
19232 By default, only ``high-level'' messages are emitted. This option enables
19233 additional, more detailed, messages, which are likely to only be of interest
19234 to GCC developers.
19235 @end table
19236
19237 One or more of the following option keywords can be used to describe a
19238 group of optimizations:
19239
19240 @table @samp
19241 @item ipa
19242 Enable dumps from all interprocedural optimizations.
19243 @item loop
19244 Enable dumps from all loop optimizations.
19245 @item inline
19246 Enable dumps from all inlining optimizations.
19247 @item omp
19248 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19249 @item vec
19250 Enable dumps from all vectorization optimizations.
19251 @item optall
19252 Enable dumps from all optimizations. This is a superset of
19253 the optimization groups listed above.
19254 @end table
19255
19256 If @var{options} is
19257 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19258 about successful optimizations from all the passes, omitting messages
19259 that are treated as ``internals''.
19260
19261 If the @var{filename} is provided, then the dumps from all the
19262 applicable optimizations are concatenated into the @var{filename}.
19263 Otherwise the dump is output onto @file{stderr}. Though multiple
19264 @option{-fopt-info} options are accepted, only one of them can include
19265 a @var{filename}. If other filenames are provided then all but the
19266 first such option are ignored.
19267
19268 Note that the output @var{filename} is overwritten
19269 in case of multiple translation units. If a combined output from
19270 multiple translation units is desired, @file{stderr} should be used
19271 instead.
19272
19273 In the following example, the optimization info is output to
19274 @file{stderr}:
19275
19276 @smallexample
19277 gcc -O3 -fopt-info
19278 @end smallexample
19279
19280 This example:
19281 @smallexample
19282 gcc -O3 -fopt-info-missed=missed.all
19283 @end smallexample
19284
19285 @noindent
19286 outputs missed optimization report from all the passes into
19287 @file{missed.all}, and this one:
19288
19289 @smallexample
19290 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19291 @end smallexample
19292
19293 @noindent
19294 prints information about missed optimization opportunities from
19295 vectorization passes on @file{stderr}.
19296 Note that @option{-fopt-info-vec-missed} is equivalent to
19297 @option{-fopt-info-missed-vec}. The order of the optimization group
19298 names and message types listed after @option{-fopt-info} does not matter.
19299
19300 As another example,
19301 @smallexample
19302 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19303 @end smallexample
19304
19305 @noindent
19306 outputs information about missed optimizations as well as
19307 optimized locations from all the inlining passes into
19308 @file{inline.txt}.
19309
19310 Finally, consider:
19311
19312 @smallexample
19313 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19314 @end smallexample
19315
19316 @noindent
19317 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19318 in conflict since only one output file is allowed. In this case, only
19319 the first option takes effect and the subsequent options are
19320 ignored. Thus only @file{vec.miss} is produced which contains
19321 dumps from the vectorizer about missed opportunities.
19322
19323 @item -fsave-optimization-record
19324 @opindex fsave-optimization-record
19325 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19326 were performed, for those optimizations that support @option{-fopt-info}.
19327
19328 This option is experimental and the format of the data within the
19329 compressed JSON file is subject to change.
19330
19331 It is roughly equivalent to a machine-readable version of
19332 @option{-fopt-info-all}, as a collection of messages with source file,
19333 line number and column number, with the following additional data for
19334 each message:
19335
19336 @itemize @bullet
19337
19338 @item
19339 the execution count of the code being optimized, along with metadata about
19340 whether this was from actual profile data, or just an estimate, allowing
19341 consumers to prioritize messages by code hotness,
19342
19343 @item
19344 the function name of the code being optimized, where applicable,
19345
19346 @item
19347 the ``inlining chain'' for the code being optimized, so that when
19348 a function is inlined into several different places (which might
19349 themselves be inlined), the reader can distinguish between the copies,
19350
19351 @item
19352 objects identifying those parts of the message that refer to expressions,
19353 statements or symbol-table nodes, which of these categories they are, and,
19354 when available, their source code location,
19355
19356 @item
19357 the GCC pass that emitted the message, and
19358
19359 @item
19360 the location in GCC's own code from which the message was emitted
19361
19362 @end itemize
19363
19364 Additionally, some messages are logically nested within other
19365 messages, reflecting implementation details of the optimization
19366 passes.
19367
19368 @item -fsched-verbose=@var{n}
19369 @opindex fsched-verbose
19370 On targets that use instruction scheduling, this option controls the
19371 amount of debugging output the scheduler prints to the dump files.
19372
19373 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19374 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19375 For @var{n} greater than one, it also output basic block probabilities,
19376 detailed ready list information and unit/insn info. For @var{n} greater
19377 than two, it includes RTL at abort point, control-flow and regions info.
19378 And for @var{n} over four, @option{-fsched-verbose} also includes
19379 dependence info.
19380
19381
19382
19383 @item -fenable-@var{kind}-@var{pass}
19384 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19385 @opindex fdisable-
19386 @opindex fenable-
19387
19388 This is a set of options that are used to explicitly disable/enable
19389 optimization passes. These options are intended for use for debugging GCC.
19390 Compiler users should use regular options for enabling/disabling
19391 passes instead.
19392
19393 @table @gcctabopt
19394
19395 @item -fdisable-ipa-@var{pass}
19396 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
19397 statically invoked in the compiler multiple times, the pass name should be
19398 appended with a sequential number starting from 1.
19399
19400 @item -fdisable-rtl-@var{pass}
19401 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19402 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
19403 statically invoked in the compiler multiple times, the pass name should be
19404 appended with a sequential number starting from 1. @var{range-list} is a
19405 comma-separated list of function ranges or assembler names. Each range is a number
19406 pair separated by a colon. The range is inclusive in both ends. If the range
19407 is trivial, the number pair can be simplified as a single number. If the
19408 function's call graph node's @var{uid} falls within one of the specified ranges,
19409 the @var{pass} is disabled for that function. The @var{uid} is shown in the
19410 function header of a dump file, and the pass names can be dumped by using
19411 option @option{-fdump-passes}.
19412
19413 @item -fdisable-tree-@var{pass}
19414 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19415 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
19416 option arguments.
19417
19418 @item -fenable-ipa-@var{pass}
19419 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
19420 statically invoked in the compiler multiple times, the pass name should be
19421 appended with a sequential number starting from 1.
19422
19423 @item -fenable-rtl-@var{pass}
19424 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19425 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
19426 description and examples.
19427
19428 @item -fenable-tree-@var{pass}
19429 @itemx -fenable-tree-@var{pass}=@var{range-list}
19430 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
19431 of option arguments.
19432
19433 @end table
19434
19435 Here are some examples showing uses of these options.
19436
19437 @smallexample
19438
19439 # disable ccp1 for all functions
19440 -fdisable-tree-ccp1
19441 # disable complete unroll for function whose cgraph node uid is 1
19442 -fenable-tree-cunroll=1
19443 # disable gcse2 for functions at the following ranges [1,1],
19444 # [300,400], and [400,1000]
19445 # disable gcse2 for functions foo and foo2
19446 -fdisable-rtl-gcse2=foo,foo2
19447 # disable early inlining
19448 -fdisable-tree-einline
19449 # disable ipa inlining
19450 -fdisable-ipa-inline
19451 # enable tree full unroll
19452 -fenable-tree-unroll
19453
19454 @end smallexample
19455
19456 @item -fchecking
19457 @itemx -fchecking=@var{n}
19458 @opindex fchecking
19459 @opindex fno-checking
19460 Enable internal consistency checking. The default depends on
19461 the compiler configuration. @option{-fchecking=2} enables further
19462 internal consistency checking that might affect code generation.
19463
19464 @item -frandom-seed=@var{string}
19465 @opindex frandom-seed
19466 This option provides a seed that GCC uses in place of
19467 random numbers in generating certain symbol names
19468 that have to be different in every compiled file. It is also used to
19469 place unique stamps in coverage data files and the object files that
19470 produce them. You can use the @option{-frandom-seed} option to produce
19471 reproducibly identical object files.
19472
19473 The @var{string} can either be a number (decimal, octal or hex) or an
19474 arbitrary string (in which case it's converted to a number by
19475 computing CRC32).
19476
19477 The @var{string} should be different for every file you compile.
19478
19479 @item -save-temps
19480 @opindex save-temps
19481 Store the usual ``temporary'' intermediate files permanently; name them
19482 as auxiliary output files, as specified described under
19483 @option{-dumpbase} and @option{-dumpdir}.
19484
19485 When used in combination with the @option{-x} command-line option,
19486 @option{-save-temps} is sensible enough to avoid overwriting an
19487 input source file with the same extension as an intermediate file.
19488 The corresponding intermediate file may be obtained by renaming the
19489 source file before using @option{-save-temps}.
19490
19491 @item -save-temps=cwd
19492 @opindex save-temps=cwd
19493 Equivalent to @option{-save-temps -dumpdir ./}.
19494
19495 @item -save-temps=obj
19496 @opindex save-temps=obj
19497 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19498 @file{outdir/} is the directory of the output file specified after the
19499 @option{-o} option, including any directory separators. If the
19500 @option{-o} option is not used, the @option{-save-temps=obj} switch
19501 behaves like @option{-save-temps=cwd}.
19502
19503 @item -time@r{[}=@var{file}@r{]}
19504 @opindex time
19505 Report the CPU time taken by each subprocess in the compilation
19506 sequence. For C source files, this is the compiler proper and assembler
19507 (plus the linker if linking is done).
19508
19509 Without the specification of an output file, the output looks like this:
19510
19511 @smallexample
19512 # cc1 0.12 0.01
19513 # as 0.00 0.01
19514 @end smallexample
19515
19516 The first number on each line is the ``user time'', that is time spent
19517 executing the program itself. The second number is ``system time'',
19518 time spent executing operating system routines on behalf of the program.
19519 Both numbers are in seconds.
19520
19521 With the specification of an output file, the output is appended to the
19522 named file, and it looks like this:
19523
19524 @smallexample
19525 0.12 0.01 cc1 @var{options}
19526 0.00 0.01 as @var{options}
19527 @end smallexample
19528
19529 The ``user time'' and the ``system time'' are moved before the program
19530 name, and the options passed to the program are displayed, so that one
19531 can later tell what file was being compiled, and with which options.
19532
19533 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19534 @opindex fdump-final-insns
19535 Dump the final internal representation (RTL) to @var{file}. If the
19536 optional argument is omitted (or if @var{file} is @code{.}), the name
19537 of the dump file is determined by appending @code{.gkd} to the
19538 dump base name, see @option{-dumpbase}.
19539
19540 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19541 @opindex fcompare-debug
19542 @opindex fno-compare-debug
19543 If no error occurs during compilation, run the compiler a second time,
19544 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19545 passed to the second compilation. Dump the final internal
19546 representation in both compilations, and print an error if they differ.
19547
19548 If the equal sign is omitted, the default @option{-gtoggle} is used.
19549
19550 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19551 and nonzero, implicitly enables @option{-fcompare-debug}. If
19552 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19553 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19554 is used.
19555
19556 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19557 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19558 of the final representation and the second compilation, preventing even
19559 @env{GCC_COMPARE_DEBUG} from taking effect.
19560
19561 To verify full coverage during @option{-fcompare-debug} testing, set
19562 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19563 which GCC rejects as an invalid option in any actual compilation
19564 (rather than preprocessing, assembly or linking). To get just a
19565 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19566 not overridden} will do.
19567
19568 @item -fcompare-debug-second
19569 @opindex fcompare-debug-second
19570 This option is implicitly passed to the compiler for the second
19571 compilation requested by @option{-fcompare-debug}, along with options to
19572 silence warnings, and omitting other options that would cause the compiler
19573 to produce output to files or to standard output as a side effect. Dump
19574 files and preserved temporary files are renamed so as to contain the
19575 @code{.gk} additional extension during the second compilation, to avoid
19576 overwriting those generated by the first.
19577
19578 When this option is passed to the compiler driver, it causes the
19579 @emph{first} compilation to be skipped, which makes it useful for little
19580 other than debugging the compiler proper.
19581
19582 @item -gtoggle
19583 @opindex gtoggle
19584 Turn off generation of debug info, if leaving out this option
19585 generates it, or turn it on at level 2 otherwise. The position of this
19586 argument in the command line does not matter; it takes effect after all
19587 other options are processed, and it does so only once, no matter how
19588 many times it is given. This is mainly intended to be used with
19589 @option{-fcompare-debug}.
19590
19591 @item -fvar-tracking-assignments-toggle
19592 @opindex fvar-tracking-assignments-toggle
19593 @opindex fno-var-tracking-assignments-toggle
19594 Toggle @option{-fvar-tracking-assignments}, in the same way that
19595 @option{-gtoggle} toggles @option{-g}.
19596
19597 @item -Q
19598 @opindex Q
19599 Makes the compiler print out each function name as it is compiled, and
19600 print some statistics about each pass when it finishes.
19601
19602 @item -ftime-report
19603 @opindex ftime-report
19604 Makes the compiler print some statistics about the time consumed by each
19605 pass when it finishes.
19606
19607 @item -ftime-report-details
19608 @opindex ftime-report-details
19609 Record the time consumed by infrastructure parts separately for each pass.
19610
19611 @item -fira-verbose=@var{n}
19612 @opindex fira-verbose
19613 Control the verbosity of the dump file for the integrated register allocator.
19614 The default value is 5. If the value @var{n} is greater or equal to 10,
19615 the dump output is sent to stderr using the same format as @var{n} minus 10.
19616
19617 @item -flto-report
19618 @opindex flto-report
19619 Prints a report with internal details on the workings of the link-time
19620 optimizer. The contents of this report vary from version to version.
19621 It is meant to be useful to GCC developers when processing object
19622 files in LTO mode (via @option{-flto}).
19623
19624 Disabled by default.
19625
19626 @item -flto-report-wpa
19627 @opindex flto-report-wpa
19628 Like @option{-flto-report}, but only print for the WPA phase of link-time
19629 optimization.
19630
19631 @item -fmem-report
19632 @opindex fmem-report
19633 Makes the compiler print some statistics about permanent memory
19634 allocation when it finishes.
19635
19636 @item -fmem-report-wpa
19637 @opindex fmem-report-wpa
19638 Makes the compiler print some statistics about permanent memory
19639 allocation for the WPA phase only.
19640
19641 @item -fpre-ipa-mem-report
19642 @opindex fpre-ipa-mem-report
19643 @item -fpost-ipa-mem-report
19644 @opindex fpost-ipa-mem-report
19645 Makes the compiler print some statistics about permanent memory
19646 allocation before or after interprocedural optimization.
19647
19648 @item -fmultiflags
19649 @opindex fmultiflags
19650 This option enables multilib-aware @code{TFLAGS} to be used to build
19651 target libraries with options different from those the compiler is
19652 configured to use by default, through the use of specs (@xref{Spec
19653 Files}) set up by compiler internals, by the target, or by builders at
19654 configure time.
19655
19656 Like @code{TFLAGS}, this allows the target libraries to be built for
19657 portable baseline environments, while the compiler defaults to more
19658 demanding ones. That's useful because users can easily override the
19659 defaults the compiler is configured to use to build their own programs,
19660 if the defaults are not ideal for their target environment, whereas
19661 rebuilding the runtime libraries is usually not as easy or desirable.
19662
19663 Unlike @code{TFLAGS}, the use of specs enables different flags to be
19664 selected for different multilibs. The way to accomplish that is to
19665 build with @samp{make TFLAGS=-fmultiflags}, after configuring
19666 @samp{--with-specs=%@{fmultiflags:...@}}.
19667
19668 This option is discarded by the driver once it's done processing driver
19669 self spec.
19670
19671 It is also useful to check that @code{TFLAGS} are being used to build
19672 all target libraries, by configuring a non-bootstrap compiler
19673 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
19674 the compiler and target libraries.
19675
19676 @item -fprofile-report
19677 @opindex fprofile-report
19678 Makes the compiler print some statistics about consistency of the
19679 (estimated) profile and effect of individual passes.
19680
19681 @item -fstack-usage
19682 @opindex fstack-usage
19683 Makes the compiler output stack usage information for the program, on a
19684 per-function basis. The filename for the dump is made by appending
19685 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
19686 the output file, if explicitly specified and it is not an executable,
19687 otherwise it is the basename of the source file. An entry is made up
19688 of three fields:
19689
19690 @itemize
19691 @item
19692 The name of the function.
19693 @item
19694 A number of bytes.
19695 @item
19696 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
19697 @end itemize
19698
19699 The qualifier @code{static} means that the function manipulates the stack
19700 statically: a fixed number of bytes are allocated for the frame on function
19701 entry and released on function exit; no stack adjustments are otherwise made
19702 in the function. The second field is this fixed number of bytes.
19703
19704 The qualifier @code{dynamic} means that the function manipulates the stack
19705 dynamically: in addition to the static allocation described above, stack
19706 adjustments are made in the body of the function, for example to push/pop
19707 arguments around function calls. If the qualifier @code{bounded} is also
19708 present, the amount of these adjustments is bounded at compile time and
19709 the second field is an upper bound of the total amount of stack used by
19710 the function. If it is not present, the amount of these adjustments is
19711 not bounded at compile time and the second field only represents the
19712 bounded part.
19713
19714 @item -fstats
19715 @opindex fstats
19716 Emit statistics about front-end processing at the end of the compilation.
19717 This option is supported only by the C++ front end, and
19718 the information is generally only useful to the G++ development team.
19719
19720 @item -fdbg-cnt-list
19721 @opindex fdbg-cnt-list
19722 Print the name and the counter upper bound for all debug counters.
19723
19724
19725 @item -fdbg-cnt=@var{counter-value-list}
19726 @opindex fdbg-cnt
19727 Set the internal debug counter lower and upper bound. @var{counter-value-list}
19728 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
19729 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
19730 the name of the counter and list of closed intervals.
19731 The @var{lower_bound} is optional and is zero
19732 initialized if not set.
19733 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
19734 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
19735 eleventh invocation.
19736 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
19737
19738 @item -print-file-name=@var{library}
19739 @opindex print-file-name
19740 Print the full absolute name of the library file @var{library} that
19741 would be used when linking---and don't do anything else. With this
19742 option, GCC does not compile or link anything; it just prints the
19743 file name.
19744
19745 @item -print-multi-directory
19746 @opindex print-multi-directory
19747 Print the directory name corresponding to the multilib selected by any
19748 other switches present in the command line. This directory is supposed
19749 to exist in @env{GCC_EXEC_PREFIX}.
19750
19751 @item -print-multi-lib
19752 @opindex print-multi-lib
19753 Print the mapping from multilib directory names to compiler switches
19754 that enable them. The directory name is separated from the switches by
19755 @samp{;}, and each switch starts with an @samp{@@} instead of the
19756 @samp{-}, without spaces between multiple switches. This is supposed to
19757 ease shell processing.
19758
19759 @item -print-multi-os-directory
19760 @opindex print-multi-os-directory
19761 Print the path to OS libraries for the selected
19762 multilib, relative to some @file{lib} subdirectory. If OS libraries are
19763 present in the @file{lib} subdirectory and no multilibs are used, this is
19764 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
19765 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
19766 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
19767 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
19768
19769 @item -print-multiarch
19770 @opindex print-multiarch
19771 Print the path to OS libraries for the selected multiarch,
19772 relative to some @file{lib} subdirectory.
19773
19774 @item -print-prog-name=@var{program}
19775 @opindex print-prog-name
19776 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
19777
19778 @item -print-libgcc-file-name
19779 @opindex print-libgcc-file-name
19780 Same as @option{-print-file-name=libgcc.a}.
19781
19782 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
19783 but you do want to link with @file{libgcc.a}. You can do:
19784
19785 @smallexample
19786 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
19787 @end smallexample
19788
19789 @item -print-search-dirs
19790 @opindex print-search-dirs
19791 Print the name of the configured installation directory and a list of
19792 program and library directories @command{gcc} searches---and don't do anything else.
19793
19794 This is useful when @command{gcc} prints the error message
19795 @samp{installation problem, cannot exec cpp0: No such file or directory}.
19796 To resolve this you either need to put @file{cpp0} and the other compiler
19797 components where @command{gcc} expects to find them, or you can set the environment
19798 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
19799 Don't forget the trailing @samp{/}.
19800 @xref{Environment Variables}.
19801
19802 @item -print-sysroot
19803 @opindex print-sysroot
19804 Print the target sysroot directory that is used during
19805 compilation. This is the target sysroot specified either at configure
19806 time or using the @option{--sysroot} option, possibly with an extra
19807 suffix that depends on compilation options. If no target sysroot is
19808 specified, the option prints nothing.
19809
19810 @item -print-sysroot-headers-suffix
19811 @opindex print-sysroot-headers-suffix
19812 Print the suffix added to the target sysroot when searching for
19813 headers, or give an error if the compiler is not configured with such
19814 a suffix---and don't do anything else.
19815
19816 @item -dumpmachine
19817 @opindex dumpmachine
19818 Print the compiler's target machine (for example,
19819 @samp{i686-pc-linux-gnu})---and don't do anything else.
19820
19821 @item -dumpversion
19822 @opindex dumpversion
19823 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
19824 anything else. This is the compiler version used in filesystem paths and
19825 specs. Depending on how the compiler has been configured it can be just
19826 a single number (major version), two numbers separated by a dot (major and
19827 minor version) or three numbers separated by dots (major, minor and patchlevel
19828 version).
19829
19830 @item -dumpfullversion
19831 @opindex dumpfullversion
19832 Print the full compiler version---and don't do anything else. The output is
19833 always three numbers separated by dots, major, minor and patchlevel version.
19834
19835 @item -dumpspecs
19836 @opindex dumpspecs
19837 Print the compiler's built-in specs---and don't do anything else. (This
19838 is used when GCC itself is being built.) @xref{Spec Files}.
19839 @end table
19840
19841 @node Submodel Options
19842 @section Machine-Dependent Options
19843 @cindex submodel options
19844 @cindex specifying hardware config
19845 @cindex hardware models and configurations, specifying
19846 @cindex target-dependent options
19847 @cindex machine-dependent options
19848
19849 Each target machine supported by GCC can have its own options---for
19850 example, to allow you to compile for a particular processor variant or
19851 ABI, or to control optimizations specific to that machine. By
19852 convention, the names of machine-specific options start with
19853 @samp{-m}.
19854
19855 Some configurations of the compiler also support additional target-specific
19856 options, usually for compatibility with other compilers on the same
19857 platform.
19858
19859 @c This list is ordered alphanumerically by subsection name.
19860 @c It should be the same order and spelling as these options are listed
19861 @c in Machine Dependent Options
19862
19863 @menu
19864 * AArch64 Options::
19865 * Adapteva Epiphany Options::
19866 * AMD GCN Options::
19867 * ARC Options::
19868 * ARM Options::
19869 * AVR Options::
19870 * Blackfin Options::
19871 * C6X Options::
19872 * CRIS Options::
19873 * C-SKY Options::
19874 * Darwin Options::
19875 * DEC Alpha Options::
19876 * eBPF Options::
19877 * FR30 Options::
19878 * FT32 Options::
19879 * FRV Options::
19880 * GNU/Linux Options::
19881 * H8/300 Options::
19882 * HPPA Options::
19883 * IA-64 Options::
19884 * LM32 Options::
19885 * LoongArch Options::
19886 * M32C Options::
19887 * M32R/D Options::
19888 * M680x0 Options::
19889 * MCore Options::
19890 * MicroBlaze Options::
19891 * MIPS Options::
19892 * MMIX Options::
19893 * MN10300 Options::
19894 * Moxie Options::
19895 * MSP430 Options::
19896 * NDS32 Options::
19897 * Nios II Options::
19898 * Nvidia PTX Options::
19899 * OpenRISC Options::
19900 * PDP-11 Options::
19901 * PowerPC Options::
19902 * PRU Options::
19903 * RISC-V Options::
19904 * RL78 Options::
19905 * RS/6000 and PowerPC Options::
19906 * RX Options::
19907 * S/390 and zSeries Options::
19908 * SH Options::
19909 * Solaris 2 Options::
19910 * SPARC Options::
19911 * System V Options::
19912 * V850 Options::
19913 * VAX Options::
19914 * Visium Options::
19915 * VMS Options::
19916 * VxWorks Options::
19917 * x86 Options::
19918 * x86 Windows Options::
19919 * Xstormy16 Options::
19920 * Xtensa Options::
19921 * zSeries Options::
19922 @end menu
19923
19924 @node AArch64 Options
19925 @subsection AArch64 Options
19926 @cindex AArch64 Options
19927
19928 These options are defined for AArch64 implementations:
19929
19930 @table @gcctabopt
19931
19932 @item -mabi=@var{name}
19933 @opindex mabi
19934 Generate code for the specified data model. Permissible values
19935 are @samp{ilp32} for SysV-like data model where int, long int and pointers
19936 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
19937 but long int and pointers are 64 bits.
19938
19939 The default depends on the specific target configuration. Note that
19940 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
19941 entire program with the same ABI, and link with a compatible set of libraries.
19942
19943 @item -mbig-endian
19944 @opindex mbig-endian
19945 Generate big-endian code. This is the default when GCC is configured for an
19946 @samp{aarch64_be-*-*} target.
19947
19948 @item -mgeneral-regs-only
19949 @opindex mgeneral-regs-only
19950 Generate code which uses only the general-purpose registers. This will prevent
19951 the compiler from using floating-point and Advanced SIMD registers but will not
19952 impose any restrictions on the assembler.
19953
19954 @item -mlittle-endian
19955 @opindex mlittle-endian
19956 Generate little-endian code. This is the default when GCC is configured for an
19957 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
19958
19959 @item -mcmodel=tiny
19960 @opindex mcmodel=tiny
19961 Generate code for the tiny code model. The program and its statically defined
19962 symbols must be within 1MB of each other. Programs can be statically or
19963 dynamically linked.
19964
19965 @item -mcmodel=small
19966 @opindex mcmodel=small
19967 Generate code for the small code model. The program and its statically defined
19968 symbols must be within 4GB of each other. Programs can be statically or
19969 dynamically linked. This is the default code model.
19970
19971 @item -mcmodel=large
19972 @opindex mcmodel=large
19973 Generate code for the large code model. This makes no assumptions about
19974 addresses and sizes of sections. Programs can be statically linked only. The
19975 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
19976 @option{-fpic} and @option{-fPIC}.
19977
19978 @item -mstrict-align
19979 @itemx -mno-strict-align
19980 @opindex mstrict-align
19981 @opindex mno-strict-align
19982 Avoid or allow generating memory accesses that may not be aligned on a natural
19983 object boundary as described in the architecture specification.
19984
19985 @item -momit-leaf-frame-pointer
19986 @itemx -mno-omit-leaf-frame-pointer
19987 @opindex momit-leaf-frame-pointer
19988 @opindex mno-omit-leaf-frame-pointer
19989 Omit or keep the frame pointer in leaf functions. The former behavior is the
19990 default.
19991
19992 @item -mstack-protector-guard=@var{guard}
19993 @itemx -mstack-protector-guard-reg=@var{reg}
19994 @itemx -mstack-protector-guard-offset=@var{offset}
19995 @opindex mstack-protector-guard
19996 @opindex mstack-protector-guard-reg
19997 @opindex mstack-protector-guard-offset
19998 Generate stack protection code using canary at @var{guard}. Supported
19999 locations are @samp{global} for a global canary or @samp{sysreg} for a
20000 canary in an appropriate system register.
20001
20002 With the latter choice the options
20003 @option{-mstack-protector-guard-reg=@var{reg}} and
20004 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20005 which system register to use as base register for reading the canary,
20006 and from what offset from that base register. There is no default
20007 register or offset as this is entirely for use within the Linux
20008 kernel.
20009
20010 @item -mtls-dialect=desc
20011 @opindex mtls-dialect=desc
20012 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20013 of TLS variables. This is the default.
20014
20015 @item -mtls-dialect=traditional
20016 @opindex mtls-dialect=traditional
20017 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20018 of TLS variables.
20019
20020 @item -mtls-size=@var{size}
20021 @opindex mtls-size
20022 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
20023 This option requires binutils 2.26 or newer.
20024
20025 @item -mfix-cortex-a53-835769
20026 @itemx -mno-fix-cortex-a53-835769
20027 @opindex mfix-cortex-a53-835769
20028 @opindex mno-fix-cortex-a53-835769
20029 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20030 This involves inserting a NOP instruction between memory instructions and
20031 64-bit integer multiply-accumulate instructions.
20032
20033 @item -mfix-cortex-a53-843419
20034 @itemx -mno-fix-cortex-a53-843419
20035 @opindex mfix-cortex-a53-843419
20036 @opindex mno-fix-cortex-a53-843419
20037 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20038 This erratum workaround is made at link time and this will only pass the
20039 corresponding flag to the linker.
20040
20041 @item -mlow-precision-recip-sqrt
20042 @itemx -mno-low-precision-recip-sqrt
20043 @opindex mlow-precision-recip-sqrt
20044 @opindex mno-low-precision-recip-sqrt
20045 Enable or disable the reciprocal square root approximation.
20046 This option only has an effect if @option{-ffast-math} or
20047 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20048 precision of reciprocal square root results to about 16 bits for
20049 single precision and to 32 bits for double precision.
20050
20051 @item -mlow-precision-sqrt
20052 @itemx -mno-low-precision-sqrt
20053 @opindex mlow-precision-sqrt
20054 @opindex mno-low-precision-sqrt
20055 Enable or disable the square root approximation.
20056 This option only has an effect if @option{-ffast-math} or
20057 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20058 precision of square root results to about 16 bits for
20059 single precision and to 32 bits for double precision.
20060 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20061
20062 @item -mlow-precision-div
20063 @itemx -mno-low-precision-div
20064 @opindex mlow-precision-div
20065 @opindex mno-low-precision-div
20066 Enable or disable the division approximation.
20067 This option only has an effect if @option{-ffast-math} or
20068 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20069 precision of division results to about 16 bits for
20070 single precision and to 32 bits for double precision.
20071
20072 @item -mtrack-speculation
20073 @itemx -mno-track-speculation
20074 Enable or disable generation of additional code to track speculative
20075 execution through conditional branches. The tracking state can then
20076 be used by the compiler when expanding calls to
20077 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20078 sequence to be generated.
20079
20080 @item -moutline-atomics
20081 @itemx -mno-outline-atomics
20082 Enable or disable calls to out-of-line helpers to implement atomic operations.
20083 These helpers will, at runtime, determine if the LSE instructions from
20084 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20085 instructions that are present in the base ARMv8.0 ISA.
20086
20087 This option is only applicable when compiling for the base ARMv8.0
20088 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
20089 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20090 used directly. The same applies when using @option{-mcpu=} when the
20091 selected cpu supports the @samp{lse} feature.
20092 This option is on by default.
20093
20094 @item -march=@var{name}
20095 @opindex march
20096 Specify the name of the target architecture and, optionally, one or
20097 more feature modifiers. This option has the form
20098 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20099
20100 The table below summarizes the permissible values for @var{arch}
20101 and the features that they enable by default:
20102
20103 @multitable @columnfractions 0.20 0.20 0.60
20104 @headitem @var{arch} value @tab Architecture @tab Includes by default
20105 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20106 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20107 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20108 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20109 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20110 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20111 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20112 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20113 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20114 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20115 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20116 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20117 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20118 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20119 @end multitable
20120
20121 The value @samp{native} is available on native AArch64 GNU/Linux and
20122 causes the compiler to pick the architecture of the host system. This
20123 option has no effect if the compiler is unable to recognize the
20124 architecture of the host system,
20125
20126 The permissible values for @var{feature} are listed in the sub-section
20127 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20128 Feature Modifiers}. Where conflicting feature modifiers are
20129 specified, the right-most feature is used.
20130
20131 GCC uses @var{name} to determine what kind of instructions it can emit
20132 when generating assembly code. If @option{-march} is specified
20133 without either of @option{-mtune} or @option{-mcpu} also being
20134 specified, the code is tuned to perform well across a range of target
20135 processors implementing the target architecture.
20136
20137 @item -mtune=@var{name}
20138 @opindex mtune
20139 Specify the name of the target processor for which GCC should tune the
20140 performance of the code. Permissible values for this option are:
20141 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20142 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20143 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20144 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20145 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20146 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20147 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20148 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20149 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20150 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
20151 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20152 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20153 @samp{octeontx2f95mm},
20154 @samp{a64fx},
20155 @samp{thunderx}, @samp{thunderxt88},
20156 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20157 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20158 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20159 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20160 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20161 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20162 @samp{cortex-x3}, @samp{cortex-a510}, @samp{cortex-a710}, @samp{cortex-a715},
20163 @samp{ampere1}, @samp{ampere1a}, and @samp{native}.
20164
20165 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20166 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20167 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20168 should tune for a big.LITTLE system.
20169
20170 The value @samp{neoverse-512tvb} specifies that GCC should tune
20171 for Neoverse cores that (a) implement SVE and (b) have a total vector
20172 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
20173 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20174 instructions a cycle and that can execute an equivalent number of SVE
20175 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20176 This is more general than tuning for a specific core like Neoverse V1
20177 but is more specific than the default tuning described below.
20178
20179 Additionally on native AArch64 GNU/Linux systems the value
20180 @samp{native} tunes performance to the host system. This option has no effect
20181 if the compiler is unable to recognize the processor of the host system.
20182
20183 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20184 are specified, the code is tuned to perform well across a range
20185 of target processors.
20186
20187 This option cannot be suffixed by feature modifiers.
20188
20189 @item -mcpu=@var{name}
20190 @opindex mcpu
20191 Specify the name of the target processor, optionally suffixed by one
20192 or more feature modifiers. This option has the form
20193 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20194 the permissible values for @var{cpu} are the same as those available
20195 for @option{-mtune}. The permissible values for @var{feature} are
20196 documented in the sub-section on
20197 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20198 Feature Modifiers}. Where conflicting feature modifiers are
20199 specified, the right-most feature is used.
20200
20201 GCC uses @var{name} to determine what kind of instructions it can emit when
20202 generating assembly code (as if by @option{-march}) and to determine
20203 the target processor for which to tune for performance (as if
20204 by @option{-mtune}). Where this option is used in conjunction
20205 with @option{-march} or @option{-mtune}, those options take precedence
20206 over the appropriate part of this option.
20207
20208 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20209 to a specific core, but instead refers to all Neoverse cores that
20210 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20211 a cycle. Unless overridden by @option{-march},
20212 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20213 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20214 these properties. Unless overridden by @option{-mtune},
20215 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20216 @option{-mtune=neoverse-512tvb}.
20217
20218 @item -moverride=@var{string}
20219 @opindex moverride
20220 Override tuning decisions made by the back-end in response to a
20221 @option{-mtune=} switch. The syntax, semantics, and accepted values
20222 for @var{string} in this option are not guaranteed to be consistent
20223 across releases.
20224
20225 This option is only intended to be useful when developing GCC.
20226
20227 @item -mverbose-cost-dump
20228 @opindex mverbose-cost-dump
20229 Enable verbose cost model dumping in the debug dump files. This option is
20230 provided for use in debugging the compiler.
20231
20232 @item -mpc-relative-literal-loads
20233 @itemx -mno-pc-relative-literal-loads
20234 @opindex mpc-relative-literal-loads
20235 @opindex mno-pc-relative-literal-loads
20236 Enable or disable PC-relative literal loads. With this option literal pools are
20237 accessed using a single instruction and emitted after each function. This
20238 limits the maximum size of functions to 1MB. This is enabled by default for
20239 @option{-mcmodel=tiny}.
20240
20241 @item -msign-return-address=@var{scope}
20242 @opindex msign-return-address
20243 Select the function scope on which return address signing will be applied.
20244 Permissible values are @samp{none}, which disables return address signing,
20245 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20246 functions, and @samp{all}, which enables pointer signing for all functions. The
20247 default value is @samp{none}. This option has been deprecated by
20248 -mbranch-protection.
20249
20250 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20251 @opindex mbranch-protection
20252 Select the branch protection features to use.
20253 @samp{none} is the default and turns off all types of branch protection.
20254 @samp{standard} turns on all types of branch protection features. If a feature
20255 has additional tuning options, then @samp{standard} sets it to its standard
20256 level.
20257 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20258 level: signing functions that save the return address to memory (non-leaf
20259 functions will practically always do this) using the a-key. The optional
20260 argument @samp{leaf} can be used to extend the signing to include leaf
20261 functions. The optional argument @samp{b-key} can be used to sign the functions
20262 with the B-key instead of the A-key.
20263 @samp{bti} turns on branch target identification mechanism.
20264
20265 @item -mharden-sls=@var{opts}
20266 @opindex mharden-sls
20267 Enable compiler hardening against straight line speculation (SLS).
20268 @var{opts} is a comma-separated list of the following options:
20269 @table @samp
20270 @item retbr
20271 @item blr
20272 @end table
20273 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20274 @samp{-mharden-sls=none} disables all SLS hardening.
20275
20276 @item -msve-vector-bits=@var{bits}
20277 @opindex msve-vector-bits
20278 Specify the number of bits in an SVE vector register. This option only has
20279 an effect when SVE is enabled.
20280
20281 GCC supports two forms of SVE code generation: ``vector-length
20282 agnostic'' output that works with any size of vector register and
20283 ``vector-length specific'' output that allows GCC to make assumptions
20284 about the vector length when it is useful for optimization reasons.
20285 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20286 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20287 Specifying @samp{scalable} selects vector-length agnostic
20288 output. At present @samp{-msve-vector-bits=128} also generates vector-length
20289 agnostic output for big-endian targets. All other values generate
20290 vector-length specific code. The behavior of these values may change
20291 in future releases and no value except @samp{scalable} should be
20292 relied on for producing code that is portable across different
20293 hardware SVE vector lengths.
20294
20295 The default is @samp{-msve-vector-bits=scalable}, which produces
20296 vector-length agnostic code.
20297 @end table
20298
20299 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20300 @anchor{aarch64-feature-modifiers}
20301 @cindex @option{-march} feature modifiers
20302 @cindex @option{-mcpu} feature modifiers
20303 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20304 the following and their inverses @option{no@var{feature}}:
20305
20306 @table @samp
20307 @item crc
20308 Enable CRC extension. This is on by default for
20309 @option{-march=armv8.1-a}.
20310 @item crypto
20311 Enable Crypto extension. This also enables Advanced SIMD and floating-point
20312 instructions.
20313 @item fp
20314 Enable floating-point instructions. This is on by default for all possible
20315 values for options @option{-march} and @option{-mcpu}.
20316 @item simd
20317 Enable Advanced SIMD instructions. This also enables floating-point
20318 instructions. This is on by default for all possible values for options
20319 @option{-march} and @option{-mcpu}.
20320 @item sve
20321 Enable Scalable Vector Extension instructions. This also enables Advanced
20322 SIMD and floating-point instructions.
20323 @item lse
20324 Enable Large System Extension instructions. This is on by default for
20325 @option{-march=armv8.1-a}.
20326 @item rdma
20327 Enable Round Double Multiply Accumulate instructions. This is on by default
20328 for @option{-march=armv8.1-a}.
20329 @item fp16
20330 Enable FP16 extension. This also enables floating-point instructions.
20331 @item fp16fml
20332 Enable FP16 fmla extension. This also enables FP16 extensions and
20333 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.
20334
20335 @item rcpc
20336 Enable the RCpc extension. This enables the use of the LDAPR instructions for
20337 load-acquire atomic semantics, and passes it on to the assembler, enabling
20338 inline asm statements to use instructions from the RCpc extension.
20339 @item dotprod
20340 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20341 @item aes
20342 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
20343 SIMD instructions.
20344 @item sha2
20345 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
20346 @item sha3
20347 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
20348 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20349 @item sm4
20350 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
20351 Use of this option with architectures prior to Armv8.2-A is not supported.
20352 @item profile
20353 Enable the Statistical Profiling extension. This option is only to enable the
20354 extension at the assembler level and does not affect code generation.
20355 @item rng
20356 Enable the Armv8.5-a Random Number instructions. This option is only to
20357 enable the extension at the assembler level and does not affect code
20358 generation.
20359 @item memtag
20360 Enable the Armv8.5-a Memory Tagging Extensions.
20361 Use of this option with architectures prior to Armv8.5-A is not supported.
20362 @item sb
20363 Enable the Armv8-a Speculation Barrier instruction. This option is only to
20364 enable the extension at the assembler level and does not affect code
20365 generation. This option is enabled by default for @option{-march=armv8.5-a}.
20366 @item ssbs
20367 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
20368 is only to enable the extension at the assembler level and does not affect code
20369 generation. This option is enabled by default for @option{-march=armv8.5-a}.
20370 @item predres
20371 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20372 This option is only to enable the extension at the assembler level and does
20373 not affect code generation. This option is enabled by default for
20374 @option{-march=armv8.5-a}.
20375 @item sve2
20376 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
20377 instructions.
20378 @item sve2-bitperm
20379 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
20380 @item sve2-sm4
20381 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
20382 @item sve2-aes
20383 Enable SVE2 aes instructions. This also enables SVE2 instructions.
20384 @item sve2-sha3
20385 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
20386 @item tme
20387 Enable the Transactional Memory Extension.
20388 @item i8mm
20389 Enable 8-bit Integer Matrix Multiply instructions. This also enables
20390 Advanced SIMD and floating-point instructions. This option is enabled by
20391 default for @option{-march=armv8.6-a}. Use of this option with architectures
20392 prior to Armv8.2-A is not supported.
20393 @item f32mm
20394 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
20395 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
20396 not supported.
20397 @item f64mm
20398 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
20399 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
20400 not supported.
20401 @item bf16
20402 Enable brain half-precision floating-point instructions. This also enables
20403 Advanced SIMD and floating-point instructions. This option is enabled by
20404 default for @option{-march=armv8.6-a}. Use of this option with architectures
20405 prior to Armv8.2-A is not supported.
20406 @item ls64
20407 Enable the 64-byte atomic load and store instructions for accelerators.
20408 This option is enabled by default for @option{-march=armv8.7-a}.
20409 @item mops
20410 Enable the instructions to accelerate memory operations like @code{memcpy},
20411 @code{memmove}, @code{memset}. This option is enabled by default for
20412 @option{-march=armv8.8-a}
20413 @item flagm
20414 Enable the Flag Manipulation instructions Extension.
20415 @item pauth
20416 Enable the Pointer Authentication Extension.
20417 @item cssc
20418 Enable the Common Short Sequence Compression instructions.
20419
20420 @end table
20421
20422 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20423 which implies @option{fp}.
20424 Conversely, @option{nofp} implies @option{nosimd}, which implies
20425 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20426
20427 @node Adapteva Epiphany Options
20428 @subsection Adapteva Epiphany Options
20429
20430 These @samp{-m} options are defined for Adapteva Epiphany:
20431
20432 @table @gcctabopt
20433 @item -mhalf-reg-file
20434 @opindex mhalf-reg-file
20435 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20436 That allows code to run on hardware variants that lack these registers.
20437
20438 @item -mprefer-short-insn-regs
20439 @opindex mprefer-short-insn-regs
20440 Preferentially allocate registers that allow short instruction generation.
20441 This can result in increased instruction count, so this may either reduce or
20442 increase overall code size.
20443
20444 @item -mbranch-cost=@var{num}
20445 @opindex mbranch-cost
20446 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20447 This cost is only a heuristic and is not guaranteed to produce
20448 consistent results across releases.
20449
20450 @item -mcmove
20451 @opindex mcmove
20452 Enable the generation of conditional moves.
20453
20454 @item -mnops=@var{num}
20455 @opindex mnops
20456 Emit @var{num} NOPs before every other generated instruction.
20457
20458 @item -mno-soft-cmpsf
20459 @opindex mno-soft-cmpsf
20460 @opindex msoft-cmpsf
20461 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20462 and test the flags. This is faster than a software comparison, but can
20463 get incorrect results in the presence of NaNs, or when two different small
20464 numbers are compared such that their difference is calculated as zero.
20465 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20466 software comparisons.
20467
20468 @item -mstack-offset=@var{num}
20469 @opindex mstack-offset
20470 Set the offset between the top of the stack and the stack pointer.
20471 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20472 can be used by leaf functions without stack allocation.
20473 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20474 Note also that this option changes the ABI; compiling a program with a
20475 different stack offset than the libraries have been compiled with
20476 generally does not work.
20477 This option can be useful if you want to evaluate if a different stack
20478 offset would give you better code, but to actually use a different stack
20479 offset to build working programs, it is recommended to configure the
20480 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20481
20482 @item -mno-round-nearest
20483 @opindex mno-round-nearest
20484 @opindex mround-nearest
20485 Make the scheduler assume that the rounding mode has been set to
20486 truncating. The default is @option{-mround-nearest}.
20487
20488 @item -mlong-calls
20489 @opindex mlong-calls
20490 If not otherwise specified by an attribute, assume all calls might be beyond
20491 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20492 function address into a register before performing a (otherwise direct) call.
20493 This is the default.
20494
20495 @item -mshort-calls
20496 @opindex short-calls
20497 If not otherwise specified by an attribute, assume all direct calls are
20498 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20499 for direct calls. The default is @option{-mlong-calls}.
20500
20501 @item -msmall16
20502 @opindex msmall16
20503 Assume addresses can be loaded as 16-bit unsigned values. This does not
20504 apply to function addresses for which @option{-mlong-calls} semantics
20505 are in effect.
20506
20507 @item -mfp-mode=@var{mode}
20508 @opindex mfp-mode
20509 Set the prevailing mode of the floating-point unit.
20510 This determines the floating-point mode that is provided and expected
20511 at function call and return time. Making this mode match the mode you
20512 predominantly need at function start can make your programs smaller and
20513 faster by avoiding unnecessary mode switches.
20514
20515 @var{mode} can be set to one the following values:
20516
20517 @table @samp
20518 @item caller
20519 Any mode at function entry is valid, and retained or restored when
20520 the function returns, and when it calls other functions.
20521 This mode is useful for compiling libraries or other compilation units
20522 you might want to incorporate into different programs with different
20523 prevailing FPU modes, and the convenience of being able to use a single
20524 object file outweighs the size and speed overhead for any extra
20525 mode switching that might be needed, compared with what would be needed
20526 with a more specific choice of prevailing FPU mode.
20527
20528 @item truncate
20529 This is the mode used for floating-point calculations with
20530 truncating (i.e.@: round towards zero) rounding mode. That includes
20531 conversion from floating point to integer.
20532
20533 @item round-nearest
20534 This is the mode used for floating-point calculations with
20535 round-to-nearest-or-even rounding mode.
20536
20537 @item int
20538 This is the mode used to perform integer calculations in the FPU, e.g.@:
20539 integer multiply, or integer multiply-and-accumulate.
20540 @end table
20541
20542 The default is @option{-mfp-mode=caller}
20543
20544 @item -mno-split-lohi
20545 @itemx -mno-postinc
20546 @itemx -mno-postmodify
20547 @opindex mno-split-lohi
20548 @opindex msplit-lohi
20549 @opindex mno-postinc
20550 @opindex mpostinc
20551 @opindex mno-postmodify
20552 @opindex mpostmodify
20553 Code generation tweaks that disable, respectively, splitting of 32-bit
20554 loads, generation of post-increment addresses, and generation of
20555 post-modify addresses. The defaults are @option{msplit-lohi},
20556 @option{-mpost-inc}, and @option{-mpost-modify}.
20557
20558 @item -mnovect-double
20559 @opindex mno-vect-double
20560 @opindex mvect-double
20561 Change the preferred SIMD mode to SImode. The default is
20562 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
20563
20564 @item -max-vect-align=@var{num}
20565 @opindex max-vect-align
20566 The maximum alignment for SIMD vector mode types.
20567 @var{num} may be 4 or 8. The default is 8.
20568 Note that this is an ABI change, even though many library function
20569 interfaces are unaffected if they don't use SIMD vector modes
20570 in places that affect size and/or alignment of relevant types.
20571
20572 @item -msplit-vecmove-early
20573 @opindex msplit-vecmove-early
20574 Split vector moves into single word moves before reload. In theory this
20575 can give better register allocation, but so far the reverse seems to be
20576 generally the case.
20577
20578 @item -m1reg-@var{reg}
20579 @opindex m1reg-
20580 Specify a register to hold the constant @minus{}1, which makes loading small negative
20581 constants and certain bitmasks faster.
20582 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
20583 which specify use of that register as a fixed register,
20584 and @samp{none}, which means that no register is used for this
20585 purpose. The default is @option{-m1reg-none}.
20586
20587 @end table
20588
20589 @node AMD GCN Options
20590 @subsection AMD GCN Options
20591 @cindex AMD GCN Options
20592
20593 These options are defined specifically for the AMD GCN port.
20594
20595 @table @gcctabopt
20596
20597 @item -march=@var{gpu}
20598 @opindex march
20599 @itemx -mtune=@var{gpu}
20600 @opindex mtune
20601 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
20602 are
20603
20604 @table @samp
20605 @item fiji
20606 Compile for GCN3 Fiji devices (gfx803).
20607
20608 @item gfx900
20609 Compile for GCN5 Vega 10 devices (gfx900).
20610
20611 @item gfx906
20612 Compile for GCN5 Vega 20 devices (gfx906).
20613
20614 @item gfx908
20615 Compile for CDNA1 Instinct MI100 series devices (gfx908).
20616
20617 @item gfx90a
20618 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
20619
20620 @end table
20621
20622 @item -msram-ecc=on
20623 @itemx -msram-ecc=off
20624 @itemx -msram-ecc=any
20625 @opindex msram-ecc
20626 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
20627 disabled, or either mode. This feature can be enabled per-process on some
20628 devices. The compiled code must match the device mode. The default is
20629 @samp{any}, for devices that support it.
20630
20631 @item -mstack-size=@var{bytes}
20632 @opindex mstack-size
20633 Specify how many @var{bytes} of stack space will be requested for each GPU
20634 thread (wave-front). Beware that there may be many threads and limited memory
20635 available. The size of the stack allocation may also have an impact on
20636 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
20637 1MB otherwise.
20638
20639 @item -mxnack
20640 @opindex mxnack
20641 Compile binaries suitable for devices with the XNACK feature enabled. Some
20642 devices always require XNACK and some allow the user to configure XNACK. The
20643 compiled code must match the device mode. The default is @samp{-mno-xnack}.
20644 At present this option is a placeholder for support that is not yet
20645 implemented.
20646
20647 @end table
20648
20649 @node ARC Options
20650 @subsection ARC Options
20651 @cindex ARC options
20652
20653 The following options control the architecture variant for which code
20654 is being compiled:
20655
20656 @c architecture variants
20657 @table @gcctabopt
20658
20659 @item -mbarrel-shifter
20660 @opindex mbarrel-shifter
20661 Generate instructions supported by barrel shifter. This is the default
20662 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
20663
20664 @item -mjli-always
20665 @opindex mjli-always
20666 Force to call a function using jli_s instruction. This option is
20667 valid only for ARCv2 architecture.
20668
20669 @item -mcpu=@var{cpu}
20670 @opindex mcpu
20671 Set architecture type, register usage, and instruction scheduling
20672 parameters for @var{cpu}. There are also shortcut alias options
20673 available for backward compatibility and convenience. Supported
20674 values for @var{cpu} are
20675
20676 @table @samp
20677 @opindex mA6
20678 @opindex mARC600
20679 @item arc600
20680 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
20681
20682 @item arc601
20683 @opindex mARC601
20684 Compile for ARC601. Alias: @option{-mARC601}.
20685
20686 @item arc700
20687 @opindex mA7
20688 @opindex mARC700
20689 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
20690 This is the default when configured with @option{--with-cpu=arc700}@.
20691
20692 @item arcem
20693 Compile for ARC EM.
20694
20695 @item archs
20696 Compile for ARC HS.
20697
20698 @item em
20699 Compile for ARC EM CPU with no hardware extensions.
20700
20701 @item em4
20702 Compile for ARC EM4 CPU.
20703
20704 @item em4_dmips
20705 Compile for ARC EM4 DMIPS CPU.
20706
20707 @item em4_fpus
20708 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
20709 extension.
20710
20711 @item em4_fpuda
20712 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
20713 double assist instructions.
20714
20715 @item hs
20716 Compile for ARC HS CPU with no hardware extensions except the atomic
20717 instructions.
20718
20719 @item hs34
20720 Compile for ARC HS34 CPU.
20721
20722 @item hs38
20723 Compile for ARC HS38 CPU.
20724
20725 @item hs38_linux
20726 Compile for ARC HS38 CPU with all hardware extensions on.
20727
20728 @item hs4x
20729 Compile for ARC HS4x CPU.
20730
20731 @item hs4xd
20732 Compile for ARC HS4xD CPU.
20733
20734 @item hs4x_rel31
20735 Compile for ARC HS4x CPU release 3.10a.
20736
20737 @item arc600_norm
20738 Compile for ARC 600 CPU with @code{norm} instructions enabled.
20739
20740 @item arc600_mul32x16
20741 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
20742 instructions enabled.
20743
20744 @item arc600_mul64
20745 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
20746 instructions enabled.
20747
20748 @item arc601_norm
20749 Compile for ARC 601 CPU with @code{norm} instructions enabled.
20750
20751 @item arc601_mul32x16
20752 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
20753 instructions enabled.
20754
20755 @item arc601_mul64
20756 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
20757 instructions enabled.
20758
20759 @item nps400
20760 Compile for ARC 700 on NPS400 chip.
20761
20762 @item em_mini
20763 Compile for ARC EM minimalist configuration featuring reduced register
20764 set.
20765
20766 @end table
20767
20768 @item -mdpfp
20769 @opindex mdpfp
20770 @itemx -mdpfp-compact
20771 @opindex mdpfp-compact
20772 Generate double-precision FPX instructions, tuned for the compact
20773 implementation.
20774
20775 @item -mdpfp-fast
20776 @opindex mdpfp-fast
20777 Generate double-precision FPX instructions, tuned for the fast
20778 implementation.
20779
20780 @item -mno-dpfp-lrsr
20781 @opindex mno-dpfp-lrsr
20782 Disable @code{lr} and @code{sr} instructions from using FPX extension
20783 aux registers.
20784
20785 @item -mea
20786 @opindex mea
20787 Generate extended arithmetic instructions. Currently only
20788 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
20789 supported. Only valid for @option{-mcpu=ARC700}.
20790
20791 @item -mno-mpy
20792 @opindex mno-mpy
20793 @opindex mmpy
20794 Do not generate @code{mpy}-family instructions for ARC700. This option is
20795 deprecated.
20796
20797 @item -mmul32x16
20798 @opindex mmul32x16
20799 Generate 32x16-bit multiply and multiply-accumulate instructions.
20800
20801 @item -mmul64
20802 @opindex mmul64
20803 Generate @code{mul64} and @code{mulu64} instructions.
20804 Only valid for @option{-mcpu=ARC600}.
20805
20806 @item -mnorm
20807 @opindex mnorm
20808 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
20809 is in effect.
20810
20811 @item -mspfp
20812 @opindex mspfp
20813 @itemx -mspfp-compact
20814 @opindex mspfp-compact
20815 Generate single-precision FPX instructions, tuned for the compact
20816 implementation.
20817
20818 @item -mspfp-fast
20819 @opindex mspfp-fast
20820 Generate single-precision FPX instructions, tuned for the fast
20821 implementation.
20822
20823 @item -msimd
20824 @opindex msimd
20825 Enable generation of ARC SIMD instructions via target-specific
20826 builtins. Only valid for @option{-mcpu=ARC700}.
20827
20828 @item -msoft-float
20829 @opindex msoft-float
20830 This option ignored; it is provided for compatibility purposes only.
20831 Software floating-point code is emitted by default, and this default
20832 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
20833 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
20834 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
20835
20836 @item -mswap
20837 @opindex mswap
20838 Generate @code{swap} instructions.
20839
20840 @item -matomic
20841 @opindex matomic
20842 This enables use of the locked load/store conditional extension to implement
20843 atomic memory built-in functions. Not available for ARC 6xx or ARC
20844 EM cores.
20845
20846 @item -mdiv-rem
20847 @opindex mdiv-rem
20848 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
20849
20850 @item -mcode-density
20851 @opindex mcode-density
20852 Enable code density instructions for ARC EM.
20853 This option is on by default for ARC HS.
20854
20855 @item -mll64
20856 @opindex mll64
20857 Enable double load/store operations for ARC HS cores.
20858
20859 @item -mtp-regno=@var{regno}
20860 @opindex mtp-regno
20861 Specify thread pointer register number.
20862
20863 @item -mmpy-option=@var{multo}
20864 @opindex mmpy-option
20865 Compile ARCv2 code with a multiplier design option. You can specify
20866 the option using either a string or numeric value for @var{multo}.
20867 @samp{wlh1} is the default value. The recognized values are:
20868
20869 @table @samp
20870 @item 0
20871 @itemx none
20872 No multiplier available.
20873
20874 @item 1
20875 @itemx w
20876 16x16 multiplier, fully pipelined.
20877 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
20878
20879 @item 2
20880 @itemx wlh1
20881 32x32 multiplier, fully
20882 pipelined (1 stage). The following instructions are additionally
20883 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20884
20885 @item 3
20886 @itemx wlh2
20887 32x32 multiplier, fully pipelined
20888 (2 stages). The following instructions are additionally enabled: @code{mpy},
20889 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20890
20891 @item 4
20892 @itemx wlh3
20893 Two 16x16 multipliers, blocking,
20894 sequential. The following instructions are additionally enabled: @code{mpy},
20895 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20896
20897 @item 5
20898 @itemx wlh4
20899 One 16x16 multiplier, blocking,
20900 sequential. The following instructions are additionally enabled: @code{mpy},
20901 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20902
20903 @item 6
20904 @itemx wlh5
20905 One 32x4 multiplier, blocking,
20906 sequential. The following instructions are additionally enabled: @code{mpy},
20907 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20908
20909 @item 7
20910 @itemx plus_dmpy
20911 ARC HS SIMD support.
20912
20913 @item 8
20914 @itemx plus_macd
20915 ARC HS SIMD support.
20916
20917 @item 9
20918 @itemx plus_qmacw
20919 ARC HS SIMD support.
20920
20921 @end table
20922
20923 This option is only available for ARCv2 cores@.
20924
20925 @item -mfpu=@var{fpu}
20926 @opindex mfpu
20927 Enables support for specific floating-point hardware extensions for ARCv2
20928 cores. Supported values for @var{fpu} are:
20929
20930 @table @samp
20931
20932 @item fpus
20933 Enables support for single-precision floating-point hardware
20934 extensions@.
20935
20936 @item fpud
20937 Enables support for double-precision floating-point hardware
20938 extensions. The single-precision floating-point extension is also
20939 enabled. Not available for ARC EM@.
20940
20941 @item fpuda
20942 Enables support for double-precision floating-point hardware
20943 extensions using double-precision assist instructions. The single-precision
20944 floating-point extension is also enabled. This option is
20945 only available for ARC EM@.
20946
20947 @item fpuda_div
20948 Enables support for double-precision floating-point hardware
20949 extensions using double-precision assist instructions.
20950 The single-precision floating-point, square-root, and divide
20951 extensions are also enabled. This option is
20952 only available for ARC EM@.
20953
20954 @item fpuda_fma
20955 Enables support for double-precision floating-point hardware
20956 extensions using double-precision assist instructions.
20957 The single-precision floating-point and fused multiply and add
20958 hardware extensions are also enabled. This option is
20959 only available for ARC EM@.
20960
20961 @item fpuda_all
20962 Enables support for double-precision floating-point hardware
20963 extensions using double-precision assist instructions.
20964 All single-precision floating-point hardware extensions are also
20965 enabled. This option is only available for ARC EM@.
20966
20967 @item fpus_div
20968 Enables support for single-precision floating-point, square-root and divide
20969 hardware extensions@.
20970
20971 @item fpud_div
20972 Enables support for double-precision floating-point, square-root and divide
20973 hardware extensions. This option
20974 includes option @samp{fpus_div}. Not available for ARC EM@.
20975
20976 @item fpus_fma
20977 Enables support for single-precision floating-point and
20978 fused multiply and add hardware extensions@.
20979
20980 @item fpud_fma
20981 Enables support for double-precision floating-point and
20982 fused multiply and add hardware extensions. This option
20983 includes option @samp{fpus_fma}. Not available for ARC EM@.
20984
20985 @item fpus_all
20986 Enables support for all single-precision floating-point hardware
20987 extensions@.
20988
20989 @item fpud_all
20990 Enables support for all single- and double-precision floating-point
20991 hardware extensions. Not available for ARC EM@.
20992
20993 @end table
20994
20995 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
20996 @opindex mirq-ctrl-saved
20997 Specifies general-purposes registers that the processor automatically
20998 saves/restores on interrupt entry and exit. @var{register-range} is
20999 specified as two registers separated by a dash. The register range
21000 always starts with @code{r0}, the upper limit is @code{fp} register.
21001 @var{blink} and @var{lp_count} are optional. This option is only
21002 valid for ARC EM and ARC HS cores.
21003
21004 @item -mrgf-banked-regs=@var{number}
21005 @opindex mrgf-banked-regs
21006 Specifies the number of registers replicated in second register bank
21007 on entry to fast interrupt. Fast interrupts are interrupts with the
21008 highest priority level P0. These interrupts save only PC and STATUS32
21009 registers to avoid memory transactions during interrupt entry and exit
21010 sequences. Use this option when you are using fast interrupts in an
21011 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
21012
21013 @item -mlpc-width=@var{width}
21014 @opindex mlpc-width
21015 Specify the width of the @code{lp_count} register. Valid values for
21016 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
21017 fixed to 32 bits. If the width is less than 32, the compiler does not
21018 attempt to transform loops in your program to use the zero-delay loop
21019 mechanism unless it is known that the @code{lp_count} register can
21020 hold the required loop-counter value. Depending on the width
21021 specified, the compiler and run-time library might continue to use the
21022 loop mechanism for various needs. This option defines macro
21023 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21024
21025 @item -mrf16
21026 @opindex mrf16
21027 This option instructs the compiler to generate code for a 16-entry
21028 register file. This option defines the @code{__ARC_RF16__}
21029 preprocessor macro.
21030
21031 @item -mbranch-index
21032 @opindex mbranch-index
21033 Enable use of @code{bi} or @code{bih} instructions to implement jump
21034 tables.
21035
21036 @end table
21037
21038 The following options are passed through to the assembler, and also
21039 define preprocessor macro symbols.
21040
21041 @c Flags used by the assembler, but for which we define preprocessor
21042 @c macro symbols as well.
21043 @table @gcctabopt
21044 @item -mdsp-packa
21045 @opindex mdsp-packa
21046 Passed down to the assembler to enable the DSP Pack A extensions.
21047 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
21048 deprecated.
21049
21050 @item -mdvbf
21051 @opindex mdvbf
21052 Passed down to the assembler to enable the dual Viterbi butterfly
21053 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
21054 option is deprecated.
21055
21056 @c ARC700 4.10 extension instruction
21057 @item -mlock
21058 @opindex mlock
21059 Passed down to the assembler to enable the locked load/store
21060 conditional extension. Also sets the preprocessor symbol
21061 @code{__Xlock}.
21062
21063 @item -mmac-d16
21064 @opindex mmac-d16
21065 Passed down to the assembler. Also sets the preprocessor symbol
21066 @code{__Xxmac_d16}. This option is deprecated.
21067
21068 @item -mmac-24
21069 @opindex mmac-24
21070 Passed down to the assembler. Also sets the preprocessor symbol
21071 @code{__Xxmac_24}. This option is deprecated.
21072
21073 @c ARC700 4.10 extension instruction
21074 @item -mrtsc
21075 @opindex mrtsc
21076 Passed down to the assembler to enable the 64-bit time-stamp counter
21077 extension instruction. Also sets the preprocessor symbol
21078 @code{__Xrtsc}. This option is deprecated.
21079
21080 @c ARC700 4.10 extension instruction
21081 @item -mswape
21082 @opindex mswape
21083 Passed down to the assembler to enable the swap byte ordering
21084 extension instruction. Also sets the preprocessor symbol
21085 @code{__Xswape}.
21086
21087 @item -mtelephony
21088 @opindex mtelephony
21089 Passed down to the assembler to enable dual- and single-operand
21090 instructions for telephony. Also sets the preprocessor symbol
21091 @code{__Xtelephony}. This option is deprecated.
21092
21093 @item -mxy
21094 @opindex mxy
21095 Passed down to the assembler to enable the XY memory extension. Also
21096 sets the preprocessor symbol @code{__Xxy}.
21097
21098 @end table
21099
21100 The following options control how the assembly code is annotated:
21101
21102 @c Assembly annotation options
21103 @table @gcctabopt
21104 @item -misize
21105 @opindex misize
21106 Annotate assembler instructions with estimated addresses.
21107
21108 @item -mannotate-align
21109 @opindex mannotate-align
21110 Explain what alignment considerations lead to the decision to make an
21111 instruction short or long.
21112
21113 @end table
21114
21115 The following options are passed through to the linker:
21116
21117 @c options passed through to the linker
21118 @table @gcctabopt
21119 @item -marclinux
21120 @opindex marclinux
21121 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21122 This option is enabled by default in tool chains built for
21123 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21124 when profiling is not requested.
21125
21126 @item -marclinux_prof
21127 @opindex marclinux_prof
21128 Passed through to the linker, to specify use of the
21129 @code{arclinux_prof} emulation. This option is enabled by default in
21130 tool chains built for @w{@code{arc-linux-uclibc}} and
21131 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21132
21133 @end table
21134
21135 The following options control the semantics of generated code:
21136
21137 @c semantically relevant code generation options
21138 @table @gcctabopt
21139 @item -mlong-calls
21140 @opindex mlong-calls
21141 Generate calls as register indirect calls, thus providing access
21142 to the full 32-bit address range.
21143
21144 @item -mmedium-calls
21145 @opindex mmedium-calls
21146 Don't use less than 25-bit addressing range for calls, which is the
21147 offset available for an unconditional branch-and-link
21148 instruction. Conditional execution of function calls is suppressed, to
21149 allow use of the 25-bit range, rather than the 21-bit range with
21150 conditional branch-and-link. This is the default for tool chains built
21151 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21152
21153 @item -G @var{num}
21154 @opindex G
21155 Put definitions of externally-visible data in a small data section if
21156 that data is no bigger than @var{num} bytes. The default value of
21157 @var{num} is 4 for any ARC configuration, or 8 when we have double
21158 load/store operations.
21159
21160 @item -mno-sdata
21161 @opindex mno-sdata
21162 @opindex msdata
21163 Do not generate sdata references. This is the default for tool chains
21164 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21165 targets.
21166
21167 @item -mvolatile-cache
21168 @opindex mvolatile-cache
21169 Use ordinarily cached memory accesses for volatile references. This is the
21170 default.
21171
21172 @item -mno-volatile-cache
21173 @opindex mno-volatile-cache
21174 @opindex mvolatile-cache
21175 Enable cache bypass for volatile references.
21176
21177 @end table
21178
21179 The following options fine tune code generation:
21180 @c code generation tuning options
21181 @table @gcctabopt
21182 @item -malign-call
21183 @opindex malign-call
21184 Does nothing. Preserved for backward compatibility.
21185
21186 @item -mauto-modify-reg
21187 @opindex mauto-modify-reg
21188 Enable the use of pre/post modify with register displacement.
21189
21190 @item -mbbit-peephole
21191 @opindex mbbit-peephole
21192 Enable bbit peephole2.
21193
21194 @item -mno-brcc
21195 @opindex mno-brcc
21196 This option disables a target-specific pass in @file{arc_reorg} to
21197 generate compare-and-branch (@code{br@var{cc}}) instructions.
21198 It has no effect on
21199 generation of these instructions driven by the combiner pass.
21200
21201 @item -mcase-vector-pcrel
21202 @opindex mcase-vector-pcrel
21203 Use PC-relative switch case tables to enable case table shortening.
21204 This is the default for @option{-Os}.
21205
21206 @item -mcompact-casesi
21207 @opindex mcompact-casesi
21208 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
21209 and only available for ARCv1 cores. This option is deprecated.
21210
21211 @item -mno-cond-exec
21212 @opindex mno-cond-exec
21213 Disable the ARCompact-specific pass to generate conditional
21214 execution instructions.
21215
21216 Due to delay slot scheduling and interactions between operand numbers,
21217 literal sizes, instruction lengths, and the support for conditional execution,
21218 the target-independent pass to generate conditional execution is often lacking,
21219 so the ARC port has kept a special pass around that tries to find more
21220 conditional execution generation opportunities after register allocation,
21221 branch shortening, and delay slot scheduling have been done. This pass
21222 generally, but not always, improves performance and code size, at the cost of
21223 extra compilation time, which is why there is an option to switch it off.
21224 If you have a problem with call instructions exceeding their allowable
21225 offset range because they are conditionalized, you should consider using
21226 @option{-mmedium-calls} instead.
21227
21228 @item -mearly-cbranchsi
21229 @opindex mearly-cbranchsi
21230 Enable pre-reload use of the @code{cbranchsi} pattern.
21231
21232 @item -mexpand-adddi
21233 @opindex mexpand-adddi
21234 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21235 @code{add.f}, @code{adc} etc. This option is deprecated.
21236
21237 @item -mindexed-loads
21238 @opindex mindexed-loads
21239 Enable the use of indexed loads. This can be problematic because some
21240 optimizers then assume that indexed stores exist, which is not
21241 the case.
21242
21243 @item -mlra
21244 @opindex mlra
21245 Enable Local Register Allocation. This is still experimental for ARC,
21246 so by default the compiler uses standard reload
21247 (i.e.@: @option{-mno-lra}).
21248
21249 @item -mlra-priority-none
21250 @opindex mlra-priority-none
21251 Don't indicate any priority for target registers.
21252
21253 @item -mlra-priority-compact
21254 @opindex mlra-priority-compact
21255 Indicate target register priority for r0..r3 / r12..r15.
21256
21257 @item -mlra-priority-noncompact
21258 @opindex mlra-priority-noncompact
21259 Reduce target register priority for r0..r3 / r12..r15.
21260
21261 @item -mmillicode
21262 @opindex mmillicode
21263 When optimizing for size (using @option{-Os}), prologues and epilogues
21264 that have to save or restore a large number of registers are often
21265 shortened by using call to a special function in libgcc; this is
21266 referred to as a @emph{millicode} call. As these calls can pose
21267 performance issues, and/or cause linking issues when linking in a
21268 nonstandard way, this option is provided to turn on or off millicode
21269 call generation.
21270
21271 @item -mcode-density-frame
21272 @opindex mcode-density-frame
21273 This option enable the compiler to emit @code{enter} and @code{leave}
21274 instructions. These instructions are only valid for CPUs with
21275 code-density feature.
21276
21277 @item -mmixed-code
21278 @opindex mmixed-code
21279 Does nothing. Preserved for backward compatibility.
21280
21281 @item -mq-class
21282 @opindex mq-class
21283 Ths option is deprecated. Enable @samp{q} instruction alternatives.
21284 This is the default for @option{-Os}.
21285
21286 @item -mRcq
21287 @opindex mRcq
21288 Does nothing. Preserved for backward compatibility.
21289
21290 @item -mRcw
21291 @opindex mRcw
21292 Does nothing. Preserved for backward compatibility.
21293
21294 @item -msize-level=@var{level}
21295 @opindex msize-level
21296 Fine-tune size optimization with regards to instruction lengths and alignment.
21297 The recognized values for @var{level} are:
21298 @table @samp
21299 @item 0
21300 No size optimization. This level is deprecated and treated like @samp{1}.
21301
21302 @item 1
21303 Short instructions are used opportunistically.
21304
21305 @item 2
21306 In addition, alignment of loops and of code after barriers are dropped.
21307
21308 @item 3
21309 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21310
21311 @end table
21312
21313 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
21314 the behavior when this is not set is equivalent to level @samp{1}.
21315
21316 @item -mtune=@var{cpu}
21317 @opindex mtune
21318 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21319 by @option{-mcpu=}.
21320
21321 Supported values for @var{cpu} are
21322
21323 @table @samp
21324 @item ARC600
21325 Tune for ARC600 CPU.
21326
21327 @item ARC601
21328 Tune for ARC601 CPU.
21329
21330 @item ARC700
21331 Tune for ARC700 CPU with standard multiplier block.
21332
21333 @item ARC700-xmac
21334 Tune for ARC700 CPU with XMAC block.
21335
21336 @item ARC725D
21337 Tune for ARC725D CPU.
21338
21339 @item ARC750D
21340 Tune for ARC750D CPU.
21341
21342 @item core3
21343 Tune for ARCv2 core3 type CPU. This option enable usage of
21344 @code{dbnz} instruction.
21345
21346 @item release31a
21347 Tune for ARC4x release 3.10a.
21348
21349 @end table
21350
21351 @item -mmultcost=@var{num}
21352 @opindex mmultcost
21353 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21354 normal instruction.
21355
21356 @item -munalign-prob-threshold=@var{probability}
21357 @opindex munalign-prob-threshold
21358 Does nothing. Preserved for backward compatibility.
21359
21360 @end table
21361
21362 The following options are maintained for backward compatibility, but
21363 are now deprecated and will be removed in a future release:
21364
21365 @c Deprecated options
21366 @table @gcctabopt
21367
21368 @item -margonaut
21369 @opindex margonaut
21370 Obsolete FPX.
21371
21372 @item -mbig-endian
21373 @opindex mbig-endian
21374 @itemx -EB
21375 @opindex EB
21376 Compile code for big-endian targets. Use of these options is now
21377 deprecated. Big-endian code is supported by configuring GCC to build
21378 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21379 for which big endian is the default.
21380
21381 @item -mlittle-endian
21382 @opindex mlittle-endian
21383 @itemx -EL
21384 @opindex EL
21385 Compile code for little-endian targets. Use of these options is now
21386 deprecated. Little-endian code is supported by configuring GCC to build
21387 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21388 for which little endian is the default.
21389
21390 @item -mbarrel_shifter
21391 @opindex mbarrel_shifter
21392 Replaced by @option{-mbarrel-shifter}.
21393
21394 @item -mdpfp_compact
21395 @opindex mdpfp_compact
21396 Replaced by @option{-mdpfp-compact}.
21397
21398 @item -mdpfp_fast
21399 @opindex mdpfp_fast
21400 Replaced by @option{-mdpfp-fast}.
21401
21402 @item -mdsp_packa
21403 @opindex mdsp_packa
21404 Replaced by @option{-mdsp-packa}.
21405
21406 @item -mEA
21407 @opindex mEA
21408 Replaced by @option{-mea}.
21409
21410 @item -mmac_24
21411 @opindex mmac_24
21412 Replaced by @option{-mmac-24}.
21413
21414 @item -mmac_d16
21415 @opindex mmac_d16
21416 Replaced by @option{-mmac-d16}.
21417
21418 @item -mspfp_compact
21419 @opindex mspfp_compact
21420 Replaced by @option{-mspfp-compact}.
21421
21422 @item -mspfp_fast
21423 @opindex mspfp_fast
21424 Replaced by @option{-mspfp-fast}.
21425
21426 @item -mtune=@var{cpu}
21427 @opindex mtune
21428 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21429 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21430 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21431
21432 @item -multcost=@var{num}
21433 @opindex multcost
21434 Replaced by @option{-mmultcost}.
21435
21436 @end table
21437
21438 @node ARM Options
21439 @subsection ARM Options
21440 @cindex ARM options
21441
21442 These @samp{-m} options are defined for the ARM port:
21443
21444 @table @gcctabopt
21445 @item -mabi=@var{name}
21446 @opindex mabi
21447 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
21448 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21449
21450 @item -mapcs-frame
21451 @opindex mapcs-frame
21452 Generate a stack frame that is compliant with the ARM Procedure Call
21453 Standard for all functions, even if this is not strictly necessary for
21454 correct execution of the code. Specifying @option{-fomit-frame-pointer}
21455 with this option causes the stack frames not to be generated for
21456 leaf functions. The default is @option{-mno-apcs-frame}.
21457 This option is deprecated.
21458
21459 @item -mapcs
21460 @opindex mapcs
21461 This is a synonym for @option{-mapcs-frame} and is deprecated.
21462
21463 @ignore
21464 @c not currently implemented
21465 @item -mapcs-stack-check
21466 @opindex mapcs-stack-check
21467 Generate code to check the amount of stack space available upon entry to
21468 every function (that actually uses some stack space). If there is
21469 insufficient space available then either the function
21470 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21471 called, depending upon the amount of stack space required. The runtime
21472 system is required to provide these functions. The default is
21473 @option{-mno-apcs-stack-check}, since this produces smaller code.
21474
21475 @c not currently implemented
21476 @item -mapcs-reentrant
21477 @opindex mapcs-reentrant
21478 Generate reentrant, position-independent code. The default is
21479 @option{-mno-apcs-reentrant}.
21480 @end ignore
21481
21482 @item -mthumb-interwork
21483 @opindex mthumb-interwork
21484 Generate code that supports calling between the ARM and Thumb
21485 instruction sets. Without this option, on pre-v5 architectures, the
21486 two instruction sets cannot be reliably used inside one program. The
21487 default is @option{-mno-thumb-interwork}, since slightly larger code
21488 is generated when @option{-mthumb-interwork} is specified. In AAPCS
21489 configurations this option is meaningless.
21490
21491 @item -mno-sched-prolog
21492 @opindex mno-sched-prolog
21493 @opindex msched-prolog
21494 Prevent the reordering of instructions in the function prologue, or the
21495 merging of those instruction with the instructions in the function's
21496 body. This means that all functions start with a recognizable set
21497 of instructions (or in fact one of a choice from a small set of
21498 different function prologues), and this information can be used to
21499 locate the start of functions inside an executable piece of code. The
21500 default is @option{-msched-prolog}.
21501
21502 @item -mfloat-abi=@var{name}
21503 @opindex mfloat-abi
21504 Specifies which floating-point ABI to use. Permissible values
21505 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21506
21507 Specifying @samp{soft} causes GCC to generate output containing
21508 library calls for floating-point operations.
21509 @samp{softfp} allows the generation of code using hardware floating-point
21510 instructions, but still uses the soft-float calling conventions.
21511 @samp{hard} allows generation of floating-point instructions
21512 and uses FPU-specific calling conventions.
21513
21514 The default depends on the specific target configuration. Note that
21515 the hard-float and soft-float ABIs are not link-compatible; you must
21516 compile your entire program with the same ABI, and link with a
21517 compatible set of libraries.
21518
21519 @item -mgeneral-regs-only
21520 @opindex mgeneral-regs-only
21521 Generate code which uses only the general-purpose registers. This will prevent
21522 the compiler from using floating-point and Advanced SIMD registers but will not
21523 impose any restrictions on the assembler.
21524
21525 @item -mlittle-endian
21526 @opindex mlittle-endian
21527 Generate code for a processor running in little-endian mode. This is
21528 the default for all standard configurations.
21529
21530 @item -mbig-endian
21531 @opindex mbig-endian
21532 Generate code for a processor running in big-endian mode; the default is
21533 to compile code for a little-endian processor.
21534
21535 @item -mbe8
21536 @itemx -mbe32
21537 @opindex mbe8
21538 When linking a big-endian image select between BE8 and BE32 formats.
21539 The option has no effect for little-endian images and is ignored. The
21540 default is dependent on the selected target architecture. For ARMv6
21541 and later architectures the default is BE8, for older architectures
21542 the default is BE32. BE32 format has been deprecated by ARM.
21543
21544 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21545 @opindex march
21546 This specifies the name of the target ARM architecture. GCC uses this
21547 name to determine what kind of instructions it can emit when generating
21548 assembly code. This option can be used in conjunction with or instead
21549 of the @option{-mcpu=} option.
21550
21551 Permissible names are:
21552 @samp{armv4t},
21553 @samp{armv5t}, @samp{armv5te},
21554 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21555 @samp{armv6z}, @samp{armv6zk},
21556 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
21557 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
21558 @samp{armv8.4-a},
21559 @samp{armv8.5-a},
21560 @samp{armv8.6-a},
21561 @samp{armv9-a},
21562 @samp{armv7-r},
21563 @samp{armv8-r},
21564 @samp{armv6-m}, @samp{armv6s-m},
21565 @samp{armv7-m}, @samp{armv7e-m},
21566 @samp{armv8-m.base}, @samp{armv8-m.main},
21567 @samp{armv8.1-m.main},
21568 @samp{armv9-a},
21569 @samp{iwmmxt} and @samp{iwmmxt2}.
21570
21571 Additionally, the following architectures, which lack support for the
21572 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
21573
21574 Many of the architectures support extensions. These can be added by
21575 appending @samp{+@var{extension}} to the architecture name. Extension
21576 options are processed in order and capabilities accumulate. An extension
21577 will also enable any necessary base extensions
21578 upon which it depends. For example, the @samp{+crypto} extension
21579 will always enable the @samp{+simd} extension. The exception to the
21580 additive construction is for extensions that are prefixed with
21581 @samp{+no@dots{}}: these extensions disable the specified option and
21582 any other extensions that may depend on the presence of that
21583 extension.
21584
21585 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
21586 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
21587 entirely disabled by the @samp{+nofp} option that follows it.
21588
21589 Most extension names are generically named, but have an effect that is
21590 dependent upon the architecture to which it is applied. For example,
21591 the @samp{+simd} option can be applied to both @samp{armv7-a} and
21592 @samp{armv8-a} architectures, but will enable the original ARMv7-A
21593 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
21594 variant for @samp{armv8-a}.
21595
21596 The table below lists the supported extensions for each architecture.
21597 Architectures not mentioned do not support any extensions.
21598
21599 @table @samp
21600 @item armv5te
21601 @itemx armv6
21602 @itemx armv6j
21603 @itemx armv6k
21604 @itemx armv6kz
21605 @itemx armv6t2
21606 @itemx armv6z
21607 @itemx armv6zk
21608 @table @samp
21609 @item +fp
21610 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
21611 used as an alias for this extension.
21612
21613 @item +nofp
21614 Disable the floating-point instructions.
21615 @end table
21616
21617 @item armv7
21618 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
21619 @table @samp
21620 @item +fp
21621 The VFPv3 floating-point instructions, with 16 double-precision
21622 registers. The extension @samp{+vfpv3-d16} can be used as an alias
21623 for this extension. Note that floating-point is not supported by the
21624 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
21625 ARMv7-R architectures.
21626
21627 @item +nofp
21628 Disable the floating-point instructions.
21629 @end table
21630
21631 @item armv7-a
21632 @table @samp
21633 @item +mp
21634 The multiprocessing extension.
21635
21636 @item +sec
21637 The security extension.
21638
21639 @item +fp
21640 The VFPv3 floating-point instructions, with 16 double-precision
21641 registers. The extension @samp{+vfpv3-d16} can be used as an alias
21642 for this extension.
21643
21644 @item +simd
21645 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21646 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
21647 for this extension.
21648
21649 @item +vfpv3
21650 The VFPv3 floating-point instructions, with 32 double-precision
21651 registers.
21652
21653 @item +vfpv3-d16-fp16
21654 The VFPv3 floating-point instructions, with 16 double-precision
21655 registers and the half-precision floating-point conversion operations.
21656
21657 @item +vfpv3-fp16
21658 The VFPv3 floating-point instructions, with 32 double-precision
21659 registers and the half-precision floating-point conversion operations.
21660
21661 @item +vfpv4-d16
21662 The VFPv4 floating-point instructions, with 16 double-precision
21663 registers.
21664
21665 @item +vfpv4
21666 The VFPv4 floating-point instructions, with 32 double-precision
21667 registers.
21668
21669 @item +neon-fp16
21670 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21671 the half-precision floating-point conversion operations.
21672
21673 @item +neon-vfpv4
21674 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
21675
21676 @item +nosimd
21677 Disable the Advanced SIMD instructions (does not disable floating point).
21678
21679 @item +nofp
21680 Disable the floating-point and Advanced SIMD instructions.
21681 @end table
21682
21683 @item armv7ve
21684 The extended version of the ARMv7-A architecture with support for
21685 virtualization.
21686 @table @samp
21687 @item +fp
21688 The VFPv4 floating-point instructions, with 16 double-precision registers.
21689 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
21690
21691 @item +simd
21692 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
21693 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
21694
21695 @item +vfpv3-d16
21696 The VFPv3 floating-point instructions, with 16 double-precision
21697 registers.
21698
21699 @item +vfpv3
21700 The VFPv3 floating-point instructions, with 32 double-precision
21701 registers.
21702
21703 @item +vfpv3-d16-fp16
21704 The VFPv3 floating-point instructions, with 16 double-precision
21705 registers and the half-precision floating-point conversion operations.
21706
21707 @item +vfpv3-fp16
21708 The VFPv3 floating-point instructions, with 32 double-precision
21709 registers and the half-precision floating-point conversion operations.
21710
21711 @item +vfpv4-d16
21712 The VFPv4 floating-point instructions, with 16 double-precision
21713 registers.
21714
21715 @item +vfpv4
21716 The VFPv4 floating-point instructions, with 32 double-precision
21717 registers.
21718
21719 @item +neon
21720 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21721 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
21722
21723 @item +neon-fp16
21724 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21725 the half-precision floating-point conversion operations.
21726
21727 @item +nosimd
21728 Disable the Advanced SIMD instructions (does not disable floating point).
21729
21730 @item +nofp
21731 Disable the floating-point and Advanced SIMD instructions.
21732 @end table
21733
21734 @item armv8-a
21735 @table @samp
21736 @item +crc
21737 The Cyclic Redundancy Check (CRC) instructions.
21738 @item +simd
21739 The ARMv8-A Advanced SIMD and floating-point instructions.
21740 @item +crypto
21741 The cryptographic instructions.
21742 @item +nocrypto
21743 Disable the cryptographic instructions.
21744 @item +nofp
21745 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21746 @item +sb
21747 Speculation Barrier Instruction.
21748 @item +predres
21749 Execution and Data Prediction Restriction Instructions.
21750 @end table
21751
21752 @item armv8.1-a
21753 @table @samp
21754 @item +simd
21755 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21756
21757 @item +crypto
21758 The cryptographic instructions. This also enables the Advanced SIMD and
21759 floating-point instructions.
21760
21761 @item +nocrypto
21762 Disable the cryptographic instructions.
21763
21764 @item +nofp
21765 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21766
21767 @item +sb
21768 Speculation Barrier Instruction.
21769
21770 @item +predres
21771 Execution and Data Prediction Restriction Instructions.
21772 @end table
21773
21774 @item armv8.2-a
21775 @itemx armv8.3-a
21776 @table @samp
21777 @item +fp16
21778 The half-precision floating-point data processing instructions.
21779 This also enables the Advanced SIMD and floating-point instructions.
21780
21781 @item +fp16fml
21782 The half-precision floating-point fmla extension. This also enables
21783 the half-precision floating-point extension and Advanced SIMD and
21784 floating-point instructions.
21785
21786 @item +simd
21787 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21788
21789 @item +crypto
21790 The cryptographic instructions. This also enables the Advanced SIMD and
21791 floating-point instructions.
21792
21793 @item +dotprod
21794 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
21795
21796 @item +nocrypto
21797 Disable the cryptographic extension.
21798
21799 @item +nofp
21800 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21801
21802 @item +sb
21803 Speculation Barrier Instruction.
21804
21805 @item +predres
21806 Execution and Data Prediction Restriction Instructions.
21807
21808 @item +i8mm
21809 8-bit Integer Matrix Multiply instructions.
21810 This also enables Advanced SIMD and floating-point instructions.
21811
21812 @item +bf16
21813 Brain half-precision floating-point instructions.
21814 This also enables Advanced SIMD and floating-point instructions.
21815 @end table
21816
21817 @item armv8.4-a
21818 @table @samp
21819 @item +fp16
21820 The half-precision floating-point data processing instructions.
21821 This also enables the Advanced SIMD and floating-point instructions as well
21822 as the Dot Product extension and the half-precision floating-point fmla
21823 extension.
21824
21825 @item +simd
21826 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21827 Dot Product extension.
21828
21829 @item +crypto
21830 The cryptographic instructions. This also enables the Advanced SIMD and
21831 floating-point instructions as well as the Dot Product extension.
21832
21833 @item +nocrypto
21834 Disable the cryptographic extension.
21835
21836 @item +nofp
21837 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21838
21839 @item +sb
21840 Speculation Barrier Instruction.
21841
21842 @item +predres
21843 Execution and Data Prediction Restriction Instructions.
21844
21845 @item +i8mm
21846 8-bit Integer Matrix Multiply instructions.
21847 This also enables Advanced SIMD and floating-point instructions.
21848
21849 @item +bf16
21850 Brain half-precision floating-point instructions.
21851 This also enables Advanced SIMD and floating-point instructions.
21852 @end table
21853
21854 @item armv8.5-a
21855 @table @samp
21856 @item +fp16
21857 The half-precision floating-point data processing instructions.
21858 This also enables the Advanced SIMD and floating-point instructions as well
21859 as the Dot Product extension and the half-precision floating-point fmla
21860 extension.
21861
21862 @item +simd
21863 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21864 Dot Product extension.
21865
21866 @item +crypto
21867 The cryptographic instructions. This also enables the Advanced SIMD and
21868 floating-point instructions as well as the Dot Product extension.
21869
21870 @item +nocrypto
21871 Disable the cryptographic extension.
21872
21873 @item +nofp
21874 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21875
21876 @item +i8mm
21877 8-bit Integer Matrix Multiply instructions.
21878 This also enables Advanced SIMD and floating-point instructions.
21879
21880 @item +bf16
21881 Brain half-precision floating-point instructions.
21882 This also enables Advanced SIMD and floating-point instructions.
21883 @end table
21884
21885 @item armv8.6-a
21886 @table @samp
21887 @item +fp16
21888 The half-precision floating-point data processing instructions.
21889 This also enables the Advanced SIMD and floating-point instructions as well
21890 as the Dot Product extension and the half-precision floating-point fmla
21891 extension.
21892
21893 @item +simd
21894 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21895 Dot Product extension.
21896
21897 @item +crypto
21898 The cryptographic instructions. This also enables the Advanced SIMD and
21899 floating-point instructions as well as the Dot Product extension.
21900
21901 @item +nocrypto
21902 Disable the cryptographic extension.
21903
21904 @item +nofp
21905 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21906
21907 @item +i8mm
21908 8-bit Integer Matrix Multiply instructions.
21909 This also enables Advanced SIMD and floating-point instructions.
21910
21911 @item +bf16
21912 Brain half-precision floating-point instructions.
21913 This also enables Advanced SIMD and floating-point instructions.
21914 @end table
21915
21916 @item armv7-r
21917 @table @samp
21918 @item +fp.sp
21919 The single-precision VFPv3 floating-point instructions. The extension
21920 @samp{+vfpv3xd} can be used as an alias for this extension.
21921
21922 @item +fp
21923 The VFPv3 floating-point instructions with 16 double-precision registers.
21924 The extension +vfpv3-d16 can be used as an alias for this extension.
21925
21926 @item +vfpv3xd-d16-fp16
21927 The single-precision VFPv3 floating-point instructions with 16 double-precision
21928 registers and the half-precision floating-point conversion operations.
21929
21930 @item +vfpv3-d16-fp16
21931 The VFPv3 floating-point instructions with 16 double-precision
21932 registers and the half-precision floating-point conversion operations.
21933
21934 @item +nofp
21935 Disable the floating-point extension.
21936
21937 @item +idiv
21938 The ARM-state integer division instructions.
21939
21940 @item +noidiv
21941 Disable the ARM-state integer division extension.
21942 @end table
21943
21944 @item armv7e-m
21945 @table @samp
21946 @item +fp
21947 The single-precision VFPv4 floating-point instructions.
21948
21949 @item +fpv5
21950 The single-precision FPv5 floating-point instructions.
21951
21952 @item +fp.dp
21953 The single- and double-precision FPv5 floating-point instructions.
21954
21955 @item +nofp
21956 Disable the floating-point extensions.
21957 @end table
21958
21959 @item armv8.1-m.main
21960 @table @samp
21961
21962 @item +dsp
21963 The DSP instructions.
21964
21965 @item +mve
21966 The M-Profile Vector Extension (MVE) integer instructions.
21967
21968 @item +mve.fp
21969 The M-Profile Vector Extension (MVE) integer and single precision
21970 floating-point instructions.
21971
21972 @item +fp
21973 The single-precision floating-point instructions.
21974
21975 @item +fp.dp
21976 The single- and double-precision floating-point instructions.
21977
21978 @item +nofp
21979 Disable the floating-point extension.
21980
21981 @item +cdecp0, +cdecp1, ... , +cdecp7
21982 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
21983 to the numbers given in the options in the range 0 to 7.
21984 @end table
21985
21986 @item armv8-m.main
21987 @table @samp
21988 @item +dsp
21989 The DSP instructions.
21990
21991 @item +nodsp
21992 Disable the DSP extension.
21993
21994 @item +fp
21995 The single-precision floating-point instructions.
21996
21997 @item +fp.dp
21998 The single- and double-precision floating-point instructions.
21999
22000 @item +nofp
22001 Disable the floating-point extension.
22002
22003 @item +cdecp0, +cdecp1, ... , +cdecp7
22004 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22005 to the numbers given in the options in the range 0 to 7.
22006 @end table
22007
22008 @item armv8-r
22009 @table @samp
22010 @item +crc
22011 The Cyclic Redundancy Check (CRC) instructions.
22012 @item +fp.sp
22013 The single-precision FPv5 floating-point instructions.
22014 @item +simd
22015 The ARMv8-A Advanced SIMD and floating-point instructions.
22016 @item +crypto
22017 The cryptographic instructions.
22018 @item +nocrypto
22019 Disable the cryptographic instructions.
22020 @item +nofp
22021 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22022 @end table
22023
22024 @end table
22025
22026 @option{-march=native} causes the compiler to auto-detect the architecture
22027 of the build computer. At present, this feature is only supported on
22028 GNU/Linux, and not all architectures are recognized. If the auto-detect
22029 is unsuccessful the option has no effect.
22030
22031 @item -mtune=@var{name}
22032 @opindex mtune
22033 This option specifies the name of the target ARM processor for
22034 which GCC should tune the performance of the code.
22035 For some ARM implementations better performance can be obtained by using
22036 this option.
22037 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22038 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22039 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22040 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22041 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22042 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22043 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22044 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22045 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22046 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22047 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22048 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22049 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22050 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22051 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22052 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22053 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22054 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22055 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22056 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1}, @samp{cortex-x1c},
22057 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22058 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22059 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22060 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22061 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22062 @samp{xgene1}.
22063
22064 Additionally, this option can specify that GCC should tune the performance
22065 of the code for a big.LITTLE system. Permissible names are:
22066 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22067 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22068 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22069 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22070
22071 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22072 performance for a blend of processors within architecture @var{arch}.
22073 The aim is to generate code that run well on the current most popular
22074 processors, balancing between optimizations that benefit some CPUs in the
22075 range, and avoiding performance pitfalls of other CPUs. The effects of
22076 this option may change in future GCC versions as CPU models come and go.
22077
22078 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22079 the extension options do not affect the tuning of the generated code.
22080
22081 @option{-mtune=native} causes the compiler to auto-detect the CPU
22082 of the build computer. At present, this feature is only supported on
22083 GNU/Linux, and not all architectures are recognized. If the auto-detect is
22084 unsuccessful the option has no effect.
22085
22086 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22087 @opindex mcpu
22088 This specifies the name of the target ARM processor. GCC uses this name
22089 to derive the name of the target ARM architecture (as if specified
22090 by @option{-march}) and the ARM processor type for which to tune for
22091 performance (as if specified by @option{-mtune}). Where this option
22092 is used in conjunction with @option{-march} or @option{-mtune},
22093 those options take precedence over the appropriate part of this option.
22094
22095 Many of the supported CPUs implement optional architectural
22096 extensions. Where this is so the architectural extensions are
22097 normally enabled by default. If implementations that lack the
22098 extension exist, then the extension syntax can be used to disable
22099 those extensions that have been omitted. For floating-point and
22100 Advanced SIMD (Neon) instructions, the settings of the options
22101 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22102 floating-point and Advanced SIMD instructions will only be used if
22103 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22104 @option{-mfpu} other than @samp{auto} will override the available
22105 floating-point and SIMD extension instructions.
22106
22107 For example, @samp{cortex-a9} can be found in three major
22108 configurations: integer only, with just a floating-point unit or with
22109 floating-point and Advanced SIMD. The default is to enable all the
22110 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22111 be used to disable just the SIMD or both the SIMD and floating-point
22112 instructions respectively.
22113
22114 Permissible names for this option are the same as those for
22115 @option{-mtune}.
22116
22117 The following extension options are common to the listed CPUs:
22118
22119 @table @samp
22120 @item +nodsp
22121 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}
22122 and @samp{cortex-m55}. Also disable the M-Profile Vector Extension (MVE)
22123 integer and single precision floating-point instructions on @samp{cortex-m55}.
22124
22125 @item +nomve
22126 Disable the M-Profile Vector Extension (MVE) integer and single precision
22127 floating-point instructions on @samp{cortex-m55}.
22128
22129 @item +nomve.fp
22130 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22131 instructions on @samp{cortex-m55}.
22132
22133 @item +nofp
22134 Disables the floating-point instructions on @samp{arm9e},
22135 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22136 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22137 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22138 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22139 and @samp{cortex-m55}.
22140 Disables the floating-point and SIMD instructions on
22141 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22142 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22143 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22144 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22145 @samp{cortex-a53} and @samp{cortex-a55}.
22146
22147 @item +nofp.dp
22148 Disables the double-precision component of the floating-point instructions
22149 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22150 @samp{cortex-r52plus} and @samp{cortex-m7}.
22151
22152 @item +nosimd
22153 Disables the SIMD (but not floating-point) instructions on
22154 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22155 and @samp{cortex-a9}.
22156
22157 @item +crypto
22158 Enables the cryptographic instructions on @samp{cortex-a32},
22159 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22160 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22161 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22162 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22163 @samp{cortex-a75.cortex-a55}.
22164 @end table
22165
22166 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22167 VFPv3 with 16 double-precision registers. It supports the following
22168 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22169 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22170 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22171 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
22172 the extensions to @option{-march=armv7-a}.
22173
22174 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22175 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22176 See @option{-mtune} for more information.
22177
22178 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22179 of the build computer. At present, this feature is only supported on
22180 GNU/Linux, and not all architectures are recognized. If the auto-detect
22181 is unsuccessful the option has no effect.
22182
22183 @item -mfpu=@var{name}
22184 @opindex mfpu
22185 This specifies what floating-point hardware (or hardware emulation) is
22186 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
22187 @samp{vfpv3},
22188 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22189 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22190 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22191 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22192 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22193 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22194 is an alias for @samp{vfpv2}.
22195
22196 The setting @samp{auto} is the default and is special. It causes the
22197 compiler to select the floating-point and Advanced SIMD instructions
22198 based on the settings of @option{-mcpu} and @option{-march}.
22199
22200 If the selected floating-point hardware includes the NEON extension
22201 (e.g.@: @option{-mfpu=neon}), note that floating-point
22202 operations are not generated by GCC's auto-vectorization pass unless
22203 @option{-funsafe-math-optimizations} is also specified. This is
22204 because NEON hardware does not fully implement the IEEE 754 standard for
22205 floating-point arithmetic (in particular denormal values are treated as
22206 zero), so the use of NEON instructions may lead to a loss of precision.
22207
22208 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}).
22209
22210 @item -mfp16-format=@var{name}
22211 @opindex mfp16-format
22212 Specify the format of the @code{__fp16} half-precision floating-point type.
22213 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22214 the default is @samp{none}, in which case the @code{__fp16} type is not
22215 defined. @xref{Half-Precision}, for more information.
22216
22217 @item -mstructure-size-boundary=@var{n}
22218 @opindex mstructure-size-boundary
22219 The sizes of all structures and unions are rounded up to a multiple
22220 of the number of bits set by this option. Permissible values are 8, 32
22221 and 64. The default value varies for different toolchains. For the COFF
22222 targeted toolchain the default value is 8. A value of 64 is only allowed
22223 if the underlying ABI supports it.
22224
22225 Specifying a larger number can produce faster, more efficient code, but
22226 can also increase the size of the program. Different values are potentially
22227 incompatible. Code compiled with one value cannot necessarily expect to
22228 work with code or libraries compiled with another value, if they exchange
22229 information using structures or unions.
22230
22231 This option is deprecated.
22232
22233 @item -mabort-on-noreturn
22234 @opindex mabort-on-noreturn
22235 Generate a call to the function @code{abort} at the end of a
22236 @code{noreturn} function. It is executed if the function tries to
22237 return.
22238
22239 @item -mlong-calls
22240 @itemx -mno-long-calls
22241 @opindex mlong-calls
22242 @opindex mno-long-calls
22243 Tells the compiler to perform function calls by first loading the
22244 address of the function into a register and then performing a subroutine
22245 call on this register. This switch is needed if the target function
22246 lies outside of the 64-megabyte addressing range of the offset-based
22247 version of subroutine call instruction.
22248
22249 Even if this switch is enabled, not all function calls are turned
22250 into long calls. The heuristic is that static functions, functions
22251 that have the @code{short_call} attribute, functions that are inside
22252 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22253 definitions have already been compiled within the current compilation
22254 unit are not turned into long calls. The exceptions to this rule are
22255 that weak function definitions, functions with the @code{long_call}
22256 attribute or the @code{section} attribute, and functions that are within
22257 the scope of a @code{#pragma long_calls} directive are always
22258 turned into long calls.
22259
22260 This feature is not enabled by default. Specifying
22261 @option{-mno-long-calls} restores the default behavior, as does
22262 placing the function calls within the scope of a @code{#pragma
22263 long_calls_off} directive. Note these switches have no effect on how
22264 the compiler generates code to handle function calls via function
22265 pointers.
22266
22267 @item -msingle-pic-base
22268 @opindex msingle-pic-base
22269 Treat the register used for PIC addressing as read-only, rather than
22270 loading it in the prologue for each function. The runtime system is
22271 responsible for initializing this register with an appropriate value
22272 before execution begins.
22273
22274 @item -mpic-register=@var{reg}
22275 @opindex mpic-register
22276 Specify the register to be used for PIC addressing.
22277 For standard PIC base case, the default is any suitable register
22278 determined by compiler. For single PIC base case, the default is
22279 @samp{R9} if target is EABI based or stack-checking is enabled,
22280 otherwise the default is @samp{R10}.
22281
22282 @item -mpic-data-is-text-relative
22283 @opindex mpic-data-is-text-relative
22284 Assume that the displacement between the text and data segments is fixed
22285 at static link time. This permits using PC-relative addressing
22286 operations to access data known to be in the data segment. For
22287 non-VxWorks RTP targets, this option is enabled by default. When
22288 disabled on such targets, it will enable @option{-msingle-pic-base} by
22289 default.
22290
22291 @item -mpoke-function-name
22292 @opindex mpoke-function-name
22293 Write the name of each function into the text section, directly
22294 preceding the function prologue. The generated code is similar to this:
22295
22296 @smallexample
22297 t0
22298 .ascii "arm_poke_function_name", 0
22299 .align
22300 t1
22301 .word 0xff000000 + (t1 - t0)
22302 arm_poke_function_name
22303 mov ip, sp
22304 stmfd sp!, @{fp, ip, lr, pc@}
22305 sub fp, ip, #4
22306 @end smallexample
22307
22308 When performing a stack backtrace, code can inspect the value of
22309 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
22310 location @code{pc - 12} and the top 8 bits are set, then we know that
22311 there is a function name embedded immediately preceding this location
22312 and has length @code{((pc[-3]) & 0xff000000)}.
22313
22314 @item -mthumb
22315 @itemx -marm
22316 @opindex marm
22317 @opindex mthumb
22318
22319 Select between generating code that executes in ARM and Thumb
22320 states. The default for most configurations is to generate code
22321 that executes in ARM state, but the default can be changed by
22322 configuring GCC with the @option{--with-mode=}@var{state}
22323 configure option.
22324
22325 You can also override the ARM and Thumb mode for each function
22326 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22327 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22328
22329 @item -mflip-thumb
22330 @opindex mflip-thumb
22331 Switch ARM/Thumb modes on alternating functions.
22332 This option is provided for regression testing of mixed Thumb/ARM code
22333 generation, and is not intended for ordinary use in compiling code.
22334
22335 @item -mtpcs-frame
22336 @opindex mtpcs-frame
22337 Generate a stack frame that is compliant with the Thumb Procedure Call
22338 Standard for all non-leaf functions. (A leaf function is one that does
22339 not call any other functions.) The default is @option{-mno-tpcs-frame}.
22340
22341 @item -mtpcs-leaf-frame
22342 @opindex mtpcs-leaf-frame
22343 Generate a stack frame that is compliant with the Thumb Procedure Call
22344 Standard for all leaf functions. (A leaf function is one that does
22345 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
22346
22347 @item -mcallee-super-interworking
22348 @opindex mcallee-super-interworking
22349 Gives all externally visible functions in the file being compiled an ARM
22350 instruction set header which switches to Thumb mode before executing the
22351 rest of the function. This allows these functions to be called from
22352 non-interworking code. This option is not valid in AAPCS configurations
22353 because interworking is enabled by default.
22354
22355 @item -mcaller-super-interworking
22356 @opindex mcaller-super-interworking
22357 Allows calls via function pointers (including virtual functions) to
22358 execute correctly regardless of whether the target code has been
22359 compiled for interworking or not. There is a small overhead in the cost
22360 of executing a function pointer if this option is enabled. This option
22361 is not valid in AAPCS configurations because interworking is enabled
22362 by default.
22363
22364 @item -mtp=@var{name}
22365 @opindex mtp
22366 Specify the access model for the thread local storage pointer. The valid
22367 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
22368 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
22369 (supported in the arm6k architecture), and @samp{auto}, which uses the
22370 best available method for the selected processor. The default setting is
22371 @samp{auto}.
22372
22373 @item -mtls-dialect=@var{dialect}
22374 @opindex mtls-dialect
22375 Specify the dialect to use for accessing thread local storage. Two
22376 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
22377 @samp{gnu} dialect selects the original GNU scheme for supporting
22378 local and global dynamic TLS models. The @samp{gnu2} dialect
22379 selects the GNU descriptor scheme, which provides better performance
22380 for shared libraries. The GNU descriptor scheme is compatible with
22381 the original scheme, but does require new assembler, linker and
22382 library support. Initial and local exec TLS models are unaffected by
22383 this option and always use the original scheme.
22384
22385 @item -mword-relocations
22386 @opindex mword-relocations
22387 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22388 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22389 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22390 is specified. This option conflicts with @option{-mslow-flash-data}.
22391
22392 @item -mfix-cortex-m3-ldrd
22393 @opindex mfix-cortex-m3-ldrd
22394 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22395 with overlapping destination and base registers are used. This option avoids
22396 generating these instructions. This option is enabled by default when
22397 @option{-mcpu=cortex-m3} is specified.
22398
22399 @item -mfix-cortex-a57-aes-1742098
22400 @itemx -mno-fix-cortex-a57-aes-1742098
22401 @itemx -mfix-cortex-a72-aes-1655431
22402 @itemx -mno-fix-cortex-a72-aes-1655431
22403 Enable (disable) mitigation for an erratum on Cortex-A57 and
22404 Cortex-A72 that affects the AES cryptographic instructions. This
22405 option is enabled by default when either @option{-mcpu=cortex-a57} or
22406 @option{-mcpu=cortex-a72} is specified.
22407
22408 @item -munaligned-access
22409 @itemx -mno-unaligned-access
22410 @opindex munaligned-access
22411 @opindex mno-unaligned-access
22412 Enables (or disables) reading and writing of 16- and 32- bit values
22413 from addresses that are not 16- or 32- bit aligned. By default
22414 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22415 ARMv8-M Baseline architectures, and enabled for all other
22416 architectures. If unaligned access is not enabled then words in packed
22417 data structures are accessed a byte at a time.
22418
22419 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22420 generated object file to either true or false, depending upon the
22421 setting of this option. If unaligned access is enabled then the
22422 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22423 defined.
22424
22425 @item -mneon-for-64bits
22426 @opindex mneon-for-64bits
22427 This option is deprecated and has no effect.
22428
22429 @item -mslow-flash-data
22430 @opindex mslow-flash-data
22431 Assume loading data from flash is slower than fetching instruction.
22432 Therefore literal load is minimized for better performance.
22433 This option is only supported when compiling for ARMv7 M-profile and
22434 off by default. It conflicts with @option{-mword-relocations}.
22435
22436 @item -masm-syntax-unified
22437 @opindex masm-syntax-unified
22438 Assume inline assembler is using unified asm syntax. The default is
22439 currently off which implies divided syntax. This option has no impact
22440 on Thumb2. However, this may change in future releases of GCC.
22441 Divided syntax should be considered deprecated.
22442
22443 @item -mrestrict-it
22444 @opindex mrestrict-it
22445 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22446 IT blocks can only contain a single 16-bit instruction from a select
22447 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22448
22449 @item -mprint-tune-info
22450 @opindex mprint-tune-info
22451 Print CPU tuning information as comment in assembler file. This is
22452 an option used only for regression testing of the compiler and not
22453 intended for ordinary use in compiling code. This option is disabled
22454 by default.
22455
22456 @item -mverbose-cost-dump
22457 @opindex mverbose-cost-dump
22458 Enable verbose cost model dumping in the debug dump files. This option is
22459 provided for use in debugging the compiler.
22460
22461 @item -mpure-code
22462 @opindex mpure-code
22463 Do not allow constant data to be placed in code sections.
22464 Additionally, when compiling for ELF object format give all text sections the
22465 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
22466 is only available when generating non-pic code for M-profile targets.
22467
22468 @item -mcmse
22469 @opindex mcmse
22470 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22471 Development Tools Engineering Specification", which can be found on
22472 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22473
22474 @item -mfix-cmse-cve-2021-35465
22475 @opindex mfix-cmse-cve-2021-35465
22476 Mitigate against a potential security issue with the @code{VLLDM} instruction
22477 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
22478 enabled by default when the option @option{-mcpu=} is used with
22479 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55} or @code{star-mc1}.
22480 The option @option{-mno-fix-cmse-cve-2021-35465} can be used to disable
22481 the mitigation.
22482
22483 @item -mstack-protector-guard=@var{guard}
22484 @itemx -mstack-protector-guard-offset=@var{offset}
22485 @opindex mstack-protector-guard
22486 @opindex mstack-protector-guard-offset
22487 Generate stack protection code using canary at @var{guard}. Supported
22488 locations are @samp{global} for a global canary or @samp{tls} for a
22489 canary accessible via the TLS register. The option
22490 @option{-mstack-protector-guard-offset=} is for use with
22491 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22492
22493 @item -mfdpic
22494 @itemx -mno-fdpic
22495 @opindex mfdpic
22496 @opindex mno-fdpic
22497 Select the FDPIC ABI, which uses 64-bit function descriptors to
22498 represent pointers to functions. When the compiler is configured for
22499 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22500 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22501 provided. On other targets, it only enables the FDPIC-specific code
22502 generation features, and the user should explicitly provide the
22503 PIC/PIE-related options as needed.
22504
22505 Note that static linking is not supported because it would still
22506 involve the dynamic linker when the program self-relocates. If such
22507 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22508
22509 The opposite @option{-mno-fdpic} option is useful (and required) to
22510 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22511 toolchain as the one used to build the userland programs.
22512
22513 @end table
22514
22515 @node AVR Options
22516 @subsection AVR Options
22517 @cindex AVR Options
22518
22519 These options are defined for AVR implementations:
22520
22521 @table @gcctabopt
22522 @item -mmcu=@var{mcu}
22523 @opindex mmcu
22524 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
22525
22526 The default for this option is@tie{}@samp{avr2}.
22527
22528 GCC supports the following AVR devices and ISAs:
22529
22530 @include avr-mmcu.texi
22531
22532 @item -mabsdata
22533 @opindex mabsdata
22534
22535 Assume that all data in static storage can be accessed by LDS / STS
22536 instructions. This option has only an effect on reduced Tiny devices like
22537 ATtiny40. See also the @code{absdata}
22538 @ref{AVR Variable Attributes,variable attribute}.
22539
22540 @item -maccumulate-args
22541 @opindex maccumulate-args
22542 Accumulate outgoing function arguments and acquire/release the needed
22543 stack space for outgoing function arguments once in function
22544 prologue/epilogue. Without this option, outgoing arguments are pushed
22545 before calling a function and popped afterwards.
22546
22547 Popping the arguments after the function call can be expensive on
22548 AVR so that accumulating the stack space might lead to smaller
22549 executables because arguments need not be removed from the
22550 stack after such a function call.
22551
22552 This option can lead to reduced code size for functions that perform
22553 several calls to functions that get their arguments on the stack like
22554 calls to printf-like functions.
22555
22556 @item -mbranch-cost=@var{cost}
22557 @opindex mbranch-cost
22558 Set the branch costs for conditional branch instructions to
22559 @var{cost}. Reasonable values for @var{cost} are small, non-negative
22560 integers. The default branch cost is 0.
22561
22562 @item -mcall-prologues
22563 @opindex mcall-prologues
22564 Functions prologues/epilogues are expanded as calls to appropriate
22565 subroutines. Code size is smaller.
22566
22567 @item -mdouble=@var{bits}
22568 @itemx -mlong-double=@var{bits}
22569 @opindex mdouble
22570 @opindex mlong-double
22571 Set the size (in bits) of the @code{double} or @code{long double} type,
22572 respectively. Possible values for @var{bits} are 32 and 64.
22573 Whether or not a specific value for @var{bits} is allowed depends on
22574 the @code{--with-double=} and @code{--with-long-double=}
22575 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
22576 and the same applies for the default values of the options.
22577
22578 @item -mgas-isr-prologues
22579 @opindex mgas-isr-prologues
22580 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
22581 instruction supported by GNU Binutils.
22582 If this option is on, the feature can still be disabled for individual
22583 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
22584 function attribute. This feature is activated per default
22585 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
22586 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
22587
22588 @item -mint8
22589 @opindex mint8
22590 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
22591 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
22592 and @code{long long} is 4 bytes. Please note that this option does not
22593 conform to the C standards, but it results in smaller code
22594 size.
22595
22596 @item -mmain-is-OS_task
22597 @opindex mmain-is-OS_task
22598 Do not save registers in @code{main}. The effect is the same like
22599 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
22600 to @code{main}. It is activated per default if optimization is on.
22601
22602 @item -mn-flash=@var{num}
22603 @opindex mn-flash
22604 Assume that the flash memory has a size of
22605 @var{num} times 64@tie{}KiB.
22606
22607 @item -mno-interrupts
22608 @opindex mno-interrupts
22609 Generated code is not compatible with hardware interrupts.
22610 Code size is smaller.
22611
22612 @item -mrelax
22613 @opindex mrelax
22614 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
22615 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
22616 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
22617 the assembler's command line and the @option{--relax} option to the
22618 linker's command line.
22619
22620 Jump relaxing is performed by the linker because jump offsets are not
22621 known before code is located. Therefore, the assembler code generated by the
22622 compiler is the same, but the instructions in the executable may
22623 differ from instructions in the assembler code.
22624
22625 Relaxing must be turned on if linker stubs are needed, see the
22626 section on @code{EIND} and linker stubs below.
22627
22628 @item -mrmw
22629 @opindex mrmw
22630 Assume that the device supports the Read-Modify-Write
22631 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
22632
22633 @item -mshort-calls
22634 @opindex mshort-calls
22635
22636 Assume that @code{RJMP} and @code{RCALL} can target the whole
22637 program memory.
22638
22639 This option is used internally for multilib selection. It is
22640 not an optimization option, and you don't need to set it by hand.
22641
22642 @item -msp8
22643 @opindex msp8
22644 Treat the stack pointer register as an 8-bit register,
22645 i.e.@: assume the high byte of the stack pointer is zero.
22646 In general, you don't need to set this option by hand.
22647
22648 This option is used internally by the compiler to select and
22649 build multilibs for architectures @code{avr2} and @code{avr25}.
22650 These architectures mix devices with and without @code{SPH}.
22651 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
22652 the compiler driver adds or removes this option from the compiler
22653 proper's command line, because the compiler then knows if the device
22654 or architecture has an 8-bit stack pointer and thus no @code{SPH}
22655 register or not.
22656
22657 @item -mstrict-X
22658 @opindex mstrict-X
22659 Use address register @code{X} in a way proposed by the hardware. This means
22660 that @code{X} is only used in indirect, post-increment or
22661 pre-decrement addressing.
22662
22663 Without this option, the @code{X} register may be used in the same way
22664 as @code{Y} or @code{Z} which then is emulated by additional
22665 instructions.
22666 For example, loading a value with @code{X+const} addressing with a
22667 small non-negative @code{const < 64} to a register @var{Rn} is
22668 performed as
22669
22670 @example
22671 adiw r26, const ; X += const
22672 ld @var{Rn}, X ; @var{Rn} = *X
22673 sbiw r26, const ; X -= const
22674 @end example
22675
22676 @item -mtiny-stack
22677 @opindex mtiny-stack
22678 Only change the lower 8@tie{}bits of the stack pointer.
22679
22680 @item -mfract-convert-truncate
22681 @opindex mfract-convert-truncate
22682 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
22683
22684 @item -nodevicelib
22685 @opindex nodevicelib
22686 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
22687
22688 @item -nodevicespecs
22689 @opindex nodevicespecs
22690 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
22691 command line. The user takes responsibility for supplying the sub-processes
22692 like compiler proper, assembler and linker with appropriate command line
22693 options. This means that the user has to supply her private device specs
22694 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
22695 more need for option @option{-mmcu=@var{mcu}}.
22696
22697 This option can also serve as a replacement for the older way of
22698 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
22699 which contains a folder named @code{device-specs} which contains a specs file named
22700 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
22701
22702 @item -Waddr-space-convert
22703 @opindex Waddr-space-convert
22704 @opindex Wno-addr-space-convert
22705 Warn about conversions between address spaces in the case where the
22706 resulting address space is not contained in the incoming address space.
22707
22708 @item -Wmisspelled-isr
22709 @opindex Wmisspelled-isr
22710 @opindex Wno-misspelled-isr
22711 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
22712 Enabled by default.
22713 @end table
22714
22715 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
22716 @cindex @code{EIND}
22717 Pointers in the implementation are 16@tie{}bits wide.
22718 The address of a function or label is represented as word address so
22719 that indirect jumps and calls can target any code address in the
22720 range of 64@tie{}Ki words.
22721
22722 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
22723 bytes of program memory space, there is a special function register called
22724 @code{EIND} that serves as most significant part of the target address
22725 when @code{EICALL} or @code{EIJMP} instructions are used.
22726
22727 Indirect jumps and calls on these devices are handled as follows by
22728 the compiler and are subject to some limitations:
22729
22730 @itemize @bullet
22731
22732 @item
22733 The compiler never sets @code{EIND}.
22734
22735 @item
22736 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
22737 instructions or might read @code{EIND} directly in order to emulate an
22738 indirect call/jump by means of a @code{RET} instruction.
22739
22740 @item
22741 The compiler assumes that @code{EIND} never changes during the startup
22742 code or during the application. In particular, @code{EIND} is not
22743 saved/restored in function or interrupt service routine
22744 prologue/epilogue.
22745
22746 @item
22747 For indirect calls to functions and computed goto, the linker
22748 generates @emph{stubs}. Stubs are jump pads sometimes also called
22749 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
22750 The stub contains a direct jump to the desired address.
22751
22752 @item
22753 Linker relaxation must be turned on so that the linker generates
22754 the stubs correctly in all situations. See the compiler option
22755 @option{-mrelax} and the linker option @option{--relax}.
22756 There are corner cases where the linker is supposed to generate stubs
22757 but aborts without relaxation and without a helpful error message.
22758
22759 @item
22760 The default linker script is arranged for code with @code{EIND = 0}.
22761 If code is supposed to work for a setup with @code{EIND != 0}, a custom
22762 linker script has to be used in order to place the sections whose
22763 name start with @code{.trampolines} into the segment where @code{EIND}
22764 points to.
22765
22766 @item
22767 The startup code from libgcc never sets @code{EIND}.
22768 Notice that startup code is a blend of code from libgcc and AVR-LibC.
22769 For the impact of AVR-LibC on @code{EIND}, see the
22770 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
22771
22772 @item
22773 It is legitimate for user-specific startup code to set up @code{EIND}
22774 early, for example by means of initialization code located in
22775 section @code{.init3}. Such code runs prior to general startup code
22776 that initializes RAM and calls constructors, but after the bit
22777 of startup code from AVR-LibC that sets @code{EIND} to the segment
22778 where the vector table is located.
22779 @example
22780 #include <avr/io.h>
22781
22782 static void
22783 __attribute__((section(".init3"),naked,used,no_instrument_function))
22784 init3_set_eind (void)
22785 @{
22786 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
22787 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
22788 @}
22789 @end example
22790
22791 @noindent
22792 The @code{__trampolines_start} symbol is defined in the linker script.
22793
22794 @item
22795 Stubs are generated automatically by the linker if
22796 the following two conditions are met:
22797 @itemize @minus
22798
22799 @item The address of a label is taken by means of the @code{gs} modifier
22800 (short for @emph{generate stubs}) like so:
22801 @example
22802 LDI r24, lo8(gs(@var{func}))
22803 LDI r25, hi8(gs(@var{func}))
22804 @end example
22805 @item The final location of that label is in a code segment
22806 @emph{outside} the segment where the stubs are located.
22807 @end itemize
22808
22809 @item
22810 The compiler emits such @code{gs} modifiers for code labels in the
22811 following situations:
22812 @itemize @minus
22813 @item Taking address of a function or code label.
22814 @item Computed goto.
22815 @item If prologue-save function is used, see @option{-mcall-prologues}
22816 command-line option.
22817 @item Switch/case dispatch tables. If you do not want such dispatch
22818 tables you can specify the @option{-fno-jump-tables} command-line option.
22819 @item C and C++ constructors/destructors called during startup/shutdown.
22820 @item If the tools hit a @code{gs()} modifier explained above.
22821 @end itemize
22822
22823 @item
22824 Jumping to non-symbolic addresses like so is @emph{not} supported:
22825
22826 @example
22827 int main (void)
22828 @{
22829 /* Call function at word address 0x2 */
22830 return ((int(*)(void)) 0x2)();
22831 @}
22832 @end example
22833
22834 Instead, a stub has to be set up, i.e.@: the function has to be called
22835 through a symbol (@code{func_4} in the example):
22836
22837 @example
22838 int main (void)
22839 @{
22840 extern int func_4 (void);
22841
22842 /* Call function at byte address 0x4 */
22843 return func_4();
22844 @}
22845 @end example
22846
22847 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
22848 Alternatively, @code{func_4} can be defined in the linker script.
22849 @end itemize
22850
22851 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
22852 @cindex @code{RAMPD}
22853 @cindex @code{RAMPX}
22854 @cindex @code{RAMPY}
22855 @cindex @code{RAMPZ}
22856 Some AVR devices support memories larger than the 64@tie{}KiB range
22857 that can be accessed with 16-bit pointers. To access memory locations
22858 outside this 64@tie{}KiB range, the content of a @code{RAMP}
22859 register is used as high part of the address:
22860 The @code{X}, @code{Y}, @code{Z} address register is concatenated
22861 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
22862 register, respectively, to get a wide address. Similarly,
22863 @code{RAMPD} is used together with direct addressing.
22864
22865 @itemize
22866 @item
22867 The startup code initializes the @code{RAMP} special function
22868 registers with zero.
22869
22870 @item
22871 If a @ref{AVR Named Address Spaces,named address space} other than
22872 generic or @code{__flash} is used, then @code{RAMPZ} is set
22873 as needed before the operation.
22874
22875 @item
22876 If the device supports RAM larger than 64@tie{}KiB and the compiler
22877 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
22878 is reset to zero after the operation.
22879
22880 @item
22881 If the device comes with a specific @code{RAMP} register, the ISR
22882 prologue/epilogue saves/restores that SFR and initializes it with
22883 zero in case the ISR code might (implicitly) use it.
22884
22885 @item
22886 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
22887 If you use inline assembler to read from locations outside the
22888 16-bit address range and change one of the @code{RAMP} registers,
22889 you must reset it to zero after the access.
22890
22891 @end itemize
22892
22893 @subsubsection AVR Built-in Macros
22894
22895 GCC defines several built-in macros so that the user code can test
22896 for the presence or absence of features. Almost any of the following
22897 built-in macros are deduced from device capabilities and thus
22898 triggered by the @option{-mmcu=} command-line option.
22899
22900 For even more AVR-specific built-in macros see
22901 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
22902
22903 @table @code
22904
22905 @item __AVR_ARCH__
22906 Build-in macro that resolves to a decimal number that identifies the
22907 architecture and depends on the @option{-mmcu=@var{mcu}} option.
22908 Possible values are:
22909
22910 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
22911 @code{4}, @code{5}, @code{51}, @code{6}
22912
22913 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
22914 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
22915
22916 respectively and
22917
22918 @code{100},
22919 @code{102}, @code{103}, @code{104},
22920 @code{105}, @code{106}, @code{107}
22921
22922 for @var{mcu}=@code{avrtiny},
22923 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
22924 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
22925 If @var{mcu} specifies a device, this built-in macro is set
22926 accordingly. For example, with @option{-mmcu=atmega8} the macro is
22927 defined to @code{4}.
22928
22929 @item __AVR_@var{Device}__
22930 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
22931 the device's name. For example, @option{-mmcu=atmega8} defines the
22932 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
22933 @code{__AVR_ATtiny261A__}, etc.
22934
22935 The built-in macros' names follow
22936 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
22937 the device name as from the AVR user manual. The difference between
22938 @var{Device} in the built-in macro and @var{device} in
22939 @option{-mmcu=@var{device}} is that the latter is always lowercase.
22940
22941 If @var{device} is not a device but only a core architecture like
22942 @samp{avr51}, this macro is not defined.
22943
22944 @item __AVR_DEVICE_NAME__
22945 Setting @option{-mmcu=@var{device}} defines this built-in macro to
22946 the device's name. For example, with @option{-mmcu=atmega8} the macro
22947 is defined to @code{atmega8}.
22948
22949 If @var{device} is not a device but only a core architecture like
22950 @samp{avr51}, this macro is not defined.
22951
22952 @item __AVR_XMEGA__
22953 The device / architecture belongs to the XMEGA family of devices.
22954
22955 @item __AVR_HAVE_ELPM__
22956 The device has the @code{ELPM} instruction.
22957
22958 @item __AVR_HAVE_ELPMX__
22959 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
22960 R@var{n},Z+} instructions.
22961
22962 @item __AVR_HAVE_MOVW__
22963 The device has the @code{MOVW} instruction to perform 16-bit
22964 register-register moves.
22965
22966 @item __AVR_HAVE_LPMX__
22967 The device has the @code{LPM R@var{n},Z} and
22968 @code{LPM R@var{n},Z+} instructions.
22969
22970 @item __AVR_HAVE_MUL__
22971 The device has a hardware multiplier.
22972
22973 @item __AVR_HAVE_JMP_CALL__
22974 The device has the @code{JMP} and @code{CALL} instructions.
22975 This is the case for devices with more than 8@tie{}KiB of program
22976 memory.
22977
22978 @item __AVR_HAVE_EIJMP_EICALL__
22979 @itemx __AVR_3_BYTE_PC__
22980 The device has the @code{EIJMP} and @code{EICALL} instructions.
22981 This is the case for devices with more than 128@tie{}KiB of program memory.
22982 This also means that the program counter
22983 (PC) is 3@tie{}bytes wide.
22984
22985 @item __AVR_2_BYTE_PC__
22986 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
22987 with up to 128@tie{}KiB of program memory.
22988
22989 @item __AVR_HAVE_8BIT_SP__
22990 @itemx __AVR_HAVE_16BIT_SP__
22991 The stack pointer (SP) register is treated as 8-bit respectively
22992 16-bit register by the compiler.
22993 The definition of these macros is affected by @option{-mtiny-stack}.
22994
22995 @item __AVR_HAVE_SPH__
22996 @itemx __AVR_SP8__
22997 The device has the SPH (high part of stack pointer) special function
22998 register or has an 8-bit stack pointer, respectively.
22999 The definition of these macros is affected by @option{-mmcu=} and
23000 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23001 by @option{-msp8}.
23002
23003 @item __AVR_HAVE_RAMPD__
23004 @itemx __AVR_HAVE_RAMPX__
23005 @itemx __AVR_HAVE_RAMPY__
23006 @itemx __AVR_HAVE_RAMPZ__
23007 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23008 @code{RAMPZ} special function register, respectively.
23009
23010 @item __NO_INTERRUPTS__
23011 This macro reflects the @option{-mno-interrupts} command-line option.
23012
23013 @item __AVR_ERRATA_SKIP__
23014 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23015 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23016 instructions because of a hardware erratum. Skip instructions are
23017 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23018 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23019 set.
23020
23021 @item __AVR_ISA_RMW__
23022 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23023
23024 @item __AVR_SFR_OFFSET__=@var{offset}
23025 Instructions that can address I/O special function registers directly
23026 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23027 address as if addressed by an instruction to access RAM like @code{LD}
23028 or @code{STS}. This offset depends on the device architecture and has
23029 to be subtracted from the RAM address in order to get the
23030 respective I/O@tie{}address.
23031
23032 @item __AVR_SHORT_CALLS__
23033 The @option{-mshort-calls} command line option is set.
23034
23035 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23036 Some devices support reading from flash memory by means of @code{LD*}
23037 instructions. The flash memory is seen in the data address space
23038 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
23039 is not defined, this feature is not available. If defined,
23040 the address space is linear and there is no need to put
23041 @code{.rodata} into RAM. This is handled by the default linker
23042 description file, and is currently available for
23043 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
23044 there is no need to use address spaces like @code{__flash} or
23045 features like attribute @code{progmem} and @code{pgm_read_*}.
23046
23047 @item __WITH_AVRLIBC__
23048 The compiler is configured to be used together with AVR-Libc.
23049 See the @option{--with-avrlibc} configure option.
23050
23051 @item __HAVE_DOUBLE_MULTILIB__
23052 Defined if @option{-mdouble=} acts as a multilib option.
23053
23054 @item __HAVE_DOUBLE32__
23055 @itemx __HAVE_DOUBLE64__
23056 Defined if the compiler supports 32-bit double resp. 64-bit double.
23057 The actual layout is specified by option @option{-mdouble=}.
23058
23059 @item __DEFAULT_DOUBLE__
23060 The size in bits of @code{double} if @option{-mdouble=} is not set.
23061 To test the layout of @code{double} in a program, use the built-in
23062 macro @code{__SIZEOF_DOUBLE__}.
23063
23064 @item __HAVE_LONG_DOUBLE32__
23065 @itemx __HAVE_LONG_DOUBLE64__
23066 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23067 @itemx __DEFAULT_LONG_DOUBLE__
23068 Same as above, but for @code{long double} instead of @code{double}.
23069
23070 @item __WITH_DOUBLE_COMPARISON__
23071 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23072 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23073 and is defined to @code{2} or @code{3}.
23074
23075 @item __WITH_LIBF7_LIBGCC__
23076 @itemx __WITH_LIBF7_MATH__
23077 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23078 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23079 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23080
23081 @end table
23082
23083 @node Blackfin Options
23084 @subsection Blackfin Options
23085 @cindex Blackfin Options
23086
23087 @table @gcctabopt
23088 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23089 @opindex mcpu=
23090 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
23091 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23092 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23093 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23094 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23095 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23096 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23097 @samp{bf561}, @samp{bf592}.
23098
23099 The optional @var{sirevision} specifies the silicon revision of the target
23100 Blackfin processor. Any workarounds available for the targeted silicon revision
23101 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
23102 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23103 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
23104 hexadecimal digits representing the major and minor numbers in the silicon
23105 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23106 is not defined. If @var{sirevision} is @samp{any}, the
23107 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23108 If this optional @var{sirevision} is not used, GCC assumes the latest known
23109 silicon revision of the targeted Blackfin processor.
23110
23111 GCC defines a preprocessor macro for the specified @var{cpu}.
23112 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23113 provided by libgloss to be linked in if @option{-msim} is not given.
23114
23115 Without this option, @samp{bf532} is used as the processor by default.
23116
23117 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
23118 only the preprocessor macro is defined.
23119
23120 @item -msim
23121 @opindex msim
23122 Specifies that the program will be run on the simulator. This causes
23123 the simulator BSP provided by libgloss to be linked in. This option
23124 has effect only for @samp{bfin-elf} toolchain.
23125 Certain other options, such as @option{-mid-shared-library} and
23126 @option{-mfdpic}, imply @option{-msim}.
23127
23128 @item -momit-leaf-frame-pointer
23129 @opindex momit-leaf-frame-pointer
23130 Don't keep the frame pointer in a register for leaf functions. This
23131 avoids the instructions to save, set up and restore frame pointers and
23132 makes an extra register available in leaf functions.
23133
23134 @item -mspecld-anomaly
23135 @opindex mspecld-anomaly
23136 When enabled, the compiler ensures that the generated code does not
23137 contain speculative loads after jump instructions. If this option is used,
23138 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23139
23140 @item -mno-specld-anomaly
23141 @opindex mno-specld-anomaly
23142 @opindex mspecld-anomaly
23143 Don't generate extra code to prevent speculative loads from occurring.
23144
23145 @item -mcsync-anomaly
23146 @opindex mcsync-anomaly
23147 When enabled, the compiler ensures that the generated code does not
23148 contain CSYNC or SSYNC instructions too soon after conditional branches.
23149 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23150
23151 @item -mno-csync-anomaly
23152 @opindex mno-csync-anomaly
23153 @opindex mcsync-anomaly
23154 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23155 occurring too soon after a conditional branch.
23156
23157 @item -mlow64k
23158 @opindex mlow64k
23159 When enabled, the compiler is free to take advantage of the knowledge that
23160 the entire program fits into the low 64k of memory.
23161
23162 @item -mno-low64k
23163 @opindex mno-low64k
23164 Assume that the program is arbitrarily large. This is the default.
23165
23166 @item -mstack-check-l1
23167 @opindex mstack-check-l1
23168 Do stack checking using information placed into L1 scratchpad memory by the
23169 uClinux kernel.
23170
23171 @item -mid-shared-library
23172 @opindex mid-shared-library
23173 Generate code that supports shared libraries via the library ID method.
23174 This allows for execute in place and shared libraries in an environment
23175 without virtual memory management. This option implies @option{-fPIC}.
23176 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23177
23178 @item -mno-id-shared-library
23179 @opindex mno-id-shared-library
23180 @opindex mid-shared-library
23181 Generate code that doesn't assume ID-based shared libraries are being used.
23182 This is the default.
23183
23184 @item -mleaf-id-shared-library
23185 @opindex mleaf-id-shared-library
23186 Generate code that supports shared libraries via the library ID method,
23187 but assumes that this library or executable won't link against any other
23188 ID shared libraries. That allows the compiler to use faster code for jumps
23189 and calls.
23190
23191 @item -mno-leaf-id-shared-library
23192 @opindex mno-leaf-id-shared-library
23193 @opindex mleaf-id-shared-library
23194 Do not assume that the code being compiled won't link against any ID shared
23195 libraries. Slower code is generated for jump and call insns.
23196
23197 @item -mshared-library-id=n
23198 @opindex mshared-library-id
23199 Specifies the identification number of the ID-based shared library being
23200 compiled. Specifying a value of 0 generates more compact code; specifying
23201 other values forces the allocation of that number to the current
23202 library but is no more space- or time-efficient than omitting this option.
23203
23204 @item -msep-data
23205 @opindex msep-data
23206 Generate code that allows the data segment to be located in a different
23207 area of memory from the text segment. This allows for execute in place in
23208 an environment without virtual memory management by eliminating relocations
23209 against the text section.
23210
23211 @item -mno-sep-data
23212 @opindex mno-sep-data
23213 @opindex msep-data
23214 Generate code that assumes that the data segment follows the text segment.
23215 This is the default.
23216
23217 @item -mlong-calls
23218 @itemx -mno-long-calls
23219 @opindex mlong-calls
23220 @opindex mno-long-calls
23221 Tells the compiler to perform function calls by first loading the
23222 address of the function into a register and then performing a subroutine
23223 call on this register. This switch is needed if the target function
23224 lies outside of the 24-bit addressing range of the offset-based
23225 version of subroutine call instruction.
23226
23227 This feature is not enabled by default. Specifying
23228 @option{-mno-long-calls} restores the default behavior. Note these
23229 switches have no effect on how the compiler generates code to handle
23230 function calls via function pointers.
23231
23232 @item -mfast-fp
23233 @opindex mfast-fp
23234 Link with the fast floating-point library. This library relaxes some of
23235 the IEEE floating-point standard's rules for checking inputs against
23236 Not-a-Number (NAN), in the interest of performance.
23237
23238 @item -minline-plt
23239 @opindex minline-plt
23240 Enable inlining of PLT entries in function calls to functions that are
23241 not known to bind locally. It has no effect without @option{-mfdpic}.
23242
23243 @item -mmulticore
23244 @opindex mmulticore
23245 Build a standalone application for multicore Blackfin processors.
23246 This option causes proper start files and link scripts supporting
23247 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
23248 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
23249
23250 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23251 selects the one-application-per-core programming model. Without
23252 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23253 programming model is used. In this model, the main function of Core B
23254 should be named as @code{coreb_main}.
23255
23256 If this option is not used, the single-core application programming
23257 model is used.
23258
23259 @item -mcorea
23260 @opindex mcorea
23261 Build a standalone application for Core A of BF561 when using
23262 the one-application-per-core programming model. Proper start files
23263 and link scripts are used to support Core A, and the macro
23264 @code{__BFIN_COREA} is defined.
23265 This option can only be used in conjunction with @option{-mmulticore}.
23266
23267 @item -mcoreb
23268 @opindex mcoreb
23269 Build a standalone application for Core B of BF561 when using
23270 the one-application-per-core programming model. Proper start files
23271 and link scripts are used to support Core B, and the macro
23272 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23273 should be used instead of @code{main}.
23274 This option can only be used in conjunction with @option{-mmulticore}.
23275
23276 @item -msdram
23277 @opindex msdram
23278 Build a standalone application for SDRAM. Proper start files and
23279 link scripts are used to put the application into SDRAM, and the macro
23280 @code{__BFIN_SDRAM} is defined.
23281 The loader should initialize SDRAM before loading the application.
23282
23283 @item -micplb
23284 @opindex micplb
23285 Assume that ICPLBs are enabled at run time. This has an effect on certain
23286 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
23287 are enabled; for standalone applications the default is off.
23288 @end table
23289
23290 @node C6X Options
23291 @subsection C6X Options
23292 @cindex C6X Options
23293
23294 @table @gcctabopt
23295 @item -march=@var{name}
23296 @opindex march
23297 This specifies the name of the target architecture. GCC uses this
23298 name to determine what kind of instructions it can emit when generating
23299 assembly code. Permissible names are: @samp{c62x},
23300 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23301
23302 @item -mbig-endian
23303 @opindex mbig-endian
23304 Generate code for a big-endian target.
23305
23306 @item -mlittle-endian
23307 @opindex mlittle-endian
23308 Generate code for a little-endian target. This is the default.
23309
23310 @item -msim
23311 @opindex msim
23312 Choose startup files and linker script suitable for the simulator.
23313
23314 @item -msdata=default
23315 @opindex msdata=default
23316 Put small global and static data in the @code{.neardata} section,
23317 which is pointed to by register @code{B14}. Put small uninitialized
23318 global and static data in the @code{.bss} section, which is adjacent
23319 to the @code{.neardata} section. Put small read-only data into the
23320 @code{.rodata} section. The corresponding sections used for large
23321 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23322
23323 @item -msdata=all
23324 @opindex msdata=all
23325 Put all data, not just small objects, into the sections reserved for
23326 small data, and use addressing relative to the @code{B14} register to
23327 access them.
23328
23329 @item -msdata=none
23330 @opindex msdata=none
23331 Make no use of the sections reserved for small data, and use absolute
23332 addresses to access all data. Put all initialized global and static
23333 data in the @code{.fardata} section, and all uninitialized data in the
23334 @code{.far} section. Put all constant data into the @code{.const}
23335 section.
23336 @end table
23337
23338 @node CRIS Options
23339 @subsection CRIS Options
23340 @cindex CRIS Options
23341
23342 These options are defined specifically for the CRIS ports.
23343
23344 @table @gcctabopt
23345 @item -march=@var{architecture-type}
23346 @itemx -mcpu=@var{architecture-type}
23347 @opindex march
23348 @opindex mcpu
23349 Generate code for the specified architecture. The choices for
23350 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23351 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23352 Default is @samp{v0}.
23353
23354 @item -mtune=@var{architecture-type}
23355 @opindex mtune
23356 Tune to @var{architecture-type} everything applicable about the generated
23357 code, except for the ABI and the set of available instructions. The
23358 choices for @var{architecture-type} are the same as for
23359 @option{-march=@var{architecture-type}}.
23360
23361 @item -mmax-stack-frame=@var{n}
23362 @opindex mmax-stack-frame
23363 Warn when the stack frame of a function exceeds @var{n} bytes.
23364
23365 @item -metrax4
23366 @itemx -metrax100
23367 @opindex metrax4
23368 @opindex metrax100
23369 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23370 @option{-march=v3} and @option{-march=v8} respectively.
23371
23372 @item -mmul-bug-workaround
23373 @itemx -mno-mul-bug-workaround
23374 @opindex mmul-bug-workaround
23375 @opindex mno-mul-bug-workaround
23376 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23377 models where it applies. This option is disabled by default.
23378
23379 @item -mpdebug
23380 @opindex mpdebug
23381 Enable CRIS-specific verbose debug-related information in the assembly
23382 code. This option also has the effect of turning off the @samp{#NO_APP}
23383 formatted-code indicator to the assembler at the beginning of the
23384 assembly file.
23385
23386 @item -mcc-init
23387 @opindex mcc-init
23388 Do not use condition-code results from previous instruction; always emit
23389 compare and test instructions before use of condition codes.
23390
23391 @item -mno-side-effects
23392 @opindex mno-side-effects
23393 @opindex mside-effects
23394 Do not emit instructions with side effects in addressing modes other than
23395 post-increment.
23396
23397 @item -mstack-align
23398 @itemx -mno-stack-align
23399 @itemx -mdata-align
23400 @itemx -mno-data-align
23401 @itemx -mconst-align
23402 @itemx -mno-const-align
23403 @opindex mstack-align
23404 @opindex mno-stack-align
23405 @opindex mdata-align
23406 @opindex mno-data-align
23407 @opindex mconst-align
23408 @opindex mno-const-align
23409 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23410 stack frame, individual data and constants to be aligned for the maximum
23411 single data access size for the chosen CPU model. The default is to
23412 arrange for 32-bit alignment. ABI details such as structure layout are
23413 not affected by these options.
23414
23415 @item -m32-bit
23416 @itemx -m16-bit
23417 @itemx -m8-bit
23418 @opindex m32-bit
23419 @opindex m16-bit
23420 @opindex m8-bit
23421 Similar to the stack- data- and const-align options above, these options
23422 arrange for stack frame, writable data and constants to all be 32-bit,
23423 16-bit or 8-bit aligned. The default is 32-bit alignment.
23424
23425 @item -mno-prologue-epilogue
23426 @itemx -mprologue-epilogue
23427 @opindex mno-prologue-epilogue
23428 @opindex mprologue-epilogue
23429 With @option{-mno-prologue-epilogue}, the normal function prologue and
23430 epilogue which set up the stack frame are omitted and no return
23431 instructions or return sequences are generated in the code. Use this
23432 option only together with visual inspection of the compiled code: no
23433 warnings or errors are generated when call-saved registers must be saved,
23434 or storage for local variables needs to be allocated.
23435
23436 @item -melf
23437 @opindex melf
23438 Legacy no-op option.
23439
23440 @item -sim
23441 @opindex sim
23442 This option arranges
23443 to link with input-output functions from a simulator library. Code,
23444 initialized data and zero-initialized data are allocated consecutively.
23445
23446 @item -sim2
23447 @opindex sim2
23448 Like @option{-sim}, but pass linker options to locate initialized data at
23449 0x40000000 and zero-initialized data at 0x80000000.
23450 @end table
23451
23452 @node C-SKY Options
23453 @subsection C-SKY Options
23454 @cindex C-SKY Options
23455
23456 GCC supports these options when compiling for C-SKY V2 processors.
23457
23458 @table @gcctabopt
23459
23460 @item -march=@var{arch}
23461 @opindex march=
23462 Specify the C-SKY target architecture. Valid values for @var{arch} are:
23463 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23464 The default is @samp{ck810}.
23465
23466 @item -mcpu=@var{cpu}
23467 @opindex mcpu=
23468 Specify the C-SKY target processor. Valid values for @var{cpu} are:
23469 @samp{ck801}, @samp{ck801t},
23470 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23471 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23472 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23473 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23474 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23475 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23476 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23477 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23478 @samp{ck803eftr1}, @samp{ck803efhtr1},
23479 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23480 @samp{ck803sef}, @samp{ck803seft},
23481 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23482 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23483 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23484 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23485
23486 @item -mbig-endian
23487 @opindex mbig-endian
23488 @itemx -EB
23489 @opindex EB
23490 @itemx -mlittle-endian
23491 @opindex mlittle-endian
23492 @itemx -EL
23493 @opindex EL
23494
23495 Select big- or little-endian code. The default is little-endian.
23496
23497 @item -mfloat-abi=@var{name}
23498 @opindex mfloat-abi
23499 Specifies which floating-point ABI to use. Permissible values
23500 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23501
23502 Specifying @samp{soft} causes GCC to generate output containing
23503 library calls for floating-point operations.
23504 @samp{softfp} allows the generation of code using hardware floating-point
23505 instructions, but still uses the soft-float calling conventions.
23506 @samp{hard} allows generation of floating-point instructions
23507 and uses FPU-specific calling conventions.
23508
23509 The default depends on the specific target configuration. Note that
23510 the hard-float and soft-float ABIs are not link-compatible; you must
23511 compile your entire program with the same ABI, and link with a
23512 compatible set of libraries.
23513
23514 @item -mhard-float
23515 @opindex mhard-float
23516 @itemx -msoft-float
23517 @opindex msoft-float
23518
23519 Select hardware or software floating-point implementations.
23520 The default is soft float.
23521
23522 @item -mdouble-float
23523 @itemx -mno-double-float
23524 @opindex mdouble-float
23525 When @option{-mhard-float} is in effect, enable generation of
23526 double-precision float instructions. This is the default except
23527 when compiling for CK803.
23528
23529 @item -mfdivdu
23530 @itemx -mno-fdivdu
23531 @opindex mfdivdu
23532 When @option{-mhard-float} is in effect, enable generation of
23533 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
23534 This is the default except when compiling for CK803.
23535
23536 @item -mfpu=@var{fpu}
23537 @opindex mfpu=
23538 Select the floating-point processor. This option can only be used with
23539 @option{-mhard-float}.
23540 Values for @var{fpu} are
23541 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
23542 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
23543 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
23544
23545 @item -melrw
23546 @itemx -mno-elrw
23547 @opindex melrw
23548 Enable the extended @code{lrw} instruction. This option defaults to on
23549 for CK801 and off otherwise.
23550
23551 @item -mistack
23552 @itemx -mno-istack
23553 @opindex mistack
23554 Enable interrupt stack instructions; the default is off.
23555
23556 The @option{-mistack} option is required to handle the
23557 @code{interrupt} and @code{isr} function attributes
23558 (@pxref{C-SKY Function Attributes}).
23559
23560 @item -mmp
23561 @opindex mmp
23562 Enable multiprocessor instructions; the default is off.
23563
23564 @item -mcp
23565 @opindex mcp
23566 Enable coprocessor instructions; the default is off.
23567
23568 @item -mcache
23569 @opindex mcache
23570 Enable coprocessor instructions; the default is off.
23571
23572 @item -msecurity
23573 @opindex msecurity
23574 Enable C-SKY security instructions; the default is off.
23575
23576 @item -mtrust
23577 @opindex mtrust
23578 Enable C-SKY trust instructions; the default is off.
23579
23580 @item -mdsp
23581 @opindex mdsp
23582 @itemx -medsp
23583 @opindex medsp
23584 @itemx -mvdsp
23585 @opindex mvdsp
23586 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
23587 All of these options default to off.
23588
23589 @item -mdiv
23590 @itemx -mno-div
23591 @opindex mdiv
23592 Generate divide instructions. Default is off.
23593
23594 @item -msmart
23595 @itemx -mno-smart
23596 @opindex msmart
23597 Generate code for Smart Mode, using only registers numbered 0-7 to allow
23598 use of 16-bit instructions. This option is ignored for CK801 where this
23599 is the required behavior, and it defaults to on for CK802.
23600 For other targets, the default is off.
23601
23602 @item -mhigh-registers
23603 @itemx -mno-high-registers
23604 @opindex mhigh-registers
23605 Generate code using the high registers numbered 16-31. This option
23606 is not supported on CK801, CK802, or CK803, and is enabled by default
23607 for other processors.
23608
23609 @item -manchor
23610 @itemx -mno-anchor
23611 @opindex manchor
23612 Generate code using global anchor symbol addresses.
23613
23614 @item -mpushpop
23615 @itemx -mno-pushpop
23616 @opindex mpushpop
23617 Generate code using @code{push} and @code{pop} instructions. This option
23618 defaults to on.
23619
23620 @item -mmultiple-stld
23621 @itemx -mstm
23622 @itemx -mno-multiple-stld
23623 @itemx -mno-stm
23624 @opindex mmultiple-stld
23625 Generate code using @code{stm} and @code{ldm} instructions. This option
23626 isn't supported on CK801 but is enabled by default on other processors.
23627
23628 @item -mconstpool
23629 @itemx -mno-constpool
23630 @opindex mconstpool
23631 Create constant pools in the compiler instead of deferring it to the
23632 assembler. This option is the default and required for correct code
23633 generation on CK801 and CK802, and is optional on other processors.
23634
23635 @item -mstack-size
23636 @item -mno-stack-size
23637 @opindex mstack-size
23638 Emit @code{.stack_size} directives for each function in the assembly
23639 output. This option defaults to off.
23640
23641 @item -mccrt
23642 @itemx -mno-ccrt
23643 @opindex mccrt
23644 Generate code for the C-SKY compiler runtime instead of libgcc. This
23645 option defaults to off.
23646
23647 @item -mbranch-cost=@var{n}
23648 @opindex mbranch-cost=
23649 Set the branch costs to roughly @code{n} instructions. The default is 1.
23650
23651 @item -msched-prolog
23652 @itemx -mno-sched-prolog
23653 @opindex msched-prolog
23654 Permit scheduling of function prologue and epilogue sequences. Using
23655 this option can result in code that is not compliant with the C-SKY V2 ABI
23656 prologue requirements and that cannot be debugged or backtraced.
23657 It is disabled by default.
23658
23659 @item -msim
23660 @opindex msim
23661 Links the library libsemi.a which is in compatible with simulator. Applicable
23662 to ELF compiler only.
23663
23664 @end table
23665
23666 @node Darwin Options
23667 @subsection Darwin Options
23668 @cindex Darwin options
23669
23670 These options are defined for all architectures running the Darwin operating
23671 system.
23672
23673 FSF GCC on Darwin does not create ``fat'' object files; it creates
23674 an object file for the single architecture that GCC was built to
23675 target. Apple's GCC on Darwin does create ``fat'' files if multiple
23676 @option{-arch} options are used; it does so by running the compiler or
23677 linker multiple times and joining the results together with
23678 @file{lipo}.
23679
23680 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
23681 @samp{i686}) is determined by the flags that specify the ISA
23682 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
23683 @option{-force_cpusubtype_ALL} option can be used to override this.
23684
23685 The Darwin tools vary in their behavior when presented with an ISA
23686 mismatch. The assembler, @file{as}, only permits instructions to
23687 be used that are valid for the subtype of the file it is generating,
23688 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
23689 The linker for shared libraries, @file{/usr/bin/libtool}, fails
23690 and prints an error if asked to create a shared library with a less
23691 restrictive subtype than its input files (for instance, trying to put
23692 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
23693 for executables, @command{ld}, quietly gives the executable the most
23694 restrictive subtype of any of its input files.
23695
23696 @table @gcctabopt
23697 @item -F@var{dir}
23698 @opindex F
23699 Add the framework directory @var{dir} to the head of the list of
23700 directories to be searched for header files. These directories are
23701 interleaved with those specified by @option{-I} options and are
23702 scanned in a left-to-right order.
23703
23704 A framework directory is a directory with frameworks in it. A
23705 framework is a directory with a @file{Headers} and/or
23706 @file{PrivateHeaders} directory contained directly in it that ends
23707 in @file{.framework}. The name of a framework is the name of this
23708 directory excluding the @file{.framework}. Headers associated with
23709 the framework are found in one of those two directories, with
23710 @file{Headers} being searched first. A subframework is a framework
23711 directory that is in a framework's @file{Frameworks} directory.
23712 Includes of subframework headers can only appear in a header of a
23713 framework that contains the subframework, or in a sibling subframework
23714 header. Two subframeworks are siblings if they occur in the same
23715 framework. A subframework should not have the same name as a
23716 framework; a warning is issued if this is violated. Currently a
23717 subframework cannot have subframeworks; in the future, the mechanism
23718 may be extended to support this. The standard frameworks can be found
23719 in @file{/System/Library/Frameworks} and
23720 @file{/Library/Frameworks}. An example include looks like
23721 @code{#include <Framework/header.h>}, where @file{Framework} denotes
23722 the name of the framework and @file{header.h} is found in the
23723 @file{PrivateHeaders} or @file{Headers} directory.
23724
23725 @item -iframework@var{dir}
23726 @opindex iframework
23727 Like @option{-F} except the directory is a treated as a system
23728 directory. The main difference between this @option{-iframework} and
23729 @option{-F} is that with @option{-iframework} the compiler does not
23730 warn about constructs contained within header files found via
23731 @var{dir}. This option is valid only for the C family of languages.
23732
23733 @item -gused
23734 @opindex gused
23735 Emit debugging information for symbols that are used. For stabs
23736 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
23737 This is by default ON@.
23738
23739 @item -gfull
23740 @opindex gfull
23741 Emit debugging information for all symbols and types.
23742
23743 @item -mmacosx-version-min=@var{version}
23744 The earliest version of MacOS X that this executable will run on
23745 is @var{version}. Typical values of @var{version} include @code{10.1},
23746 @code{10.2}, and @code{10.3.9}.
23747
23748 If the compiler was built to use the system's headers by default,
23749 then the default for this option is the system version on which the
23750 compiler is running, otherwise the default is to make choices that
23751 are compatible with as many systems and code bases as possible.
23752
23753 @item -mkernel
23754 @opindex mkernel
23755 Enable kernel development mode. The @option{-mkernel} option sets
23756 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
23757 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
23758 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
23759 applicable. This mode also sets @option{-mno-altivec},
23760 @option{-msoft-float}, @option{-fno-builtin} and
23761 @option{-mlong-branch} for PowerPC targets.
23762
23763 @item -mone-byte-bool
23764 @opindex mone-byte-bool
23765 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
23766 By default @code{sizeof(bool)} is @code{4} when compiling for
23767 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
23768 option has no effect on x86.
23769
23770 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
23771 to generate code that is not binary compatible with code generated
23772 without that switch. Using this switch may require recompiling all
23773 other modules in a program, including system libraries. Use this
23774 switch to conform to a non-default data model.
23775
23776 @item -mfix-and-continue
23777 @itemx -ffix-and-continue
23778 @itemx -findirect-data
23779 @opindex mfix-and-continue
23780 @opindex ffix-and-continue
23781 @opindex findirect-data
23782 Generate code suitable for fast turnaround development, such as to
23783 allow GDB to dynamically load @file{.o} files into already-running
23784 programs. @option{-findirect-data} and @option{-ffix-and-continue}
23785 are provided for backwards compatibility.
23786
23787 @item -all_load
23788 @opindex all_load
23789 Loads all members of static archive libraries.
23790 See man ld(1) for more information.
23791
23792 @item -arch_errors_fatal
23793 @opindex arch_errors_fatal
23794 Cause the errors having to do with files that have the wrong architecture
23795 to be fatal.
23796
23797 @item -bind_at_load
23798 @opindex bind_at_load
23799 Causes the output file to be marked such that the dynamic linker will
23800 bind all undefined references when the file is loaded or launched.
23801
23802 @item -bundle
23803 @opindex bundle
23804 Produce a Mach-o bundle format file.
23805 See man ld(1) for more information.
23806
23807 @item -bundle_loader @var{executable}
23808 @opindex bundle_loader
23809 This option specifies the @var{executable} that will load the build
23810 output file being linked. See man ld(1) for more information.
23811
23812 @item -dynamiclib
23813 @opindex dynamiclib
23814 When passed this option, GCC produces a dynamic library instead of
23815 an executable when linking, using the Darwin @file{libtool} command.
23816
23817 @item -force_cpusubtype_ALL
23818 @opindex force_cpusubtype_ALL
23819 This causes GCC's output file to have the @samp{ALL} subtype, instead of
23820 one controlled by the @option{-mcpu} or @option{-march} option.
23821
23822 @item -allowable_client @var{client_name}
23823 @itemx -client_name
23824 @itemx -compatibility_version
23825 @itemx -current_version
23826 @itemx -dead_strip
23827 @itemx -dependency-file
23828 @itemx -dylib_file
23829 @itemx -dylinker_install_name
23830 @itemx -dynamic
23831 @itemx -exported_symbols_list
23832 @itemx -filelist
23833 @need 800
23834 @itemx -flat_namespace
23835 @itemx -force_flat_namespace
23836 @itemx -headerpad_max_install_names
23837 @itemx -image_base
23838 @itemx -init
23839 @itemx -install_name
23840 @itemx -keep_private_externs
23841 @itemx -multi_module
23842 @itemx -multiply_defined
23843 @itemx -multiply_defined_unused
23844 @need 800
23845 @itemx -noall_load
23846 @itemx -no_dead_strip_inits_and_terms
23847 @itemx -nofixprebinding
23848 @itemx -nomultidefs
23849 @itemx -noprebind
23850 @itemx -noseglinkedit
23851 @itemx -pagezero_size
23852 @itemx -prebind
23853 @itemx -prebind_all_twolevel_modules
23854 @itemx -private_bundle
23855 @need 800
23856 @itemx -read_only_relocs
23857 @itemx -sectalign
23858 @itemx -sectobjectsymbols
23859 @itemx -whyload
23860 @itemx -seg1addr
23861 @itemx -sectcreate
23862 @itemx -sectobjectsymbols
23863 @itemx -sectorder
23864 @itemx -segaddr
23865 @itemx -segs_read_only_addr
23866 @need 800
23867 @itemx -segs_read_write_addr
23868 @itemx -seg_addr_table
23869 @itemx -seg_addr_table_filename
23870 @itemx -seglinkedit
23871 @itemx -segprot
23872 @itemx -segs_read_only_addr
23873 @itemx -segs_read_write_addr
23874 @itemx -single_module
23875 @itemx -static
23876 @itemx -sub_library
23877 @need 800
23878 @itemx -sub_umbrella
23879 @itemx -twolevel_namespace
23880 @itemx -umbrella
23881 @itemx -undefined
23882 @itemx -unexported_symbols_list
23883 @itemx -weak_reference_mismatches
23884 @itemx -whatsloaded
23885 @opindex allowable_client
23886 @opindex client_name
23887 @opindex compatibility_version
23888 @opindex current_version
23889 @opindex dead_strip
23890 @opindex dependency-file
23891 @opindex dylib_file
23892 @opindex dylinker_install_name
23893 @opindex dynamic
23894 @opindex exported_symbols_list
23895 @opindex filelist
23896 @opindex flat_namespace
23897 @opindex force_flat_namespace
23898 @opindex headerpad_max_install_names
23899 @opindex image_base
23900 @opindex init
23901 @opindex install_name
23902 @opindex keep_private_externs
23903 @opindex multi_module
23904 @opindex multiply_defined
23905 @opindex multiply_defined_unused
23906 @opindex noall_load
23907 @opindex no_dead_strip_inits_and_terms
23908 @opindex nofixprebinding
23909 @opindex nomultidefs
23910 @opindex noprebind
23911 @opindex noseglinkedit
23912 @opindex pagezero_size
23913 @opindex prebind
23914 @opindex prebind_all_twolevel_modules
23915 @opindex private_bundle
23916 @opindex read_only_relocs
23917 @opindex sectalign
23918 @opindex sectobjectsymbols
23919 @opindex whyload
23920 @opindex seg1addr
23921 @opindex sectcreate
23922 @opindex sectobjectsymbols
23923 @opindex sectorder
23924 @opindex segaddr
23925 @opindex segs_read_only_addr
23926 @opindex segs_read_write_addr
23927 @opindex seg_addr_table
23928 @opindex seg_addr_table_filename
23929 @opindex seglinkedit
23930 @opindex segprot
23931 @opindex segs_read_only_addr
23932 @opindex segs_read_write_addr
23933 @opindex single_module
23934 @opindex static
23935 @opindex sub_library
23936 @opindex sub_umbrella
23937 @opindex twolevel_namespace
23938 @opindex umbrella
23939 @opindex undefined
23940 @opindex unexported_symbols_list
23941 @opindex weak_reference_mismatches
23942 @opindex whatsloaded
23943 These options are passed to the Darwin linker. The Darwin linker man page
23944 describes them in detail.
23945 @end table
23946
23947 @node DEC Alpha Options
23948 @subsection DEC Alpha Options
23949
23950 These @samp{-m} options are defined for the DEC Alpha implementations:
23951
23952 @table @gcctabopt
23953 @item -mno-soft-float
23954 @itemx -msoft-float
23955 @opindex mno-soft-float
23956 @opindex msoft-float
23957 Use (do not use) the hardware floating-point instructions for
23958 floating-point operations. When @option{-msoft-float} is specified,
23959 functions in @file{libgcc.a} are used to perform floating-point
23960 operations. Unless they are replaced by routines that emulate the
23961 floating-point operations, or compiled in such a way as to call such
23962 emulations routines, these routines issue floating-point
23963 operations. If you are compiling for an Alpha without floating-point
23964 operations, you must ensure that the library is built so as not to call
23965 them.
23966
23967 Note that Alpha implementations without floating-point operations are
23968 required to have floating-point registers.
23969
23970 @item -mfp-reg
23971 @itemx -mno-fp-regs
23972 @opindex mfp-reg
23973 @opindex mno-fp-regs
23974 Generate code that uses (does not use) the floating-point register set.
23975 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
23976 register set is not used, floating-point operands are passed in integer
23977 registers as if they were integers and floating-point results are passed
23978 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
23979 so any function with a floating-point argument or return value called by code
23980 compiled with @option{-mno-fp-regs} must also be compiled with that
23981 option.
23982
23983 A typical use of this option is building a kernel that does not use,
23984 and hence need not save and restore, any floating-point registers.
23985
23986 @item -mieee
23987 @opindex mieee
23988 The Alpha architecture implements floating-point hardware optimized for
23989 maximum performance. It is mostly compliant with the IEEE floating-point
23990 standard. However, for full compliance, software assistance is
23991 required. This option generates code fully IEEE-compliant code
23992 @emph{except} that the @var{inexact-flag} is not maintained (see below).
23993 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
23994 defined during compilation. The resulting code is less efficient but is
23995 able to correctly support denormalized numbers and exceptional IEEE
23996 values such as not-a-number and plus/minus infinity. Other Alpha
23997 compilers call this option @option{-ieee_with_no_inexact}.
23998
23999 @item -mieee-with-inexact
24000 @opindex mieee-with-inexact
24001 This is like @option{-mieee} except the generated code also maintains
24002 the IEEE @var{inexact-flag}. Turning on this option causes the
24003 generated code to implement fully-compliant IEEE math. In addition to
24004 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24005 macro. On some Alpha implementations the resulting code may execute
24006 significantly slower than the code generated by default. Since there is
24007 very little code that depends on the @var{inexact-flag}, you should
24008 normally not specify this option. Other Alpha compilers call this
24009 option @option{-ieee_with_inexact}.
24010
24011 @item -mfp-trap-mode=@var{trap-mode}
24012 @opindex mfp-trap-mode
24013 This option controls what floating-point related traps are enabled.
24014 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24015 The trap mode can be set to one of four values:
24016
24017 @table @samp
24018 @item n
24019 This is the default (normal) setting. The only traps that are enabled
24020 are the ones that cannot be disabled in software (e.g., division by zero
24021 trap).
24022
24023 @item u
24024 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24025 as well.
24026
24027 @item su
24028 Like @samp{u}, but the instructions are marked to be safe for software
24029 completion (see Alpha architecture manual for details).
24030
24031 @item sui
24032 Like @samp{su}, but inexact traps are enabled as well.
24033 @end table
24034
24035 @item -mfp-rounding-mode=@var{rounding-mode}
24036 @opindex mfp-rounding-mode
24037 Selects the IEEE rounding mode. Other Alpha compilers call this option
24038 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
24039 of:
24040
24041 @table @samp
24042 @item n
24043 Normal IEEE rounding mode. Floating-point numbers are rounded towards
24044 the nearest machine number or towards the even machine number in case
24045 of a tie.
24046
24047 @item m
24048 Round towards minus infinity.
24049
24050 @item c
24051 Chopped rounding mode. Floating-point numbers are rounded towards zero.
24052
24053 @item d
24054 Dynamic rounding mode. A field in the floating-point control register
24055 (@var{fpcr}, see Alpha architecture reference manual) controls the
24056 rounding mode in effect. The C library initializes this register for
24057 rounding towards plus infinity. Thus, unless your program modifies the
24058 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24059 @end table
24060
24061 @item -mtrap-precision=@var{trap-precision}
24062 @opindex mtrap-precision
24063 In the Alpha architecture, floating-point traps are imprecise. This
24064 means without software assistance it is impossible to recover from a
24065 floating trap and program execution normally needs to be terminated.
24066 GCC can generate code that can assist operating system trap handlers
24067 in determining the exact location that caused a floating-point trap.
24068 Depending on the requirements of an application, different levels of
24069 precisions can be selected:
24070
24071 @table @samp
24072 @item p
24073 Program precision. This option is the default and means a trap handler
24074 can only identify which program caused a floating-point exception.
24075
24076 @item f
24077 Function precision. The trap handler can determine the function that
24078 caused a floating-point exception.
24079
24080 @item i
24081 Instruction precision. The trap handler can determine the exact
24082 instruction that caused a floating-point exception.
24083 @end table
24084
24085 Other Alpha compilers provide the equivalent options called
24086 @option{-scope_safe} and @option{-resumption_safe}.
24087
24088 @item -mieee-conformant
24089 @opindex mieee-conformant
24090 This option marks the generated code as IEEE conformant. You must not
24091 use this option unless you also specify @option{-mtrap-precision=i} and either
24092 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
24093 is to emit the line @samp{.eflag 48} in the function prologue of the
24094 generated assembly file.
24095
24096 @item -mbuild-constants
24097 @opindex mbuild-constants
24098 Normally GCC examines a 32- or 64-bit integer constant to
24099 see if it can construct it from smaller constants in two or three
24100 instructions. If it cannot, it outputs the constant as a literal and
24101 generates code to load it from the data segment at run time.
24102
24103 Use this option to require GCC to construct @emph{all} integer constants
24104 using code, even if it takes more instructions (the maximum is six).
24105
24106 You typically use this option to build a shared library dynamic
24107 loader. Itself a shared library, it must relocate itself in memory
24108 before it can find the variables and constants in its own data segment.
24109
24110 @item -mbwx
24111 @itemx -mno-bwx
24112 @itemx -mcix
24113 @itemx -mno-cix
24114 @itemx -mfix
24115 @itemx -mno-fix
24116 @itemx -mmax
24117 @itemx -mno-max
24118 @opindex mbwx
24119 @opindex mno-bwx
24120 @opindex mcix
24121 @opindex mno-cix
24122 @opindex mfix
24123 @opindex mno-fix
24124 @opindex mmax
24125 @opindex mno-max
24126 Indicate whether GCC should generate code to use the optional BWX,
24127 CIX, FIX and MAX instruction sets. The default is to use the instruction
24128 sets supported by the CPU type specified via @option{-mcpu=} option or that
24129 of the CPU on which GCC was built if none is specified.
24130
24131 @item -mfloat-vax
24132 @itemx -mfloat-ieee
24133 @opindex mfloat-vax
24134 @opindex mfloat-ieee
24135 Generate code that uses (does not use) VAX F and G floating-point
24136 arithmetic instead of IEEE single and double precision.
24137
24138 @item -mexplicit-relocs
24139 @itemx -mno-explicit-relocs
24140 @opindex mexplicit-relocs
24141 @opindex mno-explicit-relocs
24142 Older Alpha assemblers provided no way to generate symbol relocations
24143 except via assembler macros. Use of these macros does not allow
24144 optimal instruction scheduling. GNU binutils as of version 2.12
24145 supports a new syntax that allows the compiler to explicitly mark
24146 which relocations should apply to which instructions. This option
24147 is mostly useful for debugging, as GCC detects the capabilities of
24148 the assembler when it is built and sets the default accordingly.
24149
24150 @item -msmall-data
24151 @itemx -mlarge-data
24152 @opindex msmall-data
24153 @opindex mlarge-data
24154 When @option{-mexplicit-relocs} is in effect, static data is
24155 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
24156 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24157 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24158 16-bit relocations off of the @code{$gp} register. This limits the
24159 size of the small data area to 64KB, but allows the variables to be
24160 directly accessed via a single instruction.
24161
24162 The default is @option{-mlarge-data}. With this option the data area
24163 is limited to just below 2GB@. Programs that require more than 2GB of
24164 data must use @code{malloc} or @code{mmap} to allocate the data in the
24165 heap instead of in the program's data segment.
24166
24167 When generating code for shared libraries, @option{-fpic} implies
24168 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24169
24170 @item -msmall-text
24171 @itemx -mlarge-text
24172 @opindex msmall-text
24173 @opindex mlarge-text
24174 When @option{-msmall-text} is used, the compiler assumes that the
24175 code of the entire program (or shared library) fits in 4MB, and is
24176 thus reachable with a branch instruction. When @option{-msmall-data}
24177 is used, the compiler can assume that all local symbols share the
24178 same @code{$gp} value, and thus reduce the number of instructions
24179 required for a function call from 4 to 1.
24180
24181 The default is @option{-mlarge-text}.
24182
24183 @item -mcpu=@var{cpu_type}
24184 @opindex mcpu
24185 Set the instruction set and instruction scheduling parameters for
24186 machine type @var{cpu_type}. You can specify either the @samp{EV}
24187 style name or the corresponding chip number. GCC supports scheduling
24188 parameters for the EV4, EV5 and EV6 family of processors and
24189 chooses the default values for the instruction set from the processor
24190 you specify. If you do not specify a processor type, GCC defaults
24191 to the processor on which the compiler was built.
24192
24193 Supported values for @var{cpu_type} are
24194
24195 @table @samp
24196 @item ev4
24197 @itemx ev45
24198 @itemx 21064
24199 Schedules as an EV4 and has no instruction set extensions.
24200
24201 @item ev5
24202 @itemx 21164
24203 Schedules as an EV5 and has no instruction set extensions.
24204
24205 @item ev56
24206 @itemx 21164a
24207 Schedules as an EV5 and supports the BWX extension.
24208
24209 @item pca56
24210 @itemx 21164pc
24211 @itemx 21164PC
24212 Schedules as an EV5 and supports the BWX and MAX extensions.
24213
24214 @item ev6
24215 @itemx 21264
24216 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24217
24218 @item ev67
24219 @itemx 21264a
24220 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24221 @end table
24222
24223 Native toolchains also support the value @samp{native},
24224 which selects the best architecture option for the host processor.
24225 @option{-mcpu=native} has no effect if GCC does not recognize
24226 the processor.
24227
24228 @item -mtune=@var{cpu_type}
24229 @opindex mtune
24230 Set only the instruction scheduling parameters for machine type
24231 @var{cpu_type}. The instruction set is not changed.
24232
24233 Native toolchains also support the value @samp{native},
24234 which selects the best architecture option for the host processor.
24235 @option{-mtune=native} has no effect if GCC does not recognize
24236 the processor.
24237
24238 @item -mmemory-latency=@var{time}
24239 @opindex mmemory-latency
24240 Sets the latency the scheduler should assume for typical memory
24241 references as seen by the application. This number is highly
24242 dependent on the memory access patterns used by the application
24243 and the size of the external cache on the machine.
24244
24245 Valid options for @var{time} are
24246
24247 @table @samp
24248 @item @var{number}
24249 A decimal number representing clock cycles.
24250
24251 @item L1
24252 @itemx L2
24253 @itemx L3
24254 @itemx main
24255 The compiler contains estimates of the number of clock cycles for
24256 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24257 (also called Dcache, Scache, and Bcache), as well as to main memory.
24258 Note that L3 is only valid for EV5.
24259
24260 @end table
24261 @end table
24262
24263 @node eBPF Options
24264 @subsection eBPF Options
24265 @cindex eBPF Options
24266
24267 @table @gcctabopt
24268 @item -mframe-limit=@var{bytes}
24269 This specifies the hard limit for frame sizes, in bytes. Currently,
24270 the value that can be specified should be less than or equal to
24271 @samp{32767}. Defaults to whatever limit is imposed by the version of
24272 the Linux kernel targeted.
24273
24274 @item -mkernel=@var{version}
24275 @opindex mkernel
24276 This specifies the minimum version of the kernel that will run the
24277 compiled program. GCC uses this version to determine which
24278 instructions to use, what kernel helpers to allow, etc. Currently,
24279 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
24280 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
24281 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
24282 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
24283 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
24284 @samp{5.2}, @samp{latest} and @samp{native}.
24285
24286 @item -mbig-endian
24287 @opindex mbig-endian
24288 Generate code for a big-endian target.
24289
24290 @item -mlittle-endian
24291 @opindex mlittle-endian
24292 Generate code for a little-endian target. This is the default.
24293
24294 @item -mjmpext
24295 @opindex mjmpext
24296 Enable generation of extra conditional-branch instructions.
24297 Enabled for CPU v2 and above.
24298
24299 @item -mjmp32
24300 @opindex mjmp32
24301 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
24302
24303 @item -malu32
24304 @opindex malu32
24305 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
24306
24307 @item -mcpu=@var{version}
24308 @opindex mcpu
24309 This specifies which version of the eBPF ISA to target. Newer versions
24310 may not be supported by all kernels. The default is @samp{v3}.
24311
24312 Supported values for @var{version} are:
24313
24314 @table @samp
24315 @item v1
24316 The first stable eBPF ISA with no special features or extensions.
24317
24318 @item v2
24319 Supports the jump extensions, as in @option{-mjmpext}.
24320
24321 @item v3
24322 All features of v2, plus:
24323 @itemize @minus
24324 @item 32-bit jump operations, as in @option{-mjmp32}
24325 @item 32-bit ALU operations, as in @option{-malu32}
24326 @end itemize
24327
24328 @end table
24329
24330 @item -mco-re
24331 @opindex mco-re
24332 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24333 is implied by @option{-gbtf}.
24334
24335 @item -mno-co-re
24336 @opindex mno-co-re
24337 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24338 support is enabled by default when generating BTF debug information for
24339 the BPF target.
24340
24341 @item -mxbpf
24342 Generate code for an expanded version of BPF, which relaxes some of
24343 the restrictions imposed by the BPF architecture:
24344 @itemize @minus
24345 @item Save and restore callee-saved registers at function entry and
24346 exit, respectively.
24347 @end itemize
24348 @end table
24349
24350 @node FR30 Options
24351 @subsection FR30 Options
24352 @cindex FR30 Options
24353
24354 These options are defined specifically for the FR30 port.
24355
24356 @table @gcctabopt
24357
24358 @item -msmall-model
24359 @opindex msmall-model
24360 Use the small address space model. This can produce smaller code, but
24361 it does assume that all symbolic values and addresses fit into a
24362 20-bit range.
24363
24364 @item -mno-lsim
24365 @opindex mno-lsim
24366 Assume that runtime support has been provided and so there is no need
24367 to include the simulator library (@file{libsim.a}) on the linker
24368 command line.
24369
24370 @end table
24371
24372 @node FT32 Options
24373 @subsection FT32 Options
24374 @cindex FT32 Options
24375
24376 These options are defined specifically for the FT32 port.
24377
24378 @table @gcctabopt
24379
24380 @item -msim
24381 @opindex msim
24382 Specifies that the program will be run on the simulator. This causes
24383 an alternate runtime startup and library to be linked.
24384 You must not use this option when generating programs that will run on
24385 real hardware; you must provide your own runtime library for whatever
24386 I/O functions are needed.
24387
24388 @item -mlra
24389 @opindex mlra
24390 Enable Local Register Allocation. This is still experimental for FT32,
24391 so by default the compiler uses standard reload.
24392
24393 @item -mnodiv
24394 @opindex mnodiv
24395 Do not use div and mod instructions.
24396
24397 @item -mft32b
24398 @opindex mft32b
24399 Enable use of the extended instructions of the FT32B processor.
24400
24401 @item -mcompress
24402 @opindex mcompress
24403 Compress all code using the Ft32B code compression scheme.
24404
24405 @item -mnopm
24406 @opindex mnopm
24407 Do not generate code that reads program memory.
24408
24409 @end table
24410
24411 @node FRV Options
24412 @subsection FRV Options
24413 @cindex FRV Options
24414
24415 @table @gcctabopt
24416 @item -mgpr-32
24417 @opindex mgpr-32
24418
24419 Only use the first 32 general-purpose registers.
24420
24421 @item -mgpr-64
24422 @opindex mgpr-64
24423
24424 Use all 64 general-purpose registers.
24425
24426 @item -mfpr-32
24427 @opindex mfpr-32
24428
24429 Use only the first 32 floating-point registers.
24430
24431 @item -mfpr-64
24432 @opindex mfpr-64
24433
24434 Use all 64 floating-point registers.
24435
24436 @item -mhard-float
24437 @opindex mhard-float
24438
24439 Use hardware instructions for floating-point operations.
24440
24441 @item -msoft-float
24442 @opindex msoft-float
24443
24444 Use library routines for floating-point operations.
24445
24446 @item -malloc-cc
24447 @opindex malloc-cc
24448
24449 Dynamically allocate condition code registers.
24450
24451 @item -mfixed-cc
24452 @opindex mfixed-cc
24453
24454 Do not try to dynamically allocate condition code registers, only
24455 use @code{icc0} and @code{fcc0}.
24456
24457 @item -mdword
24458 @opindex mdword
24459
24460 Change ABI to use double word insns.
24461
24462 @item -mno-dword
24463 @opindex mno-dword
24464 @opindex mdword
24465
24466 Do not use double word instructions.
24467
24468 @item -mdouble
24469 @opindex mdouble
24470
24471 Use floating-point double instructions.
24472
24473 @item -mno-double
24474 @opindex mno-double
24475
24476 Do not use floating-point double instructions.
24477
24478 @item -mmedia
24479 @opindex mmedia
24480
24481 Use media instructions.
24482
24483 @item -mno-media
24484 @opindex mno-media
24485
24486 Do not use media instructions.
24487
24488 @item -mmuladd
24489 @opindex mmuladd
24490
24491 Use multiply and add/subtract instructions.
24492
24493 @item -mno-muladd
24494 @opindex mno-muladd
24495
24496 Do not use multiply and add/subtract instructions.
24497
24498 @item -mfdpic
24499 @opindex mfdpic
24500
24501 Select the FDPIC ABI, which uses function descriptors to represent
24502 pointers to functions. Without any PIC/PIE-related options, it
24503 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
24504 assumes GOT entries and small data are within a 12-bit range from the
24505 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
24506 are computed with 32 bits.
24507 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24508
24509 @item -minline-plt
24510 @opindex minline-plt
24511
24512 Enable inlining of PLT entries in function calls to functions that are
24513 not known to bind locally. It has no effect without @option{-mfdpic}.
24514 It's enabled by default if optimizing for speed and compiling for
24515 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
24516 optimization option such as @option{-O3} or above is present in the
24517 command line.
24518
24519 @item -mTLS
24520 @opindex mTLS
24521
24522 Assume a large TLS segment when generating thread-local code.
24523
24524 @item -mtls
24525 @opindex mtls
24526
24527 Do not assume a large TLS segment when generating thread-local code.
24528
24529 @item -mgprel-ro
24530 @opindex mgprel-ro
24531
24532 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
24533 that is known to be in read-only sections. It's enabled by default,
24534 except for @option{-fpic} or @option{-fpie}: even though it may help
24535 make the global offset table smaller, it trades 1 instruction for 4.
24536 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
24537 one of which may be shared by multiple symbols, and it avoids the need
24538 for a GOT entry for the referenced symbol, so it's more likely to be a
24539 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
24540
24541 @item -multilib-library-pic
24542 @opindex multilib-library-pic
24543
24544 Link with the (library, not FD) pic libraries. It's implied by
24545 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
24546 @option{-fpic} without @option{-mfdpic}. You should never have to use
24547 it explicitly.
24548
24549 @item -mlinked-fp
24550 @opindex mlinked-fp
24551
24552 Follow the EABI requirement of always creating a frame pointer whenever
24553 a stack frame is allocated. This option is enabled by default and can
24554 be disabled with @option{-mno-linked-fp}.
24555
24556 @item -mlong-calls
24557 @opindex mlong-calls
24558
24559 Use indirect addressing to call functions outside the current
24560 compilation unit. This allows the functions to be placed anywhere
24561 within the 32-bit address space.
24562
24563 @item -malign-labels
24564 @opindex malign-labels
24565
24566 Try to align labels to an 8-byte boundary by inserting NOPs into the
24567 previous packet. This option only has an effect when VLIW packing
24568 is enabled. It doesn't create new packets; it merely adds NOPs to
24569 existing ones.
24570
24571 @item -mlibrary-pic
24572 @opindex mlibrary-pic
24573
24574 Generate position-independent EABI code.
24575
24576 @item -macc-4
24577 @opindex macc-4
24578
24579 Use only the first four media accumulator registers.
24580
24581 @item -macc-8
24582 @opindex macc-8
24583
24584 Use all eight media accumulator registers.
24585
24586 @item -mpack
24587 @opindex mpack
24588
24589 Pack VLIW instructions.
24590
24591 @item -mno-pack
24592 @opindex mno-pack
24593
24594 Do not pack VLIW instructions.
24595
24596 @item -mno-eflags
24597 @opindex mno-eflags
24598
24599 Do not mark ABI switches in e_flags.
24600
24601 @item -mcond-move
24602 @opindex mcond-move
24603
24604 Enable the use of conditional-move instructions (default).
24605
24606 This switch is mainly for debugging the compiler and will likely be removed
24607 in a future version.
24608
24609 @item -mno-cond-move
24610 @opindex mno-cond-move
24611
24612 Disable the use of conditional-move instructions.
24613
24614 This switch is mainly for debugging the compiler and will likely be removed
24615 in a future version.
24616
24617 @item -mscc
24618 @opindex mscc
24619
24620 Enable the use of conditional set instructions (default).
24621
24622 This switch is mainly for debugging the compiler and will likely be removed
24623 in a future version.
24624
24625 @item -mno-scc
24626 @opindex mno-scc
24627
24628 Disable the use of conditional set instructions.
24629
24630 This switch is mainly for debugging the compiler and will likely be removed
24631 in a future version.
24632
24633 @item -mcond-exec
24634 @opindex mcond-exec
24635
24636 Enable the use of conditional execution (default).
24637
24638 This switch is mainly for debugging the compiler and will likely be removed
24639 in a future version.
24640
24641 @item -mno-cond-exec
24642 @opindex mno-cond-exec
24643
24644 Disable the use of conditional execution.
24645
24646 This switch is mainly for debugging the compiler and will likely be removed
24647 in a future version.
24648
24649 @item -mvliw-branch
24650 @opindex mvliw-branch
24651
24652 Run a pass to pack branches into VLIW instructions (default).
24653
24654 This switch is mainly for debugging the compiler and will likely be removed
24655 in a future version.
24656
24657 @item -mno-vliw-branch
24658 @opindex mno-vliw-branch
24659
24660 Do not run a pass to pack branches into VLIW instructions.
24661
24662 This switch is mainly for debugging the compiler and will likely be removed
24663 in a future version.
24664
24665 @item -mmulti-cond-exec
24666 @opindex mmulti-cond-exec
24667
24668 Enable optimization of @code{&&} and @code{||} in conditional execution
24669 (default).
24670
24671 This switch is mainly for debugging the compiler and will likely be removed
24672 in a future version.
24673
24674 @item -mno-multi-cond-exec
24675 @opindex mno-multi-cond-exec
24676
24677 Disable optimization of @code{&&} and @code{||} in conditional execution.
24678
24679 This switch is mainly for debugging the compiler and will likely be removed
24680 in a future version.
24681
24682 @item -mnested-cond-exec
24683 @opindex mnested-cond-exec
24684
24685 Enable nested conditional execution optimizations (default).
24686
24687 This switch is mainly for debugging the compiler and will likely be removed
24688 in a future version.
24689
24690 @item -mno-nested-cond-exec
24691 @opindex mno-nested-cond-exec
24692
24693 Disable nested conditional execution optimizations.
24694
24695 This switch is mainly for debugging the compiler and will likely be removed
24696 in a future version.
24697
24698 @item -moptimize-membar
24699 @opindex moptimize-membar
24700
24701 This switch removes redundant @code{membar} instructions from the
24702 compiler-generated code. It is enabled by default.
24703
24704 @item -mno-optimize-membar
24705 @opindex mno-optimize-membar
24706 @opindex moptimize-membar
24707
24708 This switch disables the automatic removal of redundant @code{membar}
24709 instructions from the generated code.
24710
24711 @item -mtomcat-stats
24712 @opindex mtomcat-stats
24713
24714 Cause gas to print out tomcat statistics.
24715
24716 @item -mcpu=@var{cpu}
24717 @opindex mcpu
24718
24719 Select the processor type for which to generate code. Possible values are
24720 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
24721 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
24722
24723 @end table
24724
24725 @node GNU/Linux Options
24726 @subsection GNU/Linux Options
24727
24728 These @samp{-m} options are defined for GNU/Linux targets:
24729
24730 @table @gcctabopt
24731 @item -mglibc
24732 @opindex mglibc
24733 Use the GNU C library. This is the default except
24734 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
24735 @samp{*-*-linux-*android*} targets.
24736
24737 @item -muclibc
24738 @opindex muclibc
24739 Use uClibc C library. This is the default on
24740 @samp{*-*-linux-*uclibc*} targets.
24741
24742 @item -mmusl
24743 @opindex mmusl
24744 Use the musl C library. This is the default on
24745 @samp{*-*-linux-*musl*} targets.
24746
24747 @item -mbionic
24748 @opindex mbionic
24749 Use Bionic C library. This is the default on
24750 @samp{*-*-linux-*android*} targets.
24751
24752 @item -mandroid
24753 @opindex mandroid
24754 Compile code compatible with Android platform. This is the default on
24755 @samp{*-*-linux-*android*} targets.
24756
24757 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
24758 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
24759 this option makes the GCC driver pass Android-specific options to the linker.
24760 Finally, this option causes the preprocessor macro @code{__ANDROID__}
24761 to be defined.
24762
24763 @item -tno-android-cc
24764 @opindex tno-android-cc
24765 Disable compilation effects of @option{-mandroid}, i.e., do not enable
24766 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
24767 @option{-fno-rtti} by default.
24768
24769 @item -tno-android-ld
24770 @opindex tno-android-ld
24771 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
24772 linking options to the linker.
24773
24774 @end table
24775
24776 @node H8/300 Options
24777 @subsection H8/300 Options
24778
24779 These @samp{-m} options are defined for the H8/300 implementations:
24780
24781 @table @gcctabopt
24782 @item -mrelax
24783 @opindex mrelax
24784 Shorten some address references at link time, when possible; uses the
24785 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
24786 ld, Using ld}, for a fuller description.
24787
24788 @item -mh
24789 @opindex mh
24790 Generate code for the H8/300H@.
24791
24792 @item -ms
24793 @opindex ms
24794 Generate code for the H8S@.
24795
24796 @item -mn
24797 @opindex mn
24798 Generate code for the H8S and H8/300H in the normal mode. This switch
24799 must be used either with @option{-mh} or @option{-ms}.
24800
24801 @item -ms2600
24802 @opindex ms2600
24803 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
24804
24805 @item -mexr
24806 @opindex mexr
24807 Extended registers are stored on stack before execution of function
24808 with monitor attribute. Default option is @option{-mexr}.
24809 This option is valid only for H8S targets.
24810
24811 @item -mno-exr
24812 @opindex mno-exr
24813 @opindex mexr
24814 Extended registers are not stored on stack before execution of function
24815 with monitor attribute. Default option is @option{-mno-exr}.
24816 This option is valid only for H8S targets.
24817
24818 @item -mint32
24819 @opindex mint32
24820 Make @code{int} data 32 bits by default.
24821
24822 @item -malign-300
24823 @opindex malign-300
24824 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
24825 The default for the H8/300H and H8S is to align longs and floats on
24826 4-byte boundaries.
24827 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
24828 This option has no effect on the H8/300.
24829 @end table
24830
24831 @node HPPA Options
24832 @subsection HPPA Options
24833 @cindex HPPA Options
24834
24835 These @samp{-m} options are defined for the HPPA family of computers:
24836
24837 @table @gcctabopt
24838 @item -march=@var{architecture-type}
24839 @opindex march
24840 Generate code for the specified architecture. The choices for
24841 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
24842 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
24843 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
24844 architecture option for your machine. Code compiled for lower numbered
24845 architectures runs on higher numbered architectures, but not the
24846 other way around.
24847
24848 @item -mpa-risc-1-0
24849 @itemx -mpa-risc-1-1
24850 @itemx -mpa-risc-2-0
24851 @opindex mpa-risc-1-0
24852 @opindex mpa-risc-1-1
24853 @opindex mpa-risc-2-0
24854 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
24855
24856 @item -mcaller-copies
24857 @opindex mcaller-copies
24858 The caller copies function arguments passed by hidden reference. This
24859 option should be used with care as it is not compatible with the default
24860 32-bit runtime. However, only aggregates larger than eight bytes are
24861 passed by hidden reference and the option provides better compatibility
24862 with OpenMP.
24863
24864 @item -mjump-in-delay
24865 @opindex mjump-in-delay
24866 This option is ignored and provided for compatibility purposes only.
24867
24868 @item -mdisable-fpregs
24869 @opindex mdisable-fpregs
24870 Prevent floating-point registers from being used in any manner. This is
24871 necessary for compiling kernels that perform lazy context switching of
24872 floating-point registers. If you use this option and attempt to perform
24873 floating-point operations, the compiler aborts.
24874
24875 @item -mdisable-indexing
24876 @opindex mdisable-indexing
24877 Prevent the compiler from using indexing address modes. This avoids some
24878 rather obscure problems when compiling MIG generated code under MACH@.
24879
24880 @item -mno-space-regs
24881 @opindex mno-space-regs
24882 @opindex mspace-regs
24883 Generate code that assumes the target has no space registers. This allows
24884 GCC to generate faster indirect calls and use unscaled index address modes.
24885
24886 Such code is suitable for level 0 PA systems and kernels.
24887
24888 @item -mfast-indirect-calls
24889 @opindex mfast-indirect-calls
24890 Generate code that assumes calls never cross space boundaries. This
24891 allows GCC to emit code that performs faster indirect calls.
24892
24893 This option does not work in the presence of shared libraries or nested
24894 functions.
24895
24896 @item -mfixed-range=@var{register-range}
24897 @opindex mfixed-range
24898 Generate code treating the given register range as fixed registers.
24899 A fixed register is one that the register allocator cannot use. This is
24900 useful when compiling kernel code. A register range is specified as
24901 two registers separated by a dash. Multiple register ranges can be
24902 specified separated by a comma.
24903
24904 @item -mlong-load-store
24905 @opindex mlong-load-store
24906 Generate 3-instruction load and store sequences as sometimes required by
24907 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
24908 the HP compilers.
24909
24910 @item -mportable-runtime
24911 @opindex mportable-runtime
24912 Use the portable calling conventions proposed by HP for ELF systems.
24913
24914 @item -mgas
24915 @opindex mgas
24916 Enable the use of assembler directives only GAS understands.
24917
24918 @item -mschedule=@var{cpu-type}
24919 @opindex mschedule
24920 Schedule code according to the constraints for the machine type
24921 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
24922 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
24923 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
24924 proper scheduling option for your machine. The default scheduling is
24925 @samp{8000}.
24926
24927 @item -mlinker-opt
24928 @opindex mlinker-opt
24929 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
24930 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
24931 linkers in which they give bogus error messages when linking some programs.
24932
24933 @item -msoft-float
24934 @opindex msoft-float
24935 Generate output containing library calls for floating point.
24936 @strong{Warning:} the requisite libraries are not available for all HPPA
24937 targets. Normally the facilities of the machine's usual C compiler are
24938 used, but this cannot be done directly in cross-compilation. You must make
24939 your own arrangements to provide suitable library functions for
24940 cross-compilation.
24941
24942 @option{-msoft-float} changes the calling convention in the output file;
24943 therefore, it is only useful if you compile @emph{all} of a program with
24944 this option. In particular, you need to compile @file{libgcc.a}, the
24945 library that comes with GCC, with @option{-msoft-float} in order for
24946 this to work.
24947
24948 @item -msio
24949 @opindex msio
24950 Generate the predefine, @code{_SIO}, for server IO@. The default is
24951 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
24952 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
24953 options are available under HP-UX and HI-UX@.
24954
24955 @item -mgnu-ld
24956 @opindex mgnu-ld
24957 Use options specific to GNU @command{ld}.
24958 This passes @option{-shared} to @command{ld} when
24959 building a shared library. It is the default when GCC is configured,
24960 explicitly or implicitly, with the GNU linker. This option does not
24961 affect which @command{ld} is called; it only changes what parameters
24962 are passed to that @command{ld}.
24963 The @command{ld} that is called is determined by the
24964 @option{--with-ld} configure option, GCC's program search path, and
24965 finally by the user's @env{PATH}. The linker used by GCC can be printed
24966 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
24967 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
24968
24969 @item -mhp-ld
24970 @opindex mhp-ld
24971 Use options specific to HP @command{ld}.
24972 This passes @option{-b} to @command{ld} when building
24973 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
24974 links. It is the default when GCC is configured, explicitly or
24975 implicitly, with the HP linker. This option does not affect
24976 which @command{ld} is called; it only changes what parameters are passed to that
24977 @command{ld}.
24978 The @command{ld} that is called is determined by the @option{--with-ld}
24979 configure option, GCC's program search path, and finally by the user's
24980 @env{PATH}. The linker used by GCC can be printed using @samp{which
24981 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
24982 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
24983
24984 @item -mlong-calls
24985 @opindex mno-long-calls
24986 @opindex mlong-calls
24987 Generate code that uses long call sequences. This ensures that a call
24988 is always able to reach linker generated stubs. The default is to generate
24989 long calls only when the distance from the call site to the beginning
24990 of the function or translation unit, as the case may be, exceeds a
24991 predefined limit set by the branch type being used. The limits for
24992 normal calls are 7,600,000 and 240,000 bytes, respectively for the
24993 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
24994 240,000 bytes.
24995
24996 Distances are measured from the beginning of functions when using the
24997 @option{-ffunction-sections} option, or when using the @option{-mgas}
24998 and @option{-mno-portable-runtime} options together under HP-UX with
24999 the SOM linker.
25000
25001 It is normally not desirable to use this option as it degrades
25002 performance. However, it may be useful in large applications,
25003 particularly when partial linking is used to build the application.
25004
25005 The types of long calls used depends on the capabilities of the
25006 assembler and linker, and the type of code being generated. The
25007 impact on systems that support long absolute calls, and long pic
25008 symbol-difference or pc-relative calls should be relatively small.
25009 However, an indirect call is used on 32-bit ELF systems in pic code
25010 and it is quite long.
25011
25012 @item -munix=@var{unix-std}
25013 @opindex march
25014 Generate compiler predefines and select a startfile for the specified
25015 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
25016 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
25017 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
25018 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
25019 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25020 and later.
25021
25022 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25023 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25024 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25025 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25026 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25027 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25028
25029 It is @emph{important} to note that this option changes the interfaces
25030 for various library routines. It also affects the operational behavior
25031 of the C library. Thus, @emph{extreme} care is needed in using this
25032 option.
25033
25034 Library code that is intended to operate with more than one UNIX
25035 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25036 as appropriate. Most GNU software doesn't provide this capability.
25037
25038 @item -nolibdld
25039 @opindex nolibdld
25040 Suppress the generation of link options to search libdld.sl when the
25041 @option{-static} option is specified on HP-UX 10 and later.
25042
25043 @item -static
25044 @opindex static
25045 The HP-UX implementation of setlocale in libc has a dependency on
25046 libdld.sl. There isn't an archive version of libdld.sl. Thus,
25047 when the @option{-static} option is specified, special link options
25048 are needed to resolve this dependency.
25049
25050 On HP-UX 10 and later, the GCC driver adds the necessary options to
25051 link with libdld.sl when the @option{-static} option is specified.
25052 This causes the resulting binary to be dynamic. On the 64-bit port,
25053 the linkers generate dynamic binaries by default in any case. The
25054 @option{-nolibdld} option can be used to prevent the GCC driver from
25055 adding these link options.
25056
25057 @item -threads
25058 @opindex threads
25059 Add support for multithreading with the @dfn{dce thread} library
25060 under HP-UX@. This option sets flags for both the preprocessor and
25061 linker.
25062 @end table
25063
25064 @node IA-64 Options
25065 @subsection IA-64 Options
25066 @cindex IA-64 Options
25067
25068 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25069
25070 @table @gcctabopt
25071 @item -mbig-endian
25072 @opindex mbig-endian
25073 Generate code for a big-endian target. This is the default for HP-UX@.
25074
25075 @item -mlittle-endian
25076 @opindex mlittle-endian
25077 Generate code for a little-endian target. This is the default for AIX5
25078 and GNU/Linux.
25079
25080 @item -mgnu-as
25081 @itemx -mno-gnu-as
25082 @opindex mgnu-as
25083 @opindex mno-gnu-as
25084 Generate (or don't) code for the GNU assembler. This is the default.
25085 @c Also, this is the default if the configure option @option{--with-gnu-as}
25086 @c is used.
25087
25088 @item -mgnu-ld
25089 @itemx -mno-gnu-ld
25090 @opindex mgnu-ld
25091 @opindex mno-gnu-ld
25092 Generate (or don't) code for the GNU linker. This is the default.
25093 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25094 @c is used.
25095
25096 @item -mno-pic
25097 @opindex mno-pic
25098 Generate code that does not use a global pointer register. The result
25099 is not position independent code, and violates the IA-64 ABI@.
25100
25101 @item -mvolatile-asm-stop
25102 @itemx -mno-volatile-asm-stop
25103 @opindex mvolatile-asm-stop
25104 @opindex mno-volatile-asm-stop
25105 Generate (or don't) a stop bit immediately before and after volatile asm
25106 statements.
25107
25108 @item -mregister-names
25109 @itemx -mno-register-names
25110 @opindex mregister-names
25111 @opindex mno-register-names
25112 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25113 the stacked registers. This may make assembler output more readable.
25114
25115 @item -mno-sdata
25116 @itemx -msdata
25117 @opindex mno-sdata
25118 @opindex msdata
25119 Disable (or enable) optimizations that use the small data section. This may
25120 be useful for working around optimizer bugs.
25121
25122 @item -mconstant-gp
25123 @opindex mconstant-gp
25124 Generate code that uses a single constant global pointer value. This is
25125 useful when compiling kernel code.
25126
25127 @item -mauto-pic
25128 @opindex mauto-pic
25129 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
25130 This is useful when compiling firmware code.
25131
25132 @item -minline-float-divide-min-latency
25133 @opindex minline-float-divide-min-latency
25134 Generate code for inline divides of floating-point values
25135 using the minimum latency algorithm.
25136
25137 @item -minline-float-divide-max-throughput
25138 @opindex minline-float-divide-max-throughput
25139 Generate code for inline divides of floating-point values
25140 using the maximum throughput algorithm.
25141
25142 @item -mno-inline-float-divide
25143 @opindex mno-inline-float-divide
25144 Do not generate inline code for divides of floating-point values.
25145
25146 @item -minline-int-divide-min-latency
25147 @opindex minline-int-divide-min-latency
25148 Generate code for inline divides of integer values
25149 using the minimum latency algorithm.
25150
25151 @item -minline-int-divide-max-throughput
25152 @opindex minline-int-divide-max-throughput
25153 Generate code for inline divides of integer values
25154 using the maximum throughput algorithm.
25155
25156 @item -mno-inline-int-divide
25157 @opindex mno-inline-int-divide
25158 @opindex minline-int-divide
25159 Do not generate inline code for divides of integer values.
25160
25161 @item -minline-sqrt-min-latency
25162 @opindex minline-sqrt-min-latency
25163 Generate code for inline square roots
25164 using the minimum latency algorithm.
25165
25166 @item -minline-sqrt-max-throughput
25167 @opindex minline-sqrt-max-throughput
25168 Generate code for inline square roots
25169 using the maximum throughput algorithm.
25170
25171 @item -mno-inline-sqrt
25172 @opindex mno-inline-sqrt
25173 Do not generate inline code for @code{sqrt}.
25174
25175 @item -mfused-madd
25176 @itemx -mno-fused-madd
25177 @opindex mfused-madd
25178 @opindex mno-fused-madd
25179 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25180 instructions. The default is to use these instructions.
25181
25182 @item -mno-dwarf2-asm
25183 @itemx -mdwarf2-asm
25184 @opindex mno-dwarf2-asm
25185 @opindex mdwarf2-asm
25186 Don't (or do) generate assembler code for the DWARF line number debugging
25187 info. This may be useful when not using the GNU assembler.
25188
25189 @item -mearly-stop-bits
25190 @itemx -mno-early-stop-bits
25191 @opindex mearly-stop-bits
25192 @opindex mno-early-stop-bits
25193 Allow stop bits to be placed earlier than immediately preceding the
25194 instruction that triggered the stop bit. This can improve instruction
25195 scheduling, but does not always do so.
25196
25197 @item -mfixed-range=@var{register-range}
25198 @opindex mfixed-range
25199 Generate code treating the given register range as fixed registers.
25200 A fixed register is one that the register allocator cannot use. This is
25201 useful when compiling kernel code. A register range is specified as
25202 two registers separated by a dash. Multiple register ranges can be
25203 specified separated by a comma.
25204
25205 @item -mtls-size=@var{tls-size}
25206 @opindex mtls-size
25207 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
25208 64.
25209
25210 @item -mtune=@var{cpu-type}
25211 @opindex mtune
25212 Tune the instruction scheduling for a particular CPU, Valid values are
25213 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25214 and @samp{mckinley}.
25215
25216 @item -milp32
25217 @itemx -mlp64
25218 @opindex milp32
25219 @opindex mlp64
25220 Generate code for a 32-bit or 64-bit environment.
25221 The 32-bit environment sets int, long and pointer to 32 bits.
25222 The 64-bit environment sets int to 32 bits and long and pointer
25223 to 64 bits. These are HP-UX specific flags.
25224
25225 @item -mno-sched-br-data-spec
25226 @itemx -msched-br-data-spec
25227 @opindex mno-sched-br-data-spec
25228 @opindex msched-br-data-spec
25229 (Dis/En)able data speculative scheduling before reload.
25230 This results in generation of @code{ld.a} instructions and
25231 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25232 The default setting is disabled.
25233
25234 @item -msched-ar-data-spec
25235 @itemx -mno-sched-ar-data-spec
25236 @opindex msched-ar-data-spec
25237 @opindex mno-sched-ar-data-spec
25238 (En/Dis)able data speculative scheduling after reload.
25239 This results in generation of @code{ld.a} instructions and
25240 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25241 The default setting is enabled.
25242
25243 @item -mno-sched-control-spec
25244 @itemx -msched-control-spec
25245 @opindex mno-sched-control-spec
25246 @opindex msched-control-spec
25247 (Dis/En)able control speculative scheduling. This feature is
25248 available only during region scheduling (i.e.@: before reload).
25249 This results in generation of the @code{ld.s} instructions and
25250 the corresponding check instructions @code{chk.s}.
25251 The default setting is disabled.
25252
25253 @item -msched-br-in-data-spec
25254 @itemx -mno-sched-br-in-data-spec
25255 @opindex msched-br-in-data-spec
25256 @opindex mno-sched-br-in-data-spec
25257 (En/Dis)able speculative scheduling of the instructions that
25258 are dependent on the data speculative loads before reload.
25259 This is effective only with @option{-msched-br-data-spec} enabled.
25260 The default setting is enabled.
25261
25262 @item -msched-ar-in-data-spec
25263 @itemx -mno-sched-ar-in-data-spec
25264 @opindex msched-ar-in-data-spec
25265 @opindex mno-sched-ar-in-data-spec
25266 (En/Dis)able speculative scheduling of the instructions that
25267 are dependent on the data speculative loads after reload.
25268 This is effective only with @option{-msched-ar-data-spec} enabled.
25269 The default setting is enabled.
25270
25271 @item -msched-in-control-spec
25272 @itemx -mno-sched-in-control-spec
25273 @opindex msched-in-control-spec
25274 @opindex mno-sched-in-control-spec
25275 (En/Dis)able speculative scheduling of the instructions that
25276 are dependent on the control speculative loads.
25277 This is effective only with @option{-msched-control-spec} enabled.
25278 The default setting is enabled.
25279
25280 @item -mno-sched-prefer-non-data-spec-insns
25281 @itemx -msched-prefer-non-data-spec-insns
25282 @opindex mno-sched-prefer-non-data-spec-insns
25283 @opindex msched-prefer-non-data-spec-insns
25284 If enabled, data-speculative instructions are chosen for schedule
25285 only if there are no other choices at the moment. This makes
25286 the use of the data speculation much more conservative.
25287 The default setting is disabled.
25288
25289 @item -mno-sched-prefer-non-control-spec-insns
25290 @itemx -msched-prefer-non-control-spec-insns
25291 @opindex mno-sched-prefer-non-control-spec-insns
25292 @opindex msched-prefer-non-control-spec-insns
25293 If enabled, control-speculative instructions are chosen for schedule
25294 only if there are no other choices at the moment. This makes
25295 the use of the control speculation much more conservative.
25296 The default setting is disabled.
25297
25298 @item -mno-sched-count-spec-in-critical-path
25299 @itemx -msched-count-spec-in-critical-path
25300 @opindex mno-sched-count-spec-in-critical-path
25301 @opindex msched-count-spec-in-critical-path
25302 If enabled, speculative dependencies are considered during
25303 computation of the instructions priorities. This makes the use of the
25304 speculation a bit more conservative.
25305 The default setting is disabled.
25306
25307 @item -msched-spec-ldc
25308 @opindex msched-spec-ldc
25309 Use a simple data speculation check. This option is on by default.
25310
25311 @item -msched-control-spec-ldc
25312 @opindex msched-spec-ldc
25313 Use a simple check for control speculation. This option is on by default.
25314
25315 @item -msched-stop-bits-after-every-cycle
25316 @opindex msched-stop-bits-after-every-cycle
25317 Place a stop bit after every cycle when scheduling. This option is on
25318 by default.
25319
25320 @item -msched-fp-mem-deps-zero-cost
25321 @opindex msched-fp-mem-deps-zero-cost
25322 Assume that floating-point stores and loads are not likely to cause a conflict
25323 when placed into the same instruction group. This option is disabled by
25324 default.
25325
25326 @item -msel-sched-dont-check-control-spec
25327 @opindex msel-sched-dont-check-control-spec
25328 Generate checks for control speculation in selective scheduling.
25329 This flag is disabled by default.
25330
25331 @item -msched-max-memory-insns=@var{max-insns}
25332 @opindex msched-max-memory-insns
25333 Limit on the number of memory insns per instruction group, giving lower
25334 priority to subsequent memory insns attempting to schedule in the same
25335 instruction group. Frequently useful to prevent cache bank conflicts.
25336 The default value is 1.
25337
25338 @item -msched-max-memory-insns-hard-limit
25339 @opindex msched-max-memory-insns-hard-limit
25340 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25341 disallowing more than that number in an instruction group.
25342 Otherwise, the limit is ``soft'', meaning that non-memory operations
25343 are preferred when the limit is reached, but memory operations may still
25344 be scheduled.
25345
25346 @end table
25347
25348 @node LM32 Options
25349 @subsection LM32 Options
25350 @cindex LM32 options
25351
25352 These @option{-m} options are defined for the LatticeMico32 architecture:
25353
25354 @table @gcctabopt
25355 @item -mbarrel-shift-enabled
25356 @opindex mbarrel-shift-enabled
25357 Enable barrel-shift instructions.
25358
25359 @item -mdivide-enabled
25360 @opindex mdivide-enabled
25361 Enable divide and modulus instructions.
25362
25363 @item -mmultiply-enabled
25364 @opindex multiply-enabled
25365 Enable multiply instructions.
25366
25367 @item -msign-extend-enabled
25368 @opindex msign-extend-enabled
25369 Enable sign extend instructions.
25370
25371 @item -muser-enabled
25372 @opindex muser-enabled
25373 Enable user-defined instructions.
25374
25375 @end table
25376
25377 @node LoongArch Options
25378 @subsection LoongArch Options
25379 @cindex LoongArch Options
25380
25381 These command-line options are defined for LoongArch targets:
25382
25383 @table @gcctabopt
25384 @item -march=@var{cpu-type}
25385 @opindex march
25386 Generate instructions for the machine type @var{cpu-type}. In contrast to
25387 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25388 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25389 to generate code that may not run at all on processors other than the one
25390 indicated. Specifying @option{-march=@var{cpu-type}} implies
25391 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25392
25393 The choices for @var{cpu-type} are:
25394
25395 @table @samp
25396 @item native
25397 This selects the CPU to generate code for at compilation time by determining
25398 the processor type of the compiling machine. Using @option{-march=native}
25399 enables all instruction subsets supported by the local machine (hence
25400 the result might not run on different machines). Using @option{-mtune=native}
25401 produces code optimized for the local machine under the constraints
25402 of the selected instruction set.
25403 @item loongarch64
25404 A generic CPU with 64-bit extensions.
25405 @item la464
25406 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25407 @end table
25408
25409 @item -mtune=@var{cpu-type}
25410 @opindex mtune
25411 Optimize the output for the given processor, specified by microarchitecture
25412 name.
25413
25414 @item -mabi=@var{base-abi-type}
25415 @opindex mabi
25416 Generate code for the specified calling convention.
25417 @var{base-abi-type} can be one of:
25418 @table @samp
25419 @item lp64d
25420 Uses 64-bit general purpose registers and 32/64-bit floating-point
25421 registers for parameter passing. Data model is LP64, where @samp{int}
25422 is 32 bits, while @samp{long int} and pointers are 64 bits.
25423 @item lp64f
25424 Uses 64-bit general purpose registers and 32-bit floating-point
25425 registers for parameter passing. Data model is LP64, where @samp{int}
25426 is 32 bits, while @samp{long int} and pointers are 64 bits.
25427 @item lp64s
25428 Uses 64-bit general purpose registers and no floating-point
25429 registers for parameter passing. Data model is LP64, where @samp{int}
25430 is 32 bits, while @samp{long int} and pointers are 64 bits.
25431 @end table
25432
25433 @item -mfpu=@var{fpu-type}
25434 @opindex mfpu
25435 Generate code for the specified FPU type, which can be one of:
25436 @table @samp
25437 @item 64
25438 Allow the use of hardware floating-point instructions for 32-bit
25439 and 64-bit operations.
25440 @item 32
25441 Allow the use of hardware floating-point instructions for 32-bit
25442 operations.
25443 @item none
25444 @item 0
25445 Prevent the use of hardware floating-point instructions.
25446 @end table
25447
25448 @item -msoft-float
25449 @opindex msoft-float
25450 Force @option{-mfpu=none} and prevents the use of floating-point
25451 registers for parameter passing. This option may change the target
25452 ABI.
25453
25454 @item -msingle-float
25455 @opindex msingle-float
25456 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
25457 registers for parameter passing. This option may change the target
25458 ABI.
25459
25460 @item -mdouble-float
25461 @opindex mdouble-float
25462 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
25463 registers for parameter passing. This option may change the target
25464 ABI.
25465
25466 @item -mbranch-cost=@var{n}
25467 @opindex mbranch-cost
25468 Set the cost of branches to roughly @var{n} instructions.
25469
25470 @item -mcheck-zero-division
25471 @itemx -mno-check-zero-divison
25472 @opindex mcheck-zero-division
25473 Trap (do not trap) on integer division by zero. The default is
25474 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
25475 @option{-mno-check-zero-division} for other optimization levels.
25476
25477 @item -mcond-move-int
25478 @itemx -mno-cond-move-int
25479 @opindex mcond-move-int
25480 Conditional moves for integral data in general-purpose registers
25481 are enabled (disabled). The default is @option{-mcond-move-int}.
25482
25483 @item -mcond-move-float
25484 @itemx -mno-cond-move-float
25485 @opindex mcond-move-float
25486 Conditional moves for floating-point registers are enabled (disabled).
25487 The default is @option{-mcond-move-float}.
25488
25489 @item -mmemcpy
25490 @itemx -mno-memcpy
25491 @opindex mmemcpy
25492 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
25493 The default is @option{-mno-memcpy}, which allows GCC to inline most
25494 constant-sized copies. Setting optimization level to @option{-Os} also
25495 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
25496 behavior if explicitly specified, regardless of the order these options on
25497 the command line.
25498
25499 @item -mstrict-align
25500 @itemx -mno-strict-align
25501 @opindex mstrict-align
25502 Avoid or allow generating memory accesses that may not be aligned on a natural
25503 object boundary as described in the architecture specification. The default is
25504 @option{-mno-strict-align}.
25505
25506 @item -msmall-data-limit=@var{number}
25507 @opindex msmall-data-limit
25508 Put global and static data smaller than @var{number} bytes into a special
25509 section (on some targets). The default value is 0.
25510
25511 @item -mmax-inline-memcpy-size=@var{n}
25512 @opindex mmax-inline-memcpy-size
25513 Inline all block moves (such as calls to @code{memcpy} or structure copies)
25514 less than or equal to @var{n} bytes. The default value of @var{n} is 1024.
25515
25516 @item -mcmodel=@var{code-model}
25517 Set the code model to one of:
25518 @table @samp
25519 @item tiny-static (Not implemented yet)
25520 @item tiny (Not implemented yet)
25521
25522 @item normal
25523 The text segment must be within 128MB addressing space. The data segment must
25524 be within 2GB addressing space.
25525
25526 @item medium
25527 The text segment and data segment must be within 2GB addressing space.
25528
25529 @item large (Not implemented yet)
25530
25531 @item extreme
25532 This mode does not limit the size of the code segment and data segment.
25533 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
25534 @option{-mno-explicit-relocs}.
25535 @end table
25536 The default code model is @code{normal}.
25537
25538 @item -mexplicit-relocs
25539 @itemx -mno-explicit-relocs
25540 @opindex mexplicit-relocs
25541 @opindex mno-explicit-relocs
25542 Use or do not use assembler relocation operators when dealing with symbolic
25543 addresses. The alternative is to use assembler macros instead, which may
25544 limit optimization. The default value for the option is determined during
25545 GCC build-time by detecting corresponding assembler support:
25546 @code{-mexplicit-relocs} if said support is present,
25547 @code{-mno-explicit-relocs} otherwise. This option is mostly useful for
25548 debugging, or interoperation with assemblers different from the build-time
25549 one.
25550
25551 @item -mdirect-extern-access
25552 @itemx -mno-direct-extern-access
25553 @opindex mdirect-extern-access
25554 Do not use or use GOT to access external symbols. The default is
25555 @option{-mno-direct-extern-access}: GOT is used for external symbols with
25556 default visibility, but not used for other external symbols.
25557
25558 With @option{-mdirect-extern-access}, GOT is not used and all external
25559 symbols are PC-relatively addressed. It is @strong{only} suitable for
25560 environments where no dynamic link is performed, like firmwares, OS
25561 kernels, executables linked with @option{-static} or @option{-static-pie}.
25562 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
25563 @option{-fpic}.
25564 @end table
25565
25566 @node M32C Options
25567 @subsection M32C Options
25568 @cindex M32C options
25569
25570 @table @gcctabopt
25571 @item -mcpu=@var{name}
25572 @opindex mcpu=
25573 Select the CPU for which code is generated. @var{name} may be one of
25574 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
25575 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
25576 the M32C/80 series.
25577
25578 @item -msim
25579 @opindex msim
25580 Specifies that the program will be run on the simulator. This causes
25581 an alternate runtime library to be linked in which supports, for
25582 example, file I/O@. You must not use this option when generating
25583 programs that will run on real hardware; you must provide your own
25584 runtime library for whatever I/O functions are needed.
25585
25586 @item -memregs=@var{number}
25587 @opindex memregs=
25588 Specifies the number of memory-based pseudo-registers GCC uses
25589 during code generation. These pseudo-registers are used like real
25590 registers, so there is a tradeoff between GCC's ability to fit the
25591 code into available registers, and the performance penalty of using
25592 memory instead of registers. Note that all modules in a program must
25593 be compiled with the same value for this option. Because of that, you
25594 must not use this option with GCC's default runtime libraries.
25595
25596 @end table
25597
25598 @node M32R/D Options
25599 @subsection M32R/D Options
25600 @cindex M32R/D options
25601
25602 These @option{-m} options are defined for Renesas M32R/D architectures:
25603
25604 @table @gcctabopt
25605 @item -m32r2
25606 @opindex m32r2
25607 Generate code for the M32R/2@.
25608
25609 @item -m32rx
25610 @opindex m32rx
25611 Generate code for the M32R/X@.
25612
25613 @item -m32r
25614 @opindex m32r
25615 Generate code for the M32R@. This is the default.
25616
25617 @item -mmodel=small
25618 @opindex mmodel=small
25619 Assume all objects live in the lower 16MB of memory (so that their addresses
25620 can be loaded with the @code{ld24} instruction), and assume all subroutines
25621 are reachable with the @code{bl} instruction.
25622 This is the default.
25623
25624 The addressability of a particular object can be set with the
25625 @code{model} attribute.
25626
25627 @item -mmodel=medium
25628 @opindex mmodel=medium
25629 Assume objects may be anywhere in the 32-bit address space (the compiler
25630 generates @code{seth/add3} instructions to load their addresses), and
25631 assume all subroutines are reachable with the @code{bl} instruction.
25632
25633 @item -mmodel=large
25634 @opindex mmodel=large
25635 Assume objects may be anywhere in the 32-bit address space (the compiler
25636 generates @code{seth/add3} instructions to load their addresses), and
25637 assume subroutines may not be reachable with the @code{bl} instruction
25638 (the compiler generates the much slower @code{seth/add3/jl}
25639 instruction sequence).
25640
25641 @item -msdata=none
25642 @opindex msdata=none
25643 Disable use of the small data area. Variables are put into
25644 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
25645 @code{section} attribute has been specified).
25646 This is the default.
25647
25648 The small data area consists of sections @code{.sdata} and @code{.sbss}.
25649 Objects may be explicitly put in the small data area with the
25650 @code{section} attribute using one of these sections.
25651
25652 @item -msdata=sdata
25653 @opindex msdata=sdata
25654 Put small global and static data in the small data area, but do not
25655 generate special code to reference them.
25656
25657 @item -msdata=use
25658 @opindex msdata=use
25659 Put small global and static data in the small data area, and generate
25660 special instructions to reference them.
25661
25662 @item -G @var{num}
25663 @opindex G
25664 @cindex smaller data references
25665 Put global and static objects less than or equal to @var{num} bytes
25666 into the small data or BSS sections instead of the normal data or BSS
25667 sections. The default value of @var{num} is 8.
25668 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
25669 for this option to have any effect.
25670
25671 All modules should be compiled with the same @option{-G @var{num}} value.
25672 Compiling with different values of @var{num} may or may not work; if it
25673 doesn't the linker gives an error message---incorrect code is not
25674 generated.
25675
25676 @item -mdebug
25677 @opindex mdebug
25678 Makes the M32R-specific code in the compiler display some statistics
25679 that might help in debugging programs.
25680
25681 @item -malign-loops
25682 @opindex malign-loops
25683 Align all loops to a 32-byte boundary.
25684
25685 @item -mno-align-loops
25686 @opindex mno-align-loops
25687 Do not enforce a 32-byte alignment for loops. This is the default.
25688
25689 @item -missue-rate=@var{number}
25690 @opindex missue-rate=@var{number}
25691 Issue @var{number} instructions per cycle. @var{number} can only be 1
25692 or 2.
25693
25694 @item -mbranch-cost=@var{number}
25695 @opindex mbranch-cost=@var{number}
25696 @var{number} can only be 1 or 2. If it is 1 then branches are
25697 preferred over conditional code, if it is 2, then the opposite applies.
25698
25699 @item -mflush-trap=@var{number}
25700 @opindex mflush-trap=@var{number}
25701 Specifies the trap number to use to flush the cache. The default is
25702 12. Valid numbers are between 0 and 15 inclusive.
25703
25704 @item -mno-flush-trap
25705 @opindex mno-flush-trap
25706 Specifies that the cache cannot be flushed by using a trap.
25707
25708 @item -mflush-func=@var{name}
25709 @opindex mflush-func=@var{name}
25710 Specifies the name of the operating system function to call to flush
25711 the cache. The default is @samp{_flush_cache}, but a function call
25712 is only used if a trap is not available.
25713
25714 @item -mno-flush-func
25715 @opindex mno-flush-func
25716 Indicates that there is no OS function for flushing the cache.
25717
25718 @end table
25719
25720 @node M680x0 Options
25721 @subsection M680x0 Options
25722 @cindex M680x0 options
25723
25724 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
25725 The default settings depend on which architecture was selected when
25726 the compiler was configured; the defaults for the most common choices
25727 are given below.
25728
25729 @table @gcctabopt
25730 @item -march=@var{arch}
25731 @opindex march
25732 Generate code for a specific M680x0 or ColdFire instruction set
25733 architecture. Permissible values of @var{arch} for M680x0
25734 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
25735 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
25736 architectures are selected according to Freescale's ISA classification
25737 and the permissible values are: @samp{isaa}, @samp{isaaplus},
25738 @samp{isab} and @samp{isac}.
25739
25740 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
25741 code for a ColdFire target. The @var{arch} in this macro is one of the
25742 @option{-march} arguments given above.
25743
25744 When used together, @option{-march} and @option{-mtune} select code
25745 that runs on a family of similar processors but that is optimized
25746 for a particular microarchitecture.
25747
25748 @item -mcpu=@var{cpu}
25749 @opindex mcpu
25750 Generate code for a specific M680x0 or ColdFire processor.
25751 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
25752 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
25753 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
25754 below, which also classifies the CPUs into families:
25755
25756 @multitable @columnfractions 0.20 0.80
25757 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
25758 @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}
25759 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
25760 @item @samp{5206e} @tab @samp{5206e}
25761 @item @samp{5208} @tab @samp{5207} @samp{5208}
25762 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
25763 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
25764 @item @samp{5216} @tab @samp{5214} @samp{5216}
25765 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
25766 @item @samp{5225} @tab @samp{5224} @samp{5225}
25767 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
25768 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
25769 @item @samp{5249} @tab @samp{5249}
25770 @item @samp{5250} @tab @samp{5250}
25771 @item @samp{5271} @tab @samp{5270} @samp{5271}
25772 @item @samp{5272} @tab @samp{5272}
25773 @item @samp{5275} @tab @samp{5274} @samp{5275}
25774 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
25775 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
25776 @item @samp{5307} @tab @samp{5307}
25777 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
25778 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
25779 @item @samp{5407} @tab @samp{5407}
25780 @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}
25781 @end multitable
25782
25783 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
25784 @var{arch} is compatible with @var{cpu}. Other combinations of
25785 @option{-mcpu} and @option{-march} are rejected.
25786
25787 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
25788 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
25789 where the value of @var{family} is given by the table above.
25790
25791 @item -mtune=@var{tune}
25792 @opindex mtune
25793 Tune the code for a particular microarchitecture within the
25794 constraints set by @option{-march} and @option{-mcpu}.
25795 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
25796 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
25797 and @samp{cpu32}. The ColdFire microarchitectures
25798 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
25799
25800 You can also use @option{-mtune=68020-40} for code that needs
25801 to run relatively well on 68020, 68030 and 68040 targets.
25802 @option{-mtune=68020-60} is similar but includes 68060 targets
25803 as well. These two options select the same tuning decisions as
25804 @option{-m68020-40} and @option{-m68020-60} respectively.
25805
25806 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
25807 when tuning for 680x0 architecture @var{arch}. It also defines
25808 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
25809 option is used. If GCC is tuning for a range of architectures,
25810 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
25811 it defines the macros for every architecture in the range.
25812
25813 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
25814 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
25815 of the arguments given above.
25816
25817 @item -m68000
25818 @itemx -mc68000
25819 @opindex m68000
25820 @opindex mc68000
25821 Generate output for a 68000. This is the default
25822 when the compiler is configured for 68000-based systems.
25823 It is equivalent to @option{-march=68000}.
25824
25825 Use this option for microcontrollers with a 68000 or EC000 core,
25826 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
25827
25828 @item -m68010
25829 @opindex m68010
25830 Generate output for a 68010. This is the default
25831 when the compiler is configured for 68010-based systems.
25832 It is equivalent to @option{-march=68010}.
25833
25834 @item -m68020
25835 @itemx -mc68020
25836 @opindex m68020
25837 @opindex mc68020
25838 Generate output for a 68020. This is the default
25839 when the compiler is configured for 68020-based systems.
25840 It is equivalent to @option{-march=68020}.
25841
25842 @item -m68030
25843 @opindex m68030
25844 Generate output for a 68030. This is the default when the compiler is
25845 configured for 68030-based systems. It is equivalent to
25846 @option{-march=68030}.
25847
25848 @item -m68040
25849 @opindex m68040
25850 Generate output for a 68040. This is the default when the compiler is
25851 configured for 68040-based systems. It is equivalent to
25852 @option{-march=68040}.
25853
25854 This option inhibits the use of 68881/68882 instructions that have to be
25855 emulated by software on the 68040. Use this option if your 68040 does not
25856 have code to emulate those instructions.
25857
25858 @item -m68060
25859 @opindex m68060
25860 Generate output for a 68060. This is the default when the compiler is
25861 configured for 68060-based systems. It is equivalent to
25862 @option{-march=68060}.
25863
25864 This option inhibits the use of 68020 and 68881/68882 instructions that
25865 have to be emulated by software on the 68060. Use this option if your 68060
25866 does not have code to emulate those instructions.
25867
25868 @item -mcpu32
25869 @opindex mcpu32
25870 Generate output for a CPU32. This is the default
25871 when the compiler is configured for CPU32-based systems.
25872 It is equivalent to @option{-march=cpu32}.
25873
25874 Use this option for microcontrollers with a
25875 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
25876 68336, 68340, 68341, 68349 and 68360.
25877
25878 @item -m5200
25879 @opindex m5200
25880 Generate output for a 520X ColdFire CPU@. This is the default
25881 when the compiler is configured for 520X-based systems.
25882 It is equivalent to @option{-mcpu=5206}, and is now deprecated
25883 in favor of that option.
25884
25885 Use this option for microcontroller with a 5200 core, including
25886 the MCF5202, MCF5203, MCF5204 and MCF5206.
25887
25888 @item -m5206e
25889 @opindex m5206e
25890 Generate output for a 5206e ColdFire CPU@. The option is now
25891 deprecated in favor of the equivalent @option{-mcpu=5206e}.
25892
25893 @item -m528x
25894 @opindex m528x
25895 Generate output for a member of the ColdFire 528X family.
25896 The option is now deprecated in favor of the equivalent
25897 @option{-mcpu=528x}.
25898
25899 @item -m5307
25900 @opindex m5307
25901 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
25902 in favor of the equivalent @option{-mcpu=5307}.
25903
25904 @item -m5407
25905 @opindex m5407
25906 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
25907 in favor of the equivalent @option{-mcpu=5407}.
25908
25909 @item -mcfv4e
25910 @opindex mcfv4e
25911 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
25912 This includes use of hardware floating-point instructions.
25913 The option is equivalent to @option{-mcpu=547x}, and is now
25914 deprecated in favor of that option.
25915
25916 @item -m68020-40
25917 @opindex m68020-40
25918 Generate output for a 68040, without using any of the new instructions.
25919 This results in code that can run relatively efficiently on either a
25920 68020/68881 or a 68030 or a 68040. The generated code does use the
25921 68881 instructions that are emulated on the 68040.
25922
25923 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
25924
25925 @item -m68020-60
25926 @opindex m68020-60
25927 Generate output for a 68060, without using any of the new instructions.
25928 This results in code that can run relatively efficiently on either a
25929 68020/68881 or a 68030 or a 68040. The generated code does use the
25930 68881 instructions that are emulated on the 68060.
25931
25932 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
25933
25934 @item -mhard-float
25935 @itemx -m68881
25936 @opindex mhard-float
25937 @opindex m68881
25938 Generate floating-point instructions. This is the default for 68020
25939 and above, and for ColdFire devices that have an FPU@. It defines the
25940 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
25941 on ColdFire targets.
25942
25943 @item -msoft-float
25944 @opindex msoft-float
25945 Do not generate floating-point instructions; use library calls instead.
25946 This is the default for 68000, 68010, and 68832 targets. It is also
25947 the default for ColdFire devices that have no FPU.
25948
25949 @item -mdiv
25950 @itemx -mno-div
25951 @opindex mdiv
25952 @opindex mno-div
25953 Generate (do not generate) ColdFire hardware divide and remainder
25954 instructions. If @option{-march} is used without @option{-mcpu},
25955 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
25956 architectures. Otherwise, the default is taken from the target CPU
25957 (either the default CPU, or the one specified by @option{-mcpu}). For
25958 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
25959 @option{-mcpu=5206e}.
25960
25961 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
25962
25963 @item -mshort
25964 @opindex mshort
25965 Consider type @code{int} to be 16 bits wide, like @code{short int}.
25966 Additionally, parameters passed on the stack are also aligned to a
25967 16-bit boundary even on targets whose API mandates promotion to 32-bit.
25968
25969 @item -mno-short
25970 @opindex mno-short
25971 Do not consider type @code{int} to be 16 bits wide. This is the default.
25972
25973 @item -mnobitfield
25974 @itemx -mno-bitfield
25975 @opindex mnobitfield
25976 @opindex mno-bitfield
25977 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
25978 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
25979
25980 @item -mbitfield
25981 @opindex mbitfield
25982 Do use the bit-field instructions. The @option{-m68020} option implies
25983 @option{-mbitfield}. This is the default if you use a configuration
25984 designed for a 68020.
25985
25986 @item -mrtd
25987 @opindex mrtd
25988 Use a different function-calling convention, in which functions
25989 that take a fixed number of arguments return with the @code{rtd}
25990 instruction, which pops their arguments while returning. This
25991 saves one instruction in the caller since there is no need to pop
25992 the arguments there.
25993
25994 This calling convention is incompatible with the one normally
25995 used on Unix, so you cannot use it if you need to call libraries
25996 compiled with the Unix compiler.
25997
25998 Also, you must provide function prototypes for all functions that
25999 take variable numbers of arguments (including @code{printf});
26000 otherwise incorrect code is generated for calls to those
26001 functions.
26002
26003 In addition, seriously incorrect code results if you call a
26004 function with too many arguments. (Normally, extra arguments are
26005 harmlessly ignored.)
26006
26007 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26008 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26009
26010 The default is @option{-mno-rtd}.
26011
26012 @item -malign-int
26013 @itemx -mno-align-int
26014 @opindex malign-int
26015 @opindex mno-align-int
26016 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26017 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26018 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26019 Aligning variables on 32-bit boundaries produces code that runs somewhat
26020 faster on processors with 32-bit busses at the expense of more memory.
26021
26022 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26023 aligns structures containing the above types differently than
26024 most published application binary interface specifications for the m68k.
26025
26026 @opindex mpcrel
26027 Use the pc-relative addressing mode of the 68000 directly, instead of
26028 using a global offset table. At present, this option implies @option{-fpic},
26029 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
26030 not presently supported with @option{-mpcrel}, though this could be supported for
26031 68020 and higher processors.
26032
26033 @item -mno-strict-align
26034 @itemx -mstrict-align
26035 @opindex mno-strict-align
26036 @opindex mstrict-align
26037 Do not (do) assume that unaligned memory references are handled by
26038 the system.
26039
26040 @item -msep-data
26041 Generate code that allows the data segment to be located in a different
26042 area of memory from the text segment. This allows for execute-in-place in
26043 an environment without virtual memory management. This option implies
26044 @option{-fPIC}.
26045
26046 @item -mno-sep-data
26047 Generate code that assumes that the data segment follows the text segment.
26048 This is the default.
26049
26050 @item -mid-shared-library
26051 Generate code that supports shared libraries via the library ID method.
26052 This allows for execute-in-place and shared libraries in an environment
26053 without virtual memory management. This option implies @option{-fPIC}.
26054
26055 @item -mno-id-shared-library
26056 Generate code that doesn't assume ID-based shared libraries are being used.
26057 This is the default.
26058
26059 @item -mshared-library-id=n
26060 Specifies the identification number of the ID-based shared library being
26061 compiled. Specifying a value of 0 generates more compact code; specifying
26062 other values forces the allocation of that number to the current
26063 library, but is no more space- or time-efficient than omitting this option.
26064
26065 @item -mxgot
26066 @itemx -mno-xgot
26067 @opindex mxgot
26068 @opindex mno-xgot
26069 When generating position-independent code for ColdFire, generate code
26070 that works if the GOT has more than 8192 entries. This code is
26071 larger and slower than code generated without this option. On M680x0
26072 processors, this option is not needed; @option{-fPIC} suffices.
26073
26074 GCC normally uses a single instruction to load values from the GOT@.
26075 While this is relatively efficient, it only works if the GOT
26076 is smaller than about 64k. Anything larger causes the linker
26077 to report an error such as:
26078
26079 @cindex relocation truncated to fit (ColdFire)
26080 @smallexample
26081 relocation truncated to fit: R_68K_GOT16O foobar
26082 @end smallexample
26083
26084 If this happens, you should recompile your code with @option{-mxgot}.
26085 It should then work with very large GOTs. However, code generated with
26086 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26087 the value of a global symbol.
26088
26089 Note that some linkers, including newer versions of the GNU linker,
26090 can create multiple GOTs and sort GOT entries. If you have such a linker,
26091 you should only need to use @option{-mxgot} when compiling a single
26092 object file that accesses more than 8192 GOT entries. Very few do.
26093
26094 These options have no effect unless GCC is generating
26095 position-independent code.
26096
26097 @item -mlong-jump-table-offsets
26098 @opindex mlong-jump-table-offsets
26099 Use 32-bit offsets in @code{switch} tables. The default is to use
26100 16-bit offsets.
26101
26102 @end table
26103
26104 @node MCore Options
26105 @subsection MCore Options
26106 @cindex MCore options
26107
26108 These are the @samp{-m} options defined for the Motorola M*Core
26109 processors.
26110
26111 @table @gcctabopt
26112
26113 @item -mhardlit
26114 @itemx -mno-hardlit
26115 @opindex mhardlit
26116 @opindex mno-hardlit
26117 Inline constants into the code stream if it can be done in two
26118 instructions or less.
26119
26120 @item -mdiv
26121 @itemx -mno-div
26122 @opindex mdiv
26123 @opindex mno-div
26124 Use the divide instruction. (Enabled by default).
26125
26126 @item -mrelax-immediate
26127 @itemx -mno-relax-immediate
26128 @opindex mrelax-immediate
26129 @opindex mno-relax-immediate
26130 Allow arbitrary-sized immediates in bit operations.
26131
26132 @item -mwide-bitfields
26133 @itemx -mno-wide-bitfields
26134 @opindex mwide-bitfields
26135 @opindex mno-wide-bitfields
26136 Always treat bit-fields as @code{int}-sized.
26137
26138 @item -m4byte-functions
26139 @itemx -mno-4byte-functions
26140 @opindex m4byte-functions
26141 @opindex mno-4byte-functions
26142 Force all functions to be aligned to a 4-byte boundary.
26143
26144 @item -mcallgraph-data
26145 @itemx -mno-callgraph-data
26146 @opindex mcallgraph-data
26147 @opindex mno-callgraph-data
26148 Emit callgraph information.
26149
26150 @item -mslow-bytes
26151 @itemx -mno-slow-bytes
26152 @opindex mslow-bytes
26153 @opindex mno-slow-bytes
26154 Prefer word access when reading byte quantities.
26155
26156 @item -mlittle-endian
26157 @itemx -mbig-endian
26158 @opindex mlittle-endian
26159 @opindex mbig-endian
26160 Generate code for a little-endian target.
26161
26162 @item -m210
26163 @itemx -m340
26164 @opindex m210
26165 @opindex m340
26166 Generate code for the 210 processor.
26167
26168 @item -mno-lsim
26169 @opindex mno-lsim
26170 Assume that runtime support has been provided and so omit the
26171 simulator library (@file{libsim.a)} from the linker command line.
26172
26173 @item -mstack-increment=@var{size}
26174 @opindex mstack-increment
26175 Set the maximum amount for a single stack increment operation. Large
26176 values can increase the speed of programs that contain functions
26177 that need a large amount of stack space, but they can also trigger a
26178 segmentation fault if the stack is extended too much. The default
26179 value is 0x1000.
26180
26181 @end table
26182
26183 @node MicroBlaze Options
26184 @subsection MicroBlaze Options
26185 @cindex MicroBlaze Options
26186
26187 @table @gcctabopt
26188
26189 @item -msoft-float
26190 @opindex msoft-float
26191 Use software emulation for floating point (default).
26192
26193 @item -mhard-float
26194 @opindex mhard-float
26195 Use hardware floating-point instructions.
26196
26197 @item -mmemcpy
26198 @opindex mmemcpy
26199 Do not optimize block moves, use @code{memcpy}.
26200
26201 @item -mno-clearbss
26202 @opindex mno-clearbss
26203 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
26204
26205 @item -mcpu=@var{cpu-type}
26206 @opindex mcpu=
26207 Use features of, and schedule code for, the given CPU.
26208 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26209 where @var{X} is a major version, @var{YY} is the minor version, and
26210 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
26211 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26212
26213 @item -mxl-soft-mul
26214 @opindex mxl-soft-mul
26215 Use software multiply emulation (default).
26216
26217 @item -mxl-soft-div
26218 @opindex mxl-soft-div
26219 Use software emulation for divides (default).
26220
26221 @item -mxl-barrel-shift
26222 @opindex mxl-barrel-shift
26223 Use the hardware barrel shifter.
26224
26225 @item -mxl-pattern-compare
26226 @opindex mxl-pattern-compare
26227 Use pattern compare instructions.
26228
26229 @item -msmall-divides
26230 @opindex msmall-divides
26231 Use table lookup optimization for small signed integer divisions.
26232
26233 @item -mxl-stack-check
26234 @opindex mxl-stack-check
26235 This option is deprecated. Use @option{-fstack-check} instead.
26236
26237 @item -mxl-gp-opt
26238 @opindex mxl-gp-opt
26239 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26240
26241 @item -mxl-multiply-high
26242 @opindex mxl-multiply-high
26243 Use multiply high instructions for high part of 32x32 multiply.
26244
26245 @item -mxl-float-convert
26246 @opindex mxl-float-convert
26247 Use hardware floating-point conversion instructions.
26248
26249 @item -mxl-float-sqrt
26250 @opindex mxl-float-sqrt
26251 Use hardware floating-point square root instruction.
26252
26253 @item -mbig-endian
26254 @opindex mbig-endian
26255 Generate code for a big-endian target.
26256
26257 @item -mlittle-endian
26258 @opindex mlittle-endian
26259 Generate code for a little-endian target.
26260
26261 @item -mxl-reorder
26262 @opindex mxl-reorder
26263 Use reorder instructions (swap and byte reversed load/store).
26264
26265 @item -mxl-mode-@var{app-model}
26266 Select application model @var{app-model}. Valid models are
26267 @table @samp
26268 @item executable
26269 normal executable (default), uses startup code @file{crt0.o}.
26270
26271 @item xmdstub
26272 for use with Xilinx Microprocessor Debugger (XMD) based
26273 software intrusive debug agent called xmdstub. This uses startup file
26274 @file{crt1.o} and sets the start address of the program to 0x800.
26275
26276 @item bootstrap
26277 for applications that are loaded using a bootloader.
26278 This model uses startup file @file{crt2.o} which does not contain a processor
26279 reset vector handler. This is suitable for transferring control on a
26280 processor reset to the bootloader rather than the application.
26281
26282 @item novectors
26283 for applications that do not require any of the
26284 MicroBlaze vectors. This option may be useful for applications running
26285 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26286 @end table
26287
26288 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26289 @option{-mxl-mode-@var{app-model}}.
26290
26291 @item -mpic-data-is-text-relative
26292 @opindex mpic-data-is-text-relative
26293 Assume that the displacement between the text and data segments is fixed
26294 at static link time. This allows data to be referenced by offset from start of
26295 text address instead of GOT since PC-relative addressing is not supported.
26296
26297 @end table
26298
26299 @node MIPS Options
26300 @subsection MIPS Options
26301 @cindex MIPS options
26302
26303 @table @gcctabopt
26304
26305 @item -EB
26306 @opindex EB
26307 Generate big-endian code.
26308
26309 @item -EL
26310 @opindex EL
26311 Generate little-endian code. This is the default for @samp{mips*el-*-*}
26312 configurations.
26313
26314 @item -march=@var{arch}
26315 @opindex march
26316 Generate code that runs on @var{arch}, which can be the name of a
26317 generic MIPS ISA, or the name of a particular processor.
26318 The ISA names are:
26319 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26320 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26321 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26322 @samp{mips64r5} and @samp{mips64r6}.
26323 The processor names are:
26324 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26325 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26326 @samp{5kc}, @samp{5kf},
26327 @samp{20kc},
26328 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26329 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26330 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26331 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26332 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26333 @samp{i6400}, @samp{i6500},
26334 @samp{interaptiv},
26335 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26336 @samp{gs464e}, @samp{gs264e},
26337 @samp{m4k},
26338 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26339 @samp{m5100}, @samp{m5101},
26340 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26341 @samp{orion},
26342 @samp{p5600}, @samp{p6600},
26343 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26344 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26345 @samp{r6000}, @samp{r8000},
26346 @samp{rm7000}, @samp{rm9000},
26347 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26348 @samp{sb1},
26349 @samp{sr71000},
26350 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26351 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26352 @samp{xlr} and @samp{xlp}.
26353 The special value @samp{from-abi} selects the
26354 most compatible architecture for the selected ABI (that is,
26355 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26356
26357 The native Linux/GNU toolchain also supports the value @samp{native},
26358 which selects the best architecture option for the host processor.
26359 @option{-march=native} has no effect if GCC does not recognize
26360 the processor.
26361
26362 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26363 (for example, @option{-march=r2k}). Prefixes are optional, and
26364 @samp{vr} may be written @samp{r}.
26365
26366 Names of the form @samp{@var{n}f2_1} refer to processors with
26367 FPUs clocked at half the rate of the core, names of the form
26368 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26369 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26370 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26371 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26372 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26373 accepted as synonyms for @samp{@var{n}f1_1}.
26374
26375 GCC defines two macros based on the value of this option. The first
26376 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26377 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
26378 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26379 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26380 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26381
26382 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26383 above. In other words, it has the full prefix and does not
26384 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
26385 the macro names the resolved architecture (either @code{"mips1"} or
26386 @code{"mips3"}). It names the default architecture when no
26387 @option{-march} option is given.
26388
26389 @item -mtune=@var{arch}
26390 @opindex mtune
26391 Optimize for @var{arch}. Among other things, this option controls
26392 the way instructions are scheduled, and the perceived cost of arithmetic
26393 operations. The list of @var{arch} values is the same as for
26394 @option{-march}.
26395
26396 When this option is not used, GCC optimizes for the processor
26397 specified by @option{-march}. By using @option{-march} and
26398 @option{-mtune} together, it is possible to generate code that
26399 runs on a family of processors, but optimize the code for one
26400 particular member of that family.
26401
26402 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
26403 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
26404 @option{-march} ones described above.
26405
26406 @item -mips1
26407 @opindex mips1
26408 Equivalent to @option{-march=mips1}.
26409
26410 @item -mips2
26411 @opindex mips2
26412 Equivalent to @option{-march=mips2}.
26413
26414 @item -mips3
26415 @opindex mips3
26416 Equivalent to @option{-march=mips3}.
26417
26418 @item -mips4
26419 @opindex mips4
26420 Equivalent to @option{-march=mips4}.
26421
26422 @item -mips32
26423 @opindex mips32
26424 Equivalent to @option{-march=mips32}.
26425
26426 @item -mips32r3
26427 @opindex mips32r3
26428 Equivalent to @option{-march=mips32r3}.
26429
26430 @item -mips32r5
26431 @opindex mips32r5
26432 Equivalent to @option{-march=mips32r5}.
26433
26434 @item -mips32r6
26435 @opindex mips32r6
26436 Equivalent to @option{-march=mips32r6}.
26437
26438 @item -mips64
26439 @opindex mips64
26440 Equivalent to @option{-march=mips64}.
26441
26442 @item -mips64r2
26443 @opindex mips64r2
26444 Equivalent to @option{-march=mips64r2}.
26445
26446 @item -mips64r3
26447 @opindex mips64r3
26448 Equivalent to @option{-march=mips64r3}.
26449
26450 @item -mips64r5
26451 @opindex mips64r5
26452 Equivalent to @option{-march=mips64r5}.
26453
26454 @item -mips64r6
26455 @opindex mips64r6
26456 Equivalent to @option{-march=mips64r6}.
26457
26458 @item -mips16
26459 @itemx -mno-mips16
26460 @opindex mips16
26461 @opindex mno-mips16
26462 Generate (do not generate) MIPS16 code. If GCC is targeting a
26463 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
26464
26465 MIPS16 code generation can also be controlled on a per-function basis
26466 by means of @code{mips16} and @code{nomips16} attributes.
26467 @xref{Function Attributes}, for more information.
26468
26469 @item -mflip-mips16
26470 @opindex mflip-mips16
26471 Generate MIPS16 code on alternating functions. This option is provided
26472 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
26473 not intended for ordinary use in compiling user code.
26474
26475 @item -minterlink-compressed
26476 @itemx -mno-interlink-compressed
26477 @opindex minterlink-compressed
26478 @opindex mno-interlink-compressed
26479 Require (do not require) that code using the standard (uncompressed) MIPS ISA
26480 be link-compatible with MIPS16 and microMIPS code, and vice versa.
26481
26482 For example, code using the standard ISA encoding cannot jump directly
26483 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
26484 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
26485 knows that the target of the jump is not compressed.
26486
26487 @item -minterlink-mips16
26488 @itemx -mno-interlink-mips16
26489 @opindex minterlink-mips16
26490 @opindex mno-interlink-mips16
26491 Aliases of @option{-minterlink-compressed} and
26492 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
26493 and are retained for backwards compatibility.
26494
26495 @item -mabi=32
26496 @itemx -mabi=o64
26497 @itemx -mabi=n32
26498 @itemx -mabi=64
26499 @itemx -mabi=eabi
26500 @opindex mabi=32
26501 @opindex mabi=o64
26502 @opindex mabi=n32
26503 @opindex mabi=64
26504 @opindex mabi=eabi
26505 Generate code for the given ABI@.
26506
26507 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
26508 generates 64-bit code when you select a 64-bit architecture, but you
26509 can use @option{-mgp32} to get 32-bit code instead.
26510
26511 For information about the O64 ABI, see
26512 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
26513
26514 GCC supports a variant of the o32 ABI in which floating-point registers
26515 are 64 rather than 32 bits wide. You can select this combination with
26516 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
26517 and @code{mfhc1} instructions and is therefore only supported for
26518 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
26519
26520 The register assignments for arguments and return values remain the
26521 same, but each scalar value is passed in a single 64-bit register
26522 rather than a pair of 32-bit registers. For example, scalar
26523 floating-point values are returned in @samp{$f0} only, not a
26524 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
26525 remains the same in that the even-numbered double-precision registers
26526 are saved.
26527
26528 Two additional variants of the o32 ABI are supported to enable
26529 a transition from 32-bit to 64-bit registers. These are FPXX
26530 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
26531 The FPXX extension mandates that all code must execute correctly
26532 when run using 32-bit or 64-bit registers. The code can be interlinked
26533 with either FP32 or FP64, but not both.
26534 The FP64A extension is similar to the FP64 extension but forbids the
26535 use of odd-numbered single-precision registers. This can be used
26536 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
26537 processors and allows both FP32 and FP64A code to interlink and
26538 run in the same process without changing FPU modes.
26539
26540 @item -mabicalls
26541 @itemx -mno-abicalls
26542 @opindex mabicalls
26543 @opindex mno-abicalls
26544 Generate (do not generate) code that is suitable for SVR4-style
26545 dynamic objects. @option{-mabicalls} is the default for SVR4-based
26546 systems.
26547
26548 @item -mshared
26549 @itemx -mno-shared
26550 Generate (do not generate) code that is fully position-independent,
26551 and that can therefore be linked into shared libraries. This option
26552 only affects @option{-mabicalls}.
26553
26554 All @option{-mabicalls} code has traditionally been position-independent,
26555 regardless of options like @option{-fPIC} and @option{-fpic}. However,
26556 as an extension, the GNU toolchain allows executables to use absolute
26557 accesses for locally-binding symbols. It can also use shorter GP
26558 initialization sequences and generate direct calls to locally-defined
26559 functions. This mode is selected by @option{-mno-shared}.
26560
26561 @option{-mno-shared} depends on binutils 2.16 or higher and generates
26562 objects that can only be linked by the GNU linker. However, the option
26563 does not affect the ABI of the final executable; it only affects the ABI
26564 of relocatable objects. Using @option{-mno-shared} generally makes
26565 executables both smaller and quicker.
26566
26567 @option{-mshared} is the default.
26568
26569 @item -mplt
26570 @itemx -mno-plt
26571 @opindex mplt
26572 @opindex mno-plt
26573 Assume (do not assume) that the static and dynamic linkers
26574 support PLTs and copy relocations. This option only affects
26575 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
26576 has no effect without @option{-msym32}.
26577
26578 You can make @option{-mplt} the default by configuring
26579 GCC with @option{--with-mips-plt}. The default is
26580 @option{-mno-plt} otherwise.
26581
26582 @item -mxgot
26583 @itemx -mno-xgot
26584 @opindex mxgot
26585 @opindex mno-xgot
26586 Lift (do not lift) the usual restrictions on the size of the global
26587 offset table.
26588
26589 GCC normally uses a single instruction to load values from the GOT@.
26590 While this is relatively efficient, it only works if the GOT
26591 is smaller than about 64k. Anything larger causes the linker
26592 to report an error such as:
26593
26594 @cindex relocation truncated to fit (MIPS)
26595 @smallexample
26596 relocation truncated to fit: R_MIPS_GOT16 foobar
26597 @end smallexample
26598
26599 If this happens, you should recompile your code with @option{-mxgot}.
26600 This works with very large GOTs, although the code is also
26601 less efficient, since it takes three instructions to fetch the
26602 value of a global symbol.
26603
26604 Note that some linkers can create multiple GOTs. If you have such a
26605 linker, you should only need to use @option{-mxgot} when a single object
26606 file accesses more than 64k's worth of GOT entries. Very few do.
26607
26608 These options have no effect unless GCC is generating position
26609 independent code.
26610
26611 @item -mgp32
26612 @opindex mgp32
26613 Assume that general-purpose registers are 32 bits wide.
26614
26615 @item -mgp64
26616 @opindex mgp64
26617 Assume that general-purpose registers are 64 bits wide.
26618
26619 @item -mfp32
26620 @opindex mfp32
26621 Assume that floating-point registers are 32 bits wide.
26622
26623 @item -mfp64
26624 @opindex mfp64
26625 Assume that floating-point registers are 64 bits wide.
26626
26627 @item -mfpxx
26628 @opindex mfpxx
26629 Do not assume the width of floating-point registers.
26630
26631 @item -mhard-float
26632 @opindex mhard-float
26633 Use floating-point coprocessor instructions.
26634
26635 @item -msoft-float
26636 @opindex msoft-float
26637 Do not use floating-point coprocessor instructions. Implement
26638 floating-point calculations using library calls instead.
26639
26640 @item -mno-float
26641 @opindex mno-float
26642 Equivalent to @option{-msoft-float}, but additionally asserts that the
26643 program being compiled does not perform any floating-point operations.
26644 This option is presently supported only by some bare-metal MIPS
26645 configurations, where it may select a special set of libraries
26646 that lack all floating-point support (including, for example, the
26647 floating-point @code{printf} formats).
26648 If code compiled with @option{-mno-float} accidentally contains
26649 floating-point operations, it is likely to suffer a link-time
26650 or run-time failure.
26651
26652 @item -msingle-float
26653 @opindex msingle-float
26654 Assume that the floating-point coprocessor only supports single-precision
26655 operations.
26656
26657 @item -mdouble-float
26658 @opindex mdouble-float
26659 Assume that the floating-point coprocessor supports double-precision
26660 operations. This is the default.
26661
26662 @item -modd-spreg
26663 @itemx -mno-odd-spreg
26664 @opindex modd-spreg
26665 @opindex mno-odd-spreg
26666 Enable the use of odd-numbered single-precision floating-point registers
26667 for the o32 ABI. This is the default for processors that are known to
26668 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
26669 is set by default.
26670
26671 @item -mabs=2008
26672 @itemx -mabs=legacy
26673 @opindex mabs=2008
26674 @opindex mabs=legacy
26675 These options control the treatment of the special not-a-number (NaN)
26676 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
26677 @code{neg.@i{fmt}} machine instructions.
26678
26679 By default or when @option{-mabs=legacy} is used the legacy
26680 treatment is selected. In this case these instructions are considered
26681 arithmetic and avoided where correct operation is required and the
26682 input operand might be a NaN. A longer sequence of instructions that
26683 manipulate the sign bit of floating-point datum manually is used
26684 instead unless the @option{-ffinite-math-only} option has also been
26685 specified.
26686
26687 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
26688 this case these instructions are considered non-arithmetic and therefore
26689 operating correctly in all cases, including in particular where the
26690 input operand is a NaN. These instructions are therefore always used
26691 for the respective operations.
26692
26693 @item -mnan=2008
26694 @itemx -mnan=legacy
26695 @opindex mnan=2008
26696 @opindex mnan=legacy
26697 These options control the encoding of the special not-a-number (NaN)
26698 IEEE 754 floating-point data.
26699
26700 The @option{-mnan=legacy} option selects the legacy encoding. In this
26701 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
26702 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
26703 by the first bit of their trailing significand field being 1.
26704
26705 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
26706 this case qNaNs are denoted by the first bit of their trailing
26707 significand field being 1, whereas sNaNs are denoted by the first bit of
26708 their trailing significand field being 0.
26709
26710 The default is @option{-mnan=legacy} unless GCC has been configured with
26711 @option{--with-nan=2008}.
26712
26713 @item -mllsc
26714 @itemx -mno-llsc
26715 @opindex mllsc
26716 @opindex mno-llsc
26717 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
26718 implement atomic memory built-in functions. When neither option is
26719 specified, GCC uses the instructions if the target architecture
26720 supports them.
26721
26722 @option{-mllsc} is useful if the runtime environment can emulate the
26723 instructions and @option{-mno-llsc} can be useful when compiling for
26724 nonstandard ISAs. You can make either option the default by
26725 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
26726 respectively. @option{--with-llsc} is the default for some
26727 configurations; see the installation documentation for details.
26728
26729 @item -mdsp
26730 @itemx -mno-dsp
26731 @opindex mdsp
26732 @opindex mno-dsp
26733 Use (do not use) revision 1 of the MIPS DSP ASE@.
26734 @xref{MIPS DSP Built-in Functions}. This option defines the
26735 preprocessor macro @code{__mips_dsp}. It also defines
26736 @code{__mips_dsp_rev} to 1.
26737
26738 @item -mdspr2
26739 @itemx -mno-dspr2
26740 @opindex mdspr2
26741 @opindex mno-dspr2
26742 Use (do not use) revision 2 of the MIPS DSP ASE@.
26743 @xref{MIPS DSP Built-in Functions}. This option defines the
26744 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
26745 It also defines @code{__mips_dsp_rev} to 2.
26746
26747 @item -msmartmips
26748 @itemx -mno-smartmips
26749 @opindex msmartmips
26750 @opindex mno-smartmips
26751 Use (do not use) the MIPS SmartMIPS ASE.
26752
26753 @item -mpaired-single
26754 @itemx -mno-paired-single
26755 @opindex mpaired-single
26756 @opindex mno-paired-single
26757 Use (do not use) paired-single floating-point instructions.
26758 @xref{MIPS Paired-Single Support}. This option requires
26759 hardware floating-point support to be enabled.
26760
26761 @item -mdmx
26762 @itemx -mno-mdmx
26763 @opindex mdmx
26764 @opindex mno-mdmx
26765 Use (do not use) MIPS Digital Media Extension instructions.
26766 This option can only be used when generating 64-bit code and requires
26767 hardware floating-point support to be enabled.
26768
26769 @item -mips3d
26770 @itemx -mno-mips3d
26771 @opindex mips3d
26772 @opindex mno-mips3d
26773 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
26774 The option @option{-mips3d} implies @option{-mpaired-single}.
26775
26776 @item -mmicromips
26777 @itemx -mno-micromips
26778 @opindex mmicromips
26779 @opindex mno-mmicromips
26780 Generate (do not generate) microMIPS code.
26781
26782 MicroMIPS code generation can also be controlled on a per-function basis
26783 by means of @code{micromips} and @code{nomicromips} attributes.
26784 @xref{Function Attributes}, for more information.
26785
26786 @item -mmt
26787 @itemx -mno-mt
26788 @opindex mmt
26789 @opindex mno-mt
26790 Use (do not use) MT Multithreading instructions.
26791
26792 @item -mmcu
26793 @itemx -mno-mcu
26794 @opindex mmcu
26795 @opindex mno-mcu
26796 Use (do not use) the MIPS MCU ASE instructions.
26797
26798 @item -meva
26799 @itemx -mno-eva
26800 @opindex meva
26801 @opindex mno-eva
26802 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
26803
26804 @item -mvirt
26805 @itemx -mno-virt
26806 @opindex mvirt
26807 @opindex mno-virt
26808 Use (do not use) the MIPS Virtualization (VZ) instructions.
26809
26810 @item -mxpa
26811 @itemx -mno-xpa
26812 @opindex mxpa
26813 @opindex mno-xpa
26814 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
26815
26816 @item -mcrc
26817 @itemx -mno-crc
26818 @opindex mcrc
26819 @opindex mno-crc
26820 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
26821
26822 @item -mginv
26823 @itemx -mno-ginv
26824 @opindex mginv
26825 @opindex mno-ginv
26826 Use (do not use) the MIPS Global INValidate (GINV) instructions.
26827
26828 @item -mloongson-mmi
26829 @itemx -mno-loongson-mmi
26830 @opindex mloongson-mmi
26831 @opindex mno-loongson-mmi
26832 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
26833
26834 @item -mloongson-ext
26835 @itemx -mno-loongson-ext
26836 @opindex mloongson-ext
26837 @opindex mno-loongson-ext
26838 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
26839
26840 @item -mloongson-ext2
26841 @itemx -mno-loongson-ext2
26842 @opindex mloongson-ext2
26843 @opindex mno-loongson-ext2
26844 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
26845
26846 @item -mlong64
26847 @opindex mlong64
26848 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
26849 an explanation of the default and the way that the pointer size is
26850 determined.
26851
26852 @item -mlong32
26853 @opindex mlong32
26854 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
26855
26856 The default size of @code{int}s, @code{long}s and pointers depends on
26857 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
26858 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
26859 32-bit @code{long}s. Pointers are the same size as @code{long}s,
26860 or the same size as integer registers, whichever is smaller.
26861
26862 @item -msym32
26863 @itemx -mno-sym32
26864 @opindex msym32
26865 @opindex mno-sym32
26866 Assume (do not assume) that all symbols have 32-bit values, regardless
26867 of the selected ABI@. This option is useful in combination with
26868 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
26869 to generate shorter and faster references to symbolic addresses.
26870
26871 @item -G @var{num}
26872 @opindex G
26873 Put definitions of externally-visible data in a small data section
26874 if that data is no bigger than @var{num} bytes. GCC can then generate
26875 more efficient accesses to the data; see @option{-mgpopt} for details.
26876
26877 The default @option{-G} option depends on the configuration.
26878
26879 @item -mlocal-sdata
26880 @itemx -mno-local-sdata
26881 @opindex mlocal-sdata
26882 @opindex mno-local-sdata
26883 Extend (do not extend) the @option{-G} behavior to local data too,
26884 such as to static variables in C@. @option{-mlocal-sdata} is the
26885 default for all configurations.
26886
26887 If the linker complains that an application is using too much small data,
26888 you might want to try rebuilding the less performance-critical parts with
26889 @option{-mno-local-sdata}. You might also want to build large
26890 libraries with @option{-mno-local-sdata}, so that the libraries leave
26891 more room for the main program.
26892
26893 @item -mextern-sdata
26894 @itemx -mno-extern-sdata
26895 @opindex mextern-sdata
26896 @opindex mno-extern-sdata
26897 Assume (do not assume) that externally-defined data is in
26898 a small data section if the size of that data is within the @option{-G} limit.
26899 @option{-mextern-sdata} is the default for all configurations.
26900
26901 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
26902 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
26903 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
26904 is placed in a small data section. If @var{Var} is defined by another
26905 module, you must either compile that module with a high-enough
26906 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
26907 definition. If @var{Var} is common, you must link the application
26908 with a high-enough @option{-G} setting.
26909
26910 The easiest way of satisfying these restrictions is to compile
26911 and link every module with the same @option{-G} option. However,
26912 you may wish to build a library that supports several different
26913 small data limits. You can do this by compiling the library with
26914 the highest supported @option{-G} setting and additionally using
26915 @option{-mno-extern-sdata} to stop the library from making assumptions
26916 about externally-defined data.
26917
26918 @item -mgpopt
26919 @itemx -mno-gpopt
26920 @opindex mgpopt
26921 @opindex mno-gpopt
26922 Use (do not use) GP-relative accesses for symbols that are known to be
26923 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
26924 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
26925 configurations.
26926
26927 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
26928 might not hold the value of @code{_gp}. For example, if the code is
26929 part of a library that might be used in a boot monitor, programs that
26930 call boot monitor routines pass an unknown value in @code{$gp}.
26931 (In such situations, the boot monitor itself is usually compiled
26932 with @option{-G0}.)
26933
26934 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
26935 @option{-mno-extern-sdata}.
26936
26937 @item -membedded-data
26938 @itemx -mno-embedded-data
26939 @opindex membedded-data
26940 @opindex mno-embedded-data
26941 Allocate variables to the read-only data section first if possible, then
26942 next in the small data section if possible, otherwise in data. This gives
26943 slightly slower code than the default, but reduces the amount of RAM required
26944 when executing, and thus may be preferred for some embedded systems.
26945
26946 @item -muninit-const-in-rodata
26947 @itemx -mno-uninit-const-in-rodata
26948 @opindex muninit-const-in-rodata
26949 @opindex mno-uninit-const-in-rodata
26950 Put uninitialized @code{const} variables in the read-only data section.
26951 This option is only meaningful in conjunction with @option{-membedded-data}.
26952
26953 @item -mcode-readable=@var{setting}
26954 @opindex mcode-readable
26955 Specify whether GCC may generate code that reads from executable sections.
26956 There are three possible settings:
26957
26958 @table @gcctabopt
26959 @item -mcode-readable=yes
26960 Instructions may freely access executable sections. This is the
26961 default setting.
26962
26963 @item -mcode-readable=pcrel
26964 MIPS16 PC-relative load instructions can access executable sections,
26965 but other instructions must not do so. This option is useful on 4KSc
26966 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
26967 It is also useful on processors that can be configured to have a dual
26968 instruction/data SRAM interface and that, like the M4K, automatically
26969 redirect PC-relative loads to the instruction RAM.
26970
26971 @item -mcode-readable=no
26972 Instructions must not access executable sections. This option can be
26973 useful on targets that are configured to have a dual instruction/data
26974 SRAM interface but that (unlike the M4K) do not automatically redirect
26975 PC-relative loads to the instruction RAM.
26976 @end table
26977
26978 @item -msplit-addresses
26979 @itemx -mno-split-addresses
26980 @opindex msplit-addresses
26981 @opindex mno-split-addresses
26982 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
26983 relocation operators. This option has been superseded by
26984 @option{-mexplicit-relocs} but is retained for backwards compatibility.
26985
26986 @item -mexplicit-relocs
26987 @itemx -mno-explicit-relocs
26988 @opindex mexplicit-relocs
26989 @opindex mno-explicit-relocs
26990 Use (do not use) assembler relocation operators when dealing with symbolic
26991 addresses. The alternative, selected by @option{-mno-explicit-relocs},
26992 is to use assembler macros instead.
26993
26994 @option{-mexplicit-relocs} is the default if GCC was configured
26995 to use an assembler that supports relocation operators.
26996
26997 @item -mcheck-zero-division
26998 @itemx -mno-check-zero-division
26999 @opindex mcheck-zero-division
27000 @opindex mno-check-zero-division
27001 Trap (do not trap) on integer division by zero.
27002
27003 The default is @option{-mcheck-zero-division}.
27004
27005 @item -mdivide-traps
27006 @itemx -mdivide-breaks
27007 @opindex mdivide-traps
27008 @opindex mdivide-breaks
27009 MIPS systems check for division by zero by generating either a
27010 conditional trap or a break instruction. Using traps results in
27011 smaller code, but is only supported on MIPS II and later. Also, some
27012 versions of the Linux kernel have a bug that prevents trap from
27013 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
27014 allow conditional traps on architectures that support them and
27015 @option{-mdivide-breaks} to force the use of breaks.
27016
27017 The default is usually @option{-mdivide-traps}, but this can be
27018 overridden at configure time using @option{--with-divide=breaks}.
27019 Divide-by-zero checks can be completely disabled using
27020 @option{-mno-check-zero-division}.
27021
27022 @item -mload-store-pairs
27023 @itemx -mno-load-store-pairs
27024 @opindex mload-store-pairs
27025 @opindex mno-load-store-pairs
27026 Enable (disable) an optimization that pairs consecutive load or store
27027 instructions to enable load/store bonding. This option is enabled by
27028 default but only takes effect when the selected architecture is known
27029 to support bonding.
27030
27031 @item -munaligned-access
27032 @itemx -mno-unaligned-access
27033 @opindex munaligned-access
27034 @opindex mno-unaligned-access
27035 Enable (disable) direct unaligned access for MIPS Release 6.
27036 MIPSr6 requires load/store unaligned-access support,
27037 by hardware or trap&emulate.
27038 So @option{-mno-unaligned-access} may be needed by kernel.
27039
27040 @item -mmemcpy
27041 @itemx -mno-memcpy
27042 @opindex mmemcpy
27043 @opindex mno-memcpy
27044 Force (do not force) the use of @code{memcpy} for non-trivial block
27045 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
27046 most constant-sized copies.
27047
27048 @item -mlong-calls
27049 @itemx -mno-long-calls
27050 @opindex mlong-calls
27051 @opindex mno-long-calls
27052 Disable (do not disable) use of the @code{jal} instruction. Calling
27053 functions using @code{jal} is more efficient but requires the caller
27054 and callee to be in the same 256 megabyte segment.
27055
27056 This option has no effect on abicalls code. The default is
27057 @option{-mno-long-calls}.
27058
27059 @item -mmad
27060 @itemx -mno-mad
27061 @opindex mmad
27062 @opindex mno-mad
27063 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27064 instructions, as provided by the R4650 ISA@.
27065
27066 @item -mimadd
27067 @itemx -mno-imadd
27068 @opindex mimadd
27069 @opindex mno-imadd
27070 Enable (disable) use of the @code{madd} and @code{msub} integer
27071 instructions. The default is @option{-mimadd} on architectures
27072 that support @code{madd} and @code{msub} except for the 74k
27073 architecture where it was found to generate slower code.
27074
27075 @item -mfused-madd
27076 @itemx -mno-fused-madd
27077 @opindex mfused-madd
27078 @opindex mno-fused-madd
27079 Enable (disable) use of the floating-point multiply-accumulate
27080 instructions, when they are available. The default is
27081 @option{-mfused-madd}.
27082
27083 On the R8000 CPU when multiply-accumulate instructions are used,
27084 the intermediate product is calculated to infinite precision
27085 and is not subject to the FCSR Flush to Zero bit. This may be
27086 undesirable in some circumstances. On other processors the result
27087 is numerically identical to the equivalent computation using
27088 separate multiply, add, subtract and negate instructions.
27089
27090 @item -nocpp
27091 @opindex nocpp
27092 Tell the MIPS assembler to not run its preprocessor over user
27093 assembler files (with a @samp{.s} suffix) when assembling them.
27094
27095 @item -mfix-24k
27096 @itemx -mno-fix-24k
27097 @opindex mfix-24k
27098 @opindex mno-fix-24k
27099 Work around the 24K E48 (lost data on stores during refill) errata.
27100 The workarounds are implemented by the assembler rather than by GCC@.
27101
27102 @item -mfix-r4000
27103 @itemx -mno-fix-r4000
27104 @opindex mfix-r4000
27105 @opindex mno-fix-r4000
27106 Work around certain R4000 CPU errata:
27107 @itemize @minus
27108 @item
27109 A double-word or a variable shift may give an incorrect result if executed
27110 immediately after starting an integer division.
27111 @item
27112 A double-word or a variable shift may give an incorrect result if executed
27113 while an integer multiplication is in progress.
27114 @item
27115 An integer division may give an incorrect result if started in a delay slot
27116 of a taken branch or a jump.
27117 @end itemize
27118
27119 @item -mfix-r4400
27120 @itemx -mno-fix-r4400
27121 @opindex mfix-r4400
27122 @opindex mno-fix-r4400
27123 Work around certain R4400 CPU errata:
27124 @itemize @minus
27125 @item
27126 A double-word or a variable shift may give an incorrect result if executed
27127 immediately after starting an integer division.
27128 @end itemize
27129
27130 @item -mfix-r10000
27131 @itemx -mno-fix-r10000
27132 @opindex mfix-r10000
27133 @opindex mno-fix-r10000
27134 Work around certain R10000 errata:
27135 @itemize @minus
27136 @item
27137 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27138 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
27139 @end itemize
27140
27141 This option can only be used if the target architecture supports
27142 branch-likely instructions. @option{-mfix-r10000} is the default when
27143 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27144 otherwise.
27145
27146 @item -mfix-r5900
27147 @itemx -mno-fix-r5900
27148 @opindex mfix-r5900
27149 Do not attempt to schedule the preceding instruction into the delay slot
27150 of a branch instruction placed at the end of a short loop of six
27151 instructions or fewer and always schedule a @code{nop} instruction there
27152 instead. The short loop bug under certain conditions causes loops to
27153 execute only once or twice, due to a hardware bug in the R5900 chip. The
27154 workaround is implemented by the assembler rather than by GCC@.
27155
27156 @item -mfix-rm7000
27157 @itemx -mno-fix-rm7000
27158 @opindex mfix-rm7000
27159 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
27160 workarounds are implemented by the assembler rather than by GCC@.
27161
27162 @item -mfix-vr4120
27163 @itemx -mno-fix-vr4120
27164 @opindex mfix-vr4120
27165 Work around certain VR4120 errata:
27166 @itemize @minus
27167 @item
27168 @code{dmultu} does not always produce the correct result.
27169 @item
27170 @code{div} and @code{ddiv} do not always produce the correct result if one
27171 of the operands is negative.
27172 @end itemize
27173 The workarounds for the division errata rely on special functions in
27174 @file{libgcc.a}. At present, these functions are only provided by
27175 the @code{mips64vr*-elf} configurations.
27176
27177 Other VR4120 errata require a NOP to be inserted between certain pairs of
27178 instructions. These errata are handled by the assembler, not by GCC itself.
27179
27180 @item -mfix-vr4130
27181 @opindex mfix-vr4130
27182 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
27183 workarounds are implemented by the assembler rather than by GCC,
27184 although GCC avoids using @code{mflo} and @code{mfhi} if the
27185 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27186 instructions are available instead.
27187
27188 @item -mfix-sb1
27189 @itemx -mno-fix-sb1
27190 @opindex mfix-sb1
27191 Work around certain SB-1 CPU core errata.
27192 (This flag currently works around the SB-1 revision 2
27193 ``F1'' and ``F2'' floating-point errata.)
27194
27195 @item -mr10k-cache-barrier=@var{setting}
27196 @opindex mr10k-cache-barrier
27197 Specify whether GCC should insert cache barriers to avoid the
27198 side effects of speculation on R10K processors.
27199
27200 In common with many processors, the R10K tries to predict the outcome
27201 of a conditional branch and speculatively executes instructions from
27202 the ``taken'' branch. It later aborts these instructions if the
27203 predicted outcome is wrong. However, on the R10K, even aborted
27204 instructions can have side effects.
27205
27206 This problem only affects kernel stores and, depending on the system,
27207 kernel loads. As an example, a speculatively-executed store may load
27208 the target memory into cache and mark the cache line as dirty, even if
27209 the store itself is later aborted. If a DMA operation writes to the
27210 same area of memory before the ``dirty'' line is flushed, the cached
27211 data overwrites the DMA-ed data. See the R10K processor manual
27212 for a full description, including other potential problems.
27213
27214 One workaround is to insert cache barrier instructions before every memory
27215 access that might be speculatively executed and that might have side
27216 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
27217 controls GCC's implementation of this workaround. It assumes that
27218 aborted accesses to any byte in the following regions does not have
27219 side effects:
27220
27221 @enumerate
27222 @item
27223 the memory occupied by the current function's stack frame;
27224
27225 @item
27226 the memory occupied by an incoming stack argument;
27227
27228 @item
27229 the memory occupied by an object with a link-time-constant address.
27230 @end enumerate
27231
27232 It is the kernel's responsibility to ensure that speculative
27233 accesses to these regions are indeed safe.
27234
27235 If the input program contains a function declaration such as:
27236
27237 @smallexample
27238 void foo (void);
27239 @end smallexample
27240
27241 then the implementation of @code{foo} must allow @code{j foo} and
27242 @code{jal foo} to be executed speculatively. GCC honors this
27243 restriction for functions it compiles itself. It expects non-GCC
27244 functions (such as hand-written assembly code) to do the same.
27245
27246 The option has three forms:
27247
27248 @table @gcctabopt
27249 @item -mr10k-cache-barrier=load-store
27250 Insert a cache barrier before a load or store that might be
27251 speculatively executed and that might have side effects even
27252 if aborted.
27253
27254 @item -mr10k-cache-barrier=store
27255 Insert a cache barrier before a store that might be speculatively
27256 executed and that might have side effects even if aborted.
27257
27258 @item -mr10k-cache-barrier=none
27259 Disable the insertion of cache barriers. This is the default setting.
27260 @end table
27261
27262 @item -mflush-func=@var{func}
27263 @itemx -mno-flush-func
27264 @opindex mflush-func
27265 Specifies the function to call to flush the I and D caches, or to not
27266 call any such function. If called, the function must take the same
27267 arguments as the common @code{_flush_func}, that is, the address of the
27268 memory range for which the cache is being flushed, the size of the
27269 memory range, and the number 3 (to flush both caches). The default
27270 depends on the target GCC was configured for, but commonly is either
27271 @code{_flush_func} or @code{__cpu_flush}.
27272
27273 @item mbranch-cost=@var{num}
27274 @opindex mbranch-cost
27275 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27276 This cost is only a heuristic and is not guaranteed to produce
27277 consistent results across releases. A zero cost redundantly selects
27278 the default, which is based on the @option{-mtune} setting.
27279
27280 @item -mbranch-likely
27281 @itemx -mno-branch-likely
27282 @opindex mbranch-likely
27283 @opindex mno-branch-likely
27284 Enable or disable use of Branch Likely instructions, regardless of the
27285 default for the selected architecture. By default, Branch Likely
27286 instructions may be generated if they are supported by the selected
27287 architecture. An exception is for the MIPS32 and MIPS64 architectures
27288 and processors that implement those architectures; for those, Branch
27289 Likely instructions are not be generated by default because the MIPS32
27290 and MIPS64 architectures specifically deprecate their use.
27291
27292 @item -mcompact-branches=never
27293 @itemx -mcompact-branches=optimal
27294 @itemx -mcompact-branches=always
27295 @opindex mcompact-branches=never
27296 @opindex mcompact-branches=optimal
27297 @opindex mcompact-branches=always
27298 These options control which form of branches will be generated. The
27299 default is @option{-mcompact-branches=optimal}.
27300
27301 The @option{-mcompact-branches=never} option ensures that compact branch
27302 instructions will never be generated.
27303
27304 The @option{-mcompact-branches=always} option ensures that a compact
27305 branch instruction will be generated if available for MIPS Release 6 onwards.
27306 If a compact branch instruction is not available (or pre-R6),
27307 a delay slot form of the branch will be used instead.
27308
27309 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27310 The behaviour for MIPS16/microMIPS may change in future,
27311 since they do have some compact branch instructions.
27312
27313 The @option{-mcompact-branches=optimal} option will cause a delay slot
27314 branch to be used if one is available in the current ISA and the delay
27315 slot is successfully filled. If the delay slot is not filled, a compact
27316 branch will be chosen if one is available.
27317
27318 @item -mfp-exceptions
27319 @itemx -mno-fp-exceptions
27320 @opindex mfp-exceptions
27321 Specifies whether FP exceptions are enabled. This affects how
27322 FP instructions are scheduled for some processors.
27323 The default is that FP exceptions are
27324 enabled.
27325
27326 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27327 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
27328 FP pipe.
27329
27330 @item -mvr4130-align
27331 @itemx -mno-vr4130-align
27332 @opindex mvr4130-align
27333 The VR4130 pipeline is two-way superscalar, but can only issue two
27334 instructions together if the first one is 8-byte aligned. When this
27335 option is enabled, GCC aligns pairs of instructions that it
27336 thinks should execute in parallel.
27337
27338 This option only has an effect when optimizing for the VR4130.
27339 It normally makes code faster, but at the expense of making it bigger.
27340 It is enabled by default at optimization level @option{-O3}.
27341
27342 @item -msynci
27343 @itemx -mno-synci
27344 @opindex msynci
27345 Enable (disable) generation of @code{synci} instructions on
27346 architectures that support it. The @code{synci} instructions (if
27347 enabled) are generated when @code{__builtin___clear_cache} is
27348 compiled.
27349
27350 This option defaults to @option{-mno-synci}, but the default can be
27351 overridden by configuring GCC with @option{--with-synci}.
27352
27353 When compiling code for single processor systems, it is generally safe
27354 to use @code{synci}. However, on many multi-core (SMP) systems, it
27355 does not invalidate the instruction caches on all cores and may lead
27356 to undefined behavior.
27357
27358 @item -mrelax-pic-calls
27359 @itemx -mno-relax-pic-calls
27360 @opindex mrelax-pic-calls
27361 Try to turn PIC calls that are normally dispatched via register
27362 @code{$25} into direct calls. This is only possible if the linker can
27363 resolve the destination at link time and if the destination is within
27364 range for a direct call.
27365
27366 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27367 an assembler and a linker that support the @code{.reloc} assembly
27368 directive and @option{-mexplicit-relocs} is in effect. With
27369 @option{-mno-explicit-relocs}, this optimization can be performed by the
27370 assembler and the linker alone without help from the compiler.
27371
27372 @item -mmcount-ra-address
27373 @itemx -mno-mcount-ra-address
27374 @opindex mmcount-ra-address
27375 @opindex mno-mcount-ra-address
27376 Emit (do not emit) code that allows @code{_mcount} to modify the
27377 calling function's return address. When enabled, this option extends
27378 the usual @code{_mcount} interface with a new @var{ra-address}
27379 parameter, which has type @code{intptr_t *} and is passed in register
27380 @code{$12}. @code{_mcount} can then modify the return address by
27381 doing both of the following:
27382 @itemize
27383 @item
27384 Returning the new address in register @code{$31}.
27385 @item
27386 Storing the new address in @code{*@var{ra-address}},
27387 if @var{ra-address} is nonnull.
27388 @end itemize
27389
27390 The default is @option{-mno-mcount-ra-address}.
27391
27392 @item -mframe-header-opt
27393 @itemx -mno-frame-header-opt
27394 @opindex mframe-header-opt
27395 Enable (disable) frame header optimization in the o32 ABI. When using the
27396 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
27397 function to write out register arguments. When enabled, this optimization
27398 will suppress the allocation of the frame header if it can be determined that
27399 it is unused.
27400
27401 This optimization is off by default at all optimization levels.
27402
27403 @item -mlxc1-sxc1
27404 @itemx -mno-lxc1-sxc1
27405 @opindex mlxc1-sxc1
27406 When applicable, enable (disable) the generation of @code{lwxc1},
27407 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
27408
27409 @item -mmadd4
27410 @itemx -mno-madd4
27411 @opindex mmadd4
27412 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
27413 @code{madd.d} and related instructions. Enabled by default.
27414
27415 @end table
27416
27417 @node MMIX Options
27418 @subsection MMIX Options
27419 @cindex MMIX Options
27420
27421 These options are defined for the MMIX:
27422
27423 @table @gcctabopt
27424 @item -mlibfuncs
27425 @itemx -mno-libfuncs
27426 @opindex mlibfuncs
27427 @opindex mno-libfuncs
27428 Specify that intrinsic library functions are being compiled, passing all
27429 values in registers, no matter the size.
27430
27431 @item -mepsilon
27432 @itemx -mno-epsilon
27433 @opindex mepsilon
27434 @opindex mno-epsilon
27435 Generate floating-point comparison instructions that compare with respect
27436 to the @code{rE} epsilon register.
27437
27438 @item -mabi=mmixware
27439 @itemx -mabi=gnu
27440 @opindex mabi=mmixware
27441 @opindex mabi=gnu
27442 Generate code that passes function parameters and return values that (in
27443 the called function) are seen as registers @code{$0} and up, as opposed to
27444 the GNU ABI which uses global registers @code{$231} and up.
27445
27446 @item -mzero-extend
27447 @itemx -mno-zero-extend
27448 @opindex mzero-extend
27449 @opindex mno-zero-extend
27450 When reading data from memory in sizes shorter than 64 bits, use (do not
27451 use) zero-extending load instructions by default, rather than
27452 sign-extending ones.
27453
27454 @item -mknuthdiv
27455 @itemx -mno-knuthdiv
27456 @opindex mknuthdiv
27457 @opindex mno-knuthdiv
27458 Make the result of a division yielding a remainder have the same sign as
27459 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
27460 remainder follows the sign of the dividend. Both methods are
27461 arithmetically valid, the latter being almost exclusively used.
27462
27463 @item -mtoplevel-symbols
27464 @itemx -mno-toplevel-symbols
27465 @opindex mtoplevel-symbols
27466 @opindex mno-toplevel-symbols
27467 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
27468 code can be used with the @code{PREFIX} assembly directive.
27469
27470 @item -melf
27471 @opindex melf
27472 Generate an executable in the ELF format, rather than the default
27473 @samp{mmo} format used by the @command{mmix} simulator.
27474
27475 @item -mbranch-predict
27476 @itemx -mno-branch-predict
27477 @opindex mbranch-predict
27478 @opindex mno-branch-predict
27479 Use (do not use) the probable-branch instructions, when static branch
27480 prediction indicates a probable branch.
27481
27482 @item -mbase-addresses
27483 @itemx -mno-base-addresses
27484 @opindex mbase-addresses
27485 @opindex mno-base-addresses
27486 Generate (do not generate) code that uses @emph{base addresses}. Using a
27487 base address automatically generates a request (handled by the assembler
27488 and the linker) for a constant to be set up in a global register. The
27489 register is used for one or more base address requests within the range 0
27490 to 255 from the value held in the register. The generally leads to short
27491 and fast code, but the number of different data items that can be
27492 addressed is limited. This means that a program that uses lots of static
27493 data may require @option{-mno-base-addresses}.
27494
27495 @item -msingle-exit
27496 @itemx -mno-single-exit
27497 @opindex msingle-exit
27498 @opindex mno-single-exit
27499 Force (do not force) generated code to have a single exit point in each
27500 function.
27501 @end table
27502
27503 @node MN10300 Options
27504 @subsection MN10300 Options
27505 @cindex MN10300 options
27506
27507 These @option{-m} options are defined for Matsushita MN10300 architectures:
27508
27509 @table @gcctabopt
27510 @item -mmult-bug
27511 @opindex mmult-bug
27512 Generate code to avoid bugs in the multiply instructions for the MN10300
27513 processors. This is the default.
27514
27515 @item -mno-mult-bug
27516 @opindex mno-mult-bug
27517 Do not generate code to avoid bugs in the multiply instructions for the
27518 MN10300 processors.
27519
27520 @item -mam33
27521 @opindex mam33
27522 Generate code using features specific to the AM33 processor.
27523
27524 @item -mno-am33
27525 @opindex mno-am33
27526 Do not generate code using features specific to the AM33 processor. This
27527 is the default.
27528
27529 @item -mam33-2
27530 @opindex mam33-2
27531 Generate code using features specific to the AM33/2.0 processor.
27532
27533 @item -mam34
27534 @opindex mam34
27535 Generate code using features specific to the AM34 processor.
27536
27537 @item -mtune=@var{cpu-type}
27538 @opindex mtune
27539 Use the timing characteristics of the indicated CPU type when
27540 scheduling instructions. This does not change the targeted processor
27541 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
27542 @samp{am33-2} or @samp{am34}.
27543
27544 @item -mreturn-pointer-on-d0
27545 @opindex mreturn-pointer-on-d0
27546 When generating a function that returns a pointer, return the pointer
27547 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
27548 only in @code{a0}, and attempts to call such functions without a prototype
27549 result in errors. Note that this option is on by default; use
27550 @option{-mno-return-pointer-on-d0} to disable it.
27551
27552 @item -mno-crt0
27553 @opindex mno-crt0
27554 Do not link in the C run-time initialization object file.
27555
27556 @item -mrelax
27557 @opindex mrelax
27558 Indicate to the linker that it should perform a relaxation optimization pass
27559 to shorten branches, calls and absolute memory addresses. This option only
27560 has an effect when used on the command line for the final link step.
27561
27562 This option makes symbolic debugging impossible.
27563
27564 @item -mliw
27565 @opindex mliw
27566 Allow the compiler to generate @emph{Long Instruction Word}
27567 instructions if the target is the @samp{AM33} or later. This is the
27568 default. This option defines the preprocessor macro @code{__LIW__}.
27569
27570 @item -mno-liw
27571 @opindex mno-liw
27572 Do not allow the compiler to generate @emph{Long Instruction Word}
27573 instructions. This option defines the preprocessor macro
27574 @code{__NO_LIW__}.
27575
27576 @item -msetlb
27577 @opindex msetlb
27578 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
27579 instructions if the target is the @samp{AM33} or later. This is the
27580 default. This option defines the preprocessor macro @code{__SETLB__}.
27581
27582 @item -mno-setlb
27583 @opindex mno-setlb
27584 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
27585 instructions. This option defines the preprocessor macro
27586 @code{__NO_SETLB__}.
27587
27588 @end table
27589
27590 @node Moxie Options
27591 @subsection Moxie Options
27592 @cindex Moxie Options
27593
27594 @table @gcctabopt
27595
27596 @item -meb
27597 @opindex meb
27598 Generate big-endian code. This is the default for @samp{moxie-*-*}
27599 configurations.
27600
27601 @item -mel
27602 @opindex mel
27603 Generate little-endian code.
27604
27605 @item -mmul.x
27606 @opindex mmul.x
27607 Generate mul.x and umul.x instructions. This is the default for
27608 @samp{moxiebox-*-*} configurations.
27609
27610 @item -mno-crt0
27611 @opindex mno-crt0
27612 Do not link in the C run-time initialization object file.
27613
27614 @end table
27615
27616 @node MSP430 Options
27617 @subsection MSP430 Options
27618 @cindex MSP430 Options
27619
27620 These options are defined for the MSP430:
27621
27622 @table @gcctabopt
27623
27624 @item -masm-hex
27625 @opindex masm-hex
27626 Force assembly output to always use hex constants. Normally such
27627 constants are signed decimals, but this option is available for
27628 testsuite and/or aesthetic purposes.
27629
27630 @item -mmcu=
27631 @opindex mmcu=
27632 Select the MCU to target. This is used to create a C preprocessor
27633 symbol based upon the MCU name, converted to upper case and pre- and
27634 post-fixed with @samp{__}. This in turn is used by the
27635 @file{msp430.h} header file to select an MCU-specific supplementary
27636 header file.
27637
27638 The option also sets the ISA to use. If the MCU name is one that is
27639 known to only support the 430 ISA then that is selected, otherwise the
27640 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
27641 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
27642 name selects the 430X ISA.
27643
27644 In addition an MCU-specific linker script is added to the linker
27645 command line. The script's name is the name of the MCU with
27646 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
27647 command line defines the C preprocessor symbol @code{__XXX__} and
27648 cause the linker to search for a script called @file{xxx.ld}.
27649
27650 The ISA and hardware multiply supported for the different MCUs is hard-coded
27651 into GCC. However, an external @samp{devices.csv} file can be used to
27652 extend device support beyond those that have been hard-coded.
27653
27654 GCC searches for the @samp{devices.csv} file using the following methods in the
27655 given precedence order, where the first method takes precendence over the
27656 second which takes precedence over the third.
27657
27658 @table @asis
27659 @item Include path specified with @code{-I} and @code{-L}
27660 @samp{devices.csv} will be searched for in each of the directories specified by
27661 include paths and linker library search paths.
27662 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
27663 Define the value of the global environment variable
27664 @samp{MSP430_GCC_INCLUDE_DIR}
27665 to the full path to the directory containing devices.csv, and GCC will search
27666 this directory for devices.csv. If devices.csv is found, this directory will
27667 also be registered as an include path, and linker library path. Header files
27668 and linker scripts in this directory can therefore be used without manually
27669 specifying @code{-I} and @code{-L} on the command line.
27670 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
27671 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
27672 toolchain root directory. This directory does not exist in a default
27673 installation, but if the user has created it and copied @samp{devices.csv}
27674 there, then the MCU data will be read. As above, this directory will
27675 also be registered as an include path, and linker library path.
27676
27677 @end table
27678 If none of the above search methods find @samp{devices.csv}, then the
27679 hard-coded MCU data is used.
27680
27681
27682 @item -mwarn-mcu
27683 @itemx -mno-warn-mcu
27684 @opindex mwarn-mcu
27685 @opindex mno-warn-mcu
27686 This option enables or disables warnings about conflicts between the
27687 MCU name specified by the @option{-mmcu} option and the ISA set by the
27688 @option{-mcpu} option and/or the hardware multiply support set by the
27689 @option{-mhwmult} option. It also toggles warnings about unrecognized
27690 MCU names. This option is on by default.
27691
27692 @item -mcpu=
27693 @opindex mcpu=
27694 Specifies the ISA to use. Accepted values are @samp{msp430},
27695 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
27696 @option{-mmcu=} option should be used to select the ISA.
27697
27698 @item -msim
27699 @opindex msim
27700 Link to the simulator runtime libraries and linker script. Overrides
27701 any scripts that would be selected by the @option{-mmcu=} option.
27702
27703 @item -mlarge
27704 @opindex mlarge
27705 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
27706
27707 @item -msmall
27708 @opindex msmall
27709 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
27710
27711 @item -mrelax
27712 @opindex mrelax
27713 This option is passed to the assembler and linker, and allows the
27714 linker to perform certain optimizations that cannot be done until
27715 the final link.
27716
27717 @item mhwmult=
27718 @opindex mhwmult=
27719 Describes the type of hardware multiply supported by the target.
27720 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
27721 for the original 16-bit-only multiply supported by early MCUs.
27722 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
27723 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
27724 A value of @samp{auto} can also be given. This tells GCC to deduce
27725 the hardware multiply support based upon the MCU name provided by the
27726 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
27727 the MCU name is not recognized then no hardware multiply support is
27728 assumed. @code{auto} is the default setting.
27729
27730 Hardware multiplies are normally performed by calling a library
27731 routine. This saves space in the generated code. When compiling at
27732 @option{-O3} or higher however the hardware multiplier is invoked
27733 inline. This makes for bigger, but faster code.
27734
27735 The hardware multiply routines disable interrupts whilst running and
27736 restore the previous interrupt state when they finish. This makes
27737 them safe to use inside interrupt handlers as well as in normal code.
27738
27739 @item -minrt
27740 @opindex minrt
27741 Enable the use of a minimum runtime environment - no static
27742 initializers or constructors. This is intended for memory-constrained
27743 devices. The compiler includes special symbols in some objects
27744 that tell the linker and runtime which code fragments are required.
27745
27746 @item -mtiny-printf
27747 @opindex mtiny-printf
27748 Enable reduced code size @code{printf} and @code{puts} library functions.
27749 The @samp{tiny} implementations of these functions are not reentrant, so
27750 must be used with caution in multi-threaded applications.
27751
27752 Support for streams has been removed and the string to be printed will
27753 always be sent to stdout via the @code{write} syscall. The string is not
27754 buffered before it is sent to write.
27755
27756 This option requires Newlib Nano IO, so GCC must be configured with
27757 @samp{--enable-newlib-nano-formatted-io}.
27758
27759 @item -mmax-inline-shift=
27760 @opindex mmax-inline-shift=
27761 This option takes an integer between 0 and 64 inclusive, and sets
27762 the maximum number of inline shift instructions which should be emitted to
27763 perform a shift operation by a constant amount. When this value needs to be
27764 exceeded, an mspabi helper function is used instead. The default value is 4.
27765
27766 This only affects cases where a shift by multiple positions cannot be
27767 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
27768
27769 Shifts of a 32-bit value are at least twice as costly, so the value passed for
27770 this option is divided by 2 and the resulting value used instead.
27771
27772 @item -mcode-region=
27773 @itemx -mdata-region=
27774 @opindex mcode-region
27775 @opindex mdata-region
27776 These options tell the compiler where to place functions and data that
27777 do not have one of the @code{lower}, @code{upper}, @code{either} or
27778 @code{section} attributes. Possible values are @code{lower},
27779 @code{upper}, @code{either} or @code{any}. The first three behave
27780 like the corresponding attribute. The fourth possible value -
27781 @code{any} - is the default. It leaves placement entirely up to the
27782 linker script and how it assigns the standard sections
27783 (@code{.text}, @code{.data}, etc) to the memory regions.
27784
27785 @item -msilicon-errata=
27786 @opindex msilicon-errata
27787 This option passes on a request to assembler to enable the fixes for
27788 the named silicon errata.
27789
27790 @item -msilicon-errata-warn=
27791 @opindex msilicon-errata-warn
27792 This option passes on a request to the assembler to enable warning
27793 messages when a silicon errata might need to be applied.
27794
27795 @item -mwarn-devices-csv
27796 @itemx -mno-warn-devices-csv
27797 @opindex mwarn-devices-csv
27798 @opindex mno-warn-devices-csv
27799 Warn if @samp{devices.csv} is not found or there are problem parsing it
27800 (default: on).
27801
27802 @end table
27803
27804 @node NDS32 Options
27805 @subsection NDS32 Options
27806 @cindex NDS32 Options
27807
27808 These options are defined for NDS32 implementations:
27809
27810 @table @gcctabopt
27811
27812 @item -mbig-endian
27813 @opindex mbig-endian
27814 Generate code in big-endian mode.
27815
27816 @item -mlittle-endian
27817 @opindex mlittle-endian
27818 Generate code in little-endian mode.
27819
27820 @item -mreduced-regs
27821 @opindex mreduced-regs
27822 Use reduced-set registers for register allocation.
27823
27824 @item -mfull-regs
27825 @opindex mfull-regs
27826 Use full-set registers for register allocation.
27827
27828 @item -mcmov
27829 @opindex mcmov
27830 Generate conditional move instructions.
27831
27832 @item -mno-cmov
27833 @opindex mno-cmov
27834 Do not generate conditional move instructions.
27835
27836 @item -mext-perf
27837 @opindex mext-perf
27838 Generate performance extension instructions.
27839
27840 @item -mno-ext-perf
27841 @opindex mno-ext-perf
27842 Do not generate performance extension instructions.
27843
27844 @item -mext-perf2
27845 @opindex mext-perf2
27846 Generate performance extension 2 instructions.
27847
27848 @item -mno-ext-perf2
27849 @opindex mno-ext-perf2
27850 Do not generate performance extension 2 instructions.
27851
27852 @item -mext-string
27853 @opindex mext-string
27854 Generate string extension instructions.
27855
27856 @item -mno-ext-string
27857 @opindex mno-ext-string
27858 Do not generate string extension instructions.
27859
27860 @item -mv3push
27861 @opindex mv3push
27862 Generate v3 push25/pop25 instructions.
27863
27864 @item -mno-v3push
27865 @opindex mno-v3push
27866 Do not generate v3 push25/pop25 instructions.
27867
27868 @item -m16-bit
27869 @opindex m16-bit
27870 Generate 16-bit instructions.
27871
27872 @item -mno-16-bit
27873 @opindex mno-16-bit
27874 Do not generate 16-bit instructions.
27875
27876 @item -misr-vector-size=@var{num}
27877 @opindex misr-vector-size
27878 Specify the size of each interrupt vector, which must be 4 or 16.
27879
27880 @item -mcache-block-size=@var{num}
27881 @opindex mcache-block-size
27882 Specify the size of each cache block,
27883 which must be a power of 2 between 4 and 512.
27884
27885 @item -march=@var{arch}
27886 @opindex march
27887 Specify the name of the target architecture.
27888
27889 @item -mcmodel=@var{code-model}
27890 @opindex mcmodel
27891 Set the code model to one of
27892 @table @asis
27893 @item @samp{small}
27894 All the data and read-only data segments must be within 512KB addressing space.
27895 The text segment must be within 16MB addressing space.
27896 @item @samp{medium}
27897 The data segment must be within 512KB while the read-only data segment can be
27898 within 4GB addressing space. The text segment should be still within 16MB
27899 addressing space.
27900 @item @samp{large}
27901 All the text and data segments can be within 4GB addressing space.
27902 @end table
27903
27904 @item -mctor-dtor
27905 @opindex mctor-dtor
27906 Enable constructor/destructor feature.
27907
27908 @item -mrelax
27909 @opindex mrelax
27910 Guide linker to relax instructions.
27911
27912 @end table
27913
27914 @node Nios II Options
27915 @subsection Nios II Options
27916 @cindex Nios II options
27917 @cindex Altera Nios II options
27918
27919 These are the options defined for the Altera Nios II processor.
27920
27921 @table @gcctabopt
27922
27923 @item -G @var{num}
27924 @opindex G
27925 @cindex smaller data references
27926 Put global and static objects less than or equal to @var{num} bytes
27927 into the small data or BSS sections instead of the normal data or BSS
27928 sections. The default value of @var{num} is 8.
27929
27930 @item -mgpopt=@var{option}
27931 @itemx -mgpopt
27932 @itemx -mno-gpopt
27933 @opindex mgpopt
27934 @opindex mno-gpopt
27935 Generate (do not generate) GP-relative accesses. The following
27936 @var{option} names are recognized:
27937
27938 @table @samp
27939
27940 @item none
27941 Do not generate GP-relative accesses.
27942
27943 @item local
27944 Generate GP-relative accesses for small data objects that are not
27945 external, weak, or uninitialized common symbols.
27946 Also use GP-relative addressing for objects that
27947 have been explicitly placed in a small data section via a @code{section}
27948 attribute.
27949
27950 @item global
27951 As for @samp{local}, but also generate GP-relative accesses for
27952 small data objects that are external, weak, or common. If you use this option,
27953 you must ensure that all parts of your program (including libraries) are
27954 compiled with the same @option{-G} setting.
27955
27956 @item data
27957 Generate GP-relative accesses for all data objects in the program. If you
27958 use this option, the entire data and BSS segments
27959 of your program must fit in 64K of memory and you must use an appropriate
27960 linker script to allocate them within the addressable range of the
27961 global pointer.
27962
27963 @item all
27964 Generate GP-relative addresses for function pointers as well as data
27965 pointers. If you use this option, the entire text, data, and BSS segments
27966 of your program must fit in 64K of memory and you must use an appropriate
27967 linker script to allocate them within the addressable range of the
27968 global pointer.
27969
27970 @end table
27971
27972 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
27973 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
27974
27975 The default is @option{-mgpopt} except when @option{-fpic} or
27976 @option{-fPIC} is specified to generate position-independent code.
27977 Note that the Nios II ABI does not permit GP-relative accesses from
27978 shared libraries.
27979
27980 You may need to specify @option{-mno-gpopt} explicitly when building
27981 programs that include large amounts of small data, including large
27982 GOT data sections. In this case, the 16-bit offset for GP-relative
27983 addressing may not be large enough to allow access to the entire
27984 small data section.
27985
27986 @item -mgprel-sec=@var{regexp}
27987 @opindex mgprel-sec
27988 This option specifies additional section names that can be accessed via
27989 GP-relative addressing. It is most useful in conjunction with
27990 @code{section} attributes on variable declarations
27991 (@pxref{Common Variable Attributes}) and a custom linker script.
27992 The @var{regexp} is a POSIX Extended Regular Expression.
27993
27994 This option does not affect the behavior of the @option{-G} option, and
27995 the specified sections are in addition to the standard @code{.sdata}
27996 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
27997
27998 @item -mr0rel-sec=@var{regexp}
27999 @opindex mr0rel-sec
28000 This option specifies names of sections that can be accessed via a
28001 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
28002 of the 32-bit address space. It is most useful in conjunction with
28003 @code{section} attributes on variable declarations
28004 (@pxref{Common Variable Attributes}) and a custom linker script.
28005 The @var{regexp} is a POSIX Extended Regular Expression.
28006
28007 In contrast to the use of GP-relative addressing for small data,
28008 zero-based addressing is never generated by default and there are no
28009 conventional section names used in standard linker scripts for sections
28010 in the low or high areas of memory.
28011
28012 @item -mel
28013 @itemx -meb
28014 @opindex mel
28015 @opindex meb
28016 Generate little-endian (default) or big-endian (experimental) code,
28017 respectively.
28018
28019 @item -march=@var{arch}
28020 @opindex march
28021 This specifies the name of the target Nios II architecture. GCC uses this
28022 name to determine what kind of instructions it can emit when generating
28023 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
28024
28025 The preprocessor macro @code{__nios2_arch__} is available to programs,
28026 with value 1 or 2, indicating the targeted ISA level.
28027
28028 @item -mbypass-cache
28029 @itemx -mno-bypass-cache
28030 @opindex mno-bypass-cache
28031 @opindex mbypass-cache
28032 Force all load and store instructions to always bypass cache by
28033 using I/O variants of the instructions. The default is not to
28034 bypass the cache.
28035
28036 @item -mno-cache-volatile
28037 @itemx -mcache-volatile
28038 @opindex mcache-volatile
28039 @opindex mno-cache-volatile
28040 Volatile memory access bypass the cache using the I/O variants of
28041 the load and store instructions. The default is not to bypass the cache.
28042
28043 @item -mno-fast-sw-div
28044 @itemx -mfast-sw-div
28045 @opindex mno-fast-sw-div
28046 @opindex mfast-sw-div
28047 Do not use table-based fast divide for small numbers. The default
28048 is to use the fast divide at @option{-O3} and above.
28049
28050 @item -mno-hw-mul
28051 @itemx -mhw-mul
28052 @itemx -mno-hw-mulx
28053 @itemx -mhw-mulx
28054 @itemx -mno-hw-div
28055 @itemx -mhw-div
28056 @opindex mno-hw-mul
28057 @opindex mhw-mul
28058 @opindex mno-hw-mulx
28059 @opindex mhw-mulx
28060 @opindex mno-hw-div
28061 @opindex mhw-div
28062 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
28063 instructions by the compiler. The default is to emit @code{mul}
28064 and not emit @code{div} and @code{mulx}.
28065
28066 @item -mbmx
28067 @itemx -mno-bmx
28068 @itemx -mcdx
28069 @itemx -mno-cdx
28070 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28071 CDX (code density) instructions. Enabling these instructions also
28072 requires @option{-march=r2}. Since these instructions are optional
28073 extensions to the R2 architecture, the default is not to emit them.
28074
28075 @item -mcustom-@var{insn}=@var{N}
28076 @itemx -mno-custom-@var{insn}
28077 @opindex mcustom-@var{insn}
28078 @opindex mno-custom-@var{insn}
28079 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28080 custom instruction with encoding @var{N} when generating code that uses
28081 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
28082 instruction 253 for single-precision floating-point add operations instead
28083 of the default behavior of using a library call.
28084
28085 The following values of @var{insn} are supported. Except as otherwise
28086 noted, floating-point operations are expected to be implemented with
28087 normal IEEE 754 semantics and correspond directly to the C operators or the
28088 equivalent GCC built-in functions (@pxref{Other Builtins}).
28089
28090 Single-precision floating point:
28091 @table @asis
28092
28093 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28094 Binary arithmetic operations.
28095
28096 @item @samp{fnegs}
28097 Unary negation.
28098
28099 @item @samp{fabss}
28100 Unary absolute value.
28101
28102 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28103 Comparison operations.
28104
28105 @item @samp{fmins}, @samp{fmaxs}
28106 Floating-point minimum and maximum. These instructions are only
28107 generated if @option{-ffinite-math-only} is specified.
28108
28109 @item @samp{fsqrts}
28110 Unary square root operation.
28111
28112 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28113 Floating-point trigonometric and exponential functions. These instructions
28114 are only generated if @option{-funsafe-math-optimizations} is also specified.
28115
28116 @end table
28117
28118 Double-precision floating point:
28119 @table @asis
28120
28121 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28122 Binary arithmetic operations.
28123
28124 @item @samp{fnegd}
28125 Unary negation.
28126
28127 @item @samp{fabsd}
28128 Unary absolute value.
28129
28130 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28131 Comparison operations.
28132
28133 @item @samp{fmind}, @samp{fmaxd}
28134 Double-precision minimum and maximum. These instructions are only
28135 generated if @option{-ffinite-math-only} is specified.
28136
28137 @item @samp{fsqrtd}
28138 Unary square root operation.
28139
28140 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28141 Double-precision trigonometric and exponential functions. These instructions
28142 are only generated if @option{-funsafe-math-optimizations} is also specified.
28143
28144 @end table
28145
28146 Conversions:
28147 @table @asis
28148 @item @samp{fextsd}
28149 Conversion from single precision to double precision.
28150
28151 @item @samp{ftruncds}
28152 Conversion from double precision to single precision.
28153
28154 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28155 Conversion from floating point to signed or unsigned integer types, with
28156 truncation towards zero.
28157
28158 @item @samp{round}
28159 Conversion from single-precision floating point to signed integer,
28160 rounding to the nearest integer and ties away from zero.
28161 This corresponds to the @code{__builtin_lroundf} function when
28162 @option{-fno-math-errno} is used.
28163
28164 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28165 Conversion from signed or unsigned integer types to floating-point types.
28166
28167 @end table
28168
28169 In addition, all of the following transfer instructions for internal
28170 registers X and Y must be provided to use any of the double-precision
28171 floating-point instructions. Custom instructions taking two
28172 double-precision source operands expect the first operand in the
28173 64-bit register X. The other operand (or only operand of a unary
28174 operation) is given to the custom arithmetic instruction with the
28175 least significant half in source register @var{src1} and the most
28176 significant half in @var{src2}. A custom instruction that returns a
28177 double-precision result returns the most significant 32 bits in the
28178 destination register and the other half in 32-bit register Y.
28179 GCC automatically generates the necessary code sequences to write
28180 register X and/or read register Y when double-precision floating-point
28181 instructions are used.
28182
28183 @table @asis
28184
28185 @item @samp{fwrx}
28186 Write @var{src1} into the least significant half of X and @var{src2} into
28187 the most significant half of X.
28188
28189 @item @samp{fwry}
28190 Write @var{src1} into Y.
28191
28192 @item @samp{frdxhi}, @samp{frdxlo}
28193 Read the most or least (respectively) significant half of X and store it in
28194 @var{dest}.
28195
28196 @item @samp{frdy}
28197 Read the value of Y and store it into @var{dest}.
28198 @end table
28199
28200 Note that you can gain more local control over generation of Nios II custom
28201 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28202 and @code{target("no-custom-@var{insn}")} function attributes
28203 (@pxref{Function Attributes})
28204 or pragmas (@pxref{Function Specific Option Pragmas}).
28205
28206 @item -mcustom-fpu-cfg=@var{name}
28207 @opindex mcustom-fpu-cfg
28208
28209 This option enables a predefined, named set of custom instruction encodings
28210 (see @option{-mcustom-@var{insn}} above).
28211 Currently, the following sets are defined:
28212
28213 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28214 @gccoptlist{-mcustom-fmuls=252 @gol
28215 -mcustom-fadds=253 @gol
28216 -mcustom-fsubs=254 @gol
28217 -fsingle-precision-constant}
28218
28219 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28220 @gccoptlist{-mcustom-fmuls=252 @gol
28221 -mcustom-fadds=253 @gol
28222 -mcustom-fsubs=254 @gol
28223 -mcustom-fdivs=255 @gol
28224 -fsingle-precision-constant}
28225
28226 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28227 @gccoptlist{-mcustom-floatus=243 @gol
28228 -mcustom-fixsi=244 @gol
28229 -mcustom-floatis=245 @gol
28230 -mcustom-fcmpgts=246 @gol
28231 -mcustom-fcmples=249 @gol
28232 -mcustom-fcmpeqs=250 @gol
28233 -mcustom-fcmpnes=251 @gol
28234 -mcustom-fmuls=252 @gol
28235 -mcustom-fadds=253 @gol
28236 -mcustom-fsubs=254 @gol
28237 -mcustom-fdivs=255 @gol
28238 -fsingle-precision-constant}
28239
28240 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28241 @gccoptlist{-mcustom-fabss=224 @gol
28242 -mcustom-fnegs=225 @gol
28243 -mcustom-fcmpnes=226 @gol
28244 -mcustom-fcmpeqs=227 @gol
28245 -mcustom-fcmpges=228 @gol
28246 -mcustom-fcmpgts=229 @gol
28247 -mcustom-fcmples=230 @gol
28248 -mcustom-fcmplts=231 @gol
28249 -mcustom-fmaxs=232 @gol
28250 -mcustom-fmins=233 @gol
28251 -mcustom-round=248 @gol
28252 -mcustom-fixsi=249 @gol
28253 -mcustom-floatis=250 @gol
28254 -mcustom-fsqrts=251 @gol
28255 -mcustom-fmuls=252 @gol
28256 -mcustom-fadds=253 @gol
28257 -mcustom-fsubs=254 @gol
28258 -mcustom-fdivs=255 @gol}
28259
28260 Custom instruction assignments given by individual
28261 @option{-mcustom-@var{insn}=} options override those given by
28262 @option{-mcustom-fpu-cfg=}, regardless of the
28263 order of the options on the command line.
28264
28265 Note that you can gain more local control over selection of a FPU
28266 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28267 function attribute (@pxref{Function Attributes})
28268 or pragma (@pxref{Function Specific Option Pragmas}).
28269
28270 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28271 Hardware 2 Component}. Please note that the custom instructions enabled by
28272 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28273 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
28274 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28275 specified. In contrast to the other configurations,
28276 @option{-fsingle-precision-constant} is not set.
28277
28278 @end table
28279
28280 These additional @samp{-m} options are available for the Altera Nios II
28281 ELF (bare-metal) target:
28282
28283 @table @gcctabopt
28284
28285 @item -mhal
28286 @opindex mhal
28287 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
28288 startup and termination code, and is typically used in conjunction with
28289 @option{-msys-crt0=} to specify the location of the alternate startup code
28290 provided by the HAL BSP.
28291
28292 @item -msmallc
28293 @opindex msmallc
28294 Link with a limited version of the C library, @option{-lsmallc}, rather than
28295 Newlib.
28296
28297 @item -msys-crt0=@var{startfile}
28298 @opindex msys-crt0
28299 @var{startfile} is the file name of the startfile (crt0) to use
28300 when linking. This option is only useful in conjunction with @option{-mhal}.
28301
28302 @item -msys-lib=@var{systemlib}
28303 @opindex msys-lib
28304 @var{systemlib} is the library name of the library that provides
28305 low-level system calls required by the C library,
28306 e.g.@: @code{read} and @code{write}.
28307 This option is typically used to link with a library provided by a HAL BSP.
28308
28309 @end table
28310
28311 @node Nvidia PTX Options
28312 @subsection Nvidia PTX Options
28313 @cindex Nvidia PTX options
28314 @cindex nvptx options
28315
28316 These options are defined for Nvidia PTX:
28317
28318 @table @gcctabopt
28319
28320 @item -m64
28321 @opindex m64
28322 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
28323 supported.
28324
28325 @item -march=@var{architecture-string}
28326 @opindex march
28327 Generate code for the specified PTX ISA target architecture
28328 (e.g.@: @samp{sm_35}). Valid architecture strings are @samp{sm_30},
28329 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28330 @samp{sm_80}.
28331 The default depends on how the compiler has been configured, see
28332 @option{--with-arch}.
28333
28334 This option sets the value of the preprocessor macro
28335 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28336 @samp{350}.
28337
28338 @item -misa=@var{architecture-string}
28339 @opindex misa
28340 Alias of @option{-march=}.
28341
28342 @item -march-map=@var{architecture-string}
28343 @opindex march
28344 Select the closest available @option{-march=} value that is not more
28345 capable. For instance, for @option{-march-map=sm_50} select
28346 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28347 @option{-march=sm_53}.
28348
28349 @item -mptx=@var{version-string}
28350 @opindex mptx
28351 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28352 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28353 @samp{7.0}. The default PTX ISA version is 6.0, unless a higher
28354 version is required for specified PTX ISA target architecture via
28355 option @option{-march=}.
28356
28357 This option sets the values of the preprocessor macros
28358 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28359 for instance, for @samp{3.1} the macros have the values @samp{3} and
28360 @samp{1}, respectively.
28361
28362 @item -mmainkernel
28363 @opindex mmainkernel
28364 Link in code for a __main kernel. This is for stand-alone instead of
28365 offloading execution.
28366
28367 @item -moptimize
28368 @opindex moptimize
28369 Apply partitioned execution optimizations. This is the default when any
28370 level of optimization is selected.
28371
28372 @item -msoft-stack
28373 @opindex msoft-stack
28374 Generate code that does not use @code{.local} memory
28375 directly for stack storage. Instead, a per-warp stack pointer is
28376 maintained explicitly. This enables variable-length stack allocation (with
28377 variable-length arrays or @code{alloca}), and when global memory is used for
28378 underlying storage, makes it possible to access automatic variables from other
28379 threads, or with atomic instructions. This code generation variant is used
28380 for OpenMP offloading, but the option is exposed on its own for the purpose
28381 of testing the compiler; to generate code suitable for linking into programs
28382 using OpenMP offloading, use option @option{-mgomp}.
28383
28384 @item -muniform-simt
28385 @opindex muniform-simt
28386 Switch to code generation variant that allows to execute all threads in each
28387 warp, while maintaining memory state and side effects as if only one thread
28388 in each warp was active outside of OpenMP SIMD regions. All atomic operations
28389 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
28390 current lane index equals the master lane index), and the register being
28391 assigned is copied via a shuffle instruction from the master lane. Outside of
28392 SIMD regions lane 0 is the master; inside, each thread sees itself as the
28393 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
28394 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
28395 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
28396 with current lane index to compute the master lane index.
28397
28398 @item -mgomp
28399 @opindex mgomp
28400 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
28401 @option{-muniform-simt} options, and selects corresponding multilib variant.
28402
28403 @end table
28404
28405 @node OpenRISC Options
28406 @subsection OpenRISC Options
28407 @cindex OpenRISC Options
28408
28409 These options are defined for OpenRISC:
28410
28411 @table @gcctabopt
28412
28413 @item -mboard=@var{name}
28414 @opindex mboard
28415 Configure a board specific runtime. This will be passed to the linker for
28416 newlib board library linking. The default is @code{or1ksim}.
28417
28418 @item -mnewlib
28419 @opindex mnewlib
28420 This option is ignored; it is for compatibility purposes only. This used to
28421 select linker and preprocessor options for use with newlib.
28422
28423 @item -msoft-div
28424 @itemx -mhard-div
28425 @opindex msoft-div
28426 @opindex mhard-div
28427 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
28428 This default is hardware divide.
28429
28430 @item -msoft-mul
28431 @itemx -mhard-mul
28432 @opindex msoft-mul
28433 @opindex mhard-mul
28434 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
28435 This default is hardware multiply.
28436
28437 @item -msoft-float
28438 @itemx -mhard-float
28439 @opindex msoft-float
28440 @opindex mhard-float
28441 Select software or hardware for floating point operations.
28442 The default is software.
28443
28444 @item -mdouble-float
28445 @opindex mdouble-float
28446 When @option{-mhard-float} is selected, enables generation of double-precision
28447 floating point instructions. By default functions from @file{libgcc} are used
28448 to perform double-precision floating point operations.
28449
28450 @item -munordered-float
28451 @opindex munordered-float
28452 When @option{-mhard-float} is selected, enables generation of unordered
28453 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
28454 functions from @file{libgcc} are used to perform unordered floating point
28455 compare and set flag operations.
28456
28457 @item -mcmov
28458 @opindex mcmov
28459 Enable generation of conditional move (@code{l.cmov}) instructions. By
28460 default the equivalent will be generated using set and branch.
28461
28462 @item -mror
28463 @opindex mror
28464 Enable generation of rotate right (@code{l.ror}) instructions. By default
28465 functions from @file{libgcc} are used to perform rotate right operations.
28466
28467 @item -mrori
28468 @opindex mrori
28469 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
28470 By default functions from @file{libgcc} are used to perform rotate right with
28471 immediate operations.
28472
28473 @item -msext
28474 @opindex msext
28475 Enable generation of sign extension (@code{l.ext*}) instructions. By default
28476 memory loads are used to perform sign extension.
28477
28478 @item -msfimm
28479 @opindex msfimm
28480 Enable generation of compare and set flag with immediate (@code{l.sf*i})
28481 instructions. By default extra instructions will be generated to store the
28482 immediate to a register first.
28483
28484 @item -mshftimm
28485 @opindex mshftimm
28486 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
28487 @code{l.slli}) instructions. By default extra instructions will be generated
28488 to store the immediate to a register first.
28489
28490 @item -mcmodel=small
28491 @opindex mcmodel=small
28492 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
28493 the default model.
28494
28495 @item -mcmodel=large
28496 @opindex mcmodel=large
28497 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
28498
28499
28500 @end table
28501
28502 @node PDP-11 Options
28503 @subsection PDP-11 Options
28504 @cindex PDP-11 Options
28505
28506 These options are defined for the PDP-11:
28507
28508 @table @gcctabopt
28509 @item -mfpu
28510 @opindex mfpu
28511 Use hardware FPP floating point. This is the default. (FIS floating
28512 point on the PDP-11/40 is not supported.) Implies -m45.
28513
28514 @item -msoft-float
28515 @opindex msoft-float
28516 Do not use hardware floating point.
28517
28518 @item -mac0
28519 @opindex mac0
28520 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
28521
28522 @item -mno-ac0
28523 @opindex mno-ac0
28524 Return floating-point results in memory. This is the default.
28525
28526 @item -m40
28527 @opindex m40
28528 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
28529
28530 @item -m45
28531 @opindex m45
28532 Generate code for a PDP-11/45. This is the default.
28533
28534 @item -m10
28535 @opindex m10
28536 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
28537
28538 @item -mint16
28539 @itemx -mno-int32
28540 @opindex mint16
28541 @opindex mno-int32
28542 Use 16-bit @code{int}. This is the default.
28543
28544 @item -mint32
28545 @itemx -mno-int16
28546 @opindex mint32
28547 @opindex mno-int16
28548 Use 32-bit @code{int}.
28549
28550 @item -msplit
28551 @opindex msplit
28552 Target has split instruction and data space. Implies -m45.
28553
28554 @item -munix-asm
28555 @opindex munix-asm
28556 Use Unix assembler syntax.
28557
28558 @item -mdec-asm
28559 @opindex mdec-asm
28560 Use DEC assembler syntax.
28561
28562 @item -mgnu-asm
28563 @opindex mgnu-asm
28564 Use GNU assembler syntax. This is the default.
28565
28566 @item -mlra
28567 @opindex mlra
28568 Use the new LRA register allocator. By default, the old ``reload''
28569 allocator is used.
28570 @end table
28571
28572 @node PowerPC Options
28573 @subsection PowerPC Options
28574 @cindex PowerPC options
28575
28576 These are listed under @xref{RS/6000 and PowerPC Options}.
28577
28578 @node PRU Options
28579 @subsection PRU Options
28580 @cindex PRU Options
28581
28582 These command-line options are defined for PRU target:
28583
28584 @table @gcctabopt
28585 @item -minrt
28586 @opindex minrt
28587 Link with a minimum runtime environment, with no support for static
28588 initializers and constructors. Using this option can significantly reduce
28589 the size of the final ELF binary. Beware that the compiler could still
28590 generate code with static initializers and constructors. It is up to the
28591 programmer to ensure that the source program will not use those features.
28592
28593 @item -mmcu=@var{mcu}
28594 @opindex mmcu
28595 Specify the PRU MCU variant to use. Check Newlib for the exact list of
28596 supported MCUs.
28597
28598 @item -mno-relax
28599 @opindex mno-relax
28600 Make GCC pass the @option{--no-relax} command-line option to the linker
28601 instead of the @option{--relax} option.
28602
28603 @item -mloop
28604 @opindex mloop
28605 Allow (or do not allow) GCC to use the LOOP instruction.
28606
28607 @item -mabi=@var{variant}
28608 @opindex mabi
28609 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
28610 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
28611 more naturally with certain GCC assumptions. These are the differences:
28612
28613 @table @samp
28614 @item Function Pointer Size
28615 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
28616 supports only 32-bit data and code pointers.
28617
28618 @item Optional Return Value Pointer
28619 Function return values larger than 64 bits are passed by using a hidden
28620 pointer as the first argument of the function. TI ABI, though, mandates that
28621 the pointer can be NULL in case the caller is not using the returned value.
28622 GNU always passes and expects a valid return value pointer.
28623
28624 @end table
28625
28626 The current @option{-mabi=ti} implementation simply raises a compile error
28627 when any of the above code constructs is detected. As a consequence
28628 the standard C library cannot be built and it is omitted when linking with
28629 @option{-mabi=ti}.
28630
28631 Relaxation is a GNU feature and for safety reasons is disabled when using
28632 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
28633 instructions, so the GNU linker cannot adjust them when shortening adjacent
28634 LDI32 pseudo instructions.
28635
28636 @end table
28637
28638 @node RISC-V Options
28639 @subsection RISC-V Options
28640 @cindex RISC-V Options
28641
28642 These command-line options are defined for RISC-V targets:
28643
28644 @table @gcctabopt
28645 @item -mbranch-cost=@var{n}
28646 @opindex mbranch-cost
28647 Set the cost of branches to roughly @var{n} instructions.
28648
28649 @item -mplt
28650 @itemx -mno-plt
28651 @opindex plt
28652 When generating PIC code, do or don't allow the use of PLTs. Ignored for
28653 non-PIC. The default is @option{-mplt}.
28654
28655 @item -mabi=@var{ABI-string}
28656 @opindex mabi
28657 Specify integer and floating-point calling convention. @var{ABI-string}
28658 contains two parts: the size of integer types and the registers used for
28659 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
28660 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
28661 32-bit), and that floating-point values up to 64 bits wide are passed in F
28662 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
28663 allows the compiler to generate code that uses the F and D extensions but only
28664 allows floating-point values up to 32 bits long to be passed in registers; or
28665 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
28666 passed in registers.
28667
28668 The default for this argument is system dependent, users who want a specific
28669 calling convention should specify one explicitly. The valid calling
28670 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
28671 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
28672 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
28673 invalid because the ABI requires 64-bit values be passed in F registers, but F
28674 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
28675 only be used with the @samp{rv32e} architecture. This ABI is not well
28676 specified at present, and is subject to change.
28677
28678 @item -mfdiv
28679 @itemx -mno-fdiv
28680 @opindex mfdiv
28681 Do or don't use hardware floating-point divide and square root instructions.
28682 This requires the F or D extensions for floating-point registers. The default
28683 is to use them if the specified architecture has these instructions.
28684
28685 @item -mdiv
28686 @itemx -mno-div
28687 @opindex mdiv
28688 Do or don't use hardware instructions for integer division. This requires the
28689 M extension. The default is to use them if the specified architecture has
28690 these instructions.
28691
28692 @item -misa-spec=@var{ISA-spec-string}
28693 @opindex misa-spec
28694 Specify the version of the RISC-V Unprivileged (formerly User-Level)
28695 ISA specification to produce code conforming to. The possibilities
28696 for @var{ISA-spec-string} are:
28697 @table @code
28698 @item 2.2
28699 Produce code conforming to version 2.2.
28700 @item 20190608
28701 Produce code conforming to version 20190608.
28702 @item 20191213
28703 Produce code conforming to version 20191213.
28704 @end table
28705 The default is @option{-misa-spec=20191213} unless GCC has been configured
28706 with @option{--with-isa-spec=} specifying a different default version.
28707
28708 @item -march=@var{ISA-string}
28709 @opindex march
28710 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
28711 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
28712 @samp{rv32imaf}.
28713
28714 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
28715
28716 If both @option{-march} and @option{-mcpu=} are not specified, the default for
28717 this argument is system dependent, users who want a specific architecture
28718 extensions should specify one explicitly.
28719
28720 @item -mcpu=@var{processor-string}
28721 @opindex mcpu
28722 Use architecture of and optimize the output for the given processor, specified
28723 by particular CPU name.
28724 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
28725 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
28726 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
28727 @samp{sifive-u54}, and @samp{sifive-u74}.
28728
28729 @item -mtune=@var{processor-string}
28730 @opindex mtune
28731 Optimize the output for the given processor, specified by microarchitecture or
28732 particular CPU name. Permissible values for this option are: @samp{rocket},
28733 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
28734 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
28735
28736 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
28737 the default is @samp{rocket} if both are not specified.
28738
28739 The @samp{size} choice is not intended for use by end-users. This is used
28740 when @option{-Os} is specified. It overrides the instruction cost info
28741 provided by @option{-mtune=}, but does not override the pipeline info. This
28742 helps reduce code size while still giving good performance.
28743
28744 @item -mpreferred-stack-boundary=@var{num}
28745 @opindex mpreferred-stack-boundary
28746 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28747 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28748 the default is 4 (16 bytes or 128-bits).
28749
28750 @strong{Warning:} If you use this switch, then you must build all modules with
28751 the same value, including any libraries. This includes the system libraries
28752 and startup modules.
28753
28754 @item -msmall-data-limit=@var{n}
28755 @opindex msmall-data-limit
28756 Put global and static data smaller than @var{n} bytes into a special section
28757 (on some targets).
28758
28759 @item -msave-restore
28760 @itemx -mno-save-restore
28761 @opindex msave-restore
28762 Do or don't use smaller but slower prologue and epilogue code that uses
28763 library function calls. The default is to use fast inline prologues and
28764 epilogues.
28765
28766 @item -mshorten-memrefs
28767 @itemx -mno-shorten-memrefs
28768 @opindex mshorten-memrefs
28769 Do or do not attempt to make more use of compressed load/store instructions by
28770 replacing a load/store of 'base register + large offset' with a new load/store
28771 of 'new base + small offset'. If the new base gets stored in a compressed
28772 register, then the new load/store can be compressed. Currently targets 32-bit
28773 integer load/stores only.
28774
28775 @item -mstrict-align
28776 @itemx -mno-strict-align
28777 @opindex mstrict-align
28778 Do not or do generate unaligned memory accesses. The default is set depending
28779 on whether the processor we are optimizing for supports fast unaligned access
28780 or not.
28781
28782 @item -mcmodel=medlow
28783 @opindex mcmodel=medlow
28784 Generate code for the medium-low code model. The program and its statically
28785 defined symbols must lie within a single 2 GiB address range and must lie
28786 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
28787 statically or dynamically linked. This is the default code model.
28788
28789 @item -mcmodel=medany
28790 @opindex mcmodel=medany
28791 Generate code for the medium-any code model. The program and its statically
28792 defined symbols must be within any single 2 GiB address range. Programs can be
28793 statically or dynamically linked.
28794
28795 The code generated by the medium-any code model is position-independent, but is
28796 not guaranteed to function correctly when linked into position-independent
28797 executables or libraries.
28798
28799 @item -mexplicit-relocs
28800 @itemx -mno-exlicit-relocs
28801 Use or do not use assembler relocation operators when dealing with symbolic
28802 addresses. The alternative is to use assembler macros instead, which may
28803 limit optimization.
28804
28805 @item -mrelax
28806 @itemx -mno-relax
28807 @opindex mrelax
28808 Take advantage of linker relaxations to reduce the number of instructions
28809 required to materialize symbol addresses. The default is to take advantage of
28810 linker relaxations.
28811
28812 @item -mriscv-attribute
28813 @itemx -mno-riscv-attribute
28814 @opindex mriscv-attribute
28815 Emit (do not emit) RISC-V attribute to record extra information into ELF
28816 objects. This feature requires at least binutils 2.32.
28817
28818 @item -mcsr-check
28819 @itemx -mno-csr-check
28820 @opindex mcsr-check
28821 Enables or disables the CSR checking.
28822
28823 @item -malign-data=@var{type}
28824 @opindex malign-data
28825 Control how GCC aligns variables and constants of array, structure, or union
28826 types. Supported values for @var{type} are @samp{xlen} which uses x register
28827 width as the alignment value, and @samp{natural} which uses natural alignment.
28828 @samp{xlen} is the default.
28829
28830 @item -mbig-endian
28831 @opindex mbig-endian
28832 Generate big-endian code. This is the default when GCC is configured for a
28833 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
28834
28835 @item -mlittle-endian
28836 @opindex mlittle-endian
28837 Generate little-endian code. This is the default when GCC is configured for a
28838 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
28839 @samp{riscv32be-*-*} target.
28840
28841 @item -mstack-protector-guard=@var{guard}
28842 @itemx -mstack-protector-guard-reg=@var{reg}
28843 @itemx -mstack-protector-guard-offset=@var{offset}
28844 @opindex mstack-protector-guard
28845 @opindex mstack-protector-guard-reg
28846 @opindex mstack-protector-guard-offset
28847 Generate stack protection code using canary at @var{guard}. Supported
28848 locations are @samp{global} for a global canary or @samp{tls} for per-thread
28849 canary in the TLS block.
28850
28851 With the latter choice the options
28852 @option{-mstack-protector-guard-reg=@var{reg}} and
28853 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28854 which register to use as base register for reading the canary,
28855 and from what offset from that base register. There is no default
28856 register or offset as this is entirely for use within the Linux
28857 kernel.
28858 @end table
28859
28860 @node RL78 Options
28861 @subsection RL78 Options
28862 @cindex RL78 Options
28863
28864 @table @gcctabopt
28865
28866 @item -msim
28867 @opindex msim
28868 Links in additional target libraries to support operation within a
28869 simulator.
28870
28871 @item -mmul=none
28872 @itemx -mmul=g10
28873 @itemx -mmul=g13
28874 @itemx -mmul=g14
28875 @itemx -mmul=rl78
28876 @opindex mmul
28877 Specifies the type of hardware multiplication and division support to
28878 be used. The simplest is @code{none}, which uses software for both
28879 multiplication and division. This is the default. The @code{g13}
28880 value is for the hardware multiply/divide peripheral found on the
28881 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
28882 the multiplication and division instructions supported by the RL78/G14
28883 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
28884 the value @code{mg10} is an alias for @code{none}.
28885
28886 In addition a C preprocessor macro is defined, based upon the setting
28887 of this option. Possible values are: @code{__RL78_MUL_NONE__},
28888 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
28889
28890 @item -mcpu=g10
28891 @itemx -mcpu=g13
28892 @itemx -mcpu=g14
28893 @itemx -mcpu=rl78
28894 @opindex mcpu
28895 Specifies the RL78 core to target. The default is the G14 core, also
28896 known as an S3 core or just RL78. The G13 or S2 core does not have
28897 multiply or divide instructions, instead it uses a hardware peripheral
28898 for these operations. The G10 or S1 core does not have register
28899 banks, so it uses a different calling convention.
28900
28901 If this option is set it also selects the type of hardware multiply
28902 support to use, unless this is overridden by an explicit
28903 @option{-mmul=none} option on the command line. Thus specifying
28904 @option{-mcpu=g13} enables the use of the G13 hardware multiply
28905 peripheral and specifying @option{-mcpu=g10} disables the use of
28906 hardware multiplications altogether.
28907
28908 Note, although the RL78/G14 core is the default target, specifying
28909 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
28910 change the behavior of the toolchain since it also enables G14
28911 hardware multiply support. If these options are not specified on the
28912 command line then software multiplication routines will be used even
28913 though the code targets the RL78 core. This is for backwards
28914 compatibility with older toolchains which did not have hardware
28915 multiply and divide support.
28916
28917 In addition a C preprocessor macro is defined, based upon the setting
28918 of this option. Possible values are: @code{__RL78_G10__},
28919 @code{__RL78_G13__} or @code{__RL78_G14__}.
28920
28921 @item -mg10
28922 @itemx -mg13
28923 @itemx -mg14
28924 @itemx -mrl78
28925 @opindex mg10
28926 @opindex mg13
28927 @opindex mg14
28928 @opindex mrl78
28929 These are aliases for the corresponding @option{-mcpu=} option. They
28930 are provided for backwards compatibility.
28931
28932 @item -mallregs
28933 @opindex mallregs
28934 Allow the compiler to use all of the available registers. By default
28935 registers @code{r24..r31} are reserved for use in interrupt handlers.
28936 With this option enabled these registers can be used in ordinary
28937 functions as well.
28938
28939 @item -m64bit-doubles
28940 @itemx -m32bit-doubles
28941 @opindex m64bit-doubles
28942 @opindex m32bit-doubles
28943 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28944 or 32 bits (@option{-m32bit-doubles}) in size. The default is
28945 @option{-m32bit-doubles}.
28946
28947 @item -msave-mduc-in-interrupts
28948 @itemx -mno-save-mduc-in-interrupts
28949 @opindex msave-mduc-in-interrupts
28950 @opindex mno-save-mduc-in-interrupts
28951 Specifies that interrupt handler functions should preserve the
28952 MDUC registers. This is only necessary if normal code might use
28953 the MDUC registers, for example because it performs multiplication
28954 and division operations. The default is to ignore the MDUC registers
28955 as this makes the interrupt handlers faster. The target option -mg13
28956 needs to be passed for this to work as this feature is only available
28957 on the G13 target (S2 core). The MDUC registers will only be saved
28958 if the interrupt handler performs a multiplication or division
28959 operation or it calls another function.
28960
28961 @end table
28962
28963 @node RS/6000 and PowerPC Options
28964 @subsection IBM RS/6000 and PowerPC Options
28965 @cindex RS/6000 and PowerPC Options
28966 @cindex IBM RS/6000 and PowerPC Options
28967
28968 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
28969 @table @gcctabopt
28970 @item -mpowerpc-gpopt
28971 @itemx -mno-powerpc-gpopt
28972 @itemx -mpowerpc-gfxopt
28973 @itemx -mno-powerpc-gfxopt
28974 @need 800
28975 @itemx -mpowerpc64
28976 @itemx -mno-powerpc64
28977 @itemx -mmfcrf
28978 @itemx -mno-mfcrf
28979 @itemx -mpopcntb
28980 @itemx -mno-popcntb
28981 @itemx -mpopcntd
28982 @itemx -mno-popcntd
28983 @itemx -mfprnd
28984 @itemx -mno-fprnd
28985 @need 800
28986 @itemx -mcmpb
28987 @itemx -mno-cmpb
28988 @itemx -mhard-dfp
28989 @itemx -mno-hard-dfp
28990 @opindex mpowerpc-gpopt
28991 @opindex mno-powerpc-gpopt
28992 @opindex mpowerpc-gfxopt
28993 @opindex mno-powerpc-gfxopt
28994 @opindex mpowerpc64
28995 @opindex mno-powerpc64
28996 @opindex mmfcrf
28997 @opindex mno-mfcrf
28998 @opindex mpopcntb
28999 @opindex mno-popcntb
29000 @opindex mpopcntd
29001 @opindex mno-popcntd
29002 @opindex mfprnd
29003 @opindex mno-fprnd
29004 @opindex mcmpb
29005 @opindex mno-cmpb
29006 @opindex mhard-dfp
29007 @opindex mno-hard-dfp
29008 You use these options to specify which instructions are available on the
29009 processor you are using. The default value of these options is
29010 determined when configuring GCC@. Specifying the
29011 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29012 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
29013 rather than the options listed above.
29014
29015 Specifying @option{-mpowerpc-gpopt} allows
29016 GCC to use the optional PowerPC architecture instructions in the
29017 General Purpose group, including floating-point square root. Specifying
29018 @option{-mpowerpc-gfxopt} allows GCC to
29019 use the optional PowerPC architecture instructions in the Graphics
29020 group, including floating-point select.
29021
29022 The @option{-mmfcrf} option allows GCC to generate the move from
29023 condition register field instruction implemented on the POWER4
29024 processor and other processors that support the PowerPC V2.01
29025 architecture.
29026 The @option{-mpopcntb} option allows GCC to generate the popcount and
29027 double-precision FP reciprocal estimate instruction implemented on the
29028 POWER5 processor and other processors that support the PowerPC V2.02
29029 architecture.
29030 The @option{-mpopcntd} option allows GCC to generate the popcount
29031 instruction implemented on the POWER7 processor and other processors
29032 that support the PowerPC V2.06 architecture.
29033 The @option{-mfprnd} option allows GCC to generate the FP round to
29034 integer instructions implemented on the POWER5+ processor and other
29035 processors that support the PowerPC V2.03 architecture.
29036 The @option{-mcmpb} option allows GCC to generate the compare bytes
29037 instruction implemented on the POWER6 processor and other processors
29038 that support the PowerPC V2.05 architecture.
29039 The @option{-mhard-dfp} option allows GCC to generate the decimal
29040 floating-point instructions implemented on some POWER processors.
29041
29042 The @option{-mpowerpc64} option allows GCC to generate the additional
29043 64-bit instructions that are found in the full PowerPC64 architecture
29044 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
29045 @option{-mno-powerpc64}.
29046
29047 @item -mcpu=@var{cpu_type}
29048 @opindex mcpu
29049 Set architecture type, register usage, and
29050 instruction scheduling parameters for machine type @var{cpu_type}.
29051 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29052 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29053 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29054 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29055 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29056 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29057 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29058 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29059 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29060 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29061 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29062 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29063
29064 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29065 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29066 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29067 architecture machine types, with an appropriate, generic processor
29068 model assumed for scheduling purposes.
29069
29070 Specifying @samp{native} as cpu type detects and selects the
29071 architecture option that corresponds to the host processor of the
29072 system performing the compilation.
29073 @option{-mcpu=native} has no effect if GCC does not recognize the
29074 processor.
29075
29076 The other options specify a specific processor. Code generated under
29077 those options runs best on that processor, and may not run at all on
29078 others.
29079
29080 The @option{-mcpu} options automatically enable or disable the
29081 following options:
29082
29083 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
29084 -mpopcntb -mpopcntd -mpowerpc64 @gol
29085 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
29086 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
29087 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
29088 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
29089 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
29090 -mrop-protect}
29091
29092 The particular options set for any particular CPU varies between
29093 compiler versions, depending on what setting seems to produce optimal
29094 code for that CPU; it doesn't necessarily reflect the actual hardware's
29095 capabilities. If you wish to set an individual option to a particular
29096 value, you may specify it after the @option{-mcpu} option, like
29097 @option{-mcpu=970 -mno-altivec}.
29098
29099 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29100 not enabled or disabled by the @option{-mcpu} option at present because
29101 AIX does not have full support for these options. You may still
29102 enable or disable them individually if you're sure it'll work in your
29103 environment.
29104
29105 @item -mtune=@var{cpu_type}
29106 @opindex mtune
29107 Set the instruction scheduling parameters for machine type
29108 @var{cpu_type}, but do not set the architecture type or register usage,
29109 as @option{-mcpu=@var{cpu_type}} does. The same
29110 values for @var{cpu_type} are used for @option{-mtune} as for
29111 @option{-mcpu}. If both are specified, the code generated uses the
29112 architecture and registers set by @option{-mcpu}, but the
29113 scheduling parameters set by @option{-mtune}.
29114
29115 @item -mcmodel=small
29116 @opindex mcmodel=small
29117 Generate PowerPC64 code for the small model: The TOC is limited to
29118 64k.
29119
29120 @item -mcmodel=medium
29121 @opindex mcmodel=medium
29122 Generate PowerPC64 code for the medium model: The TOC and other static
29123 data may be up to a total of 4G in size. This is the default for 64-bit
29124 Linux.
29125
29126 @item -mcmodel=large
29127 @opindex mcmodel=large
29128 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29129 in size. Other data and code is only limited by the 64-bit address
29130 space.
29131
29132 @item -maltivec
29133 @itemx -mno-altivec
29134 @opindex maltivec
29135 @opindex mno-altivec
29136 Generate code that uses (does not use) AltiVec instructions, and also
29137 enable the use of built-in functions that allow more direct access to
29138 the AltiVec instruction set. You may also need to set
29139 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29140 enhancements.
29141
29142 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29143 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
29144 match array element order corresponding to the endianness of the
29145 target. That is, element zero identifies the leftmost element in a
29146 vector register when targeting a big-endian platform, and identifies
29147 the rightmost element in a vector register when targeting a
29148 little-endian platform.
29149
29150 @item -mvrsave
29151 @itemx -mno-vrsave
29152 @opindex mvrsave
29153 @opindex mno-vrsave
29154 Generate VRSAVE instructions when generating AltiVec code.
29155
29156 @item -msecure-plt
29157 @opindex msecure-plt
29158 Generate code that allows @command{ld} and @command{ld.so}
29159 to build executables and shared
29160 libraries with non-executable @code{.plt} and @code{.got} sections.
29161 This is a PowerPC
29162 32-bit SYSV ABI option.
29163
29164 @item -mbss-plt
29165 @opindex mbss-plt
29166 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29167 fills in, and
29168 requires @code{.plt} and @code{.got}
29169 sections that are both writable and executable.
29170 This is a PowerPC 32-bit SYSV ABI option.
29171
29172 @item -misel
29173 @itemx -mno-isel
29174 @opindex misel
29175 @opindex mno-isel
29176 This switch enables or disables the generation of ISEL instructions.
29177
29178 @item -mvsx
29179 @itemx -mno-vsx
29180 @opindex mvsx
29181 @opindex mno-vsx
29182 Generate code that uses (does not use) vector/scalar (VSX)
29183 instructions, and also enable the use of built-in functions that allow
29184 more direct access to the VSX instruction set.
29185
29186 @item -mcrypto
29187 @itemx -mno-crypto
29188 @opindex mcrypto
29189 @opindex mno-crypto
29190 Enable the use (disable) of the built-in functions that allow direct
29191 access to the cryptographic instructions that were added in version
29192 2.07 of the PowerPC ISA.
29193
29194 @item -mhtm
29195 @itemx -mno-htm
29196 @opindex mhtm
29197 @opindex mno-htm
29198 Enable (disable) the use of the built-in functions that allow direct
29199 access to the Hardware Transactional Memory (HTM) instructions that
29200 were added in version 2.07 of the PowerPC ISA.
29201
29202 @item -mpower8-fusion
29203 @itemx -mno-power8-fusion
29204 @opindex mpower8-fusion
29205 @opindex mno-power8-fusion
29206 Generate code that keeps (does not keeps) some integer operations
29207 adjacent so that the instructions can be fused together on power8 and
29208 later processors.
29209
29210 @item -mpower8-vector
29211 @itemx -mno-power8-vector
29212 @opindex mpower8-vector
29213 @opindex mno-power8-vector
29214 Generate code that uses (does not use) the vector and scalar
29215 instructions that were added in version 2.07 of the PowerPC ISA. Also
29216 enable the use of built-in functions that allow more direct access to
29217 the vector instructions.
29218
29219 @item -mquad-memory
29220 @itemx -mno-quad-memory
29221 @opindex mquad-memory
29222 @opindex mno-quad-memory
29223 Generate code that uses (does not use) the non-atomic quad word memory
29224 instructions. The @option{-mquad-memory} option requires use of
29225 64-bit mode.
29226
29227 @item -mquad-memory-atomic
29228 @itemx -mno-quad-memory-atomic
29229 @opindex mquad-memory-atomic
29230 @opindex mno-quad-memory-atomic
29231 Generate code that uses (does not use) the atomic quad word memory
29232 instructions. The @option{-mquad-memory-atomic} option requires use of
29233 64-bit mode.
29234
29235 @item -mfloat128
29236 @itemx -mno-float128
29237 @opindex mfloat128
29238 @opindex mno-float128
29239 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29240 and use either software emulation for IEEE 128-bit floating point or
29241 hardware instructions.
29242
29243 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29244 128-bit floating point support. The IEEE 128-bit floating point is only
29245 supported on Linux.
29246
29247 The default for @option{-mfloat128} is enabled on PowerPC Linux
29248 systems using the VSX instruction set, and disabled on other systems.
29249
29250 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29251 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29252 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29253 floating point instructions. Otherwise, if you do not specify to
29254 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29255 system, IEEE 128-bit floating point will be done with software
29256 emulation.
29257
29258 @item -mfloat128-hardware
29259 @itemx -mno-float128-hardware
29260 @opindex mfloat128-hardware
29261 @opindex mno-float128-hardware
29262 Enable/disable using ISA 3.0 hardware instructions to support the
29263 @var{__float128} data type.
29264
29265 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29266 Linux systems using the ISA 3.0 instruction set, and disabled on other
29267 systems.
29268
29269 @item -m32
29270 @itemx -m64
29271 @opindex m32
29272 @opindex m64
29273 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29274 targets (including GNU/Linux). The 32-bit environment sets int, long
29275 and pointer to 32 bits and generates code that runs on any PowerPC
29276 variant. The 64-bit environment sets int to 32 bits and long and
29277 pointer to 64 bits, and generates code for PowerPC64, as for
29278 @option{-mpowerpc64}.
29279
29280 @item -mfull-toc
29281 @itemx -mno-fp-in-toc
29282 @itemx -mno-sum-in-toc
29283 @itemx -mminimal-toc
29284 @opindex mfull-toc
29285 @opindex mno-fp-in-toc
29286 @opindex mno-sum-in-toc
29287 @opindex mminimal-toc
29288 Modify generation of the TOC (Table Of Contents), which is created for
29289 every executable file. The @option{-mfull-toc} option is selected by
29290 default. In that case, GCC allocates at least one TOC entry for
29291 each unique non-automatic variable reference in your program. GCC
29292 also places floating-point constants in the TOC@. However, only
29293 16,384 entries are available in the TOC@.
29294
29295 If you receive a linker error message that saying you have overflowed
29296 the available TOC space, you can reduce the amount of TOC space used
29297 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29298 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29299 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29300 generate code to calculate the sum of an address and a constant at
29301 run time instead of putting that sum into the TOC@. You may specify one
29302 or both of these options. Each causes GCC to produce very slightly
29303 slower and larger code at the expense of conserving TOC space.
29304
29305 If you still run out of space in the TOC even when you specify both of
29306 these options, specify @option{-mminimal-toc} instead. This option causes
29307 GCC to make only one TOC entry for every file. When you specify this
29308 option, GCC produces code that is slower and larger but which
29309 uses extremely little TOC space. You may wish to use this option
29310 only on files that contain less frequently-executed code.
29311
29312 @item -maix64
29313 @itemx -maix32
29314 @opindex maix64
29315 @opindex maix32
29316 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29317 @code{long} type, and the infrastructure needed to support them.
29318 Specifying @option{-maix64} implies @option{-mpowerpc64},
29319 while @option{-maix32} disables the 64-bit ABI and
29320 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
29321
29322 @item -mxl-compat
29323 @itemx -mno-xl-compat
29324 @opindex mxl-compat
29325 @opindex mno-xl-compat
29326 Produce code that conforms more closely to IBM XL compiler semantics
29327 when using AIX-compatible ABI@. Pass floating-point arguments to
29328 prototyped functions beyond the register save area (RSA) on the stack
29329 in addition to argument FPRs. Do not assume that most significant
29330 double in 128-bit long double value is properly rounded when comparing
29331 values and converting to double. Use XL symbol names for long double
29332 support routines.
29333
29334 The AIX calling convention was extended but not initially documented to
29335 handle an obscure K&R C case of calling a function that takes the
29336 address of its arguments with fewer arguments than declared. IBM XL
29337 compilers access floating-point arguments that do not fit in the
29338 RSA from the stack when a subroutine is compiled without
29339 optimization. Because always storing floating-point arguments on the
29340 stack is inefficient and rarely needed, this option is not enabled by
29341 default and only is necessary when calling subroutines compiled by IBM
29342 XL compilers without optimization.
29343
29344 @item -mpe
29345 @opindex mpe
29346 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
29347 application written to use message passing with special startup code to
29348 enable the application to run. The system must have PE installed in the
29349 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
29350 must be overridden with the @option{-specs=} option to specify the
29351 appropriate directory location. The Parallel Environment does not
29352 support threads, so the @option{-mpe} option and the @option{-pthread}
29353 option are incompatible.
29354
29355 @item -malign-natural
29356 @itemx -malign-power
29357 @opindex malign-natural
29358 @opindex malign-power
29359 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
29360 @option{-malign-natural} overrides the ABI-defined alignment of larger
29361 types, such as floating-point doubles, on their natural size-based boundary.
29362 The option @option{-malign-power} instructs GCC to follow the ABI-specified
29363 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
29364
29365 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
29366 is not supported.
29367
29368 @item -msoft-float
29369 @itemx -mhard-float
29370 @opindex msoft-float
29371 @opindex mhard-float
29372 Generate code that does not use (uses) the floating-point register set.
29373 Software floating-point emulation is provided if you use the
29374 @option{-msoft-float} option, and pass the option to GCC when linking.
29375
29376 @item -mmultiple
29377 @itemx -mno-multiple
29378 @opindex mmultiple
29379 @opindex mno-multiple
29380 Generate code that uses (does not use) the load multiple word
29381 instructions and the store multiple word instructions. These
29382 instructions are generated by default on POWER systems, and not
29383 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
29384 PowerPC systems, since those instructions do not work when the
29385 processor is in little-endian mode. The exceptions are PPC740 and
29386 PPC750 which permit these instructions in little-endian mode.
29387
29388 @item -mupdate
29389 @itemx -mno-update
29390 @opindex mupdate
29391 @opindex mno-update
29392 Generate code that uses (does not use) the load or store instructions
29393 that update the base register to the address of the calculated memory
29394 location. These instructions are generated by default. If you use
29395 @option{-mno-update}, there is a small window between the time that the
29396 stack pointer is updated and the address of the previous frame is
29397 stored, which means code that walks the stack frame across interrupts or
29398 signals may get corrupted data.
29399
29400 @item -mavoid-indexed-addresses
29401 @itemx -mno-avoid-indexed-addresses
29402 @opindex mavoid-indexed-addresses
29403 @opindex mno-avoid-indexed-addresses
29404 Generate code that tries to avoid (not avoid) the use of indexed load
29405 or store instructions. These instructions can incur a performance
29406 penalty on Power6 processors in certain situations, such as when
29407 stepping through large arrays that cross a 16M boundary. This option
29408 is enabled by default when targeting Power6 and disabled otherwise.
29409
29410 @item -mfused-madd
29411 @itemx -mno-fused-madd
29412 @opindex mfused-madd
29413 @opindex mno-fused-madd
29414 Generate code that uses (does not use) the floating-point multiply and
29415 accumulate instructions. These instructions are generated by default
29416 if hardware floating point is used. The machine-dependent
29417 @option{-mfused-madd} option is now mapped to the machine-independent
29418 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29419 mapped to @option{-ffp-contract=off}.
29420
29421 @item -mmulhw
29422 @itemx -mno-mulhw
29423 @opindex mmulhw
29424 @opindex mno-mulhw
29425 Generate code that uses (does not use) the half-word multiply and
29426 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
29427 These instructions are generated by default when targeting those
29428 processors.
29429
29430 @item -mdlmzb
29431 @itemx -mno-dlmzb
29432 @opindex mdlmzb
29433 @opindex mno-dlmzb
29434 Generate code that uses (does not use) the string-search @samp{dlmzb}
29435 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
29436 generated by default when targeting those processors.
29437
29438 @item -mno-bit-align
29439 @itemx -mbit-align
29440 @opindex mno-bit-align
29441 @opindex mbit-align
29442 On System V.4 and embedded PowerPC systems do not (do) force structures
29443 and unions that contain bit-fields to be aligned to the base type of the
29444 bit-field.
29445
29446 For example, by default a structure containing nothing but 8
29447 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
29448 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
29449 the structure is aligned to a 1-byte boundary and is 1 byte in
29450 size.
29451
29452 @item -mno-strict-align
29453 @itemx -mstrict-align
29454 @opindex mno-strict-align
29455 @opindex mstrict-align
29456 On System V.4 and embedded PowerPC systems do not (do) assume that
29457 unaligned memory references are handled by the system.
29458
29459 @item -mrelocatable
29460 @itemx -mno-relocatable
29461 @opindex mrelocatable
29462 @opindex mno-relocatable
29463 Generate code that allows (does not allow) a static executable to be
29464 relocated to a different address at run time. A simple embedded
29465 PowerPC system loader should relocate the entire contents of
29466 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
29467 a table of 32-bit addresses generated by this option. For this to
29468 work, all objects linked together must be compiled with
29469 @option{-mrelocatable} or @option{-mrelocatable-lib}.
29470 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
29471
29472 @item -mrelocatable-lib
29473 @itemx -mno-relocatable-lib
29474 @opindex mrelocatable-lib
29475 @opindex mno-relocatable-lib
29476 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
29477 @code{.fixup} section to allow static executables to be relocated at
29478 run time, but @option{-mrelocatable-lib} does not use the smaller stack
29479 alignment of @option{-mrelocatable}. Objects compiled with
29480 @option{-mrelocatable-lib} may be linked with objects compiled with
29481 any combination of the @option{-mrelocatable} options.
29482
29483 @item -mno-toc
29484 @itemx -mtoc
29485 @opindex mno-toc
29486 @opindex mtoc
29487 On System V.4 and embedded PowerPC systems do not (do) assume that
29488 register 2 contains a pointer to a global area pointing to the addresses
29489 used in the program.
29490
29491 @item -mlittle
29492 @itemx -mlittle-endian
29493 @opindex mlittle
29494 @opindex mlittle-endian
29495 On System V.4 and embedded PowerPC systems compile code for the
29496 processor in little-endian mode. The @option{-mlittle-endian} option is
29497 the same as @option{-mlittle}.
29498
29499 @item -mbig
29500 @itemx -mbig-endian
29501 @opindex mbig
29502 @opindex mbig-endian
29503 On System V.4 and embedded PowerPC systems compile code for the
29504 processor in big-endian mode. The @option{-mbig-endian} option is
29505 the same as @option{-mbig}.
29506
29507 @item -mdynamic-no-pic
29508 @opindex mdynamic-no-pic
29509 On Darwin and Mac OS X systems, compile code so that it is not
29510 relocatable, but that its external references are relocatable. The
29511 resulting code is suitable for applications, but not shared
29512 libraries.
29513
29514 @item -msingle-pic-base
29515 @opindex msingle-pic-base
29516 Treat the register used for PIC addressing as read-only, rather than
29517 loading it in the prologue for each function. The runtime system is
29518 responsible for initializing this register with an appropriate value
29519 before execution begins.
29520
29521 @item -mprioritize-restricted-insns=@var{priority}
29522 @opindex mprioritize-restricted-insns
29523 This option controls the priority that is assigned to
29524 dispatch-slot restricted instructions during the second scheduling
29525 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
29526 or @samp{2} to assign no, highest, or second-highest (respectively)
29527 priority to dispatch-slot restricted
29528 instructions.
29529
29530 @item -msched-costly-dep=@var{dependence_type}
29531 @opindex msched-costly-dep
29532 This option controls which dependences are considered costly
29533 by the target during instruction scheduling. The argument
29534 @var{dependence_type} takes one of the following values:
29535
29536 @table @asis
29537 @item @samp{no}
29538 No dependence is costly.
29539
29540 @item @samp{all}
29541 All dependences are costly.
29542
29543 @item @samp{true_store_to_load}
29544 A true dependence from store to load is costly.
29545
29546 @item @samp{store_to_load}
29547 Any dependence from store to load is costly.
29548
29549 @item @var{number}
29550 Any dependence for which the latency is greater than or equal to
29551 @var{number} is costly.
29552 @end table
29553
29554 @item -minsert-sched-nops=@var{scheme}
29555 @opindex minsert-sched-nops
29556 This option controls which NOP insertion scheme is used during
29557 the second scheduling pass. The argument @var{scheme} takes one of the
29558 following values:
29559
29560 @table @asis
29561 @item @samp{no}
29562 Don't insert NOPs.
29563
29564 @item @samp{pad}
29565 Pad with NOPs any dispatch group that has vacant issue slots,
29566 according to the scheduler's grouping.
29567
29568 @item @samp{regroup_exact}
29569 Insert NOPs to force costly dependent insns into
29570 separate groups. Insert exactly as many NOPs as needed to force an insn
29571 to a new group, according to the estimated processor grouping.
29572
29573 @item @var{number}
29574 Insert NOPs to force costly dependent insns into
29575 separate groups. Insert @var{number} NOPs to force an insn to a new group.
29576 @end table
29577
29578 @item -mcall-sysv
29579 @opindex mcall-sysv
29580 On System V.4 and embedded PowerPC systems compile code using calling
29581 conventions that adhere to the March 1995 draft of the System V
29582 Application Binary Interface, PowerPC processor supplement. This is the
29583 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
29584
29585 @item -mcall-sysv-eabi
29586 @itemx -mcall-eabi
29587 @opindex mcall-sysv-eabi
29588 @opindex mcall-eabi
29589 Specify both @option{-mcall-sysv} and @option{-meabi} options.
29590
29591 @item -mcall-sysv-noeabi
29592 @opindex mcall-sysv-noeabi
29593 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
29594
29595 @item -mcall-aixdesc
29596 @opindex mcall-aixdesc
29597 On System V.4 and embedded PowerPC systems compile code for the AIX
29598 operating system.
29599
29600 @item -mcall-linux
29601 @opindex mcall-linux
29602 On System V.4 and embedded PowerPC systems compile code for the
29603 Linux-based GNU system.
29604
29605 @item -mcall-freebsd
29606 @opindex mcall-freebsd
29607 On System V.4 and embedded PowerPC systems compile code for the
29608 FreeBSD operating system.
29609
29610 @item -mcall-netbsd
29611 @opindex mcall-netbsd
29612 On System V.4 and embedded PowerPC systems compile code for the
29613 NetBSD operating system.
29614
29615 @item -mcall-openbsd
29616 @opindex mcall-openbsd
29617 On System V.4 and embedded PowerPC systems compile code for the
29618 OpenBSD operating system.
29619
29620 @item -mtraceback=@var{traceback_type}
29621 @opindex mtraceback
29622 Select the type of traceback table. Valid values for @var{traceback_type}
29623 are @samp{full}, @samp{part}, and @samp{no}.
29624
29625 @item -maix-struct-return
29626 @opindex maix-struct-return
29627 Return all structures in memory (as specified by the AIX ABI)@.
29628
29629 @item -msvr4-struct-return
29630 @opindex msvr4-struct-return
29631 Return structures smaller than 8 bytes in registers (as specified by the
29632 SVR4 ABI)@.
29633
29634 @item -mabi=@var{abi-type}
29635 @opindex mabi
29636 Extend the current ABI with a particular extension, or remove such extension.
29637 Valid values are: @samp{altivec}, @samp{no-altivec},
29638 @samp{ibmlongdouble}, @samp{ieeelongdouble},
29639 @samp{elfv1}, @samp{elfv2},
29640 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
29641
29642 @item -mabi=ibmlongdouble
29643 @opindex mabi=ibmlongdouble
29644 Change the current ABI to use IBM extended-precision long double.
29645 This is not likely to work if your system defaults to using IEEE
29646 extended-precision long double. If you change the long double type
29647 from IEEE extended-precision, the compiler will issue a warning unless
29648 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
29649 to be enabled.
29650
29651 @item -mabi=ieeelongdouble
29652 @opindex mabi=ieeelongdouble
29653 Change the current ABI to use IEEE extended-precision long double.
29654 This is not likely to work if your system defaults to using IBM
29655 extended-precision long double. If you change the long double type
29656 from IBM extended-precision, the compiler will issue a warning unless
29657 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
29658 to be enabled.
29659
29660 @item -mabi=elfv1
29661 @opindex mabi=elfv1
29662 Change the current ABI to use the ELFv1 ABI.
29663 This is the default ABI for big-endian PowerPC 64-bit Linux.
29664 Overriding the default ABI requires special system support and is
29665 likely to fail in spectacular ways.
29666
29667 @item -mabi=elfv2
29668 @opindex mabi=elfv2
29669 Change the current ABI to use the ELFv2 ABI.
29670 This is the default ABI for little-endian PowerPC 64-bit Linux.
29671 Overriding the default ABI requires special system support and is
29672 likely to fail in spectacular ways.
29673
29674 @item -mgnu-attribute
29675 @itemx -mno-gnu-attribute
29676 @opindex mgnu-attribute
29677 @opindex mno-gnu-attribute
29678 Emit .gnu_attribute assembly directives to set tag/value pairs in a
29679 .gnu.attributes section that specify ABI variations in function
29680 parameters or return values.
29681
29682 @item -mprototype
29683 @itemx -mno-prototype
29684 @opindex mprototype
29685 @opindex mno-prototype
29686 On System V.4 and embedded PowerPC systems assume that all calls to
29687 variable argument functions are properly prototyped. Otherwise, the
29688 compiler must insert an instruction before every non-prototyped call to
29689 set or clear bit 6 of the condition code register (@code{CR}) to
29690 indicate whether floating-point values are passed in the floating-point
29691 registers in case the function takes variable arguments. With
29692 @option{-mprototype}, only calls to prototyped variable argument functions
29693 set or clear the bit.
29694
29695 @item -msim
29696 @opindex msim
29697 On embedded PowerPC systems, assume that the startup module is called
29698 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
29699 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
29700 configurations.
29701
29702 @item -mmvme
29703 @opindex mmvme
29704 On embedded PowerPC systems, assume that the startup module is called
29705 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
29706 @file{libc.a}.
29707
29708 @item -mads
29709 @opindex mads
29710 On embedded PowerPC systems, assume that the startup module is called
29711 @file{crt0.o} and the standard C libraries are @file{libads.a} and
29712 @file{libc.a}.
29713
29714 @item -myellowknife
29715 @opindex myellowknife
29716 On embedded PowerPC systems, assume that the startup module is called
29717 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
29718 @file{libc.a}.
29719
29720 @item -mvxworks
29721 @opindex mvxworks
29722 On System V.4 and embedded PowerPC systems, specify that you are
29723 compiling for a VxWorks system.
29724
29725 @item -memb
29726 @opindex memb
29727 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
29728 header to indicate that @samp{eabi} extended relocations are used.
29729
29730 @item -meabi
29731 @itemx -mno-eabi
29732 @opindex meabi
29733 @opindex mno-eabi
29734 On System V.4 and embedded PowerPC systems do (do not) adhere to the
29735 Embedded Applications Binary Interface (EABI), which is a set of
29736 modifications to the System V.4 specifications. Selecting @option{-meabi}
29737 means that the stack is aligned to an 8-byte boundary, a function
29738 @code{__eabi} is called from @code{main} to set up the EABI
29739 environment, and the @option{-msdata} option can use both @code{r2} and
29740 @code{r13} to point to two separate small data areas. Selecting
29741 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
29742 no EABI initialization function is called from @code{main}, and the
29743 @option{-msdata} option only uses @code{r13} to point to a single
29744 small data area. The @option{-meabi} option is on by default if you
29745 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
29746
29747 @item -msdata=eabi
29748 @opindex msdata=eabi
29749 On System V.4 and embedded PowerPC systems, put small initialized
29750 @code{const} global and static data in the @code{.sdata2} section, which
29751 is pointed to by register @code{r2}. Put small initialized
29752 non-@code{const} global and static data in the @code{.sdata} section,
29753 which is pointed to by register @code{r13}. Put small uninitialized
29754 global and static data in the @code{.sbss} section, which is adjacent to
29755 the @code{.sdata} section. The @option{-msdata=eabi} option is
29756 incompatible with the @option{-mrelocatable} option. The
29757 @option{-msdata=eabi} option also sets the @option{-memb} option.
29758
29759 @item -msdata=sysv
29760 @opindex msdata=sysv
29761 On System V.4 and embedded PowerPC systems, put small global and static
29762 data in the @code{.sdata} section, which is pointed to by register
29763 @code{r13}. Put small uninitialized global and static data in the
29764 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
29765 The @option{-msdata=sysv} option is incompatible with the
29766 @option{-mrelocatable} option.
29767
29768 @item -msdata=default
29769 @itemx -msdata
29770 @opindex msdata=default
29771 @opindex msdata
29772 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
29773 compile code the same as @option{-msdata=eabi}, otherwise compile code the
29774 same as @option{-msdata=sysv}.
29775
29776 @item -msdata=data
29777 @opindex msdata=data
29778 On System V.4 and embedded PowerPC systems, put small global
29779 data in the @code{.sdata} section. Put small uninitialized global
29780 data in the @code{.sbss} section. Do not use register @code{r13}
29781 to address small data however. This is the default behavior unless
29782 other @option{-msdata} options are used.
29783
29784 @item -msdata=none
29785 @itemx -mno-sdata
29786 @opindex msdata=none
29787 @opindex mno-sdata
29788 On embedded PowerPC systems, put all initialized global and static data
29789 in the @code{.data} section, and all uninitialized data in the
29790 @code{.bss} section.
29791
29792 @item -mreadonly-in-sdata
29793 @opindex mreadonly-in-sdata
29794 @opindex mno-readonly-in-sdata
29795 Put read-only objects in the @code{.sdata} section as well. This is the
29796 default.
29797
29798 @item -mblock-move-inline-limit=@var{num}
29799 @opindex mblock-move-inline-limit
29800 Inline all block moves (such as calls to @code{memcpy} or structure
29801 copies) less than or equal to @var{num} bytes. The minimum value for
29802 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
29803 targets. The default value is target-specific.
29804
29805 @item -mblock-compare-inline-limit=@var{num}
29806 @opindex mblock-compare-inline-limit
29807 Generate non-looping inline code for all block compares (such as calls
29808 to @code{memcmp} or structure compares) less than or equal to @var{num}
29809 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
29810 block compare is disabled. The default value is target-specific.
29811
29812 @item -mblock-compare-inline-loop-limit=@var{num}
29813 @opindex mblock-compare-inline-loop-limit
29814 Generate an inline expansion using loop code for all block compares that
29815 are less than or equal to @var{num} bytes, but greater than the limit
29816 for non-loop inline block compare expansion. If the block length is not
29817 constant, at most @var{num} bytes will be compared before @code{memcmp}
29818 is called to compare the remainder of the block. The default value is
29819 target-specific.
29820
29821 @item -mstring-compare-inline-limit=@var{num}
29822 @opindex mstring-compare-inline-limit
29823 Compare at most @var{num} string bytes with inline code.
29824 If the difference or end of string is not found at the
29825 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
29826 take care of the rest of the comparison. The default is 64 bytes.
29827
29828 @item -G @var{num}
29829 @opindex G
29830 @cindex smaller data references (PowerPC)
29831 @cindex .sdata/.sdata2 references (PowerPC)
29832 On embedded PowerPC systems, put global and static items less than or
29833 equal to @var{num} bytes into the small data or BSS sections instead of
29834 the normal data or BSS section. By default, @var{num} is 8. The
29835 @option{-G @var{num}} switch is also passed to the linker.
29836 All modules should be compiled with the same @option{-G @var{num}} value.
29837
29838 @item -mregnames
29839 @itemx -mno-regnames
29840 @opindex mregnames
29841 @opindex mno-regnames
29842 On System V.4 and embedded PowerPC systems do (do not) emit register
29843 names in the assembly language output using symbolic forms.
29844
29845 @item -mlongcall
29846 @itemx -mno-longcall
29847 @opindex mlongcall
29848 @opindex mno-longcall
29849 By default assume that all calls are far away so that a longer and more
29850 expensive calling sequence is required. This is required for calls
29851 farther than 32 megabytes (33,554,432 bytes) from the current location.
29852 A short call is generated if the compiler knows
29853 the call cannot be that far away. This setting can be overridden by
29854 the @code{shortcall} function attribute, or by @code{#pragma
29855 longcall(0)}.
29856
29857 Some linkers are capable of detecting out-of-range calls and generating
29858 glue code on the fly. On these systems, long calls are unnecessary and
29859 generate slower code. As of this writing, the AIX linker can do this,
29860 as can the GNU linker for PowerPC/64. It is planned to add this feature
29861 to the GNU linker for 32-bit PowerPC systems as well.
29862
29863 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
29864 GCC can generate long calls using an inline PLT call sequence (see
29865 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
29866 ELFv1 (big-endian) do not support inline PLT calls.
29867
29868 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
29869 callee, L42}, plus a @dfn{branch island} (glue code). The two target
29870 addresses represent the callee and the branch island. The
29871 Darwin/PPC linker prefers the first address and generates a @code{bl
29872 callee} if the PPC @code{bl} instruction reaches the callee directly;
29873 otherwise, the linker generates @code{bl L42} to call the branch
29874 island. The branch island is appended to the body of the
29875 calling function; it computes the full 32-bit address of the callee
29876 and jumps to it.
29877
29878 On Mach-O (Darwin) systems, this option directs the compiler emit to
29879 the glue for every direct call, and the Darwin linker decides whether
29880 to use or discard it.
29881
29882 In the future, GCC may ignore all longcall specifications
29883 when the linker is known to generate glue.
29884
29885 @item -mpltseq
29886 @itemx -mno-pltseq
29887 @opindex mpltseq
29888 @opindex mno-pltseq
29889 Implement (do not implement) -fno-plt and long calls using an inline
29890 PLT call sequence that supports lazy linking and long calls to
29891 functions in dlopen'd shared libraries. Inline PLT calls are only
29892 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
29893 linkers, and are enabled by default if the support is detected when
29894 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
29895 configured with @option{--enable-secureplt}. @option{-mpltseq} code
29896 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
29897 linked together.
29898
29899 @item -mtls-markers
29900 @itemx -mno-tls-markers
29901 @opindex mtls-markers
29902 @opindex mno-tls-markers
29903 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
29904 specifying the function argument. The relocation allows the linker to
29905 reliably associate function call with argument setup instructions for
29906 TLS optimization, which in turn allows GCC to better schedule the
29907 sequence.
29908
29909 @item -mrecip
29910 @itemx -mno-recip
29911 @opindex mrecip
29912 This option enables use of the reciprocal estimate and
29913 reciprocal square root estimate instructions with additional
29914 Newton-Raphson steps to increase precision instead of doing a divide or
29915 square root and divide for floating-point arguments. You should use
29916 the @option{-ffast-math} option when using @option{-mrecip} (or at
29917 least @option{-funsafe-math-optimizations},
29918 @option{-ffinite-math-only}, @option{-freciprocal-math} and
29919 @option{-fno-trapping-math}). Note that while the throughput of the
29920 sequence is generally higher than the throughput of the non-reciprocal
29921 instruction, the precision of the sequence can be decreased by up to 2
29922 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
29923 roots.
29924
29925 @item -mrecip=@var{opt}
29926 @opindex mrecip=opt
29927 This option controls which reciprocal estimate instructions
29928 may be used. @var{opt} is a comma-separated list of options, which may
29929 be preceded by a @code{!} to invert the option:
29930
29931 @table @samp
29932
29933 @item all
29934 Enable all estimate instructions.
29935
29936 @item default
29937 Enable the default instructions, equivalent to @option{-mrecip}.
29938
29939 @item none
29940 Disable all estimate instructions, equivalent to @option{-mno-recip}.
29941
29942 @item div
29943 Enable the reciprocal approximation instructions for both
29944 single and double precision.
29945
29946 @item divf
29947 Enable the single-precision reciprocal approximation instructions.
29948
29949 @item divd
29950 Enable the double-precision reciprocal approximation instructions.
29951
29952 @item rsqrt
29953 Enable the reciprocal square root approximation instructions for both
29954 single and double precision.
29955
29956 @item rsqrtf
29957 Enable the single-precision reciprocal square root approximation instructions.
29958
29959 @item rsqrtd
29960 Enable the double-precision reciprocal square root approximation instructions.
29961
29962 @end table
29963
29964 So, for example, @option{-mrecip=all,!rsqrtd} enables
29965 all of the reciprocal estimate instructions, except for the
29966 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
29967 which handle the double-precision reciprocal square root calculations.
29968
29969 @item -mrecip-precision
29970 @itemx -mno-recip-precision
29971 @opindex mrecip-precision
29972 Assume (do not assume) that the reciprocal estimate instructions
29973 provide higher-precision estimates than is mandated by the PowerPC
29974 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
29975 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
29976 The double-precision square root estimate instructions are not generated by
29977 default on low-precision machines, since they do not provide an
29978 estimate that converges after three steps.
29979
29980 @item -mveclibabi=@var{type}
29981 @opindex mveclibabi
29982 Specifies the ABI type to use for vectorizing intrinsics using an
29983 external library. The only type supported at present is @samp{mass},
29984 which specifies to use IBM's Mathematical Acceleration Subsystem
29985 (MASS) libraries for vectorizing intrinsics using external libraries.
29986 GCC currently emits calls to @code{acosd2}, @code{acosf4},
29987 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
29988 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
29989 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
29990 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
29991 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
29992 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
29993 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
29994 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
29995 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
29996 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
29997 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
29998 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
29999 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30000 for power7. Both @option{-ftree-vectorize} and
30001 @option{-funsafe-math-optimizations} must also be enabled. The MASS
30002 libraries must be specified at link time.
30003
30004 @item -mfriz
30005 @itemx -mno-friz
30006 @opindex mfriz
30007 Generate (do not generate) the @code{friz} instruction when the
30008 @option{-funsafe-math-optimizations} option is used to optimize
30009 rounding of floating-point values to 64-bit integer and back to floating
30010 point. The @code{friz} instruction does not return the same value if
30011 the floating-point number is too large to fit in an integer.
30012
30013 @item -mpointers-to-nested-functions
30014 @itemx -mno-pointers-to-nested-functions
30015 @opindex mpointers-to-nested-functions
30016 Generate (do not generate) code to load up the static chain register
30017 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30018 systems where a function pointer points to a 3-word descriptor giving
30019 the function address, TOC value to be loaded in register @code{r2}, and
30020 static chain value to be loaded in register @code{r11}. The
30021 @option{-mpointers-to-nested-functions} is on by default. You cannot
30022 call through pointers to nested functions or pointers
30023 to functions compiled in other languages that use the static chain if
30024 you use @option{-mno-pointers-to-nested-functions}.
30025
30026 @item -msave-toc-indirect
30027 @itemx -mno-save-toc-indirect
30028 @opindex msave-toc-indirect
30029 Generate (do not generate) code to save the TOC value in the reserved
30030 stack location in the function prologue if the function calls through
30031 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
30032 saved in the prologue, it is saved just before the call through the
30033 pointer. The @option{-mno-save-toc-indirect} option is the default.
30034
30035 @item -mcompat-align-parm
30036 @itemx -mno-compat-align-parm
30037 @opindex mcompat-align-parm
30038 Generate (do not generate) code to pass structure parameters with a
30039 maximum alignment of 64 bits, for compatibility with older versions
30040 of GCC.
30041
30042 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30043 structure parameter on a 128-bit boundary when that structure contained
30044 a member requiring 128-bit alignment. This is corrected in more
30045 recent versions of GCC. This option may be used to generate code
30046 that is compatible with functions compiled with older versions of
30047 GCC.
30048
30049 The @option{-mno-compat-align-parm} option is the default.
30050
30051 @item -mstack-protector-guard=@var{guard}
30052 @itemx -mstack-protector-guard-reg=@var{reg}
30053 @itemx -mstack-protector-guard-offset=@var{offset}
30054 @itemx -mstack-protector-guard-symbol=@var{symbol}
30055 @opindex mstack-protector-guard
30056 @opindex mstack-protector-guard-reg
30057 @opindex mstack-protector-guard-offset
30058 @opindex mstack-protector-guard-symbol
30059 Generate stack protection code using canary at @var{guard}. Supported
30060 locations are @samp{global} for global canary or @samp{tls} for per-thread
30061 canary in the TLS block (the default with GNU libc version 2.4 or later).
30062
30063 With the latter choice the options
30064 @option{-mstack-protector-guard-reg=@var{reg}} and
30065 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30066 which register to use as base register for reading the canary, and from what
30067 offset from that base register. The default for those is as specified in the
30068 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30069 the offset with a symbol reference to a canary in the TLS block.
30070
30071 @item -mpcrel
30072 @itemx -mno-pcrel
30073 @opindex mpcrel
30074 @opindex mno-pcrel
30075 Generate (do not generate) pc-relative addressing. The @option{-mpcrel}
30076 option requires that the medium code model (@option{-mcmodel=medium})
30077 and prefixed addressing (@option{-mprefixed}) options are enabled.
30078
30079 @item -mprefixed
30080 @itemx -mno-prefixed
30081 @opindex mprefixed
30082 @opindex mno-prefixed
30083 Generate (do not generate) addressing modes using prefixed load and
30084 store instructions. The @option{-mprefixed} option requires that
30085 the option @option{-mcpu=power10} (or later) is enabled.
30086
30087 @item -mmma
30088 @itemx -mno-mma
30089 @opindex mmma
30090 @opindex mno-mma
30091 Generate (do not generate) the MMA instructions. The @option{-mma}
30092 option requires that the option @option{-mcpu=power10} (or later)
30093 is enabled.
30094
30095 @item -mrop-protect
30096 @itemx -mno-rop-protect
30097 @opindex mrop-protect
30098 @opindex mno-rop-protect
30099 Generate (do not generate) ROP protection instructions when the target
30100 processor supports them. Currently this option disables the shrink-wrap
30101 optimization (@option{-fshrink-wrap}).
30102
30103 @item -mprivileged
30104 @itemx -mno-privileged
30105 @opindex mprivileged
30106 @opindex mno-privileged
30107 Generate (do not generate) code that will run in privileged state.
30108
30109 @item -mblock-ops-unaligned-vsx
30110 @itemx -mno-block-ops-unaligned-vsx
30111 @opindex block-ops-unaligned-vsx
30112 @opindex no-block-ops-unaligned-vsx
30113 Generate (do not generate) unaligned vsx loads and stores for
30114 inline expansion of @code{memcpy} and @code{memmove}.
30115
30116 @item --param rs6000-vect-unroll-limit=
30117 The vectorizer will check with target information to determine whether it
30118 would be beneficial to unroll the main vectorized loop and by how much. This
30119 parameter sets the upper bound of how much the vectorizer will unroll the main
30120 loop. The default value is four.
30121
30122 @end table
30123
30124 @node RX Options
30125 @subsection RX Options
30126 @cindex RX Options
30127
30128 These command-line options are defined for RX targets:
30129
30130 @table @gcctabopt
30131 @item -m64bit-doubles
30132 @itemx -m32bit-doubles
30133 @opindex m64bit-doubles
30134 @opindex m32bit-doubles
30135 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30136 or 32 bits (@option{-m32bit-doubles}) in size. The default is
30137 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
30138 works on 32-bit values, which is why the default is
30139 @option{-m32bit-doubles}.
30140
30141 @item -fpu
30142 @itemx -nofpu
30143 @opindex fpu
30144 @opindex nofpu
30145 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30146 floating-point hardware. The default is enabled for the RX600
30147 series and disabled for the RX200 series.
30148
30149 Floating-point instructions are only generated for 32-bit floating-point
30150 values, however, so the FPU hardware is not used for doubles if the
30151 @option{-m64bit-doubles} option is used.
30152
30153 @emph{Note} If the @option{-fpu} option is enabled then
30154 @option{-funsafe-math-optimizations} is also enabled automatically.
30155 This is because the RX FPU instructions are themselves unsafe.
30156
30157 @item -mcpu=@var{name}
30158 @opindex mcpu
30159 Selects the type of RX CPU to be targeted. Currently three types are
30160 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30161 the specific @samp{RX610} CPU. The default is @samp{RX600}.
30162
30163 The only difference between @samp{RX600} and @samp{RX610} is that the
30164 @samp{RX610} does not support the @code{MVTIPL} instruction.
30165
30166 The @samp{RX200} series does not have a hardware floating-point unit
30167 and so @option{-nofpu} is enabled by default when this type is
30168 selected.
30169
30170 @item -mbig-endian-data
30171 @itemx -mlittle-endian-data
30172 @opindex mbig-endian-data
30173 @opindex mlittle-endian-data
30174 Store data (but not code) in the big-endian format. The default is
30175 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30176 format.
30177
30178 @item -msmall-data-limit=@var{N}
30179 @opindex msmall-data-limit
30180 Specifies the maximum size in bytes of global and static variables
30181 which can be placed into the small data area. Using the small data
30182 area can lead to smaller and faster code, but the size of area is
30183 limited and it is up to the programmer to ensure that the area does
30184 not overflow. Also when the small data area is used one of the RX's
30185 registers (usually @code{r13}) is reserved for use pointing to this
30186 area, so it is no longer available for use by the compiler. This
30187 could result in slower and/or larger code if variables are pushed onto
30188 the stack instead of being held in this register.
30189
30190 Note, common variables (variables that have not been initialized) and
30191 constants are not placed into the small data area as they are assigned
30192 to other sections in the output executable.
30193
30194 The default value is zero, which disables this feature. Note, this
30195 feature is not enabled by default with higher optimization levels
30196 (@option{-O2} etc) because of the potentially detrimental effects of
30197 reserving a register. It is up to the programmer to experiment and
30198 discover whether this feature is of benefit to their program. See the
30199 description of the @option{-mpid} option for a description of how the
30200 actual register to hold the small data area pointer is chosen.
30201
30202 @item -msim
30203 @itemx -mno-sim
30204 @opindex msim
30205 @opindex mno-sim
30206 Use the simulator runtime. The default is to use the libgloss
30207 board-specific runtime.
30208
30209 @item -mas100-syntax
30210 @itemx -mno-as100-syntax
30211 @opindex mas100-syntax
30212 @opindex mno-as100-syntax
30213 When generating assembler output use a syntax that is compatible with
30214 Renesas's AS100 assembler. This syntax can also be handled by the GAS
30215 assembler, but it has some restrictions so it is not generated by default.
30216
30217 @item -mmax-constant-size=@var{N}
30218 @opindex mmax-constant-size
30219 Specifies the maximum size, in bytes, of a constant that can be used as
30220 an operand in a RX instruction. Although the RX instruction set does
30221 allow constants of up to 4 bytes in length to be used in instructions,
30222 a longer value equates to a longer instruction. Thus in some
30223 circumstances it can be beneficial to restrict the size of constants
30224 that are used in instructions. Constants that are too big are instead
30225 placed into a constant pool and referenced via register indirection.
30226
30227 The value @var{N} can be between 0 and 4. A value of 0 (the default)
30228 or 4 means that constants of any size are allowed.
30229
30230 @item -mrelax
30231 @opindex mrelax
30232 Enable linker relaxation. Linker relaxation is a process whereby the
30233 linker attempts to reduce the size of a program by finding shorter
30234 versions of various instructions. Disabled by default.
30235
30236 @item -mint-register=@var{N}
30237 @opindex mint-register
30238 Specify the number of registers to reserve for fast interrupt handler
30239 functions. The value @var{N} can be between 0 and 4. A value of 1
30240 means that register @code{r13} is reserved for the exclusive use
30241 of fast interrupt handlers. A value of 2 reserves @code{r13} and
30242 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
30243 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30244 A value of 0, the default, does not reserve any registers.
30245
30246 @item -msave-acc-in-interrupts
30247 @opindex msave-acc-in-interrupts
30248 Specifies that interrupt handler functions should preserve the
30249 accumulator register. This is only necessary if normal code might use
30250 the accumulator register, for example because it performs 64-bit
30251 multiplications. The default is to ignore the accumulator as this
30252 makes the interrupt handlers faster.
30253
30254 @item -mpid
30255 @itemx -mno-pid
30256 @opindex mpid
30257 @opindex mno-pid
30258 Enables the generation of position independent data. When enabled any
30259 access to constant data is done via an offset from a base address
30260 held in a register. This allows the location of constant data to be
30261 determined at run time without requiring the executable to be
30262 relocated, which is a benefit to embedded applications with tight
30263 memory constraints. Data that can be modified is not affected by this
30264 option.
30265
30266 Note, using this feature reserves a register, usually @code{r13}, for
30267 the constant data base address. This can result in slower and/or
30268 larger code, especially in complicated functions.
30269
30270 The actual register chosen to hold the constant data base address
30271 depends upon whether the @option{-msmall-data-limit} and/or the
30272 @option{-mint-register} command-line options are enabled. Starting
30273 with register @code{r13} and proceeding downwards, registers are
30274 allocated first to satisfy the requirements of @option{-mint-register},
30275 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
30276 is possible for the small data area register to be @code{r8} if both
30277 @option{-mint-register=4} and @option{-mpid} are specified on the
30278 command line.
30279
30280 By default this feature is not enabled. The default can be restored
30281 via the @option{-mno-pid} command-line option.
30282
30283 @item -mno-warn-multiple-fast-interrupts
30284 @itemx -mwarn-multiple-fast-interrupts
30285 @opindex mno-warn-multiple-fast-interrupts
30286 @opindex mwarn-multiple-fast-interrupts
30287 Prevents GCC from issuing a warning message if it finds more than one
30288 fast interrupt handler when it is compiling a file. The default is to
30289 issue a warning for each extra fast interrupt handler found, as the RX
30290 only supports one such interrupt.
30291
30292 @item -mallow-string-insns
30293 @itemx -mno-allow-string-insns
30294 @opindex mallow-string-insns
30295 @opindex mno-allow-string-insns
30296 Enables or disables the use of the string manipulation instructions
30297 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30298 @code{SWHILE} and also the @code{RMPA} instruction. These
30299 instructions may prefetch data, which is not safe to do if accessing
30300 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
30301 for more information).
30302
30303 The default is to allow these instructions, but it is not possible for
30304 GCC to reliably detect all circumstances where a string instruction
30305 might be used to access an I/O register, so their use cannot be
30306 disabled automatically. Instead it is reliant upon the programmer to
30307 use the @option{-mno-allow-string-insns} option if their program
30308 accesses I/O space.
30309
30310 When the instructions are enabled GCC defines the C preprocessor
30311 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30312 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30313
30314 @item -mjsr
30315 @itemx -mno-jsr
30316 @opindex mjsr
30317 @opindex mno-jsr
30318 Use only (or not only) @code{JSR} instructions to access functions.
30319 This option can be used when code size exceeds the range of @code{BSR}
30320 instructions. Note that @option{-mno-jsr} does not mean to not use
30321 @code{JSR} but instead means that any type of branch may be used.
30322 @end table
30323
30324 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30325 has special significance to the RX port when used with the
30326 @code{interrupt} function attribute. This attribute indicates a
30327 function intended to process fast interrupts. GCC ensures
30328 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30329 and/or @code{r13} and only provided that the normal use of the
30330 corresponding registers have been restricted via the
30331 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30332 options.
30333
30334 @node S/390 and zSeries Options
30335 @subsection S/390 and zSeries Options
30336 @cindex S/390 and zSeries Options
30337
30338 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30339
30340 @table @gcctabopt
30341 @item -mhard-float
30342 @itemx -msoft-float
30343 @opindex mhard-float
30344 @opindex msoft-float
30345 Use (do not use) the hardware floating-point instructions and registers
30346 for floating-point operations. When @option{-msoft-float} is specified,
30347 functions in @file{libgcc.a} are used to perform floating-point
30348 operations. When @option{-mhard-float} is specified, the compiler
30349 generates IEEE floating-point instructions. This is the default.
30350
30351 @item -mhard-dfp
30352 @itemx -mno-hard-dfp
30353 @opindex mhard-dfp
30354 @opindex mno-hard-dfp
30355 Use (do not use) the hardware decimal-floating-point instructions for
30356 decimal-floating-point operations. When @option{-mno-hard-dfp} is
30357 specified, functions in @file{libgcc.a} are used to perform
30358 decimal-floating-point operations. When @option{-mhard-dfp} is
30359 specified, the compiler generates decimal-floating-point hardware
30360 instructions. This is the default for @option{-march=z9-ec} or higher.
30361
30362 @item -mlong-double-64
30363 @itemx -mlong-double-128
30364 @opindex mlong-double-64
30365 @opindex mlong-double-128
30366 These switches control the size of @code{long double} type. A size
30367 of 64 bits makes the @code{long double} type equivalent to the @code{double}
30368 type. This is the default.
30369
30370 @item -mbackchain
30371 @itemx -mno-backchain
30372 @opindex mbackchain
30373 @opindex mno-backchain
30374 Store (do not store) the address of the caller's frame as backchain pointer
30375 into the callee's stack frame.
30376 A backchain may be needed to allow debugging using tools that do not understand
30377 DWARF call frame information.
30378 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
30379 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
30380 the backchain is placed into the topmost word of the 96/160 byte register
30381 save area.
30382
30383 In general, code compiled with @option{-mbackchain} is call-compatible with
30384 code compiled with @option{-mno-backchain}; however, use of the backchain
30385 for debugging purposes usually requires that the whole binary is built with
30386 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
30387 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
30388 to build a linux kernel use @option{-msoft-float}.
30389
30390 The default is to not maintain the backchain.
30391
30392 @item -mpacked-stack
30393 @itemx -mno-packed-stack
30394 @opindex mpacked-stack
30395 @opindex mno-packed-stack
30396 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
30397 specified, the compiler uses the all fields of the 96/160 byte register save
30398 area only for their default purpose; unused fields still take up stack space.
30399 When @option{-mpacked-stack} is specified, register save slots are densely
30400 packed at the top of the register save area; unused space is reused for other
30401 purposes, allowing for more efficient use of the available stack space.
30402 However, when @option{-mbackchain} is also in effect, the topmost word of
30403 the save area is always used to store the backchain, and the return address
30404 register is always saved two words below the backchain.
30405
30406 As long as the stack frame backchain is not used, code generated with
30407 @option{-mpacked-stack} is call-compatible with code generated with
30408 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
30409 S/390 or zSeries generated code that uses the stack frame backchain at run
30410 time, not just for debugging purposes. Such code is not call-compatible
30411 with code compiled with @option{-mpacked-stack}. Also, note that the
30412 combination of @option{-mbackchain},
30413 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
30414 to build a linux kernel use @option{-msoft-float}.
30415
30416 The default is to not use the packed stack layout.
30417
30418 @item -msmall-exec
30419 @itemx -mno-small-exec
30420 @opindex msmall-exec
30421 @opindex mno-small-exec
30422 Generate (or do not generate) code using the @code{bras} instruction
30423 to do subroutine calls.
30424 This only works reliably if the total executable size does not
30425 exceed 64k. The default is to use the @code{basr} instruction instead,
30426 which does not have this limitation.
30427
30428 @item -m64
30429 @itemx -m31
30430 @opindex m64
30431 @opindex m31
30432 When @option{-m31} is specified, generate code compliant to the
30433 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
30434 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
30435 particular to generate 64-bit instructions. For the @samp{s390}
30436 targets, the default is @option{-m31}, while the @samp{s390x}
30437 targets default to @option{-m64}.
30438
30439 @item -mzarch
30440 @itemx -mesa
30441 @opindex mzarch
30442 @opindex mesa
30443 When @option{-mzarch} is specified, generate code using the
30444 instructions available on z/Architecture.
30445 When @option{-mesa} is specified, generate code using the
30446 instructions available on ESA/390. Note that @option{-mesa} is
30447 not possible with @option{-m64}.
30448 When generating code compliant to the GNU/Linux for S/390 ABI,
30449 the default is @option{-mesa}. When generating code compliant
30450 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
30451
30452 @item -mhtm
30453 @itemx -mno-htm
30454 @opindex mhtm
30455 @opindex mno-htm
30456 The @option{-mhtm} option enables a set of builtins making use of
30457 instructions available with the transactional execution facility
30458 introduced with the IBM zEnterprise EC12 machine generation
30459 @ref{S/390 System z Built-in Functions}.
30460 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
30461
30462 @item -mvx
30463 @itemx -mno-vx
30464 @opindex mvx
30465 @opindex mno-vx
30466 When @option{-mvx} is specified, generate code using the instructions
30467 available with the vector extension facility introduced with the IBM
30468 z13 machine generation.
30469 This option changes the ABI for some vector type values with regard to
30470 alignment and calling conventions. In case vector type values are
30471 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
30472 command will be added to mark the resulting binary with the ABI used.
30473 @option{-mvx} is enabled by default when using @option{-march=z13}.
30474
30475 @item -mzvector
30476 @itemx -mno-zvector
30477 @opindex mzvector
30478 @opindex mno-zvector
30479 The @option{-mzvector} option enables vector language extensions and
30480 builtins using instructions available with the vector extension
30481 facility introduced with the IBM z13 machine generation.
30482 This option adds support for @samp{vector} to be used as a keyword to
30483 define vector type variables and arguments. @samp{vector} is only
30484 available when GNU extensions are enabled. It will not be expanded
30485 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
30486 In addition to the GCC low-level builtins @option{-mzvector} enables
30487 a set of builtins added for compatibility with AltiVec-style
30488 implementations like Power and Cell. In order to make use of these
30489 builtins the header file @file{vecintrin.h} needs to be included.
30490 @option{-mzvector} is disabled by default.
30491
30492 @item -mmvcle
30493 @itemx -mno-mvcle
30494 @opindex mmvcle
30495 @opindex mno-mvcle
30496 Generate (or do not generate) code using the @code{mvcle} instruction
30497 to perform block moves. When @option{-mno-mvcle} is specified,
30498 use a @code{mvc} loop instead. This is the default unless optimizing for
30499 size.
30500
30501 @item -mdebug
30502 @itemx -mno-debug
30503 @opindex mdebug
30504 @opindex mno-debug
30505 Print (or do not print) additional debug information when compiling.
30506 The default is to not print debug information.
30507
30508 @item -march=@var{cpu-type}
30509 @opindex march
30510 Generate code that runs on @var{cpu-type}, which is the name of a
30511 system representing a certain processor type. Possible values for
30512 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
30513 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
30514 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
30515 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
30516 @samp{z16}/@samp{arch14}, and @samp{native}.
30517
30518 The default is @option{-march=z900}.
30519
30520 Specifying @samp{native} as cpu type can be used to select the best
30521 architecture option for the host processor.
30522 @option{-march=native} has no effect if GCC does not recognize the
30523 processor.
30524
30525 @item -mtune=@var{cpu-type}
30526 @opindex mtune
30527 Tune to @var{cpu-type} everything applicable about the generated code,
30528 except for the ABI and the set of available instructions.
30529 The list of @var{cpu-type} values is the same as for @option{-march}.
30530 The default is the value used for @option{-march}.
30531
30532 @item -mtpf-trace
30533 @itemx -mno-tpf-trace
30534 @opindex mtpf-trace
30535 @opindex mno-tpf-trace
30536 Generate code that adds (does not add) in TPF OS specific branches to trace
30537 routines in the operating system. This option is off by default, even
30538 when compiling for the TPF OS@.
30539
30540 @item -mtpf-trace-skip
30541 @itemx -mno-tpf-trace-skip
30542 @opindex mtpf-trace-skip
30543 @opindex mno-tpf-trace-skip
30544 Generate code that changes (does not change) the default branch
30545 targets enabled by @option{-mtpf-trace} to point to specialized trace
30546 routines providing the ability of selectively skipping function trace
30547 entries for the TPF OS. This option is off by default, even when
30548 compiling for the TPF OS and specifying @option{-mtpf-trace}.
30549
30550 @item -mfused-madd
30551 @itemx -mno-fused-madd
30552 @opindex mfused-madd
30553 @opindex mno-fused-madd
30554 Generate code that uses (does not use) the floating-point multiply and
30555 accumulate instructions. These instructions are generated by default if
30556 hardware floating point is used.
30557
30558 @item -mwarn-framesize=@var{framesize}
30559 @opindex mwarn-framesize
30560 Emit a warning if the current function exceeds the given frame size. Because
30561 this is a compile-time check it doesn't need to be a real problem when the program
30562 runs. It is intended to identify functions that most probably cause
30563 a stack overflow. It is useful to be used in an environment with limited stack
30564 size e.g.@: the linux kernel.
30565
30566 @item -mwarn-dynamicstack
30567 @opindex mwarn-dynamicstack
30568 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
30569 arrays. This is generally a bad idea with a limited stack size.
30570
30571 @item -mstack-guard=@var{stack-guard}
30572 @itemx -mstack-size=@var{stack-size}
30573 @opindex mstack-guard
30574 @opindex mstack-size
30575 If these options are provided the S/390 back end emits additional instructions in
30576 the function prologue that trigger a trap if the stack size is @var{stack-guard}
30577 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
30578 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
30579 the frame size of the compiled function is chosen.
30580 These options are intended to be used to help debugging stack overflow problems.
30581 The additionally emitted code causes only little overhead and hence can also be
30582 used in production-like systems without greater performance degradation. The given
30583 values have to be exact powers of 2 and @var{stack-size} has to be greater than
30584 @var{stack-guard} without exceeding 64k.
30585 In order to be efficient the extra code makes the assumption that the stack starts
30586 at an address aligned to the value given by @var{stack-size}.
30587 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
30588
30589 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
30590 @opindex mhotpatch
30591 If the hotpatch option is enabled, a ``hot-patching'' function
30592 prologue is generated for all functions in the compilation unit.
30593 The funtion label is prepended with the given number of two-byte
30594 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
30595 the label, 2 * @var{post-halfwords} bytes are appended, using the
30596 largest NOP like instructions the architecture allows (maximum
30597 1000000).
30598
30599 If both arguments are zero, hotpatching is disabled.
30600
30601 This option can be overridden for individual functions with the
30602 @code{hotpatch} attribute.
30603 @end table
30604
30605 @node SH Options
30606 @subsection SH Options
30607
30608 These @samp{-m} options are defined for the SH implementations:
30609
30610 @table @gcctabopt
30611 @item -m1
30612 @opindex m1
30613 Generate code for the SH1.
30614
30615 @item -m2
30616 @opindex m2
30617 Generate code for the SH2.
30618
30619 @item -m2e
30620 Generate code for the SH2e.
30621
30622 @item -m2a-nofpu
30623 @opindex m2a-nofpu
30624 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
30625 that the floating-point unit is not used.
30626
30627 @item -m2a-single-only
30628 @opindex m2a-single-only
30629 Generate code for the SH2a-FPU, in such a way that no double-precision
30630 floating-point operations are used.
30631
30632 @item -m2a-single
30633 @opindex m2a-single
30634 Generate code for the SH2a-FPU assuming the floating-point unit is in
30635 single-precision mode by default.
30636
30637 @item -m2a
30638 @opindex m2a
30639 Generate code for the SH2a-FPU assuming the floating-point unit is in
30640 double-precision mode by default.
30641
30642 @item -m3
30643 @opindex m3
30644 Generate code for the SH3.
30645
30646 @item -m3e
30647 @opindex m3e
30648 Generate code for the SH3e.
30649
30650 @item -m4-nofpu
30651 @opindex m4-nofpu
30652 Generate code for the SH4 without a floating-point unit.
30653
30654 @item -m4-single-only
30655 @opindex m4-single-only
30656 Generate code for the SH4 with a floating-point unit that only
30657 supports single-precision arithmetic.
30658
30659 @item -m4-single
30660 @opindex m4-single
30661 Generate code for the SH4 assuming the floating-point unit is in
30662 single-precision mode by default.
30663
30664 @item -m4
30665 @opindex m4
30666 Generate code for the SH4.
30667
30668 @item -m4-100
30669 @opindex m4-100
30670 Generate code for SH4-100.
30671
30672 @item -m4-100-nofpu
30673 @opindex m4-100-nofpu
30674 Generate code for SH4-100 in such a way that the
30675 floating-point unit is not used.
30676
30677 @item -m4-100-single
30678 @opindex m4-100-single
30679 Generate code for SH4-100 assuming the floating-point unit is in
30680 single-precision mode by default.
30681
30682 @item -m4-100-single-only
30683 @opindex m4-100-single-only
30684 Generate code for SH4-100 in such a way that no double-precision
30685 floating-point operations are used.
30686
30687 @item -m4-200
30688 @opindex m4-200
30689 Generate code for SH4-200.
30690
30691 @item -m4-200-nofpu
30692 @opindex m4-200-nofpu
30693 Generate code for SH4-200 without in such a way that the
30694 floating-point unit is not used.
30695
30696 @item -m4-200-single
30697 @opindex m4-200-single
30698 Generate code for SH4-200 assuming the floating-point unit is in
30699 single-precision mode by default.
30700
30701 @item -m4-200-single-only
30702 @opindex m4-200-single-only
30703 Generate code for SH4-200 in such a way that no double-precision
30704 floating-point operations are used.
30705
30706 @item -m4-300
30707 @opindex m4-300
30708 Generate code for SH4-300.
30709
30710 @item -m4-300-nofpu
30711 @opindex m4-300-nofpu
30712 Generate code for SH4-300 without in such a way that the
30713 floating-point unit is not used.
30714
30715 @item -m4-300-single
30716 @opindex m4-300-single
30717 Generate code for SH4-300 in such a way that no double-precision
30718 floating-point operations are used.
30719
30720 @item -m4-300-single-only
30721 @opindex m4-300-single-only
30722 Generate code for SH4-300 in such a way that no double-precision
30723 floating-point operations are used.
30724
30725 @item -m4-340
30726 @opindex m4-340
30727 Generate code for SH4-340 (no MMU, no FPU).
30728
30729 @item -m4-500
30730 @opindex m4-500
30731 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
30732 assembler.
30733
30734 @item -m4a-nofpu
30735 @opindex m4a-nofpu
30736 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
30737 floating-point unit is not used.
30738
30739 @item -m4a-single-only
30740 @opindex m4a-single-only
30741 Generate code for the SH4a, in such a way that no double-precision
30742 floating-point operations are used.
30743
30744 @item -m4a-single
30745 @opindex m4a-single
30746 Generate code for the SH4a assuming the floating-point unit is in
30747 single-precision mode by default.
30748
30749 @item -m4a
30750 @opindex m4a
30751 Generate code for the SH4a.
30752
30753 @item -m4al
30754 @opindex m4al
30755 Same as @option{-m4a-nofpu}, except that it implicitly passes
30756 @option{-dsp} to the assembler. GCC doesn't generate any DSP
30757 instructions at the moment.
30758
30759 @item -mb
30760 @opindex mb
30761 Compile code for the processor in big-endian mode.
30762
30763 @item -ml
30764 @opindex ml
30765 Compile code for the processor in little-endian mode.
30766
30767 @item -mdalign
30768 @opindex mdalign
30769 Align doubles at 64-bit boundaries. Note that this changes the calling
30770 conventions, and thus some functions from the standard C library do
30771 not work unless you recompile it first with @option{-mdalign}.
30772
30773 @item -mrelax
30774 @opindex mrelax
30775 Shorten some address references at link time, when possible; uses the
30776 linker option @option{-relax}.
30777
30778 @item -mbigtable
30779 @opindex mbigtable
30780 Use 32-bit offsets in @code{switch} tables. The default is to use
30781 16-bit offsets.
30782
30783 @item -mbitops
30784 @opindex mbitops
30785 Enable the use of bit manipulation instructions on SH2A.
30786
30787 @item -mfmovd
30788 @opindex mfmovd
30789 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
30790 alignment constraints.
30791
30792 @item -mrenesas
30793 @opindex mrenesas
30794 Comply with the calling conventions defined by Renesas.
30795
30796 @item -mno-renesas
30797 @opindex mno-renesas
30798 Comply with the calling conventions defined for GCC before the Renesas
30799 conventions were available. This option is the default for all
30800 targets of the SH toolchain.
30801
30802 @item -mnomacsave
30803 @opindex mnomacsave
30804 Mark the @code{MAC} register as call-clobbered, even if
30805 @option{-mrenesas} is given.
30806
30807 @item -mieee
30808 @itemx -mno-ieee
30809 @opindex mieee
30810 @opindex mno-ieee
30811 Control the IEEE compliance of floating-point comparisons, which affects the
30812 handling of cases where the result of a comparison is unordered. By default
30813 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
30814 enabled @option{-mno-ieee} is implicitly set, which results in faster
30815 floating-point greater-equal and less-equal comparisons. The implicit settings
30816 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
30817
30818 @item -minline-ic_invalidate
30819 @opindex minline-ic_invalidate
30820 Inline code to invalidate instruction cache entries after setting up
30821 nested function trampolines.
30822 This option has no effect if @option{-musermode} is in effect and the selected
30823 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
30824 instruction.
30825 If the selected code generation option does not allow the use of the @code{icbi}
30826 instruction, and @option{-musermode} is not in effect, the inlined code
30827 manipulates the instruction cache address array directly with an associative
30828 write. This not only requires privileged mode at run time, but it also
30829 fails if the cache line had been mapped via the TLB and has become unmapped.
30830
30831 @item -misize
30832 @opindex misize
30833 Dump instruction size and location in the assembly code.
30834
30835 @item -mpadstruct
30836 @opindex mpadstruct
30837 This option is deprecated. It pads structures to multiple of 4 bytes,
30838 which is incompatible with the SH ABI@.
30839
30840 @item -matomic-model=@var{model}
30841 @opindex matomic-model=@var{model}
30842 Sets the model of atomic operations and additional parameters as a comma
30843 separated list. For details on the atomic built-in functions see
30844 @ref{__atomic Builtins}. The following models and parameters are supported:
30845
30846 @table @samp
30847
30848 @item none
30849 Disable compiler generated atomic sequences and emit library calls for atomic
30850 operations. This is the default if the target is not @code{sh*-*-linux*}.
30851
30852 @item soft-gusa
30853 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
30854 built-in functions. The generated atomic sequences require additional support
30855 from the interrupt/exception handling code of the system and are only suitable
30856 for SH3* and SH4* single-core systems. This option is enabled by default when
30857 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
30858 this option also partially utilizes the hardware atomic instructions
30859 @code{movli.l} and @code{movco.l} to create more efficient code, unless
30860 @samp{strict} is specified.
30861
30862 @item soft-tcb
30863 Generate software atomic sequences that use a variable in the thread control
30864 block. This is a variation of the gUSA sequences which can also be used on
30865 SH1* and SH2* targets. The generated atomic sequences require additional
30866 support from the interrupt/exception handling code of the system and are only
30867 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
30868 parameter has to be specified as well.
30869
30870 @item soft-imask
30871 Generate software atomic sequences that temporarily disable interrupts by
30872 setting @code{SR.IMASK = 1111}. This model works only when the program runs
30873 in privileged mode and is only suitable for single-core systems. Additional
30874 support from the interrupt/exception handling code of the system is not
30875 required. This model is enabled by default when the target is
30876 @code{sh*-*-linux*} and SH1* or SH2*.
30877
30878 @item hard-llcs
30879 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
30880 instructions only. This is only available on SH4A and is suitable for
30881 multi-core systems. Since the hardware instructions support only 32 bit atomic
30882 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
30883 Code compiled with this option is also compatible with other software
30884 atomic model interrupt/exception handling systems if executed on an SH4A
30885 system. Additional support from the interrupt/exception handling code of the
30886 system is not required for this model.
30887
30888 @item gbr-offset=
30889 This parameter specifies the offset in bytes of the variable in the thread
30890 control block structure that should be used by the generated atomic sequences
30891 when the @samp{soft-tcb} model has been selected. For other models this
30892 parameter is ignored. The specified value must be an integer multiple of four
30893 and in the range 0-1020.
30894
30895 @item strict
30896 This parameter prevents mixed usage of multiple atomic models, even if they
30897 are compatible, and makes the compiler generate atomic sequences of the
30898 specified model only.
30899
30900 @end table
30901
30902 @item -mtas
30903 @opindex mtas
30904 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
30905 Notice that depending on the particular hardware and software configuration
30906 this can degrade overall performance due to the operand cache line flushes
30907 that are implied by the @code{tas.b} instruction. On multi-core SH4A
30908 processors the @code{tas.b} instruction must be used with caution since it
30909 can result in data corruption for certain cache configurations.
30910
30911 @item -mprefergot
30912 @opindex mprefergot
30913 When generating position-independent code, emit function calls using
30914 the Global Offset Table instead of the Procedure Linkage Table.
30915
30916 @item -musermode
30917 @itemx -mno-usermode
30918 @opindex musermode
30919 @opindex mno-usermode
30920 Don't allow (allow) the compiler generating privileged mode code. Specifying
30921 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
30922 inlined code would not work in user mode. @option{-musermode} is the default
30923 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
30924 @option{-musermode} has no effect, since there is no user mode.
30925
30926 @item -multcost=@var{number}
30927 @opindex multcost=@var{number}
30928 Set the cost to assume for a multiply insn.
30929
30930 @item -mdiv=@var{strategy}
30931 @opindex mdiv=@var{strategy}
30932 Set the division strategy to be used for integer division operations.
30933 @var{strategy} can be one of:
30934
30935 @table @samp
30936
30937 @item call-div1
30938 Calls a library function that uses the single-step division instruction
30939 @code{div1} to perform the operation. Division by zero calculates an
30940 unspecified result and does not trap. This is the default except for SH4,
30941 SH2A and SHcompact.
30942
30943 @item call-fp
30944 Calls a library function that performs the operation in double precision
30945 floating point. Division by zero causes a floating-point exception. This is
30946 the default for SHcompact with FPU. Specifying this for targets that do not
30947 have a double precision FPU defaults to @code{call-div1}.
30948
30949 @item call-table
30950 Calls a library function that uses a lookup table for small divisors and
30951 the @code{div1} instruction with case distinction for larger divisors. Division
30952 by zero calculates an unspecified result and does not trap. This is the default
30953 for SH4. Specifying this for targets that do not have dynamic shift
30954 instructions defaults to @code{call-div1}.
30955
30956 @end table
30957
30958 When a division strategy has not been specified the default strategy is
30959 selected based on the current target. For SH2A the default strategy is to
30960 use the @code{divs} and @code{divu} instructions instead of library function
30961 calls.
30962
30963 @item -maccumulate-outgoing-args
30964 @opindex maccumulate-outgoing-args
30965 Reserve space once for outgoing arguments in the function prologue rather
30966 than around each call. Generally beneficial for performance and size. Also
30967 needed for unwinding to avoid changing the stack frame around conditional code.
30968
30969 @item -mdivsi3_libfunc=@var{name}
30970 @opindex mdivsi3_libfunc=@var{name}
30971 Set the name of the library function used for 32-bit signed division to
30972 @var{name}.
30973 This only affects the name used in the @samp{call} division strategies, and
30974 the compiler still expects the same sets of input/output/clobbered registers as
30975 if this option were not present.
30976
30977 @item -mfixed-range=@var{register-range}
30978 @opindex mfixed-range
30979 Generate code treating the given register range as fixed registers.
30980 A fixed register is one that the register allocator cannot use. This is
30981 useful when compiling kernel code. A register range is specified as
30982 two registers separated by a dash. Multiple register ranges can be
30983 specified separated by a comma.
30984
30985 @item -mbranch-cost=@var{num}
30986 @opindex mbranch-cost=@var{num}
30987 Assume @var{num} to be the cost for a branch instruction. Higher numbers
30988 make the compiler try to generate more branch-free code if possible.
30989 If not specified the value is selected depending on the processor type that
30990 is being compiled for.
30991
30992 @item -mzdcbranch
30993 @itemx -mno-zdcbranch
30994 @opindex mzdcbranch
30995 @opindex mno-zdcbranch
30996 Assume (do not assume) that zero displacement conditional branch instructions
30997 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
30998 compiler prefers zero displacement branch code sequences. This is
30999 enabled by default when generating code for SH4 and SH4A. It can be explicitly
31000 disabled by specifying @option{-mno-zdcbranch}.
31001
31002 @item -mcbranch-force-delay-slot
31003 @opindex mcbranch-force-delay-slot
31004 Force the usage of delay slots for conditional branches, which stuffs the delay
31005 slot with a @code{nop} if a suitable instruction cannot be found. By default
31006 this option is disabled. It can be enabled to work around hardware bugs as
31007 found in the original SH7055.
31008
31009 @item -mfused-madd
31010 @itemx -mno-fused-madd
31011 @opindex mfused-madd
31012 @opindex mno-fused-madd
31013 Generate code that uses (does not use) the floating-point multiply and
31014 accumulate instructions. These instructions are generated by default
31015 if hardware floating point is used. The machine-dependent
31016 @option{-mfused-madd} option is now mapped to the machine-independent
31017 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31018 mapped to @option{-ffp-contract=off}.
31019
31020 @item -mfsca
31021 @itemx -mno-fsca
31022 @opindex mfsca
31023 @opindex mno-fsca
31024 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31025 and cosine approximations. The option @option{-mfsca} must be used in
31026 combination with @option{-funsafe-math-optimizations}. It is enabled by default
31027 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
31028 approximations even if @option{-funsafe-math-optimizations} is in effect.
31029
31030 @item -mfsrra
31031 @itemx -mno-fsrra
31032 @opindex mfsrra
31033 @opindex mno-fsrra
31034 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31035 reciprocal square root approximations. The option @option{-mfsrra} must be used
31036 in combination with @option{-funsafe-math-optimizations} and
31037 @option{-ffinite-math-only}. It is enabled by default when generating code for
31038 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
31039 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31040 in effect.
31041
31042 @item -mpretend-cmove
31043 @opindex mpretend-cmove
31044 Prefer zero-displacement conditional branches for conditional move instruction
31045 patterns. This can result in faster code on the SH4 processor.
31046
31047 @item -mfdpic
31048 @opindex fdpic
31049 Generate code using the FDPIC ABI.
31050
31051 @end table
31052
31053 @node Solaris 2 Options
31054 @subsection Solaris 2 Options
31055 @cindex Solaris 2 options
31056
31057 These @samp{-m} options are supported on Solaris 2:
31058
31059 @table @gcctabopt
31060 @item -mclear-hwcap
31061 @opindex mclear-hwcap
31062 @option{-mclear-hwcap} tells the compiler to remove the hardware
31063 capabilities generated by the Solaris assembler. This is only necessary
31064 when object files use ISA extensions not supported by the current
31065 machine, but check at runtime whether or not to use them.
31066
31067 @item -mimpure-text
31068 @opindex mimpure-text
31069 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31070 the compiler to not pass @option{-z text} to the linker when linking a
31071 shared object. Using this option, you can link position-dependent
31072 code into a shared object.
31073
31074 @option{-mimpure-text} suppresses the ``relocations remain against
31075 allocatable but non-writable sections'' linker error message.
31076 However, the necessary relocations trigger copy-on-write, and the
31077 shared object is not actually shared across processes. Instead of
31078 using @option{-mimpure-text}, you should compile all source code with
31079 @option{-fpic} or @option{-fPIC}.
31080
31081 @end table
31082
31083 These switches are supported in addition to the above on Solaris 2:
31084
31085 @table @gcctabopt
31086 @item -pthreads
31087 @opindex pthreads
31088 This is a synonym for @option{-pthread}.
31089 @end table
31090
31091 @node SPARC Options
31092 @subsection SPARC Options
31093 @cindex SPARC options
31094
31095 These @samp{-m} options are supported on the SPARC:
31096
31097 @table @gcctabopt
31098 @item -mno-app-regs
31099 @itemx -mapp-regs
31100 @opindex mno-app-regs
31101 @opindex mapp-regs
31102 Specify @option{-mapp-regs} to generate output using the global registers
31103 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
31104 global register 1, each global register 2 through 4 is then treated as an
31105 allocable register that is clobbered by function calls. This is the default.
31106
31107 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31108 specify @option{-mno-app-regs}. You should compile libraries and system
31109 software with this option.
31110
31111 @item -mflat
31112 @itemx -mno-flat
31113 @opindex mflat
31114 @opindex mno-flat
31115 With @option{-mflat}, the compiler does not generate save/restore instructions
31116 and uses a ``flat'' or single register window model. This model is compatible
31117 with the regular register window model. The local registers and the input
31118 registers (0--5) are still treated as ``call-saved'' registers and are
31119 saved on the stack as needed.
31120
31121 With @option{-mno-flat} (the default), the compiler generates save/restore
31122 instructions (except for leaf functions). This is the normal operating mode.
31123
31124 @item -mfpu
31125 @itemx -mhard-float
31126 @opindex mfpu
31127 @opindex mhard-float
31128 Generate output containing floating-point instructions. This is the
31129 default.
31130
31131 @item -mno-fpu
31132 @itemx -msoft-float
31133 @opindex mno-fpu
31134 @opindex msoft-float
31135 Generate output containing library calls for floating point.
31136 @strong{Warning:} the requisite libraries are not available for all SPARC
31137 targets. Normally the facilities of the machine's usual C compiler are
31138 used, but this cannot be done directly in cross-compilation. You must make
31139 your own arrangements to provide suitable library functions for
31140 cross-compilation. The embedded targets @samp{sparc-*-aout} and
31141 @samp{sparclite-*-*} do provide software floating-point support.
31142
31143 @option{-msoft-float} changes the calling convention in the output file;
31144 therefore, it is only useful if you compile @emph{all} of a program with
31145 this option. In particular, you need to compile @file{libgcc.a}, the
31146 library that comes with GCC, with @option{-msoft-float} in order for
31147 this to work.
31148
31149 @item -mhard-quad-float
31150 @opindex mhard-quad-float
31151 Generate output containing quad-word (long double) floating-point
31152 instructions.
31153
31154 @item -msoft-quad-float
31155 @opindex msoft-quad-float
31156 Generate output containing library calls for quad-word (long double)
31157 floating-point instructions. The functions called are those specified
31158 in the SPARC ABI@. This is the default.
31159
31160 As of this writing, there are no SPARC implementations that have hardware
31161 support for the quad-word floating-point instructions. They all invoke
31162 a trap handler for one of these instructions, and then the trap handler
31163 emulates the effect of the instruction. Because of the trap handler overhead,
31164 this is much slower than calling the ABI library routines. Thus the
31165 @option{-msoft-quad-float} option is the default.
31166
31167 @item -mno-unaligned-doubles
31168 @itemx -munaligned-doubles
31169 @opindex mno-unaligned-doubles
31170 @opindex munaligned-doubles
31171 Assume that doubles have 8-byte alignment. This is the default.
31172
31173 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31174 alignment only if they are contained in another type, or if they have an
31175 absolute address. Otherwise, it assumes they have 4-byte alignment.
31176 Specifying this option avoids some rare compatibility problems with code
31177 generated by other compilers. It is not the default because it results
31178 in a performance loss, especially for floating-point code.
31179
31180 @item -muser-mode
31181 @itemx -mno-user-mode
31182 @opindex muser-mode
31183 @opindex mno-user-mode
31184 Do not generate code that can only run in supervisor mode. This is relevant
31185 only for the @code{casa} instruction emitted for the LEON3 processor. This
31186 is the default.
31187
31188 @item -mfaster-structs
31189 @itemx -mno-faster-structs
31190 @opindex mfaster-structs
31191 @opindex mno-faster-structs
31192 With @option{-mfaster-structs}, the compiler assumes that structures
31193 should have 8-byte alignment. This enables the use of pairs of
31194 @code{ldd} and @code{std} instructions for copies in structure
31195 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31196 However, the use of this changed alignment directly violates the SPARC
31197 ABI@. Thus, it's intended only for use on targets where the developer
31198 acknowledges that their resulting code is not directly in line with
31199 the rules of the ABI@.
31200
31201 @item -mstd-struct-return
31202 @itemx -mno-std-struct-return
31203 @opindex mstd-struct-return
31204 @opindex mno-std-struct-return
31205 With @option{-mstd-struct-return}, the compiler generates checking code
31206 in functions returning structures or unions to detect size mismatches
31207 between the two sides of function calls, as per the 32-bit ABI@.
31208
31209 The default is @option{-mno-std-struct-return}. This option has no effect
31210 in 64-bit mode.
31211
31212 @item -mlra
31213 @itemx -mno-lra
31214 @opindex mlra
31215 @opindex mno-lra
31216 Enable Local Register Allocation. This is the default for SPARC since GCC 7
31217 so @option{-mno-lra} needs to be passed to get old Reload.
31218
31219 @item -mcpu=@var{cpu_type}
31220 @opindex mcpu
31221 Set the instruction set, register set, and instruction scheduling parameters
31222 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
31223 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31224 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31225 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31226 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31227 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31228 @samp{m8}.
31229
31230 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31231 which selects the best architecture option for the host processor.
31232 @option{-mcpu=native} has no effect if GCC does not recognize
31233 the processor.
31234
31235 Default instruction scheduling parameters are used for values that select
31236 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
31237 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31238
31239 Here is a list of each supported architecture and their supported
31240 implementations.
31241
31242 @table @asis
31243 @item v7
31244 cypress, leon3v7
31245
31246 @item v8
31247 supersparc, hypersparc, leon, leon3, leon5
31248
31249 @item sparclite
31250 f930, f934, sparclite86x
31251
31252 @item sparclet
31253 tsc701
31254
31255 @item v9
31256 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31257 niagara7, m8
31258 @end table
31259
31260 By default (unless configured otherwise), GCC generates code for the V7
31261 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
31262 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31263 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
31264 SPARCStation 1, 2, IPX etc.
31265
31266 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31267 architecture. The only difference from V7 code is that the compiler emits
31268 the integer multiply and integer divide instructions which exist in SPARC-V8
31269 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
31270 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31271 2000 series.
31272
31273 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31274 the SPARC architecture. This adds the integer multiply, integer divide step
31275 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31276 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31277 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
31278 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31279 MB86934 chip, which is the more recent SPARClite with FPU@.
31280
31281 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31282 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
31283 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31284 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
31285 optimizes it for the TEMIC SPARClet chip.
31286
31287 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31288 architecture. This adds 64-bit integer and floating-point move instructions,
31289 3 additional floating-point condition code registers and conditional move
31290 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
31291 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
31292 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31293 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
31294 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31295 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
31296 additionally optimizes it for Sun UltraSPARC T2 chips. With
31297 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31298 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
31299 additionally optimizes it for Sun UltraSPARC T4 chips. With
31300 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31301 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
31302 additionally optimizes it for Oracle M8 chips.
31303
31304 @item -mtune=@var{cpu_type}
31305 @opindex mtune
31306 Set the instruction scheduling parameters for machine type
31307 @var{cpu_type}, but do not set the instruction set or register set that the
31308 option @option{-mcpu=@var{cpu_type}} does.
31309
31310 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31311 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31312 that select a particular CPU implementation. Those are
31313 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31314 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31315 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31316 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31317 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
31318 and GNU/Linux toolchains, @samp{native} can also be used.
31319
31320 @item -mv8plus
31321 @itemx -mno-v8plus
31322 @opindex mv8plus
31323 @opindex mno-v8plus
31324 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
31325 difference from the V8 ABI is that the global and out registers are
31326 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
31327 mode for all SPARC-V9 processors.
31328
31329 @item -mvis
31330 @itemx -mno-vis
31331 @opindex mvis
31332 @opindex mno-vis
31333 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31334 Visual Instruction Set extensions. The default is @option{-mno-vis}.
31335
31336 @item -mvis2
31337 @itemx -mno-vis2
31338 @opindex mvis2
31339 @opindex mno-vis2
31340 With @option{-mvis2}, GCC generates code that takes advantage of
31341 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
31342 default is @option{-mvis2} when targeting a cpu that supports such
31343 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
31344 also sets @option{-mvis}.
31345
31346 @item -mvis3
31347 @itemx -mno-vis3
31348 @opindex mvis3
31349 @opindex mno-vis3
31350 With @option{-mvis3}, GCC generates code that takes advantage of
31351 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
31352 default is @option{-mvis3} when targeting a cpu that supports such
31353 instructions, such as niagara-3 and later. Setting @option{-mvis3}
31354 also sets @option{-mvis2} and @option{-mvis}.
31355
31356 @item -mvis4
31357 @itemx -mno-vis4
31358 @opindex mvis4
31359 @opindex mno-vis4
31360 With @option{-mvis4}, GCC generates code that takes advantage of
31361 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
31362 default is @option{-mvis4} when targeting a cpu that supports such
31363 instructions, such as niagara-7 and later. Setting @option{-mvis4}
31364 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
31365
31366 @item -mvis4b
31367 @itemx -mno-vis4b
31368 @opindex mvis4b
31369 @opindex mno-vis4b
31370 With @option{-mvis4b}, GCC generates code that takes advantage of
31371 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
31372 the additional VIS instructions introduced in the Oracle SPARC
31373 Architecture 2017. The default is @option{-mvis4b} when targeting a
31374 cpu that supports such instructions, such as m8 and later. Setting
31375 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
31376 @option{-mvis2} and @option{-mvis}.
31377
31378 @item -mcbcond
31379 @itemx -mno-cbcond
31380 @opindex mcbcond
31381 @opindex mno-cbcond
31382 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
31383 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
31384 when targeting a CPU that supports such instructions, such as Niagara-4 and
31385 later.
31386
31387 @item -mfmaf
31388 @itemx -mno-fmaf
31389 @opindex mfmaf
31390 @opindex mno-fmaf
31391 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
31392 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
31393 when targeting a CPU that supports such instructions, such as Niagara-3 and
31394 later.
31395
31396 @item -mfsmuld
31397 @itemx -mno-fsmuld
31398 @opindex mfsmuld
31399 @opindex mno-fsmuld
31400 With @option{-mfsmuld}, GCC generates code that takes advantage of the
31401 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
31402 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
31403 or V9 with FPU except @option{-mcpu=leon}.
31404
31405 @item -mpopc
31406 @itemx -mno-popc
31407 @opindex mpopc
31408 @opindex mno-popc
31409 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
31410 Population Count instruction. The default is @option{-mpopc}
31411 when targeting a CPU that supports such an instruction, such as Niagara-2 and
31412 later.
31413
31414 @item -msubxc
31415 @itemx -mno-subxc
31416 @opindex msubxc
31417 @opindex mno-subxc
31418 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
31419 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
31420 when targeting a CPU that supports such an instruction, such as Niagara-7 and
31421 later.
31422
31423 @item -mfix-at697f
31424 @opindex mfix-at697f
31425 Enable the documented workaround for the single erratum of the Atmel AT697F
31426 processor (which corresponds to erratum #13 of the AT697E processor).
31427
31428 @item -mfix-ut699
31429 @opindex mfix-ut699
31430 Enable the documented workarounds for the floating-point errata and the data
31431 cache nullify errata of the UT699 processor.
31432
31433 @item -mfix-ut700
31434 @opindex mfix-ut700
31435 Enable the documented workaround for the back-to-back store errata of
31436 the UT699E/UT700 processor.
31437
31438 @item -mfix-gr712rc
31439 @opindex mfix-gr712rc
31440 Enable the documented workaround for the back-to-back store errata of
31441 the GR712RC processor.
31442 @end table
31443
31444 These @samp{-m} options are supported in addition to the above
31445 on SPARC-V9 processors in 64-bit environments:
31446
31447 @table @gcctabopt
31448 @item -m32
31449 @itemx -m64
31450 @opindex m32
31451 @opindex m64
31452 Generate code for a 32-bit or 64-bit environment.
31453 The 32-bit environment sets int, long and pointer to 32 bits.
31454 The 64-bit environment sets int to 32 bits and long and pointer
31455 to 64 bits.
31456
31457 @item -mcmodel=@var{which}
31458 @opindex mcmodel
31459 Set the code model to one of
31460
31461 @table @samp
31462 @item medlow
31463 The Medium/Low code model: 64-bit addresses, programs
31464 must be linked in the low 32 bits of memory. Programs can be statically
31465 or dynamically linked.
31466
31467 @item medmid
31468 The Medium/Middle code model: 64-bit addresses, programs
31469 must be linked in the low 44 bits of memory, the text and data segments must
31470 be less than 2GB in size and the data segment must be located within 2GB of
31471 the text segment.
31472
31473 @item medany
31474 The Medium/Anywhere code model: 64-bit addresses, programs
31475 may be linked anywhere in memory, the text and data segments must be less
31476 than 2GB in size and the data segment must be located within 2GB of the
31477 text segment.
31478
31479 @item embmedany
31480 The Medium/Anywhere code model for embedded systems:
31481 64-bit addresses, the text and data segments must be less than 2GB in
31482 size, both starting anywhere in memory (determined at link time). The
31483 global register %g4 points to the base of the data segment. Programs
31484 are statically linked and PIC is not supported.
31485 @end table
31486
31487 @item -mmemory-model=@var{mem-model}
31488 @opindex mmemory-model
31489 Set the memory model in force on the processor to one of
31490
31491 @table @samp
31492 @item default
31493 The default memory model for the processor and operating system.
31494
31495 @item rmo
31496 Relaxed Memory Order
31497
31498 @item pso
31499 Partial Store Order
31500
31501 @item tso
31502 Total Store Order
31503
31504 @item sc
31505 Sequential Consistency
31506 @end table
31507
31508 These memory models are formally defined in Appendix D of the SPARC-V9
31509 architecture manual, as set in the processor's @code{PSTATE.MM} field.
31510
31511 @item -mstack-bias
31512 @itemx -mno-stack-bias
31513 @opindex mstack-bias
31514 @opindex mno-stack-bias
31515 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
31516 frame pointer if present, are offset by @minus{}2047 which must be added back
31517 when making stack frame references. This is the default in 64-bit mode.
31518 Otherwise, assume no such offset is present.
31519 @end table
31520
31521 @node System V Options
31522 @subsection Options for System V
31523
31524 These additional options are available on System V Release 4 for
31525 compatibility with other compilers on those systems:
31526
31527 @table @gcctabopt
31528 @item -G
31529 @opindex G
31530 Create a shared object.
31531 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
31532
31533 @item -Qy
31534 @opindex Qy
31535 Identify the versions of each tool used by the compiler, in a
31536 @code{.ident} assembler directive in the output.
31537
31538 @item -Qn
31539 @opindex Qn
31540 Refrain from adding @code{.ident} directives to the output file (this is
31541 the default).
31542
31543 @item -YP,@var{dirs}
31544 @opindex YP
31545 Search the directories @var{dirs}, and no others, for libraries
31546 specified with @option{-l}.
31547
31548 @item -Ym,@var{dir}
31549 @opindex Ym
31550 Look in the directory @var{dir} to find the M4 preprocessor.
31551 The assembler uses this option.
31552 @c This is supposed to go with a -Yd for predefined M4 macro files, but
31553 @c the generic assembler that comes with Solaris takes just -Ym.
31554 @end table
31555
31556 @node V850 Options
31557 @subsection V850 Options
31558 @cindex V850 Options
31559
31560 These @samp{-m} options are defined for V850 implementations:
31561
31562 @table @gcctabopt
31563 @item -mlong-calls
31564 @itemx -mno-long-calls
31565 @opindex mlong-calls
31566 @opindex mno-long-calls
31567 Treat all calls as being far away (near). If calls are assumed to be
31568 far away, the compiler always loads the function's address into a
31569 register, and calls indirect through the pointer.
31570
31571 @item -mno-ep
31572 @itemx -mep
31573 @opindex mno-ep
31574 @opindex mep
31575 Do not optimize (do optimize) basic blocks that use the same index
31576 pointer 4 or more times to copy pointer into the @code{ep} register, and
31577 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
31578 option is on by default if you optimize.
31579
31580 @item -mno-prolog-function
31581 @itemx -mprolog-function
31582 @opindex mno-prolog-function
31583 @opindex mprolog-function
31584 Do not use (do use) external functions to save and restore registers
31585 at the prologue and epilogue of a function. The external functions
31586 are slower, but use less code space if more than one function saves
31587 the same number of registers. The @option{-mprolog-function} option
31588 is on by default if you optimize.
31589
31590 @item -mspace
31591 @opindex mspace
31592 Try to make the code as small as possible. At present, this just turns
31593 on the @option{-mep} and @option{-mprolog-function} options.
31594
31595 @item -mtda=@var{n}
31596 @opindex mtda
31597 Put static or global variables whose size is @var{n} bytes or less into
31598 the tiny data area that register @code{ep} points to. The tiny data
31599 area can hold up to 256 bytes in total (128 bytes for byte references).
31600
31601 @item -msda=@var{n}
31602 @opindex msda
31603 Put static or global variables whose size is @var{n} bytes or less into
31604 the small data area that register @code{gp} points to. The small data
31605 area can hold up to 64 kilobytes.
31606
31607 @item -mzda=@var{n}
31608 @opindex mzda
31609 Put static or global variables whose size is @var{n} bytes or less into
31610 the first 32 kilobytes of memory.
31611
31612 @item -mv850
31613 @opindex mv850
31614 Specify that the target processor is the V850.
31615
31616 @item -mv850e3v5
31617 @opindex mv850e3v5
31618 Specify that the target processor is the V850E3V5. The preprocessor
31619 constant @code{__v850e3v5__} is defined if this option is used.
31620
31621 @item -mv850e2v4
31622 @opindex mv850e2v4
31623 Specify that the target processor is the V850E3V5. This is an alias for
31624 the @option{-mv850e3v5} option.
31625
31626 @item -mv850e2v3
31627 @opindex mv850e2v3
31628 Specify that the target processor is the V850E2V3. The preprocessor
31629 constant @code{__v850e2v3__} is defined if this option is used.
31630
31631 @item -mv850e2
31632 @opindex mv850e2
31633 Specify that the target processor is the V850E2. The preprocessor
31634 constant @code{__v850e2__} is defined if this option is used.
31635
31636 @item -mv850e1
31637 @opindex mv850e1
31638 Specify that the target processor is the V850E1. The preprocessor
31639 constants @code{__v850e1__} and @code{__v850e__} are defined if
31640 this option is used.
31641
31642 @item -mv850es
31643 @opindex mv850es
31644 Specify that the target processor is the V850ES. This is an alias for
31645 the @option{-mv850e1} option.
31646
31647 @item -mv850e
31648 @opindex mv850e
31649 Specify that the target processor is the V850E@. The preprocessor
31650 constant @code{__v850e__} is defined if this option is used.
31651
31652 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
31653 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
31654 are defined then a default target processor is chosen and the
31655 relevant @samp{__v850*__} preprocessor constant is defined.
31656
31657 The preprocessor constants @code{__v850} and @code{__v851__} are always
31658 defined, regardless of which processor variant is the target.
31659
31660 @item -mdisable-callt
31661 @itemx -mno-disable-callt
31662 @opindex mdisable-callt
31663 @opindex mno-disable-callt
31664 This option suppresses generation of the @code{CALLT} instruction for the
31665 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
31666 architecture.
31667
31668 This option is enabled by default when the RH850 ABI is
31669 in use (see @option{-mrh850-abi}), and disabled by default when the
31670 GCC ABI is in use. If @code{CALLT} instructions are being generated
31671 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
31672
31673 @item -mrelax
31674 @itemx -mno-relax
31675 @opindex mrelax
31676 @opindex mno-relax
31677 Pass on (or do not pass on) the @option{-mrelax} command-line option
31678 to the assembler.
31679
31680 @item -mlong-jumps
31681 @itemx -mno-long-jumps
31682 @opindex mlong-jumps
31683 @opindex mno-long-jumps
31684 Disable (or re-enable) the generation of PC-relative jump instructions.
31685
31686 @item -msoft-float
31687 @itemx -mhard-float
31688 @opindex msoft-float
31689 @opindex mhard-float
31690 Disable (or re-enable) the generation of hardware floating point
31691 instructions. This option is only significant when the target
31692 architecture is @samp{V850E2V3} or higher. If hardware floating point
31693 instructions are being generated then the C preprocessor symbol
31694 @code{__FPU_OK__} is defined, otherwise the symbol
31695 @code{__NO_FPU__} is defined.
31696
31697 @item -mloop
31698 @opindex mloop
31699 Enables the use of the e3v5 LOOP instruction. The use of this
31700 instruction is not enabled by default when the e3v5 architecture is
31701 selected because its use is still experimental.
31702
31703 @item -mrh850-abi
31704 @itemx -mghs
31705 @opindex mrh850-abi
31706 @opindex mghs
31707 Enables support for the RH850 version of the V850 ABI. This is the
31708 default. With this version of the ABI the following rules apply:
31709
31710 @itemize
31711 @item
31712 Integer sized structures and unions are returned via a memory pointer
31713 rather than a register.
31714
31715 @item
31716 Large structures and unions (more than 8 bytes in size) are passed by
31717 value.
31718
31719 @item
31720 Functions are aligned to 16-bit boundaries.
31721
31722 @item
31723 The @option{-m8byte-align} command-line option is supported.
31724
31725 @item
31726 The @option{-mdisable-callt} command-line option is enabled by
31727 default. The @option{-mno-disable-callt} command-line option is not
31728 supported.
31729 @end itemize
31730
31731 When this version of the ABI is enabled the C preprocessor symbol
31732 @code{__V850_RH850_ABI__} is defined.
31733
31734 @item -mgcc-abi
31735 @opindex mgcc-abi
31736 Enables support for the old GCC version of the V850 ABI. With this
31737 version of the ABI the following rules apply:
31738
31739 @itemize
31740 @item
31741 Integer sized structures and unions are returned in register @code{r10}.
31742
31743 @item
31744 Large structures and unions (more than 8 bytes in size) are passed by
31745 reference.
31746
31747 @item
31748 Functions are aligned to 32-bit boundaries, unless optimizing for
31749 size.
31750
31751 @item
31752 The @option{-m8byte-align} command-line option is not supported.
31753
31754 @item
31755 The @option{-mdisable-callt} command-line option is supported but not
31756 enabled by default.
31757 @end itemize
31758
31759 When this version of the ABI is enabled the C preprocessor symbol
31760 @code{__V850_GCC_ABI__} is defined.
31761
31762 @item -m8byte-align
31763 @itemx -mno-8byte-align
31764 @opindex m8byte-align
31765 @opindex mno-8byte-align
31766 Enables support for @code{double} and @code{long long} types to be
31767 aligned on 8-byte boundaries. The default is to restrict the
31768 alignment of all objects to at most 4-bytes. When
31769 @option{-m8byte-align} is in effect the C preprocessor symbol
31770 @code{__V850_8BYTE_ALIGN__} is defined.
31771
31772 @item -mbig-switch
31773 @opindex mbig-switch
31774 Generate code suitable for big switch tables. Use this option only if
31775 the assembler/linker complain about out of range branches within a switch
31776 table.
31777
31778 @item -mapp-regs
31779 @opindex mapp-regs
31780 This option causes r2 and r5 to be used in the code generated by
31781 the compiler. This setting is the default.
31782
31783 @item -mno-app-regs
31784 @opindex mno-app-regs
31785 This option causes r2 and r5 to be treated as fixed registers.
31786
31787 @end table
31788
31789 @node VAX Options
31790 @subsection VAX Options
31791 @cindex VAX options
31792
31793 These @samp{-m} options are defined for the VAX:
31794
31795 @table @gcctabopt
31796 @item -munix
31797 @opindex munix
31798 Do not output certain jump instructions (@code{aobleq} and so on)
31799 that the Unix assembler for the VAX cannot handle across long
31800 ranges.
31801
31802 @item -mgnu
31803 @opindex mgnu
31804 Do output those jump instructions, on the assumption that the
31805 GNU assembler is being used.
31806
31807 @item -mg
31808 @opindex mg
31809 Output code for G-format floating-point numbers instead of D-format.
31810
31811 @item -mlra
31812 @itemx -mno-lra
31813 @opindex mlra
31814 @opindex mno-lra
31815 Enable Local Register Allocation. This is still experimental for the VAX,
31816 so by default the compiler uses standard reload.
31817 @end table
31818
31819 @node Visium Options
31820 @subsection Visium Options
31821 @cindex Visium options
31822
31823 @table @gcctabopt
31824
31825 @item -mdebug
31826 @opindex mdebug
31827 A program which performs file I/O and is destined to run on an MCM target
31828 should be linked with this option. It causes the libraries libc.a and
31829 libdebug.a to be linked. The program should be run on the target under
31830 the control of the GDB remote debugging stub.
31831
31832 @item -msim
31833 @opindex msim
31834 A program which performs file I/O and is destined to run on the simulator
31835 should be linked with option. This causes libraries libc.a and libsim.a to
31836 be linked.
31837
31838 @item -mfpu
31839 @itemx -mhard-float
31840 @opindex mfpu
31841 @opindex mhard-float
31842 Generate code containing floating-point instructions. This is the
31843 default.
31844
31845 @item -mno-fpu
31846 @itemx -msoft-float
31847 @opindex mno-fpu
31848 @opindex msoft-float
31849 Generate code containing library calls for floating-point.
31850
31851 @option{-msoft-float} changes the calling convention in the output file;
31852 therefore, it is only useful if you compile @emph{all} of a program with
31853 this option. In particular, you need to compile @file{libgcc.a}, the
31854 library that comes with GCC, with @option{-msoft-float} in order for
31855 this to work.
31856
31857 @item -mcpu=@var{cpu_type}
31858 @opindex mcpu
31859 Set the instruction set, register set, and instruction scheduling parameters
31860 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
31861 @samp{mcm}, @samp{gr5} and @samp{gr6}.
31862
31863 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
31864
31865 By default (unless configured otherwise), GCC generates code for the GR5
31866 variant of the Visium architecture.
31867
31868 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
31869 architecture. The only difference from GR5 code is that the compiler will
31870 generate block move instructions.
31871
31872 @item -mtune=@var{cpu_type}
31873 @opindex mtune
31874 Set the instruction scheduling parameters for machine type @var{cpu_type},
31875 but do not set the instruction set or register set that the option
31876 @option{-mcpu=@var{cpu_type}} would.
31877
31878 @item -msv-mode
31879 @opindex msv-mode
31880 Generate code for the supervisor mode, where there are no restrictions on
31881 the access to general registers. This is the default.
31882
31883 @item -muser-mode
31884 @opindex muser-mode
31885 Generate code for the user mode, where the access to some general registers
31886 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
31887 mode; on the GR6, only registers r29 to r31 are affected.
31888 @end table
31889
31890 @node VMS Options
31891 @subsection VMS Options
31892
31893 These @samp{-m} options are defined for the VMS implementations:
31894
31895 @table @gcctabopt
31896 @item -mvms-return-codes
31897 @opindex mvms-return-codes
31898 Return VMS condition codes from @code{main}. The default is to return POSIX-style
31899 condition (e.g.@: error) codes.
31900
31901 @item -mdebug-main=@var{prefix}
31902 @opindex mdebug-main=@var{prefix}
31903 Flag the first routine whose name starts with @var{prefix} as the main
31904 routine for the debugger.
31905
31906 @item -mmalloc64
31907 @opindex mmalloc64
31908 Default to 64-bit memory allocation routines.
31909
31910 @item -mpointer-size=@var{size}
31911 @opindex mpointer-size=@var{size}
31912 Set the default size of pointers. Possible options for @var{size} are
31913 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
31914 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
31915 The later option disables @code{pragma pointer_size}.
31916 @end table
31917
31918 @node VxWorks Options
31919 @subsection VxWorks Options
31920 @cindex VxWorks Options
31921
31922 The options in this section are defined for all VxWorks targets.
31923 Options specific to the target hardware are listed with the other
31924 options for that target.
31925
31926 @table @gcctabopt
31927 @item -mrtp
31928 @opindex mrtp
31929 GCC can generate code for both VxWorks kernels and real time processes
31930 (RTPs). This option switches from the former to the latter. It also
31931 defines the preprocessor macro @code{__RTP__}.
31932
31933 @item -non-static
31934 @opindex non-static
31935 Link an RTP executable against shared libraries rather than static
31936 libraries. The options @option{-static} and @option{-shared} can
31937 also be used for RTPs (@pxref{Link Options}); @option{-static}
31938 is the default.
31939
31940 @item -Bstatic
31941 @itemx -Bdynamic
31942 @opindex Bstatic
31943 @opindex Bdynamic
31944 These options are passed down to the linker. They are defined for
31945 compatibility with Diab.
31946
31947 @item -Xbind-lazy
31948 @opindex Xbind-lazy
31949 Enable lazy binding of function calls. This option is equivalent to
31950 @option{-Wl,-z,now} and is defined for compatibility with Diab.
31951
31952 @item -Xbind-now
31953 @opindex Xbind-now
31954 Disable lazy binding of function calls. This option is the default and
31955 is defined for compatibility with Diab.
31956 @end table
31957
31958 @node x86 Options
31959 @subsection x86 Options
31960 @cindex x86 Options
31961
31962 These @samp{-m} options are defined for the x86 family of computers.
31963
31964 @table @gcctabopt
31965
31966 @item -march=@var{cpu-type}
31967 @opindex march
31968 Generate instructions for the machine type @var{cpu-type}. In contrast to
31969 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
31970 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
31971 to generate code that may not run at all on processors other than the one
31972 indicated. Specifying @option{-march=@var{cpu-type}} implies
31973 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
31974
31975 The choices for @var{cpu-type} are:
31976
31977 @table @samp
31978 @item native
31979 This selects the CPU to generate code for at compilation time by determining
31980 the processor type of the compiling machine. Using @option{-march=native}
31981 enables all instruction subsets supported by the local machine (hence
31982 the result might not run on different machines). Using @option{-mtune=native}
31983 produces code optimized for the local machine under the constraints
31984 of the selected instruction set.
31985
31986 @item x86-64
31987 A generic CPU with 64-bit extensions.
31988
31989 @item x86-64-v2
31990 @itemx x86-64-v3
31991 @itemx x86-64-v4
31992 These choices for @var{cpu-type} select the corresponding
31993 micro-architecture level from the x86-64 psABI. On ABIs other than
31994 the x86-64 psABI they select the same CPU features as the x86-64 psABI
31995 documents for the particular micro-architecture level.
31996
31997 Since these @var{cpu-type} values do not have a corresponding
31998 @option{-mtune} setting, using @option{-march} with these values enables
31999 generic tuning. Specific tuning can be enabled using the
32000 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32001 @var{other-cpu-type} value.
32002
32003 @item i386
32004 Original Intel i386 CPU@.
32005
32006 @item i486
32007 Intel i486 CPU@. (No scheduling is implemented for this chip.)
32008
32009 @item i586
32010 @itemx pentium
32011 Intel Pentium CPU with no MMX support.
32012
32013 @item lakemont
32014 Intel Lakemont MCU, based on Intel Pentium CPU.
32015
32016 @item pentium-mmx
32017 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32018
32019 @item pentiumpro
32020 Intel Pentium Pro CPU@.
32021
32022 @item i686
32023 When used with @option{-march}, the Pentium Pro
32024 instruction set is used, so the code runs on all i686 family chips.
32025 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32026
32027 @item pentium2
32028 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32029 set support.
32030
32031 @item pentium3
32032 @itemx pentium3m
32033 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32034 instruction set support.
32035
32036 @item pentium-m
32037 Intel Pentium M; low-power version of Intel Pentium III CPU
32038 with MMX, SSE, SSE2 and FXSR instruction set support. Used by Centrino
32039 notebooks.
32040
32041 @item pentium4
32042 @itemx pentium4m
32043 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32044
32045 @item prescott
32046 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32047 instruction set support.
32048
32049 @item nocona
32050 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32051 SSE2, SSE3 and FXSR instruction set support.
32052
32053 @item core2
32054 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32055 SAHF and FXSR instruction set support.
32056
32057 @item nehalem
32058 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32059 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32060
32061 @item westmere
32062 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32063 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32064
32065 @item sandybridge
32066 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32067 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32068 support.
32069
32070 @item ivybridge
32071 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32072 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32073 and F16C instruction set support.
32074
32075 @item haswell
32076 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32077 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32078 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32079
32080 @item broadwell
32081 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32082 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32083 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32084 instruction set support.
32085
32086 @item skylake
32087 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32088 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32089 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32090 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32091
32092 @item bonnell
32093 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32094 instruction set support.
32095
32096 @item silvermont
32097 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32098 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32099 instruction set support.
32100
32101 @item goldmont
32102 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32103 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32104 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32105 set support.
32106
32107 @item goldmont-plus
32108 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32109 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32110 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32111 RDPID and SGX instruction set support.
32112
32113 @item tremont
32114 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32115 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32116 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32117 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32118 support.
32119
32120 @item sierraforest
32121 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32122 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32123 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32124 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32125 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32126 AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
32127
32128 @item grandridge
32129 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32130 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32131 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32132 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32133 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32134 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD and RAOINT instruction set
32135 support.
32136
32137 @item knl
32138 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32139 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32140 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32141 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32142
32143 @item knm
32144 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32145 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32146 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32147 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32148 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32149
32150 @item skylake-avx512
32151 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32152 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32153 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32154 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32155 AVX512DQ and AVX512CD instruction set support.
32156
32157 @item cannonlake
32158 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32159 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32160 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32161 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32162 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32163 support.
32164
32165 @item icelake-client
32166 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32167 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32168 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32169 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32170 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32171 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32172
32173 @item icelake-server
32174 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32175 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32176 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32177 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32178 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32179 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32180 instruction set support.
32181
32182 @item cascadelake
32183 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32184 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32185 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32186 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32187 AVX512CD and AVX512VNNI instruction set support.
32188
32189 @item cooperlake
32190 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32191 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32192 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32193 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32194 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32195
32196 @item tigerlake
32197 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32198 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32199 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32200 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32201 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32202 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32203 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32204
32205 @item sapphirerapids
32206 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32207 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32208 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32209 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32210 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32211 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32212 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32213 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16
32214 instruction set support.
32215
32216 @item alderlake
32217 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32218 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32219 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32220 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32221 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32222 support.
32223
32224 @item rocketlake
32225 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32226 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32227 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32228 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32229 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32230 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32231
32232 @item graniterapids
32233 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32234 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32235 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32236 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32237 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32238 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32239 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
32240 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16,
32241 AVX512BF16, AMX-FP16 and PREFETCHI instruction set support.
32242
32243 @item k6
32244 AMD K6 CPU with MMX instruction set support.
32245
32246 @item k6-2
32247 @itemx k6-3
32248 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32249
32250 @item athlon
32251 @itemx athlon-tbird
32252 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32253 support.
32254
32255 @item athlon-4
32256 @itemx athlon-xp
32257 @itemx athlon-mp
32258 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32259 instruction set support.
32260
32261 @item k8
32262 @itemx opteron
32263 @itemx athlon64
32264 @itemx athlon-fx
32265 Processors based on the AMD K8 core with x86-64 instruction set support,
32266 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32267 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32268 instruction set extensions.)
32269
32270 @item k8-sse3
32271 @itemx opteron-sse3
32272 @itemx athlon64-sse3
32273 Improved versions of AMD K8 cores with SSE3 instruction set support.
32274
32275 @item amdfam10
32276 @itemx barcelona
32277 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
32278 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32279 instruction set extensions.)
32280
32281 @item bdver1
32282 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
32283 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32284 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32285
32286 @item bdver2
32287 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32288 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32289 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
32290 extensions.)
32291
32292 @item bdver3
32293 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32294 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
32295 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32296 64-bit instruction set extensions.)
32297
32298 @item bdver4
32299 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32300 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
32301 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32302 SSE4.2, ABM and 64-bit instruction set extensions.)
32303
32304 @item znver1
32305 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32306 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32307 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32308 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32309 instruction set extensions.)
32310
32311 @item znver2
32312 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32313 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32314 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32315 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32316 WBNOINVD, and 64-bit instruction set extensions.)
32317
32318 @item znver3
32319 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32320 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32321 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32322 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32323 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
32324
32325 @item znver4
32326 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32327 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32328 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32329 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32330 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
32331 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
32332 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
32333
32334 @item btver1
32335 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
32336 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
32337 instruction set extensions.)
32338
32339 @item btver2
32340 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
32341 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
32342 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
32343
32344 @item winchip-c6
32345 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
32346 set support.
32347
32348 @item winchip2
32349 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
32350 instruction set support.
32351
32352 @item c3
32353 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
32354 (No scheduling is implemented for this chip.)
32355
32356 @item c3-2
32357 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
32358 (No scheduling is implemented for this chip.)
32359
32360 @item c7
32361 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32362 (No scheduling is implemented for this chip.)
32363
32364 @item samuel-2
32365 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
32366 (No scheduling is implemented for this chip.)
32367
32368 @item nehemiah
32369 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
32370 (No scheduling is implemented for this chip.)
32371
32372 @item esther
32373 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32374 (No scheduling is implemented for this chip.)
32375
32376 @item eden-x2
32377 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
32378 (No scheduling is implemented for this chip.)
32379
32380 @item eden-x4
32381 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
32382 AVX and AVX2 instruction set support.
32383 (No scheduling is implemented for this chip.)
32384
32385 @item nano
32386 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32387 instruction set support.
32388 (No scheduling is implemented for this chip.)
32389
32390 @item nano-1000
32391 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32392 instruction set support.
32393 (No scheduling is implemented for this chip.)
32394
32395 @item nano-2000
32396 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32397 instruction set support.
32398 (No scheduling is implemented for this chip.)
32399
32400 @item nano-3000
32401 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32402 instruction set support.
32403 (No scheduling is implemented for this chip.)
32404
32405 @item nano-x2
32406 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32407 instruction set support.
32408 (No scheduling is implemented for this chip.)
32409
32410 @item nano-x4
32411 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32412 instruction set support.
32413 (No scheduling is implemented for this chip.)
32414
32415 @item lujiazui
32416 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
32417 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
32418 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
32419
32420 @item geode
32421 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
32422 @end table
32423
32424 @item -mtune=@var{cpu-type}
32425 @opindex mtune
32426 Tune to @var{cpu-type} everything applicable about the generated code, except
32427 for the ABI and the set of available instructions.
32428 While picking a specific @var{cpu-type} schedules things appropriately
32429 for that particular chip, the compiler does not generate any code that
32430 cannot run on the default machine type unless you use a
32431 @option{-march=@var{cpu-type}} option.
32432 For example, if GCC is configured for i686-pc-linux-gnu
32433 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
32434 but still runs on i686 machines.
32435
32436 The choices for @var{cpu-type} are the same as for @option{-march}.
32437 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
32438
32439 @table @samp
32440 @item generic
32441 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
32442 If you know the CPU on which your code will run, then you should use
32443 the corresponding @option{-mtune} or @option{-march} option instead of
32444 @option{-mtune=generic}. But, if you do not know exactly what CPU users
32445 of your application will have, then you should use this option.
32446
32447 As new processors are deployed in the marketplace, the behavior of this
32448 option will change. Therefore, if you upgrade to a newer version of
32449 GCC, code generation controlled by this option will change to reflect
32450 the processors
32451 that are most common at the time that version of GCC is released.
32452
32453 There is no @option{-march=generic} option because @option{-march}
32454 indicates the instruction set the compiler can use, and there is no
32455 generic instruction set applicable to all processors. In contrast,
32456 @option{-mtune} indicates the processor (or, in this case, collection of
32457 processors) for which the code is optimized.
32458
32459 @item intel
32460 Produce code optimized for the most current Intel processors, which are
32461 Haswell and Silvermont for this version of GCC. If you know the CPU
32462 on which your code will run, then you should use the corresponding
32463 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
32464 But, if you want your application performs better on both Haswell and
32465 Silvermont, then you should use this option.
32466
32467 As new Intel processors are deployed in the marketplace, the behavior of
32468 this option will change. Therefore, if you upgrade to a newer version of
32469 GCC, code generation controlled by this option will change to reflect
32470 the most current Intel processors at the time that version of GCC is
32471 released.
32472
32473 There is no @option{-march=intel} option because @option{-march} indicates
32474 the instruction set the compiler can use, and there is no common
32475 instruction set applicable to all processors. In contrast,
32476 @option{-mtune} indicates the processor (or, in this case, collection of
32477 processors) for which the code is optimized.
32478 @end table
32479
32480 @item -mcpu=@var{cpu-type}
32481 @opindex mcpu
32482 A deprecated synonym for @option{-mtune}.
32483
32484 @item -mfpmath=@var{unit}
32485 @opindex mfpmath
32486 Generate floating-point arithmetic for selected unit @var{unit}. The choices
32487 for @var{unit} are:
32488
32489 @table @samp
32490 @item 387
32491 Use the standard 387 floating-point coprocessor present on the majority of chips and
32492 emulated otherwise. Code compiled with this option runs almost everywhere.
32493 The temporary results are computed in 80-bit precision instead of the precision
32494 specified by the type, resulting in slightly different results compared to most
32495 of other chips. See @option{-ffloat-store} for more detailed description.
32496
32497 This is the default choice for non-Darwin x86-32 targets.
32498
32499 @item sse
32500 Use scalar floating-point instructions present in the SSE instruction set.
32501 This instruction set is supported by Pentium III and newer chips,
32502 and in the AMD line
32503 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
32504 instruction set supports only single-precision arithmetic, thus the double and
32505 extended-precision arithmetic are still done using 387. A later version, present
32506 only in Pentium 4 and AMD x86-64 chips, supports double-precision
32507 arithmetic too.
32508
32509 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
32510 or @option{-msse2} switches to enable SSE extensions and make this option
32511 effective. For the x86-64 compiler, these extensions are enabled by default.
32512
32513 The resulting code should be considerably faster in the majority of cases and avoid
32514 the numerical instability problems of 387 code, but may break some existing
32515 code that expects temporaries to be 80 bits.
32516
32517 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
32518 and the default choice for x86-32 targets with the SSE2 instruction set
32519 when @option{-ffast-math} is enabled.
32520
32521 @item sse,387
32522 @itemx sse+387
32523 @itemx both
32524 Attempt to utilize both instruction sets at once. This effectively doubles the
32525 amount of available registers, and on chips with separate execution units for
32526 387 and SSE the execution resources too. Use this option with care, as it is
32527 still experimental, because the GCC register allocator does not model separate
32528 functional units well, resulting in unstable performance.
32529 @end table
32530
32531 @item -masm=@var{dialect}
32532 @opindex masm=@var{dialect}
32533 Output assembly instructions using selected @var{dialect}. Also affects
32534 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
32535 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
32536 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
32537 not support @samp{intel}.
32538
32539 @item -mieee-fp
32540 @itemx -mno-ieee-fp
32541 @opindex mieee-fp
32542 @opindex mno-ieee-fp
32543 Control whether or not the compiler uses IEEE floating-point
32544 comparisons. These correctly handle the case where the result of a
32545 comparison is unordered.
32546
32547 @item -m80387
32548 @itemx -mhard-float
32549 @opindex m80387
32550 @opindex mhard-float
32551 Generate output containing 80387 instructions for floating point.
32552
32553 @item -mno-80387
32554 @itemx -msoft-float
32555 @opindex no-80387
32556 @opindex msoft-float
32557 Generate output containing library calls for floating point.
32558
32559 @strong{Warning:} the requisite libraries are not part of GCC@.
32560 Normally the facilities of the machine's usual C compiler are used, but
32561 this cannot be done directly in cross-compilation. You must make your
32562 own arrangements to provide suitable library functions for
32563 cross-compilation.
32564
32565 On machines where a function returns floating-point results in the 80387
32566 register stack, some floating-point opcodes may be emitted even if
32567 @option{-msoft-float} is used.
32568
32569 @item -mno-fp-ret-in-387
32570 @opindex mno-fp-ret-in-387
32571 @opindex mfp-ret-in-387
32572 Do not use the FPU registers for return values of functions.
32573
32574 The usual calling convention has functions return values of types
32575 @code{float} and @code{double} in an FPU register, even if there
32576 is no FPU@. The idea is that the operating system should emulate
32577 an FPU@.
32578
32579 The option @option{-mno-fp-ret-in-387} causes such values to be returned
32580 in ordinary CPU registers instead.
32581
32582 @item -mno-fancy-math-387
32583 @opindex mno-fancy-math-387
32584 @opindex mfancy-math-387
32585 Some 387 emulators do not support the @code{sin}, @code{cos} and
32586 @code{sqrt} instructions for the 387. Specify this option to avoid
32587 generating those instructions.
32588 This option is overridden when @option{-march}
32589 indicates that the target CPU always has an FPU and so the
32590 instruction does not need emulation. These
32591 instructions are not generated unless you also use the
32592 @option{-funsafe-math-optimizations} switch.
32593
32594 @item -malign-double
32595 @itemx -mno-align-double
32596 @opindex malign-double
32597 @opindex mno-align-double
32598 Control whether GCC aligns @code{double}, @code{long double}, and
32599 @code{long long} variables on a two-word boundary or a one-word
32600 boundary. Aligning @code{double} variables on a two-word boundary
32601 produces code that runs somewhat faster on a Pentium at the
32602 expense of more memory.
32603
32604 On x86-64, @option{-malign-double} is enabled by default.
32605
32606 @strong{Warning:} if you use the @option{-malign-double} switch,
32607 structures containing the above types are aligned differently than
32608 the published application binary interface specifications for the x86-32
32609 and are not binary compatible with structures in code compiled
32610 without that switch.
32611
32612 @item -m96bit-long-double
32613 @itemx -m128bit-long-double
32614 @opindex m96bit-long-double
32615 @opindex m128bit-long-double
32616 These switches control the size of @code{long double} type. The x86-32
32617 application binary interface specifies the size to be 96 bits,
32618 so @option{-m96bit-long-double} is the default in 32-bit mode.
32619
32620 Modern architectures (Pentium and newer) prefer @code{long double}
32621 to be aligned to an 8- or 16-byte boundary. In arrays or structures
32622 conforming to the ABI, this is not possible. So specifying
32623 @option{-m128bit-long-double} aligns @code{long double}
32624 to a 16-byte boundary by padding the @code{long double} with an additional
32625 32-bit zero.
32626
32627 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
32628 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
32629
32630 Notice that neither of these options enable any extra precision over the x87
32631 standard of 80 bits for a @code{long double}.
32632
32633 @strong{Warning:} if you override the default value for your target ABI, this
32634 changes the size of
32635 structures and arrays containing @code{long double} variables,
32636 as well as modifying the function calling convention for functions taking
32637 @code{long double}. Hence they are not binary-compatible
32638 with code compiled without that switch.
32639
32640 @item -mlong-double-64
32641 @itemx -mlong-double-80
32642 @itemx -mlong-double-128
32643 @opindex mlong-double-64
32644 @opindex mlong-double-80
32645 @opindex mlong-double-128
32646 These switches control the size of @code{long double} type. A size
32647 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32648 type. This is the default for 32-bit Bionic C library. A size
32649 of 128 bits makes the @code{long double} type equivalent to the
32650 @code{__float128} type. This is the default for 64-bit Bionic C library.
32651
32652 @strong{Warning:} if you override the default value for your target ABI, this
32653 changes the size of
32654 structures and arrays containing @code{long double} variables,
32655 as well as modifying the function calling convention for functions taking
32656 @code{long double}. Hence they are not binary-compatible
32657 with code compiled without that switch.
32658
32659 @item -malign-data=@var{type}
32660 @opindex malign-data
32661 Control how GCC aligns variables. Supported values for @var{type} are
32662 @samp{compat} uses increased alignment value compatible uses GCC 4.8
32663 and earlier, @samp{abi} uses alignment value as specified by the
32664 psABI, and @samp{cacheline} uses increased alignment value to match
32665 the cache line size. @samp{compat} is the default.
32666
32667 @item -mlarge-data-threshold=@var{threshold}
32668 @opindex mlarge-data-threshold
32669 When @option{-mcmodel=medium} is specified, data objects larger than
32670 @var{threshold} are placed in the large data section. This value must be the
32671 same across all objects linked into the binary, and defaults to 65535.
32672
32673 @item -mrtd
32674 @opindex mrtd
32675 Use a different function-calling convention, in which functions that
32676 take a fixed number of arguments return with the @code{ret @var{num}}
32677 instruction, which pops their arguments while returning. This saves one
32678 instruction in the caller since there is no need to pop the arguments
32679 there.
32680
32681 You can specify that an individual function is called with this calling
32682 sequence with the function attribute @code{stdcall}. You can also
32683 override the @option{-mrtd} option by using the function attribute
32684 @code{cdecl}. @xref{Function Attributes}.
32685
32686 @strong{Warning:} this calling convention is incompatible with the one
32687 normally used on Unix, so you cannot use it if you need to call
32688 libraries compiled with the Unix compiler.
32689
32690 Also, you must provide function prototypes for all functions that
32691 take variable numbers of arguments (including @code{printf});
32692 otherwise incorrect code is generated for calls to those
32693 functions.
32694
32695 In addition, seriously incorrect code results if you call a
32696 function with too many arguments. (Normally, extra arguments are
32697 harmlessly ignored.)
32698
32699 @item -mregparm=@var{num}
32700 @opindex mregparm
32701 Control how many registers are used to pass integer arguments. By
32702 default, no registers are used to pass arguments, and at most 3
32703 registers can be used. You can control this behavior for a specific
32704 function by using the function attribute @code{regparm}.
32705 @xref{Function Attributes}.
32706
32707 @strong{Warning:} if you use this switch, and
32708 @var{num} is nonzero, then you must build all modules with the same
32709 value, including any libraries. This includes the system libraries and
32710 startup modules.
32711
32712 @item -msseregparm
32713 @opindex msseregparm
32714 Use SSE register passing conventions for float and double arguments
32715 and return values. You can control this behavior for a specific
32716 function by using the function attribute @code{sseregparm}.
32717 @xref{Function Attributes}.
32718
32719 @strong{Warning:} if you use this switch then you must build all
32720 modules with the same value, including any libraries. This includes
32721 the system libraries and startup modules.
32722
32723 @item -mvect8-ret-in-mem
32724 @opindex mvect8-ret-in-mem
32725 Return 8-byte vectors in memory instead of MMX registers. This is the
32726 default on VxWorks to match the ABI of the Sun Studio compilers until
32727 version 12. @emph{Only} use this option if you need to remain
32728 compatible with existing code produced by those previous compiler
32729 versions or older versions of GCC@.
32730
32731 @item -mpc32
32732 @itemx -mpc64
32733 @itemx -mpc80
32734 @opindex mpc32
32735 @opindex mpc64
32736 @opindex mpc80
32737
32738 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
32739 is specified, the significands of results of floating-point operations are
32740 rounded to 24 bits (single precision); @option{-mpc64} rounds the
32741 significands of results of floating-point operations to 53 bits (double
32742 precision) and @option{-mpc80} rounds the significands of results of
32743 floating-point operations to 64 bits (extended double precision), which is
32744 the default. When this option is used, floating-point operations in higher
32745 precisions are not available to the programmer without setting the FPU
32746 control word explicitly.
32747
32748 Setting the rounding of floating-point operations to less than the default
32749 80 bits can speed some programs by 2% or more. Note that some mathematical
32750 libraries assume that extended-precision (80-bit) floating-point operations
32751 are enabled by default; routines in such libraries could suffer significant
32752 loss of accuracy, typically through so-called ``catastrophic cancellation'',
32753 when this option is used to set the precision to less than extended precision.
32754
32755 @item -mstackrealign
32756 @opindex mstackrealign
32757 Realign the stack at entry. On the x86, the @option{-mstackrealign}
32758 option generates an alternate prologue and epilogue that realigns the
32759 run-time stack if necessary. This supports mixing legacy codes that keep
32760 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
32761 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
32762 applicable to individual functions.
32763
32764 @item -mpreferred-stack-boundary=@var{num}
32765 @opindex mpreferred-stack-boundary
32766 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
32767 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
32768 the default is 4 (16 bytes or 128 bits).
32769
32770 @strong{Warning:} When generating code for the x86-64 architecture with
32771 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
32772 used to keep the stack boundary aligned to 8 byte boundary. Since
32773 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
32774 intended to be used in controlled environment where stack space is
32775 important limitation. This option leads to wrong code when functions
32776 compiled with 16 byte stack alignment (such as functions from a standard
32777 library) are called with misaligned stack. In this case, SSE
32778 instructions may lead to misaligned memory access traps. In addition,
32779 variable arguments are handled incorrectly for 16 byte aligned
32780 objects (including x87 long double and __int128), leading to wrong
32781 results. You must build all modules with
32782 @option{-mpreferred-stack-boundary=3}, including any libraries. This
32783 includes the system libraries and startup modules.
32784
32785 @item -mincoming-stack-boundary=@var{num}
32786 @opindex mincoming-stack-boundary
32787 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
32788 boundary. If @option{-mincoming-stack-boundary} is not specified,
32789 the one specified by @option{-mpreferred-stack-boundary} is used.
32790
32791 On Pentium and Pentium Pro, @code{double} and @code{long double} values
32792 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
32793 suffer significant run time performance penalties. On Pentium III, the
32794 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
32795 properly if it is not 16-byte aligned.
32796
32797 To ensure proper alignment of this values on the stack, the stack boundary
32798 must be as aligned as that required by any value stored on the stack.
32799 Further, every function must be generated such that it keeps the stack
32800 aligned. Thus calling a function compiled with a higher preferred
32801 stack boundary from a function compiled with a lower preferred stack
32802 boundary most likely misaligns the stack. It is recommended that
32803 libraries that use callbacks always use the default setting.
32804
32805 This extra alignment does consume extra stack space, and generally
32806 increases code size. Code that is sensitive to stack space usage, such
32807 as embedded systems and operating system kernels, may want to reduce the
32808 preferred alignment to @option{-mpreferred-stack-boundary=2}.
32809
32810 @need 200
32811 @item -mmmx
32812 @opindex mmmx
32813 @need 200
32814 @itemx -msse
32815 @opindex msse
32816 @need 200
32817 @itemx -msse2
32818 @opindex msse2
32819 @need 200
32820 @itemx -msse3
32821 @opindex msse3
32822 @need 200
32823 @itemx -mssse3
32824 @opindex mssse3
32825 @need 200
32826 @itemx -msse4
32827 @opindex msse4
32828 @need 200
32829 @itemx -msse4a
32830 @opindex msse4a
32831 @need 200
32832 @itemx -msse4.1
32833 @opindex msse4.1
32834 @need 200
32835 @itemx -msse4.2
32836 @opindex msse4.2
32837 @need 200
32838 @itemx -mavx
32839 @opindex mavx
32840 @need 200
32841 @itemx -mavx2
32842 @opindex mavx2
32843 @need 200
32844 @itemx -mavx512f
32845 @opindex mavx512f
32846 @need 200
32847 @itemx -mavx512pf
32848 @opindex mavx512pf
32849 @need 200
32850 @itemx -mavx512er
32851 @opindex mavx512er
32852 @need 200
32853 @itemx -mavx512cd
32854 @opindex mavx512cd
32855 @need 200
32856 @itemx -mavx512vl
32857 @opindex mavx512vl
32858 @need 200
32859 @itemx -mavx512bw
32860 @opindex mavx512bw
32861 @need 200
32862 @itemx -mavx512dq
32863 @opindex mavx512dq
32864 @need 200
32865 @itemx -mavx512ifma
32866 @opindex mavx512ifma
32867 @need 200
32868 @itemx -mavx512vbmi
32869 @opindex mavx512vbmi
32870 @need 200
32871 @itemx -msha
32872 @opindex msha
32873 @need 200
32874 @itemx -maes
32875 @opindex maes
32876 @need 200
32877 @itemx -mpclmul
32878 @opindex mpclmul
32879 @need 200
32880 @itemx -mclflushopt
32881 @opindex mclflushopt
32882 @need 200
32883 @itemx -mclwb
32884 @opindex mclwb
32885 @need 200
32886 @itemx -mfsgsbase
32887 @opindex mfsgsbase
32888 @need 200
32889 @itemx -mptwrite
32890 @opindex mptwrite
32891 @need 200
32892 @itemx -mrdrnd
32893 @opindex mrdrnd
32894 @need 200
32895 @itemx -mf16c
32896 @opindex mf16c
32897 @need 200
32898 @itemx -mfma
32899 @opindex mfma
32900 @need 200
32901 @itemx -mpconfig
32902 @opindex mpconfig
32903 @need 200
32904 @itemx -mwbnoinvd
32905 @opindex mwbnoinvd
32906 @need 200
32907 @itemx -mfma4
32908 @opindex mfma4
32909 @need 200
32910 @itemx -mprfchw
32911 @opindex mprfchw
32912 @need 200
32913 @itemx -mrdpid
32914 @opindex mrdpid
32915 @need 200
32916 @itemx -mprefetchwt1
32917 @opindex mprefetchwt1
32918 @need 200
32919 @itemx -mrdseed
32920 @opindex mrdseed
32921 @need 200
32922 @itemx -msgx
32923 @opindex msgx
32924 @need 200
32925 @itemx -mxop
32926 @opindex mxop
32927 @need 200
32928 @itemx -mlwp
32929 @opindex mlwp
32930 @need 200
32931 @itemx -m3dnow
32932 @opindex m3dnow
32933 @need 200
32934 @itemx -m3dnowa
32935 @opindex m3dnowa
32936 @need 200
32937 @itemx -mpopcnt
32938 @opindex mpopcnt
32939 @need 200
32940 @itemx -mabm
32941 @opindex mabm
32942 @need 200
32943 @itemx -madx
32944 @opindex madx
32945 @need 200
32946 @itemx -mbmi
32947 @opindex mbmi
32948 @need 200
32949 @itemx -mbmi2
32950 @opindex mbmi2
32951 @need 200
32952 @itemx -mlzcnt
32953 @opindex mlzcnt
32954 @need 200
32955 @itemx -mfxsr
32956 @opindex mfxsr
32957 @need 200
32958 @itemx -mxsave
32959 @opindex mxsave
32960 @need 200
32961 @itemx -mxsaveopt
32962 @opindex mxsaveopt
32963 @need 200
32964 @itemx -mxsavec
32965 @opindex mxsavec
32966 @need 200
32967 @itemx -mxsaves
32968 @opindex mxsaves
32969 @need 200
32970 @itemx -mrtm
32971 @opindex mrtm
32972 @need 200
32973 @itemx -mhle
32974 @opindex mhle
32975 @need 200
32976 @itemx -mtbm
32977 @opindex mtbm
32978 @need 200
32979 @itemx -mmwaitx
32980 @opindex mmwaitx
32981 @need 200
32982 @itemx -mclzero
32983 @opindex mclzero
32984 @need 200
32985 @itemx -mpku
32986 @opindex mpku
32987 @need 200
32988 @itemx -mavx512vbmi2
32989 @opindex mavx512vbmi2
32990 @need 200
32991 @itemx -mavx512bf16
32992 @opindex mavx512bf16
32993 @need 200
32994 @itemx -mavx512fp16
32995 @opindex mavx512fp16
32996 @need 200
32997 @itemx -mgfni
32998 @opindex mgfni
32999 @need 200
33000 @itemx -mvaes
33001 @opindex mvaes
33002 @need 200
33003 @itemx -mwaitpkg
33004 @opindex mwaitpkg
33005 @need 200
33006 @itemx -mvpclmulqdq
33007 @opindex mvpclmulqdq
33008 @need 200
33009 @itemx -mavx512bitalg
33010 @opindex mavx512bitalg
33011 @need 200
33012 @itemx -mmovdiri
33013 @opindex mmovdiri
33014 @need 200
33015 @itemx -mmovdir64b
33016 @opindex mmovdir64b
33017 @need 200
33018 @itemx -menqcmd
33019 @opindex menqcmd
33020 @itemx -muintr
33021 @opindex muintr
33022 @need 200
33023 @itemx -mtsxldtrk
33024 @opindex mtsxldtrk
33025 @need 200
33026 @itemx -mavx512vpopcntdq
33027 @opindex mavx512vpopcntdq
33028 @need 200
33029 @itemx -mavx512vp2intersect
33030 @opindex mavx512vp2intersect
33031 @need 200
33032 @itemx -mavx5124fmaps
33033 @opindex mavx5124fmaps
33034 @need 200
33035 @itemx -mavx512vnni
33036 @opindex mavx512vnni
33037 @need 200
33038 @itemx -mavxvnni
33039 @opindex mavxvnni
33040 @need 200
33041 @itemx -mavx5124vnniw
33042 @opindex mavx5124vnniw
33043 @need 200
33044 @itemx -mcldemote
33045 @opindex mcldemote
33046 @need 200
33047 @itemx -mserialize
33048 @opindex mserialize
33049 @need 200
33050 @itemx -mamx-tile
33051 @opindex mamx-tile
33052 @need 200
33053 @itemx -mamx-int8
33054 @opindex mamx-int8
33055 @need 200
33056 @itemx -mamx-bf16
33057 @opindex mamx-bf16
33058 @need 200
33059 @itemx -mhreset
33060 @opindex mhreset
33061 @itemx -mkl
33062 @opindex mkl
33063 @need 200
33064 @itemx -mwidekl
33065 @opindex mwidekl
33066 @need 200
33067 @itemx -mavxifma
33068 @opindex mavxifma
33069 @need 200
33070 @itemx -mavxvnniint8
33071 @opindex mavxvnniint8
33072 @need 200
33073 @itemx -mavxneconvert
33074 @opindex mavxneconvert
33075 @need 200
33076 @itemx -mcmpccxadd
33077 @opindex mcmpccxadd
33078 @need 200
33079 @itemx -mamx-fp16
33080 @opindex mamx-fp16
33081 @need 200
33082 @itemx -mprefetchi
33083 @opindex mprefetchi
33084 @need 200
33085 @itemx -mraoint
33086 @opindex mraoint
33087 These switches enable the use of instructions in the MMX, SSE,
33088 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
33089 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
33090 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
33091 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
33092 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
33093 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
33094 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
33095 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
33096 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16,
33097 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT or
33098 CLDEMOTE extended instruction sets. Each has a corresponding @option{-mno-}
33099 option to disable use of these instructions.
33100
33101 These extensions are also available as built-in functions: see
33102 @ref{x86 Built-in Functions}, for details of the functions enabled and
33103 disabled by these switches.
33104
33105 To generate SSE/SSE2 instructions automatically from floating-point
33106 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
33107
33108 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
33109 generates new AVX instructions or AVX equivalence for all SSEx instructions
33110 when needed.
33111
33112 These options enable GCC to use these extended instructions in
33113 generated code, even without @option{-mfpmath=sse}. Applications that
33114 perform run-time CPU detection must compile separate files for each
33115 supported architecture, using the appropriate flags. In particular,
33116 the file containing the CPU detection code should be compiled without
33117 these options.
33118
33119 @item -mdump-tune-features
33120 @opindex mdump-tune-features
33121 This option instructs GCC to dump the names of the x86 performance
33122 tuning features and default settings. The names can be used in
33123 @option{-mtune-ctrl=@var{feature-list}}.
33124
33125 @item -mtune-ctrl=@var{feature-list}
33126 @opindex mtune-ctrl=@var{feature-list}
33127 This option is used to do fine grain control of x86 code generation features.
33128 @var{feature-list} is a comma separated list of @var{feature} names. See also
33129 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33130 on if it is not preceded with @samp{^}, otherwise, it is turned off.
33131 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33132 developers. Using it may lead to code paths not covered by testing and can
33133 potentially result in compiler ICEs or runtime errors.
33134
33135 @item -mno-default
33136 @opindex mno-default
33137 This option instructs GCC to turn off all tunable features. See also
33138 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33139
33140 @item -mcld
33141 @opindex mcld
33142 This option instructs GCC to emit a @code{cld} instruction in the prologue
33143 of functions that use string instructions. String instructions depend on
33144 the DF flag to select between autoincrement or autodecrement mode. While the
33145 ABI specifies the DF flag to be cleared on function entry, some operating
33146 systems violate this specification by not clearing the DF flag in their
33147 exception dispatchers. The exception handler can be invoked with the DF flag
33148 set, which leads to wrong direction mode when string instructions are used.
33149 This option can be enabled by default on 32-bit x86 targets by configuring
33150 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
33151 instructions can be suppressed with the @option{-mno-cld} compiler option
33152 in this case.
33153
33154 @item -mvzeroupper
33155 @opindex mvzeroupper
33156 This option instructs GCC to emit a @code{vzeroupper} instruction
33157 before a transfer of control flow out of the function to minimize
33158 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33159 intrinsics.
33160
33161 @item -mprefer-avx128
33162 @opindex mprefer-avx128
33163 This option instructs GCC to use 128-bit AVX instructions instead of
33164 256-bit AVX instructions in the auto-vectorizer.
33165
33166 @item -mprefer-vector-width=@var{opt}
33167 @opindex mprefer-vector-width
33168 This option instructs GCC to use @var{opt}-bit vector width in instructions
33169 instead of default on the selected platform.
33170
33171 @item -mmove-max=@var{bits}
33172 @opindex mmove-max
33173 This option instructs GCC to set the maximum number of bits can be
33174 moved from memory to memory efficiently to @var{bits}. The valid
33175 @var{bits} are 128, 256 and 512.
33176
33177 @item -mstore-max=@var{bits}
33178 @opindex mstore-max
33179 This option instructs GCC to set the maximum number of bits can be
33180 stored to memory efficiently to @var{bits}. The valid @var{bits} are
33181 128, 256 and 512.
33182
33183 @table @samp
33184 @item none
33185 No extra limitations applied to GCC other than defined by the selected platform.
33186
33187 @item 128
33188 Prefer 128-bit vector width for instructions.
33189
33190 @item 256
33191 Prefer 256-bit vector width for instructions.
33192
33193 @item 512
33194 Prefer 512-bit vector width for instructions.
33195 @end table
33196
33197 @item -mcx16
33198 @opindex mcx16
33199 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33200 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33201 objects. This is useful for atomic updates of data structures exceeding one
33202 machine word in size. The compiler uses this instruction to implement
33203 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
33204 128-bit integers, a library call is always used.
33205
33206 @item -msahf
33207 @opindex msahf
33208 This option enables generation of @code{SAHF} instructions in 64-bit code.
33209 Early Intel Pentium 4 CPUs with Intel 64 support,
33210 prior to the introduction of Pentium 4 G1 step in December 2005,
33211 lacked the @code{LAHF} and @code{SAHF} instructions
33212 which are supported by AMD64.
33213 These are load and store instructions, respectively, for certain status flags.
33214 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33215 @code{drem}, and @code{remainder} built-in functions;
33216 see @ref{Other Builtins} for details.
33217
33218 @item -mmovbe
33219 @opindex mmovbe
33220 This option enables use of the @code{movbe} instruction to implement
33221 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33222
33223 @item -mshstk
33224 @opindex mshstk
33225 The @option{-mshstk} option enables shadow stack built-in functions
33226 from x86 Control-flow Enforcement Technology (CET).
33227
33228 @item -mcrc32
33229 @opindex mcrc32
33230 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33231 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33232 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33233
33234 @item -mmwait
33235 @opindex mmwait
33236 This option enables built-in functions @code{__builtin_ia32_monitor},
33237 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33238 @code{mwait} machine instructions.
33239
33240 @item -mrecip
33241 @opindex mrecip
33242 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33243 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33244 with an additional Newton-Raphson step
33245 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33246 (and their vectorized
33247 variants) for single-precision floating-point arguments. These instructions
33248 are generated only when @option{-funsafe-math-optimizations} is enabled
33249 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33250 Note that while the throughput of the sequence is higher than the throughput
33251 of the non-reciprocal instruction, the precision of the sequence can be
33252 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33253
33254 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33255 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33256 combination), and doesn't need @option{-mrecip}.
33257
33258 Also note that GCC emits the above sequence with additional Newton-Raphson step
33259 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33260 already with @option{-ffast-math} (or the above option combination), and
33261 doesn't need @option{-mrecip}.
33262
33263 @item -mrecip=@var{opt}
33264 @opindex mrecip=opt
33265 This option controls which reciprocal estimate instructions
33266 may be used. @var{opt} is a comma-separated list of options, which may
33267 be preceded by a @samp{!} to invert the option:
33268
33269 @table @samp
33270 @item all
33271 Enable all estimate instructions.
33272
33273 @item default
33274 Enable the default instructions, equivalent to @option{-mrecip}.
33275
33276 @item none
33277 Disable all estimate instructions, equivalent to @option{-mno-recip}.
33278
33279 @item div
33280 Enable the approximation for scalar division.
33281
33282 @item vec-div
33283 Enable the approximation for vectorized division.
33284
33285 @item sqrt
33286 Enable the approximation for scalar square root.
33287
33288 @item vec-sqrt
33289 Enable the approximation for vectorized square root.
33290 @end table
33291
33292 So, for example, @option{-mrecip=all,!sqrt} enables
33293 all of the reciprocal approximations, except for square root.
33294
33295 @item -mveclibabi=@var{type}
33296 @opindex mveclibabi
33297 Specifies the ABI type to use for vectorizing intrinsics using an
33298 external library. Supported values for @var{type} are @samp{svml}
33299 for the Intel short
33300 vector math library and @samp{acml} for the AMD math core library.
33301 To use this option, both @option{-ftree-vectorize} and
33302 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
33303 ABI-compatible library must be specified at link time.
33304
33305 GCC currently emits calls to @code{vmldExp2},
33306 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
33307 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
33308 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
33309 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
33310 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
33311 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
33312 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
33313 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
33314 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
33315 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
33316 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
33317 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
33318 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
33319 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
33320 when @option{-mveclibabi=acml} is used.
33321
33322 @item -mabi=@var{name}
33323 @opindex mabi
33324 Generate code for the specified calling convention. Permissible values
33325 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
33326 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
33327 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
33328 You can control this behavior for specific functions by
33329 using the function attributes @code{ms_abi} and @code{sysv_abi}.
33330 @xref{Function Attributes}.
33331
33332 @item -mforce-indirect-call
33333 @opindex mforce-indirect-call
33334 Force all calls to functions to be indirect. This is useful
33335 when using Intel Processor Trace where it generates more precise timing
33336 information for function calls.
33337
33338 @item -mmanual-endbr
33339 @opindex mmanual-endbr
33340 Insert ENDBR instruction at function entry only via the @code{cf_check}
33341 function attribute. This is useful when used with the option
33342 @option{-fcf-protection=branch} to control ENDBR insertion at the
33343 function entry.
33344
33345 @item -mcet-switch
33346 @opindex mcet-switch
33347 By default, CET instrumentation is turned off on switch statements that
33348 use a jump table and indirect branch track is disabled. Since jump
33349 tables are stored in read-only memory, this does not result in a direct
33350 loss of hardening. But if the jump table index is attacker-controlled,
33351 the indirect jump may not be constrained by CET. This option turns on
33352 CET instrumentation to enable indirect branch track for switch statements
33353 with jump tables which leads to the jump targets reachable via any indirect
33354 jumps.
33355
33356 @item -mcall-ms2sysv-xlogues
33357 @opindex mcall-ms2sysv-xlogues
33358 @opindex mno-call-ms2sysv-xlogues
33359 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
33360 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
33361 default, the code for saving and restoring these registers is emitted inline,
33362 resulting in fairly lengthy prologues and epilogues. Using
33363 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
33364 use stubs in the static portion of libgcc to perform these saves and restores,
33365 thus reducing function size at the cost of a few extra instructions.
33366
33367 @item -mtls-dialect=@var{type}
33368 @opindex mtls-dialect
33369 Generate code to access thread-local storage using the @samp{gnu} or
33370 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
33371 @samp{gnu2} is more efficient, but it may add compile- and run-time
33372 requirements that cannot be satisfied on all systems.
33373
33374 @item -mpush-args
33375 @itemx -mno-push-args
33376 @opindex mpush-args
33377 @opindex mno-push-args
33378 Use PUSH operations to store outgoing parameters. This method is shorter
33379 and usually equally fast as method using SUB/MOV operations and is enabled
33380 by default. In some cases disabling it may improve performance because of
33381 improved scheduling and reduced dependencies.
33382
33383 @item -maccumulate-outgoing-args
33384 @opindex maccumulate-outgoing-args
33385 If enabled, the maximum amount of space required for outgoing arguments is
33386 computed in the function prologue. This is faster on most modern CPUs
33387 because of reduced dependencies, improved scheduling and reduced stack usage
33388 when the preferred stack boundary is not equal to 2. The drawback is a notable
33389 increase in code size. This switch implies @option{-mno-push-args}.
33390
33391 @item -mthreads
33392 @opindex mthreads
33393 Support thread-safe exception handling on MinGW. Programs that rely
33394 on thread-safe exception handling must compile and link all code with the
33395 @option{-mthreads} option. When compiling, @option{-mthreads} defines
33396 @option{-D_MT}; when linking, it links in a special thread helper library
33397 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
33398
33399 @item -mms-bitfields
33400 @itemx -mno-ms-bitfields
33401 @opindex mms-bitfields
33402 @opindex mno-ms-bitfields
33403
33404 Enable/disable bit-field layout compatible with the native Microsoft
33405 Windows compiler.
33406
33407 If @code{packed} is used on a structure, or if bit-fields are used,
33408 it may be that the Microsoft ABI lays out the structure differently
33409 than the way GCC normally does. Particularly when moving packed
33410 data between functions compiled with GCC and the native Microsoft compiler
33411 (either via function call or as data in a file), it may be necessary to access
33412 either format.
33413
33414 This option is enabled by default for Microsoft Windows
33415 targets. This behavior can also be controlled locally by use of variable
33416 or type attributes. For more information, see @ref{x86 Variable Attributes}
33417 and @ref{x86 Type Attributes}.
33418
33419 The Microsoft structure layout algorithm is fairly simple with the exception
33420 of the bit-field packing.
33421 The padding and alignment of members of structures and whether a bit-field
33422 can straddle a storage-unit boundary are determine by these rules:
33423
33424 @enumerate
33425 @item Structure members are stored sequentially in the order in which they are
33426 declared: the first member has the lowest memory address and the last member
33427 the highest.
33428
33429 @item Every data object has an alignment requirement. The alignment requirement
33430 for all data except structures, unions, and arrays is either the size of the
33431 object or the current packing size (specified with either the
33432 @code{aligned} attribute or the @code{pack} pragma),
33433 whichever is less. For structures, unions, and arrays,
33434 the alignment requirement is the largest alignment requirement of its members.
33435 Every object is allocated an offset so that:
33436
33437 @smallexample
33438 offset % alignment_requirement == 0
33439 @end smallexample
33440
33441 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
33442 unit if the integral types are the same size and if the next bit-field fits
33443 into the current allocation unit without crossing the boundary imposed by the
33444 common alignment requirements of the bit-fields.
33445 @end enumerate
33446
33447 MSVC interprets zero-length bit-fields in the following ways:
33448
33449 @enumerate
33450 @item If a zero-length bit-field is inserted between two bit-fields that
33451 are normally coalesced, the bit-fields are not coalesced.
33452
33453 For example:
33454
33455 @smallexample
33456 struct
33457 @{
33458 unsigned long bf_1 : 12;
33459 unsigned long : 0;
33460 unsigned long bf_2 : 12;
33461 @} t1;
33462 @end smallexample
33463
33464 @noindent
33465 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
33466 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
33467
33468 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
33469 alignment of the zero-length bit-field is greater than the member that follows it,
33470 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
33471
33472 For example:
33473
33474 @smallexample
33475 struct
33476 @{
33477 char foo : 4;
33478 short : 0;
33479 char bar;
33480 @} t2;
33481
33482 struct
33483 @{
33484 char foo : 4;
33485 short : 0;
33486 double bar;
33487 @} t3;
33488 @end smallexample
33489
33490 @noindent
33491 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
33492 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
33493 bit-field does not affect the alignment of @code{bar} or, as a result, the size
33494 of the structure.
33495
33496 Taking this into account, it is important to note the following:
33497
33498 @enumerate
33499 @item If a zero-length bit-field follows a normal bit-field, the type of the
33500 zero-length bit-field may affect the alignment of the structure as whole. For
33501 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
33502 normal bit-field, and is of type short.
33503
33504 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
33505 still affect the alignment of the structure:
33506
33507 @smallexample
33508 struct
33509 @{
33510 char foo : 6;
33511 long : 0;
33512 @} t4;
33513 @end smallexample
33514
33515 @noindent
33516 Here, @code{t4} takes up 4 bytes.
33517 @end enumerate
33518
33519 @item Zero-length bit-fields following non-bit-field members are ignored:
33520
33521 @smallexample
33522 struct
33523 @{
33524 char foo;
33525 long : 0;
33526 char bar;
33527 @} t5;
33528 @end smallexample
33529
33530 @noindent
33531 Here, @code{t5} takes up 2 bytes.
33532 @end enumerate
33533
33534
33535 @item -mno-align-stringops
33536 @opindex mno-align-stringops
33537 @opindex malign-stringops
33538 Do not align the destination of inlined string operations. This switch reduces
33539 code size and improves performance in case the destination is already aligned,
33540 but GCC doesn't know about it.
33541
33542 @item -minline-all-stringops
33543 @opindex minline-all-stringops
33544 By default GCC inlines string operations only when the destination is
33545 known to be aligned to least a 4-byte boundary.
33546 This enables more inlining and increases code
33547 size, but may improve performance of code that depends on fast
33548 @code{memcpy} and @code{memset} for short lengths.
33549 The option enables inline expansion of @code{strlen} for all
33550 pointer alignments.
33551
33552 @item -minline-stringops-dynamically
33553 @opindex minline-stringops-dynamically
33554 For string operations of unknown size, use run-time checks with
33555 inline code for small blocks and a library call for large blocks.
33556
33557 @item -mstringop-strategy=@var{alg}
33558 @opindex mstringop-strategy=@var{alg}
33559 Override the internal decision heuristic for the particular algorithm to use
33560 for inlining string operations. The allowed values for @var{alg} are:
33561
33562 @table @samp
33563 @item rep_byte
33564 @itemx rep_4byte
33565 @itemx rep_8byte
33566 Expand using i386 @code{rep} prefix of the specified size.
33567
33568 @item byte_loop
33569 @itemx loop
33570 @itemx unrolled_loop
33571 Expand into an inline loop.
33572
33573 @item libcall
33574 Always use a library call.
33575 @end table
33576
33577 @item -mmemcpy-strategy=@var{strategy}
33578 @opindex mmemcpy-strategy=@var{strategy}
33579 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
33580 should be inlined and what inline algorithm to use when the expected size
33581 of the copy operation is known. @var{strategy}
33582 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
33583 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
33584 the max byte size with which inline algorithm @var{alg} is allowed. For the last
33585 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
33586 in the list must be specified in increasing order. The minimal byte size for
33587 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
33588 preceding range.
33589
33590 @item -mmemset-strategy=@var{strategy}
33591 @opindex mmemset-strategy=@var{strategy}
33592 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
33593 @code{__builtin_memset} expansion.
33594
33595 @item -momit-leaf-frame-pointer
33596 @opindex momit-leaf-frame-pointer
33597 Don't keep the frame pointer in a register for leaf functions. This
33598 avoids the instructions to save, set up, and restore frame pointers and
33599 makes an extra register available in leaf functions. The option
33600 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
33601 which might make debugging harder.
33602
33603 @item -mtls-direct-seg-refs
33604 @itemx -mno-tls-direct-seg-refs
33605 @opindex mtls-direct-seg-refs
33606 Controls whether TLS variables may be accessed with offsets from the
33607 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
33608 or whether the thread base pointer must be added. Whether or not this
33609 is valid depends on the operating system, and whether it maps the
33610 segment to cover the entire TLS area.
33611
33612 For systems that use the GNU C Library, the default is on.
33613
33614 @item -msse2avx
33615 @itemx -mno-sse2avx
33616 @opindex msse2avx
33617 Specify that the assembler should encode SSE instructions with VEX
33618 prefix. The option @option{-mavx} turns this on by default.
33619
33620 @item -mfentry
33621 @itemx -mno-fentry
33622 @opindex mfentry
33623 If profiling is active (@option{-pg}), put the profiling
33624 counter call before the prologue.
33625 Note: On x86 architectures the attribute @code{ms_hook_prologue}
33626 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
33627
33628 @item -mrecord-mcount
33629 @itemx -mno-record-mcount
33630 @opindex mrecord-mcount
33631 If profiling is active (@option{-pg}), generate a __mcount_loc section
33632 that contains pointers to each profiling call. This is useful for
33633 automatically patching and out calls.
33634
33635 @item -mnop-mcount
33636 @itemx -mno-nop-mcount
33637 @opindex mnop-mcount
33638 If profiling is active (@option{-pg}), generate the calls to
33639 the profiling functions as NOPs. This is useful when they
33640 should be patched in later dynamically. This is likely only
33641 useful together with @option{-mrecord-mcount}.
33642
33643 @item -minstrument-return=@var{type}
33644 @opindex minstrument-return
33645 Instrument function exit in -pg -mfentry instrumented functions with
33646 call to specified function. This only instruments true returns ending
33647 with ret, but not sibling calls ending with jump. Valid types
33648 are @var{none} to not instrument, @var{call} to generate a call to __return__,
33649 or @var{nop5} to generate a 5 byte nop.
33650
33651 @item -mrecord-return
33652 @itemx -mno-record-return
33653 @opindex mrecord-return
33654 Generate a __return_loc section pointing to all return instrumentation code.
33655
33656 @item -mfentry-name=@var{name}
33657 @opindex mfentry-name
33658 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
33659
33660 @item -mfentry-section=@var{name}
33661 @opindex mfentry-section
33662 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
33663
33664 @item -mskip-rax-setup
33665 @itemx -mno-skip-rax-setup
33666 @opindex mskip-rax-setup
33667 When generating code for the x86-64 architecture with SSE extensions
33668 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
33669 register when there are no variable arguments passed in vector registers.
33670
33671 @strong{Warning:} Since RAX register is used to avoid unnecessarily
33672 saving vector registers on stack when passing variable arguments, the
33673 impacts of this option are callees may waste some stack space,
33674 misbehave or jump to a random location. GCC 4.4 or newer don't have
33675 those issues, regardless the RAX register value.
33676
33677 @item -m8bit-idiv
33678 @itemx -mno-8bit-idiv
33679 @opindex m8bit-idiv
33680 On some processors, like Intel Atom, 8-bit unsigned integer divide is
33681 much faster than 32-bit/64-bit integer divide. This option generates a
33682 run-time check. If both dividend and divisor are within range of 0
33683 to 255, 8-bit unsigned integer divide is used instead of
33684 32-bit/64-bit integer divide.
33685
33686 @item -mavx256-split-unaligned-load
33687 @itemx -mavx256-split-unaligned-store
33688 @opindex mavx256-split-unaligned-load
33689 @opindex mavx256-split-unaligned-store
33690 Split 32-byte AVX unaligned load and store.
33691
33692 @item -mstack-protector-guard=@var{guard}
33693 @itemx -mstack-protector-guard-reg=@var{reg}
33694 @itemx -mstack-protector-guard-offset=@var{offset}
33695 @opindex mstack-protector-guard
33696 @opindex mstack-protector-guard-reg
33697 @opindex mstack-protector-guard-offset
33698 Generate stack protection code using canary at @var{guard}. Supported
33699 locations are @samp{global} for global canary or @samp{tls} for per-thread
33700 canary in the TLS block (the default). This option has effect only when
33701 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
33702
33703 With the latter choice the options
33704 @option{-mstack-protector-guard-reg=@var{reg}} and
33705 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
33706 which segment register (@code{%fs} or @code{%gs}) to use as base register
33707 for reading the canary, and from what offset from that base register.
33708 The default for those is as specified in the relevant ABI.
33709
33710 @item -mgeneral-regs-only
33711 @opindex mgeneral-regs-only
33712 Generate code that uses only the general-purpose registers. This
33713 prevents the compiler from using floating-point, vector, mask and bound
33714 registers.
33715
33716 @item -mrelax-cmpxchg-loop
33717 @opindex mrelax-cmpxchg-loop
33718 When emitting a compare-and-swap loop for @ref{__sync Builtins}
33719 and @ref{__atomic Builtins} lacking a native instruction, optimize
33720 for the highly contended case by issuing an atomic load before the
33721 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
33722 to save CPU power when restarting the loop.
33723
33724 @item -mindirect-branch=@var{choice}
33725 @opindex mindirect-branch
33726 Convert indirect call and jump with @var{choice}. The default is
33727 @samp{keep}, which keeps indirect call and jump unmodified.
33728 @samp{thunk} converts indirect call and jump to call and return thunk.
33729 @samp{thunk-inline} converts indirect call and jump to inlined call
33730 and return thunk. @samp{thunk-extern} converts indirect call and jump
33731 to external call and return thunk provided in a separate object file.
33732 You can control this behavior for a specific function by using the
33733 function attribute @code{indirect_branch}. @xref{Function Attributes}.
33734
33735 Note that @option{-mcmodel=large} is incompatible with
33736 @option{-mindirect-branch=thunk} and
33737 @option{-mindirect-branch=thunk-extern} since the thunk function may
33738 not be reachable in the large code model.
33739
33740 Note that @option{-mindirect-branch=thunk-extern} is compatible with
33741 @option{-fcf-protection=branch} since the external thunk can be made
33742 to enable control-flow check.
33743
33744 @item -mfunction-return=@var{choice}
33745 @opindex mfunction-return
33746 Convert function return with @var{choice}. The default is @samp{keep},
33747 which keeps function return unmodified. @samp{thunk} converts function
33748 return to call and return thunk. @samp{thunk-inline} converts function
33749 return to inlined call and return thunk. @samp{thunk-extern} converts
33750 function return to external call and return thunk provided in a separate
33751 object file. You can control this behavior for a specific function by
33752 using the function attribute @code{function_return}.
33753 @xref{Function Attributes}.
33754
33755 Note that @option{-mindirect-return=thunk-extern} is compatible with
33756 @option{-fcf-protection=branch} since the external thunk can be made
33757 to enable control-flow check.
33758
33759 Note that @option{-mcmodel=large} is incompatible with
33760 @option{-mfunction-return=thunk} and
33761 @option{-mfunction-return=thunk-extern} since the thunk function may
33762 not be reachable in the large code model.
33763
33764
33765 @item -mindirect-branch-register
33766 @opindex mindirect-branch-register
33767 Force indirect call and jump via register.
33768
33769 @item -mharden-sls=@var{choice}
33770 @opindex mharden-sls
33771 Generate code to mitigate against straight line speculation (SLS) with
33772 @var{choice}. The default is @samp{none} which disables all SLS
33773 hardening. @samp{return} enables SLS hardening for function returns.
33774 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
33775 @samp{all} enables all SLS hardening.
33776
33777 @item -mindirect-branch-cs-prefix
33778 @opindex mindirect-branch-cs-prefix
33779 Add CS prefix to call and jmp to indirect thunk with branch target in
33780 r8-r15 registers so that the call and jmp instruction length is 6 bytes
33781 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
33782 @samp{lfence; jmp *%r8-r15} at run-time.
33783
33784 @end table
33785
33786 These @samp{-m} switches are supported in addition to the above
33787 on x86-64 processors in 64-bit environments.
33788
33789 @table @gcctabopt
33790 @item -m32
33791 @itemx -m64
33792 @itemx -mx32
33793 @itemx -m16
33794 @itemx -miamcu
33795 @opindex m32
33796 @opindex m64
33797 @opindex mx32
33798 @opindex m16
33799 @opindex miamcu
33800 Generate code for a 16-bit, 32-bit or 64-bit environment.
33801 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
33802 to 32 bits, and
33803 generates code that runs on any i386 system.
33804
33805 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
33806 types to 64 bits, and generates code for the x86-64 architecture.
33807 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
33808 and @option{-mdynamic-no-pic} options.
33809
33810 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
33811 to 32 bits, and
33812 generates code for the x86-64 architecture.
33813
33814 The @option{-m16} option is the same as @option{-m32}, except for that
33815 it outputs the @code{.code16gcc} assembly directive at the beginning of
33816 the assembly output so that the binary can run in 16-bit mode.
33817
33818 The @option{-miamcu} option generates code which conforms to Intel MCU
33819 psABI. It requires the @option{-m32} option to be turned on.
33820
33821 @item -mno-red-zone
33822 @opindex mno-red-zone
33823 @opindex mred-zone
33824 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
33825 by the x86-64 ABI; it is a 128-byte area beyond the location of the
33826 stack pointer that is not modified by signal or interrupt handlers
33827 and therefore can be used for temporary data without adjusting the stack
33828 pointer. The flag @option{-mno-red-zone} disables this red zone.
33829
33830 @item -mcmodel=small
33831 @opindex mcmodel=small
33832 Generate code for the small code model: the program and its symbols must
33833 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
33834 Programs can be statically or dynamically linked. This is the default
33835 code model.
33836
33837 @item -mcmodel=kernel
33838 @opindex mcmodel=kernel
33839 Generate code for the kernel code model. The kernel runs in the
33840 negative 2 GB of the address space.
33841 This model has to be used for Linux kernel code.
33842
33843 @item -mcmodel=medium
33844 @opindex mcmodel=medium
33845 Generate code for the medium model: the program is linked in the lower 2
33846 GB of the address space. Small symbols are also placed there. Symbols
33847 with sizes larger than @option{-mlarge-data-threshold} are put into
33848 large data or BSS sections and can be located above 2GB. Programs can
33849 be statically or dynamically linked.
33850
33851 @item -mcmodel=large
33852 @opindex mcmodel=large
33853 Generate code for the large model. This model makes no assumptions
33854 about addresses and sizes of sections.
33855
33856 @item -maddress-mode=long
33857 @opindex maddress-mode=long
33858 Generate code for long address mode. This is only supported for 64-bit
33859 and x32 environments. It is the default address mode for 64-bit
33860 environments.
33861
33862 @item -maddress-mode=short
33863 @opindex maddress-mode=short
33864 Generate code for short address mode. This is only supported for 32-bit
33865 and x32 environments. It is the default address mode for 32-bit and
33866 x32 environments.
33867
33868 @item -mneeded
33869 @itemx -mno-needed
33870 @opindex mneeded
33871 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
33872 indicate the micro-architecture ISA level required to execute the binary.
33873
33874 @item -mno-direct-extern-access
33875 @opindex mno-direct-extern-access
33876 @opindex mdirect-extern-access
33877 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
33878 to access external symbols. With @option{-fpic} or @option{-fPIC},
33879 treat access to protected symbols as local symbols. The default is
33880 @option{-mdirect-extern-access}.
33881
33882 @strong{Warning:} shared libraries compiled with
33883 @option{-mno-direct-extern-access} and executable compiled with
33884 @option{-mdirect-extern-access} may not be binary compatible if
33885 protected symbols are used in shared libraries and executable.
33886
33887 @item -munroll-only-small-loops
33888 @opindex munroll-only-small-loops
33889 @opindex mno-unroll-only-small-loops
33890 Controls conservative small loop unrolling. It is default enabled by
33891 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
33892 -f[no-]unroll-[all-]loops would disable this flag to avoid any
33893 unintended unrolling behavior that user does not want.
33894
33895 @item -mlam=@var{choice}
33896 @opindex mlam
33897 LAM(linear-address masking) allows special bits in the pointer to be used
33898 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
33899 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
33900 positions 62:57 can be used for metadata.
33901 @end table
33902
33903 @node x86 Windows Options
33904 @subsection x86 Windows Options
33905 @cindex x86 Windows Options
33906 @cindex Windows Options for x86
33907
33908 These additional options are available for Microsoft Windows targets:
33909
33910 @table @gcctabopt
33911 @item -mconsole
33912 @opindex mconsole
33913 This option
33914 specifies that a console application is to be generated, by
33915 instructing the linker to set the PE header subsystem type
33916 required for console applications.
33917 This option is available for Cygwin and MinGW targets and is
33918 enabled by default on those targets.
33919
33920 @item -mdll
33921 @opindex mdll
33922 This option is available for Cygwin and MinGW targets. It
33923 specifies that a DLL---a dynamic link library---is to be
33924 generated, enabling the selection of the required runtime
33925 startup object and entry point.
33926
33927 @item -mnop-fun-dllimport
33928 @opindex mnop-fun-dllimport
33929 This option is available for Cygwin and MinGW targets. It
33930 specifies that the @code{dllimport} attribute should be ignored.
33931
33932 @item -mthreads
33933 @opindex mthreads
33934 This option is available for MinGW targets. It specifies
33935 that MinGW-specific thread support is to be used.
33936
33937 @item -municode
33938 @opindex municode
33939 This option is available for MinGW-w64 targets. It causes
33940 the @code{UNICODE} preprocessor macro to be predefined, and
33941 chooses Unicode-capable runtime startup code.
33942
33943 @item -mwin32
33944 @opindex mwin32
33945 This option is available for Cygwin and MinGW targets. It
33946 specifies that the typical Microsoft Windows predefined macros are to
33947 be set in the pre-processor, but does not influence the choice
33948 of runtime library/startup code.
33949
33950 @item -mwindows
33951 @opindex mwindows
33952 This option is available for Cygwin and MinGW targets. It
33953 specifies that a GUI application is to be generated by
33954 instructing the linker to set the PE header subsystem type
33955 appropriately.
33956
33957 @item -fno-set-stack-executable
33958 @opindex fno-set-stack-executable
33959 @opindex fset-stack-executable
33960 This option is available for MinGW targets. It specifies that
33961 the executable flag for the stack used by nested functions isn't
33962 set. This is necessary for binaries running in kernel mode of
33963 Microsoft Windows, as there the User32 API, which is used to set executable
33964 privileges, isn't available.
33965
33966 @item -fwritable-relocated-rdata
33967 @opindex fno-writable-relocated-rdata
33968 @opindex fwritable-relocated-rdata
33969 This option is available for MinGW and Cygwin targets. It specifies
33970 that relocated-data in read-only section is put into the @code{.data}
33971 section. This is a necessary for older runtimes not supporting
33972 modification of @code{.rdata} sections for pseudo-relocation.
33973
33974 @item -mpe-aligned-commons
33975 @opindex mpe-aligned-commons
33976 This option is available for Cygwin and MinGW targets. It
33977 specifies that the GNU extension to the PE file format that
33978 permits the correct alignment of COMMON variables should be
33979 used when generating code. It is enabled by default if
33980 GCC detects that the target assembler found during configuration
33981 supports the feature.
33982 @end table
33983
33984 See also under @ref{x86 Options} for standard options.
33985
33986 @node Xstormy16 Options
33987 @subsection Xstormy16 Options
33988 @cindex Xstormy16 Options
33989
33990 These options are defined for Xstormy16:
33991
33992 @table @gcctabopt
33993 @item -msim
33994 @opindex msim
33995 Choose startup files and linker script suitable for the simulator.
33996 @end table
33997
33998 @node Xtensa Options
33999 @subsection Xtensa Options
34000 @cindex Xtensa Options
34001
34002 These options are supported for Xtensa targets:
34003
34004 @table @gcctabopt
34005 @item -mconst16
34006 @itemx -mno-const16
34007 @opindex mconst16
34008 @opindex mno-const16
34009 Enable or disable use of @code{CONST16} instructions for loading
34010 constant values. The @code{CONST16} instruction is currently not a
34011 standard option from Tensilica. When enabled, @code{CONST16}
34012 instructions are always used in place of the standard @code{L32R}
34013 instructions. The use of @code{CONST16} is enabled by default only if
34014 the @code{L32R} instruction is not available.
34015
34016 @item -mfused-madd
34017 @itemx -mno-fused-madd
34018 @opindex mfused-madd
34019 @opindex mno-fused-madd
34020 Enable or disable use of fused multiply/add and multiply/subtract
34021 instructions in the floating-point option. This has no effect if the
34022 floating-point option is not also enabled. Disabling fused multiply/add
34023 and multiply/subtract instructions forces the compiler to use separate
34024 instructions for the multiply and add/subtract operations. This may be
34025 desirable in some cases where strict IEEE 754-compliant results are
34026 required: the fused multiply add/subtract instructions do not round the
34027 intermediate result, thereby producing results with @emph{more} bits of
34028 precision than specified by the IEEE standard. Disabling fused multiply
34029 add/subtract instructions also ensures that the program output is not
34030 sensitive to the compiler's ability to combine multiply and add/subtract
34031 operations.
34032
34033 @item -mserialize-volatile
34034 @itemx -mno-serialize-volatile
34035 @opindex mserialize-volatile
34036 @opindex mno-serialize-volatile
34037 When this option is enabled, GCC inserts @code{MEMW} instructions before
34038 @code{volatile} memory references to guarantee sequential consistency.
34039 The default is @option{-mserialize-volatile}. Use
34040 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
34041
34042 @item -mforce-no-pic
34043 @opindex mforce-no-pic
34044 For targets, like GNU/Linux, where all user-mode Xtensa code must be
34045 position-independent code (PIC), this option disables PIC for compiling
34046 kernel code.
34047
34048 @item -mtext-section-literals
34049 @itemx -mno-text-section-literals
34050 @opindex mtext-section-literals
34051 @opindex mno-text-section-literals
34052 These options control the treatment of literal pools. The default is
34053 @option{-mno-text-section-literals}, which places literals in a separate
34054 section in the output file. This allows the literal pool to be placed
34055 in a data RAM/ROM, and it also allows the linker to combine literal
34056 pools from separate object files to remove redundant literals and
34057 improve code size. With @option{-mtext-section-literals}, the literals
34058 are interspersed in the text section in order to keep them as close as
34059 possible to their references. This may be necessary for large assembly
34060 files. Literals for each function are placed right before that function.
34061
34062 @item -mauto-litpools
34063 @itemx -mno-auto-litpools
34064 @opindex mauto-litpools
34065 @opindex mno-auto-litpools
34066 These options control the treatment of literal pools. The default is
34067 @option{-mno-auto-litpools}, which places literals in a separate
34068 section in the output file unless @option{-mtext-section-literals} is
34069 used. With @option{-mauto-litpools} the literals are interspersed in
34070 the text section by the assembler. Compiler does not produce explicit
34071 @code{.literal} directives and loads literals into registers with
34072 @code{MOVI} instructions instead of @code{L32R} to let the assembler
34073 do relaxation and place literals as necessary. This option allows
34074 assembler to create several literal pools per function and assemble
34075 very big functions, which may not be possible with
34076 @option{-mtext-section-literals}.
34077
34078 @item -mtarget-align
34079 @itemx -mno-target-align
34080 @opindex mtarget-align
34081 @opindex mno-target-align
34082 When this option is enabled, GCC instructs the assembler to
34083 automatically align instructions to reduce branch penalties at the
34084 expense of some code density. The assembler attempts to widen density
34085 instructions to align branch targets and the instructions following call
34086 instructions. If there are not enough preceding safe density
34087 instructions to align a target, no widening is performed. The
34088 default is @option{-mtarget-align}. These options do not affect the
34089 treatment of auto-aligned instructions like @code{LOOP}, which the
34090 assembler always aligns, either by widening density instructions or
34091 by inserting NOP instructions.
34092
34093 @item -mlongcalls
34094 @itemx -mno-longcalls
34095 @opindex mlongcalls
34096 @opindex mno-longcalls
34097 When this option is enabled, GCC instructs the assembler to translate
34098 direct calls to indirect calls unless it can determine that the target
34099 of a direct call is in the range allowed by the call instruction. This
34100 translation typically occurs for calls to functions in other source
34101 files. Specifically, the assembler translates a direct @code{CALL}
34102 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
34103 The default is @option{-mno-longcalls}. This option should be used in
34104 programs where the call target can potentially be out of range. This
34105 option is implemented in the assembler, not the compiler, so the
34106 assembly code generated by GCC still shows direct call
34107 instructions---look at the disassembled object code to see the actual
34108 instructions. Note that the assembler uses an indirect call for
34109 every cross-file call, not just those that really are out of range.
34110
34111 @item -mabi=@var{name}
34112 @opindex mabi
34113 Generate code for the specified ABI@. Permissible values are: @samp{call0},
34114 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
34115
34116 @item -mabi=call0
34117 @opindex mabi=call0
34118 When this option is enabled function parameters are passed in registers
34119 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
34120 caller-saved, and register @code{a15} may be used as a frame pointer.
34121 When this version of the ABI is enabled the C preprocessor symbol
34122 @code{__XTENSA_CALL0_ABI__} is defined.
34123
34124 @item -mabi=windowed
34125 @opindex mabi=windowed
34126 When this option is enabled function parameters are passed in registers
34127 @code{a10} through @code{a15}, and called function rotates register window
34128 by 8 registers on entry so that its arguments are found in registers
34129 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
34130 pointer. Register window is rotated 8 registers back upon return.
34131 When this version of the ABI is enabled the C preprocessor symbol
34132 @code{__XTENSA_WINDOWED_ABI__} is defined.
34133
34134 @item -mextra-l32r-costs=@var{n}
34135 @opindex mextra-l32r-costs
34136 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34137 instructions, in clock cycles. This affects, when optimizing for speed,
34138 whether loading a constant from literal pool using @code{L32R} or
34139 synthesizing the constant from a small one with a couple of arithmetic
34140 instructions. The default value is 0.
34141 @end table
34142
34143 @node zSeries Options
34144 @subsection zSeries Options
34145 @cindex zSeries options
34146
34147 These are listed under @xref{S/390 and zSeries Options}.
34148
34149
34150 @c man end
34151
34152 @node Spec Files
34153 @section Specifying Subprocesses and the Switches to Pass to Them
34154 @cindex Spec Files
34155
34156 @command{gcc} is a driver program. It performs its job by invoking a
34157 sequence of other programs to do the work of compiling, assembling and
34158 linking. GCC interprets its command-line parameters and uses these to
34159 deduce which programs it should invoke, and which command-line options
34160 it ought to place on their command lines. This behavior is controlled
34161 by @dfn{spec strings}. In most cases there is one spec string for each
34162 program that GCC can invoke, but a few programs have multiple spec
34163 strings to control their behavior. The spec strings built into GCC can
34164 be overridden by using the @option{-specs=} command-line switch to specify
34165 a spec file.
34166
34167 @dfn{Spec files} are plain-text files that are used to construct spec
34168 strings. They consist of a sequence of directives separated by blank
34169 lines. The type of directive is determined by the first non-whitespace
34170 character on the line, which can be one of the following:
34171
34172 @table @code
34173 @item %@var{command}
34174 Issues a @var{command} to the spec file processor. The commands that can
34175 appear here are:
34176
34177 @table @code
34178 @item %include <@var{file}>
34179 @cindex @code{%include}
34180 Search for @var{file} and insert its text at the current point in the
34181 specs file.
34182
34183 @item %include_noerr <@var{file}>
34184 @cindex @code{%include_noerr}
34185 Just like @samp{%include}, but do not generate an error message if the include
34186 file cannot be found.
34187
34188 @item %rename @var{old_name} @var{new_name}
34189 @cindex @code{%rename}
34190 Rename the spec string @var{old_name} to @var{new_name}.
34191
34192 @end table
34193
34194 @item *[@var{spec_name}]:
34195 This tells the compiler to create, override or delete the named spec
34196 string. All lines after this directive up to the next directive or
34197 blank line are considered to be the text for the spec string. If this
34198 results in an empty string then the spec is deleted. (Or, if the
34199 spec did not exist, then nothing happens.) Otherwise, if the spec
34200 does not currently exist a new spec is created. If the spec does
34201 exist then its contents are overridden by the text of this
34202 directive, unless the first character of that text is the @samp{+}
34203 character, in which case the text is appended to the spec.
34204
34205 @item [@var{suffix}]:
34206 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
34207 and up to the next directive or blank line are considered to make up the
34208 spec string for the indicated suffix. When the compiler encounters an
34209 input file with the named suffix, it processes the spec string in
34210 order to work out how to compile that file. For example:
34211
34212 @smallexample
34213 .ZZ:
34214 z-compile -input %i
34215 @end smallexample
34216
34217 This says that any input file whose name ends in @samp{.ZZ} should be
34218 passed to the program @samp{z-compile}, which should be invoked with the
34219 command-line switch @option{-input} and with the result of performing the
34220 @samp{%i} substitution. (See below.)
34221
34222 As an alternative to providing a spec string, the text following a
34223 suffix directive can be one of the following:
34224
34225 @table @code
34226 @item @@@var{language}
34227 This says that the suffix is an alias for a known @var{language}. This is
34228 similar to using the @option{-x} command-line switch to GCC to specify a
34229 language explicitly. For example:
34230
34231 @smallexample
34232 .ZZ:
34233 @@c++
34234 @end smallexample
34235
34236 Says that .ZZ files are, in fact, C++ source files.
34237
34238 @item #@var{name}
34239 This causes an error messages saying:
34240
34241 @smallexample
34242 @var{name} compiler not installed on this system.
34243 @end smallexample
34244 @end table
34245
34246 GCC already has an extensive list of suffixes built into it.
34247 This directive adds an entry to the end of the list of suffixes, but
34248 since the list is searched from the end backwards, it is effectively
34249 possible to override earlier entries using this technique.
34250
34251 @end table
34252
34253 GCC has the following spec strings built into it. Spec files can
34254 override these strings or create their own. Note that individual
34255 targets can also add their own spec strings to this list.
34256
34257 @smallexample
34258 asm Options to pass to the assembler
34259 asm_final Options to pass to the assembler post-processor
34260 cpp Options to pass to the C preprocessor
34261 cc1 Options to pass to the C compiler
34262 cc1plus Options to pass to the C++ compiler
34263 endfile Object files to include at the end of the link
34264 link Options to pass to the linker
34265 lib Libraries to include on the command line to the linker
34266 libgcc Decides which GCC support library to pass to the linker
34267 linker Sets the name of the linker
34268 predefines Defines to be passed to the C preprocessor
34269 signed_char Defines to pass to CPP to say whether @code{char} is signed
34270 by default
34271 startfile Object files to include at the start of the link
34272 @end smallexample
34273
34274 Here is a small example of a spec file:
34275
34276 @smallexample
34277 %rename lib old_lib
34278
34279 *lib:
34280 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
34281 @end smallexample
34282
34283 This example renames the spec called @samp{lib} to @samp{old_lib} and
34284 then overrides the previous definition of @samp{lib} with a new one.
34285 The new definition adds in some extra command-line options before
34286 including the text of the old definition.
34287
34288 @dfn{Spec strings} are a list of command-line options to be passed to their
34289 corresponding program. In addition, the spec strings can contain
34290 @samp{%}-prefixed sequences to substitute variable text or to
34291 conditionally insert text into the command line. Using these constructs
34292 it is possible to generate quite complex command lines.
34293
34294 Here is a table of all defined @samp{%}-sequences for spec
34295 strings. Note that spaces are not generated automatically around the
34296 results of expanding these sequences. Therefore you can concatenate them
34297 together or combine them with constant text in a single argument.
34298
34299 @table @code
34300 @item %%
34301 Substitute one @samp{%} into the program name or argument.
34302
34303 @item %"
34304 Substitute an empty argument.
34305
34306 @item %i
34307 Substitute the name of the input file being processed.
34308
34309 @item %b
34310 Substitute the basename for outputs related with the input file being
34311 processed. This is often the substring up to (and not including) the
34312 last period and not including the directory but, unless %w is active, it
34313 expands to the basename for auxiliary outputs, which may be influenced
34314 by an explicit output name, and by various other options that control
34315 how auxiliary outputs are named.
34316
34317 @item %B
34318 This is the same as @samp{%b}, but include the file suffix (text after
34319 the last period). Without %w, it expands to the basename for dump
34320 outputs.
34321
34322 @item %d
34323 Marks the argument containing or following the @samp{%d} as a
34324 temporary file name, so that that file is deleted if GCC exits
34325 successfully. Unlike @samp{%g}, this contributes no text to the
34326 argument.
34327
34328 @item %g@var{suffix}
34329 Substitute a file name that has suffix @var{suffix} and is chosen
34330 once per compilation, and mark the argument in the same way as
34331 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
34332 name is now chosen in a way that is hard to predict even when previously
34333 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
34334 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
34335 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
34336 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
34337 was simply substituted with a file name chosen once per compilation,
34338 without regard to any appended suffix (which was therefore treated
34339 just like ordinary text), making such attacks more likely to succeed.
34340
34341 @item %u@var{suffix}
34342 Like @samp{%g}, but generates a new temporary file name
34343 each time it appears instead of once per compilation.
34344
34345 @item %U@var{suffix}
34346 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
34347 new one if there is no such last file name. In the absence of any
34348 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
34349 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
34350 involves the generation of two distinct file names, one
34351 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
34352 simply substituted with a file name chosen for the previous @samp{%u},
34353 without regard to any appended suffix.
34354
34355 @item %j@var{suffix}
34356 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
34357 writable, and if @option{-save-temps} is not used;
34358 otherwise, substitute the name
34359 of a temporary file, just like @samp{%u}. This temporary file is not
34360 meant for communication between processes, but rather as a junk
34361 disposal mechanism.
34362
34363 @item %|@var{suffix}
34364 @itemx %m@var{suffix}
34365 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
34366 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
34367 all. These are the two most common ways to instruct a program that it
34368 should read from standard input or write to standard output. If you
34369 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
34370 construct: see for example @file{gcc/fortran/lang-specs.h}.
34371
34372 @item %.@var{SUFFIX}
34373 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
34374 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
34375 terminated by the next space or %.
34376
34377 @item %w
34378 Marks the argument containing or following the @samp{%w} as the
34379 designated output file of this compilation. This puts the argument
34380 into the sequence of arguments that @samp{%o} substitutes.
34381
34382 @item %V
34383 Indicates that this compilation produces no output file.
34384
34385 @item %o
34386 Substitutes the names of all the output files, with spaces
34387 automatically placed around them. You should write spaces
34388 around the @samp{%o} as well or the results are undefined.
34389 @samp{%o} is for use in the specs for running the linker.
34390 Input files whose names have no recognized suffix are not compiled
34391 at all, but they are included among the output files, so they are
34392 linked.
34393
34394 @item %O
34395 Substitutes the suffix for object files. Note that this is
34396 handled specially when it immediately follows @samp{%g, %u, or %U},
34397 because of the need for those to form complete file names. The
34398 handling is such that @samp{%O} is treated exactly as if it had already
34399 been substituted, except that @samp{%g, %u, and %U} do not currently
34400 support additional @var{suffix} characters following @samp{%O} as they do
34401 following, for example, @samp{.o}.
34402
34403 @item %I
34404 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
34405 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
34406 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
34407 and @option{-imultilib} as necessary.
34408
34409 @item %s
34410 Current argument is the name of a library or startup file of some sort.
34411 Search for that file in a standard list of directories and substitute
34412 the full name found. The current working directory is included in the
34413 list of directories scanned.
34414
34415 @item %T
34416 Current argument is the name of a linker script. Search for that file
34417 in the current list of directories to scan for libraries. If the file
34418 is located insert a @option{--script} option into the command line
34419 followed by the full path name found. If the file is not found then
34420 generate an error message. Note: the current working directory is not
34421 searched.
34422
34423 @item %e@var{str}
34424 Print @var{str} as an error message. @var{str} is terminated by a newline.
34425 Use this when inconsistent options are detected.
34426
34427 @item %n@var{str}
34428 Print @var{str} as a notice. @var{str} is terminated by a newline.
34429
34430 @item %(@var{name})
34431 Substitute the contents of spec string @var{name} at this point.
34432
34433 @item %x@{@var{option}@}
34434 Accumulate an option for @samp{%X}.
34435
34436 @item %X
34437 Output the accumulated linker options specified by a @samp{%x} spec string.
34438
34439 @item %Y
34440 Output the accumulated assembler options specified by @option{-Wa}.
34441
34442 @item %Z
34443 Output the accumulated preprocessor options specified by @option{-Wp}.
34444
34445 @item %M
34446 Output @code{multilib_os_dir}.
34447
34448 @item %R
34449 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
34450
34451 @item %a
34452 Process the @code{asm} spec. This is used to compute the
34453 switches to be passed to the assembler.
34454
34455 @item %A
34456 Process the @code{asm_final} spec. This is a spec string for
34457 passing switches to an assembler post-processor, if such a program is
34458 needed.
34459
34460 @item %l
34461 Process the @code{link} spec. This is the spec for computing the
34462 command line passed to the linker. Typically it makes use of the
34463 @samp{%L %G %S %D and %E} sequences.
34464
34465 @item %D
34466 Dump out a @option{-L} option for each directory that GCC believes might
34467 contain startup files. If the target supports multilibs then the
34468 current multilib directory is prepended to each of these paths.
34469
34470 @item %L
34471 Process the @code{lib} spec. This is a spec string for deciding which
34472 libraries are included on the command line to the linker.
34473
34474 @item %G
34475 Process the @code{libgcc} spec. This is a spec string for deciding
34476 which GCC support library is included on the command line to the linker.
34477
34478 @item %S
34479 Process the @code{startfile} spec. This is a spec for deciding which
34480 object files are the first ones passed to the linker. Typically
34481 this might be a file named @file{crt0.o}.
34482
34483 @item %E
34484 Process the @code{endfile} spec. This is a spec string that specifies
34485 the last object files that are passed to the linker.
34486
34487 @item %C
34488 Process the @code{cpp} spec. This is used to construct the arguments
34489 to be passed to the C preprocessor.
34490
34491 @item %1
34492 Process the @code{cc1} spec. This is used to construct the options to be
34493 passed to the actual C compiler (@command{cc1}).
34494
34495 @item %2
34496 Process the @code{cc1plus} spec. This is used to construct the options to be
34497 passed to the actual C++ compiler (@command{cc1plus}).
34498
34499 @item %*
34500 Substitute the variable part of a matched option. See below.
34501 Note that each comma in the substituted string is replaced by
34502 a single space.
34503
34504 @item %<S
34505 Remove all occurrences of @code{-S} from the command line. Note---this
34506 command is position dependent. @samp{%} commands in the spec string
34507 before this one see @code{-S}, @samp{%} commands in the spec string
34508 after this one do not.
34509
34510 @item %<S*
34511 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
34512
34513 @item %>S
34514 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
34515
34516 @item %:@var{function}(@var{args})
34517 Call the named function @var{function}, passing it @var{args}.
34518 @var{args} is first processed as a nested spec string, then split
34519 into an argument vector in the usual fashion. The function returns
34520 a string which is processed as if it had appeared literally as part
34521 of the current spec.
34522
34523 The following built-in spec functions are provided:
34524
34525 @table @code
34526 @item @code{getenv}
34527 The @code{getenv} spec function takes two arguments: an environment
34528 variable name and a string. If the environment variable is not
34529 defined, a fatal error is issued. Otherwise, the return value is the
34530 value of the environment variable concatenated with the string. For
34531 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
34532
34533 @smallexample
34534 %:getenv(TOPDIR /include)
34535 @end smallexample
34536
34537 expands to @file{/path/to/top/include}.
34538
34539 @item @code{if-exists}
34540 The @code{if-exists} spec function takes one argument, an absolute
34541 pathname to a file. If the file exists, @code{if-exists} returns the
34542 pathname. Here is a small example of its usage:
34543
34544 @smallexample
34545 *startfile:
34546 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
34547 @end smallexample
34548
34549 @item @code{if-exists-else}
34550 The @code{if-exists-else} spec function is similar to the @code{if-exists}
34551 spec function, except that it takes two arguments. The first argument is
34552 an absolute pathname to a file. If the file exists, @code{if-exists-else}
34553 returns the pathname. If it does not exist, it returns the second argument.
34554 This way, @code{if-exists-else} can be used to select one file or another,
34555 based on the existence of the first. Here is a small example of its usage:
34556
34557 @smallexample
34558 *startfile:
34559 crt0%O%s %:if-exists(crti%O%s) \
34560 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
34561 @end smallexample
34562
34563 @item @code{if-exists-then-else}
34564 The @code{if-exists-then-else} spec function takes at least two arguments
34565 and an optional third one. The first argument is an absolute pathname to a
34566 file. If the file exists, the function returns the second argument.
34567 If the file does not exist, the function returns the third argument if there
34568 is one, or NULL otherwise. This can be used to expand one text, or optionally
34569 another, based on the existence of a file. Here is a small example of its
34570 usage:
34571
34572 @smallexample
34573 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
34574 @end smallexample
34575
34576 @item @code{sanitize}
34577 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
34578 any address, thread or undefined behavior sanitizers are active.
34579
34580 @smallexample
34581 %@{%:sanitize(address):-funwind-tables@}
34582 @end smallexample
34583
34584 @item @code{replace-outfile}
34585 The @code{replace-outfile} spec function takes two arguments. It looks for the
34586 first argument in the outfiles array and replaces it with the second argument. Here
34587 is a small example of its usage:
34588
34589 @smallexample
34590 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
34591 @end smallexample
34592
34593 @item @code{remove-outfile}
34594 The @code{remove-outfile} spec function takes one argument. It looks for the
34595 first argument in the outfiles array and removes it. Here is a small example
34596 its usage:
34597
34598 @smallexample
34599 %:remove-outfile(-lm)
34600 @end smallexample
34601
34602 @item @code{version-compare}
34603 The @code{version-compare} spec function takes four or five arguments of the following
34604 form:
34605
34606 @smallexample
34607 <comparison-op> <arg1> [<arg2>] <switch> <result>
34608 @end smallexample
34609
34610 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
34611 The supported @code{comparison-op} values are:
34612
34613 @table @code
34614 @item >=
34615 True if @code{switch} is a later (or same) version than @code{arg1}
34616
34617 @item !>
34618 Opposite of @code{>=}
34619
34620 @item <
34621 True if @code{switch} is an earlier version than @code{arg1}
34622
34623 @item !<
34624 Opposite of @code{<}
34625
34626 @item ><
34627 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
34628
34629 @item <>
34630 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
34631 @end table
34632
34633 If the @code{switch} is not present at all, the condition is false unless the first character
34634 of the @code{comparison-op} is @code{!}.
34635
34636 @smallexample
34637 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
34638 @end smallexample
34639
34640 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
34641 passed.
34642
34643 @item @code{include}
34644 The @code{include} spec function behaves much like @code{%include}, with the advantage
34645 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
34646 the filename, and looks for it in the startfile path. It always returns NULL.
34647
34648 @smallexample
34649 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
34650 @end smallexample
34651
34652 @item @code{pass-through-libs}
34653 The @code{pass-through-libs} spec function takes any number of arguments. It
34654 finds any @option{-l} options and any non-options ending in @file{.a} (which it
34655 assumes are the names of linker input library archive files) and returns a
34656 result containing all the found arguments each prepended by
34657 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
34658 intended to be passed to the LTO linker plugin.
34659
34660 @smallexample
34661 %:pass-through-libs(%G %L %G)
34662 @end smallexample
34663
34664 @item @code{print-asm-header}
34665 The @code{print-asm-header} function takes no arguments and simply
34666 prints a banner like:
34667
34668 @smallexample
34669 Assembler options
34670 =================
34671
34672 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
34673 @end smallexample
34674
34675 It is used to separate compiler options from assembler options
34676 in the @option{--target-help} output.
34677
34678 @item @code{gt}
34679 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
34680 empty string) if the second-to-last argument is greater than the last argument, and NULL
34681 otherwise. The following example inserts the @code{link_gomp} spec if the last
34682 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
34683
34684 @smallexample
34685 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
34686 @end smallexample
34687
34688 @item @code{debug-level-gt}
34689 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
34690 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
34691 otherwise.
34692
34693 @smallexample
34694 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
34695 @end smallexample
34696 @end table
34697
34698 @item %@{S@}
34699 Substitutes the @code{-S} switch, if that switch is given to GCC@.
34700 If that switch is not specified, this substitutes nothing. Note that
34701 the leading dash is omitted when specifying this option, and it is
34702 automatically inserted if the substitution is performed. Thus the spec
34703 string @samp{%@{foo@}} matches the command-line option @option{-foo}
34704 and outputs the command-line option @option{-foo}.
34705
34706 @item %W@{S@}
34707 Like %@{@code{S}@} but mark last argument supplied within as a file to be
34708 deleted on failure.
34709
34710 @item %@@@{S@}
34711 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
34712 @code{@@FILE} if an @code{@@file} argument has been supplied.
34713
34714 @item %@{S*@}
34715 Substitutes all the switches specified to GCC whose names start
34716 with @code{-S}, but which also take an argument. This is used for
34717 switches like @option{-o}, @option{-D}, @option{-I}, etc.
34718 GCC considers @option{-o foo} as being
34719 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
34720 text, including the space. Thus two arguments are generated.
34721
34722 @item %@{S*&T*@}
34723 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
34724 (the order of @code{S} and @code{T} in the spec is not significant).
34725 There can be any number of ampersand-separated variables; for each the
34726 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
34727
34728 @item %@{S:X@}
34729 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
34730
34731 @item %@{!S:X@}
34732 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
34733
34734 @item %@{S*:X@}
34735 Substitutes @code{X} if one or more switches whose names start with
34736 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
34737 once, no matter how many such switches appeared. However, if @code{%*}
34738 appears somewhere in @code{X}, then @code{X} is substituted once
34739 for each matching switch, with the @code{%*} replaced by the part of
34740 that switch matching the @code{*}.
34741
34742 If @code{%*} appears as the last part of a spec sequence then a space
34743 is added after the end of the last substitution. If there is more
34744 text in the sequence, however, then a space is not generated. This
34745 allows the @code{%*} substitution to be used as part of a larger
34746 string. For example, a spec string like this:
34747
34748 @smallexample
34749 %@{mcu=*:--script=%*/memory.ld@}
34750 @end smallexample
34751
34752 @noindent
34753 when matching an option like @option{-mcu=newchip} produces:
34754
34755 @smallexample
34756 --script=newchip/memory.ld
34757 @end smallexample
34758
34759 @item %@{.S:X@}
34760 Substitutes @code{X}, if processing a file with suffix @code{S}.
34761
34762 @item %@{!.S:X@}
34763 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
34764
34765 @item %@{,S:X@}
34766 Substitutes @code{X}, if processing a file for language @code{S}.
34767
34768 @item %@{!,S:X@}
34769 Substitutes @code{X}, if not processing a file for language @code{S}.
34770
34771 @item %@{S|P:X@}
34772 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
34773 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
34774 @code{*} sequences as well, although they have a stronger binding than
34775 the @samp{|}. If @code{%*} appears in @code{X}, all of the
34776 alternatives must be starred, and only the first matching alternative
34777 is substituted.
34778
34779 For example, a spec string like this:
34780
34781 @smallexample
34782 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
34783 @end smallexample
34784
34785 @noindent
34786 outputs the following command-line options from the following input
34787 command-line options:
34788
34789 @smallexample
34790 fred.c -foo -baz
34791 jim.d -bar -boggle
34792 -d fred.c -foo -baz -boggle
34793 -d jim.d -bar -baz -boggle
34794 @end smallexample
34795
34796 @item %@{%:@var{function}(@var{args}):X@}
34797
34798 Call function named @var{function} with args @var{args}. If the
34799 function returns non-NULL, then @code{X} is substituted, if it returns
34800 NULL, it isn't substituted.
34801
34802 @item %@{S:X; T:Y; :D@}
34803
34804 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
34805 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
34806 be as many clauses as you need. This may be combined with @code{.},
34807 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
34808
34809
34810 @end table
34811
34812 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
34813 or similar construct can use a backslash to ignore the special meaning
34814 of the character following it, thus allowing literal matching of a
34815 character that is otherwise specially treated. For example,
34816 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
34817 @option{-std=iso9899:1999} option is given.
34818
34819 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
34820 construct may contain other nested @samp{%} constructs or spaces, or
34821 even newlines. They are processed as usual, as described above.
34822 Trailing white space in @code{X} is ignored. White space may also
34823 appear anywhere on the left side of the colon in these constructs,
34824 except between @code{.} or @code{*} and the corresponding word.
34825
34826 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
34827 handled specifically in these constructs. If another value of
34828 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
34829 @option{-W} switch is found later in the command line, the earlier
34830 switch value is ignored, except with @{@code{S}*@} where @code{S} is
34831 just one letter, which passes all matching options.
34832
34833 The character @samp{|} at the beginning of the predicate text is used to
34834 indicate that a command should be piped to the following command, but
34835 only if @option{-pipe} is specified.
34836
34837 It is built into GCC which switches take arguments and which do not.
34838 (You might think it would be useful to generalize this to allow each
34839 compiler's spec to say which switches take arguments. But this cannot
34840 be done in a consistent fashion. GCC cannot even decide which input
34841 files have been specified without knowing which switches take arguments,
34842 and it must know which input files to compile in order to tell which
34843 compilers to run).
34844
34845 GCC also knows implicitly that arguments starting in @option{-l} are to be
34846 treated as compiler output files, and passed to the linker in their
34847 proper position among the other output files.
34848
34849 @node Environment Variables
34850 @section Environment Variables Affecting GCC
34851 @cindex environment variables
34852
34853 @c man begin ENVIRONMENT
34854 This section describes several environment variables that affect how GCC
34855 operates. Some of them work by specifying directories or prefixes to use
34856 when searching for various kinds of files. Some are used to specify other
34857 aspects of the compilation environment.
34858
34859 Note that you can also specify places to search using options such as
34860 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
34861 take precedence over places specified using environment variables, which
34862 in turn take precedence over those specified by the configuration of GCC@.
34863 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
34864 GNU Compiler Collection (GCC) Internals}.
34865
34866 @table @env
34867 @item LANG
34868 @itemx LC_CTYPE
34869 @c @itemx LC_COLLATE
34870 @itemx LC_MESSAGES
34871 @c @itemx LC_MONETARY
34872 @c @itemx LC_NUMERIC
34873 @c @itemx LC_TIME
34874 @itemx LC_ALL
34875 @findex LANG
34876 @findex LC_CTYPE
34877 @c @findex LC_COLLATE
34878 @findex LC_MESSAGES
34879 @c @findex LC_MONETARY
34880 @c @findex LC_NUMERIC
34881 @c @findex LC_TIME
34882 @findex LC_ALL
34883 @cindex locale
34884 These environment variables control the way that GCC uses
34885 localization information which allows GCC to work with different
34886 national conventions. GCC inspects the locale categories
34887 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
34888 so. These locale categories can be set to any value supported by your
34889 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
34890 Kingdom encoded in UTF-8.
34891
34892 The @env{LC_CTYPE} environment variable specifies character
34893 classification. GCC uses it to determine the character boundaries in
34894 a string; this is needed for some multibyte encodings that contain quote
34895 and escape characters that are otherwise interpreted as a string
34896 end or escape.
34897
34898 The @env{LC_MESSAGES} environment variable specifies the language to
34899 use in diagnostic messages.
34900
34901 If the @env{LC_ALL} environment variable is set, it overrides the value
34902 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
34903 and @env{LC_MESSAGES} default to the value of the @env{LANG}
34904 environment variable. If none of these variables are set, GCC
34905 defaults to traditional C English behavior.
34906
34907 @item TMPDIR
34908 @findex TMPDIR
34909 If @env{TMPDIR} is set, it specifies the directory to use for temporary
34910 files. GCC uses temporary files to hold the output of one stage of
34911 compilation which is to be used as input to the next stage: for example,
34912 the output of the preprocessor, which is the input to the compiler
34913 proper.
34914
34915 @item GCC_COMPARE_DEBUG
34916 @findex GCC_COMPARE_DEBUG
34917 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
34918 @option{-fcompare-debug} to the compiler driver. See the documentation
34919 of this option for more details.
34920
34921 @item GCC_EXEC_PREFIX
34922 @findex GCC_EXEC_PREFIX
34923 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
34924 names of the subprograms executed by the compiler. No slash is added
34925 when this prefix is combined with the name of a subprogram, but you can
34926 specify a prefix that ends with a slash if you wish.
34927
34928 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
34929 an appropriate prefix to use based on the pathname it is invoked with.
34930
34931 If GCC cannot find the subprogram using the specified prefix, it
34932 tries looking in the usual places for the subprogram.
34933
34934 The default value of @env{GCC_EXEC_PREFIX} is
34935 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
34936 the installed compiler. In many cases @var{prefix} is the value
34937 of @code{prefix} when you ran the @file{configure} script.
34938
34939 Other prefixes specified with @option{-B} take precedence over this prefix.
34940
34941 This prefix is also used for finding files such as @file{crt0.o} that are
34942 used for linking.
34943
34944 In addition, the prefix is used in an unusual way in finding the
34945 directories to search for header files. For each of the standard
34946 directories whose name normally begins with @samp{/usr/local/lib/gcc}
34947 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
34948 replacing that beginning with the specified prefix to produce an
34949 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
34950 @file{foo/bar} just before it searches the standard directory
34951 @file{/usr/local/lib/bar}.
34952 If a standard directory begins with the configured
34953 @var{prefix} then the value of @var{prefix} is replaced by
34954 @env{GCC_EXEC_PREFIX} when looking for header files.
34955
34956 @item COMPILER_PATH
34957 @findex COMPILER_PATH
34958 The value of @env{COMPILER_PATH} is a colon-separated list of
34959 directories, much like @env{PATH}. GCC tries the directories thus
34960 specified when searching for subprograms, if it cannot find the
34961 subprograms using @env{GCC_EXEC_PREFIX}.
34962
34963 @item LIBRARY_PATH
34964 @findex LIBRARY_PATH
34965 The value of @env{LIBRARY_PATH} is a colon-separated list of
34966 directories, much like @env{PATH}. When configured as a native compiler,
34967 GCC tries the directories thus specified when searching for special
34968 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
34969 using GCC also uses these directories when searching for ordinary
34970 libraries for the @option{-l} option (but directories specified with
34971 @option{-L} come first).
34972
34973 @item LANG
34974 @findex LANG
34975 @cindex locale definition
34976 This variable is used to pass locale information to the compiler. One way in
34977 which this information is used is to determine the character set to be used
34978 when character literals, string literals and comments are parsed in C and C++.
34979 When the compiler is configured to allow multibyte characters,
34980 the following values for @env{LANG} are recognized:
34981
34982 @table @samp
34983 @item C-JIS
34984 Recognize JIS characters.
34985 @item C-SJIS
34986 Recognize SJIS characters.
34987 @item C-EUCJP
34988 Recognize EUCJP characters.
34989 @end table
34990
34991 If @env{LANG} is not defined, or if it has some other value, then the
34992 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
34993 recognize and translate multibyte characters.
34994
34995 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
34996 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
34997 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
34998 then additional text will be emitted to stderr when fix-it hints are
34999 emitted. @option{-fdiagnostics-parseable-fixits} and
35000 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35001 environment variable.
35002
35003 @table @samp
35004 @item fixits-v1
35005 Emit parseable fix-it hints, equivalent to
35006 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
35007 expressed as a count of bytes, starting at byte 1 for the initial column.
35008
35009 @item fixits-v2
35010 As @code{fixits-v1}, but columns are expressed as display columns,
35011 as per @option{-fdiagnostics-column-unit=display}.
35012 @end table
35013
35014 @end table
35015
35016 @noindent
35017 Some additional environment variables affect the behavior of the
35018 preprocessor.
35019
35020 @include cppenv.texi
35021
35022 @c man end
35023
35024 @node Precompiled Headers
35025 @section Using Precompiled Headers
35026 @cindex precompiled headers
35027 @cindex speed of compilation
35028
35029 Often large projects have many header files that are included in every
35030 source file. The time the compiler takes to process these header files
35031 over and over again can account for nearly all of the time required to
35032 build the project. To make builds faster, GCC allows you to
35033 @dfn{precompile} a header file.
35034
35035 To create a precompiled header file, simply compile it as you would any
35036 other file, if necessary using the @option{-x} option to make the driver
35037 treat it as a C or C++ header file. You may want to use a
35038 tool like @command{make} to keep the precompiled header up-to-date when
35039 the headers it contains change.
35040
35041 A precompiled header file is searched for when @code{#include} is
35042 seen in the compilation. As it searches for the included file
35043 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
35044 compiler looks for a precompiled header in each directory just before it
35045 looks for the include file in that directory. The name searched for is
35046 the name specified in the @code{#include} with @samp{.gch} appended. If
35047 the precompiled header file cannot be used, it is ignored.
35048
35049 For instance, if you have @code{#include "all.h"}, and you have
35050 @file{all.h.gch} in the same directory as @file{all.h}, then the
35051 precompiled header file is used if possible, and the original
35052 header is used otherwise.
35053
35054 Alternatively, you might decide to put the precompiled header file in a
35055 directory and use @option{-I} to ensure that directory is searched
35056 before (or instead of) the directory containing the original header.
35057 Then, if you want to check that the precompiled header file is always
35058 used, you can put a file of the same name as the original header in this
35059 directory containing an @code{#error} command.
35060
35061 This also works with @option{-include}. So yet another way to use
35062 precompiled headers, good for projects not designed with precompiled
35063 header files in mind, is to simply take most of the header files used by
35064 a project, include them from another header file, precompile that header
35065 file, and @option{-include} the precompiled header. If the header files
35066 have guards against multiple inclusion, they are skipped because
35067 they've already been included (in the precompiled header).
35068
35069 If you need to precompile the same header file for different
35070 languages, targets, or compiler options, you can instead make a
35071 @emph{directory} named like @file{all.h.gch}, and put each precompiled
35072 header in the directory, perhaps using @option{-o}. It doesn't matter
35073 what you call the files in the directory; every precompiled header in
35074 the directory is considered. The first precompiled header
35075 encountered in the directory that is valid for this compilation is
35076 used; they're searched in no particular order.
35077
35078 There are many other possibilities, limited only by your imagination,
35079 good sense, and the constraints of your build system.
35080
35081 A precompiled header file can be used only when these conditions apply:
35082
35083 @itemize
35084 @item
35085 Only one precompiled header can be used in a particular compilation.
35086
35087 @item
35088 A precompiled header cannot be used once the first C token is seen. You
35089 can have preprocessor directives before a precompiled header; you cannot
35090 include a precompiled header from inside another header.
35091
35092 @item
35093 The precompiled header file must be produced for the same language as
35094 the current compilation. You cannot use a C precompiled header for a C++
35095 compilation.
35096
35097 @item
35098 The precompiled header file must have been produced by the same compiler
35099 binary as the current compilation is using.
35100
35101 @item
35102 Any macros defined before the precompiled header is included must
35103 either be defined in the same way as when the precompiled header was
35104 generated, or must not affect the precompiled header, which usually
35105 means that they don't appear in the precompiled header at all.
35106
35107 The @option{-D} option is one way to define a macro before a
35108 precompiled header is included; using a @code{#define} can also do it.
35109 There are also some options that define macros implicitly, like
35110 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
35111 defined this way.
35112
35113 @item If debugging information is output when using the precompiled
35114 header, using @option{-g} or similar, the same kind of debugging information
35115 must have been output when building the precompiled header. However,
35116 a precompiled header built using @option{-g} can be used in a compilation
35117 when no debugging information is being output.
35118
35119 @item The same @option{-m} options must generally be used when building
35120 and using the precompiled header. @xref{Submodel Options},
35121 for any cases where this rule is relaxed.
35122
35123 @item Each of the following options must be the same when building and using
35124 the precompiled header:
35125
35126 @gccoptlist{-fexceptions}
35127
35128 @item
35129 Some other command-line options starting with @option{-f},
35130 @option{-p}, or @option{-O} must be defined in the same way as when
35131 the precompiled header was generated. At present, it's not clear
35132 which options are safe to change and which are not; the safest choice
35133 is to use exactly the same options when generating and using the
35134 precompiled header. The following are known to be safe:
35135
35136 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
35137 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
35138 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
35139 -pedantic-errors}
35140
35141 @item Address space layout randomization (ASLR) can lead to not binary identical
35142 PCH files. If you rely on stable PCH file contents disable ASLR when generating
35143 PCH files.
35144
35145 @end itemize
35146
35147 For all of these except the last, the compiler automatically
35148 ignores the precompiled header if the conditions aren't met. If you
35149 find an option combination that doesn't work and doesn't cause the
35150 precompiled header to be ignored, please consider filing a bug report,
35151 see @ref{Bugs}.
35152
35153 If you do use differing options when generating and using the
35154 precompiled header, the actual behavior is a mixture of the
35155 behavior for the options. For instance, if you use @option{-g} to
35156 generate the precompiled header but not when using it, you may or may
35157 not get debugging information for routines in the precompiled header.
35158
35159 @node C++ Modules
35160 @section C++ Modules
35161 @cindex speed of compilation
35162
35163 Modules are a C++20 language feature. As the name suggests, they
35164 provides a modular compilation system, intending to provide both
35165 faster builds and better library isolation. The ``Merging Modules''
35166 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35167 of changes to the standard, although it does not capture later
35168 changes.
35169
35170 @emph{G++'s modules support is not complete.} Other than bugs, the
35171 known missing pieces are:
35172
35173 @table @emph
35174
35175 @item Private Module Fragment
35176 The Private Module Fragment is recognized, but an error is emitted.
35177
35178 @item Partition definition visibility rules
35179 Entities may be defined in implementation partitions, and those
35180 definitions are not available outside of the module. This is not
35181 implemented, and the definitions are available to extra-module use.
35182
35183 @item Textual merging of reachable GM entities
35184 Entities may be multiply defined across different header-units.
35185 These must be de-duplicated, and this is implemented across imports,
35186 or when an import redefines a textually-defined entity. However the
35187 reverse is not implemented---textually redefining an entity that has
35188 been defined in an imported header-unit. A redefinition error is
35189 emitted.
35190
35191 @item Translation-Unit local referencing rules
35192 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35193 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35194 exported region may reference (for instance, the entities an exported
35195 template definition may reference). These are not fully implemented.
35196
35197 @item Standard Library Header Units
35198 The Standard Library is not provided as importable header units. If
35199 you want to import such units, you must explicitly build them first.
35200 If you do not do this with care, you may have multiple declarations,
35201 which the module machinery must merge---compiler resource usage can be
35202 affected by how you partition header files into header units.
35203
35204 @end table
35205
35206 Modular compilation is @emph{not} enabled with just the
35207 @option{-std=c++20} option. You must explicitly enable it with the
35208 @option{-fmodules-ts} option. It is independent of the language
35209 version selected, although in pre-C++20 versions, it is of course an
35210 extension.
35211
35212 No new source file suffixes are required or supported. If you wish to
35213 use a non-standard suffix (@pxref{Overall Options}), you also need
35214 to provide a @option{-x c++} option too.@footnote{Some users like to
35215 distinguish module interface files with a new suffix, such as naming
35216 the source @code{module.cppm}, which involves
35217 teaching all tools about the new suffix. A different scheme, such as
35218 naming @code{module-m.cpp} would be less invasive.}
35219
35220 Compiling a module interface unit produces an additional output (to
35221 the assembly or object file), called a Compiled Module Interface
35222 (CMI). This encodes the exported declarations of the module.
35223 Importing a module reads in the CMI. The import graph is a Directed
35224 Acyclic Graph (DAG). You must build imports before the importer.
35225
35226 Header files may themselves be compiled to header units, which are a
35227 transitional ability aiming at faster compilation. The
35228 @option{-fmodule-header} option is used to enable this, and implies
35229 the @option{-fmodules-ts} option. These CMIs are named by the fully
35230 resolved underlying header file, and thus may be a complete pathname
35231 containing subdirectories. If the header file is found at an absolute
35232 pathname, the CMI location is still relative to a CMI root directory.
35233
35234 As header files often have no suffix, you commonly have to specify a
35235 @option{-x} option to tell the compiler the source is a header file.
35236 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35237 @option{-x c++-system-header}. When used in conjunction with
35238 @option{-fmodules-ts}, these all imply an appropriate
35239 @option{-fmodule-header} option. The latter two variants use the
35240 user or system include path to search for the file specified. This
35241 allows you to, for instance, compile standard library header files as
35242 header units, without needing to know exactly where they are
35243 installed. Specifying the language as one of these variants also
35244 inhibits output of the object file, as header files have no associated
35245 object file.
35246
35247 The @option{-fmodule-only} option disables generation of the
35248 associated object file for compiling a module interface. Only the CMI
35249 is generated. This option is implied when using the
35250 @option{-fmodule-header} option.
35251
35252 The @option{-flang-info-include-translate} and
35253 @option{-flang-info-include-translate-not} options notes whether
35254 include translation occurs or not. With no argument, the first will
35255 note all include translation. The second will note all
35256 non-translations of include files not known to intentionally be
35257 textual. With an argument, queries about include translation of a
35258 header files with that particular trailing pathname are noted. You
35259 may repeat this form to cover several different header files. This
35260 option may be helpful in determining whether include translation is
35261 happening---if it is working correctly, it behaves as if it isn't
35262 there at all.
35263
35264 The @option{-flang-info-module-cmi} option can be used to determine
35265 where the compiler is reading a CMI from. Without the option, the
35266 compiler is silent when such a read is successful. This option has an
35267 optional argument, which will restrict the notification to just the
35268 set of named modules or header units specified.
35269
35270 The @option{-Winvalid-imported-macros} option causes all imported macros
35271 to be resolved at the end of compilation. Without this, imported
35272 macros are only resolved when expanded or (re)defined. This option
35273 detects conflicting import definitions for all macros.
35274
35275 For details of the @option{-fmodule-mapper} family of options,
35276 @pxref{C++ Module Mapper}.
35277
35278 @menu
35279 * C++ Module Mapper:: Module Mapper
35280 * C++ Module Preprocessing:: Module Preprocessing
35281 * C++ Compiled Module Interface:: Compiled Module Interface
35282 @end menu
35283
35284 @node C++ Module Mapper
35285 @subsection Module Mapper
35286 @cindex C++ Module Mapper
35287
35288 A module mapper provides a server or file that the compiler queries to
35289 determine the mapping between module names and CMI files. It is also
35290 used to build CMIs on demand. @emph{Mapper functionality is in its
35291 infancy and is intended for experimentation with build system
35292 interactions.}
35293
35294 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
35295 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
35296 have one of the following forms:
35297
35298 @table @gcctabopt
35299
35300 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
35301 An optional hostname and a numeric port number to connect to. If the
35302 hostname is omitted, the loopback address is used. If the hostname
35303 corresponds to multiple IPV6 addresses, these are tried in turn, until
35304 one is successful. If your host lacks IPv6, this form is
35305 non-functional. If you must use IPv4 use
35306 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
35307
35308 @item =@var{socket}@r{[}?@var{ident}@r{]}
35309 A local domain socket. If your host lacks local domain sockets, this
35310 form is non-functional.
35311
35312 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
35313 A program to spawn, and communicate with on its stdin/stdout streams.
35314 Your @var{PATH} environment variable is searched for the program.
35315 Arguments are separated by space characters, (it is not possible for
35316 one of the arguments delivered to the program to contain a space). An
35317 exception is if @var{program} begins with @@. In that case
35318 @var{program} (sans @@) is looked for in the compiler's internal
35319 binary directory. Thus the sample mapper-server can be specified
35320 with @code{@@g++-mapper-server}.
35321
35322 @item <>@r{[}?@var{ident}@r{]}
35323 @item <>@var{inout}@r{[}?@var{ident}@r{]}
35324 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
35325 Named pipes or file descriptors to communicate over. The first form,
35326 @option{<>}, communicates over stdin and stdout. The other forms
35327 allow you to specify a file descriptor or name a pipe. A numeric value
35328 is interpreted as a file descriptor, otherwise named pipe is opened.
35329 The second form specifies a bidirectional pipe and the last form
35330 allows specifying two independent pipes. Using file descriptors
35331 directly in this manner is fragile in general, as it can require the
35332 cooperation of intermediate processes. In particular using stdin &
35333 stdout is fraught with danger as other compiler options might also
35334 cause the compiler to read stdin or write stdout, and it can have
35335 unfortunate interactions with signal delivery from the terminal.
35336
35337 @item @var{file}@r{[}?@var{ident}@r{]}
35338 A mapping file consisting of space-separated module-name, filename
35339 pairs, one per line. Only the mappings for the direct imports and any
35340 module export name need be provided. If other mappings are provided,
35341 they override those stored in any imported CMI files. A repository
35342 root may be specified in the mapping file by using @samp{$root} as the
35343 module name in the first active line. Use of this option will disable
35344 any default module->CMI name mapping.
35345
35346 @end table
35347
35348 As shown, an optional @var{ident} may suffix the first word of the
35349 option, indicated by a @samp{?} prefix. The value is used in the
35350 initial handshake with the module server, or to specify a prefix on
35351 mapping file lines. In the server case, the main source file name is
35352 used if no @var{ident} is specified. In the file case, all non-blank
35353 lines are significant, unless a value is specified, in which case only
35354 lines beginning with @var{ident} are significant. The @var{ident}
35355 must be separated by whitespace from the module name. Be aware that
35356 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
35357 significant to the shell, and therefore may need quoting.
35358
35359 The mapper is connected to or loaded lazily, when the first module
35360 mapping is required. The networking protocols are only supported on
35361 hosts that provide networking. If no mapper is specified a default is
35362 provided.
35363
35364 A project-specific mapper is expected to be provided by the build
35365 system that invokes the compiler. It is not expected that a
35366 general-purpose server is provided for all compilations. As such, the
35367 server will know the build configuration, the compiler it invoked, and
35368 the environment (such as working directory) in which that is
35369 operating. As it may parallelize builds, several compilations may
35370 connect to the same socket.
35371
35372 The default mapper generates CMI files in a @samp{gcm.cache}
35373 directory. CMI files have a @samp{.gcm} suffix. The module unit name
35374 is used directly to provide the basename. Header units construct a
35375 relative path using the underlying header file name. If the path is
35376 already relative, a @samp{,} directory is prepended. Internal
35377 @samp{..} components are translated to @samp{,,}. No attempt is made
35378 to canonicalize these filenames beyond that done by the preprocessor's
35379 include search algorithm, as in general it is ambiguous when symbolic
35380 links are present.
35381
35382 The mapper protocol was published as ``A Module Mapper''
35383 @uref{https://wg21.link/p1184}. The implementation is provided by
35384 @command{libcody}, @uref{https://github.com/urnathan/libcody},
35385 which specifies the canonical protocol definition. A proof of concept
35386 server implementation embedded in @command{make} was described in
35387 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
35388
35389 @node C++ Module Preprocessing
35390 @subsection Module Preprocessing
35391 @cindex C++ Module Preprocessing
35392
35393 Modules affect preprocessing because of header units and include
35394 translation. Some uses of the preprocessor as a separate step either
35395 do not produce a correct output, or require CMIs to be available.
35396
35397 Header units import macros. These macros can affect later conditional
35398 inclusion, which therefore can cascade to differing import sets. When
35399 preprocessing, it is necessary to load the CMI. If a header unit is
35400 unavailable, the preprocessor issues a warning and continue (when
35401 not just preprocessing, an error is emitted). Detecting such imports
35402 requires preprocessor tokenization of the input stream to phase 4
35403 (macro expansion).
35404
35405 Include translation converts @code{#include}, @code{#include_next} and
35406 @code{#import} directives to internal @code{import} declarations.
35407 Whether a particular directive is translated is controlled by the
35408 module mapper. Header unit names are canonicalized during
35409 preprocessing.
35410
35411 Dependency information can be emitted for macro import, extending the
35412 functionality of @option{-MD} and @option{-MMD} options. Detection of
35413 import declarations also requires phase 4 preprocessing, and thus
35414 requires full preprocessing (or compilation).
35415
35416 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
35417 preprocessing before phase 4.
35418
35419 The @option{-save-temps} option uses @option{-fdirectives-only} for
35420 preprocessing, and preserve the macro definitions in the preprocessed
35421 output. Usually you also want to use this option when explicitly
35422 preprocessing a header-unit, or consuming such preprocessed output:
35423
35424 @smallexample
35425 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
35426 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
35427 @end smallexample
35428
35429 @node C++ Compiled Module Interface
35430 @subsection Compiled Module Interface
35431 @cindex C++ Compiled Module Interface
35432
35433 CMIs are an additional artifact when compiling named module
35434 interfaces, partitions or header units. These are read when
35435 importing. CMI contents are implementation-specific, and in GCC's
35436 case tied to the compiler version. Consider them a rebuildable cache
35437 artifact, not a distributable object.
35438
35439 When creating an output CMI, any missing directory components are
35440 created in a manner that is safe for concurrent builds creating
35441 multiple, different, CMIs within a common subdirectory tree.
35442
35443 CMI contents are written to a temporary file, which is then atomically
35444 renamed. Observers either see old contents (if there is an
35445 existing file), or complete new contents. They do not observe the
35446 CMI during its creation. This is unlike object file writing, which
35447 may be observed by an external process.
35448
35449 CMIs are read in lazily, if the host OS provides @code{mmap}
35450 functionality. Generally blocks are read when name lookup or template
35451 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
35452 option may be used.
35453
35454 The @option{--param lazy-modules=@var{n}} parameter controls the limit
35455 on the number of concurrently open module files during lazy loading.
35456 Should more modules be imported, an LRU algorithm is used to determine
35457 which files to close---until that file is needed again. This limit
35458 may be exceeded with deep module dependency hierarchies. With large
35459 code bases there may be more imports than the process limit of file
35460 descriptors. By default, the limit is a few less than the per-process
35461 file descriptor hard limit, if that is determinable.@footnote{Where
35462 applicable the soft limit is incremented as needed towards the hard limit.}
35463
35464 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
35465 You may use @command{readelf} to inspect them, although section
35466 contents are largely undecipherable. There is a section named
35467 @code{.gnu.c++.README}, which contains human-readable text. Other
35468 than the first line, each line consists of @code{@var{tag}: @code{value}}
35469 tuples.
35470
35471 @smallexample
35472 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
35473
35474 String dump of section '.gnu.c++.README':
35475 [ 0] GNU C++ primary module interface
35476 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
35477 [ 6f] version: 2020/11/16-04:54
35478 [ 89] module: foo
35479 [ 95] source: c_b.ii
35480 [ a4] dialect: C++20/coroutines
35481 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
35482 [ ee] repository: gcm.cache
35483 [ 104] buildtime: 2020/11/16 15:03:21 UTC
35484 [ 127] localtime: 2020/11/16 07:03:21 PST
35485 [ 14a] export: foo:part1 foo-part1.gcm
35486 @end smallexample
35487
35488 Amongst other things, this lists the source that was built, C++
35489 dialect used and imports of the module.@footnote{The precise contents
35490 of this output may change.} The timestamp is the same value as that
35491 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
35492 explicitly specified with the environment variable
35493 @code{SOURCE_DATE_EPOCH}. For further details
35494 @pxref{Environment Variables}.
35495
35496 A set of related CMIs may be copied, provided the relative pathnames
35497 are preserved.
35498
35499 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
35500 it may be removed or altered. The section numbering of the sections
35501 whose names do not begin with @code{.gnu.c++.}, or are not the string
35502 section is significant and must not be altered.