]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
arm: add armv9-a architecture to -march
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2021 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
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-2021 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), dbx(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{http://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 -fallow-parameterless-variadic-functions -fno-asm @gol
202 -fno-builtin -fno-builtin-@var{function} -fcond-mismatch @gol
203 -ffreestanding -fgimple -fgnu-tm -fgnu89-inline -fhosted @gol
204 -flax-vector-conversions -fms-extensions @gol
205 -foffload=@var{arg} -foffload-options=@var{arg} @gol
206 -fopenacc -fopenacc-dim=@var{geom} @gol
207 -fopenmp -fopenmp-simd @gol
208 -fpermitted-flt-eval-methods=@var{standard} @gol
209 -fplan9-extensions -fsigned-bitfields -funsigned-bitfields @gol
210 -fsigned-char -funsigned-char -fsso-struct=@var{endianness}}
211
212 @item C++ Language Options
213 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
214 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
215 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
216 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
217 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
218 -fno-elide-constructors @gol
219 -fno-enforce-eh-specs @gol
220 -fno-gnu-keywords @gol
221 -fno-implicit-templates @gol
222 -fno-implicit-inline-templates @gol
223 -fno-implement-inlines @gol
224 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts @gol
225 -fmodule-implicit-inline @gol
226 -fno-module-lazy @gol
227 -fmodule-mapper=@var{specification} @gol
228 -fmodule-version-ignore @gol
229 -fms-extensions @gol
230 -fnew-inheriting-ctors @gol
231 -fnew-ttp-matching @gol
232 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
233 -fno-optional-diags -fpermissive @gol
234 -fno-pretty-templates @gol
235 -fno-rtti -fsized-deallocation @gol
236 -ftemplate-backtrace-limit=@var{n} @gol
237 -ftemplate-depth=@var{n} @gol
238 -fno-threadsafe-statics -fuse-cxa-atexit @gol
239 -fno-weak -nostdinc++ @gol
240 -fvisibility-inlines-hidden @gol
241 -fvisibility-ms-compat @gol
242 -fext-numeric-literals @gol
243 -flang-info-include-translate@r{[}=@var{header}@r{]} @gol
244 -flang-info-include-translate-not @gol
245 -flang-info-module-cmi@r{[}=@var{module}@r{]} @gol
246 -stdlib=@var{libstdc++,libc++} @gol
247 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
248 -Wno-class-conversion -Wclass-memaccess @gol
249 -Wcomma-subscript -Wconditionally-supported @gol
250 -Wno-conversion-null -Wctad-maybe-unsupported @gol
251 -Wctor-dtor-privacy -Wno-delete-incomplete @gol
252 -Wdelete-non-virtual-dtor -Wno-deprecated-array-compare @gol
253 -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
254 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
255 -Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base @gol
256 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
257 -Winvalid-imported-macros @gol
258 -Wno-invalid-offsetof -Wno-literal-suffix @gol
259 -Wmismatched-new-delete -Wmismatched-tags @gol
260 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
261 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
262 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
263 -Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol
264 -Wreorder -Wregister @gol
265 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
266 -Wno-non-template-friend -Wold-style-cast @gol
267 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
268 -Wsized-deallocation -Wsuggest-final-methods @gol
269 -Wsuggest-final-types -Wsuggest-override @gol
270 -Wno-terminate -Wuseless-cast -Wno-vexing-parse @gol
271 -Wvirtual-inheritance @gol
272 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
273
274 @item Objective-C and Objective-C++ Language Options
275 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
276 Objective-C and Objective-C++ Dialects}.
277 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
278 -fgnu-runtime -fnext-runtime @gol
279 -fno-nil-receivers @gol
280 -fobjc-abi-version=@var{n} @gol
281 -fobjc-call-cxx-cdtors @gol
282 -fobjc-direct-dispatch @gol
283 -fobjc-exceptions @gol
284 -fobjc-gc @gol
285 -fobjc-nilcheck @gol
286 -fobjc-std=objc1 @gol
287 -fno-local-ivars @gol
288 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
289 -freplace-objc-classes @gol
290 -fzero-link @gol
291 -gen-decls @gol
292 -Wassign-intercept -Wno-property-assign-default @gol
293 -Wno-protocol -Wobjc-root-class -Wselector @gol
294 -Wstrict-selector-match @gol
295 -Wundeclared-selector}
296
297 @item Diagnostic Message Formatting Options
298 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
299 @gccoptlist{-fmessage-length=@var{n} @gol
300 -fdiagnostics-plain-output @gol
301 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
302 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
303 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
304 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
305 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
306 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
307 -fno-diagnostics-show-cwe @gol
308 -fdiagnostics-minimum-margin-width=@var{width} @gol
309 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
310 -fdiagnostics-show-template-tree -fno-elide-type @gol
311 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
312 -fdiagnostics-show-path-depths @gol
313 -fno-show-column @gol
314 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
315 -fdiagnostics-column-origin=@var{origin} @gol
316 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}}
317
318 @item Warning Options
319 @xref{Warning Options,,Options to Request or Suppress Warnings}.
320 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
321 -pedantic-errors @gol
322 -w -Wextra -Wall -Wabi=@var{n} @gol
323 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
324 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
325 -Walloca -Walloca-larger-than=@var{byte-size} @gol
326 -Wno-aggressive-loop-optimizations @gol
327 -Warith-conversion @gol
328 -Warray-bounds -Warray-bounds=@var{n} -Warray-compare @gol
329 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
330 -Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
331 -Wno-builtin-declaration-mismatch @gol
332 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
333 -Wc11-c2x-compat @gol
334 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
335 -Wc++20-compat @gol
336 -Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions @gol
337 -Wno-c++20-extensions -Wno-c++23-extensions @gol
338 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
339 -Wchar-subscripts @gol
340 -Wclobbered -Wcomment @gol
341 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
342 -Wdangling-else -Wdate-time @gol
343 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
344 -Wdisabled-optimization @gol
345 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
346 -Wno-div-by-zero -Wdouble-promotion @gol
347 -Wduplicated-branches -Wduplicated-cond @gol
348 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
349 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
350 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
351 -Wno-format-contains-nul -Wno-format-extra-args @gol
352 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
353 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
354 -Wformat-y2k -Wframe-address @gol
355 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
356 -Wno-if-not-aligned -Wno-ignored-attributes @gol
357 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
358 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
359 -Wno-implicit-function-declaration -Wno-implicit-int @gol
360 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
361 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
362 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
363 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
364 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
365 -Wmemset-elt-size -Wmemset-transposed-args @gol
366 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
367 -Wmissing-field-initializers -Wmissing-format-attribute @gol
368 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
369 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
370 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
371 -Wnull-dereference -Wno-odr @gol
372 -Wopenacc-parallelism @gol
373 -Wopenmp-simd @gol
374 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
375 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
376 -Wparentheses -Wno-pedantic-ms-format @gol
377 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
378 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
379 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
380 -Wno-scalar-storage-order -Wsequence-point @gol
381 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
382 -Wno-shadow-ivar @gol
383 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
384 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
385 -Wsign-compare -Wsign-conversion @gol
386 -Wno-sizeof-array-argument @gol
387 -Wsizeof-array-div @gol
388 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
389 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
390 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
391 -Wstring-compare @gol
392 -Wno-stringop-overflow -Wno-stringop-overread @gol
393 -Wno-stringop-truncation @gol
394 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
395 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
396 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
397 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
398 -Wtsan -Wtype-limits -Wundef @gol
399 -Wuninitialized -Wunknown-pragmas @gol
400 -Wunsuffixed-float-constants -Wunused @gol
401 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
402 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
403 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
404 -Wunused-macros @gol
405 -Wunused-parameter -Wno-unused-result @gol
406 -Wunused-value -Wunused-variable @gol
407 -Wno-varargs -Wvariadic-macros @gol
408 -Wvector-operation-performance @gol
409 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
410 -Wvolatile-register-var -Wwrite-strings @gol
411 -Wzero-length-bounds}
412
413 @item Static Analyzer Options
414 @gccoptlist{
415 -fanalyzer @gol
416 -fanalyzer-call-summaries @gol
417 -fanalyzer-checker=@var{name} @gol
418 -fno-analyzer-feasibility @gol
419 -fanalyzer-fine-grained @gol
420 -fanalyzer-state-merge @gol
421 -fanalyzer-state-purge @gol
422 -fanalyzer-transitivity @gol
423 -fanalyzer-verbose-edges @gol
424 -fanalyzer-verbose-state-changes @gol
425 -fanalyzer-verbosity=@var{level} @gol
426 -fdump-analyzer @gol
427 -fdump-analyzer-stderr @gol
428 -fdump-analyzer-callgraph @gol
429 -fdump-analyzer-exploded-graph @gol
430 -fdump-analyzer-exploded-nodes @gol
431 -fdump-analyzer-exploded-nodes-2 @gol
432 -fdump-analyzer-exploded-nodes-3 @gol
433 -fdump-analyzer-exploded-paths @gol
434 -fdump-analyzer-feasibility @gol
435 -fdump-analyzer-json @gol
436 -fdump-analyzer-state-purge @gol
437 -fdump-analyzer-supergraph @gol
438 -Wno-analyzer-double-fclose @gol
439 -Wno-analyzer-double-free @gol
440 -Wno-analyzer-exposure-through-output-file @gol
441 -Wno-analyzer-file-leak @gol
442 -Wno-analyzer-free-of-non-heap @gol
443 -Wno-analyzer-malloc-leak @gol
444 -Wno-analyzer-mismatching-deallocation @gol
445 -Wno-analyzer-null-argument @gol
446 -Wno-analyzer-null-dereference @gol
447 -Wno-analyzer-possible-null-argument @gol
448 -Wno-analyzer-possible-null-dereference @gol
449 -Wno-analyzer-shift-count-negative @gol
450 -Wno-analyzer-shift-count-overflow @gol
451 -Wno-analyzer-stale-setjmp-buffer @gol
452 -Wno-analyzer-tainted-array-index @gol
453 -Wanalyzer-too-complex @gol
454 -Wno-analyzer-unsafe-call-within-signal-handler @gol
455 -Wno-analyzer-use-after-free @gol
456 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
457 -Wno-analyzer-use-of-uninitialized-value @gol
458 -Wno-analyzer-write-to-const @gol
459 -Wno-analyzer-write-to-string-literal @gol
460 }
461
462 @item C and Objective-C-only Warning Options
463 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
464 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
465 -Wold-style-declaration -Wold-style-definition @gol
466 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
467 -Wdeclaration-after-statement -Wpointer-sign}
468
469 @item Debugging Options
470 @xref{Debugging Options,,Options for Debugging Your Program}.
471 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
472 -gbtf -gctf -gctf@var{level} @gol
473 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
474 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
475 -gas-loc-support -gno-as-loc-support @gol
476 -gas-locview-support -gno-as-locview-support @gol
477 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol
478 -gstatement-frontiers -gno-statement-frontiers @gol
479 -gvariable-location-views -gno-variable-location-views @gol
480 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
481 -ginline-points -gno-inline-points @gol
482 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
483 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
484 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
485 -fno-eliminate-unused-debug-types @gol
486 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
487 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
488 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
489 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
490 -fvar-tracking -fvar-tracking-assignments}
491
492 @item Optimization Options
493 @xref{Optimize Options,,Options that Control Optimization}.
494 @gccoptlist{-faggressive-loop-optimizations @gol
495 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
496 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
497 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
498 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
499 -fno-allocation-dce -fallow-store-data-races @gol
500 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
501 -fauto-inc-dec -fbranch-probabilities @gol
502 -fcaller-saves @gol
503 -fcombine-stack-adjustments -fconserve-stack @gol
504 -fcompare-elim -fcprop-registers -fcrossjumping @gol
505 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
506 -fcx-limited-range @gol
507 -fdata-sections -fdce -fdelayed-branch @gol
508 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
509 -fdevirtualize-at-ltrans -fdse @gol
510 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
511 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
512 -ffinite-loops @gol
513 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
514 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
515 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
516 -fif-conversion2 -findirect-inlining @gol
517 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
518 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol
519 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
520 -fipa-reference -fipa-reference-addressable @gol
521 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
522 -flive-patching=@var{level} @gol
523 -fira-region=@var{region} -fira-hoist-pressure @gol
524 -fira-loop-pressure -fno-ira-share-save-slots @gol
525 -fno-ira-share-spill-slots @gol
526 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
527 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
528 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
529 -floop-block -floop-interchange -floop-strip-mine @gol
530 -floop-unroll-and-jam -floop-nest-optimize @gol
531 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
532 -flto-partition=@var{alg} -fmerge-all-constants @gol
533 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
534 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg @gol
535 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
536 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
537 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
538 -fno-sched-spec -fno-signed-zeros @gol
539 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
540 -fomit-frame-pointer -foptimize-sibling-calls @gol
541 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
542 -fprefetch-loop-arrays @gol
543 -fprofile-correction @gol
544 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
545 -fprofile-values -fprofile-reorder-functions @gol
546 -freciprocal-math -free -frename-registers -freorder-blocks @gol
547 -freorder-blocks-algorithm=@var{algorithm} @gol
548 -freorder-blocks-and-partition -freorder-functions @gol
549 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
550 -frounding-math -fsave-optimization-record @gol
551 -fsched2-use-superblocks -fsched-pressure @gol
552 -fsched-spec-load -fsched-spec-load-dangerous @gol
553 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
554 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
555 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
556 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
557 -fschedule-fusion @gol
558 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
559 -fselective-scheduling -fselective-scheduling2 @gol
560 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
561 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
562 -fsignaling-nans @gol
563 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
564 -fsplit-paths @gol
565 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
566 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
567 -fthread-jumps -ftracer -ftree-bit-ccp @gol
568 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
569 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
570 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
571 -ftree-loop-if-convert -ftree-loop-im @gol
572 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
573 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
574 -ftree-loop-vectorize @gol
575 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
576 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
577 -ftree-switch-conversion -ftree-tail-merge @gol
578 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init @gol
579 -funconstrained-commons -funit-at-a-time -funroll-all-loops @gol
580 -funroll-loops -funsafe-math-optimizations -funswitch-loops @gol
581 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
582 -fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol
583 --param @var{name}=@var{value}
584 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
585
586 @item Program Instrumentation Options
587 @xref{Instrumentation Options,,Program Instrumentation Options}.
588 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
589 -fprofile-abs-path @gol
590 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
591 -fprofile-info-section -fprofile-info-section=@var{name} @gol
592 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
593 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
594 -fprofile-exclude-files=@var{regex} @gol
595 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
596 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
597 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
598 -fsanitize-undefined-trap-on-error -fbounds-check @gol
599 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
600 -fharden-compares -fharden-conditional-branches @gol
601 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
602 -fstack-protector-explicit -fstack-check @gol
603 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
604 -fno-stack-limit -fsplit-stack @gol
605 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
606 -fvtv-counts -fvtv-debug @gol
607 -finstrument-functions @gol
608 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
609 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
610
611 @item Preprocessor Options
612 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
613 @gccoptlist{-A@var{question}=@var{answer} @gol
614 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
615 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
616 -dD -dI -dM -dN -dU @gol
617 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
618 -fexec-charset=@var{charset} -fextended-identifiers @gol
619 -finput-charset=@var{charset} -flarge-source-files @gol
620 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
621 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
622 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
623 -fwide-exec-charset=@var{charset} -fworking-directory @gol
624 -H -imacros @var{file} -include @var{file} @gol
625 -M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules @gol
626 -no-integrated-cpp -P -pthread -remap @gol
627 -traditional -traditional-cpp -trigraphs @gol
628 -U@var{macro} -undef @gol
629 -Wp,@var{option} -Xpreprocessor @var{option}}
630
631 @item Assembler Options
632 @xref{Assembler Options,,Passing Options to the Assembler}.
633 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
634
635 @item Linker Options
636 @xref{Link Options,,Options for Linking}.
637 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
638 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
639 -e @var{entry} --entry=@var{entry} @gol
640 -pie -pthread -r -rdynamic @gol
641 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
642 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
643 -shared -shared-libgcc -symbolic @gol
644 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
645 -u @var{symbol} -z @var{keyword}}
646
647 @item Directory Options
648 @xref{Directory Options,,Options for Directory Search}.
649 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
650 -idirafter @var{dir} @gol
651 -imacros @var{file} -imultilib @var{dir} @gol
652 -iplugindir=@var{dir} -iprefix @var{file} @gol
653 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
654 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
655 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
656 -nostdinc -nostdinc++ --sysroot=@var{dir}}
657
658 @item Code Generation Options
659 @xref{Code Gen Options,,Options for Code Generation Conventions}.
660 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
661 -ffixed-@var{reg} -fexceptions @gol
662 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
663 -fasynchronous-unwind-tables @gol
664 -fno-gnu-unique @gol
665 -finhibit-size-directive -fcommon -fno-ident @gol
666 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
667 -fno-jump-tables -fno-bit-tests @gol
668 -frecord-gcc-switches @gol
669 -freg-struct-return -fshort-enums -fshort-wchar @gol
670 -fverbose-asm -fpack-struct[=@var{n}] @gol
671 -fleading-underscore -ftls-model=@var{model} @gol
672 -fstack-reuse=@var{reuse_level} @gol
673 -ftrampolines -ftrapv -fwrapv @gol
674 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
675 -fstrict-volatile-bitfields -fsync-libcalls}
676
677 @item Developer Options
678 @xref{Developer Options,,GCC Developer Options}.
679 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
680 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
681 -fchecking -fchecking=@var{n}
682 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
683 -fdisable-ipa-@var{pass_name} @gol
684 -fdisable-rtl-@var{pass_name} @gol
685 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
686 -fdisable-tree-@var{pass_name} @gol
687 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
688 -fdump-debug -fdump-earlydebug @gol
689 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
690 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
691 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
692 -fdump-lang-all @gol
693 -fdump-lang-@var{switch} @gol
694 -fdump-lang-@var{switch}-@var{options} @gol
695 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
696 -fdump-passes @gol
697 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
698 -fdump-statistics @gol
699 -fdump-tree-all @gol
700 -fdump-tree-@var{switch} @gol
701 -fdump-tree-@var{switch}-@var{options} @gol
702 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
703 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
704 -fenable-@var{kind}-@var{pass} @gol
705 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
706 -fira-verbose=@var{n} @gol
707 -flto-report -flto-report-wpa -fmem-report-wpa @gol
708 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
709 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
710 -fprofile-report @gol
711 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
712 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
713 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
714 -fvar-tracking-assignments-toggle -gtoggle @gol
715 -print-file-name=@var{library} -print-libgcc-file-name @gol
716 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
717 -print-prog-name=@var{program} -print-search-dirs -Q @gol
718 -print-sysroot -print-sysroot-headers-suffix @gol
719 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
720
721 @item Machine-Dependent Options
722 @xref{Submodel Options,,Machine-Dependent Options}.
723 @c This list is ordered alphanumerically by subsection name.
724 @c Try and put the significant identifier (CPU or system) first,
725 @c so users have a clue at guessing where the ones they want will be.
726
727 @emph{AArch64 Options}
728 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
729 -mgeneral-regs-only @gol
730 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
731 -mstrict-align -mno-strict-align @gol
732 -momit-leaf-frame-pointer @gol
733 -mtls-dialect=desc -mtls-dialect=traditional @gol
734 -mtls-size=@var{size} @gol
735 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
736 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
737 -mpc-relative-literal-loads @gol
738 -msign-return-address=@var{scope} @gol
739 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
740 +@var{b-key}]|@var{bti} @gol
741 -mharden-sls=@var{opts} @gol
742 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
743 -moverride=@var{string} -mverbose-cost-dump @gol
744 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
745 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
746 -moutline-atomics }
747
748 @emph{Adapteva Epiphany Options}
749 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
750 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
751 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
752 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
753 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
754 -msplit-vecmove-early -m1reg-@var{reg}}
755
756 @emph{AMD GCN Options}
757 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
758
759 @emph{ARC Options}
760 @gccoptlist{-mbarrel-shifter -mjli-always @gol
761 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
762 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
763 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
764 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
765 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
766 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
767 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
768 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
769 -mvolatile-cache -mtp-regno=@var{regno} @gol
770 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
771 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
772 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
773 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
774 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
775 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
776 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
777 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
778
779 @emph{ARM Options}
780 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
781 -mabi=@var{name} @gol
782 -mapcs-stack-check -mno-apcs-stack-check @gol
783 -mapcs-reentrant -mno-apcs-reentrant @gol
784 -mgeneral-regs-only @gol
785 -msched-prolog -mno-sched-prolog @gol
786 -mlittle-endian -mbig-endian @gol
787 -mbe8 -mbe32 @gol
788 -mfloat-abi=@var{name} @gol
789 -mfp16-format=@var{name}
790 -mthumb-interwork -mno-thumb-interwork @gol
791 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
792 -mtune=@var{name} -mprint-tune-info @gol
793 -mstructure-size-boundary=@var{n} @gol
794 -mabort-on-noreturn @gol
795 -mlong-calls -mno-long-calls @gol
796 -msingle-pic-base -mno-single-pic-base @gol
797 -mpic-register=@var{reg} @gol
798 -mnop-fun-dllimport @gol
799 -mpoke-function-name @gol
800 -mthumb -marm -mflip-thumb @gol
801 -mtpcs-frame -mtpcs-leaf-frame @gol
802 -mcaller-super-interworking -mcallee-super-interworking @gol
803 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
804 -mword-relocations @gol
805 -mfix-cortex-m3-ldrd @gol
806 -munaligned-access @gol
807 -mneon-for-64bits @gol
808 -mslow-flash-data @gol
809 -masm-syntax-unified @gol
810 -mrestrict-it @gol
811 -mverbose-cost-dump @gol
812 -mpure-code @gol
813 -mcmse @gol
814 -mfix-cmse-cve-2021-35465 @gol
815 -mfdpic}
816
817 @emph{AVR Options}
818 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
819 -mbranch-cost=@var{cost} @gol
820 -mcall-prologues -mgas-isr-prologues -mint8 @gol
821 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
822 -mn_flash=@var{size} -mno-interrupts @gol
823 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
824 -mfract-convert-truncate @gol
825 -mshort-calls -nodevicelib -nodevicespecs @gol
826 -Waddr-space-convert -Wmisspelled-isr}
827
828 @emph{Blackfin Options}
829 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
830 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
831 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
832 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
833 -mno-id-shared-library -mshared-library-id=@var{n} @gol
834 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
835 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
836 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
837 -micplb}
838
839 @emph{C6X Options}
840 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
841 -msim -msdata=@var{sdata-type}}
842
843 @emph{CRIS Options}
844 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
845 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
846 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
847 -mstack-align -mdata-align -mconst-align @gol
848 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
849 -melf -maout -melinux -mlinux -sim -sim2 @gol
850 -mmul-bug-workaround -mno-mul-bug-workaround}
851
852 @emph{CR16 Options}
853 @gccoptlist{-mmac @gol
854 -mcr16cplus -mcr16c @gol
855 -msim -mint32 -mbit-ops
856 -mdata-model=@var{model}}
857
858 @emph{C-SKY Options}
859 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
860 -mbig-endian -EB -mlittle-endian -EL @gol
861 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
862 -mfloat-abi=@var{name} @gol
863 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
864 -mdsp -medsp -mvdsp @gol
865 -mdiv -msmart -mhigh-registers -manchor @gol
866 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
867 -mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim}
868
869 @emph{Darwin Options}
870 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
871 -arch_only -bind_at_load -bundle -bundle_loader @gol
872 -client_name -compatibility_version -current_version @gol
873 -dead_strip @gol
874 -dependency-file -dylib_file -dylinker_install_name @gol
875 -dynamic -dynamiclib -exported_symbols_list @gol
876 -filelist -flat_namespace -force_cpusubtype_ALL @gol
877 -force_flat_namespace -headerpad_max_install_names @gol
878 -iframework @gol
879 -image_base -init -install_name -keep_private_externs @gol
880 -multi_module -multiply_defined -multiply_defined_unused @gol
881 -noall_load -no_dead_strip_inits_and_terms @gol
882 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
883 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
884 -private_bundle -read_only_relocs -sectalign @gol
885 -sectobjectsymbols -whyload -seg1addr @gol
886 -sectcreate -sectobjectsymbols -sectorder @gol
887 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
888 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
889 -segprot -segs_read_only_addr -segs_read_write_addr @gol
890 -single_module -static -sub_library -sub_umbrella @gol
891 -twolevel_namespace -umbrella -undefined @gol
892 -unexported_symbols_list -weak_reference_mismatches @gol
893 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
894 -mkernel -mone-byte-bool}
895
896 @emph{DEC Alpha Options}
897 @gccoptlist{-mno-fp-regs -msoft-float @gol
898 -mieee -mieee-with-inexact -mieee-conformant @gol
899 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
900 -mtrap-precision=@var{mode} -mbuild-constants @gol
901 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
902 -mbwx -mmax -mfix -mcix @gol
903 -mfloat-vax -mfloat-ieee @gol
904 -mexplicit-relocs -msmall-data -mlarge-data @gol
905 -msmall-text -mlarge-text @gol
906 -mmemory-latency=@var{time}}
907
908 @emph{eBPF Options}
909 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
910 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
911 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
912
913 @emph{FR30 Options}
914 @gccoptlist{-msmall-model -mno-lsim}
915
916 @emph{FT32 Options}
917 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
918
919 @emph{FRV Options}
920 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
921 -mhard-float -msoft-float @gol
922 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
923 -mdouble -mno-double @gol
924 -mmedia -mno-media -mmuladd -mno-muladd @gol
925 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
926 -mlinked-fp -mlong-calls -malign-labels @gol
927 -mlibrary-pic -macc-4 -macc-8 @gol
928 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
929 -moptimize-membar -mno-optimize-membar @gol
930 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
931 -mvliw-branch -mno-vliw-branch @gol
932 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
933 -mno-nested-cond-exec -mtomcat-stats @gol
934 -mTLS -mtls @gol
935 -mcpu=@var{cpu}}
936
937 @emph{GNU/Linux Options}
938 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
939 -tno-android-cc -tno-android-ld}
940
941 @emph{H8/300 Options}
942 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
943
944 @emph{HPPA Options}
945 @gccoptlist{-march=@var{architecture-type} @gol
946 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
947 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
948 -mfixed-range=@var{register-range} @gol
949 -mjump-in-delay -mlinker-opt -mlong-calls @gol
950 -mlong-load-store -mno-disable-fpregs @gol
951 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
952 -mno-jump-in-delay -mno-long-load-store @gol
953 -mno-portable-runtime -mno-soft-float @gol
954 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
955 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
956 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
957 -munix=@var{unix-std} -nolibdld -static -threads}
958
959 @emph{IA-64 Options}
960 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
961 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
962 -mconstant-gp -mauto-pic -mfused-madd @gol
963 -minline-float-divide-min-latency @gol
964 -minline-float-divide-max-throughput @gol
965 -mno-inline-float-divide @gol
966 -minline-int-divide-min-latency @gol
967 -minline-int-divide-max-throughput @gol
968 -mno-inline-int-divide @gol
969 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
970 -mno-inline-sqrt @gol
971 -mdwarf2-asm -mearly-stop-bits @gol
972 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
973 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
974 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
975 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
976 -msched-spec-ldc -msched-spec-control-ldc @gol
977 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
978 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
979 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
980 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
981
982 @emph{LM32 Options}
983 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
984 -msign-extend-enabled -muser-enabled}
985
986 @emph{M32R/D Options}
987 @gccoptlist{-m32r2 -m32rx -m32r @gol
988 -mdebug @gol
989 -malign-loops -mno-align-loops @gol
990 -missue-rate=@var{number} @gol
991 -mbranch-cost=@var{number} @gol
992 -mmodel=@var{code-size-model-type} @gol
993 -msdata=@var{sdata-type} @gol
994 -mno-flush-func -mflush-func=@var{name} @gol
995 -mno-flush-trap -mflush-trap=@var{number} @gol
996 -G @var{num}}
997
998 @emph{M32C Options}
999 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
1000
1001 @emph{M680x0 Options}
1002 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
1003 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
1004 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
1005 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
1006 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
1007 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
1008 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
1009 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
1010 -mxgot -mno-xgot -mlong-jump-table-offsets}
1011
1012 @emph{MCore Options}
1013 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
1014 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
1015 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
1016 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
1017 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
1018
1019 @emph{MeP Options}
1020 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
1021 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
1022 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
1023 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
1024 -mtiny=@var{n}}
1025
1026 @emph{MicroBlaze Options}
1027 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
1028 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
1029 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
1030 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
1031 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
1032 -mpic-data-is-text-relative}
1033
1034 @emph{MIPS Options}
1035 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
1036 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
1037 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
1038 -mips16 -mno-mips16 -mflip-mips16 @gol
1039 -minterlink-compressed -mno-interlink-compressed @gol
1040 -minterlink-mips16 -mno-interlink-mips16 @gol
1041 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
1042 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
1043 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1044 -mno-float -msingle-float -mdouble-float @gol
1045 -modd-spreg -mno-odd-spreg @gol
1046 -mabs=@var{mode} -mnan=@var{encoding} @gol
1047 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1048 -mmcu -mmno-mcu @gol
1049 -meva -mno-eva @gol
1050 -mvirt -mno-virt @gol
1051 -mxpa -mno-xpa @gol
1052 -mcrc -mno-crc @gol
1053 -mginv -mno-ginv @gol
1054 -mmicromips -mno-micromips @gol
1055 -mmsa -mno-msa @gol
1056 -mloongson-mmi -mno-loongson-mmi @gol
1057 -mloongson-ext -mno-loongson-ext @gol
1058 -mloongson-ext2 -mno-loongson-ext2 @gol
1059 -mfpu=@var{fpu-type} @gol
1060 -msmartmips -mno-smartmips @gol
1061 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1062 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1063 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1064 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1065 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1066 -membedded-data -mno-embedded-data @gol
1067 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1068 -mcode-readable=@var{setting} @gol
1069 -msplit-addresses -mno-split-addresses @gol
1070 -mexplicit-relocs -mno-explicit-relocs @gol
1071 -mcheck-zero-division -mno-check-zero-division @gol
1072 -mdivide-traps -mdivide-breaks @gol
1073 -mload-store-pairs -mno-load-store-pairs @gol
1074 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1075 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1076 -mfix-24k -mno-fix-24k @gol
1077 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1078 -mfix-r5900 -mno-fix-r5900 @gol
1079 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1080 -mfix-vr4120 -mno-fix-vr4120 @gol
1081 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1082 -mflush-func=@var{func} -mno-flush-func @gol
1083 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1084 -mcompact-branches=@var{policy} @gol
1085 -mfp-exceptions -mno-fp-exceptions @gol
1086 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1087 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1088 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1089 -mframe-header-opt -mno-frame-header-opt}
1090
1091 @emph{MMIX Options}
1092 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1093 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1094 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1095 -mno-base-addresses -msingle-exit -mno-single-exit}
1096
1097 @emph{MN10300 Options}
1098 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1099 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1100 -mtune=@var{cpu-type} @gol
1101 -mreturn-pointer-on-d0 @gol
1102 -mno-crt0 -mrelax -mliw -msetlb}
1103
1104 @emph{Moxie Options}
1105 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1106
1107 @emph{MSP430 Options}
1108 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1109 -mwarn-mcu @gol
1110 -mcode-region= -mdata-region= @gol
1111 -msilicon-errata= -msilicon-errata-warn= @gol
1112 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1113
1114 @emph{NDS32 Options}
1115 @gccoptlist{-mbig-endian -mlittle-endian @gol
1116 -mreduced-regs -mfull-regs @gol
1117 -mcmov -mno-cmov @gol
1118 -mext-perf -mno-ext-perf @gol
1119 -mext-perf2 -mno-ext-perf2 @gol
1120 -mext-string -mno-ext-string @gol
1121 -mv3push -mno-v3push @gol
1122 -m16bit -mno-16bit @gol
1123 -misr-vector-size=@var{num} @gol
1124 -mcache-block-size=@var{num} @gol
1125 -march=@var{arch} @gol
1126 -mcmodel=@var{code-model} @gol
1127 -mctor-dtor -mrelax}
1128
1129 @emph{Nios II Options}
1130 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1131 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1132 -mel -meb @gol
1133 -mno-bypass-cache -mbypass-cache @gol
1134 -mno-cache-volatile -mcache-volatile @gol
1135 -mno-fast-sw-div -mfast-sw-div @gol
1136 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1137 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1138 -mcustom-fpu-cfg=@var{name} @gol
1139 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1140 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1141
1142 @emph{Nvidia PTX Options}
1143 @gccoptlist{-m64 -mmainkernel -moptimize}
1144
1145 @emph{OpenRISC Options}
1146 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1147 -msoft-mul -msoft-div @gol
1148 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1149 -mcmov -mror -mrori -msext -msfimm -mshftimm @gol
1150 -mcmodel=@var{code-model}}
1151
1152 @emph{PDP-11 Options}
1153 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1154 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1155 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1156
1157 @emph{picoChip Options}
1158 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1159 -msymbol-as-address -mno-inefficient-warnings}
1160
1161 @emph{PowerPC Options}
1162 See RS/6000 and PowerPC Options.
1163
1164 @emph{PRU Options}
1165 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1166 -mabi=@var{variant} @gol}
1167
1168 @emph{RISC-V Options}
1169 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1170 -mplt -mno-plt @gol
1171 -mabi=@var{ABI-string} @gol
1172 -mfdiv -mno-fdiv @gol
1173 -mdiv -mno-div @gol
1174 -march=@var{ISA-string} @gol
1175 -mtune=@var{processor-string} @gol
1176 -mpreferred-stack-boundary=@var{num} @gol
1177 -msmall-data-limit=@var{N-bytes} @gol
1178 -msave-restore -mno-save-restore @gol
1179 -mshorten-memrefs -mno-shorten-memrefs @gol
1180 -mstrict-align -mno-strict-align @gol
1181 -mcmodel=medlow -mcmodel=medany @gol
1182 -mexplicit-relocs -mno-explicit-relocs @gol
1183 -mrelax -mno-relax @gol
1184 -mriscv-attribute -mmo-riscv-attribute @gol
1185 -malign-data=@var{type} @gol
1186 -mbig-endian -mlittle-endian @gol
1187 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1188 -mstack-protector-guard-offset=@var{offset}}
1189
1190 @emph{RL78 Options}
1191 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1192 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1193 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1194
1195 @emph{RS/6000 and PowerPC Options}
1196 @gccoptlist{-mcpu=@var{cpu-type} @gol
1197 -mtune=@var{cpu-type} @gol
1198 -mcmodel=@var{code-model} @gol
1199 -mpowerpc64 @gol
1200 -maltivec -mno-altivec @gol
1201 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1202 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1203 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1204 -mfprnd -mno-fprnd @gol
1205 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1206 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1207 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1208 -malign-power -malign-natural @gol
1209 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1210 -mupdate -mno-update @gol
1211 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1212 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1213 -mstrict-align -mno-strict-align -mrelocatable @gol
1214 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1215 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1216 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1217 -mprioritize-restricted-insns=@var{priority} @gol
1218 -msched-costly-dep=@var{dependence_type} @gol
1219 -minsert-sched-nops=@var{scheme} @gol
1220 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1221 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1222 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1223 -mtraceback=@var{traceback_type} @gol
1224 -maix-struct-return -msvr4-struct-return @gol
1225 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1226 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1227 -mblock-move-inline-limit=@var{num} @gol
1228 -mblock-compare-inline-limit=@var{num} @gol
1229 -mblock-compare-inline-loop-limit=@var{num} @gol
1230 -mno-block-ops-unaligned-vsx @gol
1231 -mstring-compare-inline-limit=@var{num} @gol
1232 -misel -mno-isel @gol
1233 -mvrsave -mno-vrsave @gol
1234 -mmulhw -mno-mulhw @gol
1235 -mdlmzb -mno-dlmzb @gol
1236 -mprototype -mno-prototype @gol
1237 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1238 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1239 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1240 -mno-recip-precision @gol
1241 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1242 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1243 -msave-toc-indirect -mno-save-toc-indirect @gol
1244 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1245 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1246 -mquad-memory -mno-quad-memory @gol
1247 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1248 -mcompat-align-parm -mno-compat-align-parm @gol
1249 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1250 -mgnu-attribute -mno-gnu-attribute @gol
1251 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1252 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1253 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1254 -mprivileged -mno-privileged}
1255
1256 @emph{RX Options}
1257 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1258 -mcpu=@gol
1259 -mbig-endian-data -mlittle-endian-data @gol
1260 -msmall-data @gol
1261 -msim -mno-sim@gol
1262 -mas100-syntax -mno-as100-syntax@gol
1263 -mrelax@gol
1264 -mmax-constant-size=@gol
1265 -mint-register=@gol
1266 -mpid@gol
1267 -mallow-string-insns -mno-allow-string-insns@gol
1268 -mjsr@gol
1269 -mno-warn-multiple-fast-interrupts@gol
1270 -msave-acc-in-interrupts}
1271
1272 @emph{S/390 and zSeries Options}
1273 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1274 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1275 -mlong-double-64 -mlong-double-128 @gol
1276 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1277 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1278 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1279 -mhtm -mvx -mzvector @gol
1280 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1281 -mfused-madd -mno-fused-madd @gol
1282 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1283 -mhotpatch=@var{halfwords},@var{halfwords}}
1284
1285 @emph{Score Options}
1286 @gccoptlist{-meb -mel @gol
1287 -mnhwloop @gol
1288 -muls @gol
1289 -mmac @gol
1290 -mscore5 -mscore5u -mscore7 -mscore7d}
1291
1292 @emph{SH Options}
1293 @gccoptlist{-m1 -m2 -m2e @gol
1294 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1295 -m3 -m3e @gol
1296 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1297 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1298 -mb -ml -mdalign -mrelax @gol
1299 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1300 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1301 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1302 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1303 -maccumulate-outgoing-args @gol
1304 -matomic-model=@var{atomic-model} @gol
1305 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1306 -mcbranch-force-delay-slot @gol
1307 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1308 -mpretend-cmove -mtas}
1309
1310 @emph{Solaris 2 Options}
1311 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1312 -pthreads}
1313
1314 @emph{SPARC Options}
1315 @gccoptlist{-mcpu=@var{cpu-type} @gol
1316 -mtune=@var{cpu-type} @gol
1317 -mcmodel=@var{code-model} @gol
1318 -mmemory-model=@var{mem-model} @gol
1319 -m32 -m64 -mapp-regs -mno-app-regs @gol
1320 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1321 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1322 -mhard-quad-float -msoft-quad-float @gol
1323 -mstack-bias -mno-stack-bias @gol
1324 -mstd-struct-return -mno-std-struct-return @gol
1325 -munaligned-doubles -mno-unaligned-doubles @gol
1326 -muser-mode -mno-user-mode @gol
1327 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1328 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1329 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1330 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1331 -mpopc -mno-popc -msubxc -mno-subxc @gol
1332 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1333 -mlra -mno-lra}
1334
1335 @emph{System V Options}
1336 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1337
1338 @emph{TILE-Gx Options}
1339 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1340 -mcmodel=@var{code-model}}
1341
1342 @emph{TILEPro Options}
1343 @gccoptlist{-mcpu=@var{cpu} -m32}
1344
1345 @emph{V850 Options}
1346 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1347 -mprolog-function -mno-prolog-function -mspace @gol
1348 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1349 -mapp-regs -mno-app-regs @gol
1350 -mdisable-callt -mno-disable-callt @gol
1351 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1352 -mv850e -mv850 -mv850e3v5 @gol
1353 -mloop @gol
1354 -mrelax @gol
1355 -mlong-jumps @gol
1356 -msoft-float @gol
1357 -mhard-float @gol
1358 -mgcc-abi @gol
1359 -mrh850-abi @gol
1360 -mbig-switch}
1361
1362 @emph{VAX Options}
1363 @gccoptlist{-mg -mgnu -munix}
1364
1365 @emph{Visium Options}
1366 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1367 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1368
1369 @emph{VMS Options}
1370 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1371 -mpointer-size=@var{size}}
1372
1373 @emph{VxWorks Options}
1374 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1375 -Xbind-lazy -Xbind-now}
1376
1377 @emph{x86 Options}
1378 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1379 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1380 -mfpmath=@var{unit} @gol
1381 -masm=@var{dialect} -mno-fancy-math-387 @gol
1382 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1383 -mno-wide-multiply -mrtd -malign-double @gol
1384 -mpreferred-stack-boundary=@var{num} @gol
1385 -mincoming-stack-boundary=@var{num} @gol
1386 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait @gol
1387 -mrecip -mrecip=@var{opt} @gol
1388 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1389 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1390 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1391 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1392 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1393 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1394 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1395 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1396 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1397 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1398 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1399 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1400 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1401 -mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1402 -mavx512fp16 @gol
1403 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1404 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1405 -mkl -mwidekl @gol
1406 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1407 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1408 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1409 -mregparm=@var{num} -msseregparm @gol
1410 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1411 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1412 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1413 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1414 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1415 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1416 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1417 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1418 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1419 -mstack-protector-guard-reg=@var{reg} @gol
1420 -mstack-protector-guard-offset=@var{offset} @gol
1421 -mstack-protector-guard-symbol=@var{symbol} @gol
1422 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1423 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1424 -mindirect-branch-register -mneeded}
1425
1426 @emph{x86 Windows Options}
1427 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1428 -mnop-fun-dllimport -mthread @gol
1429 -municode -mwin32 -mwindows -fno-set-stack-executable}
1430
1431 @emph{Xstormy16 Options}
1432 @gccoptlist{-msim}
1433
1434 @emph{Xtensa Options}
1435 @gccoptlist{-mconst16 -mno-const16 @gol
1436 -mfused-madd -mno-fused-madd @gol
1437 -mforce-no-pic @gol
1438 -mserialize-volatile -mno-serialize-volatile @gol
1439 -mtext-section-literals -mno-text-section-literals @gol
1440 -mauto-litpools -mno-auto-litpools @gol
1441 -mtarget-align -mno-target-align @gol
1442 -mlongcalls -mno-longcalls @gol
1443 -mabi=@var{abi-type}}
1444
1445 @emph{zSeries Options}
1446 See S/390 and zSeries Options.
1447 @end table
1448
1449
1450 @node Overall Options
1451 @section Options Controlling the Kind of Output
1452
1453 Compilation can involve up to four stages: preprocessing, compilation
1454 proper, assembly and linking, always in that order. GCC is capable of
1455 preprocessing and compiling several files either into several
1456 assembler input files, or into one assembler input file; then each
1457 assembler input file produces an object file, and linking combines all
1458 the object files (those newly compiled, and those specified as input)
1459 into an executable file.
1460
1461 @cindex file name suffix
1462 For any given input file, the file name suffix determines what kind of
1463 compilation is done:
1464
1465 @table @gcctabopt
1466 @item @var{file}.c
1467 C source code that must be preprocessed.
1468
1469 @item @var{file}.i
1470 C source code that should not be preprocessed.
1471
1472 @item @var{file}.ii
1473 C++ source code that should not be preprocessed.
1474
1475 @item @var{file}.m
1476 Objective-C source code. Note that you must link with the @file{libobjc}
1477 library to make an Objective-C program work.
1478
1479 @item @var{file}.mi
1480 Objective-C source code that should not be preprocessed.
1481
1482 @item @var{file}.mm
1483 @itemx @var{file}.M
1484 Objective-C++ source code. Note that you must link with the @file{libobjc}
1485 library to make an Objective-C++ program work. Note that @samp{.M} refers
1486 to a literal capital M@.
1487
1488 @item @var{file}.mii
1489 Objective-C++ source code that should not be preprocessed.
1490
1491 @item @var{file}.h
1492 C, C++, Objective-C or Objective-C++ header file to be turned into a
1493 precompiled header (default), or C, C++ header file to be turned into an
1494 Ada spec (via the @option{-fdump-ada-spec} switch).
1495
1496 @item @var{file}.cc
1497 @itemx @var{file}.cp
1498 @itemx @var{file}.cxx
1499 @itemx @var{file}.cpp
1500 @itemx @var{file}.CPP
1501 @itemx @var{file}.c++
1502 @itemx @var{file}.C
1503 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1504 the last two letters must both be literally @samp{x}. Likewise,
1505 @samp{.C} refers to a literal capital C@.
1506
1507 @item @var{file}.mm
1508 @itemx @var{file}.M
1509 Objective-C++ source code that must be preprocessed.
1510
1511 @item @var{file}.mii
1512 Objective-C++ source code that should not be preprocessed.
1513
1514 @item @var{file}.hh
1515 @itemx @var{file}.H
1516 @itemx @var{file}.hp
1517 @itemx @var{file}.hxx
1518 @itemx @var{file}.hpp
1519 @itemx @var{file}.HPP
1520 @itemx @var{file}.h++
1521 @itemx @var{file}.tcc
1522 C++ header file to be turned into a precompiled header or Ada spec.
1523
1524 @item @var{file}.f
1525 @itemx @var{file}.for
1526 @itemx @var{file}.ftn
1527 Fixed form Fortran source code that should not be preprocessed.
1528
1529 @item @var{file}.F
1530 @itemx @var{file}.FOR
1531 @itemx @var{file}.fpp
1532 @itemx @var{file}.FPP
1533 @itemx @var{file}.FTN
1534 Fixed form Fortran source code that must be preprocessed (with the traditional
1535 preprocessor).
1536
1537 @item @var{file}.f90
1538 @itemx @var{file}.f95
1539 @itemx @var{file}.f03
1540 @itemx @var{file}.f08
1541 Free form Fortran source code that should not be preprocessed.
1542
1543 @item @var{file}.F90
1544 @itemx @var{file}.F95
1545 @itemx @var{file}.F03
1546 @itemx @var{file}.F08
1547 Free form Fortran source code that must be preprocessed (with the
1548 traditional preprocessor).
1549
1550 @item @var{file}.go
1551 Go source code.
1552
1553 @item @var{file}.d
1554 D source code.
1555
1556 @item @var{file}.di
1557 D interface file.
1558
1559 @item @var{file}.dd
1560 D documentation code (Ddoc).
1561
1562 @item @var{file}.ads
1563 Ada source code file that contains a library unit declaration (a
1564 declaration of a package, subprogram, or generic, or a generic
1565 instantiation), or a library unit renaming declaration (a package,
1566 generic, or subprogram renaming declaration). Such files are also
1567 called @dfn{specs}.
1568
1569 @item @var{file}.adb
1570 Ada source code file containing a library unit body (a subprogram or
1571 package body). Such files are also called @dfn{bodies}.
1572
1573 @c GCC also knows about some suffixes for languages not yet included:
1574 @c Ratfor:
1575 @c @var{file}.r
1576
1577 @item @var{file}.s
1578 Assembler code.
1579
1580 @item @var{file}.S
1581 @itemx @var{file}.sx
1582 Assembler code that must be preprocessed.
1583
1584 @item @var{other}
1585 An object file to be fed straight into linking.
1586 Any file name with no recognized suffix is treated this way.
1587 @end table
1588
1589 @opindex x
1590 You can specify the input language explicitly with the @option{-x} option:
1591
1592 @table @gcctabopt
1593 @item -x @var{language}
1594 Specify explicitly the @var{language} for the following input files
1595 (rather than letting the compiler choose a default based on the file
1596 name suffix). This option applies to all following input files until
1597 the next @option{-x} option. Possible values for @var{language} are:
1598 @smallexample
1599 c c-header cpp-output
1600 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1601 objective-c objective-c-header objective-c-cpp-output
1602 objective-c++ objective-c++-header objective-c++-cpp-output
1603 assembler assembler-with-cpp
1604 ada
1605 d
1606 f77 f77-cpp-input f95 f95-cpp-input
1607 go
1608 @end smallexample
1609
1610 @item -x none
1611 Turn off any specification of a language, so that subsequent files are
1612 handled according to their file name suffixes (as they are if @option{-x}
1613 has not been used at all).
1614 @end table
1615
1616 If you only want some of the stages of compilation, you can use
1617 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1618 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1619 @command{gcc} is to stop. Note that some combinations (for example,
1620 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1621
1622 @table @gcctabopt
1623 @item -c
1624 @opindex c
1625 Compile or assemble the source files, but do not link. The linking
1626 stage simply is not done. The ultimate output is in the form of an
1627 object file for each source file.
1628
1629 By default, the object file name for a source file is made by replacing
1630 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1631
1632 Unrecognized input files, not requiring compilation or assembly, are
1633 ignored.
1634
1635 @item -S
1636 @opindex S
1637 Stop after the stage of compilation proper; do not assemble. The output
1638 is in the form of an assembler code file for each non-assembler input
1639 file specified.
1640
1641 By default, the assembler file name for a source file is made by
1642 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1643
1644 Input files that don't require compilation are ignored.
1645
1646 @item -E
1647 @opindex E
1648 Stop after the preprocessing stage; do not run the compiler proper. The
1649 output is in the form of preprocessed source code, which is sent to the
1650 standard output.
1651
1652 Input files that don't require preprocessing are ignored.
1653
1654 @cindex output file option
1655 @item -o @var{file}
1656 @opindex o
1657 Place the primary output in file @var{file}. This applies to whatever
1658 sort of output is being produced, whether it be an executable file, an
1659 object file, an assembler file or preprocessed C code.
1660
1661 If @option{-o} is not specified, the default is to put an executable
1662 file in @file{a.out}, the object file for
1663 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1664 assembler file in @file{@var{source}.s}, a precompiled header file in
1665 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1666 standard output.
1667
1668 Though @option{-o} names only the primary output, it also affects the
1669 naming of auxiliary and dump outputs. See the examples below. Unless
1670 overridden, both auxiliary outputs and dump outputs are placed in the
1671 same directory as the primary output. In auxiliary outputs, the suffix
1672 of the input file is replaced with that of the auxiliary output file
1673 type; in dump outputs, the suffix of the dump file is appended to the
1674 input file suffix. In compilation commands, the base name of both
1675 auxiliary and dump outputs is that of the primary output; in compile and
1676 link commands, the primary output name, minus the executable suffix, is
1677 combined with the input file name. If both share the same base name,
1678 disregarding the suffix, the result of the combination is that base
1679 name, otherwise, they are concatenated, separated by a dash.
1680
1681 @smallexample
1682 gcc -c foo.c ...
1683 @end smallexample
1684
1685 will use @file{foo.o} as the primary output, and place aux outputs and
1686 dumps next to it, e.g., aux file @file{foo.dwo} for
1687 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1688 @option{-fdump-rtl-final}.
1689
1690 If a non-linker output file is explicitly specified, aux and dump files
1691 by default take the same base name:
1692
1693 @smallexample
1694 gcc -c foo.c -o dir/foobar.o ...
1695 @end smallexample
1696
1697 will name aux outputs @file{dir/foobar.*} and dump outputs
1698 @file{dir/foobar.c.*}.
1699
1700 A linker output will instead prefix aux and dump outputs:
1701
1702 @smallexample
1703 gcc foo.c bar.c -o dir/foobar ...
1704 @end smallexample
1705
1706 will generally name aux outputs @file{dir/foobar-foo.*} and
1707 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1708 @file{dir/foobar-bar.c.*}.
1709
1710 The one exception to the above is when the executable shares the base
1711 name with the single input:
1712
1713 @smallexample
1714 gcc foo.c -o dir/foo ...
1715 @end smallexample
1716
1717 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1718 named @file{dir/foo.c.*}.
1719
1720 The location and the names of auxiliary and dump outputs can be adjusted
1721 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1722 @option{-dumpdir}, @option{-save-temps=cwd}, and
1723 @option{-save-temps=obj}.
1724
1725
1726 @item -dumpbase @var{dumpbase}
1727 @opindex dumpbase
1728 This option sets the base name for auxiliary and dump output files. It
1729 does not affect the name of the primary output file. Intermediate
1730 outputs, when preserved, are not regarded as primary outputs, but as
1731 auxiliary outputs:
1732
1733 @smallexample
1734 gcc -save-temps -S foo.c
1735 @end smallexample
1736
1737 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1738 then compiles to the (implied) output file @file{foo.s}, whereas:
1739
1740 @smallexample
1741 gcc -save-temps -dumpbase save-foo -c foo.c
1742 @end smallexample
1743
1744 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1745 an intermediate, thus auxiliary output), and then assembles to the
1746 (implied) output file @file{foo.o}.
1747
1748 Absent this option, dump and aux files take their names from the input
1749 file, or from the (non-linker) output file, if one is explicitly
1750 specified: dump output files (e.g. those requested by @option{-fdump-*}
1751 options) with the input name suffix, and aux output files (those
1752 requested by other non-dump options, e.g. @code{-save-temps},
1753 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1754
1755 Similar suffix differentiation of dump and aux outputs can be attained
1756 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1757 @option{-dumpbase-ext .suf}.
1758
1759 If @var{dumpbase} is explicitly specified with any directory component,
1760 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1761 @option{-save-temps=*}) is ignored, and instead of appending to it,
1762 @var{dumpbase} fully overrides it:
1763
1764 @smallexample
1765 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1766 -dumpdir pfx- -save-temps=cwd ...
1767 @end smallexample
1768
1769 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1770 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1771 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1772
1773 When @option{-dumpbase} is specified in a command that compiles multiple
1774 inputs, or that compiles and then links, it may be combined with
1775 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1776 file is compiled using the combined @var{dumppfx}, and default values
1777 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1778 file:
1779
1780 @smallexample
1781 gcc foo.c bar.c -c -dumpbase main ...
1782 @end smallexample
1783
1784 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1785 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1786 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1787 and @file{main-bar.*}.
1788
1789 An empty string specified as @var{dumpbase} avoids the influence of the
1790 output basename in the naming of auxiliary and dump outputs during
1791 compilation, computing default values :
1792
1793 @smallexample
1794 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1795 @end smallexample
1796
1797 will name aux outputs @file{dir/foo.*} and dump outputs
1798 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1799 name, but the directory still defaults to that of the output.
1800
1801 The empty-string dumpbase does not prevent the use of the output
1802 basename for outputs during linking:
1803
1804 @smallexample
1805 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1806 @end smallexample
1807
1808 The compilation of the source files will name auxiliary outputs
1809 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1810 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1811 linking will use @file{dir/foobar.} as the prefix for dumps and
1812 auxiliary files.
1813
1814
1815 @item -dumpbase-ext @var{auxdropsuf}
1816 @opindex dumpbase-ext
1817 When forming the name of an auxiliary (but not a dump) output file, drop
1818 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1819 suffixes. If not specified, this option defaults to the suffix of a
1820 default @var{dumpbase}, i.e., the suffix of the input file when
1821 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1822 is combined with @var{dumppfx}.
1823
1824 @smallexample
1825 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1826 @end smallexample
1827
1828 creates @file{dir/foo.o} as the main output, and generates auxiliary
1829 outputs in @file{dir/x-foo.*}, taking the location of the primary
1830 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1831 outputs retain the suffix: @file{dir/x-foo.c.*}.
1832
1833 This option is disregarded if it does not match the suffix of a
1834 specified @var{dumpbase}, except as an alternative to the executable
1835 suffix when appending the linker output base name to @var{dumppfx}, as
1836 specified below:
1837
1838 @smallexample
1839 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1840 @end smallexample
1841
1842 creates @file{main.out} as the primary output, and avoids overwriting
1843 the auxiliary and dump outputs by using the executable name minus
1844 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1845 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1846 @file{main-foo.c.*} and @file{main-bar.c.*}.
1847
1848
1849 @item -dumpdir @var{dumppfx}
1850 @opindex dumpdir
1851 When forming the name of an auxiliary or dump output file, use
1852 @var{dumppfx} as a prefix:
1853
1854 @smallexample
1855 gcc -dumpdir pfx- -c foo.c ...
1856 @end smallexample
1857
1858 creates @file{foo.o} as the primary output, and auxiliary outputs named
1859 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1860 @var{dumpbase} derived from the default primary output, derived in turn
1861 from the input name. Dump outputs also take the input name suffix:
1862 @file{pfx-foo.c.*}.
1863
1864 If @var{dumppfx} is to be used as a directory name, it must end with a
1865 directory separator:
1866
1867 @smallexample
1868 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1869 @end smallexample
1870
1871 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1872 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1873 default @var{dumpbase} derived from the primary output name. Dump
1874 outputs also take the input name suffix: @file{dir/bar.c.*}.
1875
1876 It defaults to the location of the output file; options
1877 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1878 default, just like an explicit @option{-dumpdir} option. In case
1879 multiple such options are given, the last one prevails:
1880
1881 @smallexample
1882 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1883 @end smallexample
1884
1885 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1886 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1887 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1888 default for @option{-save-temps}, nor that the output directory is
1889 implicitly the current directory. Dump outputs are named
1890 @file{foo.c.*}.
1891
1892 When compiling from multiple input files, if @option{-dumpbase} is
1893 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1894 are appended to (or override, if containing any directory components) an
1895 explicit or defaulted @var{dumppfx}, so that each of the multiple
1896 compilations gets differently-named aux and dump outputs.
1897
1898 @smallexample
1899 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1900 @end smallexample
1901
1902 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1903 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1904 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1905 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1906 single-input compilation:
1907
1908 @smallexample
1909 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1910 @end smallexample
1911
1912 that, applying @option{-dumpbase} to a single source, does not compute
1913 and append a separate @var{dumpbase} per input file. Its auxiliary and
1914 dump outputs go in @file{dir/pfx-main.*}.
1915
1916 When compiling and then linking from multiple input files, a defaulted
1917 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1918 transformation above (e.g. the compilation of @file{foo.c} and
1919 @file{bar.c} above, but without @option{-c}). If neither
1920 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1921 base name, minus @var{auxdropsuf}, if specified, or the executable
1922 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1923 instead. Note, however, that unlike earlier cases of linking:
1924
1925 @smallexample
1926 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1927 @end smallexample
1928
1929 does not append the output name @file{main} to @var{dumppfx}, because
1930 @option{-dumpdir} is explicitly specified. The goal is that the
1931 explicitly-specified @var{dumppfx} may contain the specified output name
1932 as part of the prefix, if desired; only an explicitly-specified
1933 @option{-dumpbase} would be combined with it, in order to avoid simply
1934 discarding a meaningful option.
1935
1936 When compiling and then linking from a single input file, the linker
1937 output base name will only be appended to the default @var{dumppfx} as
1938 above if it does not share the base name with the single input file
1939 name. This has been covered in single-input linking cases above, but
1940 not with an explicit @option{-dumpdir} that inhibits the combination,
1941 even if overridden by @option{-save-temps=*}:
1942
1943 @smallexample
1944 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1945 @end smallexample
1946
1947 Auxiliary outputs are named @file{foo.*}, and dump outputs
1948 @file{foo.c.*}, in the current working directory as ultimately requested
1949 by @option{-save-temps=cwd}.
1950
1951 Summing it all up for an intuitive though slightly imprecise data flow:
1952 the primary output name is broken into a directory part and a basename
1953 part; @var{dumppfx} is set to the former, unless overridden by
1954 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1955 to the latter, unless overriden by @option{-dumpbase}. If there are
1956 multiple inputs or linking, this @var{dumpbase} may be combined with
1957 @var{dumppfx} and taken from each input file. Auxiliary output names
1958 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1959 minus suffix, and the auxiliary output suffix; dump output names are
1960 only different in that the suffix from @var{dumpbase} is retained.
1961
1962 When it comes to auxiliary and dump outputs created during LTO
1963 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1964 given or as derived from the linker output name but not from inputs,
1965 even in cases in which this combination would not otherwise be used as
1966 such, is passed down with a trailing period replacing the compiler-added
1967 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1968 being involved in linking, this program does not normally get any
1969 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1970
1971 When running sub-compilers, @command{lto-wrapper} appends LTO stage
1972 names to the received @var{dumppfx}, ensures it contains a directory
1973 component so that it overrides any @option{-dumpdir}, and passes that as
1974 @option{-dumpbase} to sub-compilers.
1975
1976 @item -v
1977 @opindex v
1978 Print (on standard error output) the commands executed to run the stages
1979 of compilation. Also print the version number of the compiler driver
1980 program and of the preprocessor and the compiler proper.
1981
1982 @item -###
1983 @opindex ###
1984 Like @option{-v} except the commands are not executed and arguments
1985 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1986 This is useful for shell scripts to capture the driver-generated command lines.
1987
1988 @item --help
1989 @opindex help
1990 Print (on the standard output) a description of the command-line options
1991 understood by @command{gcc}. If the @option{-v} option is also specified
1992 then @option{--help} is also passed on to the various processes
1993 invoked by @command{gcc}, so that they can display the command-line options
1994 they accept. If the @option{-Wextra} option has also been specified
1995 (prior to the @option{--help} option), then command-line options that
1996 have no documentation associated with them are also displayed.
1997
1998 @item --target-help
1999 @opindex target-help
2000 Print (on the standard output) a description of target-specific command-line
2001 options for each tool. For some targets extra target-specific
2002 information may also be printed.
2003
2004 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2005 Print (on the standard output) a description of the command-line
2006 options understood by the compiler that fit into all specified classes
2007 and qualifiers. These are the supported classes:
2008
2009 @table @asis
2010 @item @samp{optimizers}
2011 Display all of the optimization options supported by the
2012 compiler.
2013
2014 @item @samp{warnings}
2015 Display all of the options controlling warning messages
2016 produced by the compiler.
2017
2018 @item @samp{target}
2019 Display target-specific options. Unlike the
2020 @option{--target-help} option however, target-specific options of the
2021 linker and assembler are not displayed. This is because those
2022 tools do not currently support the extended @option{--help=} syntax.
2023
2024 @item @samp{params}
2025 Display the values recognized by the @option{--param}
2026 option.
2027
2028 @item @var{language}
2029 Display the options supported for @var{language}, where
2030 @var{language} is the name of one of the languages supported in this
2031 version of GCC@. If an option is supported by all languages, one needs
2032 to select @samp{common} class.
2033
2034 @item @samp{common}
2035 Display the options that are common to all languages.
2036 @end table
2037
2038 These are the supported qualifiers:
2039
2040 @table @asis
2041 @item @samp{undocumented}
2042 Display only those options that are undocumented.
2043
2044 @item @samp{joined}
2045 Display options taking an argument that appears after an equal
2046 sign in the same continuous piece of text, such as:
2047 @samp{--help=target}.
2048
2049 @item @samp{separate}
2050 Display options taking an argument that appears as a separate word
2051 following the original option, such as: @samp{-o output-file}.
2052 @end table
2053
2054 Thus for example to display all the undocumented target-specific
2055 switches supported by the compiler, use:
2056
2057 @smallexample
2058 --help=target,undocumented
2059 @end smallexample
2060
2061 The sense of a qualifier can be inverted by prefixing it with the
2062 @samp{^} character, so for example to display all binary warning
2063 options (i.e., ones that are either on or off and that do not take an
2064 argument) that have a description, use:
2065
2066 @smallexample
2067 --help=warnings,^joined,^undocumented
2068 @end smallexample
2069
2070 The argument to @option{--help=} should not consist solely of inverted
2071 qualifiers.
2072
2073 Combining several classes is possible, although this usually
2074 restricts the output so much that there is nothing to display. One
2075 case where it does work, however, is when one of the classes is
2076 @var{target}. For example, to display all the target-specific
2077 optimization options, use:
2078
2079 @smallexample
2080 --help=target,optimizers
2081 @end smallexample
2082
2083 The @option{--help=} option can be repeated on the command line. Each
2084 successive use displays its requested class of options, skipping
2085 those that have already been displayed. If @option{--help} is also
2086 specified anywhere on the command line then this takes precedence
2087 over any @option{--help=} option.
2088
2089 If the @option{-Q} option appears on the command line before the
2090 @option{--help=} option, then the descriptive text displayed by
2091 @option{--help=} is changed. Instead of describing the displayed
2092 options, an indication is given as to whether the option is enabled,
2093 disabled or set to a specific value (assuming that the compiler
2094 knows this at the point where the @option{--help=} option is used).
2095
2096 Here is a truncated example from the ARM port of @command{gcc}:
2097
2098 @smallexample
2099 % gcc -Q -mabi=2 --help=target -c
2100 The following options are target specific:
2101 -mabi= 2
2102 -mabort-on-noreturn [disabled]
2103 -mapcs [disabled]
2104 @end smallexample
2105
2106 The output is sensitive to the effects of previous command-line
2107 options, so for example it is possible to find out which optimizations
2108 are enabled at @option{-O2} by using:
2109
2110 @smallexample
2111 -Q -O2 --help=optimizers
2112 @end smallexample
2113
2114 Alternatively you can discover which binary optimizations are enabled
2115 by @option{-O3} by using:
2116
2117 @smallexample
2118 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2119 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2120 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2121 @end smallexample
2122
2123 @item --version
2124 @opindex version
2125 Display the version number and copyrights of the invoked GCC@.
2126
2127 @item -pass-exit-codes
2128 @opindex pass-exit-codes
2129 Normally the @command{gcc} program exits with the code of 1 if any
2130 phase of the compiler returns a non-success return code. If you specify
2131 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2132 the numerically highest error produced by any phase returning an error
2133 indication. The C, C++, and Fortran front ends return 4 if an internal
2134 compiler error is encountered.
2135
2136 @item -pipe
2137 @opindex pipe
2138 Use pipes rather than temporary files for communication between the
2139 various stages of compilation. This fails to work on some systems where
2140 the assembler is unable to read from a pipe; but the GNU assembler has
2141 no trouble.
2142
2143 @item -specs=@var{file}
2144 @opindex specs
2145 Process @var{file} after the compiler reads in the standard @file{specs}
2146 file, in order to override the defaults which the @command{gcc} driver
2147 program uses when determining what switches to pass to @command{cc1},
2148 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2149 @option{-specs=@var{file}} can be specified on the command line, and they
2150 are processed in order, from left to right. @xref{Spec Files}, for
2151 information about the format of the @var{file}.
2152
2153 @item -wrapper
2154 @opindex wrapper
2155 Invoke all subcommands under a wrapper program. The name of the
2156 wrapper program and its parameters are passed as a comma separated
2157 list.
2158
2159 @smallexample
2160 gcc -c t.c -wrapper gdb,--args
2161 @end smallexample
2162
2163 @noindent
2164 This invokes all subprograms of @command{gcc} under
2165 @samp{gdb --args}, thus the invocation of @command{cc1} is
2166 @samp{gdb --args cc1 @dots{}}.
2167
2168 @item -ffile-prefix-map=@var{old}=@var{new}
2169 @opindex ffile-prefix-map
2170 When compiling files residing in directory @file{@var{old}}, record
2171 any references to them in the result of the compilation as if the
2172 files resided in directory @file{@var{new}} instead. Specifying this
2173 option is equivalent to specifying all the individual
2174 @option{-f*-prefix-map} options. This can be used to make reproducible
2175 builds that are location independent. See also
2176 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
2177
2178 @item -fplugin=@var{name}.so
2179 @opindex fplugin
2180 Load the plugin code in file @var{name}.so, assumed to be a
2181 shared object to be dlopen'd by the compiler. The base name of
2182 the shared object file is used to identify the plugin for the
2183 purposes of argument parsing (See
2184 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2185 Each plugin should define the callback functions specified in the
2186 Plugins API.
2187
2188 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2189 @opindex fplugin-arg
2190 Define an argument called @var{key} with a value of @var{value}
2191 for the plugin called @var{name}.
2192
2193 @item -fdump-ada-spec@r{[}-slim@r{]}
2194 @opindex fdump-ada-spec
2195 For C and C++ source and include files, generate corresponding Ada specs.
2196 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2197 GNAT User's Guide}, which provides detailed documentation on this feature.
2198
2199 @item -fada-spec-parent=@var{unit}
2200 @opindex fada-spec-parent
2201 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2202 Ada specs as child units of parent @var{unit}.
2203
2204 @item -fdump-go-spec=@var{file}
2205 @opindex fdump-go-spec
2206 For input files in any language, generate corresponding Go
2207 declarations in @var{file}. This generates Go @code{const},
2208 @code{type}, @code{var}, and @code{func} declarations which may be a
2209 useful way to start writing a Go interface to code written in some
2210 other language.
2211
2212 @include @value{srcdir}/../libiberty/at-file.texi
2213 @end table
2214
2215 @node Invoking G++
2216 @section Compiling C++ Programs
2217
2218 @cindex suffixes for C++ source
2219 @cindex C++ source file suffixes
2220 C++ source files conventionally use one of the suffixes @samp{.C},
2221 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2222 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2223 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2224 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2225 files with these names and compiles them as C++ programs even if you
2226 call the compiler the same way as for compiling C programs (usually
2227 with the name @command{gcc}).
2228
2229 @findex g++
2230 @findex c++
2231 However, the use of @command{gcc} does not add the C++ library.
2232 @command{g++} is a program that calls GCC and automatically specifies linking
2233 against the C++ library. It treats @samp{.c},
2234 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2235 files unless @option{-x} is used. This program is also useful when
2236 precompiling a C header file with a @samp{.h} extension for use in C++
2237 compilations. On many systems, @command{g++} is also installed with
2238 the name @command{c++}.
2239
2240 @cindex invoking @command{g++}
2241 When you compile C++ programs, you may specify many of the same
2242 command-line options that you use for compiling programs in any
2243 language; or command-line options meaningful for C and related
2244 languages; or options that are meaningful only for C++ programs.
2245 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2246 explanations of options for languages related to C@.
2247 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2248 explanations of options that are meaningful only for C++ programs.
2249
2250 @node C Dialect Options
2251 @section Options Controlling C Dialect
2252 @cindex dialect options
2253 @cindex language dialect options
2254 @cindex options, dialect
2255
2256 The following options control the dialect of C (or languages derived
2257 from C, such as C++, Objective-C and Objective-C++) that the compiler
2258 accepts:
2259
2260 @table @gcctabopt
2261 @cindex ANSI support
2262 @cindex ISO support
2263 @item -ansi
2264 @opindex ansi
2265 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2266 equivalent to @option{-std=c++98}.
2267
2268 This turns off certain features of GCC that are incompatible with ISO
2269 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2270 such as the @code{asm} and @code{typeof} keywords, and
2271 predefined macros such as @code{unix} and @code{vax} that identify the
2272 type of system you are using. It also enables the undesirable and
2273 rarely used ISO trigraph feature. For the C compiler,
2274 it disables recognition of C++ style @samp{//} comments as well as
2275 the @code{inline} keyword.
2276
2277 The alternate keywords @code{__asm__}, @code{__extension__},
2278 @code{__inline__} and @code{__typeof__} continue to work despite
2279 @option{-ansi}. You would not want to use them in an ISO C program, of
2280 course, but it is useful to put them in header files that might be included
2281 in compilations done with @option{-ansi}. Alternate predefined macros
2282 such as @code{__unix__} and @code{__vax__} are also available, with or
2283 without @option{-ansi}.
2284
2285 The @option{-ansi} option does not cause non-ISO programs to be
2286 rejected gratuitously. For that, @option{-Wpedantic} is required in
2287 addition to @option{-ansi}. @xref{Warning Options}.
2288
2289 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2290 option is used. Some header files may notice this macro and refrain
2291 from declaring certain functions or defining certain macros that the
2292 ISO standard doesn't call for; this is to avoid interfering with any
2293 programs that might use these names for other things.
2294
2295 Functions that are normally built in but do not have semantics
2296 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2297 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2298 built-in functions provided by GCC}, for details of the functions
2299 affected.
2300
2301 @item -std=
2302 @opindex std
2303 Determine the language standard. @xref{Standards,,Language Standards
2304 Supported by GCC}, for details of these standard versions. This option
2305 is currently only supported when compiling C or C++.
2306
2307 The compiler can accept several base standards, such as @samp{c90} or
2308 @samp{c++98}, and GNU dialects of those standards, such as
2309 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2310 compiler accepts all programs following that standard plus those
2311 using GNU extensions that do not contradict it. For example,
2312 @option{-std=c90} turns off certain features of GCC that are
2313 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2314 keywords, but not other GNU extensions that do not have a meaning in
2315 ISO C90, such as omitting the middle term of a @code{?:}
2316 expression. On the other hand, when a GNU dialect of a standard is
2317 specified, all features supported by the compiler are enabled, even when
2318 those features change the meaning of the base standard. As a result, some
2319 strict-conforming programs may be rejected. The particular standard
2320 is used by @option{-Wpedantic} to identify which features are GNU
2321 extensions given that version of the standard. For example
2322 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2323 comments, while @option{-std=gnu99 -Wpedantic} does not.
2324
2325 A value for this option must be provided; possible values are
2326
2327 @table @samp
2328 @item c90
2329 @itemx c89
2330 @itemx iso9899:1990
2331 Support all ISO C90 programs (certain GNU extensions that conflict
2332 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2333
2334 @item iso9899:199409
2335 ISO C90 as modified in amendment 1.
2336
2337 @item c99
2338 @itemx c9x
2339 @itemx iso9899:1999
2340 @itemx iso9899:199x
2341 ISO C99. This standard is substantially completely supported, modulo
2342 bugs and floating-point issues
2343 (mainly but not entirely relating to optional C99 features from
2344 Annexes F and G). See
2345 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
2346 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2347
2348 @item c11
2349 @itemx c1x
2350 @itemx iso9899:2011
2351 ISO C11, the 2011 revision of the ISO C standard. This standard is
2352 substantially completely supported, modulo bugs, floating-point issues
2353 (mainly but not entirely relating to optional C11 features from
2354 Annexes F and G) and the optional Annexes K (Bounds-checking
2355 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2356
2357 @item c17
2358 @itemx c18
2359 @itemx iso9899:2017
2360 @itemx iso9899:2018
2361 ISO C17, the 2017 revision of the ISO C standard
2362 (published in 2018). This standard is
2363 same as C11 except for corrections of defects (all of which are also
2364 applied with @option{-std=c11}) and a new value of
2365 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2366
2367 @item c2x
2368 The next version of the ISO C standard, still under development. The
2369 support for this version is experimental and incomplete.
2370
2371 @item gnu90
2372 @itemx gnu89
2373 GNU dialect of ISO C90 (including some C99 features).
2374
2375 @item gnu99
2376 @itemx gnu9x
2377 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2378
2379 @item gnu11
2380 @itemx gnu1x
2381 GNU dialect of ISO C11.
2382 The name @samp{gnu1x} is deprecated.
2383
2384 @item gnu17
2385 @itemx gnu18
2386 GNU dialect of ISO C17. This is the default for C code.
2387
2388 @item gnu2x
2389 The next version of the ISO C standard, still under development, plus
2390 GNU extensions. The support for this version is experimental and
2391 incomplete.
2392
2393 @item c++98
2394 @itemx c++03
2395 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2396 additional defect reports. Same as @option{-ansi} for C++ code.
2397
2398 @item gnu++98
2399 @itemx gnu++03
2400 GNU dialect of @option{-std=c++98}.
2401
2402 @item c++11
2403 @itemx c++0x
2404 The 2011 ISO C++ standard plus amendments.
2405 The name @samp{c++0x} is deprecated.
2406
2407 @item gnu++11
2408 @itemx gnu++0x
2409 GNU dialect of @option{-std=c++11}.
2410 The name @samp{gnu++0x} is deprecated.
2411
2412 @item c++14
2413 @itemx c++1y
2414 The 2014 ISO C++ standard plus amendments.
2415 The name @samp{c++1y} is deprecated.
2416
2417 @item gnu++14
2418 @itemx gnu++1y
2419 GNU dialect of @option{-std=c++14}.
2420 The name @samp{gnu++1y} is deprecated.
2421
2422 @item c++17
2423 @itemx c++1z
2424 The 2017 ISO C++ standard plus amendments.
2425 The name @samp{c++1z} is deprecated.
2426
2427 @item gnu++17
2428 @itemx gnu++1z
2429 GNU dialect of @option{-std=c++17}.
2430 This is the default for C++ code.
2431 The name @samp{gnu++1z} is deprecated.
2432
2433 @item c++20
2434 @itemx c++2a
2435 The 2020 ISO C++ standard plus amendments.
2436 Support is experimental, and could change in incompatible ways in
2437 future releases.
2438 The name @samp{c++2a} is deprecated.
2439
2440 @item gnu++20
2441 @itemx gnu++2a
2442 GNU dialect of @option{-std=c++20}.
2443 Support is experimental, and could change in incompatible ways in
2444 future releases.
2445 The name @samp{gnu++2a} is deprecated.
2446
2447 @item c++2b
2448 @itemx c++23
2449 The next revision of the ISO C++ standard, planned for
2450 2023. Support is highly experimental, and will almost certainly
2451 change in incompatible ways in future releases.
2452
2453 @item gnu++2b
2454 @itemx gnu++23
2455 GNU dialect of @option{-std=c++2b}. Support is highly experimental,
2456 and will almost certainly change in incompatible ways in future
2457 releases.
2458 @end table
2459
2460 @item -aux-info @var{filename}
2461 @opindex aux-info
2462 Output to the given filename prototyped declarations for all functions
2463 declared and/or defined in a translation unit, including those in header
2464 files. This option is silently ignored in any language other than C@.
2465
2466 Besides declarations, the file indicates, in comments, the origin of
2467 each declaration (source file and line), whether the declaration was
2468 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2469 @samp{O} for old, respectively, in the first character after the line
2470 number and the colon), and whether it came from a declaration or a
2471 definition (@samp{C} or @samp{F}, respectively, in the following
2472 character). In the case of function definitions, a K&R-style list of
2473 arguments followed by their declarations is also provided, inside
2474 comments, after the declaration.
2475
2476 @item -fallow-parameterless-variadic-functions
2477 @opindex fallow-parameterless-variadic-functions
2478 Accept variadic functions without named parameters.
2479
2480 Although it is possible to define such a function, this is not very
2481 useful as it is not possible to read the arguments. This is only
2482 supported for C as this construct is allowed by C++.
2483
2484 @item -fno-asm
2485 @opindex fno-asm
2486 @opindex fasm
2487 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2488 keyword, so that code can use these words as identifiers. You can use
2489 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2490 instead. In C, @option{-ansi} implies @option{-fno-asm}.
2491
2492 In C++, @code{inline} is a standard keyword and is not affected by
2493 this switch. You may want to use the @option{-fno-gnu-keywords} flag
2494 instead, which disables @code{typeof} but not @code{asm} and
2495 @code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2496 this switch only affects the @code{asm} and @code{typeof} keywords,
2497 since @code{inline} is a standard keyword in ISO C99.
2498
2499 @item -fno-builtin
2500 @itemx -fno-builtin-@var{function}
2501 @opindex fno-builtin
2502 @opindex fbuiltin
2503 @cindex built-in functions
2504 Don't recognize built-in functions that do not begin with
2505 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2506 functions provided by GCC}, for details of the functions affected,
2507 including those which are not built-in functions when @option{-ansi} or
2508 @option{-std} options for strict ISO C conformance are used because they
2509 do not have an ISO standard meaning.
2510
2511 GCC normally generates special code to handle certain built-in functions
2512 more efficiently; for instance, calls to @code{alloca} may become single
2513 instructions which adjust the stack directly, and calls to @code{memcpy}
2514 may become inline copy loops. The resulting code is often both smaller
2515 and faster, but since the function calls no longer appear as such, you
2516 cannot set a breakpoint on those calls, nor can you change the behavior
2517 of the functions by linking with a different library. In addition,
2518 when a function is recognized as a built-in function, GCC may use
2519 information about that function to warn about problems with calls to
2520 that function, or to generate more efficient code, even if the
2521 resulting code still contains calls to that function. For example,
2522 warnings are given with @option{-Wformat} for bad calls to
2523 @code{printf} when @code{printf} is built in and @code{strlen} is
2524 known not to modify global memory.
2525
2526 With the @option{-fno-builtin-@var{function}} option
2527 only the built-in function @var{function} is
2528 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2529 function is named that is not built-in in this version of GCC, this
2530 option is ignored. There is no corresponding
2531 @option{-fbuiltin-@var{function}} option; if you wish to enable
2532 built-in functions selectively when using @option{-fno-builtin} or
2533 @option{-ffreestanding}, you may define macros such as:
2534
2535 @smallexample
2536 #define abs(n) __builtin_abs ((n))
2537 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2538 @end smallexample
2539
2540 @item -fcond-mismatch
2541 @opindex fcond-mismatch
2542 Allow conditional expressions with mismatched types in the second and
2543 third arguments. The value of such an expression is void. This option
2544 is not supported for C++.
2545
2546 @item -ffreestanding
2547 @opindex ffreestanding
2548 @cindex hosted environment
2549
2550 Assert that compilation targets a freestanding environment. This
2551 implies @option{-fno-builtin}. A freestanding environment
2552 is one in which the standard library may not exist, and program startup may
2553 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2554 This is equivalent to @option{-fno-hosted}.
2555
2556 @xref{Standards,,Language Standards Supported by GCC}, for details of
2557 freestanding and hosted environments.
2558
2559 @item -fgimple
2560 @opindex fgimple
2561
2562 Enable parsing of function definitions marked with @code{__GIMPLE}.
2563 This is an experimental feature that allows unit testing of GIMPLE
2564 passes.
2565
2566 @item -fgnu-tm
2567 @opindex fgnu-tm
2568 When the option @option{-fgnu-tm} is specified, the compiler
2569 generates code for the Linux variant of Intel's current Transactional
2570 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2571 an experimental feature whose interface may change in future versions
2572 of GCC, as the official specification changes. Please note that not
2573 all architectures are supported for this feature.
2574
2575 For more information on GCC's support for transactional memory,
2576 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2577 Transactional Memory Library}.
2578
2579 Note that the transactional memory feature is not supported with
2580 non-call exceptions (@option{-fnon-call-exceptions}).
2581
2582 @item -fgnu89-inline
2583 @opindex fgnu89-inline
2584 The option @option{-fgnu89-inline} tells GCC to use the traditional
2585 GNU semantics for @code{inline} functions when in C99 mode.
2586 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2587 Using this option is roughly equivalent to adding the
2588 @code{gnu_inline} function attribute to all inline functions
2589 (@pxref{Function Attributes}).
2590
2591 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2592 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2593 specifies the default behavior).
2594 This option is not supported in @option{-std=c90} or
2595 @option{-std=gnu90} mode.
2596
2597 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2598 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2599 in effect for @code{inline} functions. @xref{Common Predefined
2600 Macros,,,cpp,The C Preprocessor}.
2601
2602 @item -fhosted
2603 @opindex fhosted
2604 @cindex hosted environment
2605
2606 Assert that compilation targets a hosted environment. This implies
2607 @option{-fbuiltin}. A hosted environment is one in which the
2608 entire standard library is available, and in which @code{main} has a return
2609 type of @code{int}. Examples are nearly everything except a kernel.
2610 This is equivalent to @option{-fno-freestanding}.
2611
2612 @item -flax-vector-conversions
2613 @opindex flax-vector-conversions
2614 Allow implicit conversions between vectors with differing numbers of
2615 elements and/or incompatible element types. This option should not be
2616 used for new code.
2617
2618 @item -fms-extensions
2619 @opindex fms-extensions
2620 Accept some non-standard constructs used in Microsoft header files.
2621
2622 In C++ code, this allows member names in structures to be similar
2623 to previous types declarations.
2624
2625 @smallexample
2626 typedef int UOW;
2627 struct ABC @{
2628 UOW UOW;
2629 @};
2630 @end smallexample
2631
2632 Some cases of unnamed fields in structures and unions are only
2633 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2634 fields within structs/unions}, for details.
2635
2636 Note that this option is off for all targets except for x86
2637 targets using ms-abi.
2638
2639 @item -foffload=disable
2640 @itemx -foffload=default
2641 @itemx -foffload=@var{target-list}
2642 @opindex foffload
2643 @cindex Offloading targets
2644 @cindex OpenACC offloading targets
2645 @cindex OpenMP offloading targets
2646 Specify for which OpenMP and OpenACC offload targets code should be generated.
2647 The default behavior, equivalent to @option{-foffload=default}, is to generate
2648 code for all supported offload targets. The @option{-foffload=disable} form
2649 generates code only for the host fallback, while
2650 @option{-foffload=@var{target-list}} generates code only for the specified
2651 comma-separated list of offload targets.
2652
2653 Offload targets are specified in GCC's internal target-triplet format. You can
2654 run the compiler with @option{-v} to show the list of configured offload targets
2655 under @code{OFFLOAD_TARGET_NAMES}.
2656
2657 @item -foffload-options=@var{options}
2658 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2659 @opindex foffload-options
2660 @cindex Offloading options
2661 @cindex OpenACC offloading options
2662 @cindex OpenMP offloading options
2663
2664 With @option{-foffload-options=@var{options}}, GCC passes the specified
2665 @var{options} to the compilers for all enabled offloading targets. You can
2666 specify options that apply only to a specific target or targets by using
2667 the @option{-foffload-options=@var{target-list}=@var{options}} form. The
2668 @var{target-list} is a comma-separated list in the same format as for the
2669 @option{-foffload=} option.
2670
2671 Typical command lines are
2672
2673 @smallexample
2674 -foffload-options=-lgfortran -foffload-options=-lm
2675 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2676 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2677 @end smallexample
2678
2679 @item -fopenacc
2680 @opindex fopenacc
2681 @cindex OpenACC accelerator programming
2682 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2683 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2684 compiler generates accelerated code according to the OpenACC Application
2685 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2686 implies @option{-pthread}, and thus is only supported on targets that
2687 have support for @option{-pthread}.
2688
2689 @item -fopenacc-dim=@var{geom}
2690 @opindex fopenacc-dim
2691 @cindex OpenACC accelerator programming
2692 Specify default compute dimensions for parallel offload regions that do
2693 not explicitly specify. The @var{geom} value is a triple of
2694 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2695 can be omitted, to use a target-specific default value.
2696
2697 @item -fopenmp
2698 @opindex fopenmp
2699 @cindex OpenMP parallel
2700 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2701 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2702 compiler generates parallel code according to the OpenMP Application
2703 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2704 implies @option{-pthread}, and thus is only supported on targets that
2705 have support for @option{-pthread}. @option{-fopenmp} implies
2706 @option{-fopenmp-simd}.
2707
2708 @item -fopenmp-simd
2709 @opindex fopenmp-simd
2710 @cindex OpenMP SIMD
2711 @cindex SIMD
2712 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2713 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2714 are ignored.
2715
2716 @item -fpermitted-flt-eval-methods=@var{style}
2717 @opindex fpermitted-flt-eval-methods
2718 @opindex fpermitted-flt-eval-methods=c11
2719 @opindex fpermitted-flt-eval-methods=ts-18661-3
2720 ISO/IEC TS 18661-3 defines new permissible values for
2721 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2722 a semantic type that is an interchange or extended format should be
2723 evaluated to the precision and range of that type. These new values are
2724 a superset of those permitted under C99/C11, which does not specify the
2725 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2726 conforming to C11 may not have been written expecting the possibility of
2727 the new values.
2728
2729 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2730 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2731 or the extended set of values specified in ISO/IEC TS 18661-3.
2732
2733 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2734
2735 The default when in a standards compliant mode (@option{-std=c11} or similar)
2736 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2737 dialect (@option{-std=gnu11} or similar) is
2738 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2739
2740 @item -fplan9-extensions
2741 @opindex fplan9-extensions
2742 Accept some non-standard constructs used in Plan 9 code.
2743
2744 This enables @option{-fms-extensions}, permits passing pointers to
2745 structures with anonymous fields to functions that expect pointers to
2746 elements of the type of the field, and permits referring to anonymous
2747 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2748 struct/union fields within structs/unions}, for details. This is only
2749 supported for C, not C++.
2750
2751 @item -fsigned-bitfields
2752 @itemx -funsigned-bitfields
2753 @itemx -fno-signed-bitfields
2754 @itemx -fno-unsigned-bitfields
2755 @opindex fsigned-bitfields
2756 @opindex funsigned-bitfields
2757 @opindex fno-signed-bitfields
2758 @opindex fno-unsigned-bitfields
2759 These options control whether a bit-field is signed or unsigned, when the
2760 declaration does not use either @code{signed} or @code{unsigned}. By
2761 default, such a bit-field is signed, because this is consistent: the
2762 basic integer types such as @code{int} are signed types.
2763
2764 @item -fsigned-char
2765 @opindex fsigned-char
2766 Let the type @code{char} be signed, like @code{signed char}.
2767
2768 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2769 the negative form of @option{-funsigned-char}. Likewise, the option
2770 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2771
2772 @item -funsigned-char
2773 @opindex funsigned-char
2774 Let the type @code{char} be unsigned, like @code{unsigned char}.
2775
2776 Each kind of machine has a default for what @code{char} should
2777 be. It is either like @code{unsigned char} by default or like
2778 @code{signed char} by default.
2779
2780 Ideally, a portable program should always use @code{signed char} or
2781 @code{unsigned char} when it depends on the signedness of an object.
2782 But many programs have been written to use plain @code{char} and
2783 expect it to be signed, or expect it to be unsigned, depending on the
2784 machines they were written for. This option, and its inverse, let you
2785 make such a program work with the opposite default.
2786
2787 The type @code{char} is always a distinct type from each of
2788 @code{signed char} or @code{unsigned char}, even though its behavior
2789 is always just like one of those two.
2790
2791 @item -fsso-struct=@var{endianness}
2792 @opindex fsso-struct
2793 Set the default scalar storage order of structures and unions to the
2794 specified endianness. The accepted values are @samp{big-endian},
2795 @samp{little-endian} and @samp{native} for the native endianness of
2796 the target (the default). This option is not supported for C++.
2797
2798 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2799 code that is not binary compatible with code generated without it if the
2800 specified endianness is not the native endianness of the target.
2801 @end table
2802
2803 @node C++ Dialect Options
2804 @section Options Controlling C++ Dialect
2805
2806 @cindex compiler options, C++
2807 @cindex C++ options, command-line
2808 @cindex options, C++
2809 This section describes the command-line options that are only meaningful
2810 for C++ programs. You can also use most of the GNU compiler options
2811 regardless of what language your program is in. For example, you
2812 might compile a file @file{firstClass.C} like this:
2813
2814 @smallexample
2815 g++ -g -fstrict-enums -O -c firstClass.C
2816 @end smallexample
2817
2818 @noindent
2819 In this example, only @option{-fstrict-enums} is an option meant
2820 only for C++ programs; you can use the other options with any
2821 language supported by GCC@.
2822
2823 Some options for compiling C programs, such as @option{-std}, are also
2824 relevant for C++ programs.
2825 @xref{C Dialect Options,,Options Controlling C Dialect}.
2826
2827 Here is a list of options that are @emph{only} for compiling C++ programs:
2828
2829 @table @gcctabopt
2830
2831 @item -fabi-version=@var{n}
2832 @opindex fabi-version
2833 Use version @var{n} of the C++ ABI@. The default is version 0.
2834
2835 Version 0 refers to the version conforming most closely to
2836 the C++ ABI specification. Therefore, the ABI obtained using version 0
2837 will change in different versions of G++ as ABI bugs are fixed.
2838
2839 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2840
2841 Version 2 is the version of the C++ ABI that first appeared in G++
2842 3.4, and was the default through G++ 4.9.
2843
2844 Version 3 corrects an error in mangling a constant address as a
2845 template argument.
2846
2847 Version 4, which first appeared in G++ 4.5, implements a standard
2848 mangling for vector types.
2849
2850 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2851 attribute const/volatile on function pointer types, decltype of a
2852 plain decl, and use of a function parameter in the declaration of
2853 another parameter.
2854
2855 Version 6, which first appeared in G++ 4.7, corrects the promotion
2856 behavior of C++11 scoped enums and the mangling of template argument
2857 packs, const/static_cast, prefix ++ and --, and a class scope function
2858 used as a template argument.
2859
2860 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2861 builtin type and corrects the mangling of lambdas in default argument
2862 scope.
2863
2864 Version 8, which first appeared in G++ 4.9, corrects the substitution
2865 behavior of function types with function-cv-qualifiers.
2866
2867 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2868 @code{nullptr_t}.
2869
2870 Version 10, which first appeared in G++ 6.1, adds mangling of
2871 attributes that affect type identity, such as ia32 calling convention
2872 attributes (e.g.@: @samp{stdcall}).
2873
2874 Version 11, which first appeared in G++ 7, corrects the mangling of
2875 sizeof... expressions and operator names. For multiple entities with
2876 the same name within a function, that are declared in different scopes,
2877 the mangling now changes starting with the twelfth occurrence. It also
2878 implies @option{-fnew-inheriting-ctors}.
2879
2880 Version 12, which first appeared in G++ 8, corrects the calling
2881 conventions for empty classes on the x86_64 target and for classes
2882 with only deleted copy/move constructors. It accidentally changes the
2883 calling convention for classes with a deleted copy constructor and a
2884 trivial move constructor.
2885
2886 Version 13, which first appeared in G++ 8.2, fixes the accidental
2887 change in version 12.
2888
2889 Version 14, which first appeared in G++ 10, corrects the mangling of
2890 the nullptr expression.
2891
2892 Version 15, which first appeared in G++ 11, changes the mangling of
2893 @code{__alignof__} to be distinct from that of @code{alignof}, and
2894 dependent operator names.
2895
2896 See also @option{-Wabi}.
2897
2898 @item -fabi-compat-version=@var{n}
2899 @opindex fabi-compat-version
2900 On targets that support strong aliases, G++
2901 works around mangling changes by creating an alias with the correct
2902 mangled name when defining a symbol with an incorrect mangled name.
2903 This switch specifies which ABI version to use for the alias.
2904
2905 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2906 compatibility). If another ABI version is explicitly selected, this
2907 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2908 use @option{-fabi-compat-version=2}.
2909
2910 If this option is not provided but @option{-Wabi=@var{n}} is, that
2911 version is used for compatibility aliases. If this option is provided
2912 along with @option{-Wabi} (without the version), the version from this
2913 option is used for the warning.
2914
2915 @item -fno-access-control
2916 @opindex fno-access-control
2917 @opindex faccess-control
2918 Turn off all access checking. This switch is mainly useful for working
2919 around bugs in the access control code.
2920
2921 @item -faligned-new
2922 @opindex faligned-new
2923 Enable support for C++17 @code{new} of types that require more
2924 alignment than @code{void* ::operator new(std::size_t)} provides. A
2925 numeric argument such as @code{-faligned-new=32} can be used to
2926 specify how much alignment (in bytes) is provided by that function,
2927 but few users will need to override the default of
2928 @code{alignof(std::max_align_t)}.
2929
2930 This flag is enabled by default for @option{-std=c++17}.
2931
2932 @item -fchar8_t
2933 @itemx -fno-char8_t
2934 @opindex fchar8_t
2935 @opindex fno-char8_t
2936 Enable support for @code{char8_t} as adopted for C++20. This includes
2937 the addition of a new @code{char8_t} fundamental type, changes to the
2938 types of UTF-8 string and character literals, new signatures for
2939 user-defined literals, associated standard library updates, and new
2940 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2941
2942 This option enables functions to be overloaded for ordinary and UTF-8
2943 strings:
2944
2945 @smallexample
2946 int f(const char *); // #1
2947 int f(const char8_t *); // #2
2948 int v1 = f("text"); // Calls #1
2949 int v2 = f(u8"text"); // Calls #2
2950 @end smallexample
2951
2952 @noindent
2953 and introduces new signatures for user-defined literals:
2954
2955 @smallexample
2956 int operator""_udl1(char8_t);
2957 int v3 = u8'x'_udl1;
2958 int operator""_udl2(const char8_t*, std::size_t);
2959 int v4 = u8"text"_udl2;
2960 template<typename T, T...> int operator""_udl3();
2961 int v5 = u8"text"_udl3;
2962 @end smallexample
2963
2964 @noindent
2965 The change to the types of UTF-8 string and character literals introduces
2966 incompatibilities with ISO C++11 and later standards. For example, the
2967 following code is well-formed under ISO C++11, but is ill-formed when
2968 @option{-fchar8_t} is specified.
2969
2970 @smallexample
2971 char ca[] = u8"xx"; // error: char-array initialized from wide
2972 // string
2973 const char *cp = u8"xx";// error: invalid conversion from
2974 // `const char8_t*' to `const char*'
2975 int f(const char*);
2976 auto v = f(u8"xx"); // error: invalid conversion from
2977 // `const char8_t*' to `const char*'
2978 std::string s@{u8"xx"@}; // error: no matching function for call to
2979 // `std::basic_string<char>::basic_string()'
2980 using namespace std::literals;
2981 s = u8"xx"s; // error: conversion from
2982 // `basic_string<char8_t>' to non-scalar
2983 // type `basic_string<char>' requested
2984 @end smallexample
2985
2986 @item -fcheck-new
2987 @opindex fcheck-new
2988 Check that the pointer returned by @code{operator new} is non-null
2989 before attempting to modify the storage allocated. This check is
2990 normally unnecessary because the C++ standard specifies that
2991 @code{operator new} only returns @code{0} if it is declared
2992 @code{throw()}, in which case the compiler always checks the
2993 return value even without this option. In all other cases, when
2994 @code{operator new} has a non-empty exception specification, memory
2995 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2996 @samp{new (nothrow)}.
2997
2998 @item -fconcepts
2999 @itemx -fconcepts-ts
3000 @opindex fconcepts
3001 @opindex fconcepts-ts
3002 Below @option{-std=c++20}, @option{-fconcepts} enables support for the
3003 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
3004
3005 With @option{-std=c++20} and above, Concepts are part of the language
3006 standard, so @option{-fconcepts} defaults to on. But the standard
3007 specification of Concepts differs significantly from the TS, so some
3008 constructs that were allowed in the TS but didn't make it into the
3009 standard can still be enabled by @option{-fconcepts-ts}.
3010
3011 @item -fconstexpr-depth=@var{n}
3012 @opindex fconstexpr-depth
3013 Set the maximum nested evaluation depth for C++11 constexpr functions
3014 to @var{n}. A limit is needed to detect endless recursion during
3015 constant expression evaluation. The minimum specified by the standard
3016 is 512.
3017
3018 @item -fconstexpr-cache-depth=@var{n}
3019 @opindex fconstexpr-cache-depth
3020 Set the maximum level of nested evaluation depth for C++11 constexpr
3021 functions that will be cached to @var{n}. This is a heuristic that
3022 trades off compilation speed (when the cache avoids repeated
3023 calculations) against memory consumption (when the cache grows very
3024 large from highly recursive evaluations). The default is 8. Very few
3025 users are likely to want to adjust it, but if your code does heavy
3026 constexpr calculations you might want to experiment to find which
3027 value works best for you.
3028
3029 @item -fconstexpr-loop-limit=@var{n}
3030 @opindex fconstexpr-loop-limit
3031 Set the maximum number of iterations for a loop in C++14 constexpr functions
3032 to @var{n}. A limit is needed to detect infinite loops during
3033 constant expression evaluation. The default is 262144 (1<<18).
3034
3035 @item -fconstexpr-ops-limit=@var{n}
3036 @opindex fconstexpr-ops-limit
3037 Set the maximum number of operations during a single constexpr evaluation.
3038 Even when number of iterations of a single loop is limited with the above limit,
3039 if there are several nested loops and each of them has many iterations but still
3040 smaller than the above limit, or if in a body of some loop or even outside
3041 of a loop too many expressions need to be evaluated, the resulting constexpr
3042 evaluation might take too long.
3043 The default is 33554432 (1<<25).
3044
3045 @item -fcoroutines
3046 @opindex fcoroutines
3047 Enable support for the C++ coroutines extension (experimental).
3048
3049 @item -fno-elide-constructors
3050 @opindex fno-elide-constructors
3051 @opindex felide-constructors
3052 The C++ standard allows an implementation to omit creating a temporary
3053 that is only used to initialize another object of the same type.
3054 Specifying this option disables that optimization, and forces G++ to
3055 call the copy constructor in all cases. This option also causes G++
3056 to call trivial member functions which otherwise would be expanded inline.
3057
3058 In C++17, the compiler is required to omit these temporaries, but this
3059 option still affects trivial member functions.
3060
3061 @item -fno-enforce-eh-specs
3062 @opindex fno-enforce-eh-specs
3063 @opindex fenforce-eh-specs
3064 Don't generate code to check for violation of exception specifications
3065 at run time. This option violates the C++ standard, but may be useful
3066 for reducing code size in production builds, much like defining
3067 @code{NDEBUG}. This does not give user code permission to throw
3068 exceptions in violation of the exception specifications; the compiler
3069 still optimizes based on the specifications, so throwing an
3070 unexpected exception results in undefined behavior at run time.
3071
3072 @item -fextern-tls-init
3073 @itemx -fno-extern-tls-init
3074 @opindex fextern-tls-init
3075 @opindex fno-extern-tls-init
3076 The C++11 and OpenMP standards allow @code{thread_local} and
3077 @code{threadprivate} variables to have dynamic (runtime)
3078 initialization. To support this, any use of such a variable goes
3079 through a wrapper function that performs any necessary initialization.
3080 When the use and definition of the variable are in the same
3081 translation unit, this overhead can be optimized away, but when the
3082 use is in a different translation unit there is significant overhead
3083 even if the variable doesn't actually need dynamic initialization. If
3084 the programmer can be sure that no use of the variable in a
3085 non-defining TU needs to trigger dynamic initialization (either
3086 because the variable is statically initialized, or a use of the
3087 variable in the defining TU will be executed before any uses in
3088 another TU), they can avoid this overhead with the
3089 @option{-fno-extern-tls-init} option.
3090
3091 On targets that support symbol aliases, the default is
3092 @option{-fextern-tls-init}. On targets that do not support symbol
3093 aliases, the default is @option{-fno-extern-tls-init}.
3094
3095 @item -fno-gnu-keywords
3096 @opindex fno-gnu-keywords
3097 @opindex fgnu-keywords
3098 Do not recognize @code{typeof} as a keyword, so that code can use this
3099 word as an identifier. You can use the keyword @code{__typeof__} instead.
3100 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3101 @option{-std=c++98}, @option{-std=c++11}, etc.
3102
3103 @item -fno-implicit-templates
3104 @opindex fno-implicit-templates
3105 @opindex fimplicit-templates
3106 Never emit code for non-inline templates that are instantiated
3107 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3108 If you use this option, you must take care to structure your code to
3109 include all the necessary explicit instantiations to avoid getting
3110 undefined symbols at link time.
3111 @xref{Template Instantiation}, for more information.
3112
3113 @item -fno-implicit-inline-templates
3114 @opindex fno-implicit-inline-templates
3115 @opindex fimplicit-inline-templates
3116 Don't emit code for implicit instantiations of inline templates, either.
3117 The default is to handle inlines differently so that compiles with and
3118 without optimization need the same set of explicit instantiations.
3119
3120 @item -fno-implement-inlines
3121 @opindex fno-implement-inlines
3122 @opindex fimplement-inlines
3123 To save space, do not emit out-of-line copies of inline functions
3124 controlled by @code{#pragma implementation}. This causes linker
3125 errors if these functions are not inlined everywhere they are called.
3126
3127 @item -fmodules-ts
3128 @itemx -fno-modules-ts
3129 @opindex fmodules-ts
3130 @opindex fno-modules-ts
3131 Enable support for C++20 modules (@pxref{C++ Modules}). The
3132 @option{-fno-modules-ts} is usually not needed, as that is the
3133 default. Even though this is a C++20 feature, it is not currently
3134 implicitly enabled by selecting that standard version.
3135
3136 @item -fmodule-header
3137 @itemx -fmodule-header=user
3138 @itemx -fmodule-header=system
3139 @opindex fmodule-header
3140 Compile a header file to create an importable header unit.
3141
3142 @item -fmodule-implicit-inline
3143 @opindex fmodule-implicit-inline
3144 Member functions defined in their class definitions are not implicitly
3145 inline for modular code. This is different to traditional C++
3146 behavior, for good reasons. However, it may result in a difficulty
3147 during code porting. This option makes such function definitions
3148 implicitly inline. It does however generate an ABI incompatibility,
3149 so you must use it everywhere or nowhere. (Such definitions outside
3150 of a named module remain implicitly inline, regardless.)
3151
3152 @item -fno-module-lazy
3153 @opindex fno-module-lazy
3154 @opindex fmodule-lazy
3155 Disable lazy module importing and module mapper creation.
3156
3157 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3158 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3159 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3160 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3161 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3162 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3163 @vindex CXX_MODULE_MAPPER @r{environment variable}
3164 @opindex fmodule-mapper
3165 An oracle to query for module name to filename mappings. If
3166 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3167 and if that is unset, an in-process default is provided.
3168
3169 @item -fmodule-only
3170 @opindex fmodule-only
3171 Only emit the Compiled Module Interface, inhibiting any object file.
3172
3173 @item -fms-extensions
3174 @opindex fms-extensions
3175 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3176 int and getting a pointer to member function via non-standard syntax.
3177
3178 @item -fnew-inheriting-ctors
3179 @opindex fnew-inheriting-ctors
3180 Enable the P0136 adjustment to the semantics of C++11 constructor
3181 inheritance. This is part of C++17 but also considered to be a Defect
3182 Report against C++11 and C++14. This flag is enabled by default
3183 unless @option{-fabi-version=10} or lower is specified.
3184
3185 @item -fnew-ttp-matching
3186 @opindex fnew-ttp-matching
3187 Enable the P0522 resolution to Core issue 150, template template
3188 parameters and default arguments: this allows a template with default
3189 template arguments as an argument for a template template parameter
3190 with fewer template parameters. This flag is enabled by default for
3191 @option{-std=c++17}.
3192
3193 @item -fno-nonansi-builtins
3194 @opindex fno-nonansi-builtins
3195 @opindex fnonansi-builtins
3196 Disable built-in declarations of functions that are not mandated by
3197 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3198 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3199
3200 @item -fnothrow-opt
3201 @opindex fnothrow-opt
3202 Treat a @code{throw()} exception specification as if it were a
3203 @code{noexcept} specification to reduce or eliminate the text size
3204 overhead relative to a function with no exception specification. If
3205 the function has local variables of types with non-trivial
3206 destructors, the exception specification actually makes the
3207 function smaller because the EH cleanups for those variables can be
3208 optimized away. The semantic effect is that an exception thrown out of
3209 a function with such an exception specification results in a call
3210 to @code{terminate} rather than @code{unexpected}.
3211
3212 @item -fno-operator-names
3213 @opindex fno-operator-names
3214 @opindex foperator-names
3215 Do not treat the operator name keywords @code{and}, @code{bitand},
3216 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3217 synonyms as keywords.
3218
3219 @item -fno-optional-diags
3220 @opindex fno-optional-diags
3221 @opindex foptional-diags
3222 Disable diagnostics that the standard says a compiler does not need to
3223 issue. Currently, the only such diagnostic issued by G++ is the one for
3224 a name having multiple meanings within a class.
3225
3226 @item -fpermissive
3227 @opindex fpermissive
3228 Downgrade some diagnostics about nonconformant code from errors to
3229 warnings. Thus, using @option{-fpermissive} allows some
3230 nonconforming code to compile.
3231
3232 @item -fno-pretty-templates
3233 @opindex fno-pretty-templates
3234 @opindex fpretty-templates
3235 When an error message refers to a specialization of a function
3236 template, the compiler normally prints the signature of the
3237 template followed by the template arguments and any typedefs or
3238 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3239 rather than @code{void f(int)}) so that it's clear which template is
3240 involved. When an error message refers to a specialization of a class
3241 template, the compiler omits any template arguments that match
3242 the default template arguments for that template. If either of these
3243 behaviors make it harder to understand the error message rather than
3244 easier, you can use @option{-fno-pretty-templates} to disable them.
3245
3246 @item -fno-rtti
3247 @opindex fno-rtti
3248 @opindex frtti
3249 Disable generation of information about every class with virtual
3250 functions for use by the C++ run-time type identification features
3251 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3252 of the language, you can save some space by using this flag. Note that
3253 exception handling uses the same information, but G++ generates it as
3254 needed. The @code{dynamic_cast} operator can still be used for casts that
3255 do not require run-time type information, i.e.@: casts to @code{void *} or to
3256 unambiguous base classes.
3257
3258 Mixing code compiled with @option{-frtti} with that compiled with
3259 @option{-fno-rtti} may not work. For example, programs may
3260 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3261 for a class compiled with @option{-frtti}.
3262
3263 @item -fsized-deallocation
3264 @opindex fsized-deallocation
3265 Enable the built-in global declarations
3266 @smallexample
3267 void operator delete (void *, std::size_t) noexcept;
3268 void operator delete[] (void *, std::size_t) noexcept;
3269 @end smallexample
3270 as introduced in C++14. This is useful for user-defined replacement
3271 deallocation functions that, for example, use the size of the object
3272 to make deallocation faster. Enabled by default under
3273 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3274 warns about places that might want to add a definition.
3275
3276 @item -fstrict-enums
3277 @opindex fstrict-enums
3278 Allow the compiler to optimize using the assumption that a value of
3279 enumerated type can only be one of the values of the enumeration (as
3280 defined in the C++ standard; basically, a value that can be
3281 represented in the minimum number of bits needed to represent all the
3282 enumerators). This assumption may not be valid if the program uses a
3283 cast to convert an arbitrary integer value to the enumerated type.
3284
3285 @item -fstrong-eval-order
3286 @opindex fstrong-eval-order
3287 Evaluate member access, array subscripting, and shift expressions in
3288 left-to-right order, and evaluate assignment in right-to-left order,
3289 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3290 @option{-fstrong-eval-order=some} enables just the ordering of member
3291 access and shift expressions, and is the default without
3292 @option{-std=c++17}.
3293
3294 @item -ftemplate-backtrace-limit=@var{n}
3295 @opindex ftemplate-backtrace-limit
3296 Set the maximum number of template instantiation notes for a single
3297 warning or error to @var{n}. The default value is 10.
3298
3299 @item -ftemplate-depth=@var{n}
3300 @opindex ftemplate-depth
3301 Set the maximum instantiation depth for template classes to @var{n}.
3302 A limit on the template instantiation depth is needed to detect
3303 endless recursions during template class instantiation. ANSI/ISO C++
3304 conforming programs must not rely on a maximum depth greater than 17
3305 (changed to 1024 in C++11). The default value is 900, as the compiler
3306 can run out of stack space before hitting 1024 in some situations.
3307
3308 @item -fno-threadsafe-statics
3309 @opindex fno-threadsafe-statics
3310 @opindex fthreadsafe-statics
3311 Do not emit the extra code to use the routines specified in the C++
3312 ABI for thread-safe initialization of local statics. You can use this
3313 option to reduce code size slightly in code that doesn't need to be
3314 thread-safe.
3315
3316 @item -fuse-cxa-atexit
3317 @opindex fuse-cxa-atexit
3318 Register destructors for objects with static storage duration with the
3319 @code{__cxa_atexit} function rather than the @code{atexit} function.
3320 This option is required for fully standards-compliant handling of static
3321 destructors, but only works if your C library supports
3322 @code{__cxa_atexit}.
3323
3324 @item -fno-use-cxa-get-exception-ptr
3325 @opindex fno-use-cxa-get-exception-ptr
3326 @opindex fuse-cxa-get-exception-ptr
3327 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3328 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3329 if the runtime routine is not available.
3330
3331 @item -fvisibility-inlines-hidden
3332 @opindex fvisibility-inlines-hidden
3333 This switch declares that the user does not attempt to compare
3334 pointers to inline functions or methods where the addresses of the two functions
3335 are taken in different shared objects.
3336
3337 The effect of this is that GCC may, effectively, mark inline methods with
3338 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3339 appear in the export table of a DSO and do not require a PLT indirection
3340 when used within the DSO@. Enabling this option can have a dramatic effect
3341 on load and link times of a DSO as it massively reduces the size of the
3342 dynamic export table when the library makes heavy use of templates.
3343
3344 The behavior of this switch is not quite the same as marking the
3345 methods as hidden directly, because it does not affect static variables
3346 local to the function or cause the compiler to deduce that
3347 the function is defined in only one shared object.
3348
3349 You may mark a method as having a visibility explicitly to negate the
3350 effect of the switch for that method. For example, if you do want to
3351 compare pointers to a particular inline method, you might mark it as
3352 having default visibility. Marking the enclosing class with explicit
3353 visibility has no effect.
3354
3355 Explicitly instantiated inline methods are unaffected by this option
3356 as their linkage might otherwise cross a shared library boundary.
3357 @xref{Template Instantiation}.
3358
3359 @item -fvisibility-ms-compat
3360 @opindex fvisibility-ms-compat
3361 This flag attempts to use visibility settings to make GCC's C++
3362 linkage model compatible with that of Microsoft Visual Studio.
3363
3364 The flag makes these changes to GCC's linkage model:
3365
3366 @enumerate
3367 @item
3368 It sets the default visibility to @code{hidden}, like
3369 @option{-fvisibility=hidden}.
3370
3371 @item
3372 Types, but not their members, are not hidden by default.
3373
3374 @item
3375 The One Definition Rule is relaxed for types without explicit
3376 visibility specifications that are defined in more than one
3377 shared object: those declarations are permitted if they are
3378 permitted when this option is not used.
3379 @end enumerate
3380
3381 In new code it is better to use @option{-fvisibility=hidden} and
3382 export those classes that are intended to be externally visible.
3383 Unfortunately it is possible for code to rely, perhaps accidentally,
3384 on the Visual Studio behavior.
3385
3386 Among the consequences of these changes are that static data members
3387 of the same type with the same name but defined in different shared
3388 objects are different, so changing one does not change the other;
3389 and that pointers to function members defined in different shared
3390 objects may not compare equal. When this flag is given, it is a
3391 violation of the ODR to define types with the same name differently.
3392
3393 @item -fno-weak
3394 @opindex fno-weak
3395 @opindex fweak
3396 Do not use weak symbol support, even if it is provided by the linker.
3397 By default, G++ uses weak symbols if they are available. This
3398 option exists only for testing, and should not be used by end-users;
3399 it results in inferior code and has no benefits. This option may
3400 be removed in a future release of G++.
3401
3402 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3403 @opindex fext-numeric-literals
3404 @opindex fno-ext-numeric-literals
3405 Accept imaginary, fixed-point, or machine-defined
3406 literal number suffixes as GNU extensions.
3407 When this option is turned off these suffixes are treated
3408 as C++11 user-defined literal numeric suffixes.
3409 This is on by default for all pre-C++11 dialects and all GNU dialects:
3410 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3411 @option{-std=gnu++14}.
3412 This option is off by default
3413 for ISO C++11 onwards (@option{-std=c++11}, ...).
3414
3415 @item -nostdinc++
3416 @opindex nostdinc++
3417 Do not search for header files in the standard directories specific to
3418 C++, but do still search the other standard directories. (This option
3419 is used when building the C++ library.)
3420
3421 @item -flang-info-include-translate
3422 @itemx -flang-info-include-translate-not
3423 @itemx -flang-info-include-translate=@var{header}
3424 @opindex flang-info-include-translate
3425 @opindex flang-info-include-translate-not
3426 Inform of include translation events. The first will note accepted
3427 include translations, the second will note declined include
3428 translations. The @var{header} form will inform of include
3429 translations relating to that specific header. If @var{header} is of
3430 the form @code{"user"} or @code{<system>} it will be resolved to a
3431 specific user or system header using the include path.
3432
3433 @item -flang-info-module-cmi
3434 @itemx -flang-info-module-cmi=@var{module}
3435 @opindex flang-info-module-cmi
3436 Inform of Compiled Module Interface pathnames. The first will note
3437 all read CMI pathnames. The @var{module} form will not reading a
3438 specific module's CMI. @var{module} may be a named module or a
3439 header-unit (the latter indicated by either being a pathname containing
3440 directory separators or enclosed in @code{<>} or @code{""}).
3441
3442 @item -stdlib=@var{libstdc++,libc++}
3443 @opindex stdlib
3444 When G++ is configured to support this option, it allows specification of
3445 alternate C++ runtime libraries. Two options are available: @var{libstdc++}
3446 (the default, native C++ runtime for G++) and @var{libc++} which is the
3447 C++ runtime installed on some operating systems (e.g. Darwin versions from
3448 Darwin11 onwards). The option switches G++ to use the headers from the
3449 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3450 when a C++ runtime is required for linking.
3451 @end table
3452
3453 In addition, these warning options have meanings only for C++ programs:
3454
3455 @table @gcctabopt
3456 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3457 @opindex Wabi-tag
3458 Warn when a type with an ABI tag is used in a context that does not
3459 have that ABI tag. See @ref{C++ Attributes} for more information
3460 about ABI tags.
3461
3462 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3463 @opindex Wcomma-subscript
3464 @opindex Wno-comma-subscript
3465 Warn about uses of a comma expression within a subscripting expression.
3466 This usage was deprecated in C++20. However, a comma expression wrapped
3467 in @code{( )} is not deprecated. Example:
3468
3469 @smallexample
3470 @group
3471 void f(int *a, int b, int c) @{
3472 a[b,c]; // deprecated
3473 a[(b,c)]; // OK
3474 @}
3475 @end group
3476 @end smallexample
3477
3478 Enabled by default with @option{-std=c++20}.
3479
3480 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3481 @opindex Wctad-maybe-unsupported
3482 @opindex Wno-ctad-maybe-unsupported
3483 Warn when performing class template argument deduction (CTAD) on a type with
3484 no explicitly written deduction guides. This warning will point out cases
3485 where CTAD succeeded only because the compiler synthesized the implicit
3486 deduction guides, which might not be what the programmer intended. Certain
3487 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3488 types that are designed to support CTAD. This warning can be suppressed with
3489 the following pattern:
3490
3491 @smallexample
3492 struct allow_ctad_t; // any name works
3493 template <typename T> struct S @{
3494 S(T) @{ @}
3495 @};
3496 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3497 @end smallexample
3498
3499 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3500 @opindex Wctor-dtor-privacy
3501 @opindex Wno-ctor-dtor-privacy
3502 Warn when a class seems unusable because all the constructors or
3503 destructors in that class are private, and it has neither friends nor
3504 public static member functions. Also warn if there are no non-private
3505 methods, and there's at least one private member function that isn't
3506 a constructor or destructor.
3507
3508 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3509 @opindex Wdelete-non-virtual-dtor
3510 @opindex Wno-delete-non-virtual-dtor
3511 Warn when @code{delete} is used to destroy an instance of a class that
3512 has virtual functions and non-virtual destructor. It is unsafe to delete
3513 an instance of a derived class through a pointer to a base class if the
3514 base class does not have a virtual destructor. This warning is enabled
3515 by @option{-Wall}.
3516
3517 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3518 @opindex Wdeprecated-copy
3519 @opindex Wno-deprecated-copy
3520 Warn that the implicit declaration of a copy constructor or copy
3521 assignment operator is deprecated if the class has a user-provided
3522 copy constructor or copy assignment operator, in C++11 and up. This
3523 warning is enabled by @option{-Wextra}. With
3524 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3525 user-provided destructor.
3526
3527 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3528 @opindex Wdeprecated-enum-enum-conversion
3529 @opindex Wno-deprecated-enum-enum-conversion
3530 Disable the warning about the case when the usual arithmetic conversions
3531 are applied on operands where one is of enumeration type and the other is
3532 of a different enumeration type. This conversion was deprecated in C++20.
3533 For example:
3534
3535 @smallexample
3536 enum E1 @{ e @};
3537 enum E2 @{ f @};
3538 int k = f - e;
3539 @end smallexample
3540
3541 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3542 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3543 by @option{-Wenum-conversion}.
3544
3545 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3546 @opindex Wdeprecated-enum-float-conversion
3547 @opindex Wno-deprecated-enum-float-conversion
3548 Disable the warning about the case when the usual arithmetic conversions
3549 are applied on operands where one is of enumeration type and the other is
3550 of a floating-point type. This conversion was deprecated in C++20. For
3551 example:
3552
3553 @smallexample
3554 enum E1 @{ e @};
3555 enum E2 @{ f @};
3556 bool b = e <= 3.7;
3557 @end smallexample
3558
3559 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3560 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3561 by @option{-Wenum-conversion}.
3562
3563 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3564 @opindex Winit-list-lifetime
3565 @opindex Wno-init-list-lifetime
3566 Do not warn about uses of @code{std::initializer_list} that are likely
3567 to result in dangling pointers. Since the underlying array for an
3568 @code{initializer_list} is handled like a normal C++ temporary object,
3569 it is easy to inadvertently keep a pointer to the array past the end
3570 of the array's lifetime. For example:
3571
3572 @itemize @bullet
3573 @item
3574 If a function returns a temporary @code{initializer_list}, or a local
3575 @code{initializer_list} variable, the array's lifetime ends at the end
3576 of the return statement, so the value returned has a dangling pointer.
3577
3578 @item
3579 If a new-expression creates an @code{initializer_list}, the array only
3580 lives until the end of the enclosing full-expression, so the
3581 @code{initializer_list} in the heap has a dangling pointer.
3582
3583 @item
3584 When an @code{initializer_list} variable is assigned from a
3585 brace-enclosed initializer list, the temporary array created for the
3586 right side of the assignment only lives until the end of the
3587 full-expression, so at the next statement the @code{initializer_list}
3588 variable has a dangling pointer.
3589
3590 @smallexample
3591 // li's initial underlying array lives as long as li
3592 std::initializer_list<int> li = @{ 1,2,3 @};
3593 // assignment changes li to point to a temporary array
3594 li = @{ 4, 5 @};
3595 // now the temporary is gone and li has a dangling pointer
3596 int i = li.begin()[0] // undefined behavior
3597 @end smallexample
3598
3599 @item
3600 When a list constructor stores the @code{begin} pointer from the
3601 @code{initializer_list} argument, this doesn't extend the lifetime of
3602 the array, so if a class variable is constructed from a temporary
3603 @code{initializer_list}, the pointer is left dangling by the end of
3604 the variable declaration statement.
3605
3606 @end itemize
3607
3608 @item -Winvalid-imported-macros
3609 @opindex Winvalid-imported-macros
3610 @opindex Wno-invalid-imported-macros
3611 Verify all imported macro definitions are valid at the end of
3612 compilation. This is not enabled by default, as it requires
3613 additional processing to determine. It may be useful when preparing
3614 sets of header-units to ensure consistent macros.
3615
3616 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3617 @opindex Wliteral-suffix
3618 @opindex Wno-literal-suffix
3619 Do not warn when a string or character literal is followed by a
3620 ud-suffix which does not begin with an underscore. As a conforming
3621 extension, GCC treats such suffixes as separate preprocessing tokens
3622 in order to maintain backwards compatibility with code that uses
3623 formatting macros from @code{<inttypes.h>}. For example:
3624
3625 @smallexample
3626 #define __STDC_FORMAT_MACROS
3627 #include <inttypes.h>
3628 #include <stdio.h>
3629
3630 int main() @{
3631 int64_t i64 = 123;
3632 printf("My int64: %" PRId64"\n", i64);
3633 @}
3634 @end smallexample
3635
3636 In this case, @code{PRId64} is treated as a separate preprocessing token.
3637
3638 This option also controls warnings when a user-defined literal
3639 operator is declared with a literal suffix identifier that doesn't
3640 begin with an underscore. Literal suffix identifiers that don't begin
3641 with an underscore are reserved for future standardization.
3642
3643 These warnings are enabled by default.
3644
3645 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3646 @opindex Wnarrowing
3647 @opindex Wno-narrowing
3648 For C++11 and later standards, narrowing conversions are diagnosed by default,
3649 as required by the standard. A narrowing conversion from a constant produces
3650 an error, and a narrowing conversion from a non-constant produces a warning,
3651 but @option{-Wno-narrowing} suppresses the diagnostic.
3652 Note that this does not affect the meaning of well-formed code;
3653 narrowing conversions are still considered ill-formed in SFINAE contexts.
3654
3655 With @option{-Wnarrowing} in C++98, warn when a narrowing
3656 conversion prohibited by C++11 occurs within
3657 @samp{@{ @}}, e.g.
3658
3659 @smallexample
3660 int i = @{ 2.2 @}; // error: narrowing from double to int
3661 @end smallexample
3662
3663 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3664
3665 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3666 @opindex Wnoexcept
3667 @opindex Wno-noexcept
3668 Warn when a noexcept-expression evaluates to false because of a call
3669 to a function that does not have a non-throwing exception
3670 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3671 the compiler to never throw an exception.
3672
3673 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3674 @opindex Wnoexcept-type
3675 @opindex Wno-noexcept-type
3676 Warn if the C++17 feature making @code{noexcept} part of a function
3677 type changes the mangled name of a symbol relative to C++14. Enabled
3678 by @option{-Wabi} and @option{-Wc++17-compat}.
3679
3680 As an example:
3681
3682 @smallexample
3683 template <class T> void f(T t) @{ t(); @};
3684 void g() noexcept;
3685 void h() @{ f(g); @}
3686 @end smallexample
3687
3688 @noindent
3689 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3690 C++17 it calls @code{f<void(*)()noexcept>}.
3691
3692 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3693 @opindex Wclass-memaccess
3694 @opindex Wno-class-memaccess
3695 Warn when the destination of a call to a raw memory function such as
3696 @code{memset} or @code{memcpy} is an object of class type, and when writing
3697 into such an object might bypass the class non-trivial or deleted constructor
3698 or copy assignment, violate const-correctness or encapsulation, or corrupt
3699 virtual table pointers. Modifying the representation of such objects may
3700 violate invariants maintained by member functions of the class. For example,
3701 the call to @code{memset} below is undefined because it modifies a non-trivial
3702 class object and is, therefore, diagnosed. The safe way to either initialize
3703 or clear the storage of objects of such types is by using the appropriate
3704 constructor or assignment operator, if one is available.
3705 @smallexample
3706 std::string str = "abc";
3707 memset (&str, 0, sizeof str);
3708 @end smallexample
3709 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3710 Explicitly casting the pointer to the class object to @code{void *} or
3711 to a type that can be safely accessed by the raw memory function suppresses
3712 the warning.
3713
3714 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3715 @opindex Wnon-virtual-dtor
3716 @opindex Wno-non-virtual-dtor
3717 Warn when a class has virtual functions and an accessible non-virtual
3718 destructor itself or in an accessible polymorphic base class, in which
3719 case it is possible but unsafe to delete an instance of a derived
3720 class through a pointer to the class itself or base class. This
3721 warning is automatically enabled if @option{-Weffc++} is specified.
3722
3723 @item -Wregister @r{(C++ and Objective-C++ only)}
3724 @opindex Wregister
3725 @opindex Wno-register
3726 Warn on uses of the @code{register} storage class specifier, except
3727 when it is part of the GNU @ref{Explicit Register Variables} extension.
3728 The use of the @code{register} keyword as storage class specifier has
3729 been deprecated in C++11 and removed in C++17.
3730 Enabled by default with @option{-std=c++17}.
3731
3732 @item -Wreorder @r{(C++ and Objective-C++ only)}
3733 @opindex Wreorder
3734 @opindex Wno-reorder
3735 @cindex reordering, warning
3736 @cindex warning for reordering of member initializers
3737 Warn when the order of member initializers given in the code does not
3738 match the order in which they must be executed. For instance:
3739
3740 @smallexample
3741 struct A @{
3742 int i;
3743 int j;
3744 A(): j (0), i (1) @{ @}
3745 @};
3746 @end smallexample
3747
3748 @noindent
3749 The compiler rearranges the member initializers for @code{i}
3750 and @code{j} to match the declaration order of the members, emitting
3751 a warning to that effect. This warning is enabled by @option{-Wall}.
3752
3753 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3754 @opindex Wpessimizing-move
3755 @opindex Wno-pessimizing-move
3756 This warning warns when a call to @code{std::move} prevents copy
3757 elision. A typical scenario when copy elision can occur is when returning in
3758 a function with a class return type, when the expression being returned is the
3759 name of a non-volatile automatic object, and is not a function parameter, and
3760 has the same type as the function return type.
3761
3762 @smallexample
3763 struct T @{
3764 @dots{}
3765 @};
3766 T fn()
3767 @{
3768 T t;
3769 @dots{}
3770 return std::move (t);
3771 @}
3772 @end smallexample
3773
3774 But in this example, the @code{std::move} call prevents copy elision.
3775
3776 This warning is enabled by @option{-Wall}.
3777
3778 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3779 @opindex Wredundant-move
3780 @opindex Wno-redundant-move
3781 This warning warns about redundant calls to @code{std::move}; that is, when
3782 a move operation would have been performed even without the @code{std::move}
3783 call. This happens because the compiler is forced to treat the object as if
3784 it were an rvalue in certain situations such as returning a local variable,
3785 where copy elision isn't applicable. Consider:
3786
3787 @smallexample
3788 struct T @{
3789 @dots{}
3790 @};
3791 T fn(T t)
3792 @{
3793 @dots{}
3794 return std::move (t);
3795 @}
3796 @end smallexample
3797
3798 Here, the @code{std::move} call is redundant. Because G++ implements Core
3799 Issue 1579, another example is:
3800
3801 @smallexample
3802 struct T @{ // convertible to U
3803 @dots{}
3804 @};
3805 struct U @{
3806 @dots{}
3807 @};
3808 U fn()
3809 @{
3810 T t;
3811 @dots{}
3812 return std::move (t);
3813 @}
3814 @end smallexample
3815 In this example, copy elision isn't applicable because the type of the
3816 expression being returned and the function return type differ, yet G++
3817 treats the return value as if it were designated by an rvalue.
3818
3819 This warning is enabled by @option{-Wextra}.
3820
3821 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
3822 @opindex Wrange-loop-construct
3823 @opindex Wno-range-loop-construct
3824 This warning warns when a C++ range-based for-loop is creating an unnecessary
3825 copy. This can happen when the range declaration is not a reference, but
3826 probably should be. For example:
3827
3828 @smallexample
3829 struct S @{ char arr[128]; @};
3830 void fn () @{
3831 S arr[5];
3832 for (const auto x : arr) @{ @dots{} @}
3833 @}
3834 @end smallexample
3835
3836 It does not warn when the type being copied is a trivially-copyable type whose
3837 size is less than 64 bytes.
3838
3839 This warning also warns when a loop variable in a range-based for-loop is
3840 initialized with a value of a different type resulting in a copy. For example:
3841
3842 @smallexample
3843 void fn() @{
3844 int arr[10];
3845 for (const double &x : arr) @{ @dots{} @}
3846 @}
3847 @end smallexample
3848
3849 In the example above, in every iteration of the loop a temporary value of
3850 type @code{double} is created and destroyed, to which the reference
3851 @code{const double &} is bound.
3852
3853 This warning is enabled by @option{-Wall}.
3854
3855 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3856 @opindex Wredundant-tags
3857 @opindex Wno-redundant-tags
3858 Warn about redundant class-key and enum-key in references to class types
3859 and enumerated types in contexts where the key can be eliminated without
3860 causing an ambiguity. For example:
3861
3862 @smallexample
3863 struct foo;
3864 struct foo *p; // warn that keyword struct can be eliminated
3865 @end smallexample
3866
3867 @noindent
3868 On the other hand, in this example there is no warning:
3869
3870 @smallexample
3871 struct foo;
3872 void foo (); // "hides" struct foo
3873 void bar (struct foo&); // no warning, keyword struct is necessary
3874 @end smallexample
3875
3876 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3877 @opindex Wsubobject-linkage
3878 @opindex Wno-subobject-linkage
3879 Do not warn
3880 if a class type has a base or a field whose type uses the anonymous
3881 namespace or depends on a type with no linkage. If a type A depends on
3882 a type B with no or internal linkage, defining it in multiple
3883 translation units would be an ODR violation because the meaning of B
3884 is different in each translation unit. If A only appears in a single
3885 translation unit, the best way to silence the warning is to give it
3886 internal linkage by putting it in an anonymous namespace as well. The
3887 compiler doesn't give this warning for types defined in the main .C
3888 file, as those are unlikely to have multiple definitions.
3889 @option{-Wsubobject-linkage} is enabled by default.
3890
3891 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3892 @opindex Weffc++
3893 @opindex Wno-effc++
3894 Warn about violations of the following style guidelines from Scott Meyers'
3895 @cite{Effective C++} series of books:
3896
3897 @itemize @bullet
3898 @item
3899 Define a copy constructor and an assignment operator for classes
3900 with dynamically-allocated memory.
3901
3902 @item
3903 Prefer initialization to assignment in constructors.
3904
3905 @item
3906 Have @code{operator=} return a reference to @code{*this}.
3907
3908 @item
3909 Don't try to return a reference when you must return an object.
3910
3911 @item
3912 Distinguish between prefix and postfix forms of increment and
3913 decrement operators.
3914
3915 @item
3916 Never overload @code{&&}, @code{||}, or @code{,}.
3917
3918 @end itemize
3919
3920 This option also enables @option{-Wnon-virtual-dtor}, which is also
3921 one of the effective C++ recommendations. However, the check is
3922 extended to warn about the lack of virtual destructor in accessible
3923 non-polymorphic bases classes too.
3924
3925 When selecting this option, be aware that the standard library
3926 headers do not obey all of these guidelines; use @samp{grep -v}
3927 to filter out those warnings.
3928
3929 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
3930 @opindex Wexceptions
3931 @opindex Wno-exceptions
3932 Disable the warning about the case when an exception handler is shadowed by
3933 another handler, which can point out a wrong ordering of exception handlers.
3934
3935 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3936 @opindex Wstrict-null-sentinel
3937 @opindex Wno-strict-null-sentinel
3938 Warn about the use of an uncasted @code{NULL} as sentinel. When
3939 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3940 to @code{__null}. Although it is a null pointer constant rather than a
3941 null pointer, it is guaranteed to be of the same size as a pointer.
3942 But this use is not portable across different compilers.
3943
3944 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3945 @opindex Wno-non-template-friend
3946 @opindex Wnon-template-friend
3947 Disable warnings when non-template friend functions are declared
3948 within a template. In very old versions of GCC that predate implementation
3949 of the ISO standard, declarations such as
3950 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3951 could be interpreted as a particular specialization of a template
3952 function; the warning exists to diagnose compatibility problems,
3953 and is enabled by default.
3954
3955 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3956 @opindex Wold-style-cast
3957 @opindex Wno-old-style-cast
3958 Warn if an old-style (C-style) cast to a non-void type is used within
3959 a C++ program. The new-style casts (@code{dynamic_cast},
3960 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3961 less vulnerable to unintended effects and much easier to search for.
3962
3963 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3964 @opindex Woverloaded-virtual
3965 @opindex Wno-overloaded-virtual
3966 @cindex overloaded virtual function, warning
3967 @cindex warning for overloaded virtual function
3968 Warn when a function declaration hides virtual functions from a
3969 base class. For example, in:
3970
3971 @smallexample
3972 struct A @{
3973 virtual void f();
3974 @};
3975
3976 struct B: public A @{
3977 void f(int);
3978 @};
3979 @end smallexample
3980
3981 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3982 like:
3983
3984 @smallexample
3985 B* b;
3986 b->f();
3987 @end smallexample
3988
3989 @noindent
3990 fails to compile.
3991
3992 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3993 @opindex Wno-pmf-conversions
3994 @opindex Wpmf-conversions
3995 Disable the diagnostic for converting a bound pointer to member function
3996 to a plain pointer.
3997
3998 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3999 @opindex Wsign-promo
4000 @opindex Wno-sign-promo
4001 Warn when overload resolution chooses a promotion from unsigned or
4002 enumerated type to a signed type, over a conversion to an unsigned type of
4003 the same size. Previous versions of G++ tried to preserve
4004 unsignedness, but the standard mandates the current behavior.
4005
4006 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4007 @opindex Wtemplates
4008 @opindex Wno-templates
4009 Warn when a primary template declaration is encountered. Some coding
4010 rules disallow templates, and this may be used to enforce that rule.
4011 The warning is inactive inside a system header file, such as the STL, so
4012 one can still use the STL. One may also instantiate or specialize
4013 templates.
4014
4015 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4016 @opindex Wmismatched-new-delete
4017 @opindex Wno-mismatched-new-delete
4018 Warn for mismatches between calls to @code{operator new} or @code{operator
4019 delete} and the corresponding call to the allocation or deallocation function.
4020 This includes invocations of C++ @code{operator delete} with pointers
4021 returned from either mismatched forms of @code{operator new}, or from other
4022 functions that allocate objects for which the @code{operator delete} isn't
4023 a suitable deallocator, as well as calls to other deallocation functions
4024 with pointers returned from @code{operator new} for which the deallocation
4025 function isn't suitable.
4026
4027 For example, the @code{delete} expression in the function below is diagnosed
4028 because it doesn't match the array form of the @code{new} expression
4029 the pointer argument was returned from. Similarly, the call to @code{free}
4030 is also diagnosed.
4031
4032 @smallexample
4033 void f ()
4034 @{
4035 int *a = new int[n];
4036 delete a; // warning: mismatch in array forms of expressions
4037
4038 char *p = new char[n];
4039 free (p); // warning: mismatch between new and free
4040 @}
4041 @end smallexample
4042
4043 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4044 involving allocation and deallocation functions other than @code{operator
4045 new} and @code{operator delete}.
4046
4047 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4048
4049 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4050 @opindex Wmismatched-tags
4051 @opindex Wno-mismatched-tags
4052 Warn for declarations of structs, classes, and class templates and their
4053 specializations with a class-key that does not match either the definition
4054 or the first declaration if no definition is provided.
4055
4056 For example, the declaration of @code{struct Object} in the argument list
4057 of @code{draw} triggers the warning. To avoid it, either remove the redundant
4058 class-key @code{struct} or replace it with @code{class} to match its definition.
4059 @smallexample
4060 class Object @{
4061 public:
4062 virtual ~Object () = 0;
4063 @};
4064 void draw (struct Object*);
4065 @end smallexample
4066
4067 It is not wrong to declare a class with the class-key @code{struct} as
4068 the example above shows. The @option{-Wmismatched-tags} option is intended
4069 to help achieve a consistent style of class declarations. In code that is
4070 intended to be portable to Windows-based compilers the warning helps prevent
4071 unresolved references due to the difference in the mangling of symbols
4072 declared with different class-keys. The option can be used either on its
4073 own or in conjunction with @option{-Wredundant-tags}.
4074
4075 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4076 @opindex Wmultiple-inheritance
4077 @opindex Wno-multiple-inheritance
4078 Warn when a class is defined with multiple direct base classes. Some
4079 coding rules disallow multiple inheritance, and this may be used to
4080 enforce that rule. The warning is inactive inside a system header file,
4081 such as the STL, so one can still use the STL. One may also define
4082 classes that indirectly use multiple inheritance.
4083
4084 @item -Wvirtual-inheritance
4085 @opindex Wvirtual-inheritance
4086 @opindex Wno-virtual-inheritance
4087 Warn when a class is defined with a virtual direct base class. Some
4088 coding rules disallow multiple inheritance, and this may be used to
4089 enforce that rule. The warning is inactive inside a system header file,
4090 such as the STL, so one can still use the STL. One may also define
4091 classes that indirectly use virtual inheritance.
4092
4093 @item -Wno-virtual-move-assign
4094 @opindex Wvirtual-move-assign
4095 @opindex Wno-virtual-move-assign
4096 Suppress warnings about inheriting from a virtual base with a
4097 non-trivial C++11 move assignment operator. This is dangerous because
4098 if the virtual base is reachable along more than one path, it is
4099 moved multiple times, which can mean both objects end up in the
4100 moved-from state. If the move assignment operator is written to avoid
4101 moving from a moved-from object, this warning can be disabled.
4102
4103 @item -Wnamespaces
4104 @opindex Wnamespaces
4105 @opindex Wno-namespaces
4106 Warn when a namespace definition is opened. Some coding rules disallow
4107 namespaces, and this may be used to enforce that rule. The warning is
4108 inactive inside a system header file, such as the STL, so one can still
4109 use the STL. One may also use using directives and qualified names.
4110
4111 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4112 @opindex Wterminate
4113 @opindex Wno-terminate
4114 Disable the warning about a throw-expression that will immediately
4115 result in a call to @code{terminate}.
4116
4117 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4118 @opindex Wvexing-parse
4119 @opindex Wno-vexing-parse
4120 Warn about the most vexing parse syntactic ambiguity. This warns about
4121 the cases when a declaration looks like a variable definition, but the
4122 C++ language requires it to be interpreted as a function declaration.
4123 For instance:
4124
4125 @smallexample
4126 void f(double a) @{
4127 int i(); // extern int i (void);
4128 int n(int(a)); // extern int n (int);
4129 @}
4130 @end smallexample
4131
4132 Another example:
4133
4134 @smallexample
4135 struct S @{ S(int); @};
4136 void f(double a) @{
4137 S x(int(a)); // extern struct S x (int);
4138 S y(int()); // extern struct S y (int (*) (void));
4139 S z(); // extern struct S z (void);
4140 @}
4141 @end smallexample
4142
4143 The warning will suggest options how to deal with such an ambiguity; e.g.,
4144 it can suggest removing the parentheses or using braces instead.
4145
4146 This warning is enabled by default.
4147
4148 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4149 @opindex Wno-class-conversion
4150 @opindex Wclass-conversion
4151 Do not warn when a conversion function converts an
4152 object to the same type, to a base class of that type, or to void; such
4153 a conversion function will never be called.
4154
4155 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4156 @opindex Wvolatile
4157 @opindex Wno-volatile
4158 Warn about deprecated uses of the @code{volatile} qualifier. This includes
4159 postfix and prefix @code{++} and @code{--} expressions of
4160 @code{volatile}-qualified types, using simple assignments where the left
4161 operand is a @code{volatile}-qualified non-class type for their value,
4162 compound assignments where the left operand is a @code{volatile}-qualified
4163 non-class type, @code{volatile}-qualified function return type,
4164 @code{volatile}-qualified parameter type, and structured bindings of a
4165 @code{volatile}-qualified type. This usage was deprecated in C++20.
4166
4167 Enabled by default with @option{-std=c++20}.
4168
4169 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4170 @opindex Wzero-as-null-pointer-constant
4171 @opindex Wno-zero-as-null-pointer-constant
4172 Warn when a literal @samp{0} is used as null pointer constant. This can
4173 be useful to facilitate the conversion to @code{nullptr} in C++11.
4174
4175 @item -Waligned-new
4176 @opindex Waligned-new
4177 @opindex Wno-aligned-new
4178 Warn about a new-expression of a type that requires greater alignment
4179 than the @code{alignof(std::max_align_t)} but uses an allocation
4180 function without an explicit alignment parameter. This option is
4181 enabled by @option{-Wall}.
4182
4183 Normally this only warns about global allocation functions, but
4184 @option{-Waligned-new=all} also warns about class member allocation
4185 functions.
4186
4187 @item -Wno-placement-new
4188 @itemx -Wplacement-new=@var{n}
4189 @opindex Wplacement-new
4190 @opindex Wno-placement-new
4191 Warn about placement new expressions with undefined behavior, such as
4192 constructing an object in a buffer that is smaller than the type of
4193 the object. For example, the placement new expression below is diagnosed
4194 because it attempts to construct an array of 64 integers in a buffer only
4195 64 bytes large.
4196 @smallexample
4197 char buf [64];
4198 new (buf) int[64];
4199 @end smallexample
4200 This warning is enabled by default.
4201
4202 @table @gcctabopt
4203 @item -Wplacement-new=1
4204 This is the default warning level of @option{-Wplacement-new}. At this
4205 level the warning is not issued for some strictly undefined constructs that
4206 GCC allows as extensions for compatibility with legacy code. For example,
4207 the following @code{new} expression is not diagnosed at this level even
4208 though it has undefined behavior according to the C++ standard because
4209 it writes past the end of the one-element array.
4210 @smallexample
4211 struct S @{ int n, a[1]; @};
4212 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4213 new (s->a)int [32]();
4214 @end smallexample
4215
4216 @item -Wplacement-new=2
4217 At this level, in addition to diagnosing all the same constructs as at level
4218 1, a diagnostic is also issued for placement new expressions that construct
4219 an object in the last member of structure whose type is an array of a single
4220 element and whose size is less than the size of the object being constructed.
4221 While the previous example would be diagnosed, the following construct makes
4222 use of the flexible member array extension to avoid the warning at level 2.
4223 @smallexample
4224 struct S @{ int n, a[]; @};
4225 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4226 new (s->a)int [32]();
4227 @end smallexample
4228
4229 @end table
4230
4231 @item -Wcatch-value
4232 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4233 @opindex Wcatch-value
4234 @opindex Wno-catch-value
4235 Warn about catch handlers that do not catch via reference.
4236 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4237 warn about polymorphic class types that are caught by value.
4238 With @option{-Wcatch-value=2} warn about all class types that are caught
4239 by value. With @option{-Wcatch-value=3} warn about all types that are
4240 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4241
4242 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4243 @opindex Wconditionally-supported
4244 @opindex Wno-conditionally-supported
4245 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4246
4247 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4248 @opindex Wdelete-incomplete
4249 @opindex Wno-delete-incomplete
4250 Do not warn when deleting a pointer to incomplete type, which may cause
4251 undefined behavior at runtime. This warning is enabled by default.
4252
4253 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4254 @opindex Wextra-semi
4255 @opindex Wno-extra-semi
4256 Warn about redundant semicolons after in-class function definitions.
4257
4258 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4259 @opindex Winaccessible-base
4260 @opindex Wno-inaccessible-base
4261 This option controls warnings
4262 when a base class is inaccessible in a class derived from it due to
4263 ambiguity. The warning is enabled by default.
4264 Note that the warning for ambiguous virtual
4265 bases is enabled by the @option{-Wextra} option.
4266 @smallexample
4267 @group
4268 struct A @{ int a; @};
4269
4270 struct B : A @{ @};
4271
4272 struct C : B, A @{ @};
4273 @end group
4274 @end smallexample
4275
4276 @item -Wno-inherited-variadic-ctor
4277 @opindex Winherited-variadic-ctor
4278 @opindex Wno-inherited-variadic-ctor
4279 Suppress warnings about use of C++11 inheriting constructors when the
4280 base class inherited from has a C variadic constructor; the warning is
4281 on by default because the ellipsis is not inherited.
4282
4283 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4284 @opindex Wno-invalid-offsetof
4285 @opindex Winvalid-offsetof
4286 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4287 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
4288 to a non-standard-layout type is undefined. In existing C++ implementations,
4289 however, @code{offsetof} typically gives meaningful results.
4290 This flag is for users who are aware that they are
4291 writing nonportable code and who have deliberately chosen to ignore the
4292 warning about it.
4293
4294 The restrictions on @code{offsetof} may be relaxed in a future version
4295 of the C++ standard.
4296
4297 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4298 @opindex Wsized-deallocation
4299 @opindex Wno-sized-deallocation
4300 Warn about a definition of an unsized deallocation function
4301 @smallexample
4302 void operator delete (void *) noexcept;
4303 void operator delete[] (void *) noexcept;
4304 @end smallexample
4305 without a definition of the corresponding sized deallocation function
4306 @smallexample
4307 void operator delete (void *, std::size_t) noexcept;
4308 void operator delete[] (void *, std::size_t) noexcept;
4309 @end smallexample
4310 or vice versa. Enabled by @option{-Wextra} along with
4311 @option{-fsized-deallocation}.
4312
4313 @item -Wsuggest-final-types
4314 @opindex Wno-suggest-final-types
4315 @opindex Wsuggest-final-types
4316 Warn about types with virtual methods where code quality would be improved
4317 if the type were declared with the C++11 @code{final} specifier,
4318 or, if possible,
4319 declared in an anonymous namespace. This allows GCC to more aggressively
4320 devirtualize the polymorphic calls. This warning is more effective with
4321 link-time optimization,
4322 where the information about the class hierarchy graph is
4323 more complete.
4324
4325 @item -Wsuggest-final-methods
4326 @opindex Wno-suggest-final-methods
4327 @opindex Wsuggest-final-methods
4328 Warn about virtual methods where code quality would be improved if the method
4329 were declared with the C++11 @code{final} specifier,
4330 or, if possible, its type were
4331 declared in an anonymous namespace or with the @code{final} specifier.
4332 This warning is
4333 more effective with link-time optimization, where the information about the
4334 class hierarchy graph is more complete. It is recommended to first consider
4335 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4336 annotations.
4337
4338 @item -Wsuggest-override
4339 @opindex Wsuggest-override
4340 @opindex Wno-suggest-override
4341 Warn about overriding virtual functions that are not marked with the
4342 @code{override} keyword.
4343
4344 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4345 @opindex Wuseless-cast
4346 @opindex Wno-useless-cast
4347 Warn when an expression is casted to its own type.
4348
4349 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4350 @opindex Wconversion-null
4351 @opindex Wno-conversion-null
4352 Do not warn for conversions between @code{NULL} and non-pointer
4353 types. @option{-Wconversion-null} is enabled by default.
4354
4355 @end table
4356
4357 @node Objective-C and Objective-C++ Dialect Options
4358 @section Options Controlling Objective-C and Objective-C++ Dialects
4359
4360 @cindex compiler options, Objective-C and Objective-C++
4361 @cindex Objective-C and Objective-C++ options, command-line
4362 @cindex options, Objective-C and Objective-C++
4363 (NOTE: This manual does not describe the Objective-C and Objective-C++
4364 languages themselves. @xref{Standards,,Language Standards
4365 Supported by GCC}, for references.)
4366
4367 This section describes the command-line options that are only meaningful
4368 for Objective-C and Objective-C++ programs. You can also use most of
4369 the language-independent GNU compiler options.
4370 For example, you might compile a file @file{some_class.m} like this:
4371
4372 @smallexample
4373 gcc -g -fgnu-runtime -O -c some_class.m
4374 @end smallexample
4375
4376 @noindent
4377 In this example, @option{-fgnu-runtime} is an option meant only for
4378 Objective-C and Objective-C++ programs; you can use the other options with
4379 any language supported by GCC@.
4380
4381 Note that since Objective-C is an extension of the C language, Objective-C
4382 compilations may also use options specific to the C front-end (e.g.,
4383 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4384 C++-specific options (e.g., @option{-Wabi}).
4385
4386 Here is a list of options that are @emph{only} for compiling Objective-C
4387 and Objective-C++ programs:
4388
4389 @table @gcctabopt
4390 @item -fconstant-string-class=@var{class-name}
4391 @opindex fconstant-string-class
4392 Use @var{class-name} as the name of the class to instantiate for each
4393 literal string specified with the syntax @code{@@"@dots{}"}. The default
4394 class name is @code{NXConstantString} if the GNU runtime is being used, and
4395 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4396 @option{-fconstant-cfstrings} option, if also present, overrides the
4397 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4398 to be laid out as constant CoreFoundation strings.
4399
4400 @item -fgnu-runtime
4401 @opindex fgnu-runtime
4402 Generate object code compatible with the standard GNU Objective-C
4403 runtime. This is the default for most types of systems.
4404
4405 @item -fnext-runtime
4406 @opindex fnext-runtime
4407 Generate output compatible with the NeXT runtime. This is the default
4408 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4409 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4410 used.
4411
4412 @item -fno-nil-receivers
4413 @opindex fno-nil-receivers
4414 @opindex fnil-receivers
4415 Assume that all Objective-C message dispatches (@code{[receiver
4416 message:arg]}) in this translation unit ensure that the receiver is
4417 not @code{nil}. This allows for more efficient entry points in the
4418 runtime to be used. This option is only available in conjunction with
4419 the NeXT runtime and ABI version 0 or 1.
4420
4421 @item -fobjc-abi-version=@var{n}
4422 @opindex fobjc-abi-version
4423 Use version @var{n} of the Objective-C ABI for the selected runtime.
4424 This option is currently supported only for the NeXT runtime. In that
4425 case, Version 0 is the traditional (32-bit) ABI without support for
4426 properties and other Objective-C 2.0 additions. Version 1 is the
4427 traditional (32-bit) ABI with support for properties and other
4428 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4429 nothing is specified, the default is Version 0 on 32-bit target
4430 machines, and Version 2 on 64-bit target machines.
4431
4432 @item -fobjc-call-cxx-cdtors
4433 @opindex fobjc-call-cxx-cdtors
4434 For each Objective-C class, check if any of its instance variables is a
4435 C++ object with a non-trivial default constructor. If so, synthesize a
4436 special @code{- (id) .cxx_construct} instance method which runs
4437 non-trivial default constructors on any such instance variables, in order,
4438 and then return @code{self}. Similarly, check if any instance variable
4439 is a C++ object with a non-trivial destructor, and if so, synthesize a
4440 special @code{- (void) .cxx_destruct} method which runs
4441 all such default destructors, in reverse order.
4442
4443 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4444 methods thusly generated only operate on instance variables
4445 declared in the current Objective-C class, and not those inherited
4446 from superclasses. It is the responsibility of the Objective-C
4447 runtime to invoke all such methods in an object's inheritance
4448 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4449 by the runtime immediately after a new object instance is allocated;
4450 the @code{- (void) .cxx_destruct} methods are invoked immediately
4451 before the runtime deallocates an object instance.
4452
4453 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4454 support for invoking the @code{- (id) .cxx_construct} and
4455 @code{- (void) .cxx_destruct} methods.
4456
4457 @item -fobjc-direct-dispatch
4458 @opindex fobjc-direct-dispatch
4459 Allow fast jumps to the message dispatcher. On Darwin this is
4460 accomplished via the comm page.
4461
4462 @item -fobjc-exceptions
4463 @opindex fobjc-exceptions
4464 Enable syntactic support for structured exception handling in
4465 Objective-C, similar to what is offered by C++. This option
4466 is required to use the Objective-C keywords @code{@@try},
4467 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4468 @code{@@synchronized}. This option is available with both the GNU
4469 runtime and the NeXT runtime (but not available in conjunction with
4470 the NeXT runtime on Mac OS X 10.2 and earlier).
4471
4472 @item -fobjc-gc
4473 @opindex fobjc-gc
4474 Enable garbage collection (GC) in Objective-C and Objective-C++
4475 programs. This option is only available with the NeXT runtime; the
4476 GNU runtime has a different garbage collection implementation that
4477 does not require special compiler flags.
4478
4479 @item -fobjc-nilcheck
4480 @opindex fobjc-nilcheck
4481 For the NeXT runtime with version 2 of the ABI, check for a nil
4482 receiver in method invocations before doing the actual method call.
4483 This is the default and can be disabled using
4484 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4485 checked for nil in this way no matter what this flag is set to.
4486 Currently this flag does nothing when the GNU runtime, or an older
4487 version of the NeXT runtime ABI, is used.
4488
4489 @item -fobjc-std=objc1
4490 @opindex fobjc-std
4491 Conform to the language syntax of Objective-C 1.0, the language
4492 recognized by GCC 4.0. This only affects the Objective-C additions to
4493 the C/C++ language; it does not affect conformance to C/C++ standards,
4494 which is controlled by the separate C/C++ dialect option flags. When
4495 this option is used with the Objective-C or Objective-C++ compiler,
4496 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4497 This is useful if you need to make sure that your Objective-C code can
4498 be compiled with older versions of GCC@.
4499
4500 @item -freplace-objc-classes
4501 @opindex freplace-objc-classes
4502 Emit a special marker instructing @command{ld(1)} not to statically link in
4503 the resulting object file, and allow @command{dyld(1)} to load it in at
4504 run time instead. This is used in conjunction with the Fix-and-Continue
4505 debugging mode, where the object file in question may be recompiled and
4506 dynamically reloaded in the course of program execution, without the need
4507 to restart the program itself. Currently, Fix-and-Continue functionality
4508 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4509 and later.
4510
4511 @item -fzero-link
4512 @opindex fzero-link
4513 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4514 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4515 compile time) with static class references that get initialized at load time,
4516 which improves run-time performance. Specifying the @option{-fzero-link} flag
4517 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4518 to be retained. This is useful in Zero-Link debugging mode, since it allows
4519 for individual class implementations to be modified during program execution.
4520 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4521 regardless of command-line options.
4522
4523 @item -fno-local-ivars
4524 @opindex fno-local-ivars
4525 @opindex flocal-ivars
4526 By default instance variables in Objective-C can be accessed as if
4527 they were local variables from within the methods of the class they're
4528 declared in. This can lead to shadowing between instance variables
4529 and other variables declared either locally inside a class method or
4530 globally with the same name. Specifying the @option{-fno-local-ivars}
4531 flag disables this behavior thus avoiding variable shadowing issues.
4532
4533 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4534 @opindex fivar-visibility
4535 Set the default instance variable visibility to the specified option
4536 so that instance variables declared outside the scope of any access
4537 modifier directives default to the specified visibility.
4538
4539 @item -gen-decls
4540 @opindex gen-decls
4541 Dump interface declarations for all classes seen in the source file to a
4542 file named @file{@var{sourcename}.decl}.
4543
4544 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4545 @opindex Wassign-intercept
4546 @opindex Wno-assign-intercept
4547 Warn whenever an Objective-C assignment is being intercepted by the
4548 garbage collector.
4549
4550 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4551 @opindex Wproperty-assign-default
4552 @opindex Wno-property-assign-default
4553 Do not warn if a property for an Objective-C object has no assign
4554 semantics specified.
4555
4556 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4557 @opindex Wno-protocol
4558 @opindex Wprotocol
4559 If a class is declared to implement a protocol, a warning is issued for
4560 every method in the protocol that is not implemented by the class. The
4561 default behavior is to issue a warning for every method not explicitly
4562 implemented in the class, even if a method implementation is inherited
4563 from the superclass. If you use the @option{-Wno-protocol} option, then
4564 methods inherited from the superclass are considered to be implemented,
4565 and no warning is issued for them.
4566
4567 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4568 @opindex Wobjc-root-class
4569 Warn if a class interface lacks a superclass. Most classes will inherit
4570 from @code{NSObject} (or @code{Object}) for example. When declaring
4571 classes intended to be root classes, the warning can be suppressed by
4572 marking their interfaces with @code{__attribute__((objc_root_class))}.
4573
4574 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4575 @opindex Wselector
4576 @opindex Wno-selector
4577 Warn if multiple methods of different types for the same selector are
4578 found during compilation. The check is performed on the list of methods
4579 in the final stage of compilation. Additionally, a check is performed
4580 for each selector appearing in a @code{@@selector(@dots{})}
4581 expression, and a corresponding method for that selector has been found
4582 during compilation. Because these checks scan the method table only at
4583 the end of compilation, these warnings are not produced if the final
4584 stage of compilation is not reached, for example because an error is
4585 found during compilation, or because the @option{-fsyntax-only} option is
4586 being used.
4587
4588 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4589 @opindex Wstrict-selector-match
4590 @opindex Wno-strict-selector-match
4591 Warn if multiple methods with differing argument and/or return types are
4592 found for a given selector when attempting to send a message using this
4593 selector to a receiver of type @code{id} or @code{Class}. When this flag
4594 is off (which is the default behavior), the compiler omits such warnings
4595 if any differences found are confined to types that share the same size
4596 and alignment.
4597
4598 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4599 @opindex Wundeclared-selector
4600 @opindex Wno-undeclared-selector
4601 Warn if a @code{@@selector(@dots{})} expression referring to an
4602 undeclared selector is found. A selector is considered undeclared if no
4603 method with that name has been declared before the
4604 @code{@@selector(@dots{})} expression, either explicitly in an
4605 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4606 an @code{@@implementation} section. This option always performs its
4607 checks as soon as a @code{@@selector(@dots{})} expression is found,
4608 while @option{-Wselector} only performs its checks in the final stage of
4609 compilation. This also enforces the coding style convention
4610 that methods and selectors must be declared before being used.
4611
4612 @item -print-objc-runtime-info
4613 @opindex print-objc-runtime-info
4614 Generate C header describing the largest structure that is passed by
4615 value, if any.
4616
4617 @end table
4618
4619 @node Diagnostic Message Formatting Options
4620 @section Options to Control Diagnostic Messages Formatting
4621 @cindex options to control diagnostics formatting
4622 @cindex diagnostic messages
4623 @cindex message formatting
4624
4625 Traditionally, diagnostic messages have been formatted irrespective of
4626 the output device's aspect (e.g.@: its width, @dots{}). You can use the
4627 options described below
4628 to control the formatting algorithm for diagnostic messages,
4629 e.g.@: how many characters per line, how often source location
4630 information should be reported. Note that some language front ends may not
4631 honor these options.
4632
4633 @table @gcctabopt
4634 @item -fmessage-length=@var{n}
4635 @opindex fmessage-length
4636 Try to format error messages so that they fit on lines of about
4637 @var{n} characters. If @var{n} is zero, then no line-wrapping is
4638 done; each error message appears on a single line. This is the
4639 default for all front ends.
4640
4641 Note - this option also affects the display of the @samp{#error} and
4642 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4643 function/type/variable attribute. It does not however affect the
4644 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4645
4646 @item -fdiagnostics-plain-output
4647 This option requests that diagnostic output look as plain as possible, which
4648 may be useful when running @command{dejagnu} or other utilities that need to
4649 parse diagnostics output and prefer that it remain more stable over time.
4650 @option{-fdiagnostics-plain-output} is currently equivalent to the following
4651 options:
4652 @gccoptlist{-fno-diagnostics-show-caret @gol
4653 -fno-diagnostics-show-line-numbers @gol
4654 -fdiagnostics-color=never @gol
4655 -fdiagnostics-urls=never @gol
4656 -fdiagnostics-path-format=separate-events}
4657 In the future, if GCC changes the default appearance of its diagnostics, the
4658 corresponding option to disable the new behavior will be added to this list.
4659
4660 @item -fdiagnostics-show-location=once
4661 @opindex fdiagnostics-show-location
4662 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
4663 reporter to emit source location information @emph{once}; that is, in
4664 case the message is too long to fit on a single physical line and has to
4665 be wrapped, the source location won't be emitted (as prefix) again,
4666 over and over, in subsequent continuation lines. This is the default
4667 behavior.
4668
4669 @item -fdiagnostics-show-location=every-line
4670 Only meaningful in line-wrapping mode. Instructs the diagnostic
4671 messages reporter to emit the same source location information (as
4672 prefix) for physical lines that result from the process of breaking
4673 a message which is too long to fit on a single line.
4674
4675 @item -fdiagnostics-color[=@var{WHEN}]
4676 @itemx -fno-diagnostics-color
4677 @opindex fdiagnostics-color
4678 @cindex highlight, color
4679 @vindex GCC_COLORS @r{environment variable}
4680 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
4681 or @samp{auto}. The default depends on how the compiler has been configured,
4682 it can be any of the above @var{WHEN} options or also @samp{never}
4683 if @env{GCC_COLORS} environment variable isn't present in the environment,
4684 and @samp{auto} otherwise.
4685 @samp{auto} makes GCC use color only when the standard error is a terminal,
4686 and when not executing in an emacs shell.
4687 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4688 aliases for @option{-fdiagnostics-color=always} and
4689 @option{-fdiagnostics-color=never}, respectively.
4690
4691 The colors are defined by the environment variable @env{GCC_COLORS}.
4692 Its value is a colon-separated list of capabilities and Select Graphic
4693 Rendition (SGR) substrings. SGR commands are interpreted by the
4694 terminal or terminal emulator. (See the section in the documentation
4695 of your text terminal for permitted values and their meanings as
4696 character attributes.) These substring values are integers in decimal
4697 representation and can be concatenated with semicolons.
4698 Common values to concatenate include
4699 @samp{1} for bold,
4700 @samp{4} for underline,
4701 @samp{5} for blink,
4702 @samp{7} for inverse,
4703 @samp{39} for default foreground color,
4704 @samp{30} to @samp{37} for foreground colors,
4705 @samp{90} to @samp{97} for 16-color mode foreground colors,
4706 @samp{38;5;0} to @samp{38;5;255}
4707 for 88-color and 256-color modes foreground colors,
4708 @samp{49} for default background color,
4709 @samp{40} to @samp{47} for background colors,
4710 @samp{100} to @samp{107} for 16-color mode background colors,
4711 and @samp{48;5;0} to @samp{48;5;255}
4712 for 88-color and 256-color modes background colors.
4713
4714 The default @env{GCC_COLORS} is
4715 @smallexample
4716 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4717 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4718 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4719 type-diff=01;32
4720 @end smallexample
4721 @noindent
4722 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4723 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4724 @samp{01} is bold, and @samp{31} is red.
4725 Setting @env{GCC_COLORS} to the empty string disables colors.
4726 Supported capabilities are as follows.
4727
4728 @table @code
4729 @item error=
4730 @vindex error GCC_COLORS @r{capability}
4731 SGR substring for error: markers.
4732
4733 @item warning=
4734 @vindex warning GCC_COLORS @r{capability}
4735 SGR substring for warning: markers.
4736
4737 @item note=
4738 @vindex note GCC_COLORS @r{capability}
4739 SGR substring for note: markers.
4740
4741 @item path=
4742 @vindex path GCC_COLORS @r{capability}
4743 SGR substring for colorizing paths of control-flow events as printed
4744 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4745 individual events and lines indicating interprocedural calls and returns.
4746
4747 @item range1=
4748 @vindex range1 GCC_COLORS @r{capability}
4749 SGR substring for first additional range.
4750
4751 @item range2=
4752 @vindex range2 GCC_COLORS @r{capability}
4753 SGR substring for second additional range.
4754
4755 @item locus=
4756 @vindex locus GCC_COLORS @r{capability}
4757 SGR substring for location information, @samp{file:line} or
4758 @samp{file:line:column} etc.
4759
4760 @item quote=
4761 @vindex quote GCC_COLORS @r{capability}
4762 SGR substring for information printed within quotes.
4763
4764 @item fixit-insert=
4765 @vindex fixit-insert GCC_COLORS @r{capability}
4766 SGR substring for fix-it hints suggesting text to
4767 be inserted or replaced.
4768
4769 @item fixit-delete=
4770 @vindex fixit-delete GCC_COLORS @r{capability}
4771 SGR substring for fix-it hints suggesting text to
4772 be deleted.
4773
4774 @item diff-filename=
4775 @vindex diff-filename GCC_COLORS @r{capability}
4776 SGR substring for filename headers within generated patches.
4777
4778 @item diff-hunk=
4779 @vindex diff-hunk GCC_COLORS @r{capability}
4780 SGR substring for the starts of hunks within generated patches.
4781
4782 @item diff-delete=
4783 @vindex diff-delete GCC_COLORS @r{capability}
4784 SGR substring for deleted lines within generated patches.
4785
4786 @item diff-insert=
4787 @vindex diff-insert GCC_COLORS @r{capability}
4788 SGR substring for inserted lines within generated patches.
4789
4790 @item type-diff=
4791 @vindex type-diff GCC_COLORS @r{capability}
4792 SGR substring for highlighting mismatching types within template
4793 arguments in the C++ frontend.
4794 @end table
4795
4796 @item -fdiagnostics-urls[=@var{WHEN}]
4797 @opindex fdiagnostics-urls
4798 @cindex urls
4799 @vindex GCC_URLS @r{environment variable}
4800 @vindex TERM_URLS @r{environment variable}
4801 Use escape sequences to embed URLs in diagnostics. For example, when
4802 @option{-fdiagnostics-show-option} emits text showing the command-line
4803 option controlling a diagnostic, embed a URL for documentation of that
4804 option.
4805
4806 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4807 @samp{auto} makes GCC use URL escape sequences only when the standard error
4808 is a terminal, and when not executing in an emacs shell or any graphical
4809 terminal which is known to be incompatible with this feature, see below.
4810
4811 The default depends on how the compiler has been configured.
4812 It can be any of the above @var{WHEN} options.
4813
4814 GCC can also be configured (via the
4815 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4816 so that the default is affected by environment variables.
4817 Under such a configuration, GCC defaults to using @samp{auto}
4818 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4819 present and non-empty in the environment of the compiler, or @samp{never}
4820 if neither are.
4821
4822 However, even with @option{-fdiagnostics-urls=always} the behavior is
4823 dependent on those environment variables:
4824 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4825 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4826 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4827 Any other non-empty value enables the feature.
4828 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4829 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4830 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4831
4832 At this time GCC tries to detect also a few terminals that are known to
4833 not implement the URL feature, and have bugs or at least had bugs in
4834 some versions that are still in use, where the URL escapes are likely
4835 to misbehave, i.e. print garbage on the screen.
4836 That list is currently xfce4-terminal, certain known to be buggy
4837 gnome-terminal versions, the linux console, and mingw.
4838 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4839
4840 @item -fno-diagnostics-show-option
4841 @opindex fno-diagnostics-show-option
4842 @opindex fdiagnostics-show-option
4843 By default, each diagnostic emitted includes text indicating the
4844 command-line option that directly controls the diagnostic (if such an
4845 option is known to the diagnostic machinery). Specifying the
4846 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4847
4848 @item -fno-diagnostics-show-caret
4849 @opindex fno-diagnostics-show-caret
4850 @opindex fdiagnostics-show-caret
4851 By default, each diagnostic emitted includes the original source line
4852 and a caret @samp{^} indicating the column. This option suppresses this
4853 information. The source line is truncated to @var{n} characters, if
4854 the @option{-fmessage-length=n} option is given. When the output is done
4855 to the terminal, the width is limited to the width given by the
4856 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4857
4858 @item -fno-diagnostics-show-labels
4859 @opindex fno-diagnostics-show-labels
4860 @opindex fdiagnostics-show-labels
4861 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4862 diagnostics can label ranges of source code with pertinent information, such
4863 as the types of expressions:
4864
4865 @smallexample
4866 printf ("foo %s bar", long_i + long_j);
4867 ~^ ~~~~~~~~~~~~~~~
4868 | |
4869 char * long int
4870 @end smallexample
4871
4872 This option suppresses the printing of these labels (in the example above,
4873 the vertical bars and the ``char *'' and ``long int'' text).
4874
4875 @item -fno-diagnostics-show-cwe
4876 @opindex fno-diagnostics-show-cwe
4877 @opindex fdiagnostics-show-cwe
4878 Diagnostic messages can optionally have an associated
4879 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4880 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4881 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4882 By default, if this information is present, it will be printed with
4883 the diagnostic. This option suppresses the printing of this metadata.
4884
4885 @item -fno-diagnostics-show-line-numbers
4886 @opindex fno-diagnostics-show-line-numbers
4887 @opindex fdiagnostics-show-line-numbers
4888 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4889 a left margin is printed, showing line numbers. This option suppresses this
4890 left margin.
4891
4892 @item -fdiagnostics-minimum-margin-width=@var{width}
4893 @opindex fdiagnostics-minimum-margin-width
4894 This option controls the minimum width of the left margin printed by
4895 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4896
4897 @item -fdiagnostics-parseable-fixits
4898 @opindex fdiagnostics-parseable-fixits
4899 Emit fix-it hints in a machine-parseable format, suitable for consumption
4900 by IDEs. For each fix-it, a line will be printed after the relevant
4901 diagnostic, starting with the string ``fix-it:''. For example:
4902
4903 @smallexample
4904 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4905 @end smallexample
4906
4907 The location is expressed as a half-open range, expressed as a count of
4908 bytes, starting at byte 1 for the initial column. In the above example,
4909 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4910 given string:
4911
4912 @smallexample
4913 00000000011111111112222222222
4914 12345678901234567890123456789
4915 gtk_widget_showall (dlg);
4916 ^^^^^^^^^^^^^^^^^^
4917 gtk_widget_show_all
4918 @end smallexample
4919
4920 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4921 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4922 (e.g. vertical tab as ``\013'').
4923
4924 An empty replacement string indicates that the given range is to be removed.
4925 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4926 be inserted at the given position.
4927
4928 @item -fdiagnostics-generate-patch
4929 @opindex fdiagnostics-generate-patch
4930 Print fix-it hints to stderr in unified diff format, after any diagnostics
4931 are printed. For example:
4932
4933 @smallexample
4934 --- test.c
4935 +++ test.c
4936 @@ -42,5 +42,5 @@
4937
4938 void show_cb(GtkDialog *dlg)
4939 @{
4940 - gtk_widget_showall(dlg);
4941 + gtk_widget_show_all(dlg);
4942 @}
4943
4944 @end smallexample
4945
4946 The diff may or may not be colorized, following the same rules
4947 as for diagnostics (see @option{-fdiagnostics-color}).
4948
4949 @item -fdiagnostics-show-template-tree
4950 @opindex fdiagnostics-show-template-tree
4951
4952 In the C++ frontend, when printing diagnostics showing mismatching
4953 template types, such as:
4954
4955 @smallexample
4956 could not convert 'std::map<int, std::vector<double> >()'
4957 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4958 @end smallexample
4959
4960 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4961 tree-like structure showing the common and differing parts of the types,
4962 such as:
4963
4964 @smallexample
4965 map<
4966 [...],
4967 vector<
4968 [double != float]>>
4969 @end smallexample
4970
4971 The parts that differ are highlighted with color (``double'' and
4972 ``float'' in this case).
4973
4974 @item -fno-elide-type
4975 @opindex fno-elide-type
4976 @opindex felide-type
4977 By default when the C++ frontend prints diagnostics showing mismatching
4978 template types, common parts of the types are printed as ``[...]'' to
4979 simplify the error message. For example:
4980
4981 @smallexample
4982 could not convert 'std::map<int, std::vector<double> >()'
4983 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4984 @end smallexample
4985
4986 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4987 This flag also affects the output of the
4988 @option{-fdiagnostics-show-template-tree} flag.
4989
4990 @item -fdiagnostics-path-format=@var{KIND}
4991 @opindex fdiagnostics-path-format
4992 Specify how to print paths of control-flow events for diagnostics that
4993 have such a path associated with them.
4994
4995 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4996 the default.
4997
4998 @samp{none} means to not print diagnostic paths.
4999
5000 @samp{separate-events} means to print a separate ``note'' diagnostic for
5001 each event within the diagnostic. For example:
5002
5003 @smallexample
5004 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5005 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5006 test.c:27:3: note: (2) when 'i < count'
5007 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5008 @end smallexample
5009
5010 @samp{inline-events} means to print the events ``inline'' within the source
5011 code. This view attempts to consolidate the events into runs of
5012 sufficiently-close events, printing them as labelled ranges within the source.
5013
5014 For example, the same events as above might be printed as:
5015
5016 @smallexample
5017 'test': events 1-3
5018 |
5019 | 25 | list = PyList_New(0);
5020 | | ^~~~~~~~~~~~~
5021 | | |
5022 | | (1) when 'PyList_New' fails, returning NULL
5023 | 26 |
5024 | 27 | for (i = 0; i < count; i++) @{
5025 | | ~~~
5026 | | |
5027 | | (2) when 'i < count'
5028 | 28 | item = PyLong_FromLong(random());
5029 | 29 | PyList_Append(list, item);
5030 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
5031 | | |
5032 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5033 |
5034 @end smallexample
5035
5036 Interprocedural control flow is shown by grouping the events by stack frame,
5037 and using indentation to show how stack frames are nested, pushed, and popped.
5038
5039 For example:
5040
5041 @smallexample
5042 'test': events 1-2
5043 |
5044 | 133 | @{
5045 | | ^
5046 | | |
5047 | | (1) entering 'test'
5048 | 134 | boxed_int *obj = make_boxed_int (i);
5049 | | ~~~~~~~~~~~~~~~~~~
5050 | | |
5051 | | (2) calling 'make_boxed_int'
5052 |
5053 +--> 'make_boxed_int': events 3-4
5054 |
5055 | 120 | @{
5056 | | ^
5057 | | |
5058 | | (3) entering 'make_boxed_int'
5059 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5060 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5061 | | |
5062 | | (4) calling 'wrapped_malloc'
5063 |
5064 +--> 'wrapped_malloc': events 5-6
5065 |
5066 | 7 | @{
5067 | | ^
5068 | | |
5069 | | (5) entering 'wrapped_malloc'
5070 | 8 | return malloc (size);
5071 | | ~~~~~~~~~~~~~
5072 | | |
5073 | | (6) calling 'malloc'
5074 |
5075 <-------------+
5076 |
5077 'test': event 7
5078 |
5079 | 138 | free_boxed_int (obj);
5080 | | ^~~~~~~~~~~~~~~~~~~~
5081 | | |
5082 | | (7) calling 'free_boxed_int'
5083 |
5084 (etc)
5085 @end smallexample
5086
5087 @item -fdiagnostics-show-path-depths
5088 @opindex fdiagnostics-show-path-depths
5089 This option provides additional information when printing control-flow paths
5090 associated with a diagnostic.
5091
5092 If this is option is provided then the stack depth will be printed for
5093 each run of events within @option{-fdiagnostics-path-format=separate-events}.
5094
5095 This is intended for use by GCC developers and plugin developers when
5096 debugging diagnostics that report interprocedural control flow.
5097
5098 @item -fno-show-column
5099 @opindex fno-show-column
5100 @opindex fshow-column
5101 Do not print column numbers in diagnostics. This may be necessary if
5102 diagnostics are being scanned by a program that does not understand the
5103 column numbers, such as @command{dejagnu}.
5104
5105 @item -fdiagnostics-column-unit=@var{UNIT}
5106 @opindex fdiagnostics-column-unit
5107 Select the units for the column number. This affects traditional diagnostics
5108 (in the absence of @option{-fno-show-column}), as well as JSON format
5109 diagnostics if requested.
5110
5111 The default @var{UNIT}, @samp{display}, considers the number of display
5112 columns occupied by each character. This may be larger than the number
5113 of bytes required to encode the character, in the case of tab
5114 characters, or it may be smaller, in the case of multibyte characters.
5115 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5116 display column, and its UTF-8 encoding requires two bytes; the character
5117 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5118 its UTF-8 encoding requires four bytes.
5119
5120 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5121 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5122
5123 @item -fdiagnostics-column-origin=@var{ORIGIN}
5124 @opindex fdiagnostics-column-origin
5125 Select the origin for column numbers, i.e. the column number assigned to the
5126 first column. The default value of 1 corresponds to traditional GCC
5127 behavior and to the GNU style guide. Some utilities may perform better with an
5128 origin of 0; any non-negative value may be specified.
5129
5130 @item -fdiagnostics-escape-format=@var{FORMAT}
5131 @opindex fdiagnostics-escape-format
5132 When GCC prints pertinent source lines for a diagnostic it normally attempts
5133 to print the source bytes directly. However, some diagnostics relate to encoding
5134 issues in the source file, such as malformed UTF-8, or issues with Unicode
5135 normalization. These diagnostics are flagged so that GCC will escape bytes
5136 that are not printable ASCII when printing their pertinent source lines.
5137
5138 This option controls how such bytes should be escaped.
5139
5140 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5141 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5142 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5143 displayed as hexadecimal in the form @samp{<XX>}.
5144
5145 For example, a source line containing the string @samp{before} followed by the
5146 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5147 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5148 the string @samp{after} will be printed for such a diagnostic as:
5149
5150 @smallexample
5151 before<U+03C0><BF>after
5152 @end smallexample
5153
5154 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5155 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5156 Unicode characters. For the example above, the following will be printed:
5157
5158 @smallexample
5159 before<CF><80><BF>after
5160 @end smallexample
5161
5162 @item -fdiagnostics-format=@var{FORMAT}
5163 @opindex fdiagnostics-format
5164 Select a different format for printing diagnostics.
5165 @var{FORMAT} is @samp{text} or @samp{json}.
5166 The default is @samp{text}.
5167
5168 The @samp{json} format consists of a top-level JSON array containing JSON
5169 objects representing the diagnostics.
5170
5171 The JSON is emitted as one line, without formatting; the examples below
5172 have been formatted for clarity.
5173
5174 Diagnostics can have child diagnostics. For example, this error and note:
5175
5176 @smallexample
5177 misleading-indentation.c:15:3: warning: this 'if' clause does not
5178 guard... [-Wmisleading-indentation]
5179 15 | if (flag)
5180 | ^~
5181 misleading-indentation.c:17:5: note: ...this statement, but the latter
5182 is misleadingly indented as if it were guarded by the 'if'
5183 17 | y = 2;
5184 | ^
5185 @end smallexample
5186
5187 @noindent
5188 might be printed in JSON form (after formatting) like this:
5189
5190 @smallexample
5191 [
5192 @{
5193 "kind": "warning",
5194 "locations": [
5195 @{
5196 "caret": @{
5197 "display-column": 3,
5198 "byte-column": 3,
5199 "column": 3,
5200 "file": "misleading-indentation.c",
5201 "line": 15
5202 @},
5203 "finish": @{
5204 "display-column": 4,
5205 "byte-column": 4,
5206 "column": 4,
5207 "file": "misleading-indentation.c",
5208 "line": 15
5209 @}
5210 @}
5211 ],
5212 "message": "this \u2018if\u2019 clause does not guard...",
5213 "option": "-Wmisleading-indentation",
5214 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5215 "children": [
5216 @{
5217 "kind": "note",
5218 "locations": [
5219 @{
5220 "caret": @{
5221 "display-column": 5,
5222 "byte-column": 5,
5223 "column": 5,
5224 "file": "misleading-indentation.c",
5225 "line": 17
5226 @}
5227 @}
5228 ],
5229 "escape-source": false,
5230 "message": "...this statement, but the latter is @dots{}"
5231 @}
5232 ]
5233 "escape-source": false,
5234 "column-origin": 1,
5235 @}
5236 ]
5237 @end smallexample
5238
5239 @noindent
5240 where the @code{note} is a child of the @code{warning}.
5241
5242 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
5243 an @code{option} key describing the command-line option controlling the
5244 warning.
5245
5246 A diagnostic can contain zero or more locations. Each location has an
5247 optional @code{label} string and up to three positions within it: a
5248 @code{caret} position and optional @code{start} and @code{finish} positions.
5249 A position is described by a @code{file} name, a @code{line} number, and
5250 three numbers indicating a column position:
5251 @itemize @bullet
5252
5253 @item
5254 @code{display-column} counts display columns, accounting for tabs and
5255 multibyte characters.
5256
5257 @item
5258 @code{byte-column} counts raw bytes.
5259
5260 @item
5261 @code{column} is equal to one of
5262 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5263 option.
5264
5265 @end itemize
5266 All three columns are relative to the origin specified by
5267 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5268 be set, for instance, to 0 for compatibility with other utilities that
5269 number columns from 0. The column origin is recorded in the JSON output in
5270 the @code{column-origin} tag. In the remaining examples below, the extra
5271 column number outputs have been omitted for brevity.
5272
5273 For example, this error:
5274
5275 @smallexample
5276 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5277 'struct s'@} and 'T' @{aka 'struct t'@})
5278 64 | return callee_4a () + callee_4b ();
5279 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5280 | | |
5281 | | T @{aka struct t@}
5282 | S @{aka struct s@}
5283 @end smallexample
5284
5285 @noindent
5286 has three locations. Its primary location is at the ``+'' token at column
5287 23. It has two secondary locations, describing the left and right-hand sides
5288 of the expression, which have labels. It might be printed in JSON form as:
5289
5290 @smallexample
5291 @{
5292 "children": [],
5293 "kind": "error",
5294 "locations": [
5295 @{
5296 "caret": @{
5297 "column": 23, "file": "bad-binary-ops.c", "line": 64
5298 @}
5299 @},
5300 @{
5301 "caret": @{
5302 "column": 10, "file": "bad-binary-ops.c", "line": 64
5303 @},
5304 "finish": @{
5305 "column": 21, "file": "bad-binary-ops.c", "line": 64
5306 @},
5307 "label": "S @{aka struct s@}"
5308 @},
5309 @{
5310 "caret": @{
5311 "column": 25, "file": "bad-binary-ops.c", "line": 64
5312 @},
5313 "finish": @{
5314 "column": 36, "file": "bad-binary-ops.c", "line": 64
5315 @},
5316 "label": "T @{aka struct t@}"
5317 @}
5318 ],
5319 "escape-source": false,
5320 "message": "invalid operands to binary + @dots{}"
5321 @}
5322 @end smallexample
5323
5324 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5325 consisting of half-open intervals, similar to the output of
5326 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
5327 with a replacement fix-it hint:
5328
5329 @smallexample
5330 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5331 mean 'color'?
5332 8 | return ptr->colour;
5333 | ^~~~~~
5334 | color
5335 @end smallexample
5336
5337 @noindent
5338 might be printed in JSON form as:
5339
5340 @smallexample
5341 @{
5342 "children": [],
5343 "fixits": [
5344 @{
5345 "next": @{
5346 "column": 21,
5347 "file": "demo.c",
5348 "line": 8
5349 @},
5350 "start": @{
5351 "column": 15,
5352 "file": "demo.c",
5353 "line": 8
5354 @},
5355 "string": "color"
5356 @}
5357 ],
5358 "kind": "error",
5359 "locations": [
5360 @{
5361 "caret": @{
5362 "column": 15,
5363 "file": "demo.c",
5364 "line": 8
5365 @},
5366 "finish": @{
5367 "column": 20,
5368 "file": "demo.c",
5369 "line": 8
5370 @}
5371 @}
5372 ],
5373 "escape-source": false,
5374 "message": "\u2018struct s\u2019 has no member named @dots{}"
5375 @}
5376 @end smallexample
5377
5378 @noindent
5379 where the fix-it hint suggests replacing the text from @code{start} up
5380 to but not including @code{next} with @code{string}'s value. Deletions
5381 are expressed via an empty value for @code{string}, insertions by
5382 having @code{start} equal @code{next}.
5383
5384 If the diagnostic has a path of control-flow events associated with it,
5385 it has a @code{path} array of objects representing the events. Each
5386 event object has a @code{description} string, a @code{location} object,
5387 along with a @code{function} string and a @code{depth} number for
5388 representing interprocedural paths. The @code{function} represents the
5389 current function at that event, and the @code{depth} represents the
5390 stack depth relative to some baseline: the higher, the more frames are
5391 within the stack.
5392
5393 For example, the intraprocedural example shown for
5394 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5395
5396 @smallexample
5397 "path": [
5398 @{
5399 "depth": 0,
5400 "description": "when 'PyList_New' fails, returning NULL",
5401 "function": "test",
5402 "location": @{
5403 "column": 10,
5404 "file": "test.c",
5405 "line": 25
5406 @}
5407 @},
5408 @{
5409 "depth": 0,
5410 "description": "when 'i < count'",
5411 "function": "test",
5412 "location": @{
5413 "column": 3,
5414 "file": "test.c",
5415 "line": 27
5416 @}
5417 @},
5418 @{
5419 "depth": 0,
5420 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5421 "function": "test",
5422 "location": @{
5423 "column": 5,
5424 "file": "test.c",
5425 "line": 29
5426 @}
5427 @}
5428 ]
5429 @end smallexample
5430
5431 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5432 non-ASCII bytes should be escaped when printing the pertinent lines of
5433 source code (@code{true} for diagnostics involving source encoding issues).
5434
5435 @end table
5436
5437 @node Warning Options
5438 @section Options to Request or Suppress Warnings
5439 @cindex options to control warnings
5440 @cindex warning messages
5441 @cindex messages, warning
5442 @cindex suppressing warnings
5443
5444 Warnings are diagnostic messages that report constructions that
5445 are not inherently erroneous but that are risky or suggest there
5446 may have been an error.
5447
5448 The following language-independent options do not enable specific
5449 warnings but control the kinds of diagnostics produced by GCC@.
5450
5451 @table @gcctabopt
5452 @cindex syntax checking
5453 @item -fsyntax-only
5454 @opindex fsyntax-only
5455 Check the code for syntax errors, but don't do anything beyond that.
5456
5457 @item -fmax-errors=@var{n}
5458 @opindex fmax-errors
5459 Limits the maximum number of error messages to @var{n}, at which point
5460 GCC bails out rather than attempting to continue processing the source
5461 code. If @var{n} is 0 (the default), there is no limit on the number
5462 of error messages produced. If @option{-Wfatal-errors} is also
5463 specified, then @option{-Wfatal-errors} takes precedence over this
5464 option.
5465
5466 @item -w
5467 @opindex w
5468 Inhibit all warning messages.
5469
5470 @item -Werror
5471 @opindex Werror
5472 @opindex Wno-error
5473 Make all warnings into errors.
5474
5475 @item -Werror=
5476 @opindex Werror=
5477 @opindex Wno-error=
5478 Make the specified warning into an error. The specifier for a warning
5479 is appended; for example @option{-Werror=switch} turns the warnings
5480 controlled by @option{-Wswitch} into errors. This switch takes a
5481 negative form, to be used to negate @option{-Werror} for specific
5482 warnings; for example @option{-Wno-error=switch} makes
5483 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5484 is in effect.
5485
5486 The warning message for each controllable warning includes the
5487 option that controls the warning. That option can then be used with
5488 @option{-Werror=} and @option{-Wno-error=} as described above.
5489 (Printing of the option in the warning message can be disabled using the
5490 @option{-fno-diagnostics-show-option} flag.)
5491
5492 Note that specifying @option{-Werror=}@var{foo} automatically implies
5493 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5494 imply anything.
5495
5496 @item -Wfatal-errors
5497 @opindex Wfatal-errors
5498 @opindex Wno-fatal-errors
5499 This option causes the compiler to abort compilation on the first error
5500 occurred rather than trying to keep going and printing further error
5501 messages.
5502
5503 @end table
5504
5505 You can request many specific warnings with options beginning with
5506 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5507 implicit declarations. Each of these specific warning options also
5508 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5509 example, @option{-Wno-implicit}. This manual lists only one of the
5510 two forms, whichever is not the default. For further
5511 language-specific options also refer to @ref{C++ Dialect Options} and
5512 @ref{Objective-C and Objective-C++ Dialect Options}.
5513 Additional warnings can be produced by enabling the static analyzer;
5514 @xref{Static Analyzer Options}.
5515
5516 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5517 options, such as @option{-Wunused}, which may turn on further options,
5518 such as @option{-Wunused-value}. The combined effect of positive and
5519 negative forms is that more specific options have priority over less
5520 specific ones, independently of their position in the command-line. For
5521 options of the same specificity, the last one takes effect. Options
5522 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5523 as if they appeared at the end of the command-line.
5524
5525 When an unrecognized warning option is requested (e.g.,
5526 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5527 that the option is not recognized. However, if the @option{-Wno-} form
5528 is used, the behavior is slightly different: no diagnostic is
5529 produced for @option{-Wno-unknown-warning} unless other diagnostics
5530 are being produced. This allows the use of new @option{-Wno-} options
5531 with old compilers, but if something goes wrong, the compiler
5532 warns that an unrecognized option is present.
5533
5534 The effectiveness of some warnings depends on optimizations also being
5535 enabled. For example @option{-Wsuggest-final-types} is more effective
5536 with link-time optimization and @option{-Wmaybe-uninitialized} does not
5537 warn at all unless optimization is enabled.
5538
5539 @table @gcctabopt
5540 @item -Wpedantic
5541 @itemx -pedantic
5542 @opindex pedantic
5543 @opindex Wpedantic
5544 @opindex Wno-pedantic
5545 Issue all the warnings demanded by strict ISO C and ISO C++;
5546 reject all programs that use forbidden extensions, and some other
5547 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5548 version of the ISO C standard specified by any @option{-std} option used.
5549
5550 Valid ISO C and ISO C++ programs should compile properly with or without
5551 this option (though a rare few require @option{-ansi} or a
5552 @option{-std} option specifying the required version of ISO C)@. However,
5553 without this option, certain GNU extensions and traditional C and C++
5554 features are supported as well. With this option, they are rejected.
5555
5556 @option{-Wpedantic} does not cause warning messages for use of the
5557 alternate keywords whose names begin and end with @samp{__}. This alternate
5558 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5559 i.e. @samp{__intN__}.
5560 Pedantic warnings are also disabled in the expression that follows
5561 @code{__extension__}. However, only system header files should use
5562 these escape routes; application programs should avoid them.
5563 @xref{Alternate Keywords}.
5564
5565 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5566 C conformance. They soon find that it does not do quite what they want:
5567 it finds some non-ISO practices, but not all---only those for which
5568 ISO C @emph{requires} a diagnostic, and some others for which
5569 diagnostics have been added.
5570
5571 A feature to report any failure to conform to ISO C might be useful in
5572 some instances, but would require considerable additional work and would
5573 be quite different from @option{-Wpedantic}. We don't have plans to
5574 support such a feature in the near future.
5575
5576 Where the standard specified with @option{-std} represents a GNU
5577 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5578 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5579 extended dialect is based. Warnings from @option{-Wpedantic} are given
5580 where they are required by the base standard. (It does not make sense
5581 for such warnings to be given only for features not in the specified GNU
5582 C dialect, since by definition the GNU dialects of C include all
5583 features the compiler supports with the given option, and there would be
5584 nothing to warn about.)
5585
5586 @item -pedantic-errors
5587 @opindex pedantic-errors
5588 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5589 requires a diagnostic, in some cases where there is undefined behavior
5590 at compile-time and in some other cases that do not prevent compilation
5591 of programs that are valid according to the standard. This is not
5592 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5593 by this option and not enabled by the latter and vice versa.
5594
5595 @item -Wall
5596 @opindex Wall
5597 @opindex Wno-all
5598 This enables all the warnings about constructions that some users
5599 consider questionable, and that are easy to avoid (or modify to
5600 prevent the warning), even in conjunction with macros. This also
5601 enables some language-specific warnings described in @ref{C++ Dialect
5602 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5603
5604 @option{-Wall} turns on the following warning flags:
5605
5606 @gccoptlist{-Waddress @gol
5607 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
5608 -Warray-compare @gol
5609 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
5610 -Wbool-compare @gol
5611 -Wbool-operation @gol
5612 -Wc++11-compat -Wc++14-compat @gol
5613 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
5614 -Wchar-subscripts @gol
5615 -Wcomment @gol
5616 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5617 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5618 -Wformat @gol
5619 -Wformat-overflow @gol
5620 -Wformat-truncation @gol
5621 -Wint-in-bool-context @gol
5622 -Wimplicit @r{(C and Objective-C only)} @gol
5623 -Wimplicit-int @r{(C and Objective-C only)} @gol
5624 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5625 -Winit-self @r{(only for C++)} @gol
5626 -Wlogical-not-parentheses @gol
5627 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
5628 -Wmaybe-uninitialized @gol
5629 -Wmemset-elt-size @gol
5630 -Wmemset-transposed-args @gol
5631 -Wmisleading-indentation @r{(only for C/C++)} @gol
5632 -Wmismatched-dealloc @gol
5633 -Wmismatched-new-delete @r{(only for C/C++)} @gol
5634 -Wmissing-attributes @gol
5635 -Wmissing-braces @r{(only for C/ObjC)} @gol
5636 -Wmultistatement-macros @gol
5637 -Wnarrowing @r{(only for C++)} @gol
5638 -Wnonnull @gol
5639 -Wnonnull-compare @gol
5640 -Wopenmp-simd @gol
5641 -Wparentheses @gol
5642 -Wpessimizing-move @r{(only for C++)} @gol
5643 -Wpointer-sign @gol
5644 -Wrange-loop-construct @r{(only for C++)} @gol
5645 -Wreorder @gol
5646 -Wrestrict @gol
5647 -Wreturn-type @gol
5648 -Wsequence-point @gol
5649 -Wsign-compare @r{(only in C++)} @gol
5650 -Wsizeof-array-div @gol
5651 -Wsizeof-pointer-div @gol
5652 -Wsizeof-pointer-memaccess @gol
5653 -Wstrict-aliasing @gol
5654 -Wstrict-overflow=1 @gol
5655 -Wswitch @gol
5656 -Wtautological-compare @gol
5657 -Wtrigraphs @gol
5658 -Wuninitialized @gol
5659 -Wunknown-pragmas @gol
5660 -Wunused-function @gol
5661 -Wunused-label @gol
5662 -Wunused-value @gol
5663 -Wunused-variable @gol
5664 -Wvla-parameter @r{(C and Objective-C only)} @gol
5665 -Wvolatile-register-var @gol
5666 -Wzero-length-bounds}
5667
5668 Note that some warning flags are not implied by @option{-Wall}. Some of
5669 them warn about constructions that users generally do not consider
5670 questionable, but which occasionally you might wish to check for;
5671 others warn about constructions that are necessary or hard to avoid in
5672 some cases, and there is no simple way to modify the code to suppress
5673 the warning. Some of them are enabled by @option{-Wextra} but many of
5674 them must be enabled individually.
5675
5676 @item -Wextra
5677 @opindex W
5678 @opindex Wextra
5679 @opindex Wno-extra
5680 This enables some extra warning flags that are not enabled by
5681 @option{-Wall}. (This option used to be called @option{-W}. The older
5682 name is still supported, but the newer name is more descriptive.)
5683
5684 @gccoptlist{-Wclobbered @gol
5685 -Wcast-function-type @gol
5686 -Wdeprecated-copy @r{(C++ only)} @gol
5687 -Wempty-body @gol
5688 -Wenum-conversion @r{(C only)} @gol
5689 -Wignored-qualifiers @gol
5690 -Wimplicit-fallthrough=3 @gol
5691 -Wmissing-field-initializers @gol
5692 -Wmissing-parameter-type @r{(C only)} @gol
5693 -Wold-style-declaration @r{(C only)} @gol
5694 -Woverride-init @gol
5695 -Wsign-compare @r{(C only)} @gol
5696 -Wstring-compare @gol
5697 -Wredundant-move @r{(only for C++)} @gol
5698 -Wtype-limits @gol
5699 -Wuninitialized @gol
5700 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
5701 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5702 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5703
5704
5705 The option @option{-Wextra} also prints warning messages for the
5706 following cases:
5707
5708 @itemize @bullet
5709
5710 @item
5711 A pointer is compared against integer zero with @code{<}, @code{<=},
5712 @code{>}, or @code{>=}.
5713
5714 @item
5715 (C++ only) An enumerator and a non-enumerator both appear in a
5716 conditional expression.
5717
5718 @item
5719 (C++ only) Ambiguous virtual bases.
5720
5721 @item
5722 (C++ only) Subscripting an array that has been declared @code{register}.
5723
5724 @item
5725 (C++ only) Taking the address of a variable that has been declared
5726 @code{register}.
5727
5728 @item
5729 (C++ only) A base class is not initialized in the copy constructor
5730 of a derived class.
5731
5732 @end itemize
5733
5734 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5735 @opindex Wabi
5736 @opindex Wno-abi
5737
5738 Warn about code affected by ABI changes. This includes code that may
5739 not be compatible with the vendor-neutral C++ ABI as well as the psABI
5740 for the particular target.
5741
5742 Since G++ now defaults to updating the ABI with each major release,
5743 normally @option{-Wabi} warns only about C++ ABI compatibility
5744 problems if there is a check added later in a release series for an
5745 ABI issue discovered since the initial release. @option{-Wabi} warns
5746 about more things if an older ABI version is selected (with
5747 @option{-fabi-version=@var{n}}).
5748
5749 @option{-Wabi} can also be used with an explicit version number to
5750 warn about C++ ABI compatibility with a particular @option{-fabi-version}
5751 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5752 @option{-fabi-version=2}.
5753
5754 If an explicit version number is provided and
5755 @option{-fabi-compat-version} is not specified, the version number
5756 from this option is used for compatibility aliases. If no explicit
5757 version number is provided with this option, but
5758 @option{-fabi-compat-version} is specified, that version number is
5759 used for C++ ABI warnings.
5760
5761 Although an effort has been made to warn about
5762 all such cases, there are probably some cases that are not warned about,
5763 even though G++ is generating incompatible code. There may also be
5764 cases where warnings are emitted even though the code that is generated
5765 is compatible.
5766
5767 You should rewrite your code to avoid these warnings if you are
5768 concerned about the fact that code generated by G++ may not be binary
5769 compatible with code generated by other compilers.
5770
5771 Known incompatibilities in @option{-fabi-version=2} (which was the
5772 default from GCC 3.4 to 4.9) include:
5773
5774 @itemize @bullet
5775
5776 @item
5777 A template with a non-type template parameter of reference type was
5778 mangled incorrectly:
5779 @smallexample
5780 extern int N;
5781 template <int &> struct S @{@};
5782 void n (S<N>) @{2@}
5783 @end smallexample
5784
5785 This was fixed in @option{-fabi-version=3}.
5786
5787 @item
5788 SIMD vector types declared using @code{__attribute ((vector_size))} were
5789 mangled in a non-standard way that does not allow for overloading of
5790 functions taking vectors of different sizes.
5791
5792 The mangling was changed in @option{-fabi-version=4}.
5793
5794 @item
5795 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5796 qualifiers, and @code{decltype} of a plain declaration was folded away.
5797
5798 These mangling issues were fixed in @option{-fabi-version=5}.
5799
5800 @item
5801 Scoped enumerators passed as arguments to a variadic function are
5802 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5803 On most targets this does not actually affect the parameter passing
5804 ABI, as there is no way to pass an argument smaller than @code{int}.
5805
5806 Also, the ABI changed the mangling of template argument packs,
5807 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5808 a class scope function used as a template argument.
5809
5810 These issues were corrected in @option{-fabi-version=6}.
5811
5812 @item
5813 Lambdas in default argument scope were mangled incorrectly, and the
5814 ABI changed the mangling of @code{nullptr_t}.
5815
5816 These issues were corrected in @option{-fabi-version=7}.
5817
5818 @item
5819 When mangling a function type with function-cv-qualifiers, the
5820 un-qualified function type was incorrectly treated as a substitution
5821 candidate.
5822
5823 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5824
5825 @item
5826 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5827 unaligned accesses. Note that this did not affect the ABI of a
5828 function with a @code{nullptr_t} parameter, as parameters have a
5829 minimum alignment.
5830
5831 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5832
5833 @item
5834 Target-specific attributes that affect the identity of a type, such as
5835 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5836 did not affect the mangled name, leading to name collisions when
5837 function pointers were used as template arguments.
5838
5839 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5840
5841 @end itemize
5842
5843 This option also enables warnings about psABI-related changes.
5844 The known psABI changes at this point include:
5845
5846 @itemize @bullet
5847
5848 @item
5849 For SysV/x86-64, unions with @code{long double} members are
5850 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5851 the case. For example:
5852
5853 @smallexample
5854 union U @{
5855 long double ld;
5856 int i;
5857 @};
5858 @end smallexample
5859
5860 @noindent
5861 @code{union U} is now always passed in memory.
5862
5863 @end itemize
5864
5865 @item -Wchar-subscripts
5866 @opindex Wchar-subscripts
5867 @opindex Wno-char-subscripts
5868 Warn if an array subscript has type @code{char}. This is a common cause
5869 of error, as programmers often forget that this type is signed on some
5870 machines.
5871 This warning is enabled by @option{-Wall}.
5872
5873 @item -Wno-coverage-mismatch
5874 @opindex Wno-coverage-mismatch
5875 @opindex Wcoverage-mismatch
5876 Warn if feedback profiles do not match when using the
5877 @option{-fprofile-use} option.
5878 If a source file is changed between compiling with @option{-fprofile-generate}
5879 and with @option{-fprofile-use}, the files with the profile feedback can fail
5880 to match the source file and GCC cannot use the profile feedback
5881 information. By default, this warning is enabled and is treated as an
5882 error. @option{-Wno-coverage-mismatch} can be used to disable the
5883 warning or @option{-Wno-error=coverage-mismatch} can be used to
5884 disable the error. Disabling the error for this warning can result in
5885 poorly optimized code and is useful only in the
5886 case of very minor changes such as bug fixes to an existing code-base.
5887 Completely disabling the warning is not recommended.
5888
5889 @item -Wno-coverage-invalid-line-number
5890 @opindex Wno-coverage-invalid-line-number
5891 @opindex Wcoverage-invalid-line-number
5892 Warn in case a function ends earlier than it begins due
5893 to an invalid linenum macros. The warning is emitted only
5894 with @option{--coverage} enabled.
5895
5896 By default, this warning is enabled and is treated as an
5897 error. @option{-Wno-coverage-invalid-line-number} can be used to disable the
5898 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
5899 disable the error.
5900
5901 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5902 @opindex Wno-cpp
5903 @opindex Wcpp
5904 Suppress warning messages emitted by @code{#warning} directives.
5905
5906 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5907 @opindex Wdouble-promotion
5908 @opindex Wno-double-promotion
5909 Give a warning when a value of type @code{float} is implicitly
5910 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5911 floating-point unit implement @code{float} in hardware, but emulate
5912 @code{double} in software. On such a machine, doing computations
5913 using @code{double} values is much more expensive because of the
5914 overhead required for software emulation.
5915
5916 It is easy to accidentally do computations with @code{double} because
5917 floating-point literals are implicitly of type @code{double}. For
5918 example, in:
5919 @smallexample
5920 @group
5921 float area(float radius)
5922 @{
5923 return 3.14159 * radius * radius;
5924 @}
5925 @end group
5926 @end smallexample
5927 the compiler performs the entire computation with @code{double}
5928 because the floating-point literal is a @code{double}.
5929
5930 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5931 @opindex Wduplicate-decl-specifier
5932 @opindex Wno-duplicate-decl-specifier
5933 Warn if a declaration has duplicate @code{const}, @code{volatile},
5934 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5935 @option{-Wall}.
5936
5937 @item -Wformat
5938 @itemx -Wformat=@var{n}
5939 @opindex Wformat
5940 @opindex Wno-format
5941 @opindex ffreestanding
5942 @opindex fno-builtin
5943 @opindex Wformat=
5944 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5945 the arguments supplied have types appropriate to the format string
5946 specified, and that the conversions specified in the format string make
5947 sense. This includes standard functions, and others specified by format
5948 attributes (@pxref{Function Attributes}), in the @code{printf},
5949 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5950 not in the C standard) families (or other target-specific families).
5951 Which functions are checked without format attributes having been
5952 specified depends on the standard version selected, and such checks of
5953 functions without the attribute specified are disabled by
5954 @option{-ffreestanding} or @option{-fno-builtin}.
5955
5956 The formats are checked against the format features supported by GNU
5957 libc version 2.2. These include all ISO C90 and C99 features, as well
5958 as features from the Single Unix Specification and some BSD and GNU
5959 extensions. Other library implementations may not support all these
5960 features; GCC does not support warning about features that go beyond a
5961 particular library's limitations. However, if @option{-Wpedantic} is used
5962 with @option{-Wformat}, warnings are given about format features not
5963 in the selected standard version (but not for @code{strfmon} formats,
5964 since those are not in any version of the C standard). @xref{C Dialect
5965 Options,,Options Controlling C Dialect}.
5966
5967 @table @gcctabopt
5968 @item -Wformat=1
5969 @itemx -Wformat
5970 @opindex Wformat
5971 @opindex Wformat=1
5972 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5973 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5974 @option{-Wformat} also checks for null format arguments for several
5975 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5976 aspects of this level of format checking can be disabled by the
5977 options: @option{-Wno-format-contains-nul},
5978 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5979 @option{-Wformat} is enabled by @option{-Wall}.
5980
5981 @item -Wformat=2
5982 @opindex Wformat=2
5983 Enable @option{-Wformat} plus additional format checks. Currently
5984 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5985 -Wformat-y2k}.
5986 @end table
5987
5988 @item -Wno-format-contains-nul
5989 @opindex Wno-format-contains-nul
5990 @opindex Wformat-contains-nul
5991 If @option{-Wformat} is specified, do not warn about format strings that
5992 contain NUL bytes.
5993
5994 @item -Wno-format-extra-args
5995 @opindex Wno-format-extra-args
5996 @opindex Wformat-extra-args
5997 If @option{-Wformat} is specified, do not warn about excess arguments to a
5998 @code{printf} or @code{scanf} format function. The C standard specifies
5999 that such arguments are ignored.
6000
6001 Where the unused arguments lie between used arguments that are
6002 specified with @samp{$} operand number specifications, normally
6003 warnings are still given, since the implementation could not know what
6004 type to pass to @code{va_arg} to skip the unused arguments. However,
6005 in the case of @code{scanf} formats, this option suppresses the
6006 warning if the unused arguments are all pointers, since the Single
6007 Unix Specification says that such unused arguments are allowed.
6008
6009 @item -Wformat-overflow
6010 @itemx -Wformat-overflow=@var{level}
6011 @opindex Wformat-overflow
6012 @opindex Wno-format-overflow
6013 Warn about calls to formatted input/output functions such as @code{sprintf}
6014 and @code{vsprintf} that might overflow the destination buffer. When the
6015 exact number of bytes written by a format directive cannot be determined
6016 at compile-time it is estimated based on heuristics that depend on the
6017 @var{level} argument and on optimization. While enabling optimization
6018 will in most cases improve the accuracy of the warning, it may also
6019 result in false positives.
6020
6021 @table @gcctabopt
6022 @item -Wformat-overflow
6023 @itemx -Wformat-overflow=1
6024 @opindex Wformat-overflow
6025 @opindex Wno-format-overflow
6026 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6027 employs a conservative approach that warns only about calls that most
6028 likely overflow the buffer. At this level, numeric arguments to format
6029 directives with unknown values are assumed to have the value of one, and
6030 strings of unknown length to be empty. Numeric arguments that are known
6031 to be bounded to a subrange of their type, or string arguments whose output
6032 is bounded either by their directive's precision or by a finite set of
6033 string literals, are assumed to take on the value within the range that
6034 results in the most bytes on output. For example, the call to @code{sprintf}
6035 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6036 the terminating NUL character (@code{'\0'}) appended by the function
6037 to the destination buffer will be written past its end. Increasing
6038 the size of the buffer by a single byte is sufficient to avoid the
6039 warning, though it may not be sufficient to avoid the overflow.
6040
6041 @smallexample
6042 void f (int a, int b)
6043 @{
6044 char buf [13];
6045 sprintf (buf, "a = %i, b = %i\n", a, b);
6046 @}
6047 @end smallexample
6048
6049 @item -Wformat-overflow=2
6050 Level @var{2} warns also about calls that might overflow the destination
6051 buffer given an argument of sufficient length or magnitude. At level
6052 @var{2}, unknown numeric arguments are assumed to have the minimum
6053 representable value for signed types with a precision greater than 1, and
6054 the maximum representable value otherwise. Unknown string arguments whose
6055 length cannot be assumed to be bounded either by the directive's precision,
6056 or by a finite set of string literals they may evaluate to, or the character
6057 array they may point to, are assumed to be 1 character long.
6058
6059 At level @var{2}, the call in the example above is again diagnosed, but
6060 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6061 @code{%i} directive will write some of its digits beyond the end of
6062 the destination buffer. To make the call safe regardless of the values
6063 of the two variables, the size of the destination buffer must be increased
6064 to at least 34 bytes. GCC includes the minimum size of the buffer in
6065 an informational note following the warning.
6066
6067 An alternative to increasing the size of the destination buffer is to
6068 constrain the range of formatted values. The maximum length of string
6069 arguments can be bounded by specifying the precision in the format
6070 directive. When numeric arguments of format directives can be assumed
6071 to be bounded by less than the precision of their type, choosing
6072 an appropriate length modifier to the format specifier will reduce
6073 the required buffer size. For example, if @var{a} and @var{b} in the
6074 example above can be assumed to be within the precision of
6075 the @code{short int} type then using either the @code{%hi} format
6076 directive or casting the argument to @code{short} reduces the maximum
6077 required size of the buffer to 24 bytes.
6078
6079 @smallexample
6080 void f (int a, int b)
6081 @{
6082 char buf [23];
6083 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6084 @}
6085 @end smallexample
6086 @end table
6087
6088 @item -Wno-format-zero-length
6089 @opindex Wno-format-zero-length
6090 @opindex Wformat-zero-length
6091 If @option{-Wformat} is specified, do not warn about zero-length formats.
6092 The C standard specifies that zero-length formats are allowed.
6093
6094 @item -Wformat-nonliteral
6095 @opindex Wformat-nonliteral
6096 @opindex Wno-format-nonliteral
6097 If @option{-Wformat} is specified, also warn if the format string is not a
6098 string literal and so cannot be checked, unless the format function
6099 takes its format arguments as a @code{va_list}.
6100
6101 @item -Wformat-security
6102 @opindex Wformat-security
6103 @opindex Wno-format-security
6104 If @option{-Wformat} is specified, also warn about uses of format
6105 functions that represent possible security problems. At present, this
6106 warns about calls to @code{printf} and @code{scanf} functions where the
6107 format string is not a string literal and there are no format arguments,
6108 as in @code{printf (foo);}. This may be a security hole if the format
6109 string came from untrusted input and contains @samp{%n}. (This is
6110 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6111 in future warnings may be added to @option{-Wformat-security} that are not
6112 included in @option{-Wformat-nonliteral}.)
6113
6114 @item -Wformat-signedness
6115 @opindex Wformat-signedness
6116 @opindex Wno-format-signedness
6117 If @option{-Wformat} is specified, also warn if the format string
6118 requires an unsigned argument and the argument is signed and vice versa.
6119
6120 @item -Wformat-truncation
6121 @itemx -Wformat-truncation=@var{level}
6122 @opindex Wformat-truncation
6123 @opindex Wno-format-truncation
6124 Warn about calls to formatted input/output functions such as @code{snprintf}
6125 and @code{vsnprintf} that might result in output truncation. When the exact
6126 number of bytes written by a format directive cannot be determined at
6127 compile-time it is estimated based on heuristics that depend on
6128 the @var{level} argument and on optimization. While enabling optimization
6129 will in most cases improve the accuracy of the warning, it may also result
6130 in false positives. Except as noted otherwise, the option uses the same
6131 logic @option{-Wformat-overflow}.
6132
6133 @table @gcctabopt
6134 @item -Wformat-truncation
6135 @itemx -Wformat-truncation=1
6136 @opindex Wformat-truncation
6137 @opindex Wno-format-truncation
6138 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6139 employs a conservative approach that warns only about calls to bounded
6140 functions whose return value is unused and that will most likely result
6141 in output truncation.
6142
6143 @item -Wformat-truncation=2
6144 Level @var{2} warns also about calls to bounded functions whose return
6145 value is used and that might result in truncation given an argument of
6146 sufficient length or magnitude.
6147 @end table
6148
6149 @item -Wformat-y2k
6150 @opindex Wformat-y2k
6151 @opindex Wno-format-y2k
6152 If @option{-Wformat} is specified, also warn about @code{strftime}
6153 formats that may yield only a two-digit year.
6154
6155 @item -Wnonnull
6156 @opindex Wnonnull
6157 @opindex Wno-nonnull
6158 Warn about passing a null pointer for arguments marked as
6159 requiring a non-null value by the @code{nonnull} function attribute.
6160
6161 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
6162 can be disabled with the @option{-Wno-nonnull} option.
6163
6164 @item -Wnonnull-compare
6165 @opindex Wnonnull-compare
6166 @opindex Wno-nonnull-compare
6167 Warn when comparing an argument marked with the @code{nonnull}
6168 function attribute against null inside the function.
6169
6170 @option{-Wnonnull-compare} is included in @option{-Wall}. It
6171 can be disabled with the @option{-Wno-nonnull-compare} option.
6172
6173 @item -Wnull-dereference
6174 @opindex Wnull-dereference
6175 @opindex Wno-null-dereference
6176 Warn if the compiler detects paths that trigger erroneous or
6177 undefined behavior due to dereferencing a null pointer. This option
6178 is only active when @option{-fdelete-null-pointer-checks} is active,
6179 which is enabled by optimizations in most targets. The precision of
6180 the warnings depends on the optimization options used.
6181
6182 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6183 @opindex Winit-self
6184 @opindex Wno-init-self
6185 Warn about uninitialized variables that are initialized with themselves.
6186 Note this option can only be used with the @option{-Wuninitialized} option.
6187
6188 For example, GCC warns about @code{i} being uninitialized in the
6189 following snippet only when @option{-Winit-self} has been specified:
6190 @smallexample
6191 @group
6192 int f()
6193 @{
6194 int i = i;
6195 return i;
6196 @}
6197 @end group
6198 @end smallexample
6199
6200 This warning is enabled by @option{-Wall} in C++.
6201
6202 @item -Wno-implicit-int @r{(C and Objective-C only)}
6203 @opindex Wimplicit-int
6204 @opindex Wno-implicit-int
6205 This option controls warnings when a declaration does not specify a type.
6206 This warning is enabled by default in C99 and later dialects of C,
6207 and also by @option{-Wall}.
6208
6209 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6210 @opindex Wimplicit-function-declaration
6211 @opindex Wno-implicit-function-declaration
6212 This option controls warnings when a function is used before being declared.
6213 This warning is enabled by default in C99 and later dialects of C,
6214 and also by @option{-Wall}.
6215 The warning is made into an error by @option{-pedantic-errors}.
6216
6217 @item -Wimplicit @r{(C and Objective-C only)}
6218 @opindex Wimplicit
6219 @opindex Wno-implicit
6220 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6221 This warning is enabled by @option{-Wall}.
6222
6223 @item -Wimplicit-fallthrough
6224 @opindex Wimplicit-fallthrough
6225 @opindex Wno-implicit-fallthrough
6226 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6227 and @option{-Wno-implicit-fallthrough} is the same as
6228 @option{-Wimplicit-fallthrough=0}.
6229
6230 @item -Wimplicit-fallthrough=@var{n}
6231 @opindex Wimplicit-fallthrough=
6232 Warn when a switch case falls through. For example:
6233
6234 @smallexample
6235 @group
6236 switch (cond)
6237 @{
6238 case 1:
6239 a = 1;
6240 break;
6241 case 2:
6242 a = 2;
6243 case 3:
6244 a = 3;
6245 break;
6246 @}
6247 @end group
6248 @end smallexample
6249
6250 This warning does not warn when the last statement of a case cannot
6251 fall through, e.g. when there is a return statement or a call to function
6252 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
6253 also takes into account control flow statements, such as ifs, and only
6254 warns when appropriate. E.g.@:
6255
6256 @smallexample
6257 @group
6258 switch (cond)
6259 @{
6260 case 1:
6261 if (i > 3) @{
6262 bar (5);
6263 break;
6264 @} else if (i < 1) @{
6265 bar (0);
6266 @} else
6267 return;
6268 default:
6269 @dots{}
6270 @}
6271 @end group
6272 @end smallexample
6273
6274 Since there are occasions where a switch case fall through is desirable,
6275 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6276 to be used along with a null statement to suppress this warning that
6277 would normally occur:
6278
6279 @smallexample
6280 @group
6281 switch (cond)
6282 @{
6283 case 1:
6284 bar (0);
6285 __attribute__ ((fallthrough));
6286 default:
6287 @dots{}
6288 @}
6289 @end group
6290 @end smallexample
6291
6292 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6293 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
6294 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6295 Instead of these attributes, it is also possible to add a fallthrough comment
6296 to silence the warning. The whole body of the C or C++ style comment should
6297 match the given regular expressions listed below. The option argument @var{n}
6298 specifies what kind of comments are accepted:
6299
6300 @itemize @bullet
6301
6302 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6303
6304 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6305 expression, any comment is used as fallthrough comment.
6306
6307 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6308 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6309
6310 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6311 following regular expressions:
6312
6313 @itemize @bullet
6314
6315 @item @code{-fallthrough}
6316
6317 @item @code{@@fallthrough@@}
6318
6319 @item @code{lint -fallthrough[ \t]*}
6320
6321 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6322
6323 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6324
6325 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6326
6327 @end itemize
6328
6329 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6330 following regular expressions:
6331
6332 @itemize @bullet
6333
6334 @item @code{-fallthrough}
6335
6336 @item @code{@@fallthrough@@}
6337
6338 @item @code{lint -fallthrough[ \t]*}
6339
6340 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6341
6342 @end itemize
6343
6344 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6345 fallthrough comments, only attributes disable the warning.
6346
6347 @end itemize
6348
6349 The comment needs to be followed after optional whitespace and other comments
6350 by @code{case} or @code{default} keywords or by a user label that precedes some
6351 @code{case} or @code{default} label.
6352
6353 @smallexample
6354 @group
6355 switch (cond)
6356 @{
6357 case 1:
6358 bar (0);
6359 /* FALLTHRU */
6360 default:
6361 @dots{}
6362 @}
6363 @end group
6364 @end smallexample
6365
6366 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6367
6368 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6369 @opindex Wif-not-aligned
6370 @opindex Wno-if-not-aligned
6371 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6372 should be issued. These warnings are enabled by default.
6373
6374 @item -Wignored-qualifiers @r{(C and C++ only)}
6375 @opindex Wignored-qualifiers
6376 @opindex Wno-ignored-qualifiers
6377 Warn if the return type of a function has a type qualifier
6378 such as @code{const}. For ISO C such a type qualifier has no effect,
6379 since the value returned by a function is not an lvalue.
6380 For C++, the warning is only emitted for scalar types or @code{void}.
6381 ISO C prohibits qualified @code{void} return types on function
6382 definitions, so such return types always receive a warning
6383 even without this option.
6384
6385 This warning is also enabled by @option{-Wextra}.
6386
6387 @item -Wno-ignored-attributes @r{(C and C++ only)}
6388 @opindex Wignored-attributes
6389 @opindex Wno-ignored-attributes
6390 This option controls warnings when an attribute is ignored.
6391 This is different from the
6392 @option{-Wattributes} option in that it warns whenever the compiler decides
6393 to drop an attribute, not that the attribute is either unknown, used in a
6394 wrong place, etc. This warning is enabled by default.
6395
6396 @item -Wmain
6397 @opindex Wmain
6398 @opindex Wno-main
6399 Warn if the type of @code{main} is suspicious. @code{main} should be
6400 a function with external linkage, returning int, taking either zero
6401 arguments, two, or three arguments of appropriate types. This warning
6402 is enabled by default in C++ and is enabled by either @option{-Wall}
6403 or @option{-Wpedantic}.
6404
6405 @item -Wmisleading-indentation @r{(C and C++ only)}
6406 @opindex Wmisleading-indentation
6407 @opindex Wno-misleading-indentation
6408 Warn when the indentation of the code does not reflect the block structure.
6409 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6410 @code{for} clauses with a guarded statement that does not use braces,
6411 followed by an unguarded statement with the same indentation.
6412
6413 In the following example, the call to ``bar'' is misleadingly indented as
6414 if it were guarded by the ``if'' conditional.
6415
6416 @smallexample
6417 if (some_condition ())
6418 foo ();
6419 bar (); /* Gotcha: this is not guarded by the "if". */
6420 @end smallexample
6421
6422 In the case of mixed tabs and spaces, the warning uses the
6423 @option{-ftabstop=} option to determine if the statements line up
6424 (defaulting to 8).
6425
6426 The warning is not issued for code involving multiline preprocessor logic
6427 such as the following example.
6428
6429 @smallexample
6430 if (flagA)
6431 foo (0);
6432 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6433 if (flagB)
6434 #endif
6435 foo (1);
6436 @end smallexample
6437
6438 The warning is not issued after a @code{#line} directive, since this
6439 typically indicates autogenerated code, and no assumptions can be made
6440 about the layout of the file that the directive references.
6441
6442 This warning is enabled by @option{-Wall} in C and C++.
6443
6444 @item -Wmissing-attributes
6445 @opindex Wmissing-attributes
6446 @opindex Wno-missing-attributes
6447 Warn when a declaration of a function is missing one or more attributes
6448 that a related function is declared with and whose absence may adversely
6449 affect the correctness or efficiency of generated code. For example,
6450 the warning is issued for declarations of aliases that use attributes
6451 to specify less restrictive requirements than those of their targets.
6452 This typically represents a potential optimization opportunity.
6453 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6454 issued when the alias is more restrictive than the target, which could
6455 lead to incorrect code generation.
6456 Attributes considered include @code{alloc_align}, @code{alloc_size},
6457 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6458 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6459 @code{returns_nonnull}, and @code{returns_twice}.
6460
6461 In C++, the warning is issued when an explicit specialization of a primary
6462 template declared with attribute @code{alloc_align}, @code{alloc_size},
6463 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6464 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6465 @code{error}, and @code{warning} suppress the warning.
6466 (@pxref{Function Attributes}).
6467
6468 You can use the @code{copy} attribute to apply the same
6469 set of attributes to a declaration as that on another declaration without
6470 explicitly enumerating the attributes. This attribute can be applied
6471 to declarations of functions (@pxref{Common Function Attributes}),
6472 variables (@pxref{Common Variable Attributes}), or types
6473 (@pxref{Common Type Attributes}).
6474
6475 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6476
6477 For example, since the declaration of the primary function template
6478 below makes use of both attribute @code{malloc} and @code{alloc_size}
6479 the declaration of the explicit specialization of the template is
6480 diagnosed because it is missing one of the attributes.
6481
6482 @smallexample
6483 template <class T>
6484 T* __attribute__ ((malloc, alloc_size (1)))
6485 allocate (size_t);
6486
6487 template <>
6488 void* __attribute__ ((malloc)) // missing alloc_size
6489 allocate<void> (size_t);
6490 @end smallexample
6491
6492 @item -Wmissing-braces
6493 @opindex Wmissing-braces
6494 @opindex Wno-missing-braces
6495 Warn if an aggregate or union initializer is not fully bracketed. In
6496 the following example, the initializer for @code{a} is not fully
6497 bracketed, but that for @code{b} is fully bracketed.
6498
6499 @smallexample
6500 int a[2][2] = @{ 0, 1, 2, 3 @};
6501 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6502 @end smallexample
6503
6504 This warning is enabled by @option{-Wall}.
6505
6506 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6507 @opindex Wmissing-include-dirs
6508 @opindex Wno-missing-include-dirs
6509 Warn if a user-supplied include directory does not exist. This opions is disabled
6510 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6511 enabled by default by warning for -I and -J, only.
6512
6513 @item -Wno-missing-profile
6514 @opindex Wmissing-profile
6515 @opindex Wno-missing-profile
6516 This option controls warnings if feedback profiles are missing when using the
6517 @option{-fprofile-use} option.
6518 This option diagnoses those cases where a new function or a new file is added
6519 between compiling with @option{-fprofile-generate} and with
6520 @option{-fprofile-use}, without regenerating the profiles.
6521 In these cases, the profile feedback data files do not contain any
6522 profile feedback information for
6523 the newly added function or file respectively. Also, in the case when profile
6524 count data (.gcda) files are removed, GCC cannot use any profile feedback
6525 information. In all these cases, warnings are issued to inform you that a
6526 profile generation step is due.
6527 Ignoring the warning can result in poorly optimized code.
6528 @option{-Wno-missing-profile} can be used to
6529 disable the warning, but this is not recommended and should be done only
6530 when non-existent profile data is justified.
6531
6532 @item -Wmismatched-dealloc
6533 @opindex Wmismatched-dealloc
6534 @opindex Wno-mismatched-dealloc
6535
6536 Warn for calls to deallocation functions with pointer arguments returned
6537 from from allocations functions for which the former isn't a suitable
6538 deallocator. A pair of functions can be associated as matching allocators
6539 and deallocators by use of attribute @code{malloc}. Unless disabled by
6540 the @option{-fno-builtin} option the standard functions @code{calloc},
6541 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6542 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6543 associated as matching allocators and deallocators. In the following
6544 example @code{mydealloc} is the deallocator for pointers returned from
6545 @code{myalloc}.
6546
6547 @smallexample
6548 void mydealloc (void*);
6549
6550 __attribute__ ((malloc (mydealloc, 1))) void*
6551 myalloc (size_t);
6552
6553 void f (void)
6554 @{
6555 void *p = myalloc (32);
6556 // @dots{}use p@dots{}
6557 free (p); // warning: not a matching deallocator for myalloc
6558 mydealloc (p); // ok
6559 @}
6560 @end smallexample
6561
6562 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6563 mismatches involving either @code{operator new} or @code{operator delete}.
6564
6565 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
6566
6567 @item -Wmultistatement-macros
6568 @opindex Wmultistatement-macros
6569 @opindex Wno-multistatement-macros
6570 Warn about unsafe multiple statement macros that appear to be guarded
6571 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6572 @code{while}, in which only the first statement is actually guarded after
6573 the macro is expanded.
6574
6575 For example:
6576
6577 @smallexample
6578 #define DOIT x++; y++
6579 if (c)
6580 DOIT;
6581 @end smallexample
6582
6583 will increment @code{y} unconditionally, not just when @code{c} holds.
6584 The can usually be fixed by wrapping the macro in a do-while loop:
6585 @smallexample
6586 #define DOIT do @{ x++; y++; @} while (0)
6587 if (c)
6588 DOIT;
6589 @end smallexample
6590
6591 This warning is enabled by @option{-Wall} in C and C++.
6592
6593 @item -Wparentheses
6594 @opindex Wparentheses
6595 @opindex Wno-parentheses
6596 Warn if parentheses are omitted in certain contexts, such
6597 as when there is an assignment in a context where a truth value
6598 is expected, or when operators are nested whose precedence people
6599 often get confused about.
6600
6601 Also warn if a comparison like @code{x<=y<=z} appears; this is
6602 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6603 interpretation from that of ordinary mathematical notation.
6604
6605 Also warn for dangerous uses of the GNU extension to
6606 @code{?:} with omitted middle operand. When the condition
6607 in the @code{?}: operator is a boolean expression, the omitted value is
6608 always 1. Often programmers expect it to be a value computed
6609 inside the conditional expression instead.
6610
6611 For C++ this also warns for some cases of unnecessary parentheses in
6612 declarations, which can indicate an attempt at a function call instead
6613 of a declaration:
6614 @smallexample
6615 @{
6616 // Declares a local variable called mymutex.
6617 std::unique_lock<std::mutex> (mymutex);
6618 // User meant std::unique_lock<std::mutex> lock (mymutex);
6619 @}
6620 @end smallexample
6621
6622 This warning is enabled by @option{-Wall}.
6623
6624 @item -Wsequence-point
6625 @opindex Wsequence-point
6626 @opindex Wno-sequence-point
6627 Warn about code that may have undefined semantics because of violations
6628 of sequence point rules in the C and C++ standards.
6629
6630 The C and C++ standards define the order in which expressions in a C/C++
6631 program are evaluated in terms of @dfn{sequence points}, which represent
6632 a partial ordering between the execution of parts of the program: those
6633 executed before the sequence point, and those executed after it. These
6634 occur after the evaluation of a full expression (one which is not part
6635 of a larger expression), after the evaluation of the first operand of a
6636 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6637 function is called (but after the evaluation of its arguments and the
6638 expression denoting the called function), and in certain other places.
6639 Other than as expressed by the sequence point rules, the order of
6640 evaluation of subexpressions of an expression is not specified. All
6641 these rules describe only a partial order rather than a total order,
6642 since, for example, if two functions are called within one expression
6643 with no sequence point between them, the order in which the functions
6644 are called is not specified. However, the standards committee have
6645 ruled that function calls do not overlap.
6646
6647 It is not specified when between sequence points modifications to the
6648 values of objects take effect. Programs whose behavior depends on this
6649 have undefined behavior; the C and C++ standards specify that ``Between
6650 the previous and next sequence point an object shall have its stored
6651 value modified at most once by the evaluation of an expression.
6652 Furthermore, the prior value shall be read only to determine the value
6653 to be stored.''. If a program breaks these rules, the results on any
6654 particular implementation are entirely unpredictable.
6655
6656 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6657 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
6658 diagnosed by this option, and it may give an occasional false positive
6659 result, but in general it has been found fairly effective at detecting
6660 this sort of problem in programs.
6661
6662 The C++17 standard will define the order of evaluation of operands in
6663 more cases: in particular it requires that the right-hand side of an
6664 assignment be evaluated before the left-hand side, so the above
6665 examples are no longer undefined. But this option will still warn
6666 about them, to help people avoid writing code that is undefined in C
6667 and earlier revisions of C++.
6668
6669 The standard is worded confusingly, therefore there is some debate
6670 over the precise meaning of the sequence point rules in subtle cases.
6671 Links to discussions of the problem, including proposed formal
6672 definitions, may be found on the GCC readings page, at
6673 @uref{http://gcc.gnu.org/@/readings.html}.
6674
6675 This warning is enabled by @option{-Wall} for C and C++.
6676
6677 @item -Wno-return-local-addr
6678 @opindex Wno-return-local-addr
6679 @opindex Wreturn-local-addr
6680 Do not warn about returning a pointer (or in C++, a reference) to a
6681 variable that goes out of scope after the function returns.
6682
6683 @item -Wreturn-type
6684 @opindex Wreturn-type
6685 @opindex Wno-return-type
6686 Warn whenever a function is defined with a return type that defaults
6687 to @code{int}. Also warn about any @code{return} statement with no
6688 return value in a function whose return type is not @code{void}
6689 (falling off the end of the function body is considered returning
6690 without a value).
6691
6692 For C only, warn about a @code{return} statement with an expression in a
6693 function whose return type is @code{void}, unless the expression type is
6694 also @code{void}. As a GNU extension, the latter case is accepted
6695 without a warning unless @option{-Wpedantic} is used. Attempting
6696 to use the return value of a non-@code{void} function other than @code{main}
6697 that flows off the end by reaching the closing curly brace that terminates
6698 the function is undefined.
6699
6700 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6701 than @code{main} results in undefined behavior even when the value of
6702 the function is not used.
6703
6704 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6705
6706 @item -Wno-shift-count-negative
6707 @opindex Wshift-count-negative
6708 @opindex Wno-shift-count-negative
6709 Controls warnings if a shift count is negative.
6710 This warning is enabled by default.
6711
6712 @item -Wno-shift-count-overflow
6713 @opindex Wshift-count-overflow
6714 @opindex Wno-shift-count-overflow
6715 Controls warnings if a shift count is greater than or equal to the bit width
6716 of the type. This warning is enabled by default.
6717
6718 @item -Wshift-negative-value
6719 @opindex Wshift-negative-value
6720 @opindex Wno-shift-negative-value
6721 Warn if left shifting a negative value. This warning is enabled by
6722 @option{-Wextra} in C99 and C++11 modes (and newer).
6723
6724 @item -Wno-shift-overflow
6725 @itemx -Wshift-overflow=@var{n}
6726 @opindex Wshift-overflow
6727 @opindex Wno-shift-overflow
6728 These options control warnings about left shift overflows.
6729
6730 @table @gcctabopt
6731 @item -Wshift-overflow=1
6732 This is the warning level of @option{-Wshift-overflow} and is enabled
6733 by default in C99 and C++11 modes (and newer). This warning level does
6734 not warn about left-shifting 1 into the sign bit. (However, in C, such
6735 an overflow is still rejected in contexts where an integer constant expression
6736 is required.) No warning is emitted in C++20 mode (and newer), as signed left
6737 shifts always wrap.
6738
6739 @item -Wshift-overflow=2
6740 This warning level also warns about left-shifting 1 into the sign bit,
6741 unless C++14 mode (or newer) is active.
6742 @end table
6743
6744 @item -Wswitch
6745 @opindex Wswitch
6746 @opindex Wno-switch
6747 Warn whenever a @code{switch} statement has an index of enumerated type
6748 and lacks a @code{case} for one or more of the named codes of that
6749 enumeration. (The presence of a @code{default} label prevents this
6750 warning.) @code{case} labels outside the enumeration range also
6751 provoke warnings when this option is used (even if there is a
6752 @code{default} label).
6753 This warning is enabled by @option{-Wall}.
6754
6755 @item -Wswitch-default
6756 @opindex Wswitch-default
6757 @opindex Wno-switch-default
6758 Warn whenever a @code{switch} statement does not have a @code{default}
6759 case.
6760
6761 @item -Wswitch-enum
6762 @opindex Wswitch-enum
6763 @opindex Wno-switch-enum
6764 Warn whenever a @code{switch} statement has an index of enumerated type
6765 and lacks a @code{case} for one or more of the named codes of that
6766 enumeration. @code{case} labels outside the enumeration range also
6767 provoke warnings when this option is used. The only difference
6768 between @option{-Wswitch} and this option is that this option gives a
6769 warning about an omitted enumeration code even if there is a
6770 @code{default} label.
6771
6772 @item -Wno-switch-bool
6773 @opindex Wswitch-bool
6774 @opindex Wno-switch-bool
6775 Do not warn when a @code{switch} statement has an index of boolean type
6776 and the case values are outside the range of a boolean type.
6777 It is possible to suppress this warning by casting the controlling
6778 expression to a type other than @code{bool}. For example:
6779 @smallexample
6780 @group
6781 switch ((int) (a == 4))
6782 @{
6783 @dots{}
6784 @}
6785 @end group
6786 @end smallexample
6787 This warning is enabled by default for C and C++ programs.
6788
6789 @item -Wno-switch-outside-range
6790 @opindex Wswitch-outside-range
6791 @opindex Wno-switch-outside-range
6792 This option controls warnings when a @code{switch} case has a value
6793 that is outside of its
6794 respective type range. This warning is enabled by default for
6795 C and C++ programs.
6796
6797 @item -Wno-switch-unreachable
6798 @opindex Wswitch-unreachable
6799 @opindex Wno-switch-unreachable
6800 Do not warn when a @code{switch} statement contains statements between the
6801 controlling expression and the first case label, which will never be
6802 executed. For example:
6803 @smallexample
6804 @group
6805 switch (cond)
6806 @{
6807 i = 15;
6808 @dots{}
6809 case 5:
6810 @dots{}
6811 @}
6812 @end group
6813 @end smallexample
6814 @option{-Wswitch-unreachable} does not warn if the statement between the
6815 controlling expression and the first case label is just a declaration:
6816 @smallexample
6817 @group
6818 switch (cond)
6819 @{
6820 int i;
6821 @dots{}
6822 case 5:
6823 i = 5;
6824 @dots{}
6825 @}
6826 @end group
6827 @end smallexample
6828 This warning is enabled by default for C and C++ programs.
6829
6830 @item -Wsync-nand @r{(C and C++ only)}
6831 @opindex Wsync-nand
6832 @opindex Wno-sync-nand
6833 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6834 built-in functions are used. These functions changed semantics in GCC 4.4.
6835
6836 @item -Wunused-but-set-parameter
6837 @opindex Wunused-but-set-parameter
6838 @opindex Wno-unused-but-set-parameter
6839 Warn whenever a function parameter is assigned to, but otherwise unused
6840 (aside from its declaration).
6841
6842 To suppress this warning use the @code{unused} attribute
6843 (@pxref{Variable Attributes}).
6844
6845 This warning is also enabled by @option{-Wunused} together with
6846 @option{-Wextra}.
6847
6848 @item -Wunused-but-set-variable
6849 @opindex Wunused-but-set-variable
6850 @opindex Wno-unused-but-set-variable
6851 Warn whenever a local variable is assigned to, but otherwise unused
6852 (aside from its declaration).
6853 This warning is enabled by @option{-Wall}.
6854
6855 To suppress this warning use the @code{unused} attribute
6856 (@pxref{Variable Attributes}).
6857
6858 This warning is also enabled by @option{-Wunused}, which is enabled
6859 by @option{-Wall}.
6860
6861 @item -Wunused-function
6862 @opindex Wunused-function
6863 @opindex Wno-unused-function
6864 Warn whenever a static function is declared but not defined or a
6865 non-inline static function is unused.
6866 This warning is enabled by @option{-Wall}.
6867
6868 @item -Wunused-label
6869 @opindex Wunused-label
6870 @opindex Wno-unused-label
6871 Warn whenever a label is declared but not used.
6872 This warning is enabled by @option{-Wall}.
6873
6874 To suppress this warning use the @code{unused} attribute
6875 (@pxref{Variable Attributes}).
6876
6877 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6878 @opindex Wunused-local-typedefs
6879 @opindex Wno-unused-local-typedefs
6880 Warn when a typedef locally defined in a function is not used.
6881 This warning is enabled by @option{-Wall}.
6882
6883 @item -Wunused-parameter
6884 @opindex Wunused-parameter
6885 @opindex Wno-unused-parameter
6886 Warn whenever a function parameter is unused aside from its declaration.
6887
6888 To suppress this warning use the @code{unused} attribute
6889 (@pxref{Variable Attributes}).
6890
6891 @item -Wno-unused-result
6892 @opindex Wunused-result
6893 @opindex Wno-unused-result
6894 Do not warn if a caller of a function marked with attribute
6895 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6896 its return value. The default is @option{-Wunused-result}.
6897
6898 @item -Wunused-variable
6899 @opindex Wunused-variable
6900 @opindex Wno-unused-variable
6901 Warn whenever a local or static variable is unused aside from its
6902 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6903 but not for C++. This warning is enabled by @option{-Wall}.
6904
6905 To suppress this warning use the @code{unused} attribute
6906 (@pxref{Variable Attributes}).
6907
6908 @item -Wunused-const-variable
6909 @itemx -Wunused-const-variable=@var{n}
6910 @opindex Wunused-const-variable
6911 @opindex Wno-unused-const-variable
6912 Warn whenever a constant static variable is unused aside from its declaration.
6913 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6914 for C, but not for C++. In C this declares variable storage, but in C++ this
6915 is not an error since const variables take the place of @code{#define}s.
6916
6917 To suppress this warning use the @code{unused} attribute
6918 (@pxref{Variable Attributes}).
6919
6920 @table @gcctabopt
6921 @item -Wunused-const-variable=1
6922 This is the warning level that is enabled by @option{-Wunused-variable} for
6923 C. It warns only about unused static const variables defined in the main
6924 compilation unit, but not about static const variables declared in any
6925 header included.
6926
6927 @item -Wunused-const-variable=2
6928 This warning level also warns for unused constant static variables in
6929 headers (excluding system headers). This is the warning level of
6930 @option{-Wunused-const-variable} and must be explicitly requested since
6931 in C++ this isn't an error and in C it might be harder to clean up all
6932 headers included.
6933 @end table
6934
6935 @item -Wunused-value
6936 @opindex Wunused-value
6937 @opindex Wno-unused-value
6938 Warn whenever a statement computes a result that is explicitly not
6939 used. To suppress this warning cast the unused expression to
6940 @code{void}. This includes an expression-statement or the left-hand
6941 side of a comma expression that contains no side effects. For example,
6942 an expression such as @code{x[i,j]} causes a warning, while
6943 @code{x[(void)i,j]} does not.
6944
6945 This warning is enabled by @option{-Wall}.
6946
6947 @item -Wunused
6948 @opindex Wunused
6949 @opindex Wno-unused
6950 All the above @option{-Wunused} options combined.
6951
6952 In order to get a warning about an unused function parameter, you must
6953 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6954 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6955
6956 @item -Wuninitialized
6957 @opindex Wuninitialized
6958 @opindex Wno-uninitialized
6959 Warn if an object with automatic or allocated storage duration is used
6960 without having been initialized. In C++, also warn if a non-static
6961 reference or non-static @code{const} member appears in a class without
6962 constructors.
6963
6964 In addition, passing a pointer (or in C++, a reference) to an uninitialized
6965 object to a @code{const}-qualified argument of a built-in function known to
6966 read the object is also diagnosed by this warning.
6967 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
6968
6969 If you want to warn about code that uses the uninitialized value of the
6970 variable in its own initializer, use the @option{-Winit-self} option.
6971
6972 These warnings occur for individual uninitialized elements of
6973 structure, union or array variables as well as for variables that are
6974 uninitialized as a whole. They do not occur for variables or elements
6975 declared @code{volatile}. Because these warnings depend on
6976 optimization, the exact variables or elements for which there are
6977 warnings depend on the precise optimization options and version of GCC
6978 used.
6979
6980 Note that there may be no warning about a variable that is used only
6981 to compute a value that itself is never used, because such
6982 computations may be deleted by data flow analysis before the warnings
6983 are printed.
6984
6985 @item -Wno-invalid-memory-model
6986 @opindex Winvalid-memory-model
6987 @opindex Wno-invalid-memory-model
6988 This option controls warnings
6989 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6990 and the C11 atomic generic functions with a memory consistency argument
6991 that is either invalid for the operation or outside the range of values
6992 of the @code{memory_order} enumeration. For example, since the
6993 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6994 defined for the relaxed, release, and sequentially consistent memory
6995 orders the following code is diagnosed:
6996
6997 @smallexample
6998 void store (int *i)
6999 @{
7000 __atomic_store_n (i, 0, memory_order_consume);
7001 @}
7002 @end smallexample
7003
7004 @option{-Winvalid-memory-model} is enabled by default.
7005
7006 @item -Wmaybe-uninitialized
7007 @opindex Wmaybe-uninitialized
7008 @opindex Wno-maybe-uninitialized
7009 For an object with automatic or allocated storage duration, if there exists
7010 a path from the function entry to a use of the object that is initialized,
7011 but there exist some other paths for which the object is not initialized,
7012 the compiler emits a warning if it cannot prove the uninitialized paths
7013 are not executed at run time.
7014
7015 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7016 object to a @code{const}-qualified function argument is also diagnosed by
7017 this warning. (@option{-Wuninitialized} is issued for built-in functions
7018 known to read the object.) Annotating the function with attribute
7019 @code{access (none)} indicates that the argument isn't used to access
7020 the object and avoids the warning (@pxref{Common Function Attributes}).
7021
7022 These warnings are only possible in optimizing compilation, because otherwise
7023 GCC does not keep track of the state of variables.
7024
7025 These warnings are made optional because GCC may not be able to determine when
7026 the code is correct in spite of appearing to have an error. Here is one
7027 example of how this can happen:
7028
7029 @smallexample
7030 @group
7031 @{
7032 int x;
7033 switch (y)
7034 @{
7035 case 1: x = 1;
7036 break;
7037 case 2: x = 4;
7038 break;
7039 case 3: x = 5;
7040 @}
7041 foo (x);
7042 @}
7043 @end group
7044 @end smallexample
7045
7046 @noindent
7047 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7048 always initialized, but GCC doesn't know this. To suppress the
7049 warning, you need to provide a default case with assert(0) or
7050 similar code.
7051
7052 @cindex @code{longjmp} warnings
7053 This option also warns when a non-volatile automatic variable might be
7054 changed by a call to @code{longjmp}.
7055 The compiler sees only the calls to @code{setjmp}. It cannot know
7056 where @code{longjmp} will be called; in fact, a signal handler could
7057 call it at any point in the code. As a result, you may get a warning
7058 even when there is in fact no problem because @code{longjmp} cannot
7059 in fact be called at the place that would cause a problem.
7060
7061 Some spurious warnings can be avoided if you declare all the functions
7062 you use that never return as @code{noreturn}. @xref{Function
7063 Attributes}.
7064
7065 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7066
7067 @item -Wunknown-pragmas
7068 @opindex Wunknown-pragmas
7069 @opindex Wno-unknown-pragmas
7070 @cindex warning for unknown pragmas
7071 @cindex unknown pragmas, warning
7072 @cindex pragmas, warning of unknown
7073 Warn when a @code{#pragma} directive is encountered that is not understood by
7074 GCC@. If this command-line option is used, warnings are even issued
7075 for unknown pragmas in system header files. This is not the case if
7076 the warnings are only enabled by the @option{-Wall} command-line option.
7077
7078 @item -Wno-pragmas
7079 @opindex Wno-pragmas
7080 @opindex Wpragmas
7081 Do not warn about misuses of pragmas, such as incorrect parameters,
7082 invalid syntax, or conflicts between pragmas. See also
7083 @option{-Wunknown-pragmas}.
7084
7085 @item -Wno-prio-ctor-dtor
7086 @opindex Wno-prio-ctor-dtor
7087 @opindex Wprio-ctor-dtor
7088 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7089 The use of constructor and destructor attributes allow you to assign a
7090 priority to the constructor/destructor to control its order of execution
7091 before @code{main} is called or after it returns. The priority values must be
7092 greater than 100 as the compiler reserves priority values between 0--100 for
7093 the implementation.
7094
7095 @item -Wstrict-aliasing
7096 @opindex Wstrict-aliasing
7097 @opindex Wno-strict-aliasing
7098 This option is only active when @option{-fstrict-aliasing} is active.
7099 It warns about code that might break the strict aliasing rules that the
7100 compiler is using for optimization. The warning does not catch all
7101 cases, but does attempt to catch the more common pitfalls. It is
7102 included in @option{-Wall}.
7103 It is equivalent to @option{-Wstrict-aliasing=3}
7104
7105 @item -Wstrict-aliasing=n
7106 @opindex Wstrict-aliasing=n
7107 This option is only active when @option{-fstrict-aliasing} is active.
7108 It warns about code that might break the strict aliasing rules that the
7109 compiler is using for optimization.
7110 Higher levels correspond to higher accuracy (fewer false positives).
7111 Higher levels also correspond to more effort, similar to the way @option{-O}
7112 works.
7113 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7114
7115 Level 1: Most aggressive, quick, least accurate.
7116 Possibly useful when higher levels
7117 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7118 false negatives. However, it has many false positives.
7119 Warns for all pointer conversions between possibly incompatible types,
7120 even if never dereferenced. Runs in the front end only.
7121
7122 Level 2: Aggressive, quick, not too precise.
7123 May still have many false positives (not as many as level 1 though),
7124 and few false negatives (but possibly more than level 1).
7125 Unlike level 1, it only warns when an address is taken. Warns about
7126 incomplete types. Runs in the front end only.
7127
7128 Level 3 (default for @option{-Wstrict-aliasing}):
7129 Should have very few false positives and few false
7130 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
7131 Takes care of the common pun+dereference pattern in the front end:
7132 @code{*(int*)&some_float}.
7133 If optimization is enabled, it also runs in the back end, where it deals
7134 with multiple statement cases using flow-sensitive points-to information.
7135 Only warns when the converted pointer is dereferenced.
7136 Does not warn about incomplete types.
7137
7138 @item -Wstrict-overflow
7139 @itemx -Wstrict-overflow=@var{n}
7140 @opindex Wstrict-overflow
7141 @opindex Wno-strict-overflow
7142 This option is only active when signed overflow is undefined.
7143 It warns about cases where the compiler optimizes based on the
7144 assumption that signed overflow does not occur. Note that it does not
7145 warn about all cases where the code might overflow: it only warns
7146 about cases where the compiler implements some optimization. Thus
7147 this warning depends on the optimization level.
7148
7149 An optimization that assumes that signed overflow does not occur is
7150 perfectly safe if the values of the variables involved are such that
7151 overflow never does, in fact, occur. Therefore this warning can
7152 easily give a false positive: a warning about code that is not
7153 actually a problem. To help focus on important issues, several
7154 warning levels are defined. No warnings are issued for the use of
7155 undefined signed overflow when estimating how many iterations a loop
7156 requires, in particular when determining whether a loop will be
7157 executed at all.
7158
7159 @table @gcctabopt
7160 @item -Wstrict-overflow=1
7161 Warn about cases that are both questionable and easy to avoid. For
7162 example the compiler simplifies
7163 @code{x + 1 > x} to @code{1}. This level of
7164 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7165 are not, and must be explicitly requested.
7166
7167 @item -Wstrict-overflow=2
7168 Also warn about other cases where a comparison is simplified to a
7169 constant. For example: @code{abs (x) >= 0}. This can only be
7170 simplified when signed integer overflow is undefined, because
7171 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7172 zero. @option{-Wstrict-overflow} (with no level) is the same as
7173 @option{-Wstrict-overflow=2}.
7174
7175 @item -Wstrict-overflow=3
7176 Also warn about other cases where a comparison is simplified. For
7177 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7178
7179 @item -Wstrict-overflow=4
7180 Also warn about other simplifications not covered by the above cases.
7181 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7182
7183 @item -Wstrict-overflow=5
7184 Also warn about cases where the compiler reduces the magnitude of a
7185 constant involved in a comparison. For example: @code{x + 2 > y} is
7186 simplified to @code{x + 1 >= y}. This is reported only at the
7187 highest warning level because this simplification applies to many
7188 comparisons, so this warning level gives a very large number of
7189 false positives.
7190 @end table
7191
7192 @item -Wstring-compare
7193 @opindex Wstring-compare
7194 @opindex Wno-string-compare
7195 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7196 determined to be either zero or non-zero in tests for such equality
7197 owing to the length of one argument being greater than the size of
7198 the array the other argument is stored in (or the bound in the case
7199 of @code{strncmp}). Such calls could be mistakes. For example,
7200 the call to @code{strcmp} below is diagnosed because its result is
7201 necessarily non-zero irrespective of the contents of the array @code{a}.
7202
7203 @smallexample
7204 extern char a[4];
7205 void f (char *d)
7206 @{
7207 strcpy (d, "string");
7208 @dots{}
7209 if (0 == strcmp (a, d)) // cannot be true
7210 puts ("a and d are the same");
7211 @}
7212 @end smallexample
7213
7214 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7215
7216 @item -Wno-stringop-overflow
7217 @item -Wstringop-overflow
7218 @itemx -Wstringop-overflow=@var{type}
7219 @opindex Wstringop-overflow
7220 @opindex Wno-stringop-overflow
7221 Warn for calls to string manipulation functions such as @code{memcpy} and
7222 @code{strcpy} that are determined to overflow the destination buffer. The
7223 optional argument is one greater than the type of Object Size Checking to
7224 perform to determine the size of the destination. @xref{Object Size Checking}.
7225 The argument is meaningful only for functions that operate on character arrays
7226 but not for raw memory functions like @code{memcpy} which always make use
7227 of Object Size type-0. The option also warns for calls that specify a size
7228 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7229 The option produces the best results with optimization enabled but can detect
7230 a small subset of simple buffer overflows even without optimization in
7231 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7232 correspond to the standard functions. In any case, the option warns about
7233 just a subset of buffer overflows detected by the corresponding overflow
7234 checking built-ins. For example, the option issues a warning for
7235 the @code{strcpy} call below because it copies at least 5 characters
7236 (the string @code{"blue"} including the terminating NUL) into the buffer
7237 of size 4.
7238
7239 @smallexample
7240 enum Color @{ blue, purple, yellow @};
7241 const char* f (enum Color clr)
7242 @{
7243 static char buf [4];
7244 const char *str;
7245 switch (clr)
7246 @{
7247 case blue: str = "blue"; break;
7248 case purple: str = "purple"; break;
7249 case yellow: str = "yellow"; break;
7250 @}
7251
7252 return strcpy (buf, str); // warning here
7253 @}
7254 @end smallexample
7255
7256 Option @option{-Wstringop-overflow=2} is enabled by default.
7257
7258 @table @gcctabopt
7259 @item -Wstringop-overflow
7260 @itemx -Wstringop-overflow=1
7261 @opindex Wstringop-overflow
7262 @opindex Wno-stringop-overflow
7263 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7264 to determine the sizes of destination objects. At this setting the option
7265 does not warn for writes past the end of subobjects of larger objects accessed
7266 by pointers unless the size of the largest surrounding object is known. When
7267 the destination may be one of several objects it is assumed to be the largest
7268 one of them. On Linux systems, when optimization is enabled at this setting
7269 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7270 is defined to a non-zero value.
7271
7272 @item -Wstringop-overflow=2
7273 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7274 to determine the sizes of destination objects. At this setting the option
7275 warns about overflows when writing to members of the largest complete
7276 objects whose exact size is known. However, it does not warn for excessive
7277 writes to the same members of unknown objects referenced by pointers since
7278 they may point to arrays containing unknown numbers of elements. This is
7279 the default setting of the option.
7280
7281 @item -Wstringop-overflow=3
7282 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7283 to determine the sizes of destination objects. At this setting the option
7284 warns about overflowing the smallest object or data member. This is the
7285 most restrictive setting of the option that may result in warnings for safe
7286 code.
7287
7288 @item -Wstringop-overflow=4
7289 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7290 to determine the sizes of destination objects. At this setting the option
7291 warns about overflowing any data members, and when the destination is
7292 one of several objects it uses the size of the largest of them to decide
7293 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
7294 setting of the option may result in warnings for benign code.
7295 @end table
7296
7297 @item -Wno-stringop-overread
7298 @opindex Wstringop-overread
7299 @opindex Wno-stringop-overread
7300 Warn for calls to string manipulation functions such as @code{memchr}, or
7301 @code{strcpy} that are determined to read past the end of the source
7302 sequence.
7303
7304 Option @option{-Wstringop-overread} is enabled by default.
7305
7306 @item -Wno-stringop-truncation
7307 @opindex Wstringop-truncation
7308 @opindex Wno-stringop-truncation
7309 Do not warn for calls to bounded string manipulation functions
7310 such as @code{strncat},
7311 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7312 or leave the destination unchanged.
7313
7314 In the following example, the call to @code{strncat} specifies a bound that
7315 is less than the length of the source string. As a result, the copy of
7316 the source will be truncated and so the call is diagnosed. To avoid the
7317 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7318
7319 @smallexample
7320 void append (char *buf, size_t bufsize)
7321 @{
7322 strncat (buf, ".txt", 3);
7323 @}
7324 @end smallexample
7325
7326 As another example, the following call to @code{strncpy} results in copying
7327 to @code{d} just the characters preceding the terminating NUL, without
7328 appending the NUL to the end. Assuming the result of @code{strncpy} is
7329 necessarily a NUL-terminated string is a common mistake, and so the call
7330 is diagnosed. To avoid the warning when the result is not expected to be
7331 NUL-terminated, call @code{memcpy} instead.
7332
7333 @smallexample
7334 void copy (char *d, const char *s)
7335 @{
7336 strncpy (d, s, strlen (s));
7337 @}
7338 @end smallexample
7339
7340 In the following example, the call to @code{strncpy} specifies the size
7341 of the destination buffer as the bound. If the length of the source
7342 string is equal to or greater than this size the result of the copy will
7343 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
7344 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7345 element of the buffer to @code{NUL}.
7346
7347 @smallexample
7348 void copy (const char *s)
7349 @{
7350 char buf[80];
7351 strncpy (buf, s, sizeof buf);
7352 @dots{}
7353 @}
7354 @end smallexample
7355
7356 In situations where a character array is intended to store a sequence
7357 of bytes with no terminating @code{NUL} such an array may be annotated
7358 with attribute @code{nonstring} to avoid this warning. Such arrays,
7359 however, are not suitable arguments to functions that expect
7360 @code{NUL}-terminated strings. To help detect accidental misuses of
7361 such arrays GCC issues warnings unless it can prove that the use is
7362 safe. @xref{Common Variable Attributes}.
7363
7364 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7365 @opindex Wsuggest-attribute=
7366 @opindex Wno-suggest-attribute=
7367 Warn for cases where adding an attribute may be beneficial. The
7368 attributes currently supported are listed below.
7369
7370 @table @gcctabopt
7371 @item -Wsuggest-attribute=pure
7372 @itemx -Wsuggest-attribute=const
7373 @itemx -Wsuggest-attribute=noreturn
7374 @itemx -Wmissing-noreturn
7375 @itemx -Wsuggest-attribute=malloc
7376 @opindex Wsuggest-attribute=pure
7377 @opindex Wno-suggest-attribute=pure
7378 @opindex Wsuggest-attribute=const
7379 @opindex Wno-suggest-attribute=const
7380 @opindex Wsuggest-attribute=noreturn
7381 @opindex Wno-suggest-attribute=noreturn
7382 @opindex Wmissing-noreturn
7383 @opindex Wno-missing-noreturn
7384 @opindex Wsuggest-attribute=malloc
7385 @opindex Wno-suggest-attribute=malloc
7386
7387 Warn about functions that might be candidates for attributes
7388 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7389 only warns for functions visible in other compilation units or (in the case of
7390 @code{pure} and @code{const}) if it cannot prove that the function returns
7391 normally. A function returns normally if it doesn't contain an infinite loop or
7392 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7393 requires option @option{-fipa-pure-const}, which is enabled by default at
7394 @option{-O} and higher. Higher optimization levels improve the accuracy
7395 of the analysis.
7396
7397 @item -Wsuggest-attribute=format
7398 @itemx -Wmissing-format-attribute
7399 @opindex Wsuggest-attribute=format
7400 @opindex Wmissing-format-attribute
7401 @opindex Wno-suggest-attribute=format
7402 @opindex Wno-missing-format-attribute
7403 @opindex Wformat
7404 @opindex Wno-format
7405
7406 Warn about function pointers that might be candidates for @code{format}
7407 attributes. Note these are only possible candidates, not absolute ones.
7408 GCC guesses that function pointers with @code{format} attributes that
7409 are used in assignment, initialization, parameter passing or return
7410 statements should have a corresponding @code{format} attribute in the
7411 resulting type. I.e.@: the left-hand side of the assignment or
7412 initialization, the type of the parameter variable, or the return type
7413 of the containing function respectively should also have a @code{format}
7414 attribute to avoid the warning.
7415
7416 GCC also warns about function definitions that might be
7417 candidates for @code{format} attributes. Again, these are only
7418 possible candidates. GCC guesses that @code{format} attributes
7419 might be appropriate for any function that calls a function like
7420 @code{vprintf} or @code{vscanf}, but this might not always be the
7421 case, and some functions for which @code{format} attributes are
7422 appropriate may not be detected.
7423
7424 @item -Wsuggest-attribute=cold
7425 @opindex Wsuggest-attribute=cold
7426 @opindex Wno-suggest-attribute=cold
7427
7428 Warn about functions that might be candidates for @code{cold} attribute. This
7429 is based on static detection and generally only warns about functions which
7430 always leads to a call to another @code{cold} function such as wrappers of
7431 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7432 @end table
7433
7434 @item -Walloc-zero
7435 @opindex Wno-alloc-zero
7436 @opindex Walloc-zero
7437 Warn about calls to allocation functions decorated with attribute
7438 @code{alloc_size} that specify zero bytes, including those to the built-in
7439 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7440 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7441 when called with a zero size differs among implementations (and in the case
7442 of @code{realloc} has been deprecated) relying on it may result in subtle
7443 portability bugs and should be avoided.
7444
7445 @item -Walloc-size-larger-than=@var{byte-size}
7446 @opindex Walloc-size-larger-than=
7447 @opindex Wno-alloc-size-larger-than
7448 Warn about calls to functions decorated with attribute @code{alloc_size}
7449 that attempt to allocate objects larger than the specified number of bytes,
7450 or where the result of the size computation in an integer type with infinite
7451 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7452 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7453 Warnings controlled by the option can be disabled either by specifying
7454 @var{byte-size} of @samp{SIZE_MAX} or more or by
7455 @option{-Wno-alloc-size-larger-than}.
7456 @xref{Function Attributes}.
7457
7458 @item -Wno-alloc-size-larger-than
7459 @opindex Wno-alloc-size-larger-than
7460 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7461 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7462 larger.
7463
7464 @item -Walloca
7465 @opindex Wno-alloca
7466 @opindex Walloca
7467 This option warns on all uses of @code{alloca} in the source.
7468
7469 @item -Walloca-larger-than=@var{byte-size}
7470 @opindex Walloca-larger-than=
7471 @opindex Wno-alloca-larger-than
7472 This option warns on calls to @code{alloca} with an integer argument whose
7473 value is either zero, or that is not bounded by a controlling predicate
7474 that limits its value to at most @var{byte-size}. It also warns for calls
7475 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7476 types are considered unbounded even if they appear to be constrained to
7477 the expected range.
7478
7479 For example, a bounded case of @code{alloca} could be:
7480
7481 @smallexample
7482 void func (size_t n)
7483 @{
7484 void *p;
7485 if (n <= 1000)
7486 p = alloca (n);
7487 else
7488 p = malloc (n);
7489 f (p);
7490 @}
7491 @end smallexample
7492
7493 In the above example, passing @code{-Walloca-larger-than=1000} would not
7494 issue a warning because the call to @code{alloca} is known to be at most
7495 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7496 the compiler would emit a warning.
7497
7498 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7499 controlling predicate constraining its integer argument. For example:
7500
7501 @smallexample
7502 void func ()
7503 @{
7504 void *p = alloca (n);
7505 f (p);
7506 @}
7507 @end smallexample
7508
7509 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7510 a warning, but this time because of the lack of bounds checking.
7511
7512 Note, that even seemingly correct code involving signed integers could
7513 cause a warning:
7514
7515 @smallexample
7516 void func (signed int n)
7517 @{
7518 if (n < 500)
7519 @{
7520 p = alloca (n);
7521 f (p);
7522 @}
7523 @}
7524 @end smallexample
7525
7526 In the above example, @var{n} could be negative, causing a larger than
7527 expected argument to be implicitly cast into the @code{alloca} call.
7528
7529 This option also warns when @code{alloca} is used in a loop.
7530
7531 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7532 but is usually only effective when @option{-ftree-vrp} is active (default
7533 for @option{-O2} and above).
7534
7535 See also @option{-Wvla-larger-than=}@samp{byte-size}.
7536
7537 @item -Wno-alloca-larger-than
7538 @opindex Wno-alloca-larger-than
7539 Disable @option{-Walloca-larger-than=} warnings. The option is
7540 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7541
7542 @item -Warith-conversion
7543 @opindex Warith-conversion
7544 @opindex Wno-arith-conversion
7545 Do warn about implicit conversions from arithmetic operations even
7546 when conversion of the operands to the same type cannot change their
7547 values. This affects warnings from @option{-Wconversion},
7548 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7549
7550 @smallexample
7551 @group
7552 void f (char c, int i)
7553 @{
7554 c = c + i; // warns with @option{-Wconversion}
7555 c = c + 1; // only warns with @option{-Warith-conversion}
7556 @}
7557 @end group
7558 @end smallexample
7559
7560 @item -Warray-bounds
7561 @itemx -Warray-bounds=@var{n}
7562 @opindex Wno-array-bounds
7563 @opindex Warray-bounds
7564 This option is only active when @option{-ftree-vrp} is active
7565 (default for @option{-O2} and above). It warns about subscripts to arrays
7566 that are always out of bounds. This warning is enabled by @option{-Wall}.
7567
7568 @table @gcctabopt
7569 @item -Warray-bounds=1
7570 This is the warning level of @option{-Warray-bounds} and is enabled
7571 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7572
7573 @item -Warray-bounds=2
7574 This warning level also warns about out of bounds access for
7575 arrays at the end of a struct and for arrays accessed through
7576 pointers. This warning level may give a larger number of
7577 false positives and is deactivated by default.
7578 @end table
7579
7580 @item -Warray-compare
7581 @opindex Warray-compare
7582 @opindex Wno-array-compare
7583 Warn about equality and relational comparisons between two operands of array
7584 type. This comparison was deprecated in C++20. For example:
7585
7586 @smallexample
7587 int arr1[5];
7588 int arr2[5];
7589 bool same = arr1 == arr2;
7590 @end smallexample
7591
7592 @option{-Warray-compare} is enabled by @option{-Wall}.
7593
7594 @item -Warray-parameter
7595 @itemx -Warray-parameter=@var{n}
7596 @opindex Wno-array-parameter
7597 Warn about redeclarations of functions involving arguments of array or
7598 pointer types of inconsistent kinds or forms, and enable the detection
7599 of out-of-bounds accesses to such parameters by warnings such as
7600 @option{-Warray-bounds}.
7601
7602 If the first function declaration uses the array form the bound specified
7603 in the array is assumed to be the minimum number of elements expected to
7604 be provided in calls to the function and the maximum number of elements
7605 accessed by it. Failing to provide arguments of sufficient size or accessing
7606 more than the maximum number of elements may be diagnosed by warnings such
7607 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
7608 involving array parameters declared using the @code{T[static N]} form.
7609
7610 For example, the warning triggers for the following redeclarations because
7611 the first one allows an array of any size to be passed to @code{f} while
7612 the second one with the keyword @code{static} specifies that the array
7613 argument must have at least four elements.
7614
7615 @smallexample
7616 void f (int[static 4]);
7617 void f (int[]); // warning (inconsistent array form)
7618
7619 void g (void)
7620 @{
7621 int *p = (int *)malloc (4);
7622 f (p); // warning (array too small)
7623 @dots{}
7624 @}
7625 @end smallexample
7626
7627 At level 2 the warning also triggers for redeclarations involving any other
7628 inconsistency in array or pointer argument forms denoting array sizes.
7629 Pointers and arrays of unspecified bound are considered equivalent and do
7630 not trigger a warning.
7631
7632 @smallexample
7633 void g (int*);
7634 void g (int[]); // no warning
7635 void g (int[8]); // warning (inconsistent array bound)
7636 @end smallexample
7637
7638 @option{-Warray-parameter=2} is included in @option{-Wall}. The
7639 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
7640 involving Variable Length Array arguments.
7641
7642 @item -Wattribute-alias=@var{n}
7643 @itemx -Wno-attribute-alias
7644 @opindex Wattribute-alias
7645 @opindex Wno-attribute-alias
7646 Warn about declarations using the @code{alias} and similar attributes whose
7647 target is incompatible with the type of the alias.
7648 @xref{Function Attributes,,Declaring Attributes of Functions}.
7649
7650 @table @gcctabopt
7651 @item -Wattribute-alias=1
7652 The default warning level of the @option{-Wattribute-alias} option diagnoses
7653 incompatibilities between the type of the alias declaration and that of its
7654 target. Such incompatibilities are typically indicative of bugs.
7655
7656 @item -Wattribute-alias=2
7657
7658 At this level @option{-Wattribute-alias} also diagnoses cases where
7659 the attributes of the alias declaration are more restrictive than the
7660 attributes applied to its target. These mismatches can potentially
7661 result in incorrect code generation. In other cases they may be
7662 benign and could be resolved simply by adding the missing attribute to
7663 the target. For comparison, see the @option{-Wmissing-attributes}
7664 option, which controls diagnostics when the alias declaration is less
7665 restrictive than the target, rather than more restrictive.
7666
7667 Attributes considered include @code{alloc_align}, @code{alloc_size},
7668 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7669 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7670 @code{returns_nonnull}, and @code{returns_twice}.
7671 @end table
7672
7673 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7674 This is the default. You can disable these warnings with either
7675 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7676
7677 @item -Wbool-compare
7678 @opindex Wno-bool-compare
7679 @opindex Wbool-compare
7680 Warn about boolean expression compared with an integer value different from
7681 @code{true}/@code{false}. For instance, the following comparison is
7682 always false:
7683 @smallexample
7684 int n = 5;
7685 @dots{}
7686 if ((n > 1) == 2) @{ @dots{} @}
7687 @end smallexample
7688 This warning is enabled by @option{-Wall}.
7689
7690 @item -Wbool-operation
7691 @opindex Wno-bool-operation
7692 @opindex Wbool-operation
7693 Warn about suspicious operations on expressions of a boolean type. For
7694 instance, bitwise negation of a boolean is very likely a bug in the program.
7695 For C, this warning also warns about incrementing or decrementing a boolean,
7696 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
7697 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7698
7699 This warning is enabled by @option{-Wall}.
7700
7701 @item -Wduplicated-branches
7702 @opindex Wno-duplicated-branches
7703 @opindex Wduplicated-branches
7704 Warn when an if-else has identical branches. This warning detects cases like
7705 @smallexample
7706 if (p != NULL)
7707 return 0;
7708 else
7709 return 0;
7710 @end smallexample
7711 It doesn't warn when both branches contain just a null statement. This warning
7712 also warn for conditional operators:
7713 @smallexample
7714 int i = x ? *p : *p;
7715 @end smallexample
7716
7717 @item -Wduplicated-cond
7718 @opindex Wno-duplicated-cond
7719 @opindex Wduplicated-cond
7720 Warn about duplicated conditions in an if-else-if chain. For instance,
7721 warn for the following code:
7722 @smallexample
7723 if (p->q != NULL) @{ @dots{} @}
7724 else if (p->q != NULL) @{ @dots{} @}
7725 @end smallexample
7726
7727 @item -Wframe-address
7728 @opindex Wno-frame-address
7729 @opindex Wframe-address
7730 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7731 is called with an argument greater than 0. Such calls may return indeterminate
7732 values or crash the program. The warning is included in @option{-Wall}.
7733
7734 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7735 @opindex Wno-discarded-qualifiers
7736 @opindex Wdiscarded-qualifiers
7737 Do not warn if type qualifiers on pointers are being discarded.
7738 Typically, the compiler warns if a @code{const char *} variable is
7739 passed to a function that takes a @code{char *} parameter. This option
7740 can be used to suppress such a warning.
7741
7742 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7743 @opindex Wno-discarded-array-qualifiers
7744 @opindex Wdiscarded-array-qualifiers
7745 Do not warn if type qualifiers on arrays which are pointer targets
7746 are being discarded. Typically, the compiler warns if a
7747 @code{const int (*)[]} variable is passed to a function that
7748 takes a @code{int (*)[]} parameter. This option can be used to
7749 suppress such a warning.
7750
7751 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7752 @opindex Wno-incompatible-pointer-types
7753 @opindex Wincompatible-pointer-types
7754 Do not warn when there is a conversion between pointers that have incompatible
7755 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
7756 which warns for pointer argument passing or assignment with different
7757 signedness.
7758
7759 @item -Wno-int-conversion @r{(C and Objective-C only)}
7760 @opindex Wno-int-conversion
7761 @opindex Wint-conversion
7762 Do not warn about incompatible integer to pointer and pointer to integer
7763 conversions. This warning is about implicit conversions; for explicit
7764 conversions the warnings @option{-Wno-int-to-pointer-cast} and
7765 @option{-Wno-pointer-to-int-cast} may be used.
7766
7767 @item -Wzero-length-bounds
7768 @opindex Wzero-length-bounds
7769 @opindex Wzero-length-bounds
7770 Warn about accesses to elements of zero-length array members that might
7771 overlap other members of the same object. Declaring interior zero-length
7772 arrays is discouraged because accesses to them are undefined. See
7773 @xref{Zero Length}.
7774
7775 For example, the first two stores in function @code{bad} are diagnosed
7776 because the array elements overlap the subsequent members @code{b} and
7777 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
7778 because it is beyond the bounds of the enclosing object.
7779
7780 @smallexample
7781 struct X @{ int a[0]; int b, c; @};
7782 struct X x;
7783
7784 void bad (void)
7785 @{
7786 x.a[0] = 0; // -Wzero-length-bounds
7787 x.a[1] = 1; // -Wzero-length-bounds
7788 x.a[2] = 2; // -Warray-bounds
7789 @}
7790 @end smallexample
7791
7792 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7793
7794 @item -Wno-div-by-zero
7795 @opindex Wno-div-by-zero
7796 @opindex Wdiv-by-zero
7797 Do not warn about compile-time integer division by zero. Floating-point
7798 division by zero is not warned about, as it can be a legitimate way of
7799 obtaining infinities and NaNs.
7800
7801 @item -Wsystem-headers
7802 @opindex Wsystem-headers
7803 @opindex Wno-system-headers
7804 @cindex warnings from system headers
7805 @cindex system headers, warnings from
7806 Print warning messages for constructs found in system header files.
7807 Warnings from system headers are normally suppressed, on the assumption
7808 that they usually do not indicate real problems and would only make the
7809 compiler output harder to read. Using this command-line option tells
7810 GCC to emit warnings from system headers as if they occurred in user
7811 code. However, note that using @option{-Wall} in conjunction with this
7812 option does @emph{not} warn about unknown pragmas in system
7813 headers---for that, @option{-Wunknown-pragmas} must also be used.
7814
7815 @item -Wtautological-compare
7816 @opindex Wtautological-compare
7817 @opindex Wno-tautological-compare
7818 Warn if a self-comparison always evaluates to true or false. This
7819 warning detects various mistakes such as:
7820 @smallexample
7821 int i = 1;
7822 @dots{}
7823 if (i > i) @{ @dots{} @}
7824 @end smallexample
7825
7826 This warning also warns about bitwise comparisons that always evaluate
7827 to true or false, for instance:
7828 @smallexample
7829 if ((a & 16) == 10) @{ @dots{} @}
7830 @end smallexample
7831 will always be false.
7832
7833 This warning is enabled by @option{-Wall}.
7834
7835 @item -Wtrampolines
7836 @opindex Wtrampolines
7837 @opindex Wno-trampolines
7838 Warn about trampolines generated for pointers to nested functions.
7839 A trampoline is a small piece of data or code that is created at run
7840 time on the stack when the address of a nested function is taken, and is
7841 used to call the nested function indirectly. For some targets, it is
7842 made up of data only and thus requires no special treatment. But, for
7843 most targets, it is made up of code and thus requires the stack to be
7844 made executable in order for the program to work properly.
7845
7846 @item -Wfloat-equal
7847 @opindex Wfloat-equal
7848 @opindex Wno-float-equal
7849 Warn if floating-point values are used in equality comparisons.
7850
7851 The idea behind this is that sometimes it is convenient (for the
7852 programmer) to consider floating-point values as approximations to
7853 infinitely precise real numbers. If you are doing this, then you need
7854 to compute (by analyzing the code, or in some other way) the maximum or
7855 likely maximum error that the computation introduces, and allow for it
7856 when performing comparisons (and when producing output, but that's a
7857 different problem). In particular, instead of testing for equality, you
7858 should check to see whether the two values have ranges that overlap; and
7859 this is done with the relational operators, so equality comparisons are
7860 probably mistaken.
7861
7862 @item -Wtraditional @r{(C and Objective-C only)}
7863 @opindex Wtraditional
7864 @opindex Wno-traditional
7865 Warn about certain constructs that behave differently in traditional and
7866 ISO C@. Also warn about ISO C constructs that have no traditional C
7867 equivalent, and/or problematic constructs that should be avoided.
7868
7869 @itemize @bullet
7870 @item
7871 Macro parameters that appear within string literals in the macro body.
7872 In traditional C macro replacement takes place within string literals,
7873 but in ISO C it does not.
7874
7875 @item
7876 In traditional C, some preprocessor directives did not exist.
7877 Traditional preprocessors only considered a line to be a directive
7878 if the @samp{#} appeared in column 1 on the line. Therefore
7879 @option{-Wtraditional} warns about directives that traditional C
7880 understands but ignores because the @samp{#} does not appear as the
7881 first character on the line. It also suggests you hide directives like
7882 @code{#pragma} not understood by traditional C by indenting them. Some
7883 traditional implementations do not recognize @code{#elif}, so this option
7884 suggests avoiding it altogether.
7885
7886 @item
7887 A function-like macro that appears without arguments.
7888
7889 @item
7890 The unary plus operator.
7891
7892 @item
7893 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7894 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
7895 constants.) Note, these suffixes appear in macros defined in the system
7896 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7897 Use of these macros in user code might normally lead to spurious
7898 warnings, however GCC's integrated preprocessor has enough context to
7899 avoid warning in these cases.
7900
7901 @item
7902 A function declared external in one block and then used after the end of
7903 the block.
7904
7905 @item
7906 A @code{switch} statement has an operand of type @code{long}.
7907
7908 @item
7909 A non-@code{static} function declaration follows a @code{static} one.
7910 This construct is not accepted by some traditional C compilers.
7911
7912 @item
7913 The ISO type of an integer constant has a different width or
7914 signedness from its traditional type. This warning is only issued if
7915 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
7916 typically represent bit patterns, are not warned about.
7917
7918 @item
7919 Usage of ISO string concatenation is detected.
7920
7921 @item
7922 Initialization of automatic aggregates.
7923
7924 @item
7925 Identifier conflicts with labels. Traditional C lacks a separate
7926 namespace for labels.
7927
7928 @item
7929 Initialization of unions. If the initializer is zero, the warning is
7930 omitted. This is done under the assumption that the zero initializer in
7931 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7932 initializer warnings and relies on default initialization to zero in the
7933 traditional C case.
7934
7935 @item
7936 Conversions by prototypes between fixed/floating-point values and vice
7937 versa. The absence of these prototypes when compiling with traditional
7938 C causes serious problems. This is a subset of the possible
7939 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7940
7941 @item
7942 Use of ISO C style function definitions. This warning intentionally is
7943 @emph{not} issued for prototype declarations or variadic functions
7944 because these ISO C features appear in your code when using
7945 libiberty's traditional C compatibility macros, @code{PARAMS} and
7946 @code{VPARAMS}. This warning is also bypassed for nested functions
7947 because that feature is already a GCC extension and thus not relevant to
7948 traditional C compatibility.
7949 @end itemize
7950
7951 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7952 @opindex Wtraditional-conversion
7953 @opindex Wno-traditional-conversion
7954 Warn if a prototype causes a type conversion that is different from what
7955 would happen to the same argument in the absence of a prototype. This
7956 includes conversions of fixed point to floating and vice versa, and
7957 conversions changing the width or signedness of a fixed-point argument
7958 except when the same as the default promotion.
7959
7960 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7961 @opindex Wdeclaration-after-statement
7962 @opindex Wno-declaration-after-statement
7963 Warn when a declaration is found after a statement in a block. This
7964 construct, known from C++, was introduced with ISO C99 and is by default
7965 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
7966
7967 @item -Wshadow
7968 @opindex Wshadow
7969 @opindex Wno-shadow
7970 Warn whenever a local variable or type declaration shadows another
7971 variable, parameter, type, class member (in C++), or instance variable
7972 (in Objective-C) or whenever a built-in function is shadowed. Note
7973 that in C++, the compiler warns if a local variable shadows an
7974 explicit typedef, but not if it shadows a struct/class/enum.
7975 If this warning is enabled, it includes also all instances of
7976 local shadowing. This means that @option{-Wno-shadow=local}
7977 and @option{-Wno-shadow=compatible-local} are ignored when
7978 @option{-Wshadow} is used.
7979 Same as @option{-Wshadow=global}.
7980
7981 @item -Wno-shadow-ivar @r{(Objective-C only)}
7982 @opindex Wno-shadow-ivar
7983 @opindex Wshadow-ivar
7984 Do not warn whenever a local variable shadows an instance variable in an
7985 Objective-C method.
7986
7987 @item -Wshadow=global
7988 @opindex Wshadow=global
7989 Warn for any shadowing.
7990 Same as @option{-Wshadow}.
7991
7992 @item -Wshadow=local
7993 @opindex Wshadow=local
7994 Warn when a local variable shadows another local variable or parameter.
7995
7996 @item -Wshadow=compatible-local
7997 @opindex Wshadow=compatible-local
7998 Warn when a local variable shadows another local variable or parameter
7999 whose type is compatible with that of the shadowing variable. In C++,
8000 type compatibility here means the type of the shadowing variable can be
8001 converted to that of the shadowed variable. The creation of this flag
8002 (in addition to @option{-Wshadow=local}) is based on the idea that when
8003 a local variable shadows another one of incompatible type, it is most
8004 likely intentional, not a bug or typo, as shown in the following example:
8005
8006 @smallexample
8007 @group
8008 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8009 @{
8010 for (int i = 0; i < N; ++i)
8011 @{
8012 ...
8013 @}
8014 ...
8015 @}
8016 @end group
8017 @end smallexample
8018
8019 Since the two variable @code{i} in the example above have incompatible types,
8020 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8021 Because their types are incompatible, if a programmer accidentally uses one
8022 in place of the other, type checking is expected to catch that and emit an
8023 error or warning. Use of this flag instead of @option{-Wshadow=local} can
8024 possibly reduce the number of warnings triggered by intentional shadowing.
8025 Note that this also means that shadowing @code{const char *i} by
8026 @code{char *i} does not emit a warning.
8027
8028 This warning is also enabled by @option{-Wshadow=local}.
8029
8030 @item -Wlarger-than=@var{byte-size}
8031 @opindex Wlarger-than=
8032 @opindex Wlarger-than-@var{byte-size}
8033 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8034 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8035 Warnings controlled by the option can be disabled either by specifying
8036 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8037
8038 Also warn for calls to bounded functions such as @code{memchr} or
8039 @code{strnlen} that specify a bound greater than the largest possible
8040 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
8041 can only be disabled by @option{-Wno-larger-than}.
8042
8043 @item -Wno-larger-than
8044 @opindex Wno-larger-than
8045 Disable @option{-Wlarger-than=} warnings. The option is equivalent
8046 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8047
8048 @item -Wframe-larger-than=@var{byte-size}
8049 @opindex Wframe-larger-than=
8050 @opindex Wno-frame-larger-than
8051 Warn if the size of a function frame exceeds @var{byte-size}.
8052 The computation done to determine the stack frame size is approximate
8053 and not conservative.
8054 The actual requirements may be somewhat greater than @var{byte-size}
8055 even if you do not get a warning. In addition, any space allocated
8056 via @code{alloca}, variable-length arrays, or related constructs
8057 is not included by the compiler when determining
8058 whether or not to issue a warning.
8059 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8060 Warnings controlled by the option can be disabled either by specifying
8061 @var{byte-size} of @samp{SIZE_MAX} or more or by
8062 @option{-Wno-frame-larger-than}.
8063
8064 @item -Wno-frame-larger-than
8065 @opindex Wno-frame-larger-than
8066 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8067 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8068
8069 @item -Wfree-nonheap-object
8070 @opindex Wfree-nonheap-object
8071 @opindex Wno-free-nonheap-object
8072 Warn when attempting to deallocate an object that was either not allocated
8073 on the heap, or by using a pointer that was not returned from a prior call
8074 to the corresponding allocation function. For example, because the call
8075 to @code{stpcpy} returns a pointer to the terminating nul character and
8076 not to the begginning of the object, the call to @code{free} below is
8077 diagnosed.
8078
8079 @smallexample
8080 void f (char *p)
8081 @{
8082 p = stpcpy (p, "abc");
8083 // ...
8084 free (p); // warning
8085 @}
8086 @end smallexample
8087
8088 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8089
8090 @item -Wstack-usage=@var{byte-size}
8091 @opindex Wstack-usage
8092 @opindex Wno-stack-usage
8093 Warn if the stack usage of a function might exceed @var{byte-size}.
8094 The computation done to determine the stack usage is conservative.
8095 Any space allocated via @code{alloca}, variable-length arrays, or related
8096 constructs is included by the compiler when determining whether or not to
8097 issue a warning.
8098
8099 The message is in keeping with the output of @option{-fstack-usage}.
8100
8101 @itemize
8102 @item
8103 If the stack usage is fully static but exceeds the specified amount, it's:
8104
8105 @smallexample
8106 warning: stack usage is 1120 bytes
8107 @end smallexample
8108 @item
8109 If the stack usage is (partly) dynamic but bounded, it's:
8110
8111 @smallexample
8112 warning: stack usage might be 1648 bytes
8113 @end smallexample
8114 @item
8115 If the stack usage is (partly) dynamic and not bounded, it's:
8116
8117 @smallexample
8118 warning: stack usage might be unbounded
8119 @end smallexample
8120 @end itemize
8121
8122 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8123 Warnings controlled by the option can be disabled either by specifying
8124 @var{byte-size} of @samp{SIZE_MAX} or more or by
8125 @option{-Wno-stack-usage}.
8126
8127 @item -Wno-stack-usage
8128 @opindex Wno-stack-usage
8129 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8130 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8131
8132 @item -Wunsafe-loop-optimizations
8133 @opindex Wunsafe-loop-optimizations
8134 @opindex Wno-unsafe-loop-optimizations
8135 Warn if the loop cannot be optimized because the compiler cannot
8136 assume anything on the bounds of the loop indices. With
8137 @option{-funsafe-loop-optimizations} warn if the compiler makes
8138 such assumptions.
8139
8140 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8141 @opindex Wno-pedantic-ms-format
8142 @opindex Wpedantic-ms-format
8143 When used in combination with @option{-Wformat}
8144 and @option{-pedantic} without GNU extensions, this option
8145 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8146 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8147 which depend on the MS runtime.
8148
8149 @item -Wpointer-arith
8150 @opindex Wpointer-arith
8151 @opindex Wno-pointer-arith
8152 Warn about anything that depends on the ``size of'' a function type or
8153 of @code{void}. GNU C assigns these types a size of 1, for
8154 convenience in calculations with @code{void *} pointers and pointers
8155 to functions. In C++, warn also when an arithmetic operation involves
8156 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8157
8158 @item -Wno-pointer-compare
8159 @opindex Wpointer-compare
8160 @opindex Wno-pointer-compare
8161 Do not warn if a pointer is compared with a zero character constant.
8162 This usually
8163 means that the pointer was meant to be dereferenced. For example:
8164
8165 @smallexample
8166 const char *p = foo ();
8167 if (p == '\0')
8168 return 42;
8169 @end smallexample
8170
8171 Note that the code above is invalid in C++11.
8172
8173 This warning is enabled by default.
8174
8175 @item -Wtsan
8176 @opindex Wtsan
8177 @opindex Wno-tsan
8178 Warn about unsupported features in ThreadSanitizer.
8179
8180 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8181 can report false positives.
8182
8183 This warning is enabled by default.
8184
8185 @item -Wtype-limits
8186 @opindex Wtype-limits
8187 @opindex Wno-type-limits
8188 Warn if a comparison is always true or always false due to the limited
8189 range of the data type, but do not warn for constant expressions. For
8190 example, warn if an unsigned variable is compared against zero with
8191 @code{<} or @code{>=}. This warning is also enabled by
8192 @option{-Wextra}.
8193
8194 @item -Wabsolute-value @r{(C and Objective-C only)}
8195 @opindex Wabsolute-value
8196 @opindex Wno-absolute-value
8197 Warn for calls to standard functions that compute the absolute value
8198 of an argument when a more appropriate standard function is available.
8199 For example, calling @code{abs(3.14)} triggers the warning because the
8200 appropriate function to call to compute the absolute value of a double
8201 argument is @code{fabs}. The option also triggers warnings when the
8202 argument in a call to such a function has an unsigned type. This
8203 warning can be suppressed with an explicit type cast and it is also
8204 enabled by @option{-Wextra}.
8205
8206 @include cppwarnopts.texi
8207
8208 @item -Wbad-function-cast @r{(C and Objective-C only)}
8209 @opindex Wbad-function-cast
8210 @opindex Wno-bad-function-cast
8211 Warn when a function call is cast to a non-matching type.
8212 For example, warn if a call to a function returning an integer type
8213 is cast to a pointer type.
8214
8215 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8216 @opindex Wc90-c99-compat
8217 @opindex Wno-c90-c99-compat
8218 Warn about features not present in ISO C90, but present in ISO C99.
8219 For instance, warn about use of variable length arrays, @code{long long}
8220 type, @code{bool} type, compound literals, designated initializers, and so
8221 on. This option is independent of the standards mode. Warnings are disabled
8222 in the expression that follows @code{__extension__}.
8223
8224 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8225 @opindex Wc99-c11-compat
8226 @opindex Wno-c99-c11-compat
8227 Warn about features not present in ISO C99, but present in ISO C11.
8228 For instance, warn about use of anonymous structures and unions,
8229 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8230 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8231 and so on. This option is independent of the standards mode. Warnings are
8232 disabled in the expression that follows @code{__extension__}.
8233
8234 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8235 @opindex Wc11-c2x-compat
8236 @opindex Wno-c11-c2x-compat
8237 Warn about features not present in ISO C11, but present in ISO C2X.
8238 For instance, warn about omitting the string in @code{_Static_assert},
8239 use of @samp{[[]]} syntax for attributes, use of decimal
8240 floating-point types, and so on. This option is independent of the
8241 standards mode. Warnings are disabled in the expression that follows
8242 @code{__extension__}.
8243
8244 @item -Wc++-compat @r{(C and Objective-C only)}
8245 @opindex Wc++-compat
8246 @opindex Wno-c++-compat
8247 Warn about ISO C constructs that are outside of the common subset of
8248 ISO C and ISO C++, e.g.@: request for implicit conversion from
8249 @code{void *} to a pointer to non-@code{void} type.
8250
8251 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8252 @opindex Wc++11-compat
8253 @opindex Wno-c++11-compat
8254 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8255 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8256 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8257 enabled by @option{-Wall}.
8258
8259 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8260 @opindex Wc++14-compat
8261 @opindex Wno-c++14-compat
8262 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8263 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8264
8265 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8266 @opindex Wc++17-compat
8267 @opindex Wno-c++17-compat
8268 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8269 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8270
8271 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8272 @opindex Wc++20-compat
8273 @opindex Wno-c++20-compat
8274 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8275 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8276
8277 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8278 @opindex Wc++11-extensions
8279 @opindex Wno-c++11-extensions
8280 Do not warn about C++11 constructs in code being compiled using
8281 an older C++ standard. Even without this option, some C++11 constructs
8282 will only be diagnosed if @option{-Wpedantic} is used.
8283
8284 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8285 @opindex Wc++14-extensions
8286 @opindex Wno-c++14-extensions
8287 Do not warn about C++14 constructs in code being compiled using
8288 an older C++ standard. Even without this option, some C++14 constructs
8289 will only be diagnosed if @option{-Wpedantic} is used.
8290
8291 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8292 @opindex Wc++17-extensions
8293 @opindex Wno-c++17-extensions
8294 Do not warn about C++17 constructs in code being compiled using
8295 an older C++ standard. Even without this option, some C++17 constructs
8296 will only be diagnosed if @option{-Wpedantic} is used.
8297
8298 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8299 @opindex Wc++20-extensions
8300 @opindex Wno-c++20-extensions
8301 Do not warn about C++20 constructs in code being compiled using
8302 an older C++ standard. Even without this option, some C++20 constructs
8303 will only be diagnosed if @option{-Wpedantic} is used.
8304
8305 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8306 @opindex Wc++23-extensions
8307 @opindex Wno-c++23-extensions
8308 Do not warn about C++23 constructs in code being compiled using
8309 an older C++ standard. Even without this option, some C++23 constructs
8310 will only be diagnosed if @option{-Wpedantic} is used.
8311
8312 @item -Wcast-qual
8313 @opindex Wcast-qual
8314 @opindex Wno-cast-qual
8315 Warn whenever a pointer is cast so as to remove a type qualifier from
8316 the target type. For example, warn if a @code{const char *} is cast
8317 to an ordinary @code{char *}.
8318
8319 Also warn when making a cast that introduces a type qualifier in an
8320 unsafe way. For example, casting @code{char **} to @code{const char **}
8321 is unsafe, as in this example:
8322
8323 @smallexample
8324 /* p is char ** value. */
8325 const char **q = (const char **) p;
8326 /* Assignment of readonly string to const char * is OK. */
8327 *q = "string";
8328 /* Now char** pointer points to read-only memory. */
8329 **p = 'b';
8330 @end smallexample
8331
8332 @item -Wcast-align
8333 @opindex Wcast-align
8334 @opindex Wno-cast-align
8335 Warn whenever a pointer is cast such that the required alignment of the
8336 target is increased. For example, warn if a @code{char *} is cast to
8337 an @code{int *} on machines where integers can only be accessed at
8338 two- or four-byte boundaries.
8339
8340 @item -Wcast-align=strict
8341 @opindex Wcast-align=strict
8342 Warn whenever a pointer is cast such that the required alignment of the
8343 target is increased. For example, warn if a @code{char *} is cast to
8344 an @code{int *} regardless of the target machine.
8345
8346 @item -Wcast-function-type
8347 @opindex Wcast-function-type
8348 @opindex Wno-cast-function-type
8349 Warn when a function pointer is cast to an incompatible function pointer.
8350 In a cast involving function types with a variable argument list only
8351 the types of initial arguments that are provided are considered.
8352 Any parameter of pointer-type matches any other pointer-type. Any benign
8353 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8354 on ILP32 targets. Likewise type qualifiers are ignored. The function
8355 type @code{void (*) (void)} is special and matches everything, which can
8356 be used to suppress this warning.
8357 In a cast involving pointer to member types this warning warns whenever
8358 the type cast is changing the pointer to member type.
8359 This warning is enabled by @option{-Wextra}.
8360
8361 @item -Wwrite-strings
8362 @opindex Wwrite-strings
8363 @opindex Wno-write-strings
8364 When compiling C, give string constants the type @code{const
8365 char[@var{length}]} so that copying the address of one into a
8366 non-@code{const} @code{char *} pointer produces a warning. These
8367 warnings help you find at compile time code that can try to write
8368 into a string constant, but only if you have been very careful about
8369 using @code{const} in declarations and prototypes. Otherwise, it is
8370 just a nuisance. This is why we did not make @option{-Wall} request
8371 these warnings.
8372
8373 When compiling C++, warn about the deprecated conversion from string
8374 literals to @code{char *}. This warning is enabled by default for C++
8375 programs.
8376
8377 @item -Wclobbered
8378 @opindex Wclobbered
8379 @opindex Wno-clobbered
8380 Warn for variables that might be changed by @code{longjmp} or
8381 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8382
8383 @item -Wconversion
8384 @opindex Wconversion
8385 @opindex Wno-conversion
8386 Warn for implicit conversions that may alter a value. This includes
8387 conversions between real and integer, like @code{abs (x)} when
8388 @code{x} is @code{double}; conversions between signed and unsigned,
8389 like @code{unsigned ui = -1}; and conversions to smaller types, like
8390 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8391 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8392 changed by the conversion like in @code{abs (2.0)}. Warnings about
8393 conversions between signed and unsigned integers can be disabled by
8394 using @option{-Wno-sign-conversion}.
8395
8396 For C++, also warn for confusing overload resolution for user-defined
8397 conversions; and conversions that never use a type conversion
8398 operator: conversions to @code{void}, the same type, a base class or a
8399 reference to them. Warnings about conversions between signed and
8400 unsigned integers are disabled by default in C++ unless
8401 @option{-Wsign-conversion} is explicitly enabled.
8402
8403 Warnings about conversion from arithmetic on a small type back to that
8404 type are only given with @option{-Warith-conversion}.
8405
8406 @item -Wdangling-else
8407 @opindex Wdangling-else
8408 @opindex Wno-dangling-else
8409 Warn about constructions where there may be confusion to which
8410 @code{if} statement an @code{else} branch belongs. Here is an example of
8411 such a case:
8412
8413 @smallexample
8414 @group
8415 @{
8416 if (a)
8417 if (b)
8418 foo ();
8419 else
8420 bar ();
8421 @}
8422 @end group
8423 @end smallexample
8424
8425 In C/C++, every @code{else} branch belongs to the innermost possible
8426 @code{if} statement, which in this example is @code{if (b)}. This is
8427 often not what the programmer expected, as illustrated in the above
8428 example by indentation the programmer chose. When there is the
8429 potential for this confusion, GCC issues a warning when this flag
8430 is specified. To eliminate the warning, add explicit braces around
8431 the innermost @code{if} statement so there is no way the @code{else}
8432 can belong to the enclosing @code{if}. The resulting code
8433 looks like this:
8434
8435 @smallexample
8436 @group
8437 @{
8438 if (a)
8439 @{
8440 if (b)
8441 foo ();
8442 else
8443 bar ();
8444 @}
8445 @}
8446 @end group
8447 @end smallexample
8448
8449 This warning is enabled by @option{-Wparentheses}.
8450
8451 @item -Wdate-time
8452 @opindex Wdate-time
8453 @opindex Wno-date-time
8454 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
8455 are encountered as they might prevent bit-wise-identical reproducible
8456 compilations.
8457
8458 @item -Wempty-body
8459 @opindex Wempty-body
8460 @opindex Wno-empty-body
8461 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
8462 while} statement. This warning is also enabled by @option{-Wextra}.
8463
8464 @item -Wno-endif-labels
8465 @opindex Wendif-labels
8466 @opindex Wno-endif-labels
8467 Do not warn about stray tokens after @code{#else} and @code{#endif}.
8468
8469 @item -Wenum-compare
8470 @opindex Wenum-compare
8471 @opindex Wno-enum-compare
8472 Warn about a comparison between values of different enumerated types.
8473 In C++ enumerated type mismatches in conditional expressions are also
8474 diagnosed and the warning is enabled by default. In C this warning is
8475 enabled by @option{-Wall}.
8476
8477 @item -Wenum-conversion
8478 @opindex Wenum-conversion
8479 @opindex Wno-enum-conversion
8480 Warn when a value of enumerated type is implicitly converted to a
8481 different enumerated type. This warning is enabled by @option{-Wextra}
8482 in C@.
8483
8484 @item -Wjump-misses-init @r{(C, Objective-C only)}
8485 @opindex Wjump-misses-init
8486 @opindex Wno-jump-misses-init
8487 Warn if a @code{goto} statement or a @code{switch} statement jumps
8488 forward across the initialization of a variable, or jumps backward to a
8489 label after the variable has been initialized. This only warns about
8490 variables that are initialized when they are declared. This warning is
8491 only supported for C and Objective-C; in C++ this sort of branch is an
8492 error in any case.
8493
8494 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
8495 can be disabled with the @option{-Wno-jump-misses-init} option.
8496
8497 @item -Wsign-compare
8498 @opindex Wsign-compare
8499 @opindex Wno-sign-compare
8500 @cindex warning for comparison of signed and unsigned values
8501 @cindex comparison of signed and unsigned values, warning
8502 @cindex signed and unsigned values, comparison warning
8503 Warn when a comparison between signed and unsigned values could produce
8504 an incorrect result when the signed value is converted to unsigned.
8505 In C++, this warning is also enabled by @option{-Wall}. In C, it is
8506 also enabled by @option{-Wextra}.
8507
8508 @item -Wsign-conversion
8509 @opindex Wsign-conversion
8510 @opindex Wno-sign-conversion
8511 Warn for implicit conversions that may change the sign of an integer
8512 value, like assigning a signed integer expression to an unsigned
8513 integer variable. An explicit cast silences the warning. In C, this
8514 option is enabled also by @option{-Wconversion}.
8515
8516 @item -Wfloat-conversion
8517 @opindex Wfloat-conversion
8518 @opindex Wno-float-conversion
8519 Warn for implicit conversions that reduce the precision of a real value.
8520 This includes conversions from real to integer, and from higher precision
8521 real to lower precision real values. This option is also enabled by
8522 @option{-Wconversion}.
8523
8524 @item -Wno-scalar-storage-order
8525 @opindex Wno-scalar-storage-order
8526 @opindex Wscalar-storage-order
8527 Do not warn on suspicious constructs involving reverse scalar storage order.
8528
8529 @item -Wsizeof-array-div
8530 @opindex Wsizeof-array-div
8531 @opindex Wno-sizeof-array-div
8532 Warn about divisions of two sizeof operators when the first one is applied
8533 to an array and the divisor does not equal the size of the array element.
8534 In such a case, the computation will not yield the number of elements in the
8535 array, which is likely what the user intended. This warning warns e.g. about
8536 @smallexample
8537 int fn ()
8538 @{
8539 int arr[10];
8540 return sizeof (arr) / sizeof (short);
8541 @}
8542 @end smallexample
8543
8544 This warning is enabled by @option{-Wall}.
8545
8546 @item -Wsizeof-pointer-div
8547 @opindex Wsizeof-pointer-div
8548 @opindex Wno-sizeof-pointer-div
8549 Warn for suspicious divisions of two sizeof expressions that divide
8550 the pointer size by the element size, which is the usual way to compute
8551 the array size but won't work out correctly with pointers. This warning
8552 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
8553 not an array, but a pointer. This warning is enabled by @option{-Wall}.
8554
8555 @item -Wsizeof-pointer-memaccess
8556 @opindex Wsizeof-pointer-memaccess
8557 @opindex Wno-sizeof-pointer-memaccess
8558 Warn for suspicious length parameters to certain string and memory built-in
8559 functions if the argument uses @code{sizeof}. This warning triggers for
8560 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
8561 an array, but a pointer, and suggests a possible fix, or about
8562 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
8563 also warns about calls to bounded string copy functions like @code{strncat}
8564 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
8565 the source array. For example, in the following function the call to
8566 @code{strncat} specifies the size of the source string as the bound. That
8567 is almost certainly a mistake and so the call is diagnosed.
8568 @smallexample
8569 void make_file (const char *name)
8570 @{
8571 char path[PATH_MAX];
8572 strncpy (path, name, sizeof path - 1);
8573 strncat (path, ".text", sizeof ".text");
8574 @dots{}
8575 @}
8576 @end smallexample
8577
8578 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
8579
8580 @item -Wno-sizeof-array-argument
8581 @opindex Wsizeof-array-argument
8582 @opindex Wno-sizeof-array-argument
8583 Do not warn when the @code{sizeof} operator is applied to a parameter that is
8584 declared as an array in a function definition. This warning is enabled by
8585 default for C and C++ programs.
8586
8587 @item -Wmemset-elt-size
8588 @opindex Wmemset-elt-size
8589 @opindex Wno-memset-elt-size
8590 Warn for suspicious calls to the @code{memset} built-in function, if the
8591 first argument references an array, and the third argument is a number
8592 equal to the number of elements, but not equal to the size of the array
8593 in memory. This indicates that the user has omitted a multiplication by
8594 the element size. This warning is enabled by @option{-Wall}.
8595
8596 @item -Wmemset-transposed-args
8597 @opindex Wmemset-transposed-args
8598 @opindex Wno-memset-transposed-args
8599 Warn for suspicious calls to the @code{memset} built-in function where
8600 the second argument is not zero and the third argument is zero. For
8601 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
8602 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
8603 is only emitted if the third argument is a literal zero. Otherwise, if
8604 it is an expression that is folded to zero, or a cast of zero to some
8605 type, it is far less likely that the arguments have been mistakenly
8606 transposed and no warning is emitted. This warning is enabled
8607 by @option{-Wall}.
8608
8609 @item -Waddress
8610 @opindex Waddress
8611 @opindex Wno-address
8612 Warn about suspicious uses of address expressions. These include comparing
8613 the address of a function or a declared object to the null pointer constant
8614 such as in
8615 @smallexample
8616 void f (void);
8617 void g (void)
8618 @{
8619 if (!func) // warning: expression evaluates to false
8620 abort ();
8621 @}
8622 @end smallexample
8623 comparisons of a pointer to a string literal, such as in
8624 @smallexample
8625 void f (const char *x)
8626 @{
8627 if (x == "abc") // warning: expression evaluates to false
8628 puts ("equal");
8629 @}
8630 @end smallexample
8631 and tests of the results of pointer addition or subtraction for equality
8632 to null, such as in
8633 @smallexample
8634 void f (const int *p, int i)
8635 @{
8636 return p + i == NULL;
8637 @}
8638 @end smallexample
8639 Such uses typically indicate a programmer error: the address of most
8640 functions and objects necessarily evaluates to true (the exception are
8641 weak symbols), so their use in a conditional might indicate missing
8642 parentheses in a function call or a missing dereference in an array
8643 expression. The subset of the warning for object pointers can be
8644 suppressed by casting the pointer operand to an integer type such
8645 as @code{inptr_t} or @code{uinptr_t}.
8646 Comparisons against string literals result in unspecified behavior
8647 and are not portable, and suggest the intent was to call @code{strcmp}.
8648 @option{-Waddress} warning is enabled by @option{-Wall}.
8649
8650 @item -Wno-address-of-packed-member
8651 @opindex Waddress-of-packed-member
8652 @opindex Wno-address-of-packed-member
8653 Do not warn when the address of packed member of struct or union is taken,
8654 which usually results in an unaligned pointer value. This is
8655 enabled by default.
8656
8657 @item -Wlogical-op
8658 @opindex Wlogical-op
8659 @opindex Wno-logical-op
8660 Warn about suspicious uses of logical operators in expressions.
8661 This includes using logical operators in contexts where a
8662 bit-wise operator is likely to be expected. Also warns when
8663 the operands of a logical operator are the same:
8664 @smallexample
8665 extern int a;
8666 if (a < 0 && a < 0) @{ @dots{} @}
8667 @end smallexample
8668
8669 @item -Wlogical-not-parentheses
8670 @opindex Wlogical-not-parentheses
8671 @opindex Wno-logical-not-parentheses
8672 Warn about logical not used on the left hand side operand of a comparison.
8673 This option does not warn if the right operand is considered to be a boolean
8674 expression. Its purpose is to detect suspicious code like the following:
8675 @smallexample
8676 int a;
8677 @dots{}
8678 if (!a > 1) @{ @dots{} @}
8679 @end smallexample
8680
8681 It is possible to suppress the warning by wrapping the LHS into
8682 parentheses:
8683 @smallexample
8684 if ((!a) > 1) @{ @dots{} @}
8685 @end smallexample
8686
8687 This warning is enabled by @option{-Wall}.
8688
8689 @item -Waggregate-return
8690 @opindex Waggregate-return
8691 @opindex Wno-aggregate-return
8692 Warn if any functions that return structures or unions are defined or
8693 called. (In languages where you can return an array, this also elicits
8694 a warning.)
8695
8696 @item -Wno-aggressive-loop-optimizations
8697 @opindex Wno-aggressive-loop-optimizations
8698 @opindex Waggressive-loop-optimizations
8699 Warn if in a loop with constant number of iterations the compiler detects
8700 undefined behavior in some statement during one or more of the iterations.
8701
8702 @item -Wno-attributes
8703 @opindex Wno-attributes
8704 @opindex Wattributes
8705 Do not warn if an unexpected @code{__attribute__} is used, such as
8706 unrecognized attributes, function attributes applied to variables,
8707 etc. This does not stop errors for incorrect use of supported
8708 attributes.
8709
8710 @item -Wno-builtin-declaration-mismatch
8711 @opindex Wno-builtin-declaration-mismatch
8712 @opindex Wbuiltin-declaration-mismatch
8713 Warn if a built-in function is declared with an incompatible signature
8714 or as a non-function, or when a built-in function declared with a type
8715 that does not include a prototype is called with arguments whose promoted
8716 types do not match those expected by the function. When @option{-Wextra}
8717 is specified, also warn when a built-in function that takes arguments is
8718 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
8719 warning is enabled by default. To avoid the warning include the appropriate
8720 header to bring the prototypes of built-in functions into scope.
8721
8722 For example, the call to @code{memset} below is diagnosed by the warning
8723 because the function expects a value of type @code{size_t} as its argument
8724 but the type of @code{32} is @code{int}. With @option{-Wextra},
8725 the declaration of the function is diagnosed as well.
8726 @smallexample
8727 extern void* memset ();
8728 void f (void *d)
8729 @{
8730 memset (d, '\0', 32);
8731 @}
8732 @end smallexample
8733
8734 @item -Wno-builtin-macro-redefined
8735 @opindex Wno-builtin-macro-redefined
8736 @opindex Wbuiltin-macro-redefined
8737 Do not warn if certain built-in macros are redefined. This suppresses
8738 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8739 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8740
8741 @item -Wstrict-prototypes @r{(C and Objective-C only)}
8742 @opindex Wstrict-prototypes
8743 @opindex Wno-strict-prototypes
8744 Warn if a function is declared or defined without specifying the
8745 argument types. (An old-style function definition is permitted without
8746 a warning if preceded by a declaration that specifies the argument
8747 types.)
8748
8749 @item -Wold-style-declaration @r{(C and Objective-C only)}
8750 @opindex Wold-style-declaration
8751 @opindex Wno-old-style-declaration
8752 Warn for obsolescent usages, according to the C Standard, in a
8753 declaration. For example, warn if storage-class specifiers like
8754 @code{static} are not the first things in a declaration. This warning
8755 is also enabled by @option{-Wextra}.
8756
8757 @item -Wold-style-definition @r{(C and Objective-C only)}
8758 @opindex Wold-style-definition
8759 @opindex Wno-old-style-definition
8760 Warn if an old-style function definition is used. A warning is given
8761 even if there is a previous prototype. A definition using @samp{()}
8762 is not considered an old-style definition in C2X mode, because it is
8763 equivalent to @samp{(void)} in that case, but is considered an
8764 old-style definition for older standards.
8765
8766 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
8767 @opindex Wmissing-parameter-type
8768 @opindex Wno-missing-parameter-type
8769 A function parameter is declared without a type specifier in K&R-style
8770 functions:
8771
8772 @smallexample
8773 void foo(bar) @{ @}
8774 @end smallexample
8775
8776 This warning is also enabled by @option{-Wextra}.
8777
8778 @item -Wmissing-prototypes @r{(C and Objective-C only)}
8779 @opindex Wmissing-prototypes
8780 @opindex Wno-missing-prototypes
8781 Warn if a global function is defined without a previous prototype
8782 declaration. This warning is issued even if the definition itself
8783 provides a prototype. Use this option to detect global functions
8784 that do not have a matching prototype declaration in a header file.
8785 This option is not valid for C++ because all function declarations
8786 provide prototypes and a non-matching declaration declares an
8787 overload rather than conflict with an earlier declaration.
8788 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8789
8790 @item -Wmissing-declarations
8791 @opindex Wmissing-declarations
8792 @opindex Wno-missing-declarations
8793 Warn if a global function is defined without a previous declaration.
8794 Do so even if the definition itself provides a prototype.
8795 Use this option to detect global functions that are not declared in
8796 header files. In C, no warnings are issued for functions with previous
8797 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8798 missing prototypes. In C++, no warnings are issued for function templates,
8799 or for inline functions, or for functions in anonymous namespaces.
8800
8801 @item -Wmissing-field-initializers
8802 @opindex Wmissing-field-initializers
8803 @opindex Wno-missing-field-initializers
8804 @opindex W
8805 @opindex Wextra
8806 @opindex Wno-extra
8807 Warn if a structure's initializer has some fields missing. For
8808 example, the following code causes such a warning, because
8809 @code{x.h} is implicitly zero:
8810
8811 @smallexample
8812 struct s @{ int f, g, h; @};
8813 struct s x = @{ 3, 4 @};
8814 @end smallexample
8815
8816 This option does not warn about designated initializers, so the following
8817 modification does not trigger a warning:
8818
8819 @smallexample
8820 struct s @{ int f, g, h; @};
8821 struct s x = @{ .f = 3, .g = 4 @};
8822 @end smallexample
8823
8824 In C this option does not warn about the universal zero initializer
8825 @samp{@{ 0 @}}:
8826
8827 @smallexample
8828 struct s @{ int f, g, h; @};
8829 struct s x = @{ 0 @};
8830 @end smallexample
8831
8832 Likewise, in C++ this option does not warn about the empty @{ @}
8833 initializer, for example:
8834
8835 @smallexample
8836 struct s @{ int f, g, h; @};
8837 s x = @{ @};
8838 @end smallexample
8839
8840 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
8841 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8842
8843 @item -Wno-missing-requires
8844 @opindex Wmissing-requires
8845 @opindex Wno-missing-requires
8846
8847 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
8848
8849 @smallexample
8850 bool satisfied = requires @{ C<T> @};
8851 @end smallexample
8852
8853 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
8854 expression, which it is for all T. Presumably the user meant to write
8855
8856 @smallexample
8857 bool satisfied = requires @{ requires C<T> @};
8858 @end smallexample
8859
8860 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
8861 type @samp{T}.
8862
8863 This warning can be disabled with @option{-Wno-missing-requires}.
8864
8865 @item -Wno-multichar
8866 @opindex Wno-multichar
8867 @opindex Wmultichar
8868 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8869 Usually they indicate a typo in the user's code, as they have
8870 implementation-defined values, and should not be used in portable code.
8871
8872 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8873 @opindex Wnormalized=
8874 @opindex Wnormalized
8875 @opindex Wno-normalized
8876 @cindex NFC
8877 @cindex NFKC
8878 @cindex character set, input normalization
8879 In ISO C and ISO C++, two identifiers are different if they are
8880 different sequences of characters. However, sometimes when characters
8881 outside the basic ASCII character set are used, you can have two
8882 different character sequences that look the same. To avoid confusion,
8883 the ISO 10646 standard sets out some @dfn{normalization rules} which
8884 when applied ensure that two sequences that look the same are turned into
8885 the same sequence. GCC can warn you if you are using identifiers that
8886 have not been normalized; this option controls that warning.
8887
8888 There are four levels of warning supported by GCC@. The default is
8889 @option{-Wnormalized=nfc}, which warns about any identifier that is
8890 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
8891 recommended form for most uses. It is equivalent to
8892 @option{-Wnormalized}.
8893
8894 Unfortunately, there are some characters allowed in identifiers by
8895 ISO C and ISO C++ that, when turned into NFC, are not allowed in
8896 identifiers. That is, there's no way to use these symbols in portable
8897 ISO C or C++ and have all your identifiers in NFC@.
8898 @option{-Wnormalized=id} suppresses the warning for these characters.
8899 It is hoped that future versions of the standards involved will correct
8900 this, which is why this option is not the default.
8901
8902 You can switch the warning off for all characters by writing
8903 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
8904 only do this if you are using some other normalization scheme (like
8905 ``D''), because otherwise you can easily create bugs that are
8906 literally impossible to see.
8907
8908 Some characters in ISO 10646 have distinct meanings but look identical
8909 in some fonts or display methodologies, especially once formatting has
8910 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
8911 LETTER N'', displays just like a regular @code{n} that has been
8912 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
8913 normalization scheme to convert all these into a standard form as
8914 well, and GCC warns if your code is not in NFKC if you use
8915 @option{-Wnormalized=nfkc}. This warning is comparable to warning
8916 about every identifier that contains the letter O because it might be
8917 confused with the digit 0, and so is not the default, but may be
8918 useful as a local coding convention if the programming environment
8919 cannot be fixed to display these characters distinctly.
8920
8921 @item -Wno-attribute-warning
8922 @opindex Wno-attribute-warning
8923 @opindex Wattribute-warning
8924 Do not warn about usage of functions (@pxref{Function Attributes})
8925 declared with @code{warning} attribute. By default, this warning is
8926 enabled. @option{-Wno-attribute-warning} can be used to disable the
8927 warning or @option{-Wno-error=attribute-warning} can be used to
8928 disable the error when compiled with @option{-Werror} flag.
8929
8930 @item -Wno-deprecated
8931 @opindex Wno-deprecated
8932 @opindex Wdeprecated
8933 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
8934
8935 @item -Wno-deprecated-declarations
8936 @opindex Wno-deprecated-declarations
8937 @opindex Wdeprecated-declarations
8938 Do not warn about uses of functions (@pxref{Function Attributes}),
8939 variables (@pxref{Variable Attributes}), and types (@pxref{Type
8940 Attributes}) marked as deprecated by using the @code{deprecated}
8941 attribute.
8942
8943 @item -Wno-overflow
8944 @opindex Wno-overflow
8945 @opindex Woverflow
8946 Do not warn about compile-time overflow in constant expressions.
8947
8948 @item -Wno-odr
8949 @opindex Wno-odr
8950 @opindex Wodr
8951 Warn about One Definition Rule violations during link-time optimization.
8952 Enabled by default.
8953
8954 @item -Wopenacc-parallelism
8955 @opindex Wopenacc-parallelism
8956 @opindex Wno-openacc-parallelism
8957 @cindex OpenACC accelerator programming
8958 Warn about potentially suboptimal choices related to OpenACC parallelism.
8959
8960 @item -Wopenmp-simd
8961 @opindex Wopenmp-simd
8962 @opindex Wno-openmp-simd
8963 Warn if the vectorizer cost model overrides the OpenMP
8964 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
8965 option can be used to relax the cost model.
8966
8967 @item -Woverride-init @r{(C and Objective-C only)}
8968 @opindex Woverride-init
8969 @opindex Wno-override-init
8970 @opindex W
8971 @opindex Wextra
8972 @opindex Wno-extra
8973 Warn if an initialized field without side effects is overridden when
8974 using designated initializers (@pxref{Designated Inits, , Designated
8975 Initializers}).
8976
8977 This warning is included in @option{-Wextra}. To get other
8978 @option{-Wextra} warnings without this one, use @option{-Wextra
8979 -Wno-override-init}.
8980
8981 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
8982 @opindex Woverride-init-side-effects
8983 @opindex Wno-override-init-side-effects
8984 Do not warn if an initialized field with side effects is overridden when
8985 using designated initializers (@pxref{Designated Inits, , Designated
8986 Initializers}). This warning is enabled by default.
8987
8988 @item -Wpacked
8989 @opindex Wpacked
8990 @opindex Wno-packed
8991 Warn if a structure is given the packed attribute, but the packed
8992 attribute has no effect on the layout or size of the structure.
8993 Such structures may be mis-aligned for little benefit. For
8994 instance, in this code, the variable @code{f.x} in @code{struct bar}
8995 is misaligned even though @code{struct bar} does not itself
8996 have the packed attribute:
8997
8998 @smallexample
8999 @group
9000 struct foo @{
9001 int x;
9002 char a, b, c, d;
9003 @} __attribute__((packed));
9004 struct bar @{
9005 char z;
9006 struct foo f;
9007 @};
9008 @end group
9009 @end smallexample
9010
9011 @item -Wnopacked-bitfield-compat
9012 @opindex Wpacked-bitfield-compat
9013 @opindex Wno-packed-bitfield-compat
9014 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9015 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
9016 the change can lead to differences in the structure layout. GCC
9017 informs you when the offset of such a field has changed in GCC 4.4.
9018 For example there is no longer a 4-bit padding between field @code{a}
9019 and @code{b} in this structure:
9020
9021 @smallexample
9022 struct foo
9023 @{
9024 char a:4;
9025 char b:8;
9026 @} __attribute__ ((packed));
9027 @end smallexample
9028
9029 This warning is enabled by default. Use
9030 @option{-Wno-packed-bitfield-compat} to disable this warning.
9031
9032 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9033 @opindex Wpacked-not-aligned
9034 @opindex Wno-packed-not-aligned
9035 Warn if a structure field with explicitly specified alignment in a
9036 packed struct or union is misaligned. For example, a warning will
9037 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9038 'struct S' is less than 8}, in this code:
9039
9040 @smallexample
9041 @group
9042 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9043 struct __attribute__ ((packed)) S @{
9044 struct S8 s8;
9045 @};
9046 @end group
9047 @end smallexample
9048
9049 This warning is enabled by @option{-Wall}.
9050
9051 @item -Wpadded
9052 @opindex Wpadded
9053 @opindex Wno-padded
9054 Warn if padding is included in a structure, either to align an element
9055 of the structure or to align the whole structure. Sometimes when this
9056 happens it is possible to rearrange the fields of the structure to
9057 reduce the padding and so make the structure smaller.
9058
9059 @item -Wredundant-decls
9060 @opindex Wredundant-decls
9061 @opindex Wno-redundant-decls
9062 Warn if anything is declared more than once in the same scope, even in
9063 cases where multiple declaration is valid and changes nothing.
9064
9065 @item -Wrestrict
9066 @opindex Wrestrict
9067 @opindex Wno-restrict
9068 Warn when an object referenced by a @code{restrict}-qualified parameter
9069 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9070 argument, or when copies between such objects overlap. For example,
9071 the call to the @code{strcpy} function below attempts to truncate the string
9072 by replacing its initial characters with the last four. However, because
9073 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9074 the call is diagnosed.
9075
9076 @smallexample
9077 void foo (void)
9078 @{
9079 char a[] = "abcd1234";
9080 strcpy (a, a + 4);
9081 @dots{}
9082 @}
9083 @end smallexample
9084 The @option{-Wrestrict} option detects some instances of simple overlap
9085 even without optimization but works best at @option{-O2} and above. It
9086 is included in @option{-Wall}.
9087
9088 @item -Wnested-externs @r{(C and Objective-C only)}
9089 @opindex Wnested-externs
9090 @opindex Wno-nested-externs
9091 Warn if an @code{extern} declaration is encountered within a function.
9092
9093 @item -Winline
9094 @opindex Winline
9095 @opindex Wno-inline
9096 Warn if a function that is declared as inline cannot be inlined.
9097 Even with this option, the compiler does not warn about failures to
9098 inline functions declared in system headers.
9099
9100 The compiler uses a variety of heuristics to determine whether or not
9101 to inline a function. For example, the compiler takes into account
9102 the size of the function being inlined and the amount of inlining
9103 that has already been done in the current function. Therefore,
9104 seemingly insignificant changes in the source program can cause the
9105 warnings produced by @option{-Winline} to appear or disappear.
9106
9107 @item -Winterference-size
9108 @opindex Winterference-size
9109 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9110 without specifying its value with @option{--param destructive-interference-size}.
9111 Also warn about questionable values for that option.
9112
9113 This variable is intended to be used for controlling class layout, to
9114 avoid false sharing in concurrent code:
9115
9116 @smallexample
9117 struct independent_fields @{
9118 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9119 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9120 @};
9121 @end smallexample
9122
9123 Here @samp{one} and @samp{two} are intended to be far enough apart
9124 that stores to one won't require accesses to the other to reload the
9125 cache line.
9126
9127 By default, @option{--param destructive-interference-size} and
9128 @option{--param constructive-interference-size} are set based on the
9129 current @option{-mtune} option, typically to the L1 cache line size
9130 for the particular target CPU, sometimes to a range if tuning for a
9131 generic target. So all translation units that depend on ABI
9132 compatibility for the use of these variables must be compiled with
9133 the same @option{-mtune} (or @option{-mcpu}).
9134
9135 If ABI stability is important, such as if the use is in a header for a
9136 library, you should probably not use the hardware interference size
9137 variables at all. Alternatively, you can force a particular value
9138 with @option{--param}.
9139
9140 If you are confident that your use of the variable does not affect ABI
9141 outside a single build of your project, you can turn off the warning
9142 with @option{-Wno-interference-size}.
9143
9144 @item -Wint-in-bool-context
9145 @opindex Wint-in-bool-context
9146 @opindex Wno-int-in-bool-context
9147 Warn for suspicious use of integer values where boolean values are expected,
9148 such as conditional expressions (?:) using non-boolean integer constants in
9149 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9150 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9151 for all kinds of multiplications regardless of the data type.
9152 This warning is enabled by @option{-Wall}.
9153
9154 @item -Wno-int-to-pointer-cast
9155 @opindex Wno-int-to-pointer-cast
9156 @opindex Wint-to-pointer-cast
9157 Suppress warnings from casts to pointer type of an integer of a
9158 different size. In C++, casting to a pointer type of smaller size is
9159 an error. @option{Wint-to-pointer-cast} is enabled by default.
9160
9161
9162 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9163 @opindex Wno-pointer-to-int-cast
9164 @opindex Wpointer-to-int-cast
9165 Suppress warnings from casts from a pointer to an integer type of a
9166 different size.
9167
9168 @item -Winvalid-pch
9169 @opindex Winvalid-pch
9170 @opindex Wno-invalid-pch
9171 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9172 the search path but cannot be used.
9173
9174 @item -Wlong-long
9175 @opindex Wlong-long
9176 @opindex Wno-long-long
9177 Warn if @code{long long} type is used. This is enabled by either
9178 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9179 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9180
9181 @item -Wvariadic-macros
9182 @opindex Wvariadic-macros
9183 @opindex Wno-variadic-macros
9184 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9185 alternate syntax is used in ISO C99 mode. This is enabled by either
9186 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9187 messages, use @option{-Wno-variadic-macros}.
9188
9189 @item -Wno-varargs
9190 @opindex Wvarargs
9191 @opindex Wno-varargs
9192 Do not warn upon questionable usage of the macros used to handle variable
9193 arguments like @code{va_start}. These warnings are enabled by default.
9194
9195 @item -Wvector-operation-performance
9196 @opindex Wvector-operation-performance
9197 @opindex Wno-vector-operation-performance
9198 Warn if vector operation is not implemented via SIMD capabilities of the
9199 architecture. Mainly useful for the performance tuning.
9200 Vector operation can be implemented @code{piecewise}, which means that the
9201 scalar operation is performed on every vector element;
9202 @code{in parallel}, which means that the vector operation is implemented
9203 using scalars of wider type, which normally is more performance efficient;
9204 and @code{as a single scalar}, which means that vector fits into a
9205 scalar type.
9206
9207 @item -Wvla
9208 @opindex Wvla
9209 @opindex Wno-vla
9210 Warn if a variable-length array is used in the code.
9211 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9212 the variable-length array.
9213
9214 @item -Wvla-larger-than=@var{byte-size}
9215 @opindex Wvla-larger-than=
9216 @opindex Wno-vla-larger-than
9217 If this option is used, the compiler warns for declarations of
9218 variable-length arrays whose size is either unbounded, or bounded
9219 by an argument that allows the array size to exceed @var{byte-size}
9220 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9221 works, but with variable-length arrays.
9222
9223 Note that GCC may optimize small variable-length arrays of a known
9224 value into plain arrays, so this warning may not get triggered for
9225 such arrays.
9226
9227 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9228 is typically only effective when @option{-ftree-vrp} is active (default
9229 for @option{-O2} and above).
9230
9231 See also @option{-Walloca-larger-than=@var{byte-size}}.
9232
9233 @item -Wno-vla-larger-than
9234 @opindex Wno-vla-larger-than
9235 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9236 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9237
9238 @item -Wvla-parameter
9239 @opindex Wno-vla-parameter
9240 Warn about redeclarations of functions involving arguments of Variable
9241 Length Array types of inconsistent kinds or forms, and enable the detection
9242 of out-of-bounds accesses to such parameters by warnings such as
9243 @option{-Warray-bounds}.
9244
9245 If the first function declaration uses the VLA form the bound specified
9246 in the array is assumed to be the minimum number of elements expected to
9247 be provided in calls to the function and the maximum number of elements
9248 accessed by it. Failing to provide arguments of sufficient size or
9249 accessing more than the maximum number of elements may be diagnosed.
9250
9251 For example, the warning triggers for the following redeclarations because
9252 the first one allows an array of any size to be passed to @code{f} while
9253 the second one specifies that the array argument must have at least @code{n}
9254 elements. In addition, calling @code{f} with the assotiated VLA bound
9255 parameter in excess of the actual VLA bound triggers a warning as well.
9256
9257 @smallexample
9258 void f (int n, int[n]);
9259 void f (int, int[]); // warning: argument 2 previously declared as a VLA
9260
9261 void g (int n)
9262 @{
9263 if (n > 4)
9264 return;
9265 int a[n];
9266 f (sizeof a, a); // warning: access to a by f may be out of bounds
9267 @dots{}
9268 @}
9269
9270 @end smallexample
9271
9272 @option{-Wvla-parameter} is included in @option{-Wall}. The
9273 @option{-Warray-parameter} option triggers warnings for similar problems
9274 involving ordinary array arguments.
9275
9276 @item -Wvolatile-register-var
9277 @opindex Wvolatile-register-var
9278 @opindex Wno-volatile-register-var
9279 Warn if a register variable is declared volatile. The volatile
9280 modifier does not inhibit all optimizations that may eliminate reads
9281 and/or writes to register variables. This warning is enabled by
9282 @option{-Wall}.
9283
9284 @item -Wdisabled-optimization
9285 @opindex Wdisabled-optimization
9286 @opindex Wno-disabled-optimization
9287 Warn if a requested optimization pass is disabled. This warning does
9288 not generally indicate that there is anything wrong with your code; it
9289 merely indicates that GCC's optimizers are unable to handle the code
9290 effectively. Often, the problem is that your code is too big or too
9291 complex; GCC refuses to optimize programs when the optimization
9292 itself is likely to take inordinate amounts of time.
9293
9294 @item -Wpointer-sign @r{(C and Objective-C only)}
9295 @opindex Wpointer-sign
9296 @opindex Wno-pointer-sign
9297 Warn for pointer argument passing or assignment with different signedness.
9298 This option is only supported for C and Objective-C@. It is implied by
9299 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9300 @option{-Wno-pointer-sign}.
9301
9302 @item -Wstack-protector
9303 @opindex Wstack-protector
9304 @opindex Wno-stack-protector
9305 This option is only active when @option{-fstack-protector} is active. It
9306 warns about functions that are not protected against stack smashing.
9307
9308 @item -Woverlength-strings
9309 @opindex Woverlength-strings
9310 @opindex Wno-overlength-strings
9311 Warn about string constants that are longer than the ``minimum
9312 maximum'' length specified in the C standard. Modern compilers
9313 generally allow string constants that are much longer than the
9314 standard's minimum limit, but very portable programs should avoid
9315 using longer strings.
9316
9317 The limit applies @emph{after} string constant concatenation, and does
9318 not count the trailing NUL@. In C90, the limit was 509 characters; in
9319 C99, it was raised to 4095. C++98 does not specify a normative
9320 minimum maximum, so we do not diagnose overlength strings in C++@.
9321
9322 This option is implied by @option{-Wpedantic}, and can be disabled with
9323 @option{-Wno-overlength-strings}.
9324
9325 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9326 @opindex Wunsuffixed-float-constants
9327 @opindex Wno-unsuffixed-float-constants
9328
9329 Issue a warning for any floating constant that does not have
9330 a suffix. When used together with @option{-Wsystem-headers} it
9331 warns about such constants in system header files. This can be useful
9332 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9333 from the decimal floating-point extension to C99.
9334
9335 @item -Wno-lto-type-mismatch
9336 @opindex Wlto-type-mismatch
9337 @opindex Wno-lto-type-mismatch
9338
9339 During the link-time optimization, do not warn about type mismatches in
9340 global declarations from different compilation units.
9341 Requires @option{-flto} to be enabled. Enabled by default.
9342
9343 @item -Wno-designated-init @r{(C and Objective-C only)}
9344 @opindex Wdesignated-init
9345 @opindex Wno-designated-init
9346 Suppress warnings when a positional initializer is used to initialize
9347 a structure that has been marked with the @code{designated_init}
9348 attribute.
9349
9350 @end table
9351
9352 @node Static Analyzer Options
9353 @section Options That Control Static Analysis
9354
9355 @table @gcctabopt
9356 @item -fanalyzer
9357 @opindex analyzer
9358 @opindex fanalyzer
9359 @opindex fno-analyzer
9360 This option enables an static analysis of program flow which looks
9361 for ``interesting'' interprocedural paths through the
9362 code, and issues warnings for problems found on them.
9363
9364 This analysis is much more expensive than other GCC warnings.
9365
9366 Enabling this option effectively enables the following warnings:
9367
9368 @gccoptlist{ @gol
9369 -Wanalyzer-double-fclose @gol
9370 -Wanalyzer-double-free @gol
9371 -Wanalyzer-exposure-through-output-file @gol
9372 -Wanalyzer-file-leak @gol
9373 -Wanalyzer-free-of-non-heap @gol
9374 -Wanalyzer-malloc-leak @gol
9375 -Wanalyzer-mismatching-deallocation @gol
9376 -Wanalyzer-possible-null-argument @gol
9377 -Wanalyzer-possible-null-dereference @gol
9378 -Wanalyzer-null-argument @gol
9379 -Wanalyzer-null-dereference @gol
9380 -Wanalyzer-shift-count-negative @gol
9381 -Wanalyzer-shift-count-overflow @gol
9382 -Wanalyzer-stale-setjmp-buffer @gol
9383 -Wanalyzer-tainted-array-index @gol
9384 -Wanalyzer-unsafe-call-within-signal-handler @gol
9385 -Wanalyzer-use-after-free @gol
9386 -Wanalyzer-use-of-uninitialized-value @gol
9387 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
9388 -Wanalyzer-write-to-const @gol
9389 -Wanalyzer-write-to-string-literal @gol
9390 }
9391
9392 This option is only available if GCC was configured with analyzer
9393 support enabled.
9394
9395 @item -Wanalyzer-too-complex
9396 @opindex Wanalyzer-too-complex
9397 @opindex Wno-analyzer-too-complex
9398 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
9399 to attempt to explore the control flow and data flow in the program,
9400 but these can be defeated by sufficiently complicated code.
9401
9402 By default, the analysis silently stops if the code is too
9403 complicated for the analyzer to fully explore and it reaches an internal
9404 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
9405
9406 @item -Wno-analyzer-double-fclose
9407 @opindex Wanalyzer-double-fclose
9408 @opindex Wno-analyzer-double-fclose
9409 This warning requires @option{-fanalyzer}, which enables it; use
9410 @option{-Wno-analyzer-double-fclose} to disable it.
9411
9412 This diagnostic warns for paths through the code in which a @code{FILE *}
9413 can have @code{fclose} called on it more than once.
9414
9415 @item -Wno-analyzer-double-free
9416 @opindex Wanalyzer-double-free
9417 @opindex Wno-analyzer-double-free
9418 This warning requires @option{-fanalyzer}, which enables it; use
9419 @option{-Wno-analyzer-double-free} to disable it.
9420
9421 This diagnostic warns for paths through the code in which a pointer
9422 can have a deallocator called on it more than once, either @code{free},
9423 or a deallocator referenced by attribute @code{malloc}.
9424
9425 @item -Wno-analyzer-exposure-through-output-file
9426 @opindex Wanalyzer-exposure-through-output-file
9427 @opindex Wno-analyzer-exposure-through-output-file
9428 This warning requires @option{-fanalyzer}, which enables it; use
9429 @option{-Wno-analyzer-exposure-through-output-file}
9430 to disable it.
9431
9432 This diagnostic warns for paths through the code in which a
9433 security-sensitive value is written to an output file
9434 (such as writing a password to a log file).
9435
9436 @item -Wno-analyzer-file-leak
9437 @opindex Wanalyzer-file-leak
9438 @opindex Wno-analyzer-file-leak
9439 This warning requires @option{-fanalyzer}, which enables it; use
9440 @option{-Wno-analyzer-file-leak}
9441 to disable it.
9442
9443 This diagnostic warns for paths through the code in which a
9444 @code{<stdio.h>} @code{FILE *} stream object is leaked.
9445
9446 @item -Wno-analyzer-free-of-non-heap
9447 @opindex Wanalyzer-free-of-non-heap
9448 @opindex Wno-analyzer-free-of-non-heap
9449 This warning requires @option{-fanalyzer}, which enables it; use
9450 @option{-Wno-analyzer-free-of-non-heap}
9451 to disable it.
9452
9453 This diagnostic warns for paths through the code in which @code{free}
9454 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
9455
9456 @item -Wno-analyzer-malloc-leak
9457 @opindex Wanalyzer-malloc-leak
9458 @opindex Wno-analyzer-malloc-leak
9459 This warning requires @option{-fanalyzer}, which enables it; use
9460 @option{-Wno-analyzer-malloc-leak}
9461 to disable it.
9462
9463 This diagnostic warns for paths through the code in which a
9464 pointer allocated via an allocator is leaked: either @code{malloc},
9465 or a function marked with attribute @code{malloc}.
9466
9467 @item -Wno-analyzer-mismatching-deallocation
9468 @opindex Wanalyzer-mismatching-deallocation
9469 @opindex Wno-analyzer-mismatching-deallocation
9470 This warning requires @option{-fanalyzer}, which enables it; use
9471 @option{-Wno-analyzer-mismatching-deallocation}
9472 to disable it.
9473
9474 This diagnostic warns for paths through the code in which the
9475 wrong deallocation function is called on a pointer value, based on
9476 which function was used to allocate the pointer value. The diagnostic
9477 will warn about mismatches between @code{free}, scalar @code{delete}
9478 and vector @code{delete[]}, and those marked as allocator/deallocator
9479 pairs using attribute @code{malloc}.
9480
9481 @item -Wno-analyzer-possible-null-argument
9482 @opindex Wanalyzer-possible-null-argument
9483 @opindex Wno-analyzer-possible-null-argument
9484 This warning requires @option{-fanalyzer}, which enables it; use
9485 @option{-Wno-analyzer-possible-null-argument} to disable it.
9486
9487 This diagnostic warns for paths through the code in which a
9488 possibly-NULL value is passed to a function argument marked
9489 with @code{__attribute__((nonnull))} as requiring a non-NULL
9490 value.
9491
9492 @item -Wno-analyzer-possible-null-dereference
9493 @opindex Wanalyzer-possible-null-dereference
9494 @opindex Wno-analyzer-possible-null-dereference
9495 This warning requires @option{-fanalyzer}, which enables it; use
9496 @option{-Wno-analyzer-possible-null-dereference} to disable it.
9497
9498 This diagnostic warns for paths through the code in which a
9499 possibly-NULL value is dereferenced.
9500
9501 @item -Wno-analyzer-null-argument
9502 @opindex Wanalyzer-null-argument
9503 @opindex Wno-analyzer-null-argument
9504 This warning requires @option{-fanalyzer}, which enables it; use
9505 @option{-Wno-analyzer-null-argument} to disable it.
9506
9507 This diagnostic warns for paths through the code in which a
9508 value known to be NULL is passed to a function argument marked
9509 with @code{__attribute__((nonnull))} as requiring a non-NULL
9510 value.
9511
9512 @item -Wno-analyzer-null-dereference
9513 @opindex Wanalyzer-null-dereference
9514 @opindex Wno-analyzer-null-dereference
9515 This warning requires @option{-fanalyzer}, which enables it; use
9516 @option{-Wno-analyzer-null-dereference} to disable it.
9517
9518 This diagnostic warns for paths through the code in which a
9519 value known to be NULL is dereferenced.
9520
9521 @item -Wno-analyzer-shift-count-negative
9522 @opindex Wanalyzer-shift-count-negative
9523 @opindex Wno-analyzer-shift-count-negative
9524 This warning requires @option{-fanalyzer}, which enables it; use
9525 @option{-Wno-analyzer-shift-count-negative} to disable it.
9526
9527 This diagnostic warns for paths through the code in which a
9528 shift is attempted with a negative count. It is analogous to
9529 the @option{-Wshift-count-negative} diagnostic implemented in
9530 the C/C++ front ends, but is implemented based on analyzing
9531 interprocedural paths, rather than merely parsing the syntax tree.
9532 However, the analyzer does not prioritize detection of such paths, so
9533 false negatives are more likely relative to other warnings.
9534
9535 @item -Wno-analyzer-shift-count-overflow
9536 @opindex Wanalyzer-shift-count-overflow
9537 @opindex Wno-analyzer-shift-count-overflow
9538 This warning requires @option{-fanalyzer}, which enables it; use
9539 @option{-Wno-analyzer-shift-count-overflow} to disable it.
9540
9541 This diagnostic warns for paths through the code in which a
9542 shift is attempted with a count greater than or equal to the
9543 precision of the operand's type. It is analogous to
9544 the @option{-Wshift-count-overflow} diagnostic implemented in
9545 the C/C++ front ends, but is implemented based on analyzing
9546 interprocedural paths, rather than merely parsing the syntax tree.
9547 However, the analyzer does not prioritize detection of such paths, so
9548 false negatives are more likely relative to other warnings.
9549
9550 @item -Wno-analyzer-stale-setjmp-buffer
9551 @opindex Wanalyzer-stale-setjmp-buffer
9552 @opindex Wno-analyzer-stale-setjmp-buffer
9553 This warning requires @option{-fanalyzer}, which enables it; use
9554 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
9555
9556 This diagnostic warns for paths through the code in which
9557 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
9558 to a @code{setjmp} call in a function that has returned.
9559
9560 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
9561 location, it records the stack frame. The stack frame becomes invalid
9562 when the function containing the @code{setjmp} call returns. Attempting
9563 to rewind to it via @code{longjmp} would reference a stack frame that
9564 no longer exists, and likely lead to a crash (or worse).
9565
9566 @item -Wno-analyzer-tainted-array-index
9567 @opindex Wanalyzer-tainted-array-index
9568 @opindex Wno-analyzer-tainted-array-index
9569 This warning requires both @option{-fanalyzer} and
9570 @option{-fanalyzer-checker=taint} to enable it;
9571 use @option{-Wno-analyzer-tainted-array-index} to disable it.
9572
9573 This diagnostic warns for paths through the code in which a value
9574 that could be under an attacker's control is used as the index
9575 of an array access without being sanitized.
9576
9577 @item -Wno-analyzer-unsafe-call-within-signal-handler
9578 @opindex Wanalyzer-unsafe-call-within-signal-handler
9579 @opindex Wno-analyzer-unsafe-call-within-signal-handler
9580 This warning requires @option{-fanalyzer}, which enables it; use
9581 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
9582
9583 This diagnostic warns for paths through the code in which a
9584 function known to be async-signal-unsafe (such as @code{fprintf}) is
9585 called from a signal handler.
9586
9587 @item -Wno-analyzer-use-after-free
9588 @opindex Wanalyzer-use-after-free
9589 @opindex Wno-analyzer-use-after-free
9590 This warning requires @option{-fanalyzer}, which enables it; use
9591 @option{-Wno-analyzer-use-after-free} to disable it.
9592
9593 This diagnostic warns for paths through the code in which a
9594 pointer is used after a deallocator is called on it: either @code{free},
9595 or a deallocator referenced by attribute @code{malloc}.
9596
9597 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
9598 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
9599 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
9600 This warning requires @option{-fanalyzer}, which enables it; use
9601 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
9602 to disable it.
9603
9604 This diagnostic warns for paths through the code in which a pointer
9605 is dereferenced that points to a variable in a stale stack frame.
9606
9607 @item -Wno-analyzer-write-to-const
9608 @opindex Wanalyzer-write-to-const
9609 @opindex Wno-analyzer-write-to-const
9610 This warning requires @option{-fanalyzer}, which enables it; use
9611 @option{-Wno-analyzer-write-to-const}
9612 to disable it.
9613
9614 This diagnostic warns for paths through the code in which the analyzer
9615 detects an attempt to write through a pointer to a @code{const} object.
9616 However, the analyzer does not prioritize detection of such paths, so
9617 false negatives are more likely relative to other warnings.
9618
9619 @item -Wno-analyzer-write-to-string-literal
9620 @opindex Wanalyzer-write-to-string-literal
9621 @opindex Wno-analyzer-write-to-string-literal
9622 This warning requires @option{-fanalyzer}, which enables it; use
9623 @option{-Wno-analyzer-write-to-string-literal}
9624 to disable it.
9625
9626 This diagnostic warns for paths through the code in which the analyzer
9627 detects an attempt to write through a pointer to a string literal.
9628 However, the analyzer does not prioritize detection of such paths, so
9629 false negatives are more likely relative to other warnings.
9630
9631 @item -Wno-analyzer-use-of-uninitialized-value
9632 @opindex Wanalyzer-use-of-uninitialized-value
9633 @opindex Wno-analyzer-use-of-uninitialized-value
9634 This warning requires @option{-fanalyzer}, which enables it; use
9635 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
9636
9637 This diagnostic warns for paths through the code in which an uninitialized
9638 value is used.
9639
9640 @end table
9641
9642 Pertinent parameters for controlling the exploration are:
9643 @option{--param analyzer-bb-explosion-factor=@var{value}},
9644 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
9645 @option{--param analyzer-max-recursion-depth=@var{value}}, and
9646 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
9647
9648 The following options control the analyzer.
9649
9650 @table @gcctabopt
9651
9652 @item -fanalyzer-call-summaries
9653 @opindex fanalyzer-call-summaries
9654 @opindex fno-analyzer-call-summaries
9655 Simplify interprocedural analysis by computing the effect of certain calls,
9656 rather than exploring all paths through the function from callsite to each
9657 possible return.
9658
9659 If enabled, call summaries are only used for functions with more than one
9660 call site, and that are sufficiently complicated (as per
9661 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
9662
9663 @item -fanalyzer-checker=@var{name}
9664 @opindex fanalyzer-checker
9665 Restrict the analyzer to run just the named checker, and enable it.
9666
9667 Some checkers are disabled by default (even with @option{-fanalyzer}),
9668 such as the @code{taint} checker that implements
9669 @option{-Wanalyzer-tainted-array-index}, and this option is required
9670 to enable them.
9671
9672 @item -fno-analyzer-feasibility
9673 @opindex fanalyzer-feasibility
9674 @opindex fno-analyzer-feasibility
9675 This option is intended for analyzer developers.
9676
9677 By default the analyzer verifies that there is a feasible control flow path
9678 for each diagnostic it emits: that the conditions that hold are not mutually
9679 exclusive. Diagnostics for which no feasible path can be found are rejected.
9680 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
9681 debugging issues in this code.
9682
9683 @item -fanalyzer-fine-grained
9684 @opindex fanalyzer-fine-grained
9685 @opindex fno-analyzer-fine-grained
9686 This option is intended for analyzer developers.
9687
9688 Internally the analyzer builds an ``exploded graph'' that combines
9689 control flow graphs with data flow information.
9690
9691 By default, an edge in this graph can contain the effects of a run
9692 of multiple statements within a basic block. With
9693 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
9694
9695 @item -fanalyzer-show-duplicate-count
9696 @opindex fanalyzer-show-duplicate-count
9697 @opindex fno-analyzer-show-duplicate-count
9698 This option is intended for analyzer developers: if multiple diagnostics
9699 have been detected as being duplicates of each other, it emits a note when
9700 reporting the best diagnostic, giving the number of additional diagnostics
9701 that were suppressed by the deduplication logic.
9702
9703 @item -fno-analyzer-state-merge
9704 @opindex fanalyzer-state-merge
9705 @opindex fno-analyzer-state-merge
9706 This option is intended for analyzer developers.
9707
9708 By default the analyzer attempts to simplify analysis by merging
9709 sufficiently similar states at each program point as it builds its
9710 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
9711 merging can be suppressed, for debugging state-handling issues.
9712
9713 @item -fno-analyzer-state-purge
9714 @opindex fanalyzer-state-purge
9715 @opindex fno-analyzer-state-purge
9716 This option is intended for analyzer developers.
9717
9718 By default the analyzer attempts to simplify analysis by purging
9719 aspects of state at a program point that appear to no longer be relevant
9720 e.g. the values of locals that aren't accessed later in the function
9721 and which aren't relevant to leak analysis.
9722
9723 With @option{-fno-analyzer-state-purge} this purging of state can
9724 be suppressed, for debugging state-handling issues.
9725
9726 @item -fanalyzer-transitivity
9727 @opindex fanalyzer-transitivity
9728 @opindex fno-analyzer-transitivity
9729 This option enables transitivity of constraints within the analyzer.
9730
9731 @item -fanalyzer-verbose-edges
9732 This option is intended for analyzer developers. It enables more
9733 verbose, lower-level detail in the descriptions of control flow
9734 within diagnostic paths.
9735
9736 @item -fanalyzer-verbose-state-changes
9737 This option is intended for analyzer developers. It enables more
9738 verbose, lower-level detail in the descriptions of events relating
9739 to state machines within diagnostic paths.
9740
9741 @item -fanalyzer-verbosity=@var{level}
9742 This option controls the complexity of the control flow paths that are
9743 emitted for analyzer diagnostics.
9744
9745 The @var{level} can be one of:
9746
9747 @table @samp
9748 @item 0
9749 At this level, interprocedural call and return events are displayed,
9750 along with the most pertinent state-change events relating to
9751 a diagnostic. For example, for a double-@code{free} diagnostic,
9752 both calls to @code{free} will be shown.
9753
9754 @item 1
9755 As per the previous level, but also show events for the entry
9756 to each function.
9757
9758 @item 2
9759 As per the previous level, but also show events relating to
9760 control flow that are significant to triggering the issue
9761 (e.g. ``true path taken'' at a conditional).
9762
9763 This level is the default.
9764
9765 @item 3
9766 As per the previous level, but show all control flow events, not
9767 just significant ones.
9768
9769 @item 4
9770 This level is intended for analyzer developers; it adds various
9771 other events intended for debugging the analyzer.
9772
9773 @end table
9774
9775 @item -fdump-analyzer
9776 @opindex fdump-analyzer
9777 Dump internal details about what the analyzer is doing to
9778 @file{@var{file}.analyzer.txt}.
9779 This option is overridden by @option{-fdump-analyzer-stderr}.
9780
9781 @item -fdump-analyzer-stderr
9782 @opindex fdump-analyzer-stderr
9783 Dump internal details about what the analyzer is doing to stderr.
9784 This option overrides @option{-fdump-analyzer}.
9785
9786 @item -fdump-analyzer-callgraph
9787 @opindex fdump-analyzer-callgraph
9788 Dump a representation of the call graph suitable for viewing with
9789 GraphViz to @file{@var{file}.callgraph.dot}.
9790
9791 @item -fdump-analyzer-exploded-graph
9792 @opindex fdump-analyzer-exploded-graph
9793 Dump a representation of the ``exploded graph'' suitable for viewing with
9794 GraphViz to @file{@var{file}.eg.dot}.
9795 Nodes are color-coded based on state-machine states to emphasize
9796 state changes.
9797
9798 @item -fdump-analyzer-exploded-nodes
9799 @opindex dump-analyzer-exploded-nodes
9800 Emit diagnostics showing where nodes in the ``exploded graph'' are
9801 in relation to the program source.
9802
9803 @item -fdump-analyzer-exploded-nodes-2
9804 @opindex dump-analyzer-exploded-nodes-2
9805 Dump a textual representation of the ``exploded graph'' to
9806 @file{@var{file}.eg.txt}.
9807
9808 @item -fdump-analyzer-exploded-nodes-3
9809 @opindex dump-analyzer-exploded-nodes-3
9810 Dump a textual representation of the ``exploded graph'' to
9811 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
9812 This is typically a large number of dump files.
9813
9814 @item -fdump-analyzer-exploded-paths
9815 @opindex fdump-analyzer-exploded-paths
9816 Dump a textual representation of the ``exploded path'' for each
9817 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
9818
9819 @item -fdump-analyzer-feasibility
9820 @opindex dump-analyzer-feasibility
9821 Dump internal details about the analyzer's search for feasible paths.
9822 The details are written in a form suitable for viewing with GraphViz
9823 to filenames of the form @file{@var{file}.*.fg.dot} and
9824 @file{@var{file}.*.tg.dot}.
9825
9826 @item -fdump-analyzer-json
9827 @opindex fdump-analyzer-json
9828 Dump a compressed JSON representation of analyzer internals to
9829 @file{@var{file}.analyzer.json.gz}. The precise format is subject
9830 to change.
9831
9832 @item -fdump-analyzer-state-purge
9833 @opindex fdump-analyzer-state-purge
9834 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
9835 ``supergraph'' suitable for viewing with GraphViz, but annotate the
9836 graph with information on what state will be purged at each node.
9837 The graph is written to @file{@var{file}.state-purge.dot}.
9838
9839 @item -fdump-analyzer-supergraph
9840 @opindex fdump-analyzer-supergraph
9841 Dump representations of the ``supergraph'' suitable for viewing with
9842 GraphViz to @file{@var{file}.supergraph.dot} and to
9843 @file{@var{file}.supergraph-eg.dot}. These show all of the
9844 control flow graphs in the program, with interprocedural edges for
9845 calls and returns. The second dump contains annotations showing nodes
9846 in the ``exploded graph'' and diagnostics associated with them.
9847
9848 @end table
9849
9850 @node Debugging Options
9851 @section Options for Debugging Your Program
9852 @cindex options, debugging
9853 @cindex debugging information options
9854
9855 To tell GCC to emit extra information for use by a debugger, in almost
9856 all cases you need only to add @option{-g} to your other options. Some debug
9857 formats can co-exist (like DWARF with CTF) when each of them is enabled
9858 explicitly by adding the respective command line option to your other options.
9859
9860 GCC allows you to use @option{-g} with
9861 @option{-O}. The shortcuts taken by optimized code may occasionally
9862 be surprising: some variables you declared may not exist
9863 at all; flow of control may briefly move where you did not expect it;
9864 some statements may not be executed because they compute constant
9865 results or their values are already at hand; some statements may
9866 execute in different places because they have been moved out of loops.
9867 Nevertheless it is possible to debug optimized output. This makes
9868 it reasonable to use the optimizer for programs that might have bugs.
9869
9870 If you are not using some other optimization option, consider
9871 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
9872 With no @option{-O} option at all, some compiler passes that collect
9873 information useful for debugging do not run at all, so that
9874 @option{-Og} may result in a better debugging experience.
9875
9876 @table @gcctabopt
9877 @item -g
9878 @opindex g
9879 Produce debugging information in the operating system's native format
9880 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
9881 information.
9882
9883 On most systems that use stabs format, @option{-g} enables use of extra
9884 debugging information that only GDB can use; this extra information
9885 makes debugging work better in GDB but probably makes other debuggers
9886 crash or
9887 refuse to read the program. If you want to control for certain whether
9888 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
9889 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
9890
9891 @item -ggdb
9892 @opindex ggdb
9893 Produce debugging information for use by GDB@. This means to use the
9894 most expressive format available (DWARF, stabs, or the native format
9895 if neither of those are supported), including GDB extensions if at all
9896 possible.
9897
9898 @item -gdwarf
9899 @itemx -gdwarf-@var{version}
9900 @opindex gdwarf
9901 Produce debugging information in DWARF format (if that is supported).
9902 The value of @var{version} may be either 2, 3, 4 or 5; the default
9903 version for most targets is 5 (with the exception of VxWorks, TPF and
9904 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
9905 to version 4).
9906
9907 Note that with DWARF Version 2, some ports require and always
9908 use some non-conflicting DWARF 3 extensions in the unwind tables.
9909
9910 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
9911 for maximum benefit. Version 5 requires GDB 8.0 or higher.
9912
9913 GCC no longer supports DWARF Version 1, which is substantially
9914 different than Version 2 and later. For historical reasons, some
9915 other DWARF-related options such as
9916 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
9917 in their names, but apply to all currently-supported versions of DWARF.
9918
9919 @item -gbtf
9920 @opindex gbtf
9921 Request BTF debug information. BTF is the default debugging format for the
9922 eBPF target. On other targets, like x86, BTF debug information can be
9923 generated along with DWARF debug information when both of the debug formats are
9924 enabled explicitly via their respective command line options.
9925
9926 @item -gctf
9927 @itemx -gctf@var{level}
9928 @opindex gctf
9929 Request CTF debug information and use level to specify how much CTF debug
9930 information should be produced. If @option{-gctf} is specified
9931 without a value for level, the default level of CTF debug information is 2.
9932
9933 CTF debug information can be generated along with DWARF debug information when
9934 both of the debug formats are enabled explicitly via their respective command
9935 line options.
9936
9937 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
9938 negates @option{-gctf}.
9939
9940 Level 1 produces CTF information for tracebacks only. This includes callsite
9941 information, but does not include type information.
9942
9943 Level 2 produces type information for entities (functions, data objects etc.)
9944 at file-scope or global-scope only.
9945
9946 @item -gstabs
9947 @opindex gstabs
9948 Produce debugging information in stabs format (if that is supported),
9949 without GDB extensions. This is the format used by DBX on most BSD
9950 systems. On MIPS, Alpha and System V Release 4 systems this option
9951 produces stabs debugging output that is not understood by DBX@.
9952 On System V Release 4 systems this option requires the GNU assembler.
9953
9954 @item -gstabs+
9955 @opindex gstabs+
9956 Produce debugging information in stabs format (if that is supported),
9957 using GNU extensions understood only by the GNU debugger (GDB)@. The
9958 use of these extensions is likely to make other debuggers crash or
9959 refuse to read the program.
9960
9961 @item -gxcoff
9962 @opindex gxcoff
9963 Produce debugging information in XCOFF format (if that is supported).
9964 This is the format used by the DBX debugger on IBM RS/6000 systems.
9965
9966 @item -gxcoff+
9967 @opindex gxcoff+
9968 Produce debugging information in XCOFF format (if that is supported),
9969 using GNU extensions understood only by the GNU debugger (GDB)@. The
9970 use of these extensions is likely to make other debuggers crash or
9971 refuse to read the program, and may cause assemblers other than the GNU
9972 assembler (GAS) to fail with an error.
9973
9974 @item -gvms
9975 @opindex gvms
9976 Produce debugging information in Alpha/VMS debug format (if that is
9977 supported). This is the format used by DEBUG on Alpha/VMS systems.
9978
9979 @item -g@var{level}
9980 @itemx -ggdb@var{level}
9981 @itemx -gstabs@var{level}
9982 @itemx -gxcoff@var{level}
9983 @itemx -gvms@var{level}
9984 Request debugging information and also use @var{level} to specify how
9985 much information. The default level is 2.
9986
9987 Level 0 produces no debug information at all. Thus, @option{-g0} negates
9988 @option{-g}.
9989
9990 Level 1 produces minimal information, enough for making backtraces in
9991 parts of the program that you don't plan to debug. This includes
9992 descriptions of functions and external variables, and line number
9993 tables, but no information about local variables.
9994
9995 Level 3 includes extra information, such as all the macro definitions
9996 present in the program. Some debuggers support macro expansion when
9997 you use @option{-g3}.
9998
9999 If you use multiple @option{-g} options, with or without level numbers,
10000 the last such option is the one that is effective.
10001
10002 @option{-gdwarf} does not accept a concatenated debug level, to avoid
10003 confusion with @option{-gdwarf-@var{level}}.
10004 Instead use an additional @option{-g@var{level}} option to change the
10005 debug level for DWARF.
10006
10007 @item -fno-eliminate-unused-debug-symbols
10008 @opindex feliminate-unused-debug-symbols
10009 @opindex fno-eliminate-unused-debug-symbols
10010 By default, no debug information is produced for symbols that are not actually
10011 used. Use this option if you want debug information for all symbols.
10012
10013 @item -femit-class-debug-always
10014 @opindex femit-class-debug-always
10015 Instead of emitting debugging information for a C++ class in only one
10016 object file, emit it in all object files using the class. This option
10017 should be used only with debuggers that are unable to handle the way GCC
10018 normally emits debugging information for classes because using this
10019 option increases the size of debugging information by as much as a
10020 factor of two.
10021
10022 @item -fno-merge-debug-strings
10023 @opindex fmerge-debug-strings
10024 @opindex fno-merge-debug-strings
10025 Direct the linker to not merge together strings in the debugging
10026 information that are identical in different object files. Merging is
10027 not supported by all assemblers or linkers. Merging decreases the size
10028 of the debug information in the output file at the cost of increasing
10029 link processing time. Merging is enabled by default.
10030
10031 @item -fdebug-prefix-map=@var{old}=@var{new}
10032 @opindex fdebug-prefix-map
10033 When compiling files residing in directory @file{@var{old}}, record
10034 debugging information describing them as if the files resided in
10035 directory @file{@var{new}} instead. This can be used to replace a
10036 build-time path with an install-time path in the debug info. It can
10037 also be used to change an absolute path to a relative path by using
10038 @file{.} for @var{new}. This can give more reproducible builds, which
10039 are location independent, but may require an extra command to tell GDB
10040 where to find the source files. See also @option{-ffile-prefix-map}.
10041
10042 @item -fvar-tracking
10043 @opindex fvar-tracking
10044 Run variable tracking pass. It computes where variables are stored at each
10045 position in code. Better debugging information is then generated
10046 (if the debugging information format supports this information).
10047
10048 It is enabled by default when compiling with optimization (@option{-Os},
10049 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
10050 the debug info format supports it.
10051
10052 @item -fvar-tracking-assignments
10053 @opindex fvar-tracking-assignments
10054 @opindex fno-var-tracking-assignments
10055 Annotate assignments to user variables early in the compilation and
10056 attempt to carry the annotations over throughout the compilation all the
10057 way to the end, in an attempt to improve debug information while
10058 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
10059
10060 It can be enabled even if var-tracking is disabled, in which case
10061 annotations are created and maintained, but discarded at the end.
10062 By default, this flag is enabled together with @option{-fvar-tracking},
10063 except when selective scheduling is enabled.
10064
10065 @item -gsplit-dwarf
10066 @opindex gsplit-dwarf
10067 If DWARF debugging information is enabled, separate as much debugging
10068 information as possible into a separate output file with the extension
10069 @file{.dwo}. This option allows the build system to avoid linking files with
10070 debug information. To be useful, this option requires a debugger capable of
10071 reading @file{.dwo} files.
10072
10073 @item -gdwarf32
10074 @itemx -gdwarf64
10075 @opindex gdwarf32
10076 @opindex gdwarf64
10077 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
10078 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
10079 DWARF format. The default is target specific, on most targets it is
10080 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
10081 can't support more than 2GiB of debug information in any of the DWARF
10082 debug information sections. The 64-bit DWARF format allows larger debug
10083 information and might not be well supported by all consumers yet.
10084
10085 @item -gdescribe-dies
10086 @opindex gdescribe-dies
10087 Add description attributes to some DWARF DIEs that have no name attribute,
10088 such as artificial variables, external references and call site
10089 parameter DIEs.
10090
10091 @item -gpubnames
10092 @opindex gpubnames
10093 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
10094
10095 @item -ggnu-pubnames
10096 @opindex ggnu-pubnames
10097 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
10098 suitable for conversion into a GDB@ index. This option is only useful
10099 with a linker that can produce GDB@ index version 7.
10100
10101 @item -fdebug-types-section
10102 @opindex fdebug-types-section
10103 @opindex fno-debug-types-section
10104 When using DWARF Version 4 or higher, type DIEs can be put into
10105 their own @code{.debug_types} section instead of making them part of the
10106 @code{.debug_info} section. It is more efficient to put them in a separate
10107 comdat section since the linker can then remove duplicates.
10108 But not all DWARF consumers support @code{.debug_types} sections yet
10109 and on some objects @code{.debug_types} produces larger instead of smaller
10110 debugging information.
10111
10112 @item -grecord-gcc-switches
10113 @itemx -gno-record-gcc-switches
10114 @opindex grecord-gcc-switches
10115 @opindex gno-record-gcc-switches
10116 This switch causes the command-line options used to invoke the
10117 compiler that may affect code generation to be appended to the
10118 DW_AT_producer attribute in DWARF debugging information. The options
10119 are concatenated with spaces separating them from each other and from
10120 the compiler version.
10121 It is enabled by default.
10122 See also @option{-frecord-gcc-switches} for another
10123 way of storing compiler options into the object file.
10124
10125 @item -gstrict-dwarf
10126 @opindex gstrict-dwarf
10127 Disallow using extensions of later DWARF standard version than selected
10128 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
10129 DWARF extensions from later standard versions is allowed.
10130
10131 @item -gno-strict-dwarf
10132 @opindex gno-strict-dwarf
10133 Allow using extensions of later DWARF standard version than selected with
10134 @option{-gdwarf-@var{version}}.
10135
10136 @item -gas-loc-support
10137 @opindex gas-loc-support
10138 Inform the compiler that the assembler supports @code{.loc} directives.
10139 It may then use them for the assembler to generate DWARF2+ line number
10140 tables.
10141
10142 This is generally desirable, because assembler-generated line-number
10143 tables are a lot more compact than those the compiler can generate
10144 itself.
10145
10146 This option will be enabled by default if, at GCC configure time, the
10147 assembler was found to support such directives.
10148
10149 @item -gno-as-loc-support
10150 @opindex gno-as-loc-support
10151 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
10152 line number tables are to be generated.
10153
10154 @item -gas-locview-support
10155 @opindex gas-locview-support
10156 Inform the compiler that the assembler supports @code{view} assignment
10157 and reset assertion checking in @code{.loc} directives.
10158
10159 This option will be enabled by default if, at GCC configure time, the
10160 assembler was found to support them.
10161
10162 @item -gno-as-locview-support
10163 Force GCC to assign view numbers internally, if
10164 @option{-gvariable-location-views} are explicitly requested.
10165
10166 @item -gcolumn-info
10167 @itemx -gno-column-info
10168 @opindex gcolumn-info
10169 @opindex gno-column-info
10170 Emit location column information into DWARF debugging information, rather
10171 than just file and line.
10172 This option is enabled by default.
10173
10174 @item -gstatement-frontiers
10175 @itemx -gno-statement-frontiers
10176 @opindex gstatement-frontiers
10177 @opindex gno-statement-frontiers
10178 This option causes GCC to create markers in the internal representation
10179 at the beginning of statements, and to keep them roughly in place
10180 throughout compilation, using them to guide the output of @code{is_stmt}
10181 markers in the line number table. This is enabled by default when
10182 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
10183 @dots{}), and outputting DWARF 2 debug information at the normal level.
10184
10185 @item -gvariable-location-views
10186 @itemx -gvariable-location-views=incompat5
10187 @itemx -gno-variable-location-views
10188 @opindex gvariable-location-views
10189 @opindex gvariable-location-views=incompat5
10190 @opindex gno-variable-location-views
10191 Augment variable location lists with progressive view numbers implied
10192 from the line number table. This enables debug information consumers to
10193 inspect state at certain points of the program, even if no instructions
10194 associated with the corresponding source locations are present at that
10195 point. If the assembler lacks support for view numbers in line number
10196 tables, this will cause the compiler to emit the line number table,
10197 which generally makes them somewhat less compact. The augmented line
10198 number tables and location lists are fully backward-compatible, so they
10199 can be consumed by debug information consumers that are not aware of
10200 these augmentations, but they won't derive any benefit from them either.
10201
10202 This is enabled by default when outputting DWARF 2 debug information at
10203 the normal level, as long as there is assembler support,
10204 @option{-fvar-tracking-assignments} is enabled and
10205 @option{-gstrict-dwarf} is not. When assembler support is not
10206 available, this may still be enabled, but it will force GCC to output
10207 internal line number tables, and if
10208 @option{-ginternal-reset-location-views} is not enabled, that will most
10209 certainly lead to silently mismatching location views.
10210
10211 There is a proposed representation for view numbers that is not backward
10212 compatible with the location list format introduced in DWARF 5, that can
10213 be enabled with @option{-gvariable-location-views=incompat5}. This
10214 option may be removed in the future, is only provided as a reference
10215 implementation of the proposed representation. Debug information
10216 consumers are not expected to support this extended format, and they
10217 would be rendered unable to decode location lists using it.
10218
10219 @item -ginternal-reset-location-views
10220 @itemx -gno-internal-reset-location-views
10221 @opindex ginternal-reset-location-views
10222 @opindex gno-internal-reset-location-views
10223 Attempt to determine location views that can be omitted from location
10224 view lists. This requires the compiler to have very accurate insn
10225 length estimates, which isn't always the case, and it may cause
10226 incorrect view lists to be generated silently when using an assembler
10227 that does not support location view lists. The GNU assembler will flag
10228 any such error as a @code{view number mismatch}. This is only enabled
10229 on ports that define a reliable estimation function.
10230
10231 @item -ginline-points
10232 @itemx -gno-inline-points
10233 @opindex ginline-points
10234 @opindex gno-inline-points
10235 Generate extended debug information for inlined functions. Location
10236 view tracking markers are inserted at inlined entry points, so that
10237 address and view numbers can be computed and output in debug
10238 information. This can be enabled independently of location views, in
10239 which case the view numbers won't be output, but it can only be enabled
10240 along with statement frontiers, and it is only enabled by default if
10241 location views are enabled.
10242
10243 @item -gz@r{[}=@var{type}@r{]}
10244 @opindex gz
10245 Produce compressed debug sections in DWARF format, if that is supported.
10246 If @var{type} is not given, the default type depends on the capabilities
10247 of the assembler and linker used. @var{type} may be one of
10248 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
10249 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
10250 compression in traditional GNU format). If the linker doesn't support
10251 writing compressed debug sections, the option is rejected. Otherwise,
10252 if the assembler does not support them, @option{-gz} is silently ignored
10253 when producing object files.
10254
10255 @item -femit-struct-debug-baseonly
10256 @opindex femit-struct-debug-baseonly
10257 Emit debug information for struct-like types
10258 only when the base name of the compilation source file
10259 matches the base name of file in which the struct is defined.
10260
10261 This option substantially reduces the size of debugging information,
10262 but at significant potential loss in type information to the debugger.
10263 See @option{-femit-struct-debug-reduced} for a less aggressive option.
10264 See @option{-femit-struct-debug-detailed} for more detailed control.
10265
10266 This option works only with DWARF debug output.
10267
10268 @item -femit-struct-debug-reduced
10269 @opindex femit-struct-debug-reduced
10270 Emit debug information for struct-like types
10271 only when the base name of the compilation source file
10272 matches the base name of file in which the type is defined,
10273 unless the struct is a template or defined in a system header.
10274
10275 This option significantly reduces the size of debugging information,
10276 with some potential loss in type information to the debugger.
10277 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
10278 See @option{-femit-struct-debug-detailed} for more detailed control.
10279
10280 This option works only with DWARF debug output.
10281
10282 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
10283 @opindex femit-struct-debug-detailed
10284 Specify the struct-like types
10285 for which the compiler generates debug information.
10286 The intent is to reduce duplicate struct debug information
10287 between different object files within the same program.
10288
10289 This option is a detailed version of
10290 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
10291 which serves for most needs.
10292
10293 A specification has the syntax@*
10294 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
10295
10296 The optional first word limits the specification to
10297 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
10298 A struct type is used directly when it is the type of a variable, member.
10299 Indirect uses arise through pointers to structs.
10300 That is, when use of an incomplete struct is valid, the use is indirect.
10301 An example is
10302 @samp{struct one direct; struct two * indirect;}.
10303
10304 The optional second word limits the specification to
10305 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
10306 Generic structs are a bit complicated to explain.
10307 For C++, these are non-explicit specializations of template classes,
10308 or non-template classes within the above.
10309 Other programming languages have generics,
10310 but @option{-femit-struct-debug-detailed} does not yet implement them.
10311
10312 The third word specifies the source files for those
10313 structs for which the compiler should emit debug information.
10314 The values @samp{none} and @samp{any} have the normal meaning.
10315 The value @samp{base} means that
10316 the base of name of the file in which the type declaration appears
10317 must match the base of the name of the main compilation file.
10318 In practice, this means that when compiling @file{foo.c}, debug information
10319 is generated for types declared in that file and @file{foo.h},
10320 but not other header files.
10321 The value @samp{sys} means those types satisfying @samp{base}
10322 or declared in system or compiler headers.
10323
10324 You may need to experiment to determine the best settings for your application.
10325
10326 The default is @option{-femit-struct-debug-detailed=all}.
10327
10328 This option works only with DWARF debug output.
10329
10330 @item -fno-dwarf2-cfi-asm
10331 @opindex fdwarf2-cfi-asm
10332 @opindex fno-dwarf2-cfi-asm
10333 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
10334 instead of using GAS @code{.cfi_*} directives.
10335
10336 @item -fno-eliminate-unused-debug-types
10337 @opindex feliminate-unused-debug-types
10338 @opindex fno-eliminate-unused-debug-types
10339 Normally, when producing DWARF output, GCC avoids producing debug symbol
10340 output for types that are nowhere used in the source file being compiled.
10341 Sometimes it is useful to have GCC emit debugging
10342 information for all types declared in a compilation
10343 unit, regardless of whether or not they are actually used
10344 in that compilation unit, for example
10345 if, in the debugger, you want to cast a value to a type that is
10346 not actually used in your program (but is declared). More often,
10347 however, this results in a significant amount of wasted space.
10348 @end table
10349
10350 @node Optimize Options
10351 @section Options That Control Optimization
10352 @cindex optimize options
10353 @cindex options, optimization
10354
10355 These options control various sorts of optimizations.
10356
10357 Without any optimization option, the compiler's goal is to reduce the
10358 cost of compilation and to make debugging produce the expected
10359 results. Statements are independent: if you stop the program with a
10360 breakpoint between statements, you can then assign a new value to any
10361 variable or change the program counter to any other statement in the
10362 function and get exactly the results you expect from the source
10363 code.
10364
10365 Turning on optimization flags makes the compiler attempt to improve
10366 the performance and/or code size at the expense of compilation time
10367 and possibly the ability to debug the program.
10368
10369 The compiler performs optimization based on the knowledge it has of the
10370 program. Compiling multiple files at once to a single output file mode allows
10371 the compiler to use information gained from all of the files when compiling
10372 each of them.
10373
10374 Not all optimizations are controlled directly by a flag. Only
10375 optimizations that have a flag are listed in this section.
10376
10377 Most optimizations are completely disabled at @option{-O0} or if an
10378 @option{-O} level is not set on the command line, even if individual
10379 optimization flags are specified. Similarly, @option{-Og} suppresses
10380 many optimization passes.
10381
10382 Depending on the target and how GCC was configured, a slightly different
10383 set of optimizations may be enabled at each @option{-O} level than
10384 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
10385 to find out the exact set of optimizations that are enabled at each level.
10386 @xref{Overall Options}, for examples.
10387
10388 @table @gcctabopt
10389 @item -O
10390 @itemx -O1
10391 @opindex O
10392 @opindex O1
10393 Optimize. Optimizing compilation takes somewhat more time, and a lot
10394 more memory for a large function.
10395
10396 With @option{-O}, the compiler tries to reduce code size and execution
10397 time, without performing any optimizations that take a great deal of
10398 compilation time.
10399
10400 @c Note that in addition to the default_options_table list in opts.c,
10401 @c several optimization flags default to true but control optimization
10402 @c passes that are explicitly disabled at -O0.
10403
10404 @option{-O} turns on the following optimization flags:
10405
10406 @c Please keep the following list alphabetized.
10407 @gccoptlist{-fauto-inc-dec @gol
10408 -fbranch-count-reg @gol
10409 -fcombine-stack-adjustments @gol
10410 -fcompare-elim @gol
10411 -fcprop-registers @gol
10412 -fdce @gol
10413 -fdefer-pop @gol
10414 -fdelayed-branch @gol
10415 -fdse @gol
10416 -fforward-propagate @gol
10417 -fguess-branch-probability @gol
10418 -fif-conversion @gol
10419 -fif-conversion2 @gol
10420 -finline-functions-called-once @gol
10421 -fipa-modref @gol
10422 -fipa-profile @gol
10423 -fipa-pure-const @gol
10424 -fipa-reference @gol
10425 -fipa-reference-addressable @gol
10426 -fmerge-constants @gol
10427 -fmove-loop-invariants @gol
10428 -fmove-loop-stores@gol
10429 -fomit-frame-pointer @gol
10430 -freorder-blocks @gol
10431 -fshrink-wrap @gol
10432 -fshrink-wrap-separate @gol
10433 -fsplit-wide-types @gol
10434 -fssa-backprop @gol
10435 -fssa-phiopt @gol
10436 -ftree-bit-ccp @gol
10437 -ftree-ccp @gol
10438 -ftree-ch @gol
10439 -ftree-coalesce-vars @gol
10440 -ftree-copy-prop @gol
10441 -ftree-dce @gol
10442 -ftree-dominator-opts @gol
10443 -ftree-dse @gol
10444 -ftree-forwprop @gol
10445 -ftree-fre @gol
10446 -ftree-phiprop @gol
10447 -ftree-pta @gol
10448 -ftree-scev-cprop @gol
10449 -ftree-sink @gol
10450 -ftree-slsr @gol
10451 -ftree-sra @gol
10452 -ftree-ter @gol
10453 -funit-at-a-time}
10454
10455 @item -O2
10456 @opindex O2
10457 Optimize even more. GCC performs nearly all supported optimizations
10458 that do not involve a space-speed tradeoff.
10459 As compared to @option{-O}, this option increases both compilation time
10460 and the performance of the generated code.
10461
10462 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
10463 also turns on the following optimization flags:
10464
10465 @c Please keep the following list alphabetized!
10466 @gccoptlist{-falign-functions -falign-jumps @gol
10467 -falign-labels -falign-loops @gol
10468 -fcaller-saves @gol
10469 -fcode-hoisting @gol
10470 -fcrossjumping @gol
10471 -fcse-follow-jumps -fcse-skip-blocks @gol
10472 -fdelete-null-pointer-checks @gol
10473 -fdevirtualize -fdevirtualize-speculatively @gol
10474 -fexpensive-optimizations @gol
10475 -ffinite-loops @gol
10476 -fgcse -fgcse-lm @gol
10477 -fhoist-adjacent-loads @gol
10478 -finline-functions @gol
10479 -finline-small-functions @gol
10480 -findirect-inlining @gol
10481 -fipa-bit-cp -fipa-cp -fipa-icf @gol
10482 -fipa-ra -fipa-sra -fipa-vrp @gol
10483 -fisolate-erroneous-paths-dereference @gol
10484 -flra-remat @gol
10485 -foptimize-sibling-calls @gol
10486 -foptimize-strlen @gol
10487 -fpartial-inlining @gol
10488 -fpeephole2 @gol
10489 -freorder-blocks-algorithm=stc @gol
10490 -freorder-blocks-and-partition -freorder-functions @gol
10491 -frerun-cse-after-loop @gol
10492 -fschedule-insns -fschedule-insns2 @gol
10493 -fsched-interblock -fsched-spec @gol
10494 -fstore-merging @gol
10495 -fstrict-aliasing @gol
10496 -fthread-jumps @gol
10497 -ftree-builtin-call-dce @gol
10498 -ftree-loop-vectorize @gol
10499 -ftree-pre @gol
10500 -ftree-slp-vectorize @gol
10501 -ftree-switch-conversion -ftree-tail-merge @gol
10502 -ftree-vrp @gol
10503 -fvect-cost-model=very-cheap}
10504
10505 Please note the warning under @option{-fgcse} about
10506 invoking @option{-O2} on programs that use computed gotos.
10507
10508 @item -O3
10509 @opindex O3
10510 Optimize yet more. @option{-O3} turns on all optimizations specified
10511 by @option{-O2} and also turns on the following optimization flags:
10512
10513 @c Please keep the following list alphabetized!
10514 @gccoptlist{-fgcse-after-reload @gol
10515 -fipa-cp-clone
10516 -floop-interchange @gol
10517 -floop-unroll-and-jam @gol
10518 -fpeel-loops @gol
10519 -fpredictive-commoning @gol
10520 -fsplit-loops @gol
10521 -fsplit-paths @gol
10522 -ftree-loop-distribution @gol
10523 -ftree-partial-pre @gol
10524 -funswitch-loops @gol
10525 -fvect-cost-model=dynamic @gol
10526 -fversion-loops-for-strides}
10527
10528 @item -O0
10529 @opindex O0
10530 Reduce compilation time and make debugging produce the expected
10531 results. This is the default.
10532
10533 @item -Os
10534 @opindex Os
10535 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
10536 except those that often increase code size:
10537
10538 @gccoptlist{-falign-functions -falign-jumps @gol
10539 -falign-labels -falign-loops @gol
10540 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
10541
10542 It also enables @option{-finline-functions}, causes the compiler to tune for
10543 code size rather than execution speed, and performs further optimizations
10544 designed to reduce code size.
10545
10546 @item -Ofast
10547 @opindex Ofast
10548 Disregard strict standards compliance. @option{-Ofast} enables all
10549 @option{-O3} optimizations. It also enables optimizations that are not
10550 valid for all standard-compliant programs.
10551 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
10552 and the Fortran-specific @option{-fstack-arrays}, unless
10553 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
10554
10555 @item -Og
10556 @opindex Og
10557 Optimize debugging experience. @option{-Og} should be the optimization
10558 level of choice for the standard edit-compile-debug cycle, offering
10559 a reasonable level of optimization while maintaining fast compilation
10560 and a good debugging experience. It is a better choice than @option{-O0}
10561 for producing debuggable code because some compiler passes
10562 that collect debug information are disabled at @option{-O0}.
10563
10564 Like @option{-O0}, @option{-Og} completely disables a number of
10565 optimization passes so that individual options controlling them have
10566 no effect. Otherwise @option{-Og} enables all @option{-O1}
10567 optimization flags except for those that may interfere with debugging:
10568
10569 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
10570 -fdse -fif-conversion -fif-conversion2 @gol
10571 -finline-functions-called-once @gol
10572 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol
10573 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
10574
10575 @end table
10576
10577 If you use multiple @option{-O} options, with or without level numbers,
10578 the last such option is the one that is effective.
10579
10580 Options of the form @option{-f@var{flag}} specify machine-independent
10581 flags. Most flags have both positive and negative forms; the negative
10582 form of @option{-ffoo} is @option{-fno-foo}. In the table
10583 below, only one of the forms is listed---the one you typically
10584 use. You can figure out the other form by either removing @samp{no-}
10585 or adding it.
10586
10587 The following options control specific optimizations. They are either
10588 activated by @option{-O} options or are related to ones that are. You
10589 can use the following flags in the rare cases when ``fine-tuning'' of
10590 optimizations to be performed is desired.
10591
10592 @table @gcctabopt
10593 @item -fno-defer-pop
10594 @opindex fno-defer-pop
10595 @opindex fdefer-pop
10596 For machines that must pop arguments after a function call, always pop
10597 the arguments as soon as each function returns.
10598 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
10599 this allows the compiler to let arguments accumulate on the stack for several
10600 function calls and pop them all at once.
10601
10602 @item -fforward-propagate
10603 @opindex fforward-propagate
10604 Perform a forward propagation pass on RTL@. The pass tries to combine two
10605 instructions and checks if the result can be simplified. If loop unrolling
10606 is active, two passes are performed and the second is scheduled after
10607 loop unrolling.
10608
10609 This option is enabled by default at optimization levels @option{-O1},
10610 @option{-O2}, @option{-O3}, @option{-Os}.
10611
10612 @item -ffp-contract=@var{style}
10613 @opindex ffp-contract
10614 @option{-ffp-contract=off} disables floating-point expression contraction.
10615 @option{-ffp-contract=fast} enables floating-point expression contraction
10616 such as forming of fused multiply-add operations if the target has
10617 native support for them.
10618 @option{-ffp-contract=on} enables floating-point expression contraction
10619 if allowed by the language standard. This is currently not implemented
10620 and treated equal to @option{-ffp-contract=off}.
10621
10622 The default is @option{-ffp-contract=fast}.
10623
10624 @item -fomit-frame-pointer
10625 @opindex fomit-frame-pointer
10626 Omit the frame pointer in functions that don't need one. This avoids the
10627 instructions to save, set up and restore the frame pointer; on many targets
10628 it also makes an extra register available.
10629
10630 On some targets this flag has no effect because the standard calling sequence
10631 always uses a frame pointer, so it cannot be omitted.
10632
10633 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
10634 is used in all functions. Several targets always omit the frame pointer in
10635 leaf functions.
10636
10637 Enabled by default at @option{-O1} and higher.
10638
10639 @item -foptimize-sibling-calls
10640 @opindex foptimize-sibling-calls
10641 Optimize sibling and tail recursive calls.
10642
10643 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10644
10645 @item -foptimize-strlen
10646 @opindex foptimize-strlen
10647 Optimize various standard C string functions (e.g.@: @code{strlen},
10648 @code{strchr} or @code{strcpy}) and
10649 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
10650
10651 Enabled at levels @option{-O2}, @option{-O3}.
10652
10653 @item -fno-inline
10654 @opindex fno-inline
10655 @opindex finline
10656 Do not expand any functions inline apart from those marked with
10657 the @code{always_inline} attribute. This is the default when not
10658 optimizing.
10659
10660 Single functions can be exempted from inlining by marking them
10661 with the @code{noinline} attribute.
10662
10663 @item -finline-small-functions
10664 @opindex finline-small-functions
10665 Integrate functions into their callers when their body is smaller than expected
10666 function call code (so overall size of program gets smaller). The compiler
10667 heuristically decides which functions are simple enough to be worth integrating
10668 in this way. This inlining applies to all functions, even those not declared
10669 inline.
10670
10671 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10672
10673 @item -findirect-inlining
10674 @opindex findirect-inlining
10675 Inline also indirect calls that are discovered to be known at compile
10676 time thanks to previous inlining. This option has any effect only
10677 when inlining itself is turned on by the @option{-finline-functions}
10678 or @option{-finline-small-functions} options.
10679
10680 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10681
10682 @item -finline-functions
10683 @opindex finline-functions
10684 Consider all functions for inlining, even if they are not declared inline.
10685 The compiler heuristically decides which functions are worth integrating
10686 in this way.
10687
10688 If all calls to a given function are integrated, and the function is
10689 declared @code{static}, then the function is normally not output as
10690 assembler code in its own right.
10691
10692 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
10693 by @option{-fprofile-use} and @option{-fauto-profile}.
10694
10695 @item -finline-functions-called-once
10696 @opindex finline-functions-called-once
10697 Consider all @code{static} functions called once for inlining into their
10698 caller even if they are not marked @code{inline}. If a call to a given
10699 function is integrated, then the function is not output as assembler code
10700 in its own right.
10701
10702 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
10703 but not @option{-Og}.
10704
10705 @item -fearly-inlining
10706 @opindex fearly-inlining
10707 Inline functions marked by @code{always_inline} and functions whose body seems
10708 smaller than the function call overhead early before doing
10709 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
10710 makes profiling significantly cheaper and usually inlining faster on programs
10711 having large chains of nested wrapper functions.
10712
10713 Enabled by default.
10714
10715 @item -fipa-sra
10716 @opindex fipa-sra
10717 Perform interprocedural scalar replacement of aggregates, removal of
10718 unused parameters and replacement of parameters passed by reference
10719 by parameters passed by value.
10720
10721 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
10722
10723 @item -finline-limit=@var{n}
10724 @opindex finline-limit
10725 By default, GCC limits the size of functions that can be inlined. This flag
10726 allows coarse control of this limit. @var{n} is the size of functions that
10727 can be inlined in number of pseudo instructions.
10728
10729 Inlining is actually controlled by a number of parameters, which may be
10730 specified individually by using @option{--param @var{name}=@var{value}}.
10731 The @option{-finline-limit=@var{n}} option sets some of these parameters
10732 as follows:
10733
10734 @table @gcctabopt
10735 @item max-inline-insns-single
10736 is set to @var{n}/2.
10737 @item max-inline-insns-auto
10738 is set to @var{n}/2.
10739 @end table
10740
10741 See below for a documentation of the individual
10742 parameters controlling inlining and for the defaults of these parameters.
10743
10744 @emph{Note:} there may be no value to @option{-finline-limit} that results
10745 in default behavior.
10746
10747 @emph{Note:} pseudo instruction represents, in this particular context, an
10748 abstract measurement of function's size. In no way does it represent a count
10749 of assembly instructions and as such its exact meaning might change from one
10750 release to an another.
10751
10752 @item -fno-keep-inline-dllexport
10753 @opindex fno-keep-inline-dllexport
10754 @opindex fkeep-inline-dllexport
10755 This is a more fine-grained version of @option{-fkeep-inline-functions},
10756 which applies only to functions that are declared using the @code{dllexport}
10757 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
10758 Functions}.
10759
10760 @item -fkeep-inline-functions
10761 @opindex fkeep-inline-functions
10762 In C, emit @code{static} functions that are declared @code{inline}
10763 into the object file, even if the function has been inlined into all
10764 of its callers. This switch does not affect functions using the
10765 @code{extern inline} extension in GNU C90@. In C++, emit any and all
10766 inline functions into the object file.
10767
10768 @item -fkeep-static-functions
10769 @opindex fkeep-static-functions
10770 Emit @code{static} functions into the object file, even if the function
10771 is never used.
10772
10773 @item -fkeep-static-consts
10774 @opindex fkeep-static-consts
10775 Emit variables declared @code{static const} when optimization isn't turned
10776 on, even if the variables aren't referenced.
10777
10778 GCC enables this option by default. If you want to force the compiler to
10779 check if a variable is referenced, regardless of whether or not
10780 optimization is turned on, use the @option{-fno-keep-static-consts} option.
10781
10782 @item -fmerge-constants
10783 @opindex fmerge-constants
10784 Attempt to merge identical constants (string constants and floating-point
10785 constants) across compilation units.
10786
10787 This option is the default for optimized compilation if the assembler and
10788 linker support it. Use @option{-fno-merge-constants} to inhibit this
10789 behavior.
10790
10791 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10792
10793 @item -fmerge-all-constants
10794 @opindex fmerge-all-constants
10795 Attempt to merge identical constants and identical variables.
10796
10797 This option implies @option{-fmerge-constants}. In addition to
10798 @option{-fmerge-constants} this considers e.g.@: even constant initialized
10799 arrays or initialized constant variables with integral or floating-point
10800 types. Languages like C or C++ require each variable, including multiple
10801 instances of the same variable in recursive calls, to have distinct locations,
10802 so using this option results in non-conforming
10803 behavior.
10804
10805 @item -fmodulo-sched
10806 @opindex fmodulo-sched
10807 Perform swing modulo scheduling immediately before the first scheduling
10808 pass. This pass looks at innermost loops and reorders their
10809 instructions by overlapping different iterations.
10810
10811 @item -fmodulo-sched-allow-regmoves
10812 @opindex fmodulo-sched-allow-regmoves
10813 Perform more aggressive SMS-based modulo scheduling with register moves
10814 allowed. By setting this flag certain anti-dependences edges are
10815 deleted, which triggers the generation of reg-moves based on the
10816 life-range analysis. This option is effective only with
10817 @option{-fmodulo-sched} enabled.
10818
10819 @item -fno-branch-count-reg
10820 @opindex fno-branch-count-reg
10821 @opindex fbranch-count-reg
10822 Disable the optimization pass that scans for opportunities to use
10823 ``decrement and branch'' instructions on a count register instead of
10824 instruction sequences that decrement a register, compare it against zero, and
10825 then branch based upon the result. This option is only meaningful on
10826 architectures that support such instructions, which include x86, PowerPC,
10827 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
10828 doesn't remove the decrement and branch instructions from the generated
10829 instruction stream introduced by other optimization passes.
10830
10831 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
10832 except for @option{-Og}.
10833
10834 @item -fno-function-cse
10835 @opindex fno-function-cse
10836 @opindex ffunction-cse
10837 Do not put function addresses in registers; make each instruction that
10838 calls a constant function contain the function's address explicitly.
10839
10840 This option results in less efficient code, but some strange hacks
10841 that alter the assembler output may be confused by the optimizations
10842 performed when this option is not used.
10843
10844 The default is @option{-ffunction-cse}
10845
10846 @item -fno-zero-initialized-in-bss
10847 @opindex fno-zero-initialized-in-bss
10848 @opindex fzero-initialized-in-bss
10849 If the target supports a BSS section, GCC by default puts variables that
10850 are initialized to zero into BSS@. This can save space in the resulting
10851 code.
10852
10853 This option turns off this behavior because some programs explicitly
10854 rely on variables going to the data section---e.g., so that the
10855 resulting executable can find the beginning of that section and/or make
10856 assumptions based on that.
10857
10858 The default is @option{-fzero-initialized-in-bss}.
10859
10860 @item -fthread-jumps
10861 @opindex fthread-jumps
10862 Perform optimizations that check to see if a jump branches to a
10863 location where another comparison subsumed by the first is found. If
10864 so, the first branch is redirected to either the destination of the
10865 second branch or a point immediately following it, depending on whether
10866 the condition is known to be true or false.
10867
10868 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10869
10870 @item -fsplit-wide-types
10871 @opindex fsplit-wide-types
10872 When using a type that occupies multiple registers, such as @code{long
10873 long} on a 32-bit system, split the registers apart and allocate them
10874 independently. This normally generates better code for those types,
10875 but may make debugging more difficult.
10876
10877 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
10878 @option{-Os}.
10879
10880 @item -fsplit-wide-types-early
10881 @opindex fsplit-wide-types-early
10882 Fully split wide types early, instead of very late.
10883 This option has no effect unless @option{-fsplit-wide-types} is turned on.
10884
10885 This is the default on some targets.
10886
10887 @item -fcse-follow-jumps
10888 @opindex fcse-follow-jumps
10889 In common subexpression elimination (CSE), scan through jump instructions
10890 when the target of the jump is not reached by any other path. For
10891 example, when CSE encounters an @code{if} statement with an
10892 @code{else} clause, CSE follows the jump when the condition
10893 tested is false.
10894
10895 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10896
10897 @item -fcse-skip-blocks
10898 @opindex fcse-skip-blocks
10899 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
10900 follow jumps that conditionally skip over blocks. When CSE
10901 encounters a simple @code{if} statement with no else clause,
10902 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
10903 body of the @code{if}.
10904
10905 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10906
10907 @item -frerun-cse-after-loop
10908 @opindex frerun-cse-after-loop
10909 Re-run common subexpression elimination after loop optimizations are
10910 performed.
10911
10912 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10913
10914 @item -fgcse
10915 @opindex fgcse
10916 Perform a global common subexpression elimination pass.
10917 This pass also performs global constant and copy propagation.
10918
10919 @emph{Note:} When compiling a program using computed gotos, a GCC
10920 extension, you may get better run-time performance if you disable
10921 the global common subexpression elimination pass by adding
10922 @option{-fno-gcse} to the command line.
10923
10924 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10925
10926 @item -fgcse-lm
10927 @opindex fgcse-lm
10928 When @option{-fgcse-lm} is enabled, global common subexpression elimination
10929 attempts to move loads that are only killed by stores into themselves. This
10930 allows a loop containing a load/store sequence to be changed to a load outside
10931 the loop, and a copy/store within the loop.
10932
10933 Enabled by default when @option{-fgcse} is enabled.
10934
10935 @item -fgcse-sm
10936 @opindex fgcse-sm
10937 When @option{-fgcse-sm} is enabled, a store motion pass is run after
10938 global common subexpression elimination. This pass attempts to move
10939 stores out of loops. When used in conjunction with @option{-fgcse-lm},
10940 loops containing a load/store sequence can be changed to a load before
10941 the loop and a store after the loop.
10942
10943 Not enabled at any optimization level.
10944
10945 @item -fgcse-las
10946 @opindex fgcse-las
10947 When @option{-fgcse-las} is enabled, the global common subexpression
10948 elimination pass eliminates redundant loads that come after stores to the
10949 same memory location (both partial and full redundancies).
10950
10951 Not enabled at any optimization level.
10952
10953 @item -fgcse-after-reload
10954 @opindex fgcse-after-reload
10955 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
10956 pass is performed after reload. The purpose of this pass is to clean up
10957 redundant spilling.
10958
10959 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
10960
10961 @item -faggressive-loop-optimizations
10962 @opindex faggressive-loop-optimizations
10963 This option tells the loop optimizer to use language constraints to
10964 derive bounds for the number of iterations of a loop. This assumes that
10965 loop code does not invoke undefined behavior by for example causing signed
10966 integer overflows or out-of-bound array accesses. The bounds for the
10967 number of iterations of a loop are used to guide loop unrolling and peeling
10968 and loop exit test optimizations.
10969 This option is enabled by default.
10970
10971 @item -funconstrained-commons
10972 @opindex funconstrained-commons
10973 This option tells the compiler that variables declared in common blocks
10974 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
10975 prevents certain optimizations that depend on knowing the array bounds.
10976
10977 @item -fcrossjumping
10978 @opindex fcrossjumping
10979 Perform cross-jumping transformation.
10980 This transformation unifies equivalent code and saves code size. The
10981 resulting code may or may not perform better than without cross-jumping.
10982
10983 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10984
10985 @item -fauto-inc-dec
10986 @opindex fauto-inc-dec
10987 Combine increments or decrements of addresses with memory accesses.
10988 This pass is always skipped on architectures that do not have
10989 instructions to support this. Enabled by default at @option{-O1} and
10990 higher on architectures that support this.
10991
10992 @item -fdce
10993 @opindex fdce
10994 Perform dead code elimination (DCE) on RTL@.
10995 Enabled by default at @option{-O1} and higher.
10996
10997 @item -fdse
10998 @opindex fdse
10999 Perform dead store elimination (DSE) on RTL@.
11000 Enabled by default at @option{-O1} and higher.
11001
11002 @item -fif-conversion
11003 @opindex fif-conversion
11004 Attempt to transform conditional jumps into branch-less equivalents. This
11005 includes use of conditional moves, min, max, set flags and abs instructions, and
11006 some tricks doable by standard arithmetics. The use of conditional execution
11007 on chips where it is available is controlled by @option{-fif-conversion2}.
11008
11009 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11010 not with @option{-Og}.
11011
11012 @item -fif-conversion2
11013 @opindex fif-conversion2
11014 Use conditional execution (where available) to transform conditional jumps into
11015 branch-less equivalents.
11016
11017 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11018 not with @option{-Og}.
11019
11020 @item -fdeclone-ctor-dtor
11021 @opindex fdeclone-ctor-dtor
11022 The C++ ABI requires multiple entry points for constructors and
11023 destructors: one for a base subobject, one for a complete object, and
11024 one for a virtual destructor that calls operator delete afterwards.
11025 For a hierarchy with virtual bases, the base and complete variants are
11026 clones, which means two copies of the function. With this option, the
11027 base and complete variants are changed to be thunks that call a common
11028 implementation.
11029
11030 Enabled by @option{-Os}.
11031
11032 @item -fdelete-null-pointer-checks
11033 @opindex fdelete-null-pointer-checks
11034 Assume that programs cannot safely dereference null pointers, and that
11035 no code or data element resides at address zero.
11036 This option enables simple constant
11037 folding optimizations at all optimization levels. In addition, other
11038 optimization passes in GCC use this flag to control global dataflow
11039 analyses that eliminate useless checks for null pointers; these assume
11040 that a memory access to address zero always results in a trap, so
11041 that if a pointer is checked after it has already been dereferenced,
11042 it cannot be null.
11043
11044 Note however that in some environments this assumption is not true.
11045 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
11046 for programs that depend on that behavior.
11047
11048 This option is enabled by default on most targets. On Nios II ELF, it
11049 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
11050
11051 Passes that use the dataflow information
11052 are enabled independently at different optimization levels.
11053
11054 @item -fdevirtualize
11055 @opindex fdevirtualize
11056 Attempt to convert calls to virtual functions to direct calls. This
11057 is done both within a procedure and interprocedurally as part of
11058 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
11059 propagation (@option{-fipa-cp}).
11060 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11061
11062 @item -fdevirtualize-speculatively
11063 @opindex fdevirtualize-speculatively
11064 Attempt to convert calls to virtual functions to speculative direct calls.
11065 Based on the analysis of the type inheritance graph, determine for a given call
11066 the set of likely targets. If the set is small, preferably of size 1, change
11067 the call into a conditional deciding between direct and indirect calls. The
11068 speculative calls enable more optimizations, such as inlining. When they seem
11069 useless after further optimization, they are converted back into original form.
11070
11071 @item -fdevirtualize-at-ltrans
11072 @opindex fdevirtualize-at-ltrans
11073 Stream extra information needed for aggressive devirtualization when running
11074 the link-time optimizer in local transformation mode.
11075 This option enables more devirtualization but
11076 significantly increases the size of streamed data. For this reason it is
11077 disabled by default.
11078
11079 @item -fexpensive-optimizations
11080 @opindex fexpensive-optimizations
11081 Perform a number of minor optimizations that are relatively expensive.
11082
11083 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11084
11085 @item -free
11086 @opindex free
11087 Attempt to remove redundant extension instructions. This is especially
11088 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
11089 registers after writing to their lower 32-bit half.
11090
11091 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
11092 @option{-O3}, @option{-Os}.
11093
11094 @item -fno-lifetime-dse
11095 @opindex fno-lifetime-dse
11096 @opindex flifetime-dse
11097 In C++ the value of an object is only affected by changes within its
11098 lifetime: when the constructor begins, the object has an indeterminate
11099 value, and any changes during the lifetime of the object are dead when
11100 the object is destroyed. Normally dead store elimination will take
11101 advantage of this; if your code relies on the value of the object
11102 storage persisting beyond the lifetime of the object, you can use this
11103 flag to disable this optimization. To preserve stores before the
11104 constructor starts (e.g.@: because your operator new clears the object
11105 storage) but still treat the object as dead after the destructor, you
11106 can use @option{-flifetime-dse=1}. The default behavior can be
11107 explicitly selected with @option{-flifetime-dse=2}.
11108 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
11109
11110 @item -flive-range-shrinkage
11111 @opindex flive-range-shrinkage
11112 Attempt to decrease register pressure through register live range
11113 shrinkage. This is helpful for fast processors with small or moderate
11114 size register sets.
11115
11116 @item -fira-algorithm=@var{algorithm}
11117 @opindex fira-algorithm
11118 Use the specified coloring algorithm for the integrated register
11119 allocator. The @var{algorithm} argument can be @samp{priority}, which
11120 specifies Chow's priority coloring, or @samp{CB}, which specifies
11121 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
11122 for all architectures, but for those targets that do support it, it is
11123 the default because it generates better code.
11124
11125 @item -fira-region=@var{region}
11126 @opindex fira-region
11127 Use specified regions for the integrated register allocator. The
11128 @var{region} argument should be one of the following:
11129
11130 @table @samp
11131
11132 @item all
11133 Use all loops as register allocation regions.
11134 This can give the best results for machines with a small and/or
11135 irregular register set.
11136
11137 @item mixed
11138 Use all loops except for loops with small register pressure
11139 as the regions. This value usually gives
11140 the best results in most cases and for most architectures,
11141 and is enabled by default when compiling with optimization for speed
11142 (@option{-O}, @option{-O2}, @dots{}).
11143
11144 @item one
11145 Use all functions as a single region.
11146 This typically results in the smallest code size, and is enabled by default for
11147 @option{-Os} or @option{-O0}.
11148
11149 @end table
11150
11151 @item -fira-hoist-pressure
11152 @opindex fira-hoist-pressure
11153 Use IRA to evaluate register pressure in the code hoisting pass for
11154 decisions to hoist expressions. This option usually results in smaller
11155 code, but it can slow the compiler down.
11156
11157 This option is enabled at level @option{-Os} for all targets.
11158
11159 @item -fira-loop-pressure
11160 @opindex fira-loop-pressure
11161 Use IRA to evaluate register pressure in loops for decisions to move
11162 loop invariants. This option usually results in generation
11163 of faster and smaller code on machines with large register files (>= 32
11164 registers), but it can slow the compiler down.
11165
11166 This option is enabled at level @option{-O3} for some targets.
11167
11168 @item -fno-ira-share-save-slots
11169 @opindex fno-ira-share-save-slots
11170 @opindex fira-share-save-slots
11171 Disable sharing of stack slots used for saving call-used hard
11172 registers living through a call. Each hard register gets a
11173 separate stack slot, and as a result function stack frames are
11174 larger.
11175
11176 @item -fno-ira-share-spill-slots
11177 @opindex fno-ira-share-spill-slots
11178 @opindex fira-share-spill-slots
11179 Disable sharing of stack slots allocated for pseudo-registers. Each
11180 pseudo-register that does not get a hard register gets a separate
11181 stack slot, and as a result function stack frames are larger.
11182
11183 @item -flra-remat
11184 @opindex flra-remat
11185 Enable CFG-sensitive rematerialization in LRA. Instead of loading
11186 values of spilled pseudos, LRA tries to rematerialize (recalculate)
11187 values if it is profitable.
11188
11189 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11190
11191 @item -fdelayed-branch
11192 @opindex fdelayed-branch
11193 If supported for the target machine, attempt to reorder instructions
11194 to exploit instruction slots available after delayed branch
11195 instructions.
11196
11197 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
11198 but not at @option{-Og}.
11199
11200 @item -fschedule-insns
11201 @opindex fschedule-insns
11202 If supported for the target machine, attempt to reorder instructions to
11203 eliminate execution stalls due to required data being unavailable. This
11204 helps machines that have slow floating point or memory load instructions
11205 by allowing other instructions to be issued until the result of the load
11206 or floating-point instruction is required.
11207
11208 Enabled at levels @option{-O2}, @option{-O3}.
11209
11210 @item -fschedule-insns2
11211 @opindex fschedule-insns2
11212 Similar to @option{-fschedule-insns}, but requests an additional pass of
11213 instruction scheduling after register allocation has been done. This is
11214 especially useful on machines with a relatively small number of
11215 registers and where memory load instructions take more than one cycle.
11216
11217 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11218
11219 @item -fno-sched-interblock
11220 @opindex fno-sched-interblock
11221 @opindex fsched-interblock
11222 Disable instruction scheduling across basic blocks, which
11223 is normally enabled when scheduling before register allocation, i.e.@:
11224 with @option{-fschedule-insns} or at @option{-O2} or higher.
11225
11226 @item -fno-sched-spec
11227 @opindex fno-sched-spec
11228 @opindex fsched-spec
11229 Disable speculative motion of non-load instructions, which
11230 is normally enabled when scheduling before register allocation, i.e.@:
11231 with @option{-fschedule-insns} or at @option{-O2} or higher.
11232
11233 @item -fsched-pressure
11234 @opindex fsched-pressure
11235 Enable register pressure sensitive insn scheduling before register
11236 allocation. This only makes sense when scheduling before register
11237 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
11238 @option{-O2} or higher. Usage of this option can improve the
11239 generated code and decrease its size by preventing register pressure
11240 increase above the number of available hard registers and subsequent
11241 spills in register allocation.
11242
11243 @item -fsched-spec-load
11244 @opindex fsched-spec-load
11245 Allow speculative motion of some load instructions. This only makes
11246 sense when scheduling before register allocation, i.e.@: with
11247 @option{-fschedule-insns} or at @option{-O2} or higher.
11248
11249 @item -fsched-spec-load-dangerous
11250 @opindex fsched-spec-load-dangerous
11251 Allow speculative motion of more load instructions. This only makes
11252 sense when scheduling before register allocation, i.e.@: with
11253 @option{-fschedule-insns} or at @option{-O2} or higher.
11254
11255 @item -fsched-stalled-insns
11256 @itemx -fsched-stalled-insns=@var{n}
11257 @opindex fsched-stalled-insns
11258 Define how many insns (if any) can be moved prematurely from the queue
11259 of stalled insns into the ready list during the second scheduling pass.
11260 @option{-fno-sched-stalled-insns} means that no insns are moved
11261 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
11262 on how many queued insns can be moved prematurely.
11263 @option{-fsched-stalled-insns} without a value is equivalent to
11264 @option{-fsched-stalled-insns=1}.
11265
11266 @item -fsched-stalled-insns-dep
11267 @itemx -fsched-stalled-insns-dep=@var{n}
11268 @opindex fsched-stalled-insns-dep
11269 Define how many insn groups (cycles) are examined for a dependency
11270 on a stalled insn that is a candidate for premature removal from the queue
11271 of stalled insns. This has an effect only during the second scheduling pass,
11272 and only if @option{-fsched-stalled-insns} is used.
11273 @option{-fno-sched-stalled-insns-dep} is equivalent to
11274 @option{-fsched-stalled-insns-dep=0}.
11275 @option{-fsched-stalled-insns-dep} without a value is equivalent to
11276 @option{-fsched-stalled-insns-dep=1}.
11277
11278 @item -fsched2-use-superblocks
11279 @opindex fsched2-use-superblocks
11280 When scheduling after register allocation, use superblock scheduling.
11281 This allows motion across basic block boundaries,
11282 resulting in faster schedules. This option is experimental, as not all machine
11283 descriptions used by GCC model the CPU closely enough to avoid unreliable
11284 results from the algorithm.
11285
11286 This only makes sense when scheduling after register allocation, i.e.@: with
11287 @option{-fschedule-insns2} or at @option{-O2} or higher.
11288
11289 @item -fsched-group-heuristic
11290 @opindex fsched-group-heuristic
11291 Enable the group heuristic in the scheduler. This heuristic favors
11292 the instruction that belongs to a schedule group. This is enabled
11293 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11294 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11295
11296 @item -fsched-critical-path-heuristic
11297 @opindex fsched-critical-path-heuristic
11298 Enable the critical-path heuristic in the scheduler. This heuristic favors
11299 instructions on the critical path. This is enabled by default when
11300 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11301 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11302
11303 @item -fsched-spec-insn-heuristic
11304 @opindex fsched-spec-insn-heuristic
11305 Enable the speculative instruction heuristic in the scheduler. This
11306 heuristic favors speculative instructions with greater dependency weakness.
11307 This is enabled by default when scheduling is enabled, i.e.@:
11308 with @option{-fschedule-insns} or @option{-fschedule-insns2}
11309 or at @option{-O2} or higher.
11310
11311 @item -fsched-rank-heuristic
11312 @opindex fsched-rank-heuristic
11313 Enable the rank heuristic in the scheduler. This heuristic favors
11314 the instruction belonging to a basic block with greater size or frequency.
11315 This is enabled by default when scheduling is enabled, i.e.@:
11316 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11317 at @option{-O2} or higher.
11318
11319 @item -fsched-last-insn-heuristic
11320 @opindex fsched-last-insn-heuristic
11321 Enable the last-instruction heuristic in the scheduler. This heuristic
11322 favors the instruction that is less dependent on the last instruction
11323 scheduled. This is enabled by default when scheduling is enabled,
11324 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11325 at @option{-O2} or higher.
11326
11327 @item -fsched-dep-count-heuristic
11328 @opindex fsched-dep-count-heuristic
11329 Enable the dependent-count heuristic in the scheduler. This heuristic
11330 favors the instruction that has more instructions depending on it.
11331 This is enabled by default when scheduling is enabled, i.e.@:
11332 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11333 at @option{-O2} or higher.
11334
11335 @item -freschedule-modulo-scheduled-loops
11336 @opindex freschedule-modulo-scheduled-loops
11337 Modulo scheduling is performed before traditional scheduling. If a loop
11338 is modulo scheduled, later scheduling passes may change its schedule.
11339 Use this option to control that behavior.
11340
11341 @item -fselective-scheduling
11342 @opindex fselective-scheduling
11343 Schedule instructions using selective scheduling algorithm. Selective
11344 scheduling runs instead of the first scheduler pass.
11345
11346 @item -fselective-scheduling2
11347 @opindex fselective-scheduling2
11348 Schedule instructions using selective scheduling algorithm. Selective
11349 scheduling runs instead of the second scheduler pass.
11350
11351 @item -fsel-sched-pipelining
11352 @opindex fsel-sched-pipelining
11353 Enable software pipelining of innermost loops during selective scheduling.
11354 This option has no effect unless one of @option{-fselective-scheduling} or
11355 @option{-fselective-scheduling2} is turned on.
11356
11357 @item -fsel-sched-pipelining-outer-loops
11358 @opindex fsel-sched-pipelining-outer-loops
11359 When pipelining loops during selective scheduling, also pipeline outer loops.
11360 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
11361
11362 @item -fsemantic-interposition
11363 @opindex fsemantic-interposition
11364 Some object formats, like ELF, allow interposing of symbols by the
11365 dynamic linker.
11366 This means that for symbols exported from the DSO, the compiler cannot perform
11367 interprocedural propagation, inlining and other optimizations in anticipation
11368 that the function or variable in question may change. While this feature is
11369 useful, for example, to rewrite memory allocation functions by a debugging
11370 implementation, it is expensive in the terms of code quality.
11371 With @option{-fno-semantic-interposition} the compiler assumes that
11372 if interposition happens for functions the overwriting function will have
11373 precisely the same semantics (and side effects).
11374 Similarly if interposition happens
11375 for variables, the constructor of the variable will be the same. The flag
11376 has no effect for functions explicitly declared inline
11377 (where it is never allowed for interposition to change semantics)
11378 and for symbols explicitly declared weak.
11379
11380 @item -fshrink-wrap
11381 @opindex fshrink-wrap
11382 Emit function prologues only before parts of the function that need it,
11383 rather than at the top of the function. This flag is enabled by default at
11384 @option{-O} and higher.
11385
11386 @item -fshrink-wrap-separate
11387 @opindex fshrink-wrap-separate
11388 Shrink-wrap separate parts of the prologue and epilogue separately, so that
11389 those parts are only executed when needed.
11390 This option is on by default, but has no effect unless @option{-fshrink-wrap}
11391 is also turned on and the target supports this.
11392
11393 @item -fcaller-saves
11394 @opindex fcaller-saves
11395 Enable allocation of values to registers that are clobbered by
11396 function calls, by emitting extra instructions to save and restore the
11397 registers around such calls. Such allocation is done only when it
11398 seems to result in better code.
11399
11400 This option is always enabled by default on certain machines, usually
11401 those which have no call-preserved registers to use instead.
11402
11403 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11404
11405 @item -fcombine-stack-adjustments
11406 @opindex fcombine-stack-adjustments
11407 Tracks stack adjustments (pushes and pops) and stack memory references
11408 and then tries to find ways to combine them.
11409
11410 Enabled by default at @option{-O1} and higher.
11411
11412 @item -fipa-ra
11413 @opindex fipa-ra
11414 Use caller save registers for allocation if those registers are not used by
11415 any called function. In that case it is not necessary to save and restore
11416 them around calls. This is only possible if called functions are part of
11417 same compilation unit as current function and they are compiled before it.
11418
11419 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
11420 is disabled if generated code will be instrumented for profiling
11421 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
11422 exactly (this happens on targets that do not expose prologues
11423 and epilogues in RTL).
11424
11425 @item -fconserve-stack
11426 @opindex fconserve-stack
11427 Attempt to minimize stack usage. The compiler attempts to use less
11428 stack space, even if that makes the program slower. This option
11429 implies setting the @option{large-stack-frame} parameter to 100
11430 and the @option{large-stack-frame-growth} parameter to 400.
11431
11432 @item -ftree-reassoc
11433 @opindex ftree-reassoc
11434 Perform reassociation on trees. This flag is enabled by default
11435 at @option{-O1} and higher.
11436
11437 @item -fcode-hoisting
11438 @opindex fcode-hoisting
11439 Perform code hoisting. Code hoisting tries to move the
11440 evaluation of expressions executed on all paths to the function exit
11441 as early as possible. This is especially useful as a code size
11442 optimization, but it often helps for code speed as well.
11443 This flag is enabled by default at @option{-O2} and higher.
11444
11445 @item -ftree-pre
11446 @opindex ftree-pre
11447 Perform partial redundancy elimination (PRE) on trees. This flag is
11448 enabled by default at @option{-O2} and @option{-O3}.
11449
11450 @item -ftree-partial-pre
11451 @opindex ftree-partial-pre
11452 Make partial redundancy elimination (PRE) more aggressive. This flag is
11453 enabled by default at @option{-O3}.
11454
11455 @item -ftree-forwprop
11456 @opindex ftree-forwprop
11457 Perform forward propagation on trees. This flag is enabled by default
11458 at @option{-O1} and higher.
11459
11460 @item -ftree-fre
11461 @opindex ftree-fre
11462 Perform full redundancy elimination (FRE) on trees. The difference
11463 between FRE and PRE is that FRE only considers expressions
11464 that are computed on all paths leading to the redundant computation.
11465 This analysis is faster than PRE, though it exposes fewer redundancies.
11466 This flag is enabled by default at @option{-O1} and higher.
11467
11468 @item -ftree-phiprop
11469 @opindex ftree-phiprop
11470 Perform hoisting of loads from conditional pointers on trees. This
11471 pass is enabled by default at @option{-O1} and higher.
11472
11473 @item -fhoist-adjacent-loads
11474 @opindex fhoist-adjacent-loads
11475 Speculatively hoist loads from both branches of an if-then-else if the
11476 loads are from adjacent locations in the same structure and the target
11477 architecture has a conditional move instruction. This flag is enabled
11478 by default at @option{-O2} and higher.
11479
11480 @item -ftree-copy-prop
11481 @opindex ftree-copy-prop
11482 Perform copy propagation on trees. This pass eliminates unnecessary
11483 copy operations. This flag is enabled by default at @option{-O1} and
11484 higher.
11485
11486 @item -fipa-pure-const
11487 @opindex fipa-pure-const
11488 Discover which functions are pure or constant.
11489 Enabled by default at @option{-O1} and higher.
11490
11491 @item -fipa-reference
11492 @opindex fipa-reference
11493 Discover which static variables do not escape the
11494 compilation unit.
11495 Enabled by default at @option{-O1} and higher.
11496
11497 @item -fipa-reference-addressable
11498 @opindex fipa-reference-addressable
11499 Discover read-only, write-only and non-addressable static variables.
11500 Enabled by default at @option{-O1} and higher.
11501
11502 @item -fipa-stack-alignment
11503 @opindex fipa-stack-alignment
11504 Reduce stack alignment on call sites if possible.
11505 Enabled by default.
11506
11507 @item -fipa-pta
11508 @opindex fipa-pta
11509 Perform interprocedural pointer analysis and interprocedural modification
11510 and reference analysis. This option can cause excessive memory and
11511 compile-time usage on large compilation units. It is not enabled by
11512 default at any optimization level.
11513
11514 @item -fipa-profile
11515 @opindex fipa-profile
11516 Perform interprocedural profile propagation. The functions called only from
11517 cold functions are marked as cold. Also functions executed once (such as
11518 @code{cold}, @code{noreturn}, static constructors or destructors) are
11519 identified. Cold functions and loop less parts of functions executed once are
11520 then optimized for size.
11521 Enabled by default at @option{-O1} and higher.
11522
11523 @item -fipa-modref
11524 @opindex fipa-modref
11525 Perform interprocedural mod/ref analysis. This optimization analyzes the side
11526 effects of functions (memory locations that are modified or referenced) and
11527 enables better optimization across the function call boundary. This flag is
11528 enabled by default at @option{-O1} and higher.
11529
11530 @item -fipa-cp
11531 @opindex fipa-cp
11532 Perform interprocedural constant propagation.
11533 This optimization analyzes the program to determine when values passed
11534 to functions are constants and then optimizes accordingly.
11535 This optimization can substantially increase performance
11536 if the application has constants passed to functions.
11537 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
11538 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11539
11540 @item -fipa-cp-clone
11541 @opindex fipa-cp-clone
11542 Perform function cloning to make interprocedural constant propagation stronger.
11543 When enabled, interprocedural constant propagation performs function cloning
11544 when externally visible function can be called with constant arguments.
11545 Because this optimization can create multiple copies of functions,
11546 it may significantly increase code size
11547 (see @option{--param ipa-cp-unit-growth=@var{value}}).
11548 This flag is enabled by default at @option{-O3}.
11549 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11550
11551 @item -fipa-bit-cp
11552 @opindex fipa-bit-cp
11553 When enabled, perform interprocedural bitwise constant
11554 propagation. This flag is enabled by default at @option{-O2} and
11555 by @option{-fprofile-use} and @option{-fauto-profile}.
11556 It requires that @option{-fipa-cp} is enabled.
11557
11558 @item -fipa-vrp
11559 @opindex fipa-vrp
11560 When enabled, perform interprocedural propagation of value
11561 ranges. This flag is enabled by default at @option{-O2}. It requires
11562 that @option{-fipa-cp} is enabled.
11563
11564 @item -fipa-icf
11565 @opindex fipa-icf
11566 Perform Identical Code Folding for functions and read-only variables.
11567 The optimization reduces code size and may disturb unwind stacks by replacing
11568 a function by equivalent one with a different name. The optimization works
11569 more effectively with link-time optimization enabled.
11570
11571 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
11572 works on different levels and thus the optimizations are not same - there are
11573 equivalences that are found only by GCC and equivalences found only by Gold.
11574
11575 This flag is enabled by default at @option{-O2} and @option{-Os}.
11576
11577 @item -flive-patching=@var{level}
11578 @opindex flive-patching
11579 Control GCC's optimizations to produce output suitable for live-patching.
11580
11581 If the compiler's optimization uses a function's body or information extracted
11582 from its body to optimize/change another function, the latter is called an
11583 impacted function of the former. If a function is patched, its impacted
11584 functions should be patched too.
11585
11586 The impacted functions are determined by the compiler's interprocedural
11587 optimizations. For example, a caller is impacted when inlining a function
11588 into its caller,
11589 cloning a function and changing its caller to call this new clone,
11590 or extracting a function's pureness/constness information to optimize
11591 its direct or indirect callers, etc.
11592
11593 Usually, the more IPA optimizations enabled, the larger the number of
11594 impacted functions for each function. In order to control the number of
11595 impacted functions and more easily compute the list of impacted function,
11596 IPA optimizations can be partially enabled at two different levels.
11597
11598 The @var{level} argument should be one of the following:
11599
11600 @table @samp
11601
11602 @item inline-clone
11603
11604 Only enable inlining and cloning optimizations, which includes inlining,
11605 cloning, interprocedural scalar replacement of aggregates and partial inlining.
11606 As a result, when patching a function, all its callers and its clones'
11607 callers are impacted, therefore need to be patched as well.
11608
11609 @option{-flive-patching=inline-clone} disables the following optimization flags:
11610 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
11611 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
11612 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
11613 -fipa-stack-alignment -fipa-modref}
11614
11615 @item inline-only-static
11616
11617 Only enable inlining of static functions.
11618 As a result, when patching a static function, all its callers are impacted
11619 and so need to be patched as well.
11620
11621 In addition to all the flags that @option{-flive-patching=inline-clone}
11622 disables,
11623 @option{-flive-patching=inline-only-static} disables the following additional
11624 optimization flags:
11625 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
11626
11627 @end table
11628
11629 When @option{-flive-patching} is specified without any value, the default value
11630 is @var{inline-clone}.
11631
11632 This flag is disabled by default.
11633
11634 Note that @option{-flive-patching} is not supported with link-time optimization
11635 (@option{-flto}).
11636
11637 @item -fisolate-erroneous-paths-dereference
11638 @opindex fisolate-erroneous-paths-dereference
11639 Detect paths that trigger erroneous or undefined behavior due to
11640 dereferencing a null pointer. Isolate those paths from the main control
11641 flow and turn the statement with erroneous or undefined behavior into a trap.
11642 This flag is enabled by default at @option{-O2} and higher and depends on
11643 @option{-fdelete-null-pointer-checks} also being enabled.
11644
11645 @item -fisolate-erroneous-paths-attribute
11646 @opindex fisolate-erroneous-paths-attribute
11647 Detect paths that trigger erroneous or undefined behavior due to a null value
11648 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
11649 attribute. Isolate those paths from the main control flow and turn the
11650 statement with erroneous or undefined behavior into a trap. This is not
11651 currently enabled, but may be enabled by @option{-O2} in the future.
11652
11653 @item -ftree-sink
11654 @opindex ftree-sink
11655 Perform forward store motion on trees. This flag is
11656 enabled by default at @option{-O1} and higher.
11657
11658 @item -ftree-bit-ccp
11659 @opindex ftree-bit-ccp
11660 Perform sparse conditional bit constant propagation on trees and propagate
11661 pointer alignment information.
11662 This pass only operates on local scalar variables and is enabled by default
11663 at @option{-O1} and higher, except for @option{-Og}.
11664 It requires that @option{-ftree-ccp} is enabled.
11665
11666 @item -ftree-ccp
11667 @opindex ftree-ccp
11668 Perform sparse conditional constant propagation (CCP) on trees. This
11669 pass only operates on local scalar variables and is enabled by default
11670 at @option{-O1} and higher.
11671
11672 @item -fssa-backprop
11673 @opindex fssa-backprop
11674 Propagate information about uses of a value up the definition chain
11675 in order to simplify the definitions. For example, this pass strips
11676 sign operations if the sign of a value never matters. The flag is
11677 enabled by default at @option{-O1} and higher.
11678
11679 @item -fssa-phiopt
11680 @opindex fssa-phiopt
11681 Perform pattern matching on SSA PHI nodes to optimize conditional
11682 code. This pass is enabled by default at @option{-O1} and higher,
11683 except for @option{-Og}.
11684
11685 @item -ftree-switch-conversion
11686 @opindex ftree-switch-conversion
11687 Perform conversion of simple initializations in a switch to
11688 initializations from a scalar array. This flag is enabled by default
11689 at @option{-O2} and higher.
11690
11691 @item -ftree-tail-merge
11692 @opindex ftree-tail-merge
11693 Look for identical code sequences. When found, replace one with a jump to the
11694 other. This optimization is known as tail merging or cross jumping. This flag
11695 is enabled by default at @option{-O2} and higher. The compilation time
11696 in this pass can
11697 be limited using @option{max-tail-merge-comparisons} parameter and
11698 @option{max-tail-merge-iterations} parameter.
11699
11700 @item -ftree-dce
11701 @opindex ftree-dce
11702 Perform dead code elimination (DCE) on trees. This flag is enabled by
11703 default at @option{-O1} and higher.
11704
11705 @item -ftree-builtin-call-dce
11706 @opindex ftree-builtin-call-dce
11707 Perform conditional dead code elimination (DCE) for calls to built-in functions
11708 that may set @code{errno} but are otherwise free of side effects. This flag is
11709 enabled by default at @option{-O2} and higher if @option{-Os} is not also
11710 specified.
11711
11712 @item -ffinite-loops
11713 @opindex ffinite-loops
11714 @opindex fno-finite-loops
11715 Assume that a loop with an exit will eventually take the exit and not loop
11716 indefinitely. This allows the compiler to remove loops that otherwise have
11717 no side-effects, not considering eventual endless looping as such.
11718
11719 This option is enabled by default at @option{-O2} for C++ with -std=c++11
11720 or higher.
11721
11722 @item -ftree-dominator-opts
11723 @opindex ftree-dominator-opts
11724 Perform a variety of simple scalar cleanups (constant/copy
11725 propagation, redundancy elimination, range propagation and expression
11726 simplification) based on a dominator tree traversal. This also
11727 performs jump threading (to reduce jumps to jumps). This flag is
11728 enabled by default at @option{-O1} and higher.
11729
11730 @item -ftree-dse
11731 @opindex ftree-dse
11732 Perform dead store elimination (DSE) on trees. A dead store is a store into
11733 a memory location that is later overwritten by another store without
11734 any intervening loads. In this case the earlier store can be deleted. This
11735 flag is enabled by default at @option{-O1} and higher.
11736
11737 @item -ftree-ch
11738 @opindex ftree-ch
11739 Perform loop header copying on trees. This is beneficial since it increases
11740 effectiveness of code motion optimizations. It also saves one jump. This flag
11741 is enabled by default at @option{-O1} and higher. It is not enabled
11742 for @option{-Os}, since it usually increases code size.
11743
11744 @item -ftree-loop-optimize
11745 @opindex ftree-loop-optimize
11746 Perform loop optimizations on trees. This flag is enabled by default
11747 at @option{-O1} and higher.
11748
11749 @item -ftree-loop-linear
11750 @itemx -floop-strip-mine
11751 @itemx -floop-block
11752 @opindex ftree-loop-linear
11753 @opindex floop-strip-mine
11754 @opindex floop-block
11755 Perform loop nest optimizations. Same as
11756 @option{-floop-nest-optimize}. To use this code transformation, GCC has
11757 to be configured with @option{--with-isl} to enable the Graphite loop
11758 transformation infrastructure.
11759
11760 @item -fgraphite-identity
11761 @opindex fgraphite-identity
11762 Enable the identity transformation for graphite. For every SCoP we generate
11763 the polyhedral representation and transform it back to gimple. Using
11764 @option{-fgraphite-identity} we can check the costs or benefits of the
11765 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
11766 are also performed by the code generator isl, like index splitting and
11767 dead code elimination in loops.
11768
11769 @item -floop-nest-optimize
11770 @opindex floop-nest-optimize
11771 Enable the isl based loop nest optimizer. This is a generic loop nest
11772 optimizer based on the Pluto optimization algorithms. It calculates a loop
11773 structure optimized for data-locality and parallelism. This option
11774 is experimental.
11775
11776 @item -floop-parallelize-all
11777 @opindex floop-parallelize-all
11778 Use the Graphite data dependence analysis to identify loops that can
11779 be parallelized. Parallelize all the loops that can be analyzed to
11780 not contain loop carried dependences without checking that it is
11781 profitable to parallelize the loops.
11782
11783 @item -ftree-coalesce-vars
11784 @opindex ftree-coalesce-vars
11785 While transforming the program out of the SSA representation, attempt to
11786 reduce copying by coalescing versions of different user-defined
11787 variables, instead of just compiler temporaries. This may severely
11788 limit the ability to debug an optimized program compiled with
11789 @option{-fno-var-tracking-assignments}. In the negated form, this flag
11790 prevents SSA coalescing of user variables. This option is enabled by
11791 default if optimization is enabled, and it does very little otherwise.
11792
11793 @item -ftree-loop-if-convert
11794 @opindex ftree-loop-if-convert
11795 Attempt to transform conditional jumps in the innermost loops to
11796 branch-less equivalents. The intent is to remove control-flow from
11797 the innermost loops in order to improve the ability of the
11798 vectorization pass to handle these loops. This is enabled by default
11799 if vectorization is enabled.
11800
11801 @item -ftree-loop-distribution
11802 @opindex ftree-loop-distribution
11803 Perform loop distribution. This flag can improve cache performance on
11804 big loop bodies and allow further loop optimizations, like
11805 parallelization or vectorization, to take place. For example, the loop
11806 @smallexample
11807 DO I = 1, N
11808 A(I) = B(I) + C
11809 D(I) = E(I) * F
11810 ENDDO
11811 @end smallexample
11812 is transformed to
11813 @smallexample
11814 DO I = 1, N
11815 A(I) = B(I) + C
11816 ENDDO
11817 DO I = 1, N
11818 D(I) = E(I) * F
11819 ENDDO
11820 @end smallexample
11821 This flag is enabled by default at @option{-O3}.
11822 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11823
11824 @item -ftree-loop-distribute-patterns
11825 @opindex ftree-loop-distribute-patterns
11826 Perform loop distribution of patterns that can be code generated with
11827 calls to a library. This flag is enabled by default at @option{-O2} and
11828 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
11829
11830 This pass distributes the initialization loops and generates a call to
11831 memset zero. For example, the loop
11832 @smallexample
11833 DO I = 1, N
11834 A(I) = 0
11835 B(I) = A(I) + I
11836 ENDDO
11837 @end smallexample
11838 is transformed to
11839 @smallexample
11840 DO I = 1, N
11841 A(I) = 0
11842 ENDDO
11843 DO I = 1, N
11844 B(I) = A(I) + I
11845 ENDDO
11846 @end smallexample
11847 and the initialization loop is transformed into a call to memset zero.
11848 This flag is enabled by default at @option{-O3}.
11849 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11850
11851 @item -floop-interchange
11852 @opindex floop-interchange
11853 Perform loop interchange outside of graphite. This flag can improve cache
11854 performance on loop nest and allow further loop optimizations, like
11855 vectorization, to take place. For example, the loop
11856 @smallexample
11857 for (int i = 0; i < N; i++)
11858 for (int j = 0; j < N; j++)
11859 for (int k = 0; k < N; k++)
11860 c[i][j] = c[i][j] + a[i][k]*b[k][j];
11861 @end smallexample
11862 is transformed to
11863 @smallexample
11864 for (int i = 0; i < N; i++)
11865 for (int k = 0; k < N; k++)
11866 for (int j = 0; j < N; j++)
11867 c[i][j] = c[i][j] + a[i][k]*b[k][j];
11868 @end smallexample
11869 This flag is enabled by default at @option{-O3}.
11870 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11871
11872 @item -floop-unroll-and-jam
11873 @opindex floop-unroll-and-jam
11874 Apply unroll and jam transformations on feasible loops. In a loop
11875 nest this unrolls the outer loop by some factor and fuses the resulting
11876 multiple inner loops. This flag is enabled by default at @option{-O3}.
11877 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11878
11879 @item -ftree-loop-im
11880 @opindex ftree-loop-im
11881 Perform loop invariant motion on trees. This pass moves only invariants that
11882 are hard to handle at RTL level (function calls, operations that expand to
11883 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
11884 operands of conditions that are invariant out of the loop, so that we can use
11885 just trivial invariantness analysis in loop unswitching. The pass also includes
11886 store motion.
11887
11888 @item -ftree-loop-ivcanon
11889 @opindex ftree-loop-ivcanon
11890 Create a canonical counter for number of iterations in loops for which
11891 determining number of iterations requires complicated analysis. Later
11892 optimizations then may determine the number easily. Useful especially
11893 in connection with unrolling.
11894
11895 @item -ftree-scev-cprop
11896 @opindex ftree-scev-cprop
11897 Perform final value replacement. If a variable is modified in a loop
11898 in such a way that its value when exiting the loop can be determined using
11899 only its initial value and the number of loop iterations, replace uses of
11900 the final value by such a computation, provided it is sufficiently cheap.
11901 This reduces data dependencies and may allow further simplifications.
11902 Enabled by default at @option{-O1} and higher.
11903
11904 @item -fivopts
11905 @opindex fivopts
11906 Perform induction variable optimizations (strength reduction, induction
11907 variable merging and induction variable elimination) on trees.
11908
11909 @item -ftree-parallelize-loops=n
11910 @opindex ftree-parallelize-loops
11911 Parallelize loops, i.e., split their iteration space to run in n threads.
11912 This is only possible for loops whose iterations are independent
11913 and can be arbitrarily reordered. The optimization is only
11914 profitable on multiprocessor machines, for loops that are CPU-intensive,
11915 rather than constrained e.g.@: by memory bandwidth. This option
11916 implies @option{-pthread}, and thus is only supported on targets
11917 that have support for @option{-pthread}.
11918
11919 @item -ftree-pta
11920 @opindex ftree-pta
11921 Perform function-local points-to analysis on trees. This flag is
11922 enabled by default at @option{-O1} and higher, except for @option{-Og}.
11923
11924 @item -ftree-sra
11925 @opindex ftree-sra
11926 Perform scalar replacement of aggregates. This pass replaces structure
11927 references with scalars to prevent committing structures to memory too
11928 early. This flag is enabled by default at @option{-O1} and higher,
11929 except for @option{-Og}.
11930
11931 @item -fstore-merging
11932 @opindex fstore-merging
11933 Perform merging of narrow stores to consecutive memory addresses. This pass
11934 merges contiguous stores of immediate values narrower than a word into fewer
11935 wider stores to reduce the number of instructions. This is enabled by default
11936 at @option{-O2} and higher as well as @option{-Os}.
11937
11938 @item -ftree-ter
11939 @opindex ftree-ter
11940 Perform temporary expression replacement during the SSA->normal phase. Single
11941 use/single def temporaries are replaced at their use location with their
11942 defining expression. This results in non-GIMPLE code, but gives the expanders
11943 much more complex trees to work on resulting in better RTL generation. This is
11944 enabled by default at @option{-O1} and higher.
11945
11946 @item -ftree-slsr
11947 @opindex ftree-slsr
11948 Perform straight-line strength reduction on trees. This recognizes related
11949 expressions involving multiplications and replaces them by less expensive
11950 calculations when possible. This is enabled by default at @option{-O1} and
11951 higher.
11952
11953 @item -ftree-vectorize
11954 @opindex ftree-vectorize
11955 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
11956 and @option{-ftree-slp-vectorize} if not explicitly specified.
11957
11958 @item -ftree-loop-vectorize
11959 @opindex ftree-loop-vectorize
11960 Perform loop vectorization on trees. This flag is enabled by default at
11961 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11962 and @option{-fauto-profile}.
11963
11964 @item -ftree-slp-vectorize
11965 @opindex ftree-slp-vectorize
11966 Perform basic block vectorization on trees. This flag is enabled by default at
11967 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11968 and @option{-fauto-profile}.
11969
11970 @item -ftrivial-auto-var-init=@var{choice}
11971 @opindex ftrivial-auto-var-init
11972 Initialize automatic variables with either a pattern or with zeroes to increase
11973 the security and predictability of a program by preventing uninitialized memory
11974 disclosure and use.
11975 GCC still considers an automatic variable that doesn't have an explicit
11976 initializer as uninitialized, -Wuninitialized will still report warning messages
11977 on such automatic variables.
11978 With this option, GCC will also initialize any padding of automatic variables
11979 that have structure or union types to zeroes.
11980
11981 The three values of @var{choice} are:
11982
11983 @itemize @bullet
11984 @item
11985 @samp{uninitialized} doesn't initialize any automatic variables.
11986 This is C and C++'s default.
11987
11988 @item
11989 @samp{pattern} Initialize automatic variables with values which will likely
11990 transform logic bugs into crashes down the line, are easily recognized in a
11991 crash dump and without being values that programmers can rely on for useful
11992 program semantics.
11993 The current value is byte-repeatable pattern with byte "0xFE".
11994 The values used for pattern initialization might be changed in the future.
11995
11996 @item
11997 @samp{zero} Initialize automatic variables with zeroes.
11998 @end itemize
11999
12000 The default is @samp{uninitialized}.
12001
12002 You can control this behavior for a specific variable by using the variable
12003 attribute @code{uninitialized} (@pxref{Variable Attributes}).
12004
12005 @item -fvect-cost-model=@var{model}
12006 @opindex fvect-cost-model
12007 Alter the cost model used for vectorization. The @var{model} argument
12008 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
12009 @samp{very-cheap}.
12010 With the @samp{unlimited} model the vectorized code-path is assumed
12011 to be profitable while with the @samp{dynamic} model a runtime check
12012 guards the vectorized code-path to enable it only for iteration
12013 counts that will likely execute faster than when executing the original
12014 scalar loop. The @samp{cheap} model disables vectorization of
12015 loops where doing so would be cost prohibitive for example due to
12016 required runtime checks for data dependence or alignment but otherwise
12017 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
12018 allows vectorization if the vector code would entirely replace the
12019 scalar code that is being vectorized. For example, if each iteration
12020 of a vectorized loop would only be able to handle exactly four iterations
12021 of the scalar loop, the @samp{very-cheap} model would only allow
12022 vectorization if the scalar iteration count is known to be a multiple
12023 of four.
12024
12025 The default cost model depends on other optimization flags and is
12026 either @samp{dynamic} or @samp{cheap}.
12027
12028 @item -fsimd-cost-model=@var{model}
12029 @opindex fsimd-cost-model
12030 Alter the cost model used for vectorization of loops marked with the OpenMP
12031 simd directive. The @var{model} argument should be one of
12032 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
12033 have the same meaning as described in @option{-fvect-cost-model} and by
12034 default a cost model defined with @option{-fvect-cost-model} is used.
12035
12036 @item -ftree-vrp
12037 @opindex ftree-vrp
12038 Perform Value Range Propagation on trees. This is similar to the
12039 constant propagation pass, but instead of values, ranges of values are
12040 propagated. This allows the optimizers to remove unnecessary range
12041 checks like array bound checks and null pointer checks. This is
12042 enabled by default at @option{-O2} and higher. Null pointer check
12043 elimination is only done if @option{-fdelete-null-pointer-checks} is
12044 enabled.
12045
12046 @item -fsplit-paths
12047 @opindex fsplit-paths
12048 Split paths leading to loop backedges. This can improve dead code
12049 elimination and common subexpression elimination. This is enabled by
12050 default at @option{-O3} and above.
12051
12052 @item -fsplit-ivs-in-unroller
12053 @opindex fsplit-ivs-in-unroller
12054 Enables expression of values of induction variables in later iterations
12055 of the unrolled loop using the value in the first iteration. This breaks
12056 long dependency chains, thus improving efficiency of the scheduling passes.
12057
12058 A combination of @option{-fweb} and CSE is often sufficient to obtain the
12059 same effect. However, that is not reliable in cases where the loop body
12060 is more complicated than a single basic block. It also does not work at all
12061 on some architectures due to restrictions in the CSE pass.
12062
12063 This optimization is enabled by default.
12064
12065 @item -fvariable-expansion-in-unroller
12066 @opindex fvariable-expansion-in-unroller
12067 With this option, the compiler creates multiple copies of some
12068 local variables when unrolling a loop, which can result in superior code.
12069
12070 This optimization is enabled by default for PowerPC targets, but disabled
12071 by default otherwise.
12072
12073 @item -fpartial-inlining
12074 @opindex fpartial-inlining
12075 Inline parts of functions. This option has any effect only
12076 when inlining itself is turned on by the @option{-finline-functions}
12077 or @option{-finline-small-functions} options.
12078
12079 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12080
12081 @item -fpredictive-commoning
12082 @opindex fpredictive-commoning
12083 Perform predictive commoning optimization, i.e., reusing computations
12084 (especially memory loads and stores) performed in previous
12085 iterations of loops.
12086
12087 This option is enabled at level @option{-O3}.
12088 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12089
12090 @item -fprefetch-loop-arrays
12091 @opindex fprefetch-loop-arrays
12092 If supported by the target machine, generate instructions to prefetch
12093 memory to improve the performance of loops that access large arrays.
12094
12095 This option may generate better or worse code; results are highly
12096 dependent on the structure of loops within the source code.
12097
12098 Disabled at level @option{-Os}.
12099
12100 @item -fno-printf-return-value
12101 @opindex fno-printf-return-value
12102 @opindex fprintf-return-value
12103 Do not substitute constants for known return value of formatted output
12104 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
12105 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
12106 transformation allows GCC to optimize or even eliminate branches based
12107 on the known return value of these functions called with arguments that
12108 are either constant, or whose values are known to be in a range that
12109 makes determining the exact return value possible. For example, when
12110 @option{-fprintf-return-value} is in effect, both the branch and the
12111 body of the @code{if} statement (but not the call to @code{snprint})
12112 can be optimized away when @code{i} is a 32-bit or smaller integer
12113 because the return value is guaranteed to be at most 8.
12114
12115 @smallexample
12116 char buf[9];
12117 if (snprintf (buf, "%08x", i) >= sizeof buf)
12118 @dots{}
12119 @end smallexample
12120
12121 The @option{-fprintf-return-value} option relies on other optimizations
12122 and yields best results with @option{-O2} and above. It works in tandem
12123 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
12124 options. The @option{-fprintf-return-value} option is enabled by default.
12125
12126 @item -fno-peephole
12127 @itemx -fno-peephole2
12128 @opindex fno-peephole
12129 @opindex fpeephole
12130 @opindex fno-peephole2
12131 @opindex fpeephole2
12132 Disable any machine-specific peephole optimizations. The difference
12133 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
12134 are implemented in the compiler; some targets use one, some use the
12135 other, a few use both.
12136
12137 @option{-fpeephole} is enabled by default.
12138 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12139
12140 @item -fno-guess-branch-probability
12141 @opindex fno-guess-branch-probability
12142 @opindex fguess-branch-probability
12143 Do not guess branch probabilities using heuristics.
12144
12145 GCC uses heuristics to guess branch probabilities if they are
12146 not provided by profiling feedback (@option{-fprofile-arcs}). These
12147 heuristics are based on the control flow graph. If some branch probabilities
12148 are specified by @code{__builtin_expect}, then the heuristics are
12149 used to guess branch probabilities for the rest of the control flow graph,
12150 taking the @code{__builtin_expect} info into account. The interactions
12151 between the heuristics and @code{__builtin_expect} can be complex, and in
12152 some cases, it may be useful to disable the heuristics so that the effects
12153 of @code{__builtin_expect} are easier to understand.
12154
12155 It is also possible to specify expected probability of the expression
12156 with @code{__builtin_expect_with_probability} built-in function.
12157
12158 The default is @option{-fguess-branch-probability} at levels
12159 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12160
12161 @item -freorder-blocks
12162 @opindex freorder-blocks
12163 Reorder basic blocks in the compiled function in order to reduce number of
12164 taken branches and improve code locality.
12165
12166 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12167
12168 @item -freorder-blocks-algorithm=@var{algorithm}
12169 @opindex freorder-blocks-algorithm
12170 Use the specified algorithm for basic block reordering. The
12171 @var{algorithm} argument can be @samp{simple}, which does not increase
12172 code size (except sometimes due to secondary effects like alignment),
12173 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
12174 put all often executed code together, minimizing the number of branches
12175 executed by making extra copies of code.
12176
12177 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
12178 @samp{stc} at levels @option{-O2}, @option{-O3}.
12179
12180 @item -freorder-blocks-and-partition
12181 @opindex freorder-blocks-and-partition
12182 In addition to reordering basic blocks in the compiled function, in order
12183 to reduce number of taken branches, partitions hot and cold basic blocks
12184 into separate sections of the assembly and @file{.o} files, to improve
12185 paging and cache locality performance.
12186
12187 This optimization is automatically turned off in the presence of
12188 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
12189 section attribute and on any architecture that does not support named
12190 sections. When @option{-fsplit-stack} is used this option is not
12191 enabled by default (to avoid linker errors), but may be enabled
12192 explicitly (if using a working linker).
12193
12194 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
12195
12196 @item -freorder-functions
12197 @opindex freorder-functions
12198 Reorder functions in the object file in order to
12199 improve code locality. This is implemented by using special
12200 subsections @code{.text.hot} for most frequently executed functions and
12201 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
12202 the linker so object file format must support named sections and linker must
12203 place them in a reasonable way.
12204
12205 This option isn't effective unless you either provide profile feedback
12206 (see @option{-fprofile-arcs} for details) or manually annotate functions with
12207 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
12208
12209 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12210
12211 @item -fstrict-aliasing
12212 @opindex fstrict-aliasing
12213 Allow the compiler to assume the strictest aliasing rules applicable to
12214 the language being compiled. For C (and C++), this activates
12215 optimizations based on the type of expressions. In particular, an
12216 object of one type is assumed never to reside at the same address as an
12217 object of a different type, unless the types are almost the same. For
12218 example, an @code{unsigned int} can alias an @code{int}, but not a
12219 @code{void*} or a @code{double}. A character type may alias any other
12220 type.
12221
12222 @anchor{Type-punning}Pay special attention to code like this:
12223 @smallexample
12224 union a_union @{
12225 int i;
12226 double d;
12227 @};
12228
12229 int f() @{
12230 union a_union t;
12231 t.d = 3.0;
12232 return t.i;
12233 @}
12234 @end smallexample
12235 The practice of reading from a different union member than the one most
12236 recently written to (called ``type-punning'') is common. Even with
12237 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
12238 is accessed through the union type. So, the code above works as
12239 expected. @xref{Structures unions enumerations and bit-fields
12240 implementation}. However, this code might not:
12241 @smallexample
12242 int f() @{
12243 union a_union t;
12244 int* ip;
12245 t.d = 3.0;
12246 ip = &t.i;
12247 return *ip;
12248 @}
12249 @end smallexample
12250
12251 Similarly, access by taking the address, casting the resulting pointer
12252 and dereferencing the result has undefined behavior, even if the cast
12253 uses a union type, e.g.:
12254 @smallexample
12255 int f() @{
12256 double d = 3.0;
12257 return ((union a_union *) &d)->i;
12258 @}
12259 @end smallexample
12260
12261 The @option{-fstrict-aliasing} option is enabled at levels
12262 @option{-O2}, @option{-O3}, @option{-Os}.
12263
12264 @item -falign-functions
12265 @itemx -falign-functions=@var{n}
12266 @itemx -falign-functions=@var{n}:@var{m}
12267 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
12268 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
12269 @opindex falign-functions
12270 Align the start of functions to the next power-of-two greater than or
12271 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
12272 least the first @var{m} bytes of the function can be fetched by the CPU
12273 without crossing an @var{n}-byte alignment boundary.
12274
12275 If @var{m} is not specified, it defaults to @var{n}.
12276
12277 Examples: @option{-falign-functions=32} aligns functions to the next
12278 32-byte boundary, @option{-falign-functions=24} aligns to the next
12279 32-byte boundary only if this can be done by skipping 23 bytes or less,
12280 @option{-falign-functions=32:7} aligns to the next
12281 32-byte boundary only if this can be done by skipping 6 bytes or less.
12282
12283 The second pair of @var{n2}:@var{m2} values allows you to specify
12284 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
12285 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
12286 otherwise aligns to the next 32-byte boundary if this can be done
12287 by skipping 2 bytes or less.
12288 If @var{m2} is not specified, it defaults to @var{n2}.
12289
12290 Some assemblers only support this flag when @var{n} is a power of two;
12291 in that case, it is rounded up.
12292
12293 @option{-fno-align-functions} and @option{-falign-functions=1} are
12294 equivalent and mean that functions are not aligned.
12295
12296 If @var{n} is not specified or is zero, use a machine-dependent default.
12297 The maximum allowed @var{n} option value is 65536.
12298
12299 Enabled at levels @option{-O2}, @option{-O3}.
12300
12301 @item -flimit-function-alignment
12302 If this option is enabled, the compiler tries to avoid unnecessarily
12303 overaligning functions. It attempts to instruct the assembler to align
12304 by the amount specified by @option{-falign-functions}, but not to
12305 skip more bytes than the size of the function.
12306
12307 @item -falign-labels
12308 @itemx -falign-labels=@var{n}
12309 @itemx -falign-labels=@var{n}:@var{m}
12310 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
12311 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
12312 @opindex falign-labels
12313 Align all branch targets to a power-of-two boundary.
12314
12315 Parameters of this option are analogous to the @option{-falign-functions} option.
12316 @option{-fno-align-labels} and @option{-falign-labels=1} are
12317 equivalent and mean that labels are not aligned.
12318
12319 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
12320 are greater than this value, then their values are used instead.
12321
12322 If @var{n} is not specified or is zero, use a machine-dependent default
12323 which is very likely to be @samp{1}, meaning no alignment.
12324 The maximum allowed @var{n} option value is 65536.
12325
12326 Enabled at levels @option{-O2}, @option{-O3}.
12327
12328 @item -falign-loops
12329 @itemx -falign-loops=@var{n}
12330 @itemx -falign-loops=@var{n}:@var{m}
12331 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
12332 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
12333 @opindex falign-loops
12334 Align loops to a power-of-two boundary. If the loops are executed
12335 many times, this makes up for any execution of the dummy padding
12336 instructions.
12337
12338 If @option{-falign-labels} is greater than this value, then its value
12339 is used instead.
12340
12341 Parameters of this option are analogous to the @option{-falign-functions} option.
12342 @option{-fno-align-loops} and @option{-falign-loops=1} are
12343 equivalent and mean that loops are not aligned.
12344 The maximum allowed @var{n} option value is 65536.
12345
12346 If @var{n} is not specified or is zero, use a machine-dependent default.
12347
12348 Enabled at levels @option{-O2}, @option{-O3}.
12349
12350 @item -falign-jumps
12351 @itemx -falign-jumps=@var{n}
12352 @itemx -falign-jumps=@var{n}:@var{m}
12353 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
12354 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
12355 @opindex falign-jumps
12356 Align branch targets to a power-of-two boundary, for branch targets
12357 where the targets can only be reached by jumping. In this case,
12358 no dummy operations need be executed.
12359
12360 If @option{-falign-labels} is greater than this value, then its value
12361 is used instead.
12362
12363 Parameters of this option are analogous to the @option{-falign-functions} option.
12364 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
12365 equivalent and mean that loops are not aligned.
12366
12367 If @var{n} is not specified or is zero, use a machine-dependent default.
12368 The maximum allowed @var{n} option value is 65536.
12369
12370 Enabled at levels @option{-O2}, @option{-O3}.
12371
12372 @item -fno-allocation-dce
12373 @opindex fno-allocation-dce
12374 Do not remove unused C++ allocations in dead code elimination.
12375
12376 @item -fallow-store-data-races
12377 @opindex fallow-store-data-races
12378 Allow the compiler to perform optimizations that may introduce new data races
12379 on stores, without proving that the variable cannot be concurrently accessed
12380 by other threads. Does not affect optimization of local data. It is safe to
12381 use this option if it is known that global data will not be accessed by
12382 multiple threads.
12383
12384 Examples of optimizations enabled by @option{-fallow-store-data-races} include
12385 hoisting or if-conversions that may cause a value that was already in memory
12386 to be re-written with that same value. Such re-writing is safe in a single
12387 threaded context but may be unsafe in a multi-threaded context. Note that on
12388 some processors, if-conversions may be required in order to enable
12389 vectorization.
12390
12391 Enabled at level @option{-Ofast}.
12392
12393 @item -funit-at-a-time
12394 @opindex funit-at-a-time
12395 This option is left for compatibility reasons. @option{-funit-at-a-time}
12396 has no effect, while @option{-fno-unit-at-a-time} implies
12397 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
12398
12399 Enabled by default.
12400
12401 @item -fno-toplevel-reorder
12402 @opindex fno-toplevel-reorder
12403 @opindex ftoplevel-reorder
12404 Do not reorder top-level functions, variables, and @code{asm}
12405 statements. Output them in the same order that they appear in the
12406 input file. When this option is used, unreferenced static variables
12407 are not removed. This option is intended to support existing code
12408 that relies on a particular ordering. For new code, it is better to
12409 use attributes when possible.
12410
12411 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
12412 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
12413 Additionally @option{-fno-toplevel-reorder} implies
12414 @option{-fno-section-anchors}.
12415
12416 @item -fweb
12417 @opindex fweb
12418 Constructs webs as commonly used for register allocation purposes and assign
12419 each web individual pseudo register. This allows the register allocation pass
12420 to operate on pseudos directly, but also strengthens several other optimization
12421 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
12422 however, make debugging impossible, since variables no longer stay in a
12423 ``home register''.
12424
12425 Enabled by default with @option{-funroll-loops}.
12426
12427 @item -fwhole-program
12428 @opindex fwhole-program
12429 Assume that the current compilation unit represents the whole program being
12430 compiled. All public functions and variables with the exception of @code{main}
12431 and those merged by attribute @code{externally_visible} become static functions
12432 and in effect are optimized more aggressively by interprocedural optimizers.
12433
12434 This option should not be used in combination with @option{-flto}.
12435 Instead relying on a linker plugin should provide safer and more precise
12436 information.
12437
12438 @item -flto[=@var{n}]
12439 @opindex flto
12440 This option runs the standard link-time optimizer. When invoked
12441 with source code, it generates GIMPLE (one of GCC's internal
12442 representations) and writes it to special ELF sections in the object
12443 file. When the object files are linked together, all the function
12444 bodies are read from these ELF sections and instantiated as if they
12445 had been part of the same translation unit.
12446
12447 To use the link-time optimizer, @option{-flto} and optimization
12448 options should be specified at compile time and during the final link.
12449 It is recommended that you compile all the files participating in the
12450 same link with the same options and also specify those options at
12451 link time.
12452 For example:
12453
12454 @smallexample
12455 gcc -c -O2 -flto foo.c
12456 gcc -c -O2 -flto bar.c
12457 gcc -o myprog -flto -O2 foo.o bar.o
12458 @end smallexample
12459
12460 The first two invocations to GCC save a bytecode representation
12461 of GIMPLE into special ELF sections inside @file{foo.o} and
12462 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
12463 @file{foo.o} and @file{bar.o}, merges the two files into a single
12464 internal image, and compiles the result as usual. Since both
12465 @file{foo.o} and @file{bar.o} are merged into a single image, this
12466 causes all the interprocedural analyses and optimizations in GCC to
12467 work across the two files as if they were a single one. This means,
12468 for example, that the inliner is able to inline functions in
12469 @file{bar.o} into functions in @file{foo.o} and vice-versa.
12470
12471 Another (simpler) way to enable link-time optimization is:
12472
12473 @smallexample
12474 gcc -o myprog -flto -O2 foo.c bar.c
12475 @end smallexample
12476
12477 The above generates bytecode for @file{foo.c} and @file{bar.c},
12478 merges them together into a single GIMPLE representation and optimizes
12479 them as usual to produce @file{myprog}.
12480
12481 The important thing to keep in mind is that to enable link-time
12482 optimizations you need to use the GCC driver to perform the link step.
12483 GCC automatically performs link-time optimization if any of the
12484 objects involved were compiled with the @option{-flto} command-line option.
12485 You can always override
12486 the automatic decision to do link-time optimization
12487 by passing @option{-fno-lto} to the link command.
12488
12489 To make whole program optimization effective, it is necessary to make
12490 certain whole program assumptions. The compiler needs to know
12491 what functions and variables can be accessed by libraries and runtime
12492 outside of the link-time optimized unit. When supported by the linker,
12493 the linker plugin (see @option{-fuse-linker-plugin}) passes information
12494 to the compiler about used and externally visible symbols. When
12495 the linker plugin is not available, @option{-fwhole-program} should be
12496 used to allow the compiler to make these assumptions, which leads
12497 to more aggressive optimization decisions.
12498
12499 When a file is compiled with @option{-flto} without
12500 @option{-fuse-linker-plugin}, the generated object file is larger than
12501 a regular object file because it contains GIMPLE bytecodes and the usual
12502 final code (see @option{-ffat-lto-objects}). This means that
12503 object files with LTO information can be linked as normal object
12504 files; if @option{-fno-lto} is passed to the linker, no
12505 interprocedural optimizations are applied. Note that when
12506 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
12507 but you cannot perform a regular, non-LTO link on them.
12508
12509 When producing the final binary, GCC only
12510 applies link-time optimizations to those files that contain bytecode.
12511 Therefore, you can mix and match object files and libraries with
12512 GIMPLE bytecodes and final object code. GCC automatically selects
12513 which files to optimize in LTO mode and which files to link without
12514 further processing.
12515
12516 Generally, options specified at link time override those
12517 specified at compile time, although in some cases GCC attempts to infer
12518 link-time options from the settings used to compile the input files.
12519
12520 If you do not specify an optimization level option @option{-O} at
12521 link time, then GCC uses the highest optimization level
12522 used when compiling the object files. Note that it is generally
12523 ineffective to specify an optimization level option only at link time and
12524 not at compile time, for two reasons. First, compiling without
12525 optimization suppresses compiler passes that gather information
12526 needed for effective optimization at link time. Second, some early
12527 optimization passes can be performed only at compile time and
12528 not at link time.
12529
12530 There are some code generation flags preserved by GCC when
12531 generating bytecodes, as they need to be used during the final link.
12532 Currently, the following options and their settings are taken from
12533 the first object file that explicitly specifies them:
12534 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
12535 @option{-fgnu-tm} and all the @option{-m} target flags.
12536
12537 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
12538 @option{-fPIE} are combined based on the following scheme:
12539
12540 @smallexample
12541 @option{-fPIC} + @option{-fpic} = @option{-fpic}
12542 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
12543 @option{-fpic/-fPIC} + (no option) = (no option)
12544 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
12545 @option{-fpic} + @option{-fPIE} = @option{-fpie}
12546 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
12547 @end smallexample
12548
12549 Certain ABI-changing flags are required to match in all compilation units,
12550 and trying to override this at link time with a conflicting value
12551 is ignored. This includes options such as @option{-freg-struct-return}
12552 and @option{-fpcc-struct-return}.
12553
12554 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
12555 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
12556 are passed through to the link stage and merged conservatively for
12557 conflicting translation units. Specifically
12558 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
12559 precedence; and for example @option{-ffp-contract=off} takes precedence
12560 over @option{-ffp-contract=fast}. You can override them at link time.
12561
12562 Diagnostic options such as @option{-Wstringop-overflow} are passed
12563 through to the link stage and their setting matches that of the
12564 compile-step at function granularity. Note that this matters only
12565 for diagnostics emitted during optimization. Note that code
12566 transforms such as inlining can lead to warnings being enabled
12567 or disabled for regions if code not consistent with the setting
12568 at compile time.
12569
12570 When you need to pass options to the assembler via @option{-Wa} or
12571 @option{-Xassembler} make sure to either compile such translation
12572 units with @option{-fno-lto} or consistently use the same assembler
12573 options on all translation units. You can alternatively also
12574 specify assembler options at LTO link time.
12575
12576 To enable debug info generation you need to supply @option{-g} at
12577 compile time. If any of the input files at link time were built
12578 with debug info generation enabled the link will enable debug info
12579 generation as well. Any elaborate debug info settings
12580 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
12581 at the linker command line and mixing different settings in different
12582 translation units is discouraged.
12583
12584 If LTO encounters objects with C linkage declared with incompatible
12585 types in separate translation units to be linked together (undefined
12586 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
12587 issued. The behavior is still undefined at run time. Similar
12588 diagnostics may be raised for other languages.
12589
12590 Another feature of LTO is that it is possible to apply interprocedural
12591 optimizations on files written in different languages:
12592
12593 @smallexample
12594 gcc -c -flto foo.c
12595 g++ -c -flto bar.cc
12596 gfortran -c -flto baz.f90
12597 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
12598 @end smallexample
12599
12600 Notice that the final link is done with @command{g++} to get the C++
12601 runtime libraries and @option{-lgfortran} is added to get the Fortran
12602 runtime libraries. In general, when mixing languages in LTO mode, you
12603 should use the same link command options as when mixing languages in a
12604 regular (non-LTO) compilation.
12605
12606 If object files containing GIMPLE bytecode are stored in a library archive, say
12607 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
12608 are using a linker with plugin support. To create static libraries suitable
12609 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
12610 and @command{ranlib};
12611 to show the symbols of object files with GIMPLE bytecode, use
12612 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
12613 and @command{nm} have been compiled with plugin support. At link time, use the
12614 flag @option{-fuse-linker-plugin} to ensure that the library participates in
12615 the LTO optimization process:
12616
12617 @smallexample
12618 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
12619 @end smallexample
12620
12621 With the linker plugin enabled, the linker extracts the needed
12622 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
12623 to make them part of the aggregated GIMPLE image to be optimized.
12624
12625 If you are not using a linker with plugin support and/or do not
12626 enable the linker plugin, then the objects inside @file{libfoo.a}
12627 are extracted and linked as usual, but they do not participate
12628 in the LTO optimization process. In order to make a static library suitable
12629 for both LTO optimization and usual linkage, compile its object files with
12630 @option{-flto} @option{-ffat-lto-objects}.
12631
12632 Link-time optimizations do not require the presence of the whole program to
12633 operate. If the program does not require any symbols to be exported, it is
12634 possible to combine @option{-flto} and @option{-fwhole-program} to allow
12635 the interprocedural optimizers to use more aggressive assumptions which may
12636 lead to improved optimization opportunities.
12637 Use of @option{-fwhole-program} is not needed when linker plugin is
12638 active (see @option{-fuse-linker-plugin}).
12639
12640 The current implementation of LTO makes no
12641 attempt to generate bytecode that is portable between different
12642 types of hosts. The bytecode files are versioned and there is a
12643 strict version check, so bytecode files generated in one version of
12644 GCC do not work with an older or newer version of GCC.
12645
12646 Link-time optimization does not work well with generation of debugging
12647 information on systems other than those using a combination of ELF and
12648 DWARF.
12649
12650 If you specify the optional @var{n}, the optimization and code
12651 generation done at link time is executed in parallel using @var{n}
12652 parallel jobs by utilizing an installed @command{make} program. The
12653 environment variable @env{MAKE} may be used to override the program
12654 used.
12655
12656 You can also specify @option{-flto=jobserver} to use GNU make's
12657 job server mode to determine the number of parallel jobs. This
12658 is useful when the Makefile calling GCC is already executing in parallel.
12659 You must prepend a @samp{+} to the command recipe in the parent Makefile
12660 for this to work. This option likely only works if @env{MAKE} is
12661 GNU make. Even without the option value, GCC tries to automatically
12662 detect a running GNU make's job server.
12663
12664 Use @option{-flto=auto} to use GNU make's job server, if available,
12665 or otherwise fall back to autodetection of the number of CPU threads
12666 present in your system.
12667
12668 @item -flto-partition=@var{alg}
12669 @opindex flto-partition
12670 Specify the partitioning algorithm used by the link-time optimizer.
12671 The value is either @samp{1to1} to specify a partitioning mirroring
12672 the original source files or @samp{balanced} to specify partitioning
12673 into equally sized chunks (whenever possible) or @samp{max} to create
12674 new partition for every symbol where possible. Specifying @samp{none}
12675 as an algorithm disables partitioning and streaming completely.
12676 The default value is @samp{balanced}. While @samp{1to1} can be used
12677 as an workaround for various code ordering issues, the @samp{max}
12678 partitioning is intended for internal testing only.
12679 The value @samp{one} specifies that exactly one partition should be
12680 used while the value @samp{none} bypasses partitioning and executes
12681 the link-time optimization step directly from the WPA phase.
12682
12683 @item -flto-compression-level=@var{n}
12684 @opindex flto-compression-level
12685 This option specifies the level of compression used for intermediate
12686 language written to LTO object files, and is only meaningful in
12687 conjunction with LTO mode (@option{-flto}). GCC currently supports two
12688 LTO compression algorithms. For zstd, valid values are 0 (no compression)
12689 to 19 (maximum compression), while zlib supports values from 0 to 9.
12690 Values outside this range are clamped to either minimum or maximum
12691 of the supported values. If the option is not given,
12692 a default balanced compression setting is used.
12693
12694 @item -fuse-linker-plugin
12695 @opindex fuse-linker-plugin
12696 Enables the use of a linker plugin during link-time optimization. This
12697 option relies on plugin support in the linker, which is available in gold
12698 or in GNU ld 2.21 or newer.
12699
12700 This option enables the extraction of object files with GIMPLE bytecode out
12701 of library archives. This improves the quality of optimization by exposing
12702 more code to the link-time optimizer. This information specifies what
12703 symbols can be accessed externally (by non-LTO object or during dynamic
12704 linking). Resulting code quality improvements on binaries (and shared
12705 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
12706 See @option{-flto} for a description of the effect of this flag and how to
12707 use it.
12708
12709 This option is enabled by default when LTO support in GCC is enabled
12710 and GCC was configured for use with
12711 a linker supporting plugins (GNU ld 2.21 or newer or gold).
12712
12713 @item -ffat-lto-objects
12714 @opindex ffat-lto-objects
12715 Fat LTO objects are object files that contain both the intermediate language
12716 and the object code. This makes them usable for both LTO linking and normal
12717 linking. This option is effective only when compiling with @option{-flto}
12718 and is ignored at link time.
12719
12720 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
12721 requires the complete toolchain to be aware of LTO. It requires a linker with
12722 linker plugin support for basic functionality. Additionally,
12723 @command{nm}, @command{ar} and @command{ranlib}
12724 need to support linker plugins to allow a full-featured build environment
12725 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
12726 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
12727 to these tools. With non fat LTO makefiles need to be modified to use them.
12728
12729 Note that modern binutils provide plugin auto-load mechanism.
12730 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
12731 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
12732 @command{gcc-ranlib}).
12733
12734 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
12735 support.
12736
12737 @item -fcompare-elim
12738 @opindex fcompare-elim
12739 After register allocation and post-register allocation instruction splitting,
12740 identify arithmetic instructions that compute processor flags similar to a
12741 comparison operation based on that arithmetic. If possible, eliminate the
12742 explicit comparison operation.
12743
12744 This pass only applies to certain targets that cannot explicitly represent
12745 the comparison operation before register allocation is complete.
12746
12747 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12748
12749 @item -fcprop-registers
12750 @opindex fcprop-registers
12751 After register allocation and post-register allocation instruction splitting,
12752 perform a copy-propagation pass to try to reduce scheduling dependencies
12753 and occasionally eliminate the copy.
12754
12755 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12756
12757 @item -fprofile-correction
12758 @opindex fprofile-correction
12759 Profiles collected using an instrumented binary for multi-threaded programs may
12760 be inconsistent due to missed counter updates. When this option is specified,
12761 GCC uses heuristics to correct or smooth out such inconsistencies. By
12762 default, GCC emits an error message when an inconsistent profile is detected.
12763
12764 This option is enabled by @option{-fauto-profile}.
12765
12766 @item -fprofile-partial-training
12767 @opindex fprofile-partial-training
12768 With @code{-fprofile-use} all portions of programs not executed during train
12769 run are optimized agressively for size rather than speed. In some cases it is
12770 not practical to train all possible hot paths in the program. (For
12771 example, program may contain functions specific for a given hardware and
12772 trianing may not cover all hardware configurations program is run on.) With
12773 @code{-fprofile-partial-training} profile feedback will be ignored for all
12774 functions not executed during the train run leading them to be optimized as if
12775 they were compiled without profile feedback. This leads to better performance
12776 when train run is not representative but also leads to significantly bigger
12777 code.
12778
12779 @item -fprofile-use
12780 @itemx -fprofile-use=@var{path}
12781 @opindex fprofile-use
12782 Enable profile feedback-directed optimizations,
12783 and the following optimizations, many of which
12784 are generally profitable only with profile feedback available:
12785
12786 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12787 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12788 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12789 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12790 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12791 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12792 -fprofile-reorder-functions}
12793
12794 Before you can use this option, you must first generate profiling information.
12795 @xref{Instrumentation Options}, for information about the
12796 @option{-fprofile-generate} option.
12797
12798 By default, GCC emits an error message if the feedback profiles do not
12799 match the source code. This error can be turned into a warning by using
12800 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
12801 optimized code. Additionally, by default, GCC also emits a warning message if
12802 the feedback profiles do not exist (see @option{-Wmissing-profile}).
12803
12804 If @var{path} is specified, GCC looks at the @var{path} to find
12805 the profile feedback data files. See @option{-fprofile-dir}.
12806
12807 @item -fauto-profile
12808 @itemx -fauto-profile=@var{path}
12809 @opindex fauto-profile
12810 Enable sampling-based feedback-directed optimizations,
12811 and the following optimizations,
12812 many of which are generally profitable only with profile feedback available:
12813
12814 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12815 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12816 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12817 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12818 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12819 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12820 -fprofile-correction}
12821
12822 @var{path} is the name of a file containing AutoFDO profile information.
12823 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
12824
12825 Producing an AutoFDO profile data file requires running your program
12826 with the @command{perf} utility on a supported GNU/Linux target system.
12827 For more information, see @uref{https://perf.wiki.kernel.org/}.
12828
12829 E.g.
12830 @smallexample
12831 perf record -e br_inst_retired:near_taken -b -o perf.data \
12832 -- your_program
12833 @end smallexample
12834
12835 Then use the @command{create_gcov} tool to convert the raw profile data
12836 to a format that can be used by GCC.@ You must also supply the
12837 unstripped binary for your program to this tool.
12838 See @uref{https://github.com/google/autofdo}.
12839
12840 E.g.
12841 @smallexample
12842 create_gcov --binary=your_program.unstripped --profile=perf.data \
12843 --gcov=profile.afdo
12844 @end smallexample
12845 @end table
12846
12847 The following options control compiler behavior regarding floating-point
12848 arithmetic. These options trade off between speed and
12849 correctness. All must be specifically enabled.
12850
12851 @table @gcctabopt
12852 @item -ffloat-store
12853 @opindex ffloat-store
12854 Do not store floating-point variables in registers, and inhibit other
12855 options that might change whether a floating-point value is taken from a
12856 register or memory.
12857
12858 @cindex floating-point precision
12859 This option prevents undesirable excess precision on machines such as
12860 the 68000 where the floating registers (of the 68881) keep more
12861 precision than a @code{double} is supposed to have. Similarly for the
12862 x86 architecture. For most programs, the excess precision does only
12863 good, but a few programs rely on the precise definition of IEEE floating
12864 point. Use @option{-ffloat-store} for such programs, after modifying
12865 them to store all pertinent intermediate computations into variables.
12866
12867 @item -fexcess-precision=@var{style}
12868 @opindex fexcess-precision
12869 This option allows further control over excess precision on machines
12870 where floating-point operations occur in a format with more precision or
12871 range than the IEEE standard and interchange floating-point types. By
12872 default, @option{-fexcess-precision=fast} is in effect; this means that
12873 operations may be carried out in a wider precision than the types specified
12874 in the source if that would result in faster code, and it is unpredictable
12875 when rounding to the types specified in the source code takes place.
12876 When compiling C, if @option{-fexcess-precision=standard} is specified then
12877 excess precision follows the rules specified in ISO C99; in particular,
12878 both casts and assignments cause values to be rounded to their
12879 semantic types (whereas @option{-ffloat-store} only affects
12880 assignments). This option is enabled by default for C if a strict
12881 conformance option such as @option{-std=c99} is used.
12882 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
12883 regardless of whether a strict conformance option is used.
12884
12885 @opindex mfpmath
12886 @option{-fexcess-precision=standard} is not implemented for languages
12887 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
12888 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
12889 semantics apply without excess precision, and in the latter, rounding
12890 is unpredictable.
12891
12892 @item -ffast-math
12893 @opindex ffast-math
12894 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
12895 @option{-ffinite-math-only}, @option{-fno-rounding-math},
12896 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
12897 @option{-fexcess-precision=fast}.
12898
12899 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
12900
12901 This option is not turned on by any @option{-O} option besides
12902 @option{-Ofast} since it can result in incorrect output for programs
12903 that depend on an exact implementation of IEEE or ISO rules/specifications
12904 for math functions. It may, however, yield faster code for programs
12905 that do not require the guarantees of these specifications.
12906
12907 @item -fno-math-errno
12908 @opindex fno-math-errno
12909 @opindex fmath-errno
12910 Do not set @code{errno} after calling math functions that are executed
12911 with a single instruction, e.g., @code{sqrt}. A program that relies on
12912 IEEE exceptions for math error handling may want to use this flag
12913 for speed while maintaining IEEE arithmetic compatibility.
12914
12915 This option is not turned on by any @option{-O} option since
12916 it can result in incorrect output for programs that depend on
12917 an exact implementation of IEEE or ISO rules/specifications for
12918 math functions. It may, however, yield faster code for programs
12919 that do not require the guarantees of these specifications.
12920
12921 The default is @option{-fmath-errno}.
12922
12923 On Darwin systems, the math library never sets @code{errno}. There is
12924 therefore no reason for the compiler to consider the possibility that
12925 it might, and @option{-fno-math-errno} is the default.
12926
12927 @item -funsafe-math-optimizations
12928 @opindex funsafe-math-optimizations
12929
12930 Allow optimizations for floating-point arithmetic that (a) assume
12931 that arguments and results are valid and (b) may violate IEEE or
12932 ANSI standards. When used at link time, it may include libraries
12933 or startup files that change the default FPU control word or other
12934 similar optimizations.
12935
12936 This option is not turned on by any @option{-O} option since
12937 it can result in incorrect output for programs that depend on
12938 an exact implementation of IEEE or ISO rules/specifications for
12939 math functions. It may, however, yield faster code for programs
12940 that do not require the guarantees of these specifications.
12941 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
12942 @option{-fassociative-math} and @option{-freciprocal-math}.
12943
12944 The default is @option{-fno-unsafe-math-optimizations}.
12945
12946 @item -fassociative-math
12947 @opindex fassociative-math
12948
12949 Allow re-association of operands in series of floating-point operations.
12950 This violates the ISO C and C++ language standard by possibly changing
12951 computation result. NOTE: re-ordering may change the sign of zero as
12952 well as ignore NaNs and inhibit or create underflow or overflow (and
12953 thus cannot be used on code that relies on rounding behavior like
12954 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
12955 and thus may not be used when ordered comparisons are required.
12956 This option requires that both @option{-fno-signed-zeros} and
12957 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
12958 much sense with @option{-frounding-math}. For Fortran the option
12959 is automatically enabled when both @option{-fno-signed-zeros} and
12960 @option{-fno-trapping-math} are in effect.
12961
12962 The default is @option{-fno-associative-math}.
12963
12964 @item -freciprocal-math
12965 @opindex freciprocal-math
12966
12967 Allow the reciprocal of a value to be used instead of dividing by
12968 the value if this enables optimizations. For example @code{x / y}
12969 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
12970 is subject to common subexpression elimination. Note that this loses
12971 precision and increases the number of flops operating on the value.
12972
12973 The default is @option{-fno-reciprocal-math}.
12974
12975 @item -ffinite-math-only
12976 @opindex ffinite-math-only
12977 Allow optimizations for floating-point arithmetic that assume
12978 that arguments and results are not NaNs or +-Infs.
12979
12980 This option is not turned on by any @option{-O} option since
12981 it can result in incorrect output for programs that depend on
12982 an exact implementation of IEEE or ISO rules/specifications for
12983 math functions. It may, however, yield faster code for programs
12984 that do not require the guarantees of these specifications.
12985
12986 The default is @option{-fno-finite-math-only}.
12987
12988 @item -fno-signed-zeros
12989 @opindex fno-signed-zeros
12990 @opindex fsigned-zeros
12991 Allow optimizations for floating-point arithmetic that ignore the
12992 signedness of zero. IEEE arithmetic specifies the behavior of
12993 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
12994 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
12995 This option implies that the sign of a zero result isn't significant.
12996
12997 The default is @option{-fsigned-zeros}.
12998
12999 @item -fno-trapping-math
13000 @opindex fno-trapping-math
13001 @opindex ftrapping-math
13002 Compile code assuming that floating-point operations cannot generate
13003 user-visible traps. These traps include division by zero, overflow,
13004 underflow, inexact result and invalid operation. This option requires
13005 that @option{-fno-signaling-nans} be in effect. Setting this option may
13006 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
13007
13008 This option should never be turned on by any @option{-O} option since
13009 it can result in incorrect output for programs that depend on
13010 an exact implementation of IEEE or ISO rules/specifications for
13011 math functions.
13012
13013 The default is @option{-ftrapping-math}.
13014
13015 @item -frounding-math
13016 @opindex frounding-math
13017 Disable transformations and optimizations that assume default floating-point
13018 rounding behavior. This is round-to-zero for all floating point
13019 to integer conversions, and round-to-nearest for all other arithmetic
13020 truncations. This option should be specified for programs that change
13021 the FP rounding mode dynamically, or that may be executed with a
13022 non-default rounding mode. This option disables constant folding of
13023 floating-point expressions at compile time (which may be affected by
13024 rounding mode) and arithmetic transformations that are unsafe in the
13025 presence of sign-dependent rounding modes.
13026
13027 The default is @option{-fno-rounding-math}.
13028
13029 This option is experimental and does not currently guarantee to
13030 disable all GCC optimizations that are affected by rounding mode.
13031 Future versions of GCC may provide finer control of this setting
13032 using C99's @code{FENV_ACCESS} pragma. This command-line option
13033 will be used to specify the default state for @code{FENV_ACCESS}.
13034
13035 @item -fsignaling-nans
13036 @opindex fsignaling-nans
13037 Compile code assuming that IEEE signaling NaNs may generate user-visible
13038 traps during floating-point operations. Setting this option disables
13039 optimizations that may change the number of exceptions visible with
13040 signaling NaNs. This option implies @option{-ftrapping-math}.
13041
13042 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
13043 be defined.
13044
13045 The default is @option{-fno-signaling-nans}.
13046
13047 This option is experimental and does not currently guarantee to
13048 disable all GCC optimizations that affect signaling NaN behavior.
13049
13050 @item -fno-fp-int-builtin-inexact
13051 @opindex fno-fp-int-builtin-inexact
13052 @opindex ffp-int-builtin-inexact
13053 Do not allow the built-in functions @code{ceil}, @code{floor},
13054 @code{round} and @code{trunc}, and their @code{float} and @code{long
13055 double} variants, to generate code that raises the ``inexact''
13056 floating-point exception for noninteger arguments. ISO C99 and C11
13057 allow these functions to raise the ``inexact'' exception, but ISO/IEC
13058 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
13059 ISO C2X, does not allow these functions to do so.
13060
13061 The default is @option{-ffp-int-builtin-inexact}, allowing the
13062 exception to be raised, unless C2X or a later C standard is selected.
13063 This option does nothing unless @option{-ftrapping-math} is in effect.
13064
13065 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
13066 generate a call to a library function then the ``inexact'' exception
13067 may be raised if the library implementation does not follow TS 18661.
13068
13069 @item -fsingle-precision-constant
13070 @opindex fsingle-precision-constant
13071 Treat floating-point constants as single precision instead of
13072 implicitly converting them to double-precision constants.
13073
13074 @item -fcx-limited-range
13075 @opindex fcx-limited-range
13076 When enabled, this option states that a range reduction step is not
13077 needed when performing complex division. Also, there is no checking
13078 whether the result of a complex multiplication or division is @code{NaN
13079 + I*NaN}, with an attempt to rescue the situation in that case. The
13080 default is @option{-fno-cx-limited-range}, but is enabled by
13081 @option{-ffast-math}.
13082
13083 This option controls the default setting of the ISO C99
13084 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
13085 all languages.
13086
13087 @item -fcx-fortran-rules
13088 @opindex fcx-fortran-rules
13089 Complex multiplication and division follow Fortran rules. Range
13090 reduction is done as part of complex division, but there is no checking
13091 whether the result of a complex multiplication or division is @code{NaN
13092 + I*NaN}, with an attempt to rescue the situation in that case.
13093
13094 The default is @option{-fno-cx-fortran-rules}.
13095
13096 @end table
13097
13098 The following options control optimizations that may improve
13099 performance, but are not enabled by any @option{-O} options. This
13100 section includes experimental options that may produce broken code.
13101
13102 @table @gcctabopt
13103 @item -fbranch-probabilities
13104 @opindex fbranch-probabilities
13105 After running a program compiled with @option{-fprofile-arcs}
13106 (@pxref{Instrumentation Options}),
13107 you can compile it a second time using
13108 @option{-fbranch-probabilities}, to improve optimizations based on
13109 the number of times each branch was taken. When a program
13110 compiled with @option{-fprofile-arcs} exits, it saves arc execution
13111 counts to a file called @file{@var{sourcename}.gcda} for each source
13112 file. The information in this data file is very dependent on the
13113 structure of the generated code, so you must use the same source code
13114 and the same optimization options for both compilations.
13115
13116 With @option{-fbranch-probabilities}, GCC puts a
13117 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
13118 These can be used to improve optimization. Currently, they are only
13119 used in one place: in @file{reorg.c}, instead of guessing which path a
13120 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
13121 exactly determine which path is taken more often.
13122
13123 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13124
13125 @item -fprofile-values
13126 @opindex fprofile-values
13127 If combined with @option{-fprofile-arcs}, it adds code so that some
13128 data about values of expressions in the program is gathered.
13129
13130 With @option{-fbranch-probabilities}, it reads back the data gathered
13131 from profiling values of expressions for usage in optimizations.
13132
13133 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
13134 @option{-fauto-profile}.
13135
13136 @item -fprofile-reorder-functions
13137 @opindex fprofile-reorder-functions
13138 Function reordering based on profile instrumentation collects
13139 first time of execution of a function and orders these functions
13140 in ascending order.
13141
13142 Enabled with @option{-fprofile-use}.
13143
13144 @item -fvpt
13145 @opindex fvpt
13146 If combined with @option{-fprofile-arcs}, this option instructs the compiler
13147 to add code to gather information about values of expressions.
13148
13149 With @option{-fbranch-probabilities}, it reads back the data gathered
13150 and actually performs the optimizations based on them.
13151 Currently the optimizations include specialization of division operations
13152 using the knowledge about the value of the denominator.
13153
13154 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
13155
13156 @item -frename-registers
13157 @opindex frename-registers
13158 Attempt to avoid false dependencies in scheduled code by making use
13159 of registers left over after register allocation. This optimization
13160 most benefits processors with lots of registers. Depending on the
13161 debug information format adopted by the target, however, it can
13162 make debugging impossible, since variables no longer stay in
13163 a ``home register''.
13164
13165 Enabled by default with @option{-funroll-loops}.
13166
13167 @item -fschedule-fusion
13168 @opindex fschedule-fusion
13169 Performs a target dependent pass over the instruction stream to schedule
13170 instructions of same type together because target machine can execute them
13171 more efficiently if they are adjacent to each other in the instruction flow.
13172
13173 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13174
13175 @item -ftracer
13176 @opindex ftracer
13177 Perform tail duplication to enlarge superblock size. This transformation
13178 simplifies the control flow of the function allowing other optimizations to do
13179 a better job.
13180
13181 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13182
13183 @item -funroll-loops
13184 @opindex funroll-loops
13185 Unroll loops whose number of iterations can be determined at compile time or
13186 upon entry to the loop. @option{-funroll-loops} implies
13187 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
13188 It also turns on complete loop peeling (i.e.@: complete removal of loops with
13189 a small constant number of iterations). This option makes code larger, and may
13190 or may not make it run faster.
13191
13192 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13193
13194 @item -funroll-all-loops
13195 @opindex funroll-all-loops
13196 Unroll all loops, even if their number of iterations is uncertain when
13197 the loop is entered. This usually makes programs run more slowly.
13198 @option{-funroll-all-loops} implies the same options as
13199 @option{-funroll-loops}.
13200
13201 @item -fpeel-loops
13202 @opindex fpeel-loops
13203 Peels loops for which there is enough information that they do not
13204 roll much (from profile feedback or static analysis). It also turns on
13205 complete loop peeling (i.e.@: complete removal of loops with small constant
13206 number of iterations).
13207
13208 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
13209
13210 @item -fmove-loop-invariants
13211 @opindex fmove-loop-invariants
13212 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
13213 at level @option{-O1} and higher, except for @option{-Og}.
13214
13215 @item -fmove-loop-stores
13216 @opindex fmove-loop-stores
13217 Enables the loop store motion pass in the GIMPLE loop optimizer. This
13218 moves invariant stores to after the end of the loop in exchange for
13219 carrying the stored value in a register across the iteration.
13220 Note for this option to have an effect @option{-ftree-loop-im} has to
13221 be enabled as well. Enabled at level @option{-O1} and higher, except
13222 for @option{-Og}.
13223
13224 @item -fsplit-loops
13225 @opindex fsplit-loops
13226 Split a loop into two if it contains a condition that's always true
13227 for one side of the iteration space and false for the other.
13228
13229 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13230
13231 @item -funswitch-loops
13232 @opindex funswitch-loops
13233 Move branches with loop invariant conditions out of the loop, with duplicates
13234 of the loop on both branches (modified according to result of the condition).
13235
13236 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13237
13238 @item -fversion-loops-for-strides
13239 @opindex fversion-loops-for-strides
13240 If a loop iterates over an array with a variable stride, create another
13241 version of the loop that assumes the stride is always one. For example:
13242
13243 @smallexample
13244 for (int i = 0; i < n; ++i)
13245 x[i * stride] = @dots{};
13246 @end smallexample
13247
13248 becomes:
13249
13250 @smallexample
13251 if (stride == 1)
13252 for (int i = 0; i < n; ++i)
13253 x[i] = @dots{};
13254 else
13255 for (int i = 0; i < n; ++i)
13256 x[i * stride] = @dots{};
13257 @end smallexample
13258
13259 This is particularly useful for assumed-shape arrays in Fortran where
13260 (for example) it allows better vectorization assuming contiguous accesses.
13261 This flag is enabled by default at @option{-O3}.
13262 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13263
13264 @item -ffunction-sections
13265 @itemx -fdata-sections
13266 @opindex ffunction-sections
13267 @opindex fdata-sections
13268 Place each function or data item into its own section in the output
13269 file if the target supports arbitrary sections. The name of the
13270 function or the name of the data item determines the section's name
13271 in the output file.
13272
13273 Use these options on systems where the linker can perform optimizations to
13274 improve locality of reference in the instruction space. Most systems using the
13275 ELF object format have linkers with such optimizations. On AIX, the linker
13276 rearranges sections (CSECTs) based on the call graph. The performance impact
13277 varies.
13278
13279 Together with a linker garbage collection (linker @option{--gc-sections}
13280 option) these options may lead to smaller statically-linked executables (after
13281 stripping).
13282
13283 On ELF/DWARF systems these options do not degenerate the quality of the debug
13284 information. There could be issues with other object files/debug info formats.
13285
13286 Only use these options when there are significant benefits from doing so. When
13287 you specify these options, the assembler and linker create larger object and
13288 executable files and are also slower. These options affect code generation.
13289 They prevent optimizations by the compiler and assembler using relative
13290 locations inside a translation unit since the locations are unknown until
13291 link time. An example of such an optimization is relaxing calls to short call
13292 instructions.
13293
13294 @item -fstdarg-opt
13295 @opindex fstdarg-opt
13296 Optimize the prologue of variadic argument functions with respect to usage of
13297 those arguments.
13298
13299 @item -fsection-anchors
13300 @opindex fsection-anchors
13301 Try to reduce the number of symbolic address calculations by using
13302 shared ``anchor'' symbols to address nearby objects. This transformation
13303 can help to reduce the number of GOT entries and GOT accesses on some
13304 targets.
13305
13306 For example, the implementation of the following function @code{foo}:
13307
13308 @smallexample
13309 static int a, b, c;
13310 int foo (void) @{ return a + b + c; @}
13311 @end smallexample
13312
13313 @noindent
13314 usually calculates the addresses of all three variables, but if you
13315 compile it with @option{-fsection-anchors}, it accesses the variables
13316 from a common anchor point instead. The effect is similar to the
13317 following pseudocode (which isn't valid C):
13318
13319 @smallexample
13320 int foo (void)
13321 @{
13322 register int *xr = &x;
13323 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
13324 @}
13325 @end smallexample
13326
13327 Not all targets support this option.
13328
13329 @item -fzero-call-used-regs=@var{choice}
13330 @opindex fzero-call-used-regs
13331 Zero call-used registers at function return to increase program
13332 security by either mitigating Return-Oriented Programming (ROP)
13333 attacks or preventing information leakage through registers.
13334
13335 The possible values of @var{choice} are the same as for the
13336 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
13337 The default is @samp{skip}.
13338
13339 You can control this behavior for a specific function by using the function
13340 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
13341
13342 @item --param @var{name}=@var{value}
13343 @opindex param
13344 In some places, GCC uses various constants to control the amount of
13345 optimization that is done. For example, GCC does not inline functions
13346 that contain more than a certain number of instructions. You can
13347 control some of these constants on the command line using the
13348 @option{--param} option.
13349
13350 The names of specific parameters, and the meaning of the values, are
13351 tied to the internals of the compiler, and are subject to change
13352 without notice in future releases.
13353
13354 In order to get minimal, maximal and default value of a parameter,
13355 one can use @option{--help=param -Q} options.
13356
13357 In each case, the @var{value} is an integer. The following choices
13358 of @var{name} are recognized for all targets:
13359
13360 @table @gcctabopt
13361 @item predictable-branch-outcome
13362 When branch is predicted to be taken with probability lower than this threshold
13363 (in percent), then it is considered well predictable.
13364
13365 @item max-rtl-if-conversion-insns
13366 RTL if-conversion tries to remove conditional branches around a block and
13367 replace them with conditionally executed instructions. This parameter
13368 gives the maximum number of instructions in a block which should be
13369 considered for if-conversion. The compiler will
13370 also use other heuristics to decide whether if-conversion is likely to be
13371 profitable.
13372
13373 @item max-rtl-if-conversion-predictable-cost
13374 RTL if-conversion will try to remove conditional branches around a block
13375 and replace them with conditionally executed instructions. These parameters
13376 give the maximum permissible cost for the sequence that would be generated
13377 by if-conversion depending on whether the branch is statically determined
13378 to be predictable or not. The units for this parameter are the same as
13379 those for the GCC internal seq_cost metric. The compiler will try to
13380 provide a reasonable default for this parameter using the BRANCH_COST
13381 target macro.
13382
13383 @item max-crossjump-edges
13384 The maximum number of incoming edges to consider for cross-jumping.
13385 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
13386 the number of edges incoming to each block. Increasing values mean
13387 more aggressive optimization, making the compilation time increase with
13388 probably small improvement in executable size.
13389
13390 @item min-crossjump-insns
13391 The minimum number of instructions that must be matched at the end
13392 of two blocks before cross-jumping is performed on them. This
13393 value is ignored in the case where all instructions in the block being
13394 cross-jumped from are matched.
13395
13396 @item max-grow-copy-bb-insns
13397 The maximum code size expansion factor when copying basic blocks
13398 instead of jumping. The expansion is relative to a jump instruction.
13399
13400 @item max-goto-duplication-insns
13401 The maximum number of instructions to duplicate to a block that jumps
13402 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
13403 passes, GCC factors computed gotos early in the compilation process,
13404 and unfactors them as late as possible. Only computed jumps at the
13405 end of a basic blocks with no more than max-goto-duplication-insns are
13406 unfactored.
13407
13408 @item max-delay-slot-insn-search
13409 The maximum number of instructions to consider when looking for an
13410 instruction to fill a delay slot. If more than this arbitrary number of
13411 instructions are searched, the time savings from filling the delay slot
13412 are minimal, so stop searching. Increasing values mean more
13413 aggressive optimization, making the compilation time increase with probably
13414 small improvement in execution time.
13415
13416 @item max-delay-slot-live-search
13417 When trying to fill delay slots, the maximum number of instructions to
13418 consider when searching for a block with valid live register
13419 information. Increasing this arbitrarily chosen value means more
13420 aggressive optimization, increasing the compilation time. This parameter
13421 should be removed when the delay slot code is rewritten to maintain the
13422 control-flow graph.
13423
13424 @item max-gcse-memory
13425 The approximate maximum amount of memory in @code{kB} that can be allocated in
13426 order to perform the global common subexpression elimination
13427 optimization. If more memory than specified is required, the
13428 optimization is not done.
13429
13430 @item max-gcse-insertion-ratio
13431 If the ratio of expression insertions to deletions is larger than this value
13432 for any expression, then RTL PRE inserts or removes the expression and thus
13433 leaves partially redundant computations in the instruction stream.
13434
13435 @item max-pending-list-length
13436 The maximum number of pending dependencies scheduling allows
13437 before flushing the current state and starting over. Large functions
13438 with few branches or calls can create excessively large lists which
13439 needlessly consume memory and resources.
13440
13441 @item max-modulo-backtrack-attempts
13442 The maximum number of backtrack attempts the scheduler should make
13443 when modulo scheduling a loop. Larger values can exponentially increase
13444 compilation time.
13445
13446 @item max-inline-insns-single
13447 Several parameters control the tree inliner used in GCC@. This number sets the
13448 maximum number of instructions (counted in GCC's internal representation) in a
13449 single function that the tree inliner considers for inlining. This only
13450 affects functions declared inline and methods implemented in a class
13451 declaration (C++).
13452
13453
13454 @item max-inline-insns-auto
13455 When you use @option{-finline-functions} (included in @option{-O3}),
13456 a lot of functions that would otherwise not be considered for inlining
13457 by the compiler are investigated. To those functions, a different
13458 (more restrictive) limit compared to functions declared inline can
13459 be applied (@option{--param max-inline-insns-auto}).
13460
13461 @item max-inline-insns-small
13462 This is bound applied to calls which are considered relevant with
13463 @option{-finline-small-functions}.
13464
13465 @item max-inline-insns-size
13466 This is bound applied to calls which are optimized for size. Small growth
13467 may be desirable to anticipate optimization oppurtunities exposed by inlining.
13468
13469 @item uninlined-function-insns
13470 Number of instructions accounted by inliner for function overhead such as
13471 function prologue and epilogue.
13472
13473 @item uninlined-function-time
13474 Extra time accounted by inliner for function overhead such as time needed to
13475 execute function prologue and epilogue.
13476
13477 @item inline-heuristics-hint-percent
13478 The scale (in percents) applied to @option{inline-insns-single},
13479 @option{inline-insns-single-O2}, @option{inline-insns-auto}
13480 when inline heuristics hints that inlining is
13481 very profitable (will enable later optimizations).
13482
13483 @item uninlined-thunk-insns
13484 @item uninlined-thunk-time
13485 Same as @option{--param uninlined-function-insns} and
13486 @option{--param uninlined-function-time} but applied to function thunks.
13487
13488 @item inline-min-speedup
13489 When estimated performance improvement of caller + callee runtime exceeds this
13490 threshold (in percent), the function can be inlined regardless of the limit on
13491 @option{--param max-inline-insns-single} and @option{--param
13492 max-inline-insns-auto}.
13493
13494 @item large-function-insns
13495 The limit specifying really large functions. For functions larger than this
13496 limit after inlining, inlining is constrained by
13497 @option{--param large-function-growth}. This parameter is useful primarily
13498 to avoid extreme compilation time caused by non-linear algorithms used by the
13499 back end.
13500
13501 @item large-function-growth
13502 Specifies maximal growth of large function caused by inlining in percents.
13503 For example, parameter value 100 limits large function growth to 2.0 times
13504 the original size.
13505
13506 @item large-unit-insns
13507 The limit specifying large translation unit. Growth caused by inlining of
13508 units larger than this limit is limited by @option{--param inline-unit-growth}.
13509 For small units this might be too tight.
13510 For example, consider a unit consisting of function A
13511 that is inline and B that just calls A three times. If B is small relative to
13512 A, the growth of unit is 300\% and yet such inlining is very sane. For very
13513 large units consisting of small inlineable functions, however, the overall unit
13514 growth limit is needed to avoid exponential explosion of code size. Thus for
13515 smaller units, the size is increased to @option{--param large-unit-insns}
13516 before applying @option{--param inline-unit-growth}.
13517
13518 @item lazy-modules
13519 Maximum number of concurrently open C++ module files when lazy loading.
13520
13521 @item inline-unit-growth
13522 Specifies maximal overall growth of the compilation unit caused by inlining.
13523 For example, parameter value 20 limits unit growth to 1.2 times the original
13524 size. Cold functions (either marked cold via an attribute or by profile
13525 feedback) are not accounted into the unit size.
13526
13527 @item ipa-cp-unit-growth
13528 Specifies maximal overall growth of the compilation unit caused by
13529 interprocedural constant propagation. For example, parameter value 10 limits
13530 unit growth to 1.1 times the original size.
13531
13532 @item ipa-cp-large-unit-insns
13533 The size of translation unit that IPA-CP pass considers large.
13534
13535 @item large-stack-frame
13536 The limit specifying large stack frames. While inlining the algorithm is trying
13537 to not grow past this limit too much.
13538
13539 @item large-stack-frame-growth
13540 Specifies maximal growth of large stack frames caused by inlining in percents.
13541 For example, parameter value 1000 limits large stack frame growth to 11 times
13542 the original size.
13543
13544 @item max-inline-insns-recursive
13545 @itemx max-inline-insns-recursive-auto
13546 Specifies the maximum number of instructions an out-of-line copy of a
13547 self-recursive inline
13548 function can grow into by performing recursive inlining.
13549
13550 @option{--param max-inline-insns-recursive} applies to functions
13551 declared inline.
13552 For functions not declared inline, recursive inlining
13553 happens only when @option{-finline-functions} (included in @option{-O3}) is
13554 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
13555
13556 @item max-inline-recursive-depth
13557 @itemx max-inline-recursive-depth-auto
13558 Specifies the maximum recursion depth used for recursive inlining.
13559
13560 @option{--param max-inline-recursive-depth} applies to functions
13561 declared inline. For functions not declared inline, recursive inlining
13562 happens only when @option{-finline-functions} (included in @option{-O3}) is
13563 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
13564
13565 @item min-inline-recursive-probability
13566 Recursive inlining is profitable only for function having deep recursion
13567 in average and can hurt for function having little recursion depth by
13568 increasing the prologue size or complexity of function body to other
13569 optimizers.
13570
13571 When profile feedback is available (see @option{-fprofile-generate}) the actual
13572 recursion depth can be guessed from the probability that function recurses
13573 via a given call expression. This parameter limits inlining only to call
13574 expressions whose probability exceeds the given threshold (in percents).
13575
13576 @item early-inlining-insns
13577 Specify growth that the early inliner can make. In effect it increases
13578 the amount of inlining for code having a large abstraction penalty.
13579
13580 @item max-early-inliner-iterations
13581 Limit of iterations of the early inliner. This basically bounds
13582 the number of nested indirect calls the early inliner can resolve.
13583 Deeper chains are still handled by late inlining.
13584
13585 @item comdat-sharing-probability
13586 Probability (in percent) that C++ inline function with comdat visibility
13587 are shared across multiple compilation units.
13588
13589 @item modref-max-bases
13590 @item modref-max-refs
13591 @item modref-max-accesses
13592 Specifies the maximal number of base pointers, references and accesses stored
13593 for a single function by mod/ref analysis.
13594
13595 @item modref-max-tests
13596 Specifies the maxmal number of tests alias oracle can perform to disambiguate
13597 memory locations using the mod/ref information. This parameter ought to be
13598 bigger than @option{--param modref-max-bases} and @option{--param
13599 modref-max-refs}.
13600
13601 @item modref-max-depth
13602 Specifies the maximum depth of DFS walk used by modref escape analysis.
13603 Setting to 0 disables the analysis completely.
13604
13605 @item modref-max-escape-points
13606 Specifies the maximum number of escape points tracked by modref per SSA-name.
13607
13608 @item modref-max-adjustments
13609 Specifies the maximum number the access range is enlarged during modref dataflow
13610 analysis.
13611
13612 @item profile-func-internal-id
13613 A parameter to control whether to use function internal id in profile
13614 database lookup. If the value is 0, the compiler uses an id that
13615 is based on function assembler name and filename, which makes old profile
13616 data more tolerant to source changes such as function reordering etc.
13617
13618 @item min-vect-loop-bound
13619 The minimum number of iterations under which loops are not vectorized
13620 when @option{-ftree-vectorize} is used. The number of iterations after
13621 vectorization needs to be greater than the value specified by this option
13622 to allow vectorization.
13623
13624 @item gcse-cost-distance-ratio
13625 Scaling factor in calculation of maximum distance an expression
13626 can be moved by GCSE optimizations. This is currently supported only in the
13627 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
13628 is with simple expressions, i.e., the expressions that have cost
13629 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
13630 hoisting of simple expressions.
13631
13632 @item gcse-unrestricted-cost
13633 Cost, roughly measured as the cost of a single typical machine
13634 instruction, at which GCSE optimizations do not constrain
13635 the distance an expression can travel. This is currently
13636 supported only in the code hoisting pass. The lesser the cost,
13637 the more aggressive code hoisting is. Specifying 0
13638 allows all expressions to travel unrestricted distances.
13639
13640 @item max-hoist-depth
13641 The depth of search in the dominator tree for expressions to hoist.
13642 This is used to avoid quadratic behavior in hoisting algorithm.
13643 The value of 0 does not limit on the search, but may slow down compilation
13644 of huge functions.
13645
13646 @item max-tail-merge-comparisons
13647 The maximum amount of similar bbs to compare a bb with. This is used to
13648 avoid quadratic behavior in tree tail merging.
13649
13650 @item max-tail-merge-iterations
13651 The maximum amount of iterations of the pass over the function. This is used to
13652 limit compilation time in tree tail merging.
13653
13654 @item store-merging-allow-unaligned
13655 Allow the store merging pass to introduce unaligned stores if it is legal to
13656 do so.
13657
13658 @item max-stores-to-merge
13659 The maximum number of stores to attempt to merge into wider stores in the store
13660 merging pass.
13661
13662 @item max-store-chains-to-track
13663 The maximum number of store chains to track at the same time in the attempt
13664 to merge them into wider stores in the store merging pass.
13665
13666 @item max-stores-to-track
13667 The maximum number of stores to track at the same time in the attemt to
13668 to merge them into wider stores in the store merging pass.
13669
13670 @item max-unrolled-insns
13671 The maximum number of instructions that a loop may have to be unrolled.
13672 If a loop is unrolled, this parameter also determines how many times
13673 the loop code is unrolled.
13674
13675 @item max-average-unrolled-insns
13676 The maximum number of instructions biased by probabilities of their execution
13677 that a loop may have to be unrolled. If a loop is unrolled,
13678 this parameter also determines how many times the loop code is unrolled.
13679
13680 @item max-unroll-times
13681 The maximum number of unrollings of a single loop.
13682
13683 @item max-peeled-insns
13684 The maximum number of instructions that a loop may have to be peeled.
13685 If a loop is peeled, this parameter also determines how many times
13686 the loop code is peeled.
13687
13688 @item max-peel-times
13689 The maximum number of peelings of a single loop.
13690
13691 @item max-peel-branches
13692 The maximum number of branches on the hot path through the peeled sequence.
13693
13694 @item max-completely-peeled-insns
13695 The maximum number of insns of a completely peeled loop.
13696
13697 @item max-completely-peel-times
13698 The maximum number of iterations of a loop to be suitable for complete peeling.
13699
13700 @item max-completely-peel-loop-nest-depth
13701 The maximum depth of a loop nest suitable for complete peeling.
13702
13703 @item max-unswitch-insns
13704 The maximum number of insns of an unswitched loop.
13705
13706 @item max-unswitch-level
13707 The maximum number of branches unswitched in a single loop.
13708
13709 @item lim-expensive
13710 The minimum cost of an expensive expression in the loop invariant motion.
13711
13712 @item min-loop-cond-split-prob
13713 When FDO profile information is available, @option{min-loop-cond-split-prob}
13714 specifies minimum threshold for probability of semi-invariant condition
13715 statement to trigger loop split.
13716
13717 @item iv-consider-all-candidates-bound
13718 Bound on number of candidates for induction variables, below which
13719 all candidates are considered for each use in induction variable
13720 optimizations. If there are more candidates than this,
13721 only the most relevant ones are considered to avoid quadratic time complexity.
13722
13723 @item iv-max-considered-uses
13724 The induction variable optimizations give up on loops that contain more
13725 induction variable uses.
13726
13727 @item iv-always-prune-cand-set-bound
13728 If the number of candidates in the set is smaller than this value,
13729 always try to remove unnecessary ivs from the set
13730 when adding a new one.
13731
13732 @item avg-loop-niter
13733 Average number of iterations of a loop.
13734
13735 @item dse-max-object-size
13736 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
13737 Larger values may result in larger compilation times.
13738
13739 @item dse-max-alias-queries-per-store
13740 Maximum number of queries into the alias oracle per store.
13741 Larger values result in larger compilation times and may result in more
13742 removed dead stores.
13743
13744 @item scev-max-expr-size
13745 Bound on size of expressions used in the scalar evolutions analyzer.
13746 Large expressions slow the analyzer.
13747
13748 @item scev-max-expr-complexity
13749 Bound on the complexity of the expressions in the scalar evolutions analyzer.
13750 Complex expressions slow the analyzer.
13751
13752 @item max-tree-if-conversion-phi-args
13753 Maximum number of arguments in a PHI supported by TREE if conversion
13754 unless the loop is marked with simd pragma.
13755
13756 @item vect-max-version-for-alignment-checks
13757 The maximum number of run-time checks that can be performed when
13758 doing loop versioning for alignment in the vectorizer.
13759
13760 @item vect-max-version-for-alias-checks
13761 The maximum number of run-time checks that can be performed when
13762 doing loop versioning for alias in the vectorizer.
13763
13764 @item vect-max-peeling-for-alignment
13765 The maximum number of loop peels to enhance access alignment
13766 for vectorizer. Value -1 means no limit.
13767
13768 @item max-iterations-to-track
13769 The maximum number of iterations of a loop the brute-force algorithm
13770 for analysis of the number of iterations of the loop tries to evaluate.
13771
13772 @item hot-bb-count-fraction
13773 The denominator n of fraction 1/n of the maximal execution count of a
13774 basic block in the entire program that a basic block needs to at least
13775 have in order to be considered hot. The default is 10000, which means
13776 that a basic block is considered hot if its execution count is greater
13777 than 1/10000 of the maximal execution count. 0 means that it is never
13778 considered hot. Used in non-LTO mode.
13779
13780 @item hot-bb-count-ws-permille
13781 The number of most executed permilles, ranging from 0 to 1000, of the
13782 profiled execution of the entire program to which the execution count
13783 of a basic block must be part of in order to be considered hot. The
13784 default is 990, which means that a basic block is considered hot if
13785 its execution count contributes to the upper 990 permilles, or 99.0%,
13786 of the profiled execution of the entire program. 0 means that it is
13787 never considered hot. Used in LTO mode.
13788
13789 @item hot-bb-frequency-fraction
13790 The denominator n of fraction 1/n of the execution frequency of the
13791 entry block of a function that a basic block of this function needs
13792 to at least have in order to be considered hot. The default is 1000,
13793 which means that a basic block is considered hot in a function if it
13794 is executed more frequently than 1/1000 of the frequency of the entry
13795 block of the function. 0 means that it is never considered hot.
13796
13797 @item unlikely-bb-count-fraction
13798 The denominator n of fraction 1/n of the number of profiled runs of
13799 the entire program below which the execution count of a basic block
13800 must be in order for the basic block to be considered unlikely executed.
13801 The default is 20, which means that a basic block is considered unlikely
13802 executed if it is executed in fewer than 1/20, or 5%, of the runs of
13803 the program. 0 means that it is always considered unlikely executed.
13804
13805 @item max-predicted-iterations
13806 The maximum number of loop iterations we predict statically. This is useful
13807 in cases where a function contains a single loop with known bound and
13808 another loop with unknown bound.
13809 The known number of iterations is predicted correctly, while
13810 the unknown number of iterations average to roughly 10. This means that the
13811 loop without bounds appears artificially cold relative to the other one.
13812
13813 @item builtin-expect-probability
13814 Control the probability of the expression having the specified value. This
13815 parameter takes a percentage (i.e.@: 0 ... 100) as input.
13816
13817 @item builtin-string-cmp-inline-length
13818 The maximum length of a constant string for a builtin string cmp call
13819 eligible for inlining.
13820
13821 @item align-threshold
13822
13823 Select fraction of the maximal frequency of executions of a basic block in
13824 a function to align the basic block.
13825
13826 @item align-loop-iterations
13827
13828 A loop expected to iterate at least the selected number of iterations is
13829 aligned.
13830
13831 @item tracer-dynamic-coverage
13832 @itemx tracer-dynamic-coverage-feedback
13833
13834 This value is used to limit superblock formation once the given percentage of
13835 executed instructions is covered. This limits unnecessary code size
13836 expansion.
13837
13838 The @option{tracer-dynamic-coverage-feedback} parameter
13839 is used only when profile
13840 feedback is available. The real profiles (as opposed to statically estimated
13841 ones) are much less balanced allowing the threshold to be larger value.
13842
13843 @item tracer-max-code-growth
13844 Stop tail duplication once code growth has reached given percentage. This is
13845 a rather artificial limit, as most of the duplicates are eliminated later in
13846 cross jumping, so it may be set to much higher values than is the desired code
13847 growth.
13848
13849 @item tracer-min-branch-ratio
13850
13851 Stop reverse growth when the reverse probability of best edge is less than this
13852 threshold (in percent).
13853
13854 @item tracer-min-branch-probability
13855 @itemx tracer-min-branch-probability-feedback
13856
13857 Stop forward growth if the best edge has probability lower than this
13858 threshold.
13859
13860 Similarly to @option{tracer-dynamic-coverage} two parameters are
13861 provided. @option{tracer-min-branch-probability-feedback} is used for
13862 compilation with profile feedback and @option{tracer-min-branch-probability}
13863 compilation without. The value for compilation with profile feedback
13864 needs to be more conservative (higher) in order to make tracer
13865 effective.
13866
13867 @item stack-clash-protection-guard-size
13868 Specify the size of the operating system provided stack guard as
13869 2 raised to @var{num} bytes. Higher values may reduce the
13870 number of explicit probes, but a value larger than the operating system
13871 provided guard will leave code vulnerable to stack clash style attacks.
13872
13873 @item stack-clash-protection-probe-interval
13874 Stack clash protection involves probing stack space as it is allocated. This
13875 param controls the maximum distance between probes into the stack as 2 raised
13876 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
13877 larger than the operating system provided guard will leave code vulnerable to
13878 stack clash style attacks.
13879
13880 @item max-cse-path-length
13881
13882 The maximum number of basic blocks on path that CSE considers.
13883
13884 @item max-cse-insns
13885 The maximum number of instructions CSE processes before flushing.
13886
13887 @item ggc-min-expand
13888
13889 GCC uses a garbage collector to manage its own memory allocation. This
13890 parameter specifies the minimum percentage by which the garbage
13891 collector's heap should be allowed to expand between collections.
13892 Tuning this may improve compilation speed; it has no effect on code
13893 generation.
13894
13895 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
13896 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
13897 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
13898 GCC is not able to calculate RAM on a particular platform, the lower
13899 bound of 30% is used. Setting this parameter and
13900 @option{ggc-min-heapsize} to zero causes a full collection to occur at
13901 every opportunity. This is extremely slow, but can be useful for
13902 debugging.
13903
13904 @item ggc-min-heapsize
13905
13906 Minimum size of the garbage collector's heap before it begins bothering
13907 to collect garbage. The first collection occurs after the heap expands
13908 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
13909 tuning this may improve compilation speed, and has no effect on code
13910 generation.
13911
13912 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
13913 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
13914 with a lower bound of 4096 (four megabytes) and an upper bound of
13915 131072 (128 megabytes). If GCC is not able to calculate RAM on a
13916 particular platform, the lower bound is used. Setting this parameter
13917 very large effectively disables garbage collection. Setting this
13918 parameter and @option{ggc-min-expand} to zero causes a full collection
13919 to occur at every opportunity.
13920
13921 @item max-reload-search-insns
13922 The maximum number of instruction reload should look backward for equivalent
13923 register. Increasing values mean more aggressive optimization, making the
13924 compilation time increase with probably slightly better performance.
13925
13926 @item max-cselib-memory-locations
13927 The maximum number of memory locations cselib should take into account.
13928 Increasing values mean more aggressive optimization, making the compilation time
13929 increase with probably slightly better performance.
13930
13931 @item max-sched-ready-insns
13932 The maximum number of instructions ready to be issued the scheduler should
13933 consider at any given time during the first scheduling pass. Increasing
13934 values mean more thorough searches, making the compilation time increase
13935 with probably little benefit.
13936
13937 @item max-sched-region-blocks
13938 The maximum number of blocks in a region to be considered for
13939 interblock scheduling.
13940
13941 @item max-pipeline-region-blocks
13942 The maximum number of blocks in a region to be considered for
13943 pipelining in the selective scheduler.
13944
13945 @item max-sched-region-insns
13946 The maximum number of insns in a region to be considered for
13947 interblock scheduling.
13948
13949 @item max-pipeline-region-insns
13950 The maximum number of insns in a region to be considered for
13951 pipelining in the selective scheduler.
13952
13953 @item min-spec-prob
13954 The minimum probability (in percents) of reaching a source block
13955 for interblock speculative scheduling.
13956
13957 @item max-sched-extend-regions-iters
13958 The maximum number of iterations through CFG to extend regions.
13959 A value of 0 disables region extensions.
13960
13961 @item max-sched-insn-conflict-delay
13962 The maximum conflict delay for an insn to be considered for speculative motion.
13963
13964 @item sched-spec-prob-cutoff
13965 The minimal probability of speculation success (in percents), so that
13966 speculative insns are scheduled.
13967
13968 @item sched-state-edge-prob-cutoff
13969 The minimum probability an edge must have for the scheduler to save its
13970 state across it.
13971
13972 @item sched-mem-true-dep-cost
13973 Minimal distance (in CPU cycles) between store and load targeting same
13974 memory locations.
13975
13976 @item selsched-max-lookahead
13977 The maximum size of the lookahead window of selective scheduling. It is a
13978 depth of search for available instructions.
13979
13980 @item selsched-max-sched-times
13981 The maximum number of times that an instruction is scheduled during
13982 selective scheduling. This is the limit on the number of iterations
13983 through which the instruction may be pipelined.
13984
13985 @item selsched-insns-to-rename
13986 The maximum number of best instructions in the ready list that are considered
13987 for renaming in the selective scheduler.
13988
13989 @item sms-min-sc
13990 The minimum value of stage count that swing modulo scheduler
13991 generates.
13992
13993 @item max-last-value-rtl
13994 The maximum size measured as number of RTLs that can be recorded in an expression
13995 in combiner for a pseudo register as last known value of that register.
13996
13997 @item max-combine-insns
13998 The maximum number of instructions the RTL combiner tries to combine.
13999
14000 @item integer-share-limit
14001 Small integer constants can use a shared data structure, reducing the
14002 compiler's memory usage and increasing its speed. This sets the maximum
14003 value of a shared integer constant.
14004
14005 @item ssp-buffer-size
14006 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
14007 protection when @option{-fstack-protection} is used.
14008
14009 @item min-size-for-stack-sharing
14010 The minimum size of variables taking part in stack slot sharing when not
14011 optimizing.
14012
14013 @item max-jump-thread-duplication-stmts
14014 Maximum number of statements allowed in a block that needs to be
14015 duplicated when threading jumps.
14016
14017 @item max-fields-for-field-sensitive
14018 Maximum number of fields in a structure treated in
14019 a field sensitive manner during pointer analysis.
14020
14021 @item prefetch-latency
14022 Estimate on average number of instructions that are executed before
14023 prefetch finishes. The distance prefetched ahead is proportional
14024 to this constant. Increasing this number may also lead to less
14025 streams being prefetched (see @option{simultaneous-prefetches}).
14026
14027 @item simultaneous-prefetches
14028 Maximum number of prefetches that can run at the same time.
14029
14030 @item l1-cache-line-size
14031 The size of cache line in L1 data cache, in bytes.
14032
14033 @item l1-cache-size
14034 The size of L1 data cache, in kilobytes.
14035
14036 @item l2-cache-size
14037 The size of L2 data cache, in kilobytes.
14038
14039 @item prefetch-dynamic-strides
14040 Whether the loop array prefetch pass should issue software prefetch hints
14041 for strides that are non-constant. In some cases this may be
14042 beneficial, though the fact the stride is non-constant may make it
14043 hard to predict when there is clear benefit to issuing these hints.
14044
14045 Set to 1 if the prefetch hints should be issued for non-constant
14046 strides. Set to 0 if prefetch hints should be issued only for strides that
14047 are known to be constant and below @option{prefetch-minimum-stride}.
14048
14049 @item prefetch-minimum-stride
14050 Minimum constant stride, in bytes, to start using prefetch hints for. If
14051 the stride is less than this threshold, prefetch hints will not be issued.
14052
14053 This setting is useful for processors that have hardware prefetchers, in
14054 which case there may be conflicts between the hardware prefetchers and
14055 the software prefetchers. If the hardware prefetchers have a maximum
14056 stride they can handle, it should be used here to improve the use of
14057 software prefetchers.
14058
14059 A value of -1 means we don't have a threshold and therefore
14060 prefetch hints can be issued for any constant stride.
14061
14062 This setting is only useful for strides that are known and constant.
14063
14064 @item destructive-interference-size
14065 @item constructive-interference-size
14066 The values for the C++17 variables
14067 @code{std::hardware_destructive_interference_size} and
14068 @code{std::hardware_constructive_interference_size}. The destructive
14069 interference size is the minimum recommended offset between two
14070 independent concurrently-accessed objects; the constructive
14071 interference size is the maximum recommended size of contiguous memory
14072 accessed together. Typically both will be the size of an L1 cache
14073 line for the target, in bytes. For a generic target covering a range of L1
14074 cache line sizes, typically the constructive interference size will be
14075 the small end of the range and the destructive size will be the large
14076 end.
14077
14078 The destructive interference size is intended to be used for layout,
14079 and thus has ABI impact. The default value is not expected to be
14080 stable, and on some targets varies with @option{-mtune}, so use of
14081 this variable in a context where ABI stability is important, such as
14082 the public interface of a library, is strongly discouraged; if it is
14083 used in that context, users can stabilize the value using this
14084 option.
14085
14086 The constructive interference size is less sensitive, as it is
14087 typically only used in a @samp{static_assert} to make sure that a type
14088 fits within a cache line.
14089
14090 See also @option{-Winterference-size}.
14091
14092 @item loop-interchange-max-num-stmts
14093 The maximum number of stmts in a loop to be interchanged.
14094
14095 @item loop-interchange-stride-ratio
14096 The minimum ratio between stride of two loops for interchange to be profitable.
14097
14098 @item min-insn-to-prefetch-ratio
14099 The minimum ratio between the number of instructions and the
14100 number of prefetches to enable prefetching in a loop.
14101
14102 @item prefetch-min-insn-to-mem-ratio
14103 The minimum ratio between the number of instructions and the
14104 number of memory references to enable prefetching in a loop.
14105
14106 @item use-canonical-types
14107 Whether the compiler should use the ``canonical'' type system.
14108 Should always be 1, which uses a more efficient internal
14109 mechanism for comparing types in C++ and Objective-C++. However, if
14110 bugs in the canonical type system are causing compilation failures,
14111 set this value to 0 to disable canonical types.
14112
14113 @item switch-conversion-max-branch-ratio
14114 Switch initialization conversion refuses to create arrays that are
14115 bigger than @option{switch-conversion-max-branch-ratio} times the number of
14116 branches in the switch.
14117
14118 @item max-partial-antic-length
14119 Maximum length of the partial antic set computed during the tree
14120 partial redundancy elimination optimization (@option{-ftree-pre}) when
14121 optimizing at @option{-O3} and above. For some sorts of source code
14122 the enhanced partial redundancy elimination optimization can run away,
14123 consuming all of the memory available on the host machine. This
14124 parameter sets a limit on the length of the sets that are computed,
14125 which prevents the runaway behavior. Setting a value of 0 for
14126 this parameter allows an unlimited set length.
14127
14128 @item rpo-vn-max-loop-depth
14129 Maximum loop depth that is value-numbered optimistically.
14130 When the limit hits the innermost
14131 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
14132 loop nest are value-numbered optimistically and the remaining ones not.
14133
14134 @item sccvn-max-alias-queries-per-access
14135 Maximum number of alias-oracle queries we perform when looking for
14136 redundancies for loads and stores. If this limit is hit the search
14137 is aborted and the load or store is not considered redundant. The
14138 number of queries is algorithmically limited to the number of
14139 stores on all paths from the load to the function entry.
14140
14141 @item ira-max-loops-num
14142 IRA uses regional register allocation by default. If a function
14143 contains more loops than the number given by this parameter, only at most
14144 the given number of the most frequently-executed loops form regions
14145 for regional register allocation.
14146
14147 @item ira-max-conflict-table-size
14148 Although IRA uses a sophisticated algorithm to compress the conflict
14149 table, the table can still require excessive amounts of memory for
14150 huge functions. If the conflict table for a function could be more
14151 than the size in MB given by this parameter, the register allocator
14152 instead uses a faster, simpler, and lower-quality
14153 algorithm that does not require building a pseudo-register conflict table.
14154
14155 @item ira-loop-reserved-regs
14156 IRA can be used to evaluate more accurate register pressure in loops
14157 for decisions to move loop invariants (see @option{-O3}). The number
14158 of available registers reserved for some other purposes is given
14159 by this parameter. Default of the parameter
14160 is the best found from numerous experiments.
14161
14162 @item ira-consider-dup-in-all-alts
14163 Make IRA to consider matching constraint (duplicated operand number)
14164 heavily in all available alternatives for preferred register class.
14165 If it is set as zero, it means IRA only respects the matching
14166 constraint when it's in the only available alternative with an
14167 appropriate register class. Otherwise, it means IRA will check all
14168 available alternatives for preferred register class even if it has
14169 found some choice with an appropriate register class and respect the
14170 found qualified matching constraint.
14171
14172 @item lra-inheritance-ebb-probability-cutoff
14173 LRA tries to reuse values reloaded in registers in subsequent insns.
14174 This optimization is called inheritance. EBB is used as a region to
14175 do this optimization. The parameter defines a minimal fall-through
14176 edge probability in percentage used to add BB to inheritance EBB in
14177 LRA. The default value was chosen
14178 from numerous runs of SPEC2000 on x86-64.
14179
14180 @item loop-invariant-max-bbs-in-loop
14181 Loop invariant motion can be very expensive, both in compilation time and
14182 in amount of needed compile-time memory, with very large loops. Loops
14183 with more basic blocks than this parameter won't have loop invariant
14184 motion optimization performed on them.
14185
14186 @item loop-max-datarefs-for-datadeps
14187 Building data dependencies is expensive for very large loops. This
14188 parameter limits the number of data references in loops that are
14189 considered for data dependence analysis. These large loops are no
14190 handled by the optimizations using loop data dependencies.
14191
14192 @item max-vartrack-size
14193 Sets a maximum number of hash table slots to use during variable
14194 tracking dataflow analysis of any function. If this limit is exceeded
14195 with variable tracking at assignments enabled, analysis for that
14196 function is retried without it, after removing all debug insns from
14197 the function. If the limit is exceeded even without debug insns, var
14198 tracking analysis is completely disabled for the function. Setting
14199 the parameter to zero makes it unlimited.
14200
14201 @item max-vartrack-expr-depth
14202 Sets a maximum number of recursion levels when attempting to map
14203 variable names or debug temporaries to value expressions. This trades
14204 compilation time for more complete debug information. If this is set too
14205 low, value expressions that are available and could be represented in
14206 debug information may end up not being used; setting this higher may
14207 enable the compiler to find more complex debug expressions, but compile
14208 time and memory use may grow.
14209
14210 @item max-debug-marker-count
14211 Sets a threshold on the number of debug markers (e.g.@: begin stmt
14212 markers) to avoid complexity explosion at inlining or expanding to RTL.
14213 If a function has more such gimple stmts than the set limit, such stmts
14214 will be dropped from the inlined copy of a function, and from its RTL
14215 expansion.
14216
14217 @item min-nondebug-insn-uid
14218 Use uids starting at this parameter for nondebug insns. The range below
14219 the parameter is reserved exclusively for debug insns created by
14220 @option{-fvar-tracking-assignments}, but debug insns may get
14221 (non-overlapping) uids above it if the reserved range is exhausted.
14222
14223 @item ipa-sra-ptr-growth-factor
14224 IPA-SRA replaces a pointer to an aggregate with one or more new
14225 parameters only when their cumulative size is less or equal to
14226 @option{ipa-sra-ptr-growth-factor} times the size of the original
14227 pointer parameter.
14228
14229 @item ipa-sra-max-replacements
14230 Maximum pieces of an aggregate that IPA-SRA tracks. As a
14231 consequence, it is also the maximum number of replacements of a formal
14232 parameter.
14233
14234 @item sra-max-scalarization-size-Ospeed
14235 @itemx sra-max-scalarization-size-Osize
14236 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
14237 replace scalar parts of aggregates with uses of independent scalar
14238 variables. These parameters control the maximum size, in storage units,
14239 of aggregate which is considered for replacement when compiling for
14240 speed
14241 (@option{sra-max-scalarization-size-Ospeed}) or size
14242 (@option{sra-max-scalarization-size-Osize}) respectively.
14243
14244 @item sra-max-propagations
14245 The maximum number of artificial accesses that Scalar Replacement of
14246 Aggregates (SRA) will track, per one local variable, in order to
14247 facilitate copy propagation.
14248
14249 @item tm-max-aggregate-size
14250 When making copies of thread-local variables in a transaction, this
14251 parameter specifies the size in bytes after which variables are
14252 saved with the logging functions as opposed to save/restore code
14253 sequence pairs. This option only applies when using
14254 @option{-fgnu-tm}.
14255
14256 @item graphite-max-nb-scop-params
14257 To avoid exponential effects in the Graphite loop transforms, the
14258 number of parameters in a Static Control Part (SCoP) is bounded.
14259 A value of zero can be used to lift
14260 the bound. A variable whose value is unknown at compilation time and
14261 defined outside a SCoP is a parameter of the SCoP.
14262
14263 @item loop-block-tile-size
14264 Loop blocking or strip mining transforms, enabled with
14265 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
14266 loop in the loop nest by a given number of iterations. The strip
14267 length can be changed using the @option{loop-block-tile-size}
14268 parameter.
14269
14270 @item ipa-jump-function-lookups
14271 Specifies number of statements visited during jump function offset discovery.
14272
14273 @item ipa-cp-value-list-size
14274 IPA-CP attempts to track all possible values and types passed to a function's
14275 parameter in order to propagate them and perform devirtualization.
14276 @option{ipa-cp-value-list-size} is the maximum number of values and types it
14277 stores per one formal parameter of a function.
14278
14279 @item ipa-cp-eval-threshold
14280 IPA-CP calculates its own score of cloning profitability heuristics
14281 and performs those cloning opportunities with scores that exceed
14282 @option{ipa-cp-eval-threshold}.
14283
14284 @item ipa-cp-max-recursive-depth
14285 Maximum depth of recursive cloning for self-recursive function.
14286
14287 @item ipa-cp-min-recursive-probability
14288 Recursive cloning only when the probability of call being executed exceeds
14289 the parameter.
14290
14291 @item ipa-cp-profile-count-base
14292 When using @option{-fprofile-use} option, IPA-CP will consider the measured
14293 execution count of a call graph edge at this percentage position in their
14294 histogram as the basis for its heuristics calculation.
14295
14296 @item ipa-cp-recursive-freq-factor
14297 The number of times interprocedural copy propagation expects recursive
14298 functions to call themselves.
14299
14300 @item ipa-cp-recursion-penalty
14301 Percentage penalty the recursive functions will receive when they
14302 are evaluated for cloning.
14303
14304 @item ipa-cp-single-call-penalty
14305 Percentage penalty functions containing a single call to another
14306 function will receive when they are evaluated for cloning.
14307
14308 @item ipa-max-agg-items
14309 IPA-CP is also capable to propagate a number of scalar values passed
14310 in an aggregate. @option{ipa-max-agg-items} controls the maximum
14311 number of such values per one parameter.
14312
14313 @item ipa-cp-loop-hint-bonus
14314 When IPA-CP determines that a cloning candidate would make the number
14315 of iterations of a loop known, it adds a bonus of
14316 @option{ipa-cp-loop-hint-bonus} to the profitability score of
14317 the candidate.
14318
14319 @item ipa-max-loop-predicates
14320 The maximum number of different predicates IPA will use to describe when
14321 loops in a function have known properties.
14322
14323 @item ipa-max-aa-steps
14324 During its analysis of function bodies, IPA-CP employs alias analysis
14325 in order to track values pointed to by function parameters. In order
14326 not spend too much time analyzing huge functions, it gives up and
14327 consider all memory clobbered after examining
14328 @option{ipa-max-aa-steps} statements modifying memory.
14329
14330 @item ipa-max-switch-predicate-bounds
14331 Maximal number of boundary endpoints of case ranges of switch statement.
14332 For switch exceeding this limit, IPA-CP will not construct cloning cost
14333 predicate, which is used to estimate cloning benefit, for default case
14334 of the switch statement.
14335
14336 @item ipa-max-param-expr-ops
14337 IPA-CP will analyze conditional statement that references some function
14338 parameter to estimate benefit for cloning upon certain constant value.
14339 But if number of operations in a parameter expression exceeds
14340 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
14341 one, and is not handled by IPA analysis.
14342
14343 @item lto-partitions
14344 Specify desired number of partitions produced during WHOPR compilation.
14345 The number of partitions should exceed the number of CPUs used for compilation.
14346
14347 @item lto-min-partition
14348 Size of minimal partition for WHOPR (in estimated instructions).
14349 This prevents expenses of splitting very small programs into too many
14350 partitions.
14351
14352 @item lto-max-partition
14353 Size of max partition for WHOPR (in estimated instructions).
14354 to provide an upper bound for individual size of partition.
14355 Meant to be used only with balanced partitioning.
14356
14357 @item lto-max-streaming-parallelism
14358 Maximal number of parallel processes used for LTO streaming.
14359
14360 @item cxx-max-namespaces-for-diagnostic-help
14361 The maximum number of namespaces to consult for suggestions when C++
14362 name lookup fails for an identifier.
14363
14364 @item sink-frequency-threshold
14365 The maximum relative execution frequency (in percents) of the target block
14366 relative to a statement's original block to allow statement sinking of a
14367 statement. Larger numbers result in more aggressive statement sinking.
14368 A small positive adjustment is applied for
14369 statements with memory operands as those are even more profitable so sink.
14370
14371 @item max-stores-to-sink
14372 The maximum number of conditional store pairs that can be sunk. Set to 0
14373 if either vectorization (@option{-ftree-vectorize}) or if-conversion
14374 (@option{-ftree-loop-if-convert}) is disabled.
14375
14376 @item case-values-threshold
14377 The smallest number of different values for which it is best to use a
14378 jump-table instead of a tree of conditional branches. If the value is
14379 0, use the default for the machine.
14380
14381 @item jump-table-max-growth-ratio-for-size
14382 The maximum code size growth ratio when expanding
14383 into a jump table (in percent). The parameter is used when
14384 optimizing for size.
14385
14386 @item jump-table-max-growth-ratio-for-speed
14387 The maximum code size growth ratio when expanding
14388 into a jump table (in percent). The parameter is used when
14389 optimizing for speed.
14390
14391 @item tree-reassoc-width
14392 Set the maximum number of instructions executed in parallel in
14393 reassociated tree. This parameter overrides target dependent
14394 heuristics used by default if has non zero value.
14395
14396 @item sched-pressure-algorithm
14397 Choose between the two available implementations of
14398 @option{-fsched-pressure}. Algorithm 1 is the original implementation
14399 and is the more likely to prevent instructions from being reordered.
14400 Algorithm 2 was designed to be a compromise between the relatively
14401 conservative approach taken by algorithm 1 and the rather aggressive
14402 approach taken by the default scheduler. It relies more heavily on
14403 having a regular register file and accurate register pressure classes.
14404 See @file{haifa-sched.c} in the GCC sources for more details.
14405
14406 The default choice depends on the target.
14407
14408 @item max-slsr-cand-scan
14409 Set the maximum number of existing candidates that are considered when
14410 seeking a basis for a new straight-line strength reduction candidate.
14411
14412 @item asan-globals
14413 Enable buffer overflow detection for global objects. This kind
14414 of protection is enabled by default if you are using
14415 @option{-fsanitize=address} option.
14416 To disable global objects protection use @option{--param asan-globals=0}.
14417
14418 @item asan-stack
14419 Enable buffer overflow detection for stack objects. This kind of
14420 protection is enabled by default when using @option{-fsanitize=address}.
14421 To disable stack protection use @option{--param asan-stack=0} option.
14422
14423 @item asan-instrument-reads
14424 Enable buffer overflow detection for memory reads. This kind of
14425 protection is enabled by default when using @option{-fsanitize=address}.
14426 To disable memory reads protection use
14427 @option{--param asan-instrument-reads=0}.
14428
14429 @item asan-instrument-writes
14430 Enable buffer overflow detection for memory writes. This kind of
14431 protection is enabled by default when using @option{-fsanitize=address}.
14432 To disable memory writes protection use
14433 @option{--param asan-instrument-writes=0} option.
14434
14435 @item asan-memintrin
14436 Enable detection for built-in functions. This kind of protection
14437 is enabled by default when using @option{-fsanitize=address}.
14438 To disable built-in functions protection use
14439 @option{--param asan-memintrin=0}.
14440
14441 @item asan-use-after-return
14442 Enable detection of use-after-return. This kind of protection
14443 is enabled by default when using the @option{-fsanitize=address} option.
14444 To disable it use @option{--param asan-use-after-return=0}.
14445
14446 Note: By default the check is disabled at run time. To enable it,
14447 add @code{detect_stack_use_after_return=1} to the environment variable
14448 @env{ASAN_OPTIONS}.
14449
14450 @item asan-instrumentation-with-call-threshold
14451 If number of memory accesses in function being instrumented
14452 is greater or equal to this number, use callbacks instead of inline checks.
14453 E.g. to disable inline code use
14454 @option{--param asan-instrumentation-with-call-threshold=0}.
14455
14456 @item hwasan-instrument-stack
14457 Enable hwasan instrumentation of statically sized stack-allocated variables.
14458 This kind of instrumentation is enabled by default when using
14459 @option{-fsanitize=hwaddress} and disabled by default when using
14460 @option{-fsanitize=kernel-hwaddress}.
14461 To disable stack instrumentation use
14462 @option{--param hwasan-instrument-stack=0}, and to enable it use
14463 @option{--param hwasan-instrument-stack=1}.
14464
14465 @item hwasan-random-frame-tag
14466 When using stack instrumentation, decide tags for stack variables using a
14467 deterministic sequence beginning at a random tag for each frame. With this
14468 parameter unset tags are chosen using the same sequence but beginning from 1.
14469 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
14470 for @option{-fsanitize=kernel-hwaddress}.
14471 To disable it use @option{--param hwasan-random-frame-tag=0}.
14472
14473 @item hwasan-instrument-allocas
14474 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
14475 This kind of instrumentation is enabled by default when using
14476 @option{-fsanitize=hwaddress} and disabled by default when using
14477 @option{-fsanitize=kernel-hwaddress}.
14478 To disable instrumentation of such variables use
14479 @option{--param hwasan-instrument-allocas=0}, and to enable it use
14480 @option{--param hwasan-instrument-allocas=1}.
14481
14482 @item hwasan-instrument-reads
14483 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
14484 default for both @option{-fsanitize=hwaddress} and
14485 @option{-fsanitize=kernel-hwaddress}.
14486 To disable checking memory reads use
14487 @option{--param hwasan-instrument-reads=0}.
14488
14489 @item hwasan-instrument-writes
14490 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
14491 default for both @option{-fsanitize=hwaddress} and
14492 @option{-fsanitize=kernel-hwaddress}.
14493 To disable checking memory writes use
14494 @option{--param hwasan-instrument-writes=0}.
14495
14496 @item hwasan-instrument-mem-intrinsics
14497 Enable hwasan instrumentation of builtin functions. Instrumentation of these
14498 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
14499 and @option{-fsanitize=kernel-hwaddress}.
14500 To disable instrumentation of builtin functions use
14501 @option{--param hwasan-instrument-mem-intrinsics=0}.
14502
14503 @item use-after-scope-direct-emission-threshold
14504 If the size of a local variable in bytes is smaller or equal to this
14505 number, directly poison (or unpoison) shadow memory instead of using
14506 run-time callbacks.
14507
14508 @item tsan-distinguish-volatile
14509 Emit special instrumentation for accesses to volatiles.
14510
14511 @item tsan-instrument-func-entry-exit
14512 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
14513
14514 @item max-fsm-thread-path-insns
14515 Maximum number of instructions to copy when duplicating blocks on a
14516 finite state automaton jump thread path.
14517
14518 @item max-fsm-thread-length
14519 Maximum number of basic blocks on a jump thread path.
14520
14521 @item parloops-chunk-size
14522 Chunk size of omp schedule for loops parallelized by parloops.
14523
14524 @item parloops-schedule
14525 Schedule type of omp schedule for loops parallelized by parloops (static,
14526 dynamic, guided, auto, runtime).
14527
14528 @item parloops-min-per-thread
14529 The minimum number of iterations per thread of an innermost parallelized
14530 loop for which the parallelized variant is preferred over the single threaded
14531 one. Note that for a parallelized loop nest the
14532 minimum number of iterations of the outermost loop per thread is two.
14533
14534 @item max-ssa-name-query-depth
14535 Maximum depth of recursion when querying properties of SSA names in things
14536 like fold routines. One level of recursion corresponds to following a
14537 use-def chain.
14538
14539 @item max-speculative-devirt-maydefs
14540 The maximum number of may-defs we analyze when looking for a must-def
14541 specifying the dynamic type of an object that invokes a virtual call
14542 we may be able to devirtualize speculatively.
14543
14544 @item max-vrp-switch-assertions
14545 The maximum number of assertions to add along the default edge of a switch
14546 statement during VRP.
14547
14548 @item evrp-sparse-threshold
14549 Maximum number of basic blocks before EVRP uses a sparse cache.
14550
14551 @item evrp-mode
14552 Specifies the mode Early VRP should operate in.
14553
14554 @item vrp1-mode
14555 Specifies the mode VRP pass 1 should operate in.
14556
14557 @item vrp2-mode
14558 Specifies the mode VRP pass 2 should operate in.
14559
14560 @item ranger-debug
14561 Specifies the type of debug output to be issued for ranges.
14562
14563 @item evrp-switch-limit
14564 Specifies the maximum number of switch cases before EVRP ignores a switch.
14565
14566 @item unroll-jam-min-percent
14567 The minimum percentage of memory references that must be optimized
14568 away for the unroll-and-jam transformation to be considered profitable.
14569
14570 @item unroll-jam-max-unroll
14571 The maximum number of times the outer loop should be unrolled by
14572 the unroll-and-jam transformation.
14573
14574 @item max-rtl-if-conversion-unpredictable-cost
14575 Maximum permissible cost for the sequence that would be generated
14576 by the RTL if-conversion pass for a branch that is considered unpredictable.
14577
14578 @item max-variable-expansions-in-unroller
14579 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
14580 of times that an individual variable will be expanded during loop unrolling.
14581
14582 @item tracer-min-branch-probability-feedback
14583 Stop forward growth if the probability of best edge is less than
14584 this threshold (in percent). Used when profile feedback is available.
14585
14586 @item partial-inlining-entry-probability
14587 Maximum probability of the entry BB of split region
14588 (in percent relative to entry BB of the function)
14589 to make partial inlining happen.
14590
14591 @item max-tracked-strlens
14592 Maximum number of strings for which strlen optimization pass will
14593 track string lengths.
14594
14595 @item gcse-after-reload-partial-fraction
14596 The threshold ratio for performing partial redundancy
14597 elimination after reload.
14598
14599 @item gcse-after-reload-critical-fraction
14600 The threshold ratio of critical edges execution count that
14601 permit performing redundancy elimination after reload.
14602
14603 @item max-loop-header-insns
14604 The maximum number of insns in loop header duplicated
14605 by the copy loop headers pass.
14606
14607 @item vect-epilogues-nomask
14608 Enable loop epilogue vectorization using smaller vector size.
14609
14610 @item vect-partial-vector-usage
14611 Controls when the loop vectorizer considers using partial vector loads
14612 and stores as an alternative to falling back to scalar code. 0 stops
14613 the vectorizer from ever using partial vector loads and stores. 1 allows
14614 partial vector loads and stores if vectorization removes the need for the
14615 code to iterate. 2 allows partial vector loads and stores in all loops.
14616 The parameter only has an effect on targets that support partial
14617 vector loads and stores.
14618
14619 @item vect-inner-loop-cost-factor
14620 The maximum factor which the loop vectorizer applies to the cost of statements
14621 in an inner loop relative to the loop being vectorized. The factor applied
14622 is the maximum of the estimated number of iterations of the inner loop and
14623 this parameter. The default value of this parameter is 50.
14624
14625 @item avoid-fma-max-bits
14626 Maximum number of bits for which we avoid creating FMAs.
14627
14628 @item sms-loop-average-count-threshold
14629 A threshold on the average loop count considered by the swing modulo scheduler.
14630
14631 @item sms-dfa-history
14632 The number of cycles the swing modulo scheduler considers when checking
14633 conflicts using DFA.
14634
14635 @item max-inline-insns-recursive-auto
14636 The maximum number of instructions non-inline function
14637 can grow to via recursive inlining.
14638
14639 @item graphite-allow-codegen-errors
14640 Whether codegen errors should be ICEs when @option{-fchecking}.
14641
14642 @item sms-max-ii-factor
14643 A factor for tuning the upper bound that swing modulo scheduler
14644 uses for scheduling a loop.
14645
14646 @item lra-max-considered-reload-pseudos
14647 The max number of reload pseudos which are considered during
14648 spilling a non-reload pseudo.
14649
14650 @item max-pow-sqrt-depth
14651 Maximum depth of sqrt chains to use when synthesizing exponentiation
14652 by a real constant.
14653
14654 @item max-dse-active-local-stores
14655 Maximum number of active local stores in RTL dead store elimination.
14656
14657 @item asan-instrument-allocas
14658 Enable asan allocas/VLAs protection.
14659
14660 @item max-iterations-computation-cost
14661 Bound on the cost of an expression to compute the number of iterations.
14662
14663 @item max-isl-operations
14664 Maximum number of isl operations, 0 means unlimited.
14665
14666 @item graphite-max-arrays-per-scop
14667 Maximum number of arrays per scop.
14668
14669 @item max-vartrack-reverse-op-size
14670 Max. size of loc list for which reverse ops should be added.
14671
14672 @item tracer-dynamic-coverage-feedback
14673 The percentage of function, weighted by execution frequency,
14674 that must be covered by trace formation.
14675 Used when profile feedback is available.
14676
14677 @item max-inline-recursive-depth-auto
14678 The maximum depth of recursive inlining for non-inline functions.
14679
14680 @item fsm-scale-path-stmts
14681 Scale factor to apply to the number of statements in a threading path
14682 when comparing to the number of (scaled) blocks.
14683
14684 @item uninit-control-dep-attempts
14685 Maximum number of nested calls to search for control dependencies
14686 during uninitialized variable analysis.
14687
14688 @item sra-max-scalarization-size-Osize
14689 Maximum size, in storage units, of an aggregate
14690 which should be considered for scalarization when compiling for size.
14691
14692 @item fsm-scale-path-blocks
14693 Scale factor to apply to the number of blocks in a threading path
14694 when comparing to the number of (scaled) statements.
14695
14696 @item sched-autopref-queue-depth
14697 Hardware autoprefetcher scheduler model control flag.
14698 Number of lookahead cycles the model looks into; at '
14699 ' only enable instruction sorting heuristic.
14700
14701 @item loop-versioning-max-inner-insns
14702 The maximum number of instructions that an inner loop can have
14703 before the loop versioning pass considers it too big to copy.
14704
14705 @item loop-versioning-max-outer-insns
14706 The maximum number of instructions that an outer loop can have
14707 before the loop versioning pass considers it too big to copy,
14708 discounting any instructions in inner loops that directly benefit
14709 from versioning.
14710
14711 @item ssa-name-def-chain-limit
14712 The maximum number of SSA_NAME assignments to follow in determining
14713 a property of a variable such as its value. This limits the number
14714 of iterations or recursive calls GCC performs when optimizing certain
14715 statements or when determining their validity prior to issuing
14716 diagnostics.
14717
14718 @item store-merging-max-size
14719 Maximum size of a single store merging region in bytes.
14720
14721 @item hash-table-verification-limit
14722 The number of elements for which hash table verification is done
14723 for each searched element.
14724
14725 @item max-find-base-term-values
14726 Maximum number of VALUEs handled during a single find_base_term call.
14727
14728 @item analyzer-max-enodes-per-program-point
14729 The maximum number of exploded nodes per program point within
14730 the analyzer, before terminating analysis of that point.
14731
14732 @item analyzer-max-constraints
14733 The maximum number of constraints per state.
14734
14735 @item analyzer-min-snodes-for-call-summary
14736 The minimum number of supernodes within a function for the
14737 analyzer to consider summarizing its effects at call sites.
14738
14739 @item analyzer-max-enodes-for-full-dump
14740 The maximum depth of exploded nodes that should appear in a dot dump
14741 before switching to a less verbose format.
14742
14743 @item analyzer-max-recursion-depth
14744 The maximum number of times a callsite can appear in a call stack
14745 within the analyzer, before terminating analysis of a call that would
14746 recurse deeper.
14747
14748 @item analyzer-max-svalue-depth
14749 The maximum depth of a symbolic value, before approximating
14750 the value as unknown.
14751
14752 @item analyzer-max-infeasible-edges
14753 The maximum number of infeasible edges to reject before declaring
14754 a diagnostic as infeasible.
14755
14756 @item gimple-fe-computed-hot-bb-threshold
14757 The number of executions of a basic block which is considered hot.
14758 The parameter is used only in GIMPLE FE.
14759
14760 @item analyzer-bb-explosion-factor
14761 The maximum number of 'after supernode' exploded nodes within the analyzer
14762 per supernode, before terminating analysis.
14763
14764 @item ranger-logical-depth
14765 Maximum depth of logical expression evaluation ranger will look through
14766 when evaluating outgoing edge ranges.
14767
14768 @item openacc-kernels
14769 Specify mode of OpenACC `kernels' constructs handling.
14770 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
14771 constructs are decomposed into parts, a sequence of compute
14772 constructs, each then handled individually.
14773 This is work in progress.
14774 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
14775 constructs are handled by the @samp{parloops} pass, en bloc.
14776 This is the current default.
14777
14778 @item openacc-privatization
14779 Specify mode of OpenACC privatization diagnostics for
14780 @option{-fopt-info-omp-note} and applicable
14781 @option{-fdump-tree-*-details}.
14782 With @option{--param=openacc-privatization=quiet}, don't diagnose.
14783 This is the current default.
14784 With @option{--param=openacc-privatization=noisy}, do diagnose.
14785
14786 @end table
14787
14788 The following choices of @var{name} are available on AArch64 targets:
14789
14790 @table @gcctabopt
14791 @item aarch64-sve-compare-costs
14792 When vectorizing for SVE, consider using ``unpacked'' vectors for
14793 smaller elements and use the cost model to pick the cheapest approach.
14794 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
14795
14796 Using unpacked vectors includes storing smaller elements in larger
14797 containers and accessing elements with extending loads and truncating
14798 stores.
14799
14800 @item aarch64-float-recp-precision
14801 The number of Newton iterations for calculating the reciprocal for float type.
14802 The precision of division is proportional to this param when division
14803 approximation is enabled. The default value is 1.
14804
14805 @item aarch64-double-recp-precision
14806 The number of Newton iterations for calculating the reciprocal for double type.
14807 The precision of division is propotional to this param when division
14808 approximation is enabled. The default value is 2.
14809
14810 @item aarch64-autovec-preference
14811 Force an ISA selection strategy for auto-vectorization. Accepts values from
14812 0 to 4, inclusive.
14813 @table @samp
14814 @item 0
14815 Use the default heuristics.
14816 @item 1
14817 Use only Advanced SIMD for auto-vectorization.
14818 @item 2
14819 Use only SVE for auto-vectorization.
14820 @item 3
14821 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
14822 deemed equal.
14823 @item 4
14824 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
14825 @end table
14826 The default value is 0.
14827
14828 @item aarch64-loop-vect-issue-rate-niters
14829 The tuning for some AArch64 CPUs tries to take both latencies and issue
14830 rates into account when deciding whether a loop should be vectorized
14831 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
14832 If this parameter is set to @var{n}, GCC will not use this heuristic
14833 for loops that are known to execute in fewer than @var{n} Advanced
14834 SIMD iterations.
14835
14836 @end table
14837
14838 @end table
14839
14840 @node Instrumentation Options
14841 @section Program Instrumentation Options
14842 @cindex instrumentation options
14843 @cindex program instrumentation options
14844 @cindex run-time error checking options
14845 @cindex profiling options
14846 @cindex options, program instrumentation
14847 @cindex options, run-time error checking
14848 @cindex options, profiling
14849
14850 GCC supports a number of command-line options that control adding
14851 run-time instrumentation to the code it normally generates.
14852 For example, one purpose of instrumentation is collect profiling
14853 statistics for use in finding program hot spots, code coverage
14854 analysis, or profile-guided optimizations.
14855 Another class of program instrumentation is adding run-time checking
14856 to detect programming errors like invalid pointer
14857 dereferences or out-of-bounds array accesses, as well as deliberately
14858 hostile attacks such as stack smashing or C++ vtable hijacking.
14859 There is also a general hook which can be used to implement other
14860 forms of tracing or function-level instrumentation for debug or
14861 program analysis purposes.
14862
14863 @table @gcctabopt
14864 @cindex @command{prof}
14865 @cindex @command{gprof}
14866 @item -p
14867 @itemx -pg
14868 @opindex p
14869 @opindex pg
14870 Generate extra code to write profile information suitable for the
14871 analysis program @command{prof} (for @option{-p}) or @command{gprof}
14872 (for @option{-pg}). You must use this option when compiling
14873 the source files you want data about, and you must also use it when
14874 linking.
14875
14876 You can use the function attribute @code{no_instrument_function} to
14877 suppress profiling of individual functions when compiling with these options.
14878 @xref{Common Function Attributes}.
14879
14880 @item -fprofile-arcs
14881 @opindex fprofile-arcs
14882 Add code so that program flow @dfn{arcs} are instrumented. During
14883 execution the program records how many times each branch and call is
14884 executed and how many times it is taken or returns. On targets that support
14885 constructors with priority support, profiling properly handles constructors,
14886 destructors and C++ constructors (and destructors) of classes which are used
14887 as a type of a global variable.
14888
14889 When the compiled
14890 program exits it saves this data to a file called
14891 @file{@var{auxname}.gcda} for each source file. The data may be used for
14892 profile-directed optimizations (@option{-fbranch-probabilities}), or for
14893 test coverage analysis (@option{-ftest-coverage}). Each object file's
14894 @var{auxname} is generated from the name of the output file, if
14895 explicitly specified and it is not the final executable, otherwise it is
14896 the basename of the source file. In both cases any suffix is removed
14897 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
14898 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
14899 @xref{Cross-profiling}.
14900
14901 @cindex @command{gcov}
14902 @item --coverage
14903 @opindex coverage
14904
14905 This option is used to compile and link code instrumented for coverage
14906 analysis. The option is a synonym for @option{-fprofile-arcs}
14907 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
14908 linking). See the documentation for those options for more details.
14909
14910 @itemize
14911
14912 @item
14913 Compile the source files with @option{-fprofile-arcs} plus optimization
14914 and code generation options. For test coverage analysis, use the
14915 additional @option{-ftest-coverage} option. You do not need to profile
14916 every source file in a program.
14917
14918 @item
14919 Compile the source files additionally with @option{-fprofile-abs-path}
14920 to create absolute path names in the @file{.gcno} files. This allows
14921 @command{gcov} to find the correct sources in projects where compilations
14922 occur with different working directories.
14923
14924 @item
14925 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
14926 (the latter implies the former).
14927
14928 @item
14929 Run the program on a representative workload to generate the arc profile
14930 information. This may be repeated any number of times. You can run
14931 concurrent instances of your program, and provided that the file system
14932 supports locking, the data files will be correctly updated. Unless
14933 a strict ISO C dialect option is in effect, @code{fork} calls are
14934 detected and correctly handled without double counting.
14935
14936 Moreover, an object file can be recompiled multiple times
14937 and the corresponding @file{.gcda} file merges as long as
14938 the source file and the compiler options are unchanged.
14939
14940 @item
14941 For profile-directed optimizations, compile the source files again with
14942 the same optimization and code generation options plus
14943 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
14944 Control Optimization}).
14945
14946 @item
14947 For test coverage analysis, use @command{gcov} to produce human readable
14948 information from the @file{.gcno} and @file{.gcda} files. Refer to the
14949 @command{gcov} documentation for further information.
14950
14951 @end itemize
14952
14953 With @option{-fprofile-arcs}, for each function of your program GCC
14954 creates a program flow graph, then finds a spanning tree for the graph.
14955 Only arcs that are not on the spanning tree have to be instrumented: the
14956 compiler adds code to count the number of times that these arcs are
14957 executed. When an arc is the only exit or only entrance to a block, the
14958 instrumentation code can be added to the block; otherwise, a new basic
14959 block must be created to hold the instrumentation code.
14960
14961 @need 2000
14962 @item -ftest-coverage
14963 @opindex ftest-coverage
14964 Produce a notes file that the @command{gcov} code-coverage utility
14965 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
14966 show program coverage. Each source file's note file is called
14967 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
14968 above for a description of @var{auxname} and instructions on how to
14969 generate test coverage data. Coverage data matches the source files
14970 more closely if you do not optimize.
14971
14972 @item -fprofile-abs-path
14973 @opindex fprofile-abs-path
14974 Automatically convert relative source file names to absolute path names
14975 in the @file{.gcno} files. This allows @command{gcov} to find the correct
14976 sources in projects where compilations occur with different working
14977 directories.
14978
14979 @item -fprofile-dir=@var{path}
14980 @opindex fprofile-dir
14981
14982 Set the directory to search for the profile data files in to @var{path}.
14983 This option affects only the profile data generated by
14984 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
14985 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
14986 and its related options. Both absolute and relative paths can be used.
14987 By default, GCC uses the current directory as @var{path}, thus the
14988 profile data file appears in the same directory as the object file.
14989 In order to prevent the file name clashing, if the object file name is
14990 not an absolute path, we mangle the absolute path of the
14991 @file{@var{sourcename}.gcda} file and use it as the file name of a
14992 @file{.gcda} file. See similar option @option{-fprofile-note}.
14993
14994 When an executable is run in a massive parallel environment, it is recommended
14995 to save profile to different folders. That can be done with variables
14996 in @var{path} that are exported during run-time:
14997
14998 @table @gcctabopt
14999
15000 @item %p
15001 process ID.
15002
15003 @item %q@{VAR@}
15004 value of environment variable @var{VAR}
15005
15006 @end table
15007
15008 @item -fprofile-generate
15009 @itemx -fprofile-generate=@var{path}
15010 @opindex fprofile-generate
15011
15012 Enable options usually used for instrumenting application to produce
15013 profile useful for later recompilation with profile feedback based
15014 optimization. You must use @option{-fprofile-generate} both when
15015 compiling and when linking your program.
15016
15017 The following options are enabled:
15018 @option{-fprofile-arcs}, @option{-fprofile-values},
15019 @option{-finline-functions}, and @option{-fipa-bit-cp}.
15020
15021 If @var{path} is specified, GCC looks at the @var{path} to find
15022 the profile feedback data files. See @option{-fprofile-dir}.
15023
15024 To optimize the program based on the collected profile information, use
15025 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
15026
15027 @item -fprofile-info-section
15028 @itemx -fprofile-info-section=@var{name}
15029 @opindex fprofile-info-section
15030
15031 Register the profile information in the specified section instead of using a
15032 constructor/destructor. The section name is @var{name} if it is specified,
15033 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
15034 profile information generated by @option{-fprofile-arcs} is placed in the
15035 specified section for each translation unit. This option disables the profile
15036 information registration through a constructor and it disables the profile
15037 information processing through a destructor. This option is not intended to be
15038 used in hosted environments such as GNU/Linux. It targets free-standing
15039 environments (for example embedded systems) with limited resources which do not
15040 support constructors/destructors or the C library file I/O.
15041
15042 The linker could collect the input sections in a continuous memory block and
15043 define start and end symbols. A GNU linker script example which defines a
15044 linker output section follows:
15045
15046 @smallexample
15047 .gcov_info :
15048 @{
15049 PROVIDE (__gcov_info_start = .);
15050 KEEP (*(.gcov_info))
15051 PROVIDE (__gcov_info_end = .);
15052 @}
15053 @end smallexample
15054
15055 The program could dump the profiling information registered in this linker set
15056 for example like this:
15057
15058 @smallexample
15059 #include <gcov.h>
15060 #include <stdio.h>
15061 #include <stdlib.h>
15062
15063 extern const struct gcov_info *__gcov_info_start[];
15064 extern const struct gcov_info *__gcov_info_end[];
15065
15066 static void
15067 filename (const char *f, void *arg)
15068 @{
15069 puts (f);
15070 @}
15071
15072 static void
15073 dump (const void *d, unsigned n, void *arg)
15074 @{
15075 const unsigned char *c = d;
15076
15077 for (unsigned i = 0; i < n; ++i)
15078 printf ("%02x", c[i]);
15079 @}
15080
15081 static void *
15082 allocate (unsigned length, void *arg)
15083 @{
15084 return malloc (length);
15085 @}
15086
15087 static void
15088 dump_gcov_info (void)
15089 @{
15090 const struct gcov_info **info = __gcov_info_start;
15091 const struct gcov_info **end = __gcov_info_end;
15092
15093 /* Obfuscate variable to prevent compiler optimizations. */
15094 __asm__ ("" : "+r" (info));
15095
15096 while (info != end)
15097 @{
15098 void *arg = NULL;
15099 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
15100 putchar ('\n');
15101 ++info;
15102 @}
15103 @}
15104
15105 int
15106 main()
15107 @{
15108 dump_gcov_info();
15109 return 0;
15110 @}
15111 @end smallexample
15112
15113 @item -fprofile-note=@var{path}
15114 @opindex fprofile-note
15115
15116 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
15117 location. If you combine the option with multiple source files,
15118 the @file{.gcno} file will be overwritten.
15119
15120 @item -fprofile-prefix-path=@var{path}
15121 @opindex fprofile-prefix-path
15122
15123 This option can be used in combination with
15124 @option{profile-generate=}@var{profile_dir} and
15125 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
15126 directory of built source tree. By default @var{profile_dir} will contain
15127 files with mangled absolute paths of all object files in the built project.
15128 This is not desirable when directory used to build the instrumented binary
15129 differs from the directory used to build the binary optimized with profile
15130 feedback because the profile data will not be found during the optimized build.
15131 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
15132 pointing to the base directory of the build can be used to strip the irrelevant
15133 part of the path and keep all file names relative to the main build directory.
15134
15135 @item -fprofile-update=@var{method}
15136 @opindex fprofile-update
15137
15138 Alter the update method for an application instrumented for profile
15139 feedback based optimization. The @var{method} argument should be one of
15140 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
15141 The first one is useful for single-threaded applications,
15142 while the second one prevents profile corruption by emitting thread-safe code.
15143
15144 @strong{Warning:} When an application does not properly join all threads
15145 (or creates an detached thread), a profile file can be still corrupted.
15146
15147 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
15148 when supported by a target, or to @samp{single} otherwise. The GCC driver
15149 automatically selects @samp{prefer-atomic} when @option{-pthread}
15150 is present in the command line.
15151
15152 @item -fprofile-filter-files=@var{regex}
15153 @opindex fprofile-filter-files
15154
15155 Instrument only functions from files whose name matches
15156 any of the regular expressions (separated by semi-colons).
15157
15158 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
15159 only @file{main.c} and all C files starting with 'module'.
15160
15161 @item -fprofile-exclude-files=@var{regex}
15162 @opindex fprofile-exclude-files
15163
15164 Instrument only functions from files whose name does not match
15165 any of the regular expressions (separated by semi-colons).
15166
15167 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
15168 of all files that are located in the @file{/usr/} folder.
15169
15170 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
15171 @opindex fprofile-reproducible
15172 Control level of reproducibility of profile gathered by
15173 @code{-fprofile-generate}. This makes it possible to rebuild program
15174 with same outcome which is useful, for example, for distribution
15175 packages.
15176
15177 With @option{-fprofile-reproducible=serial} the profile gathered by
15178 @option{-fprofile-generate} is reproducible provided the trained program
15179 behaves the same at each invocation of the train run, it is not
15180 multi-threaded and profile data streaming is always done in the same
15181 order. Note that profile streaming happens at the end of program run but
15182 also before @code{fork} function is invoked.
15183
15184 Note that it is quite common that execution counts of some part of
15185 programs depends, for example, on length of temporary file names or
15186 memory space randomization (that may affect hash-table collision rate).
15187 Such non-reproducible part of programs may be annotated by
15188 @code{no_instrument_function} function attribute. @command{gcov-dump} with
15189 @option{-l} can be used to dump gathered data and verify that they are
15190 indeed reproducible.
15191
15192 With @option{-fprofile-reproducible=parallel-runs} collected profile
15193 stays reproducible regardless the order of streaming of the data into
15194 gcda files. This setting makes it possible to run multiple instances of
15195 instrumented program in parallel (such as with @code{make -j}). This
15196 reduces quality of gathered data, in particular of indirect call
15197 profiling.
15198
15199 @item -fsanitize=address
15200 @opindex fsanitize=address
15201 Enable AddressSanitizer, a fast memory error detector.
15202 Memory access instructions are instrumented to detect
15203 out-of-bounds and use-after-free bugs.
15204 The option enables @option{-fsanitize-address-use-after-scope}.
15205 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
15206 more details. The run-time behavior can be influenced using the
15207 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
15208 the available options are shown at startup of the instrumented program. See
15209 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
15210 for a list of supported options.
15211 The option cannot be combined with @option{-fsanitize=thread} or
15212 @option{-fsanitize=hwaddress}. Note that the only target
15213 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
15214
15215 @item -fsanitize=kernel-address
15216 @opindex fsanitize=kernel-address
15217 Enable AddressSanitizer for Linux kernel.
15218 See @uref{https://github.com/google/kasan} for more details.
15219
15220 @item -fsanitize=hwaddress
15221 @opindex fsanitize=hwaddress
15222 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
15223 ignore the top byte of a pointer to allow the detection of memory errors with
15224 a low memory overhead.
15225 Memory access instructions are instrumented to detect out-of-bounds and
15226 use-after-free bugs.
15227 The option enables @option{-fsanitize-address-use-after-scope}.
15228 See
15229 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
15230 for more details. The run-time behavior can be influenced using the
15231 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
15232 the available options are shown at startup of the instrumented program.
15233 The option cannot be combined with @option{-fsanitize=thread} or
15234 @option{-fsanitize=address}, and is currently only available on AArch64.
15235
15236 @item -fsanitize=kernel-hwaddress
15237 @opindex fsanitize=kernel-hwaddress
15238 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
15239 Similar to @option{-fsanitize=kernel-address} but using an alternate
15240 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
15241 instrumentation differences necessary for compiling the Linux kernel.
15242 These differences are to avoid hwasan library initialization calls and to
15243 account for the stack pointer having a different value in its top byte.
15244
15245 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
15246 Instrumenting the stack and alloca calls are not on by default but are still
15247 possible by specifying the command-line options
15248 @option{--param hwasan-instrument-stack=1} and
15249 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
15250 tag is not implemented for kernel instrumentation.
15251
15252 @item -fsanitize=pointer-compare
15253 @opindex fsanitize=pointer-compare
15254 Instrument comparison operation (<, <=, >, >=) with pointer operands.
15255 The option must be combined with either @option{-fsanitize=kernel-address} or
15256 @option{-fsanitize=address}
15257 The option cannot be combined with @option{-fsanitize=thread}.
15258 Note: By default the check is disabled at run time. To enable it,
15259 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15260 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15261 invalid operation only when both pointers are non-null.
15262
15263 @item -fsanitize=pointer-subtract
15264 @opindex fsanitize=pointer-subtract
15265 Instrument subtraction with pointer operands.
15266 The option must be combined with either @option{-fsanitize=kernel-address} or
15267 @option{-fsanitize=address}
15268 The option cannot be combined with @option{-fsanitize=thread}.
15269 Note: By default the check is disabled at run time. To enable it,
15270 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15271 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15272 invalid operation only when both pointers are non-null.
15273
15274 @item -fsanitize=thread
15275 @opindex fsanitize=thread
15276 Enable ThreadSanitizer, a fast data race detector.
15277 Memory access instructions are instrumented to detect
15278 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
15279 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
15280 environment variable; see
15281 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
15282 supported options.
15283 The option cannot be combined with @option{-fsanitize=address},
15284 @option{-fsanitize=leak}.
15285
15286 Note that sanitized atomic builtins cannot throw exceptions when
15287 operating on invalid memory addresses with non-call exceptions
15288 (@option{-fnon-call-exceptions}).
15289
15290 @item -fsanitize=leak
15291 @opindex fsanitize=leak
15292 Enable LeakSanitizer, a memory leak detector.
15293 This option only matters for linking of executables and
15294 the executable is linked against a library that overrides @code{malloc}
15295 and other allocator functions. See
15296 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
15297 details. The run-time behavior can be influenced using the
15298 @env{LSAN_OPTIONS} environment variable.
15299 The option cannot be combined with @option{-fsanitize=thread}.
15300
15301 @item -fsanitize=undefined
15302 @opindex fsanitize=undefined
15303 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
15304 Various computations are instrumented to detect undefined behavior
15305 at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the
15306 @env{UBSAN_OPTIONS} environment variable. Current suboptions are:
15307
15308 @table @gcctabopt
15309
15310 @item -fsanitize=shift
15311 @opindex fsanitize=shift
15312 This option enables checking that the result of a shift operation is
15313 not undefined. Note that what exactly is considered undefined differs
15314 slightly between C and C++, as well as between ISO C90 and C99, etc.
15315 This option has two suboptions, @option{-fsanitize=shift-base} and
15316 @option{-fsanitize=shift-exponent}.
15317
15318 @item -fsanitize=shift-exponent
15319 @opindex fsanitize=shift-exponent
15320 This option enables checking that the second argument of a shift operation
15321 is not negative and is smaller than the precision of the promoted first
15322 argument.
15323
15324 @item -fsanitize=shift-base
15325 @opindex fsanitize=shift-base
15326 If the second argument of a shift operation is within range, check that the
15327 result of a shift operation is not undefined. Note that what exactly is
15328 considered undefined differs slightly between C and C++, as well as between
15329 ISO C90 and C99, etc.
15330
15331 @item -fsanitize=integer-divide-by-zero
15332 @opindex fsanitize=integer-divide-by-zero
15333 Detect integer division by zero.
15334
15335 @item -fsanitize=unreachable
15336 @opindex fsanitize=unreachable
15337 With this option, the compiler turns the @code{__builtin_unreachable}
15338 call into a diagnostics message call instead. When reaching the
15339 @code{__builtin_unreachable} call, the behavior is undefined.
15340
15341 @item -fsanitize=vla-bound
15342 @opindex fsanitize=vla-bound
15343 This option instructs the compiler to check that the size of a variable
15344 length array is positive.
15345
15346 @item -fsanitize=null
15347 @opindex fsanitize=null
15348 This option enables pointer checking. Particularly, the application
15349 built with this option turned on will issue an error message when it
15350 tries to dereference a NULL pointer, or if a reference (possibly an
15351 rvalue reference) is bound to a NULL pointer, or if a method is invoked
15352 on an object pointed by a NULL pointer.
15353
15354 @item -fsanitize=return
15355 @opindex fsanitize=return
15356 This option enables return statement checking. Programs
15357 built with this option turned on will issue an error message
15358 when the end of a non-void function is reached without actually
15359 returning a value. This option works in C++ only.
15360
15361 @item -fsanitize=signed-integer-overflow
15362 @opindex fsanitize=signed-integer-overflow
15363 This option enables signed integer overflow checking. We check that
15364 the result of @code{+}, @code{*}, and both unary and binary @code{-}
15365 does not overflow in the signed arithmetics. This also detects
15366 @code{INT_MIN / -1} signed division. Note, integer promotion
15367 rules must be taken into account. That is, the following is not an
15368 overflow:
15369 @smallexample
15370 signed char a = SCHAR_MAX;
15371 a++;
15372 @end smallexample
15373
15374 @item -fsanitize=bounds
15375 @opindex fsanitize=bounds
15376 This option enables instrumentation of array bounds. Various out of bounds
15377 accesses are detected. Flexible array members, flexible array member-like
15378 arrays, and initializers of variables with static storage are not instrumented.
15379
15380 @item -fsanitize=bounds-strict
15381 @opindex fsanitize=bounds-strict
15382 This option enables strict instrumentation of array bounds. Most out of bounds
15383 accesses are detected, including flexible array members and flexible array
15384 member-like arrays. Initializers of variables with static storage are not
15385 instrumented.
15386
15387 @item -fsanitize=alignment
15388 @opindex fsanitize=alignment
15389
15390 This option enables checking of alignment of pointers when they are
15391 dereferenced, or when a reference is bound to insufficiently aligned target,
15392 or when a method or constructor is invoked on insufficiently aligned object.
15393
15394 @item -fsanitize=object-size
15395 @opindex fsanitize=object-size
15396 This option enables instrumentation of memory references using the
15397 @code{__builtin_object_size} function. Various out of bounds pointer
15398 accesses are detected.
15399
15400 @item -fsanitize=float-divide-by-zero
15401 @opindex fsanitize=float-divide-by-zero
15402 Detect floating-point division by zero. Unlike other similar options,
15403 @option{-fsanitize=float-divide-by-zero} is not enabled by
15404 @option{-fsanitize=undefined}, since floating-point division by zero can
15405 be a legitimate way of obtaining infinities and NaNs.
15406
15407 @item -fsanitize=float-cast-overflow
15408 @opindex fsanitize=float-cast-overflow
15409 This option enables floating-point type to integer conversion checking.
15410 We check that the result of the conversion does not overflow.
15411 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
15412 not enabled by @option{-fsanitize=undefined}.
15413 This option does not work well with @code{FE_INVALID} exceptions enabled.
15414
15415 @item -fsanitize=nonnull-attribute
15416 @opindex fsanitize=nonnull-attribute
15417
15418 This option enables instrumentation of calls, checking whether null values
15419 are not passed to arguments marked as requiring a non-null value by the
15420 @code{nonnull} function attribute.
15421
15422 @item -fsanitize=returns-nonnull-attribute
15423 @opindex fsanitize=returns-nonnull-attribute
15424
15425 This option enables instrumentation of return statements in functions
15426 marked with @code{returns_nonnull} function attribute, to detect returning
15427 of null values from such functions.
15428
15429 @item -fsanitize=bool
15430 @opindex fsanitize=bool
15431
15432 This option enables instrumentation of loads from bool. If a value other
15433 than 0/1 is loaded, a run-time error is issued.
15434
15435 @item -fsanitize=enum
15436 @opindex fsanitize=enum
15437
15438 This option enables instrumentation of loads from an enum type. If
15439 a value outside the range of values for the enum type is loaded,
15440 a run-time error is issued.
15441
15442 @item -fsanitize=vptr
15443 @opindex fsanitize=vptr
15444
15445 This option enables instrumentation of C++ member function calls, member
15446 accesses and some conversions between pointers to base and derived classes,
15447 to verify the referenced object has the correct dynamic type.
15448
15449 @item -fsanitize=pointer-overflow
15450 @opindex fsanitize=pointer-overflow
15451
15452 This option enables instrumentation of pointer arithmetics. If the pointer
15453 arithmetics overflows, a run-time error is issued.
15454
15455 @item -fsanitize=builtin
15456 @opindex fsanitize=builtin
15457
15458 This option enables instrumentation of arguments to selected builtin
15459 functions. If an invalid value is passed to such arguments, a run-time
15460 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
15461 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
15462 by this option.
15463
15464 @end table
15465
15466 While @option{-ftrapv} causes traps for signed overflows to be emitted,
15467 @option{-fsanitize=undefined} gives a diagnostic message.
15468 This currently works only for the C family of languages.
15469
15470 @item -fno-sanitize=all
15471 @opindex fno-sanitize=all
15472
15473 This option disables all previously enabled sanitizers.
15474 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
15475 together.
15476
15477 @item -fasan-shadow-offset=@var{number}
15478 @opindex fasan-shadow-offset
15479 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
15480 It is useful for experimenting with different shadow memory layouts in
15481 Kernel AddressSanitizer.
15482
15483 @item -fsanitize-sections=@var{s1},@var{s2},...
15484 @opindex fsanitize-sections
15485 Sanitize global variables in selected user-defined sections. @var{si} may
15486 contain wildcards.
15487
15488 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
15489 @opindex fsanitize-recover
15490 @opindex fno-sanitize-recover
15491 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
15492 mentioned in comma-separated list of @var{opts}. Enabling this option
15493 for a sanitizer component causes it to attempt to continue
15494 running the program as if no error happened. This means multiple
15495 runtime errors can be reported in a single program run, and the exit
15496 code of the program may indicate success even when errors
15497 have been reported. The @option{-fno-sanitize-recover=} option
15498 can be used to alter
15499 this behavior: only the first detected error is reported
15500 and program then exits with a non-zero exit code.
15501
15502 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
15503 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
15504 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
15505 @option{-fsanitize=bounds-strict},
15506 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
15507 For these sanitizers error recovery is turned on by default,
15508 except @option{-fsanitize=address}, for which this feature is experimental.
15509 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
15510 accepted, the former enables recovery for all sanitizers that support it,
15511 the latter disables recovery for all sanitizers that support it.
15512
15513 Even if a recovery mode is turned on the compiler side, it needs to be also
15514 enabled on the runtime library side, otherwise the failures are still fatal.
15515 The runtime library defaults to @code{halt_on_error=0} for
15516 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
15517 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
15518 setting the @code{halt_on_error} flag in the corresponding environment variable.
15519
15520 Syntax without an explicit @var{opts} parameter is deprecated. It is
15521 equivalent to specifying an @var{opts} list of:
15522
15523 @smallexample
15524 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
15525 @end smallexample
15526
15527 @item -fsanitize-address-use-after-scope
15528 @opindex fsanitize-address-use-after-scope
15529 Enable sanitization of local variables to detect use-after-scope bugs.
15530 The option sets @option{-fstack-reuse} to @samp{none}.
15531
15532 @item -fsanitize-undefined-trap-on-error
15533 @opindex fsanitize-undefined-trap-on-error
15534 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
15535 report undefined behavior using @code{__builtin_trap} rather than
15536 a @code{libubsan} library routine. The advantage of this is that the
15537 @code{libubsan} library is not needed and is not linked in, so this
15538 is usable even in freestanding environments.
15539
15540 @item -fsanitize-coverage=trace-pc
15541 @opindex fsanitize-coverage=trace-pc
15542 Enable coverage-guided fuzzing code instrumentation.
15543 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
15544
15545 @item -fsanitize-coverage=trace-cmp
15546 @opindex fsanitize-coverage=trace-cmp
15547 Enable dataflow guided fuzzing code instrumentation.
15548 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
15549 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
15550 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
15551 variable or @code{__sanitizer_cov_trace_const_cmp1},
15552 @code{__sanitizer_cov_trace_const_cmp2},
15553 @code{__sanitizer_cov_trace_const_cmp4} or
15554 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
15555 operand constant, @code{__sanitizer_cov_trace_cmpf} or
15556 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
15557 @code{__sanitizer_cov_trace_switch} for switch statements.
15558
15559 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
15560 @opindex fcf-protection
15561 Enable code instrumentation of control-flow transfers to increase
15562 program security by checking that target addresses of control-flow
15563 transfer instructions (such as indirect function call, function return,
15564 indirect jump) are valid. This prevents diverting the flow of control
15565 to an unexpected target. This is intended to protect against such
15566 threats as Return-oriented Programming (ROP), and similarly
15567 call/jmp-oriented programming (COP/JOP).
15568
15569 The value @code{branch} tells the compiler to implement checking of
15570 validity of control-flow transfer at the point of indirect branch
15571 instructions, i.e.@: call/jmp instructions. The value @code{return}
15572 implements checking of validity at the point of returning from a
15573 function. The value @code{full} is an alias for specifying both
15574 @code{branch} and @code{return}. The value @code{none} turns off
15575 instrumentation.
15576
15577 The value @code{check} is used for the final link with link-time
15578 optimization (LTO). An error is issued if LTO object files are
15579 compiled with different @option{-fcf-protection} values. The
15580 value @code{check} is ignored at the compile time.
15581
15582 The macro @code{__CET__} is defined when @option{-fcf-protection} is
15583 used. The first bit of @code{__CET__} is set to 1 for the value
15584 @code{branch} and the second bit of @code{__CET__} is set to 1 for
15585 the @code{return}.
15586
15587 You can also use the @code{nocf_check} attribute to identify
15588 which functions and calls should be skipped from instrumentation
15589 (@pxref{Function Attributes}).
15590
15591 Currently the x86 GNU/Linux target provides an implementation based
15592 on Intel Control-flow Enforcement Technology (CET) which works for
15593 i686 processor or newer.
15594
15595 @item -fharden-compares
15596 @opindex fharden-compares
15597 For every logical test that survives gimple optimizations and is
15598 @emph{not} the condition in a conditional branch (for example,
15599 conditions tested for conditional moves, or to store in boolean
15600 variables), emit extra code to compute and verify the reversed
15601 condition, and to call @code{__builtin_trap} if the results do not
15602 match. Use with @samp{-fharden-conditional-branches} to cover all
15603 conditionals.
15604
15605 @item -fharden-conditional-branches
15606 @opindex fharden-conditional-branches
15607 For every non-vectorized conditional branch that survives gimple
15608 optimizations, emit extra code to compute and verify the reversed
15609 condition, and to call @code{__builtin_trap} if the result is
15610 unexpected. Use with @samp{-fharden-compares} to cover all
15611 conditionals.
15612
15613 @item -fstack-protector
15614 @opindex fstack-protector
15615 Emit extra code to check for buffer overflows, such as stack smashing
15616 attacks. This is done by adding a guard variable to functions with
15617 vulnerable objects. This includes functions that call @code{alloca}, and
15618 functions with buffers larger than or equal to 8 bytes. The guards are
15619 initialized when a function is entered and then checked when the function
15620 exits. If a guard check fails, an error message is printed and the program
15621 exits. Only variables that are actually allocated on the stack are
15622 considered, optimized away variables or variables allocated in registers
15623 don't count.
15624
15625 @item -fstack-protector-all
15626 @opindex fstack-protector-all
15627 Like @option{-fstack-protector} except that all functions are protected.
15628
15629 @item -fstack-protector-strong
15630 @opindex fstack-protector-strong
15631 Like @option{-fstack-protector} but includes additional functions to
15632 be protected --- those that have local array definitions, or have
15633 references to local frame addresses. Only variables that are actually
15634 allocated on the stack are considered, optimized away variables or variables
15635 allocated in registers don't count.
15636
15637 @item -fstack-protector-explicit
15638 @opindex fstack-protector-explicit
15639 Like @option{-fstack-protector} but only protects those functions which
15640 have the @code{stack_protect} attribute.
15641
15642 @item -fstack-check
15643 @opindex fstack-check
15644 Generate code to verify that you do not go beyond the boundary of the
15645 stack. You should specify this flag if you are running in an
15646 environment with multiple threads, but you only rarely need to specify it in
15647 a single-threaded environment since stack overflow is automatically
15648 detected on nearly all systems if there is only one stack.
15649
15650 Note that this switch does not actually cause checking to be done; the
15651 operating system or the language runtime must do that. The switch causes
15652 generation of code to ensure that they see the stack being extended.
15653
15654 You can additionally specify a string parameter: @samp{no} means no
15655 checking, @samp{generic} means force the use of old-style checking,
15656 @samp{specific} means use the best checking method and is equivalent
15657 to bare @option{-fstack-check}.
15658
15659 Old-style checking is a generic mechanism that requires no specific
15660 target support in the compiler but comes with the following drawbacks:
15661
15662 @enumerate
15663 @item
15664 Modified allocation strategy for large objects: they are always
15665 allocated dynamically if their size exceeds a fixed threshold. Note this
15666 may change the semantics of some code.
15667
15668 @item
15669 Fixed limit on the size of the static frame of functions: when it is
15670 topped by a particular function, stack checking is not reliable and
15671 a warning is issued by the compiler.
15672
15673 @item
15674 Inefficiency: because of both the modified allocation strategy and the
15675 generic implementation, code performance is hampered.
15676 @end enumerate
15677
15678 Note that old-style stack checking is also the fallback method for
15679 @samp{specific} if no target support has been added in the compiler.
15680
15681 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
15682 and stack overflows. @samp{specific} is an excellent choice when compiling
15683 Ada code. It is not generally sufficient to protect against stack-clash
15684 attacks. To protect against those you want @samp{-fstack-clash-protection}.
15685
15686 @item -fstack-clash-protection
15687 @opindex fstack-clash-protection
15688 Generate code to prevent stack clash style attacks. When this option is
15689 enabled, the compiler will only allocate one page of stack space at a time
15690 and each page is accessed immediately after allocation. Thus, it prevents
15691 allocations from jumping over any stack guard page provided by the
15692 operating system.
15693
15694 Most targets do not fully support stack clash protection. However, on
15695 those targets @option{-fstack-clash-protection} will protect dynamic stack
15696 allocations. @option{-fstack-clash-protection} may also provide limited
15697 protection for static stack allocations if the target supports
15698 @option{-fstack-check=specific}.
15699
15700 @item -fstack-limit-register=@var{reg}
15701 @itemx -fstack-limit-symbol=@var{sym}
15702 @itemx -fno-stack-limit
15703 @opindex fstack-limit-register
15704 @opindex fstack-limit-symbol
15705 @opindex fno-stack-limit
15706 Generate code to ensure that the stack does not grow beyond a certain value,
15707 either the value of a register or the address of a symbol. If a larger
15708 stack is required, a signal is raised at run time. For most targets,
15709 the signal is raised before the stack overruns the boundary, so
15710 it is possible to catch the signal without taking special precautions.
15711
15712 For instance, if the stack starts at absolute address @samp{0x80000000}
15713 and grows downwards, you can use the flags
15714 @option{-fstack-limit-symbol=__stack_limit} and
15715 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
15716 of 128KB@. Note that this may only work with the GNU linker.
15717
15718 You can locally override stack limit checking by using the
15719 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
15720
15721 @item -fsplit-stack
15722 @opindex fsplit-stack
15723 Generate code to automatically split the stack before it overflows.
15724 The resulting program has a discontiguous stack which can only
15725 overflow if the program is unable to allocate any more memory. This
15726 is most useful when running threaded programs, as it is no longer
15727 necessary to calculate a good stack size to use for each thread. This
15728 is currently only implemented for the x86 targets running
15729 GNU/Linux.
15730
15731 When code compiled with @option{-fsplit-stack} calls code compiled
15732 without @option{-fsplit-stack}, there may not be much stack space
15733 available for the latter code to run. If compiling all code,
15734 including library code, with @option{-fsplit-stack} is not an option,
15735 then the linker can fix up these calls so that the code compiled
15736 without @option{-fsplit-stack} always has a large stack. Support for
15737 this is implemented in the gold linker in GNU binutils release 2.21
15738 and later.
15739
15740 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
15741 @opindex fvtable-verify
15742 This option is only available when compiling C++ code.
15743 It turns on (or off, if using @option{-fvtable-verify=none}) the security
15744 feature that verifies at run time, for every virtual call, that
15745 the vtable pointer through which the call is made is valid for the type of
15746 the object, and has not been corrupted or overwritten. If an invalid vtable
15747 pointer is detected at run time, an error is reported and execution of the
15748 program is immediately halted.
15749
15750 This option causes run-time data structures to be built at program startup,
15751 which are used for verifying the vtable pointers.
15752 The options @samp{std} and @samp{preinit}
15753 control the timing of when these data structures are built. In both cases the
15754 data structures are built before execution reaches @code{main}. Using
15755 @option{-fvtable-verify=std} causes the data structures to be built after
15756 shared libraries have been loaded and initialized.
15757 @option{-fvtable-verify=preinit} causes them to be built before shared
15758 libraries have been loaded and initialized.
15759
15760 If this option appears multiple times in the command line with different
15761 values specified, @samp{none} takes highest priority over both @samp{std} and
15762 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
15763
15764 @item -fvtv-debug
15765 @opindex fvtv-debug
15766 When used in conjunction with @option{-fvtable-verify=std} or
15767 @option{-fvtable-verify=preinit}, causes debug versions of the
15768 runtime functions for the vtable verification feature to be called.
15769 This flag also causes the compiler to log information about which
15770 vtable pointers it finds for each class.
15771 This information is written to a file named @file{vtv_set_ptr_data.log}
15772 in the directory named by the environment variable @env{VTV_LOGS_DIR}
15773 if that is defined or the current working directory otherwise.
15774
15775 Note: This feature @emph{appends} data to the log file. If you want a fresh log
15776 file, be sure to delete any existing one.
15777
15778 @item -fvtv-counts
15779 @opindex fvtv-counts
15780 This is a debugging flag. When used in conjunction with
15781 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
15782 causes the compiler to keep track of the total number of virtual calls
15783 it encounters and the number of verifications it inserts. It also
15784 counts the number of calls to certain run-time library functions
15785 that it inserts and logs this information for each compilation unit.
15786 The compiler writes this information to a file named
15787 @file{vtv_count_data.log} in the directory named by the environment
15788 variable @env{VTV_LOGS_DIR} if that is defined or the current working
15789 directory otherwise. It also counts the size of the vtable pointer sets
15790 for each class, and writes this information to @file{vtv_class_set_sizes.log}
15791 in the same directory.
15792
15793 Note: This feature @emph{appends} data to the log files. To get fresh log
15794 files, be sure to delete any existing ones.
15795
15796 @item -finstrument-functions
15797 @opindex finstrument-functions
15798 Generate instrumentation calls for entry and exit to functions. Just
15799 after function entry and just before function exit, the following
15800 profiling functions are called with the address of the current
15801 function and its call site. (On some platforms,
15802 @code{__builtin_return_address} does not work beyond the current
15803 function, so the call site information may not be available to the
15804 profiling functions otherwise.)
15805
15806 @smallexample
15807 void __cyg_profile_func_enter (void *this_fn,
15808 void *call_site);
15809 void __cyg_profile_func_exit (void *this_fn,
15810 void *call_site);
15811 @end smallexample
15812
15813 The first argument is the address of the start of the current function,
15814 which may be looked up exactly in the symbol table.
15815
15816 This instrumentation is also done for functions expanded inline in other
15817 functions. The profiling calls indicate where, conceptually, the
15818 inline function is entered and exited. This means that addressable
15819 versions of such functions must be available. If all your uses of a
15820 function are expanded inline, this may mean an additional expansion of
15821 code size. If you use @code{extern inline} in your C code, an
15822 addressable version of such functions must be provided. (This is
15823 normally the case anyway, but if you get lucky and the optimizer always
15824 expands the functions inline, you might have gotten away without
15825 providing static copies.)
15826
15827 A function may be given the attribute @code{no_instrument_function}, in
15828 which case this instrumentation is not done. This can be used, for
15829 example, for the profiling functions listed above, high-priority
15830 interrupt routines, and any functions from which the profiling functions
15831 cannot safely be called (perhaps signal handlers, if the profiling
15832 routines generate output or allocate memory).
15833 @xref{Common Function Attributes}.
15834
15835 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
15836 @opindex finstrument-functions-exclude-file-list
15837
15838 Set the list of functions that are excluded from instrumentation (see
15839 the description of @option{-finstrument-functions}). If the file that
15840 contains a function definition matches with one of @var{file}, then
15841 that function is not instrumented. The match is done on substrings:
15842 if the @var{file} parameter is a substring of the file name, it is
15843 considered to be a match.
15844
15845 For example:
15846
15847 @smallexample
15848 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
15849 @end smallexample
15850
15851 @noindent
15852 excludes any inline function defined in files whose pathnames
15853 contain @file{/bits/stl} or @file{include/sys}.
15854
15855 If, for some reason, you want to include letter @samp{,} in one of
15856 @var{sym}, write @samp{\,}. For example,
15857 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
15858 (note the single quote surrounding the option).
15859
15860 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
15861 @opindex finstrument-functions-exclude-function-list
15862
15863 This is similar to @option{-finstrument-functions-exclude-file-list},
15864 but this option sets the list of function names to be excluded from
15865 instrumentation. The function name to be matched is its user-visible
15866 name, such as @code{vector<int> blah(const vector<int> &)}, not the
15867 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
15868 match is done on substrings: if the @var{sym} parameter is a substring
15869 of the function name, it is considered to be a match. For C99 and C++
15870 extended identifiers, the function name must be given in UTF-8, not
15871 using universal character names.
15872
15873 @item -fpatchable-function-entry=@var{N}[,@var{M}]
15874 @opindex fpatchable-function-entry
15875 Generate @var{N} NOPs right at the beginning
15876 of each function, with the function entry point before the @var{M}th NOP.
15877 If @var{M} is omitted, it defaults to @code{0} so the
15878 function entry points to the address just at the first NOP.
15879 The NOP instructions reserve extra space which can be used to patch in
15880 any desired instrumentation at run time, provided that the code segment
15881 is writable. The amount of space is controllable indirectly via
15882 the number of NOPs; the NOP instruction used corresponds to the instruction
15883 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
15884 is target-specific and may also depend on the architecture variant and/or
15885 other compilation options.
15886
15887 For run-time identification, the starting addresses of these areas,
15888 which correspond to their respective function entries minus @var{M},
15889 are additionally collected in the @code{__patchable_function_entries}
15890 section of the resulting binary.
15891
15892 Note that the value of @code{__attribute__ ((patchable_function_entry
15893 (N,M)))} takes precedence over command-line option
15894 @option{-fpatchable-function-entry=N,M}. This can be used to increase
15895 the area size or to remove it completely on a single function.
15896 If @code{N=0}, no pad location is recorded.
15897
15898 The NOP instructions are inserted at---and maybe before, depending on
15899 @var{M}---the function entry address, even before the prologue.
15900
15901 The maximum value of @var{N} and @var{M} is 65535.
15902 @end table
15903
15904
15905 @node Preprocessor Options
15906 @section Options Controlling the Preprocessor
15907 @cindex preprocessor options
15908 @cindex options, preprocessor
15909
15910 These options control the C preprocessor, which is run on each C source
15911 file before actual compilation.
15912
15913 If you use the @option{-E} option, nothing is done except preprocessing.
15914 Some of these options make sense only together with @option{-E} because
15915 they cause the preprocessor output to be unsuitable for actual
15916 compilation.
15917
15918 In addition to the options listed here, there are a number of options
15919 to control search paths for include files documented in
15920 @ref{Directory Options}.
15921 Options to control preprocessor diagnostics are listed in
15922 @ref{Warning Options}.
15923
15924 @table @gcctabopt
15925 @include cppopts.texi
15926
15927 @item -Wp,@var{option}
15928 @opindex Wp
15929 You can use @option{-Wp,@var{option}} to bypass the compiler driver
15930 and pass @var{option} directly through to the preprocessor. If
15931 @var{option} contains commas, it is split into multiple options at the
15932 commas. However, many options are modified, translated or interpreted
15933 by the compiler driver before being passed to the preprocessor, and
15934 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
15935 interface is undocumented and subject to change, so whenever possible
15936 you should avoid using @option{-Wp} and let the driver handle the
15937 options instead.
15938
15939 @item -Xpreprocessor @var{option}
15940 @opindex Xpreprocessor
15941 Pass @var{option} as an option to the preprocessor. You can use this to
15942 supply system-specific preprocessor options that GCC does not
15943 recognize.
15944
15945 If you want to pass an option that takes an argument, you must use
15946 @option{-Xpreprocessor} twice, once for the option and once for the argument.
15947
15948 @item -no-integrated-cpp
15949 @opindex no-integrated-cpp
15950 Perform preprocessing as a separate pass before compilation.
15951 By default, GCC performs preprocessing as an integrated part of
15952 input tokenization and parsing.
15953 If this option is provided, the appropriate language front end
15954 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
15955 and Objective-C, respectively) is instead invoked twice,
15956 once for preprocessing only and once for actual compilation
15957 of the preprocessed input.
15958 This option may be useful in conjunction with the @option{-B} or
15959 @option{-wrapper} options to specify an alternate preprocessor or
15960 perform additional processing of the program source between
15961 normal preprocessing and compilation.
15962
15963 @item -flarge-source-files
15964 @opindex flarge-source-files
15965 Adjust GCC to expect large source files, at the expense of slower
15966 compilation and higher memory usage.
15967
15968 Specifically, GCC normally tracks both column numbers and line numbers
15969 within source files and it normally prints both of these numbers in
15970 diagnostics. However, once it has processed a certain number of source
15971 lines, it stops tracking column numbers and only tracks line numbers.
15972 This means that diagnostics for later lines do not include column numbers.
15973 It also means that options like @option{-Wmisleading-indentation} cease to work
15974 at that point, although the compiler prints a note if this happens.
15975 Passing @option{-flarge-source-files} significantly increases the number
15976 of source lines that GCC can process before it stops tracking columns.
15977
15978 @end table
15979
15980 @node Assembler Options
15981 @section Passing Options to the Assembler
15982
15983 @c prevent bad page break with this line
15984 You can pass options to the assembler.
15985
15986 @table @gcctabopt
15987 @item -Wa,@var{option}
15988 @opindex Wa
15989 Pass @var{option} as an option to the assembler. If @var{option}
15990 contains commas, it is split into multiple options at the commas.
15991
15992 @item -Xassembler @var{option}
15993 @opindex Xassembler
15994 Pass @var{option} as an option to the assembler. You can use this to
15995 supply system-specific assembler options that GCC does not
15996 recognize.
15997
15998 If you want to pass an option that takes an argument, you must use
15999 @option{-Xassembler} twice, once for the option and once for the argument.
16000
16001 @end table
16002
16003 @node Link Options
16004 @section Options for Linking
16005 @cindex link options
16006 @cindex options, linking
16007
16008 These options come into play when the compiler links object files into
16009 an executable output file. They are meaningless if the compiler is
16010 not doing a link step.
16011
16012 @table @gcctabopt
16013 @cindex file names
16014 @item @var{object-file-name}
16015 A file name that does not end in a special recognized suffix is
16016 considered to name an object file or library. (Object files are
16017 distinguished from libraries by the linker according to the file
16018 contents.) If linking is done, these object files are used as input
16019 to the linker.
16020
16021 @item -c
16022 @itemx -S
16023 @itemx -E
16024 @opindex c
16025 @opindex S
16026 @opindex E
16027 If any of these options is used, then the linker is not run, and
16028 object file names should not be used as arguments. @xref{Overall
16029 Options}.
16030
16031 @item -flinker-output=@var{type}
16032 @opindex flinker-output
16033 This option controls code generation of the link-time optimizer. By
16034 default the linker output is automatically determined by the linker
16035 plugin. For debugging the compiler and if incremental linking with a
16036 non-LTO object file is desired, it may be useful to control the type
16037 manually.
16038
16039 If @var{type} is @samp{exec}, code generation produces a static
16040 binary. In this case @option{-fpic} and @option{-fpie} are both
16041 disabled.
16042
16043 If @var{type} is @samp{dyn}, code generation produces a shared
16044 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
16045 but not enabled automatically. This allows to build shared libraries
16046 without position-independent code on architectures where this is
16047 possible, i.e.@: on x86.
16048
16049 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
16050 executable. This results in similar optimizations as @samp{exec}
16051 except that @option{-fpie} is not disabled if specified at compilation
16052 time.
16053
16054 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
16055 done. The sections containing intermediate code for link-time optimization are
16056 merged, pre-optimized, and output to the resulting object file. In addition, if
16057 @option{-ffat-lto-objects} is specified, binary code is produced for future
16058 non-LTO linking. The object file produced by incremental linking is smaller
16059 than a static library produced from the same object files. At link time the
16060 result of incremental linking also loads faster than a static
16061 library assuming that the majority of objects in the library are used.
16062
16063 Finally @samp{nolto-rel} configures the compiler for incremental linking where
16064 code generation is forced, a final binary is produced, and the intermediate
16065 code for later link-time optimization is stripped. When multiple object files
16066 are linked together the resulting code is better optimized than with
16067 link-time optimizations disabled (for example, cross-module inlining
16068 happens), but most of benefits of whole program optimizations are lost.
16069
16070 During the incremental link (by @option{-r}) the linker plugin defaults to
16071 @option{rel}. With current interfaces to GNU Binutils it is however not
16072 possible to incrementally link LTO objects and non-LTO objects into a single
16073 mixed object file. If any of object files in incremental link cannot
16074 be used for link-time optimization, the linker plugin issues a warning and
16075 uses @samp{nolto-rel}. To maintain whole program optimization, it is
16076 recommended to link such objects into static library instead. Alternatively it
16077 is possible to use H.J. Lu's binutils with support for mixed objects.
16078
16079 @item -fuse-ld=bfd
16080 @opindex fuse-ld=bfd
16081 Use the @command{bfd} linker instead of the default linker.
16082
16083 @item -fuse-ld=gold
16084 @opindex fuse-ld=gold
16085 Use the @command{gold} linker instead of the default linker.
16086
16087 @item -fuse-ld=lld
16088 @opindex fuse-ld=lld
16089 Use the LLVM @command{lld} linker instead of the default linker.
16090
16091 @cindex Libraries
16092 @item -l@var{library}
16093 @itemx -l @var{library}
16094 @opindex l
16095 Search the library named @var{library} when linking. (The second
16096 alternative with the library as a separate argument is only for
16097 POSIX compliance and is not recommended.)
16098
16099 The @option{-l} option is passed directly to the linker by GCC. Refer
16100 to your linker documentation for exact details. The general
16101 description below applies to the GNU linker.
16102
16103 The linker searches a standard list of directories for the library.
16104 The directories searched include several standard system directories
16105 plus any that you specify with @option{-L}.
16106
16107 Static libraries are archives of object files, and have file names
16108 like @file{lib@var{library}.a}. Some targets also support shared
16109 libraries, which typically have names like @file{lib@var{library}.so}.
16110 If both static and shared libraries are found, the linker gives
16111 preference to linking with the shared library unless the
16112 @option{-static} option is used.
16113
16114 It makes a difference where in the command you write this option; the
16115 linker searches and processes libraries and object files in the order they
16116 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
16117 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
16118 to functions in @samp{z}, those functions may not be loaded.
16119
16120 @item -lobjc
16121 @opindex lobjc
16122 You need this special case of the @option{-l} option in order to
16123 link an Objective-C or Objective-C++ program.
16124
16125 @item -nostartfiles
16126 @opindex nostartfiles
16127 Do not use the standard system startup files when linking.
16128 The standard system libraries are used normally, unless @option{-nostdlib},
16129 @option{-nolibc}, or @option{-nodefaultlibs} is used.
16130
16131 @item -nodefaultlibs
16132 @opindex nodefaultlibs
16133 Do not use the standard system libraries when linking.
16134 Only the libraries you specify are passed to the linker, and options
16135 specifying linkage of the system libraries, such as @option{-static-libgcc}
16136 or @option{-shared-libgcc}, are ignored.
16137 The standard startup files are used normally, unless @option{-nostartfiles}
16138 is used.
16139
16140 The compiler may generate calls to @code{memcmp},
16141 @code{memset}, @code{memcpy} and @code{memmove}.
16142 These entries are usually resolved by entries in
16143 libc. These entry points should be supplied through some other
16144 mechanism when this option is specified.
16145
16146 @item -nolibc
16147 @opindex nolibc
16148 Do not use the C library or system libraries tightly coupled with it when
16149 linking. Still link with the startup files, @file{libgcc} or toolchain
16150 provided language support libraries such as @file{libgnat}, @file{libgfortran}
16151 or @file{libstdc++} unless options preventing their inclusion are used as
16152 well. This typically removes @option{-lc} from the link command line, as well
16153 as system libraries that normally go with it and become meaningless when
16154 absence of a C library is assumed, for example @option{-lpthread} or
16155 @option{-lm} in some configurations. This is intended for bare-board
16156 targets when there is indeed no C library available.
16157
16158 @item -nostdlib
16159 @opindex nostdlib
16160 Do not use the standard system startup files or libraries when linking.
16161 No startup files and only the libraries you specify are passed to
16162 the linker, and options specifying linkage of the system libraries, such as
16163 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
16164
16165 The compiler may generate calls to @code{memcmp}, @code{memset},
16166 @code{memcpy} and @code{memmove}.
16167 These entries are usually resolved by entries in
16168 libc. These entry points should be supplied through some other
16169 mechanism when this option is specified.
16170
16171 @cindex @option{-lgcc}, use with @option{-nostdlib}
16172 @cindex @option{-nostdlib} and unresolved references
16173 @cindex unresolved references and @option{-nostdlib}
16174 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
16175 @cindex @option{-nodefaultlibs} and unresolved references
16176 @cindex unresolved references and @option{-nodefaultlibs}
16177 One of the standard libraries bypassed by @option{-nostdlib} and
16178 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
16179 which GCC uses to overcome shortcomings of particular machines, or special
16180 needs for some languages.
16181 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
16182 Collection (GCC) Internals},
16183 for more discussion of @file{libgcc.a}.)
16184 In most cases, you need @file{libgcc.a} even when you want to avoid
16185 other standard libraries. In other words, when you specify @option{-nostdlib}
16186 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
16187 This ensures that you have no unresolved references to internal GCC
16188 library subroutines.
16189 (An example of such an internal subroutine is @code{__main}, used to ensure C++
16190 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
16191 GNU Compiler Collection (GCC) Internals}.)
16192
16193 @item -e @var{entry}
16194 @itemx --entry=@var{entry}
16195 @opindex e
16196 @opindex entry
16197
16198 Specify that the program entry point is @var{entry}. The argument is
16199 interpreted by the linker; the GNU linker accepts either a symbol name
16200 or an address.
16201
16202 @item -pie
16203 @opindex pie
16204 Produce a dynamically linked position independent executable on targets
16205 that support it. For predictable results, you must also specify the same
16206 set of options used for compilation (@option{-fpie}, @option{-fPIE},
16207 or model suboptions) when you specify this linker option.
16208
16209 @item -no-pie
16210 @opindex no-pie
16211 Don't produce a dynamically linked position independent executable.
16212
16213 @item -static-pie
16214 @opindex static-pie
16215 Produce a static position independent executable on targets that support
16216 it. A static position independent executable is similar to a static
16217 executable, but can be loaded at any address without a dynamic linker.
16218 For predictable results, you must also specify the same set of options
16219 used for compilation (@option{-fpie}, @option{-fPIE}, or model
16220 suboptions) when you specify this linker option.
16221
16222 @item -pthread
16223 @opindex pthread
16224 Link with the POSIX threads library. This option is supported on
16225 GNU/Linux targets, most other Unix derivatives, and also on
16226 x86 Cygwin and MinGW targets. On some targets this option also sets
16227 flags for the preprocessor, so it should be used consistently for both
16228 compilation and linking.
16229
16230 @item -r
16231 @opindex r
16232 Produce a relocatable object as output. This is also known as partial
16233 linking.
16234
16235 @item -rdynamic
16236 @opindex rdynamic
16237 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
16238 that support it. This instructs the linker to add all symbols, not
16239 only used ones, to the dynamic symbol table. This option is needed
16240 for some uses of @code{dlopen} or to allow obtaining backtraces
16241 from within a program.
16242
16243 @item -s
16244 @opindex s
16245 Remove all symbol table and relocation information from the executable.
16246
16247 @item -static
16248 @opindex static
16249 On systems that support dynamic linking, this overrides @option{-pie}
16250 and prevents linking with the shared libraries. On other systems, this
16251 option has no effect.
16252
16253 @item -shared
16254 @opindex shared
16255 Produce a shared object which can then be linked with other objects to
16256 form an executable. Not all systems support this option. For predictable
16257 results, you must also specify the same set of options used for compilation
16258 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
16259 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
16260 needs to build supplementary stub code for constructors to work. On
16261 multi-libbed systems, @samp{gcc -shared} must select the correct support
16262 libraries to link against. Failing to supply the correct flags may lead
16263 to subtle defects. Supplying them in cases where they are not necessary
16264 is innocuous.}
16265
16266 @item -shared-libgcc
16267 @itemx -static-libgcc
16268 @opindex shared-libgcc
16269 @opindex static-libgcc
16270 On systems that provide @file{libgcc} as a shared library, these options
16271 force the use of either the shared or static version, respectively.
16272 If no shared version of @file{libgcc} was built when the compiler was
16273 configured, these options have no effect.
16274
16275 There are several situations in which an application should use the
16276 shared @file{libgcc} instead of the static version. The most common
16277 of these is when the application wishes to throw and catch exceptions
16278 across different shared libraries. In that case, each of the libraries
16279 as well as the application itself should use the shared @file{libgcc}.
16280
16281 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
16282 whenever you build a shared library or a main executable, because C++
16283 programs typically use exceptions, so this is the right thing to do.
16284
16285 If, instead, you use the GCC driver to create shared libraries, you may
16286 find that they are not always linked with the shared @file{libgcc}.
16287 If GCC finds, at its configuration time, that you have a non-GNU linker
16288 or a GNU linker that does not support option @option{--eh-frame-hdr},
16289 it links the shared version of @file{libgcc} into shared libraries
16290 by default. Otherwise, it takes advantage of the linker and optimizes
16291 away the linking with the shared version of @file{libgcc}, linking with
16292 the static version of libgcc by default. This allows exceptions to
16293 propagate through such shared libraries, without incurring relocation
16294 costs at library load time.
16295
16296 However, if a library or main executable is supposed to throw or catch
16297 exceptions, you must link it using the G++ driver, or using the option
16298 @option{-shared-libgcc}, such that it is linked with the shared
16299 @file{libgcc}.
16300
16301 @item -static-libasan
16302 @opindex static-libasan
16303 When the @option{-fsanitize=address} option is used to link a program,
16304 the GCC driver automatically links against @option{libasan}. If
16305 @file{libasan} is available as a shared library, and the @option{-static}
16306 option is not used, then this links against the shared version of
16307 @file{libasan}. The @option{-static-libasan} option directs the GCC
16308 driver to link @file{libasan} statically, without necessarily linking
16309 other libraries statically.
16310
16311 @item -static-libtsan
16312 @opindex static-libtsan
16313 When the @option{-fsanitize=thread} option is used to link a program,
16314 the GCC driver automatically links against @option{libtsan}. If
16315 @file{libtsan} is available as a shared library, and the @option{-static}
16316 option is not used, then this links against the shared version of
16317 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
16318 driver to link @file{libtsan} statically, without necessarily linking
16319 other libraries statically.
16320
16321 @item -static-liblsan
16322 @opindex static-liblsan
16323 When the @option{-fsanitize=leak} option is used to link a program,
16324 the GCC driver automatically links against @option{liblsan}. If
16325 @file{liblsan} is available as a shared library, and the @option{-static}
16326 option is not used, then this links against the shared version of
16327 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
16328 driver to link @file{liblsan} statically, without necessarily linking
16329 other libraries statically.
16330
16331 @item -static-libubsan
16332 @opindex static-libubsan
16333 When the @option{-fsanitize=undefined} option is used to link a program,
16334 the GCC driver automatically links against @option{libubsan}. If
16335 @file{libubsan} is available as a shared library, and the @option{-static}
16336 option is not used, then this links against the shared version of
16337 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
16338 driver to link @file{libubsan} statically, without necessarily linking
16339 other libraries statically.
16340
16341 @item -static-libstdc++
16342 @opindex static-libstdc++
16343 When the @command{g++} program is used to link a C++ program, it
16344 normally automatically links against @option{libstdc++}. If
16345 @file{libstdc++} is available as a shared library, and the
16346 @option{-static} option is not used, then this links against the
16347 shared version of @file{libstdc++}. That is normally fine. However, it
16348 is sometimes useful to freeze the version of @file{libstdc++} used by
16349 the program without going all the way to a fully static link. The
16350 @option{-static-libstdc++} option directs the @command{g++} driver to
16351 link @file{libstdc++} statically, without necessarily linking other
16352 libraries statically.
16353
16354 @item -symbolic
16355 @opindex symbolic
16356 Bind references to global symbols when building a shared object. Warn
16357 about any unresolved references (unless overridden by the link editor
16358 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
16359 this option.
16360
16361 @item -T @var{script}
16362 @opindex T
16363 @cindex linker script
16364 Use @var{script} as the linker script. This option is supported by most
16365 systems using the GNU linker. On some targets, such as bare-board
16366 targets without an operating system, the @option{-T} option may be required
16367 when linking to avoid references to undefined symbols.
16368
16369 @item -Xlinker @var{option}
16370 @opindex Xlinker
16371 Pass @var{option} as an option to the linker. You can use this to
16372 supply system-specific linker options that GCC does not recognize.
16373
16374 If you want to pass an option that takes a separate argument, you must use
16375 @option{-Xlinker} twice, once for the option and once for the argument.
16376 For example, to pass @option{-assert definitions}, you must write
16377 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
16378 @option{-Xlinker "-assert definitions"}, because this passes the entire
16379 string as a single argument, which is not what the linker expects.
16380
16381 When using the GNU linker, it is usually more convenient to pass
16382 arguments to linker options using the @option{@var{option}=@var{value}}
16383 syntax than as separate arguments. For example, you can specify
16384 @option{-Xlinker -Map=output.map} rather than
16385 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
16386 this syntax for command-line options.
16387
16388 @item -Wl,@var{option}
16389 @opindex Wl
16390 Pass @var{option} as an option to the linker. If @var{option} contains
16391 commas, it is split into multiple options at the commas. You can use this
16392 syntax to pass an argument to the option.
16393 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
16394 linker. When using the GNU linker, you can also get the same effect with
16395 @option{-Wl,-Map=output.map}.
16396
16397 @item -u @var{symbol}
16398 @opindex u
16399 Pretend the symbol @var{symbol} is undefined, to force linking of
16400 library modules to define it. You can use @option{-u} multiple times with
16401 different symbols to force loading of additional library modules.
16402
16403 @item -z @var{keyword}
16404 @opindex z
16405 @option{-z} is passed directly on to the linker along with the keyword
16406 @var{keyword}. See the section in the documentation of your linker for
16407 permitted values and their meanings.
16408 @end table
16409
16410 @node Directory Options
16411 @section Options for Directory Search
16412 @cindex directory options
16413 @cindex options, directory search
16414 @cindex search path
16415
16416 These options specify directories to search for header files, for
16417 libraries and for parts of the compiler:
16418
16419 @table @gcctabopt
16420 @include cppdiropts.texi
16421
16422 @item -iplugindir=@var{dir}
16423 @opindex iplugindir=
16424 Set the directory to search for plugins that are passed
16425 by @option{-fplugin=@var{name}} instead of
16426 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
16427 to be used by the user, but only passed by the driver.
16428
16429 @item -L@var{dir}
16430 @opindex L
16431 Add directory @var{dir} to the list of directories to be searched
16432 for @option{-l}.
16433
16434 @item -B@var{prefix}
16435 @opindex B
16436 This option specifies where to find the executables, libraries,
16437 include files, and data files of the compiler itself.
16438
16439 The compiler driver program runs one or more of the subprograms
16440 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
16441 @var{prefix} as a prefix for each program it tries to run, both with and
16442 without @samp{@var{machine}/@var{version}/} for the corresponding target
16443 machine and compiler version.
16444
16445 For each subprogram to be run, the compiler driver first tries the
16446 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
16447 is not specified, the driver tries two standard prefixes,
16448 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
16449 those results in a file name that is found, the unmodified program
16450 name is searched for using the directories specified in your
16451 @env{PATH} environment variable.
16452
16453 The compiler checks to see if the path provided by @option{-B}
16454 refers to a directory, and if necessary it adds a directory
16455 separator character at the end of the path.
16456
16457 @option{-B} prefixes that effectively specify directory names also apply
16458 to libraries in the linker, because the compiler translates these
16459 options into @option{-L} options for the linker. They also apply to
16460 include files in the preprocessor, because the compiler translates these
16461 options into @option{-isystem} options for the preprocessor. In this case,
16462 the compiler appends @samp{include} to the prefix.
16463
16464 The runtime support file @file{libgcc.a} can also be searched for using
16465 the @option{-B} prefix, if needed. If it is not found there, the two
16466 standard prefixes above are tried, and that is all. The file is left
16467 out of the link if it is not found by those means.
16468
16469 Another way to specify a prefix much like the @option{-B} prefix is to use
16470 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
16471 Variables}.
16472
16473 As a special kludge, if the path provided by @option{-B} is
16474 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
16475 9, then it is replaced by @file{[dir/]include}. This is to help
16476 with boot-strapping the compiler.
16477
16478 @item -no-canonical-prefixes
16479 @opindex no-canonical-prefixes
16480 Do not expand any symbolic links, resolve references to @samp{/../}
16481 or @samp{/./}, or make the path absolute when generating a relative
16482 prefix.
16483
16484 @item --sysroot=@var{dir}
16485 @opindex sysroot
16486 Use @var{dir} as the logical root directory for headers and libraries.
16487 For example, if the compiler normally searches for headers in
16488 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
16489 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
16490
16491 If you use both this option and the @option{-isysroot} option, then
16492 the @option{--sysroot} option applies to libraries, but the
16493 @option{-isysroot} option applies to header files.
16494
16495 The GNU linker (beginning with version 2.16) has the necessary support
16496 for this option. If your linker does not support this option, the
16497 header file aspect of @option{--sysroot} still works, but the
16498 library aspect does not.
16499
16500 @item --no-sysroot-suffix
16501 @opindex no-sysroot-suffix
16502 For some targets, a suffix is added to the root directory specified
16503 with @option{--sysroot}, depending on the other options used, so that
16504 headers may for example be found in
16505 @file{@var{dir}/@var{suffix}/usr/include} instead of
16506 @file{@var{dir}/usr/include}. This option disables the addition of
16507 such a suffix.
16508
16509 @end table
16510
16511 @node Code Gen Options
16512 @section Options for Code Generation Conventions
16513 @cindex code generation conventions
16514 @cindex options, code generation
16515 @cindex run-time options
16516
16517 These machine-independent options control the interface conventions
16518 used in code generation.
16519
16520 Most of them have both positive and negative forms; the negative form
16521 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
16522 one of the forms is listed---the one that is not the default. You
16523 can figure out the other form by either removing @samp{no-} or adding
16524 it.
16525
16526 @table @gcctabopt
16527 @item -fstack-reuse=@var{reuse-level}
16528 @opindex fstack_reuse
16529 This option controls stack space reuse for user declared local/auto variables
16530 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
16531 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
16532 local variables and temporaries, @samp{named_vars} enables the reuse only for
16533 user defined local variables with names, and @samp{none} disables stack reuse
16534 completely. The default value is @samp{all}. The option is needed when the
16535 program extends the lifetime of a scoped local variable or a compiler generated
16536 temporary beyond the end point defined by the language. When a lifetime of
16537 a variable ends, and if the variable lives in memory, the optimizing compiler
16538 has the freedom to reuse its stack space with other temporaries or scoped
16539 local variables whose live range does not overlap with it. Legacy code extending
16540 local lifetime is likely to break with the stack reuse optimization.
16541
16542 For example,
16543
16544 @smallexample
16545 int *p;
16546 @{
16547 int local1;
16548
16549 p = &local1;
16550 local1 = 10;
16551 ....
16552 @}
16553 @{
16554 int local2;
16555 local2 = 20;
16556 ...
16557 @}
16558
16559 if (*p == 10) // out of scope use of local1
16560 @{
16561
16562 @}
16563 @end smallexample
16564
16565 Another example:
16566 @smallexample
16567
16568 struct A
16569 @{
16570 A(int k) : i(k), j(k) @{ @}
16571 int i;
16572 int j;
16573 @};
16574
16575 A *ap;
16576
16577 void foo(const A& ar)
16578 @{
16579 ap = &ar;
16580 @}
16581
16582 void bar()
16583 @{
16584 foo(A(10)); // temp object's lifetime ends when foo returns
16585
16586 @{
16587 A a(20);
16588 ....
16589 @}
16590 ap->i+= 10; // ap references out of scope temp whose space
16591 // is reused with a. What is the value of ap->i?
16592 @}
16593
16594 @end smallexample
16595
16596 The lifetime of a compiler generated temporary is well defined by the C++
16597 standard. When a lifetime of a temporary ends, and if the temporary lives
16598 in memory, the optimizing compiler has the freedom to reuse its stack
16599 space with other temporaries or scoped local variables whose live range
16600 does not overlap with it. However some of the legacy code relies on
16601 the behavior of older compilers in which temporaries' stack space is
16602 not reused, the aggressive stack reuse can lead to runtime errors. This
16603 option is used to control the temporary stack reuse optimization.
16604
16605 @item -ftrapv
16606 @opindex ftrapv
16607 This option generates traps for signed overflow on addition, subtraction,
16608 multiplication operations.
16609 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16610 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16611 @option{-fwrapv} being effective. Note that only active options override, so
16612 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16613 results in @option{-ftrapv} being effective.
16614
16615 @item -fwrapv
16616 @opindex fwrapv
16617 This option instructs the compiler to assume that signed arithmetic
16618 overflow of addition, subtraction and multiplication wraps around
16619 using twos-complement representation. This flag enables some optimizations
16620 and disables others.
16621 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16622 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16623 @option{-fwrapv} being effective. Note that only active options override, so
16624 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16625 results in @option{-ftrapv} being effective.
16626
16627 @item -fwrapv-pointer
16628 @opindex fwrapv-pointer
16629 This option instructs the compiler to assume that pointer arithmetic
16630 overflow on addition and subtraction wraps around using twos-complement
16631 representation. This flag disables some optimizations which assume
16632 pointer overflow is invalid.
16633
16634 @item -fstrict-overflow
16635 @opindex fstrict-overflow
16636 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
16637 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
16638
16639 @item -fexceptions
16640 @opindex fexceptions
16641 Enable exception handling. Generates extra code needed to propagate
16642 exceptions. For some targets, this implies GCC generates frame
16643 unwind information for all functions, which can produce significant data
16644 size overhead, although it does not affect execution. If you do not
16645 specify this option, GCC enables it by default for languages like
16646 C++ that normally require exception handling, and disables it for
16647 languages like C that do not normally require it. However, you may need
16648 to enable this option when compiling C code that needs to interoperate
16649 properly with exception handlers written in C++. You may also wish to
16650 disable this option if you are compiling older C++ programs that don't
16651 use exception handling.
16652
16653 @item -fnon-call-exceptions
16654 @opindex fnon-call-exceptions
16655 Generate code that allows trapping instructions to throw exceptions.
16656 Note that this requires platform-specific runtime support that does
16657 not exist everywhere. Moreover, it only allows @emph{trapping}
16658 instructions to throw exceptions, i.e.@: memory references or floating-point
16659 instructions. It does not allow exceptions to be thrown from
16660 arbitrary signal handlers such as @code{SIGALRM}. This enables
16661 @option{-fexceptions}.
16662
16663 @item -fdelete-dead-exceptions
16664 @opindex fdelete-dead-exceptions
16665 Consider that instructions that may throw exceptions but don't otherwise
16666 contribute to the execution of the program can be optimized away.
16667 This does not affect calls to functions except those with the
16668 @code{pure} or @code{const} attributes.
16669 This option is enabled by default for the Ada and C++ compilers, as permitted by
16670 the language specifications.
16671 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
16672
16673 @item -funwind-tables
16674 @opindex funwind-tables
16675 Similar to @option{-fexceptions}, except that it just generates any needed
16676 static data, but does not affect the generated code in any other way.
16677 You normally do not need to enable this option; instead, a language processor
16678 that needs this handling enables it on your behalf.
16679
16680 @item -fasynchronous-unwind-tables
16681 @opindex fasynchronous-unwind-tables
16682 Generate unwind table in DWARF format, if supported by target machine. The
16683 table is exact at each instruction boundary, so it can be used for stack
16684 unwinding from asynchronous events (such as debugger or garbage collector).
16685
16686 @item -fno-gnu-unique
16687 @opindex fno-gnu-unique
16688 @opindex fgnu-unique
16689 On systems with recent GNU assembler and C library, the C++ compiler
16690 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
16691 of template static data members and static local variables in inline
16692 functions are unique even in the presence of @code{RTLD_LOCAL}; this
16693 is necessary to avoid problems with a library used by two different
16694 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
16695 therefore disagreeing with the other one about the binding of the
16696 symbol. But this causes @code{dlclose} to be ignored for affected
16697 DSOs; if your program relies on reinitialization of a DSO via
16698 @code{dlclose} and @code{dlopen}, you can use
16699 @option{-fno-gnu-unique}.
16700
16701 @item -fpcc-struct-return
16702 @opindex fpcc-struct-return
16703 Return ``short'' @code{struct} and @code{union} values in memory like
16704 longer ones, rather than in registers. This convention is less
16705 efficient, but it has the advantage of allowing intercallability between
16706 GCC-compiled files and files compiled with other compilers, particularly
16707 the Portable C Compiler (pcc).
16708
16709 The precise convention for returning structures in memory depends
16710 on the target configuration macros.
16711
16712 Short structures and unions are those whose size and alignment match
16713 that of some integer type.
16714
16715 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
16716 switch is not binary compatible with code compiled with the
16717 @option{-freg-struct-return} switch.
16718 Use it to conform to a non-default application binary interface.
16719
16720 @item -freg-struct-return
16721 @opindex freg-struct-return
16722 Return @code{struct} and @code{union} values in registers when possible.
16723 This is more efficient for small structures than
16724 @option{-fpcc-struct-return}.
16725
16726 If you specify neither @option{-fpcc-struct-return} nor
16727 @option{-freg-struct-return}, GCC defaults to whichever convention is
16728 standard for the target. If there is no standard convention, GCC
16729 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
16730 the principal compiler. In those cases, we can choose the standard, and
16731 we chose the more efficient register return alternative.
16732
16733 @strong{Warning:} code compiled with the @option{-freg-struct-return}
16734 switch is not binary compatible with code compiled with the
16735 @option{-fpcc-struct-return} switch.
16736 Use it to conform to a non-default application binary interface.
16737
16738 @item -fshort-enums
16739 @opindex fshort-enums
16740 Allocate to an @code{enum} type only as many bytes as it needs for the
16741 declared range of possible values. Specifically, the @code{enum} type
16742 is equivalent to the smallest integer type that has enough room.
16743
16744 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
16745 code that is not binary compatible with code generated without that switch.
16746 Use it to conform to a non-default application binary interface.
16747
16748 @item -fshort-wchar
16749 @opindex fshort-wchar
16750 Override the underlying type for @code{wchar_t} to be @code{short
16751 unsigned int} instead of the default for the target. This option is
16752 useful for building programs to run under WINE@.
16753
16754 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
16755 code that is not binary compatible with code generated without that switch.
16756 Use it to conform to a non-default application binary interface.
16757
16758 @item -fcommon
16759 @opindex fcommon
16760 @opindex fno-common
16761 @cindex tentative definitions
16762 In C code, this option controls the placement of global variables
16763 defined without an initializer, known as @dfn{tentative definitions}
16764 in the C standard. Tentative definitions are distinct from declarations
16765 of a variable with the @code{extern} keyword, which do not allocate storage.
16766
16767 The default is @option{-fno-common}, which specifies that the compiler places
16768 uninitialized global variables in the BSS section of the object file.
16769 This inhibits the merging of tentative definitions by the linker so you get a
16770 multiple-definition error if the same variable is accidentally defined in more
16771 than one compilation unit.
16772
16773 The @option{-fcommon} places uninitialized global variables in a common block.
16774 This allows the linker to resolve all tentative definitions of the same variable
16775 in different compilation units to the same object, or to a non-tentative
16776 definition. This behavior is inconsistent with C++, and on many targets implies
16777 a speed and code size penalty on global variable references. It is mainly
16778 useful to enable legacy code to link without errors.
16779
16780 @item -fno-ident
16781 @opindex fno-ident
16782 @opindex fident
16783 Ignore the @code{#ident} directive.
16784
16785 @item -finhibit-size-directive
16786 @opindex finhibit-size-directive
16787 Don't output a @code{.size} assembler directive, or anything else that
16788 would cause trouble if the function is split in the middle, and the
16789 two halves are placed at locations far apart in memory. This option is
16790 used when compiling @file{crtstuff.c}; you should not need to use it
16791 for anything else.
16792
16793 @item -fverbose-asm
16794 @opindex fverbose-asm
16795 Put extra commentary information in the generated assembly code to
16796 make it more readable. This option is generally only of use to those
16797 who actually need to read the generated assembly code (perhaps while
16798 debugging the compiler itself).
16799
16800 @option{-fno-verbose-asm}, the default, causes the
16801 extra information to be omitted and is useful when comparing two assembler
16802 files.
16803
16804 The added comments include:
16805
16806 @itemize @bullet
16807
16808 @item
16809 information on the compiler version and command-line options,
16810
16811 @item
16812 the source code lines associated with the assembly instructions,
16813 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16814
16815 @item
16816 hints on which high-level expressions correspond to
16817 the various assembly instruction operands.
16818
16819 @end itemize
16820
16821 For example, given this C source file:
16822
16823 @smallexample
16824 int test (int n)
16825 @{
16826 int i;
16827 int total = 0;
16828
16829 for (i = 0; i < n; i++)
16830 total += i * i;
16831
16832 return total;
16833 @}
16834 @end smallexample
16835
16836 compiling to (x86_64) assembly via @option{-S} and emitting the result
16837 direct to stdout via @option{-o} @option{-}
16838
16839 @smallexample
16840 gcc -S test.c -fverbose-asm -Os -o -
16841 @end smallexample
16842
16843 gives output similar to this:
16844
16845 @smallexample
16846 .file "test.c"
16847 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16848 [...snip...]
16849 # options passed:
16850 [...snip...]
16851
16852 .text
16853 .globl test
16854 .type test, @@function
16855 test:
16856 .LFB0:
16857 .cfi_startproc
16858 # test.c:4: int total = 0;
16859 xorl %eax, %eax # <retval>
16860 # test.c:6: for (i = 0; i < n; i++)
16861 xorl %edx, %edx # i
16862 .L2:
16863 # test.c:6: for (i = 0; i < n; i++)
16864 cmpl %edi, %edx # n, i
16865 jge .L5 #,
16866 # test.c:7: total += i * i;
16867 movl %edx, %ecx # i, tmp92
16868 imull %edx, %ecx # i, tmp92
16869 # test.c:6: for (i = 0; i < n; i++)
16870 incl %edx # i
16871 # test.c:7: total += i * i;
16872 addl %ecx, %eax # tmp92, <retval>
16873 jmp .L2 #
16874 .L5:
16875 # test.c:10: @}
16876 ret
16877 .cfi_endproc
16878 .LFE0:
16879 .size test, .-test
16880 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
16881 .section .note.GNU-stack,"",@@progbits
16882 @end smallexample
16883
16884 The comments are intended for humans rather than machines and hence the
16885 precise format of the comments is subject to change.
16886
16887 @item -frecord-gcc-switches
16888 @opindex frecord-gcc-switches
16889 This switch causes the command line used to invoke the
16890 compiler to be recorded into the object file that is being created.
16891 This switch is only implemented on some targets and the exact format
16892 of the recording is target and binary file format dependent, but it
16893 usually takes the form of a section containing ASCII text. This
16894 switch is related to the @option{-fverbose-asm} switch, but that
16895 switch only records information in the assembler output file as
16896 comments, so it never reaches the object file.
16897 See also @option{-grecord-gcc-switches} for another
16898 way of storing compiler options into the object file.
16899
16900 @item -fpic
16901 @opindex fpic
16902 @cindex global offset table
16903 @cindex PIC
16904 Generate position-independent code (PIC) suitable for use in a shared
16905 library, if supported for the target machine. Such code accesses all
16906 constant addresses through a global offset table (GOT)@. The dynamic
16907 loader resolves the GOT entries when the program starts (the dynamic
16908 loader is not part of GCC; it is part of the operating system). If
16909 the GOT size for the linked executable exceeds a machine-specific
16910 maximum size, you get an error message from the linker indicating that
16911 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
16912 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
16913 on the m68k and RS/6000. The x86 has no such limit.)
16914
16915 Position-independent code requires special support, and therefore works
16916 only on certain machines. For the x86, GCC supports PIC for System V
16917 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
16918 position-independent.
16919
16920 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16921 are defined to 1.
16922
16923 @item -fPIC
16924 @opindex fPIC
16925 If supported for the target machine, emit position-independent code,
16926 suitable for dynamic linking and avoiding any limit on the size of the
16927 global offset table. This option makes a difference on AArch64, m68k,
16928 PowerPC and SPARC@.
16929
16930 Position-independent code requires special support, and therefore works
16931 only on certain machines.
16932
16933 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16934 are defined to 2.
16935
16936 @item -fpie
16937 @itemx -fPIE
16938 @opindex fpie
16939 @opindex fPIE
16940 These options are similar to @option{-fpic} and @option{-fPIC}, but the
16941 generated position-independent code can be only linked into executables.
16942 Usually these options are used to compile code that will be linked using
16943 the @option{-pie} GCC option.
16944
16945 @option{-fpie} and @option{-fPIE} both define the macros
16946 @code{__pie__} and @code{__PIE__}. The macros have the value 1
16947 for @option{-fpie} and 2 for @option{-fPIE}.
16948
16949 @item -fno-plt
16950 @opindex fno-plt
16951 @opindex fplt
16952 Do not use the PLT for external function calls in position-independent code.
16953 Instead, load the callee address at call sites from the GOT and branch to it.
16954 This leads to more efficient code by eliminating PLT stubs and exposing
16955 GOT loads to optimizations. On architectures such as 32-bit x86 where
16956 PLT stubs expect the GOT pointer in a specific register, this gives more
16957 register allocation freedom to the compiler.
16958 Lazy binding requires use of the PLT;
16959 with @option{-fno-plt} all external symbols are resolved at load time.
16960
16961 Alternatively, the function attribute @code{noplt} can be used to avoid calls
16962 through the PLT for specific external functions.
16963
16964 In position-dependent code, a few targets also convert calls to
16965 functions that are marked to not use the PLT to use the GOT instead.
16966
16967 @item -fno-jump-tables
16968 @opindex fno-jump-tables
16969 @opindex fjump-tables
16970 Do not use jump tables for switch statements even where it would be
16971 more efficient than other code generation strategies. This option is
16972 of use in conjunction with @option{-fpic} or @option{-fPIC} for
16973 building code that forms part of a dynamic linker and cannot
16974 reference the address of a jump table. On some targets, jump tables
16975 do not require a GOT and this option is not needed.
16976
16977 @item -fno-bit-tests
16978 @opindex fno-bit-tests
16979 @opindex fbit-tests
16980 Do not use bit tests for switch statements even where it would be
16981 more efficient than other code generation strategies.
16982
16983 @item -ffixed-@var{reg}
16984 @opindex ffixed
16985 Treat the register named @var{reg} as a fixed register; generated code
16986 should never refer to it (except perhaps as a stack pointer, frame
16987 pointer or in some other fixed role).
16988
16989 @var{reg} must be the name of a register. The register names accepted
16990 are machine-specific and are defined in the @code{REGISTER_NAMES}
16991 macro in the machine description macro file.
16992
16993 This flag does not have a negative form, because it specifies a
16994 three-way choice.
16995
16996 @item -fcall-used-@var{reg}
16997 @opindex fcall-used
16998 Treat the register named @var{reg} as an allocable register that is
16999 clobbered by function calls. It may be allocated for temporaries or
17000 variables that do not live across a call. Functions compiled this way
17001 do not save and restore the register @var{reg}.
17002
17003 It is an error to use this flag with the frame pointer or stack pointer.
17004 Use of this flag for other registers that have fixed pervasive roles in
17005 the machine's execution model produces disastrous results.
17006
17007 This flag does not have a negative form, because it specifies a
17008 three-way choice.
17009
17010 @item -fcall-saved-@var{reg}
17011 @opindex fcall-saved
17012 Treat the register named @var{reg} as an allocable register saved by
17013 functions. It may be allocated even for temporaries or variables that
17014 live across a call. Functions compiled this way save and restore
17015 the register @var{reg} if they use it.
17016
17017 It is an error to use this flag with the frame pointer or stack pointer.
17018 Use of this flag for other registers that have fixed pervasive roles in
17019 the machine's execution model produces disastrous results.
17020
17021 A different sort of disaster results from the use of this flag for
17022 a register in which function values may be returned.
17023
17024 This flag does not have a negative form, because it specifies a
17025 three-way choice.
17026
17027 @item -fpack-struct[=@var{n}]
17028 @opindex fpack-struct
17029 Without a value specified, pack all structure members together without
17030 holes. When a value is specified (which must be a small power of two), pack
17031 structure members according to this value, representing the maximum
17032 alignment (that is, objects with default alignment requirements larger than
17033 this are output potentially unaligned at the next fitting location.
17034
17035 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
17036 code that is not binary compatible with code generated without that switch.
17037 Additionally, it makes the code suboptimal.
17038 Use it to conform to a non-default application binary interface.
17039
17040 @item -fleading-underscore
17041 @opindex fleading-underscore
17042 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
17043 change the way C symbols are represented in the object file. One use
17044 is to help link with legacy assembly code.
17045
17046 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
17047 generate code that is not binary compatible with code generated without that
17048 switch. Use it to conform to a non-default application binary interface.
17049 Not all targets provide complete support for this switch.
17050
17051 @item -ftls-model=@var{model}
17052 @opindex ftls-model
17053 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
17054 The @var{model} argument should be one of @samp{global-dynamic},
17055 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
17056 Note that the choice is subject to optimization: the compiler may use
17057 a more efficient model for symbols not visible outside of the translation
17058 unit, or if @option{-fpic} is not given on the command line.
17059
17060 The default without @option{-fpic} is @samp{initial-exec}; with
17061 @option{-fpic} the default is @samp{global-dynamic}.
17062
17063 @item -ftrampolines
17064 @opindex ftrampolines
17065 For targets that normally need trampolines for nested functions, always
17066 generate them instead of using descriptors. Otherwise, for targets that
17067 do not need them, like for example HP-PA or IA-64, do nothing.
17068
17069 A trampoline is a small piece of code that is created at run time on the
17070 stack when the address of a nested function is taken, and is used to call
17071 the nested function indirectly. Therefore, it requires the stack to be
17072 made executable in order for the program to work properly.
17073
17074 @option{-fno-trampolines} is enabled by default on a language by language
17075 basis to let the compiler avoid generating them, if it computes that this
17076 is safe, and replace them with descriptors. Descriptors are made up of data
17077 only, but the generated code must be prepared to deal with them. As of this
17078 writing, @option{-fno-trampolines} is enabled by default only for Ada.
17079
17080 Moreover, code compiled with @option{-ftrampolines} and code compiled with
17081 @option{-fno-trampolines} are not binary compatible if nested functions are
17082 present. This option must therefore be used on a program-wide basis and be
17083 manipulated with extreme care.
17084
17085 For languages other than Ada, the @code{-ftrampolines} and
17086 @code{-fno-trampolines} options currently have no effect, and
17087 trampolines are always generated on platforms that need them
17088 for nested functions.
17089
17090 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
17091 @opindex fvisibility
17092 Set the default ELF image symbol visibility to the specified option---all
17093 symbols are marked with this unless overridden within the code.
17094 Using this feature can very substantially improve linking and
17095 load times of shared object libraries, produce more optimized
17096 code, provide near-perfect API export and prevent symbol clashes.
17097 It is @strong{strongly} recommended that you use this in any shared objects
17098 you distribute.
17099
17100 Despite the nomenclature, @samp{default} always means public; i.e.,
17101 available to be linked against from outside the shared object.
17102 @samp{protected} and @samp{internal} are pretty useless in real-world
17103 usage so the only other commonly used option is @samp{hidden}.
17104 The default if @option{-fvisibility} isn't specified is
17105 @samp{default}, i.e., make every symbol public.
17106
17107 A good explanation of the benefits offered by ensuring ELF
17108 symbols have the correct visibility is given by ``How To Write
17109 Shared Libraries'' by Ulrich Drepper (which can be found at
17110 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
17111 solution made possible by this option to marking things hidden when
17112 the default is public is to make the default hidden and mark things
17113 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
17114 and @code{__attribute__ ((visibility("default")))} instead of
17115 @code{__declspec(dllexport)} you get almost identical semantics with
17116 identical syntax. This is a great boon to those working with
17117 cross-platform projects.
17118
17119 For those adding visibility support to existing code, you may find
17120 @code{#pragma GCC visibility} of use. This works by you enclosing
17121 the declarations you wish to set visibility for with (for example)
17122 @code{#pragma GCC visibility push(hidden)} and
17123 @code{#pragma GCC visibility pop}.
17124 Bear in mind that symbol visibility should be viewed @strong{as
17125 part of the API interface contract} and thus all new code should
17126 always specify visibility when it is not the default; i.e., declarations
17127 only for use within the local DSO should @strong{always} be marked explicitly
17128 as hidden as so to avoid PLT indirection overheads---making this
17129 abundantly clear also aids readability and self-documentation of the code.
17130 Note that due to ISO C++ specification requirements, @code{operator new} and
17131 @code{operator delete} must always be of default visibility.
17132
17133 Be aware that headers from outside your project, in particular system
17134 headers and headers from any other library you use, may not be
17135 expecting to be compiled with visibility other than the default. You
17136 may need to explicitly say @code{#pragma GCC visibility push(default)}
17137 before including any such headers.
17138
17139 @code{extern} declarations are not affected by @option{-fvisibility}, so
17140 a lot of code can be recompiled with @option{-fvisibility=hidden} with
17141 no modifications. However, this means that calls to @code{extern}
17142 functions with no explicit visibility use the PLT, so it is more
17143 effective to use @code{__attribute ((visibility))} and/or
17144 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
17145 declarations should be treated as hidden.
17146
17147 Note that @option{-fvisibility} does affect C++ vague linkage
17148 entities. This means that, for instance, an exception class that is
17149 be thrown between DSOs must be explicitly marked with default
17150 visibility so that the @samp{type_info} nodes are unified between
17151 the DSOs.
17152
17153 An overview of these techniques, their benefits and how to use them
17154 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
17155
17156 @item -fstrict-volatile-bitfields
17157 @opindex fstrict-volatile-bitfields
17158 This option should be used if accesses to volatile bit-fields (or other
17159 structure fields, although the compiler usually honors those types
17160 anyway) should use a single access of the width of the
17161 field's type, aligned to a natural alignment if possible. For
17162 example, targets with memory-mapped peripheral registers might require
17163 all such accesses to be 16 bits wide; with this flag you can
17164 declare all peripheral bit-fields as @code{unsigned short} (assuming short
17165 is 16 bits on these targets) to force GCC to use 16-bit accesses
17166 instead of, perhaps, a more efficient 32-bit access.
17167
17168 If this option is disabled, the compiler uses the most efficient
17169 instruction. In the previous example, that might be a 32-bit load
17170 instruction, even though that accesses bytes that do not contain
17171 any portion of the bit-field, or memory-mapped registers unrelated to
17172 the one being updated.
17173
17174 In some cases, such as when the @code{packed} attribute is applied to a
17175 structure field, it may not be possible to access the field with a single
17176 read or write that is correctly aligned for the target machine. In this
17177 case GCC falls back to generating multiple accesses rather than code that
17178 will fault or truncate the result at run time.
17179
17180 Note: Due to restrictions of the C/C++11 memory model, write accesses are
17181 not allowed to touch non bit-field members. It is therefore recommended
17182 to define all bits of the field's type as bit-field members.
17183
17184 The default value of this option is determined by the application binary
17185 interface for the target processor.
17186
17187 @item -fsync-libcalls
17188 @opindex fsync-libcalls
17189 This option controls whether any out-of-line instance of the @code{__sync}
17190 family of functions may be used to implement the C++11 @code{__atomic}
17191 family of functions.
17192
17193 The default value of this option is enabled, thus the only useful form
17194 of the option is @option{-fno-sync-libcalls}. This option is used in
17195 the implementation of the @file{libatomic} runtime library.
17196
17197 @end table
17198
17199 @node Developer Options
17200 @section GCC Developer Options
17201 @cindex developer options
17202 @cindex debugging GCC
17203 @cindex debug dump options
17204 @cindex dump options
17205 @cindex compilation statistics
17206
17207 This section describes command-line options that are primarily of
17208 interest to GCC developers, including options to support compiler
17209 testing and investigation of compiler bugs and compile-time
17210 performance problems. This includes options that produce debug dumps
17211 at various points in the compilation; that print statistics such as
17212 memory use and execution time; and that print information about GCC's
17213 configuration, such as where it searches for libraries. You should
17214 rarely need to use any of these options for ordinary compilation and
17215 linking tasks.
17216
17217 Many developer options that cause GCC to dump output to a file take an
17218 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
17219 or @samp{-} to dump to standard output, and @samp{stderr} for standard
17220 error.
17221
17222 If @samp{=@var{filename}} is omitted, a default dump file name is
17223 constructed by concatenating the base dump file name, a pass number,
17224 phase letter, and pass name. The base dump file name is the name of
17225 output file produced by the compiler if explicitly specified and not
17226 an executable; otherwise it is the source file name.
17227 The pass number is determined by the order passes are registered with
17228 the compiler's pass manager.
17229 This is generally the same as the order of execution, but passes
17230 registered by plugins, target-specific passes, or passes that are
17231 otherwise registered late are numbered higher than the pass named
17232 @samp{final}, even if they are executed earlier. The phase letter is
17233 one of @samp{i} (inter-procedural analysis), @samp{l}
17234 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
17235 The files are created in the directory of the output file.
17236
17237 @table @gcctabopt
17238
17239 @item -fcallgraph-info
17240 @itemx -fcallgraph-info=@var{MARKERS}
17241 @opindex fcallgraph-info
17242 Makes the compiler output callgraph information for the program, on a
17243 per-object-file basis. The information is generated in the common VCG
17244 format. It can be decorated with additional, per-node and/or per-edge
17245 information, if a list of comma-separated markers is additionally
17246 specified. When the @code{su} marker is specified, the callgraph is
17247 decorated with stack usage information; it is equivalent to
17248 @option{-fstack-usage}. When the @code{da} marker is specified, the
17249 callgraph is decorated with information about dynamically allocated
17250 objects.
17251
17252 When compiling with @option{-flto}, no callgraph information is output
17253 along with the object file. At LTO link time, @option{-fcallgraph-info}
17254 may generate multiple callgraph information files next to intermediate
17255 LTO output files.
17256
17257 @item -d@var{letters}
17258 @itemx -fdump-rtl-@var{pass}
17259 @itemx -fdump-rtl-@var{pass}=@var{filename}
17260 @opindex d
17261 @opindex fdump-rtl-@var{pass}
17262 Says to make debugging dumps during compilation at times specified by
17263 @var{letters}. This is used for debugging the RTL-based passes of the
17264 compiler.
17265
17266 Some @option{-d@var{letters}} switches have different meaning when
17267 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
17268 for information about preprocessor-specific dump options.
17269
17270 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
17271 @option{-d} option @var{letters}. Here are the possible
17272 letters for use in @var{pass} and @var{letters}, and their meanings:
17273
17274 @table @gcctabopt
17275
17276 @item -fdump-rtl-alignments
17277 @opindex fdump-rtl-alignments
17278 Dump after branch alignments have been computed.
17279
17280 @item -fdump-rtl-asmcons
17281 @opindex fdump-rtl-asmcons
17282 Dump after fixing rtl statements that have unsatisfied in/out constraints.
17283
17284 @item -fdump-rtl-auto_inc_dec
17285 @opindex fdump-rtl-auto_inc_dec
17286 Dump after auto-inc-dec discovery. This pass is only run on
17287 architectures that have auto inc or auto dec instructions.
17288
17289 @item -fdump-rtl-barriers
17290 @opindex fdump-rtl-barriers
17291 Dump after cleaning up the barrier instructions.
17292
17293 @item -fdump-rtl-bbpart
17294 @opindex fdump-rtl-bbpart
17295 Dump after partitioning hot and cold basic blocks.
17296
17297 @item -fdump-rtl-bbro
17298 @opindex fdump-rtl-bbro
17299 Dump after block reordering.
17300
17301 @item -fdump-rtl-btl1
17302 @itemx -fdump-rtl-btl2
17303 @opindex fdump-rtl-btl2
17304 @opindex fdump-rtl-btl2
17305 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
17306 after the two branch
17307 target load optimization passes.
17308
17309 @item -fdump-rtl-bypass
17310 @opindex fdump-rtl-bypass
17311 Dump after jump bypassing and control flow optimizations.
17312
17313 @item -fdump-rtl-combine
17314 @opindex fdump-rtl-combine
17315 Dump after the RTL instruction combination pass.
17316
17317 @item -fdump-rtl-compgotos
17318 @opindex fdump-rtl-compgotos
17319 Dump after duplicating the computed gotos.
17320
17321 @item -fdump-rtl-ce1
17322 @itemx -fdump-rtl-ce2
17323 @itemx -fdump-rtl-ce3
17324 @opindex fdump-rtl-ce1
17325 @opindex fdump-rtl-ce2
17326 @opindex fdump-rtl-ce3
17327 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
17328 @option{-fdump-rtl-ce3} enable dumping after the three
17329 if conversion passes.
17330
17331 @item -fdump-rtl-cprop_hardreg
17332 @opindex fdump-rtl-cprop_hardreg
17333 Dump after hard register copy propagation.
17334
17335 @item -fdump-rtl-csa
17336 @opindex fdump-rtl-csa
17337 Dump after combining stack adjustments.
17338
17339 @item -fdump-rtl-cse1
17340 @itemx -fdump-rtl-cse2
17341 @opindex fdump-rtl-cse1
17342 @opindex fdump-rtl-cse2
17343 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
17344 the two common subexpression elimination passes.
17345
17346 @item -fdump-rtl-dce
17347 @opindex fdump-rtl-dce
17348 Dump after the standalone dead code elimination passes.
17349
17350 @item -fdump-rtl-dbr
17351 @opindex fdump-rtl-dbr
17352 Dump after delayed branch scheduling.
17353
17354 @item -fdump-rtl-dce1
17355 @itemx -fdump-rtl-dce2
17356 @opindex fdump-rtl-dce1
17357 @opindex fdump-rtl-dce2
17358 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
17359 the two dead store elimination passes.
17360
17361 @item -fdump-rtl-eh
17362 @opindex fdump-rtl-eh
17363 Dump after finalization of EH handling code.
17364
17365 @item -fdump-rtl-eh_ranges
17366 @opindex fdump-rtl-eh_ranges
17367 Dump after conversion of EH handling range regions.
17368
17369 @item -fdump-rtl-expand
17370 @opindex fdump-rtl-expand
17371 Dump after RTL generation.
17372
17373 @item -fdump-rtl-fwprop1
17374 @itemx -fdump-rtl-fwprop2
17375 @opindex fdump-rtl-fwprop1
17376 @opindex fdump-rtl-fwprop2
17377 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
17378 dumping after the two forward propagation passes.
17379
17380 @item -fdump-rtl-gcse1
17381 @itemx -fdump-rtl-gcse2
17382 @opindex fdump-rtl-gcse1
17383 @opindex fdump-rtl-gcse2
17384 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
17385 after global common subexpression elimination.
17386
17387 @item -fdump-rtl-init-regs
17388 @opindex fdump-rtl-init-regs
17389 Dump after the initialization of the registers.
17390
17391 @item -fdump-rtl-initvals
17392 @opindex fdump-rtl-initvals
17393 Dump after the computation of the initial value sets.
17394
17395 @item -fdump-rtl-into_cfglayout
17396 @opindex fdump-rtl-into_cfglayout
17397 Dump after converting to cfglayout mode.
17398
17399 @item -fdump-rtl-ira
17400 @opindex fdump-rtl-ira
17401 Dump after iterated register allocation.
17402
17403 @item -fdump-rtl-jump
17404 @opindex fdump-rtl-jump
17405 Dump after the second jump optimization.
17406
17407 @item -fdump-rtl-loop2
17408 @opindex fdump-rtl-loop2
17409 @option{-fdump-rtl-loop2} enables dumping after the rtl
17410 loop optimization passes.
17411
17412 @item -fdump-rtl-mach
17413 @opindex fdump-rtl-mach
17414 Dump after performing the machine dependent reorganization pass, if that
17415 pass exists.
17416
17417 @item -fdump-rtl-mode_sw
17418 @opindex fdump-rtl-mode_sw
17419 Dump after removing redundant mode switches.
17420
17421 @item -fdump-rtl-rnreg
17422 @opindex fdump-rtl-rnreg
17423 Dump after register renumbering.
17424
17425 @item -fdump-rtl-outof_cfglayout
17426 @opindex fdump-rtl-outof_cfglayout
17427 Dump after converting from cfglayout mode.
17428
17429 @item -fdump-rtl-peephole2
17430 @opindex fdump-rtl-peephole2
17431 Dump after the peephole pass.
17432
17433 @item -fdump-rtl-postreload
17434 @opindex fdump-rtl-postreload
17435 Dump after post-reload optimizations.
17436
17437 @item -fdump-rtl-pro_and_epilogue
17438 @opindex fdump-rtl-pro_and_epilogue
17439 Dump after generating the function prologues and epilogues.
17440
17441 @item -fdump-rtl-sched1
17442 @itemx -fdump-rtl-sched2
17443 @opindex fdump-rtl-sched1
17444 @opindex fdump-rtl-sched2
17445 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
17446 after the basic block scheduling passes.
17447
17448 @item -fdump-rtl-ree
17449 @opindex fdump-rtl-ree
17450 Dump after sign/zero extension elimination.
17451
17452 @item -fdump-rtl-seqabstr
17453 @opindex fdump-rtl-seqabstr
17454 Dump after common sequence discovery.
17455
17456 @item -fdump-rtl-shorten
17457 @opindex fdump-rtl-shorten
17458 Dump after shortening branches.
17459
17460 @item -fdump-rtl-sibling
17461 @opindex fdump-rtl-sibling
17462 Dump after sibling call optimizations.
17463
17464 @item -fdump-rtl-split1
17465 @itemx -fdump-rtl-split2
17466 @itemx -fdump-rtl-split3
17467 @itemx -fdump-rtl-split4
17468 @itemx -fdump-rtl-split5
17469 @opindex fdump-rtl-split1
17470 @opindex fdump-rtl-split2
17471 @opindex fdump-rtl-split3
17472 @opindex fdump-rtl-split4
17473 @opindex fdump-rtl-split5
17474 These options enable dumping after five rounds of
17475 instruction splitting.
17476
17477 @item -fdump-rtl-sms
17478 @opindex fdump-rtl-sms
17479 Dump after modulo scheduling. This pass is only run on some
17480 architectures.
17481
17482 @item -fdump-rtl-stack
17483 @opindex fdump-rtl-stack
17484 Dump after conversion from GCC's ``flat register file'' registers to the
17485 x87's stack-like registers. This pass is only run on x86 variants.
17486
17487 @item -fdump-rtl-subreg1
17488 @itemx -fdump-rtl-subreg2
17489 @opindex fdump-rtl-subreg1
17490 @opindex fdump-rtl-subreg2
17491 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
17492 the two subreg expansion passes.
17493
17494 @item -fdump-rtl-unshare
17495 @opindex fdump-rtl-unshare
17496 Dump after all rtl has been unshared.
17497
17498 @item -fdump-rtl-vartrack
17499 @opindex fdump-rtl-vartrack
17500 Dump after variable tracking.
17501
17502 @item -fdump-rtl-vregs
17503 @opindex fdump-rtl-vregs
17504 Dump after converting virtual registers to hard registers.
17505
17506 @item -fdump-rtl-web
17507 @opindex fdump-rtl-web
17508 Dump after live range splitting.
17509
17510 @item -fdump-rtl-regclass
17511 @itemx -fdump-rtl-subregs_of_mode_init
17512 @itemx -fdump-rtl-subregs_of_mode_finish
17513 @itemx -fdump-rtl-dfinit
17514 @itemx -fdump-rtl-dfinish
17515 @opindex fdump-rtl-regclass
17516 @opindex fdump-rtl-subregs_of_mode_init
17517 @opindex fdump-rtl-subregs_of_mode_finish
17518 @opindex fdump-rtl-dfinit
17519 @opindex fdump-rtl-dfinish
17520 These dumps are defined but always produce empty files.
17521
17522 @item -da
17523 @itemx -fdump-rtl-all
17524 @opindex da
17525 @opindex fdump-rtl-all
17526 Produce all the dumps listed above.
17527
17528 @item -dA
17529 @opindex dA
17530 Annotate the assembler output with miscellaneous debugging information.
17531
17532 @item -dD
17533 @opindex dD
17534 Dump all macro definitions, at the end of preprocessing, in addition to
17535 normal output.
17536
17537 @item -dH
17538 @opindex dH
17539 Produce a core dump whenever an error occurs.
17540
17541 @item -dp
17542 @opindex dp
17543 Annotate the assembler output with a comment indicating which
17544 pattern and alternative is used. The length and cost of each instruction are
17545 also printed.
17546
17547 @item -dP
17548 @opindex dP
17549 Dump the RTL in the assembler output as a comment before each instruction.
17550 Also turns on @option{-dp} annotation.
17551
17552 @item -dx
17553 @opindex dx
17554 Just generate RTL for a function instead of compiling it. Usually used
17555 with @option{-fdump-rtl-expand}.
17556 @end table
17557
17558 @item -fdump-debug
17559 @opindex fdump-debug
17560 Dump debugging information generated during the debug
17561 generation phase.
17562
17563 @item -fdump-earlydebug
17564 @opindex fdump-earlydebug
17565 Dump debugging information generated during the early debug
17566 generation phase.
17567
17568 @item -fdump-noaddr
17569 @opindex fdump-noaddr
17570 When doing debugging dumps, suppress address output. This makes it more
17571 feasible to use diff on debugging dumps for compiler invocations with
17572 different compiler binaries and/or different
17573 text / bss / data / heap / stack / dso start locations.
17574
17575 @item -freport-bug
17576 @opindex freport-bug
17577 Collect and dump debug information into a temporary file if an
17578 internal compiler error (ICE) occurs.
17579
17580 @item -fdump-unnumbered
17581 @opindex fdump-unnumbered
17582 When doing debugging dumps, suppress instruction numbers and address output.
17583 This makes it more feasible to use diff on debugging dumps for compiler
17584 invocations with different options, in particular with and without
17585 @option{-g}.
17586
17587 @item -fdump-unnumbered-links
17588 @opindex fdump-unnumbered-links
17589 When doing debugging dumps (see @option{-d} option above), suppress
17590 instruction numbers for the links to the previous and next instructions
17591 in a sequence.
17592
17593 @item -fdump-ipa-@var{switch}
17594 @itemx -fdump-ipa-@var{switch}-@var{options}
17595 @opindex fdump-ipa
17596 Control the dumping at various stages of inter-procedural analysis
17597 language tree to a file. The file name is generated by appending a
17598 switch specific suffix to the source file name, and the file is created
17599 in the same directory as the output file. The following dumps are
17600 possible:
17601
17602 @table @samp
17603 @item all
17604 Enables all inter-procedural analysis dumps.
17605
17606 @item cgraph
17607 Dumps information about call-graph optimization, unused function removal,
17608 and inlining decisions.
17609
17610 @item inline
17611 Dump after function inlining.
17612
17613 @end table
17614
17615 Additionally, the options @option{-optimized}, @option{-missed},
17616 @option{-note}, and @option{-all} can be provided, with the same meaning
17617 as for @option{-fopt-info}, defaulting to @option{-optimized}.
17618
17619 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
17620 information on callsites that were inlined, along with callsites
17621 that were not inlined.
17622
17623 By default, the dump will contain messages about successful
17624 optimizations (equivalent to @option{-optimized}) together with
17625 low-level details about the analysis.
17626
17627 @item -fdump-lang
17628 @opindex fdump-lang
17629 Dump language-specific information. The file name is made by appending
17630 @file{.lang} to the source file name.
17631
17632 @item -fdump-lang-all
17633 @itemx -fdump-lang-@var{switch}
17634 @itemx -fdump-lang-@var{switch}-@var{options}
17635 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
17636 @opindex fdump-lang-all
17637 @opindex fdump-lang
17638 Control the dumping of language-specific information. The @var{options}
17639 and @var{filename} portions behave as described in the
17640 @option{-fdump-tree} option. The following @var{switch} values are
17641 accepted:
17642
17643 @table @samp
17644 @item all
17645
17646 Enable all language-specific dumps.
17647
17648 @item class
17649 Dump class hierarchy information. Virtual table information is emitted
17650 unless '@option{slim}' is specified. This option is applicable to C++ only.
17651
17652 @item module
17653 Dump module information. Options @option{lineno} (locations),
17654 @option{graph} (reachability), @option{blocks} (clusters),
17655 @option{uid} (serialization), @option{alias} (mergeable),
17656 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
17657 (macros) may provide additional information. This option is
17658 applicable to C++ only.
17659
17660 @item raw
17661 Dump the raw internal tree data. This option is applicable to C++ only.
17662
17663 @end table
17664
17665 @item -fdump-passes
17666 @opindex fdump-passes
17667 Print on @file{stderr} the list of optimization passes that are turned
17668 on and off by the current command-line options.
17669
17670 @item -fdump-statistics-@var{option}
17671 @opindex fdump-statistics
17672 Enable and control dumping of pass statistics in a separate file. The
17673 file name is generated by appending a suffix ending in
17674 @samp{.statistics} to the source file name, and the file is created in
17675 the same directory as the output file. If the @samp{-@var{option}}
17676 form is used, @samp{-stats} causes counters to be summed over the
17677 whole compilation unit while @samp{-details} dumps every event as
17678 the passes generate them. The default with no option is to sum
17679 counters for each function compiled.
17680
17681 @item -fdump-tree-all
17682 @itemx -fdump-tree-@var{switch}
17683 @itemx -fdump-tree-@var{switch}-@var{options}
17684 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
17685 @opindex fdump-tree-all
17686 @opindex fdump-tree
17687 Control the dumping at various stages of processing the intermediate
17688 language tree to a file. If the @samp{-@var{options}}
17689 form is used, @var{options} is a list of @samp{-} separated options
17690 which control the details of the dump. Not all options are applicable
17691 to all dumps; those that are not meaningful are ignored. The
17692 following options are available
17693
17694 @table @samp
17695 @item address
17696 Print the address of each node. Usually this is not meaningful as it
17697 changes according to the environment and source file. Its primary use
17698 is for tying up a dump file with a debug environment.
17699 @item asmname
17700 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
17701 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
17702 use working backward from mangled names in the assembly file.
17703 @item slim
17704 When dumping front-end intermediate representations, inhibit dumping
17705 of members of a scope or body of a function merely because that scope
17706 has been reached. Only dump such items when they are directly reachable
17707 by some other path.
17708
17709 When dumping pretty-printed trees, this option inhibits dumping the
17710 bodies of control structures.
17711
17712 When dumping RTL, print the RTL in slim (condensed) form instead of
17713 the default LISP-like representation.
17714 @item raw
17715 Print a raw representation of the tree. By default, trees are
17716 pretty-printed into a C-like representation.
17717 @item details
17718 Enable more detailed dumps (not honored by every dump option). Also
17719 include information from the optimization passes.
17720 @item stats
17721 Enable dumping various statistics about the pass (not honored by every dump
17722 option).
17723 @item blocks
17724 Enable showing basic block boundaries (disabled in raw dumps).
17725 @item graph
17726 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
17727 dump a representation of the control flow graph suitable for viewing with
17728 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
17729 the file is pretty-printed as a subgraph, so that GraphViz can render them
17730 all in a single plot.
17731
17732 This option currently only works for RTL dumps, and the RTL is always
17733 dumped in slim form.
17734 @item vops
17735 Enable showing virtual operands for every statement.
17736 @item lineno
17737 Enable showing line numbers for statements.
17738 @item uid
17739 Enable showing the unique ID (@code{DECL_UID}) for each variable.
17740 @item verbose
17741 Enable showing the tree dump for each statement.
17742 @item eh
17743 Enable showing the EH region number holding each statement.
17744 @item scev
17745 Enable showing scalar evolution analysis details.
17746 @item optimized
17747 Enable showing optimization information (only available in certain
17748 passes).
17749 @item missed
17750 Enable showing missed optimization information (only available in certain
17751 passes).
17752 @item note
17753 Enable other detailed optimization information (only available in
17754 certain passes).
17755 @item all
17756 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
17757 and @option{lineno}.
17758 @item optall
17759 Turn on all optimization options, i.e., @option{optimized},
17760 @option{missed}, and @option{note}.
17761 @end table
17762
17763 To determine what tree dumps are available or find the dump for a pass
17764 of interest follow the steps below.
17765
17766 @enumerate
17767 @item
17768 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
17769 look for a code that corresponds to the pass you are interested in.
17770 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
17771 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
17772 The number at the end distinguishes distinct invocations of the same pass.
17773 @item
17774 To enable the creation of the dump file, append the pass code to
17775 the @option{-fdump-} option prefix and invoke GCC with it. For example,
17776 to enable the dump from the Early Value Range Propagation pass, invoke
17777 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
17778 specify the name of the dump file. If you don't specify one, GCC
17779 creates as described below.
17780 @item
17781 Find the pass dump in a file whose name is composed of three components
17782 separated by a period: the name of the source file GCC was invoked to
17783 compile, a numeric suffix indicating the pass number followed by the
17784 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
17785 and finally the pass code. For example, the Early VRP pass dump might
17786 be in a file named @file{myfile.c.038t.evrp} in the current working
17787 directory. Note that the numeric codes are not stable and may change
17788 from one version of GCC to another.
17789 @end enumerate
17790
17791 @item -fopt-info
17792 @itemx -fopt-info-@var{options}
17793 @itemx -fopt-info-@var{options}=@var{filename}
17794 @opindex fopt-info
17795 Controls optimization dumps from various optimization passes. If the
17796 @samp{-@var{options}} form is used, @var{options} is a list of
17797 @samp{-} separated option keywords to select the dump details and
17798 optimizations.
17799
17800 The @var{options} can be divided into three groups:
17801 @enumerate
17802 @item
17803 options describing what kinds of messages should be emitted,
17804 @item
17805 options describing the verbosity of the dump, and
17806 @item
17807 options describing which optimizations should be included.
17808 @end enumerate
17809 The options from each group can be freely mixed as they are
17810 non-overlapping. However, in case of any conflicts,
17811 the later options override the earlier options on the command
17812 line.
17813
17814 The following options control which kinds of messages should be emitted:
17815
17816 @table @samp
17817 @item optimized
17818 Print information when an optimization is successfully applied. It is
17819 up to a pass to decide which information is relevant. For example, the
17820 vectorizer passes print the source location of loops which are
17821 successfully vectorized.
17822 @item missed
17823 Print information about missed optimizations. Individual passes
17824 control which information to include in the output.
17825 @item note
17826 Print verbose information about optimizations, such as certain
17827 transformations, more detailed messages about decisions etc.
17828 @item all
17829 Print detailed optimization information. This includes
17830 @samp{optimized}, @samp{missed}, and @samp{note}.
17831 @end table
17832
17833 The following option controls the dump verbosity:
17834
17835 @table @samp
17836 @item internals
17837 By default, only ``high-level'' messages are emitted. This option enables
17838 additional, more detailed, messages, which are likely to only be of interest
17839 to GCC developers.
17840 @end table
17841
17842 One or more of the following option keywords can be used to describe a
17843 group of optimizations:
17844
17845 @table @samp
17846 @item ipa
17847 Enable dumps from all interprocedural optimizations.
17848 @item loop
17849 Enable dumps from all loop optimizations.
17850 @item inline
17851 Enable dumps from all inlining optimizations.
17852 @item omp
17853 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
17854 @item vec
17855 Enable dumps from all vectorization optimizations.
17856 @item optall
17857 Enable dumps from all optimizations. This is a superset of
17858 the optimization groups listed above.
17859 @end table
17860
17861 If @var{options} is
17862 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
17863 about successful optimizations from all the passes, omitting messages
17864 that are treated as ``internals''.
17865
17866 If the @var{filename} is provided, then the dumps from all the
17867 applicable optimizations are concatenated into the @var{filename}.
17868 Otherwise the dump is output onto @file{stderr}. Though multiple
17869 @option{-fopt-info} options are accepted, only one of them can include
17870 a @var{filename}. If other filenames are provided then all but the
17871 first such option are ignored.
17872
17873 Note that the output @var{filename} is overwritten
17874 in case of multiple translation units. If a combined output from
17875 multiple translation units is desired, @file{stderr} should be used
17876 instead.
17877
17878 In the following example, the optimization info is output to
17879 @file{stderr}:
17880
17881 @smallexample
17882 gcc -O3 -fopt-info
17883 @end smallexample
17884
17885 This example:
17886 @smallexample
17887 gcc -O3 -fopt-info-missed=missed.all
17888 @end smallexample
17889
17890 @noindent
17891 outputs missed optimization report from all the passes into
17892 @file{missed.all}, and this one:
17893
17894 @smallexample
17895 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17896 @end smallexample
17897
17898 @noindent
17899 prints information about missed optimization opportunities from
17900 vectorization passes on @file{stderr}.
17901 Note that @option{-fopt-info-vec-missed} is equivalent to
17902 @option{-fopt-info-missed-vec}. The order of the optimization group
17903 names and message types listed after @option{-fopt-info} does not matter.
17904
17905 As another example,
17906 @smallexample
17907 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17908 @end smallexample
17909
17910 @noindent
17911 outputs information about missed optimizations as well as
17912 optimized locations from all the inlining passes into
17913 @file{inline.txt}.
17914
17915 Finally, consider:
17916
17917 @smallexample
17918 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17919 @end smallexample
17920
17921 @noindent
17922 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
17923 in conflict since only one output file is allowed. In this case, only
17924 the first option takes effect and the subsequent options are
17925 ignored. Thus only @file{vec.miss} is produced which contains
17926 dumps from the vectorizer about missed opportunities.
17927
17928 @item -fsave-optimization-record
17929 @opindex fsave-optimization-record
17930 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
17931 were performed, for those optimizations that support @option{-fopt-info}.
17932
17933 This option is experimental and the format of the data within the
17934 compressed JSON file is subject to change.
17935
17936 It is roughly equivalent to a machine-readable version of
17937 @option{-fopt-info-all}, as a collection of messages with source file,
17938 line number and column number, with the following additional data for
17939 each message:
17940
17941 @itemize @bullet
17942
17943 @item
17944 the execution count of the code being optimized, along with metadata about
17945 whether this was from actual profile data, or just an estimate, allowing
17946 consumers to prioritize messages by code hotness,
17947
17948 @item
17949 the function name of the code being optimized, where applicable,
17950
17951 @item
17952 the ``inlining chain'' for the code being optimized, so that when
17953 a function is inlined into several different places (which might
17954 themselves be inlined), the reader can distinguish between the copies,
17955
17956 @item
17957 objects identifying those parts of the message that refer to expressions,
17958 statements or symbol-table nodes, which of these categories they are, and,
17959 when available, their source code location,
17960
17961 @item
17962 the GCC pass that emitted the message, and
17963
17964 @item
17965 the location in GCC's own code from which the message was emitted
17966
17967 @end itemize
17968
17969 Additionally, some messages are logically nested within other
17970 messages, reflecting implementation details of the optimization
17971 passes.
17972
17973 @item -fsched-verbose=@var{n}
17974 @opindex fsched-verbose
17975 On targets that use instruction scheduling, this option controls the
17976 amount of debugging output the scheduler prints to the dump files.
17977
17978 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
17979 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
17980 For @var{n} greater than one, it also output basic block probabilities,
17981 detailed ready list information and unit/insn info. For @var{n} greater
17982 than two, it includes RTL at abort point, control-flow and regions info.
17983 And for @var{n} over four, @option{-fsched-verbose} also includes
17984 dependence info.
17985
17986
17987
17988 @item -fenable-@var{kind}-@var{pass}
17989 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
17990 @opindex fdisable-
17991 @opindex fenable-
17992
17993 This is a set of options that are used to explicitly disable/enable
17994 optimization passes. These options are intended for use for debugging GCC.
17995 Compiler users should use regular options for enabling/disabling
17996 passes instead.
17997
17998 @table @gcctabopt
17999
18000 @item -fdisable-ipa-@var{pass}
18001 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
18002 statically invoked in the compiler multiple times, the pass name should be
18003 appended with a sequential number starting from 1.
18004
18005 @item -fdisable-rtl-@var{pass}
18006 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
18007 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
18008 statically invoked in the compiler multiple times, the pass name should be
18009 appended with a sequential number starting from 1. @var{range-list} is a
18010 comma-separated list of function ranges or assembler names. Each range is a number
18011 pair separated by a colon. The range is inclusive in both ends. If the range
18012 is trivial, the number pair can be simplified as a single number. If the
18013 function's call graph node's @var{uid} falls within one of the specified ranges,
18014 the @var{pass} is disabled for that function. The @var{uid} is shown in the
18015 function header of a dump file, and the pass names can be dumped by using
18016 option @option{-fdump-passes}.
18017
18018 @item -fdisable-tree-@var{pass}
18019 @itemx -fdisable-tree-@var{pass}=@var{range-list}
18020 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
18021 option arguments.
18022
18023 @item -fenable-ipa-@var{pass}
18024 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
18025 statically invoked in the compiler multiple times, the pass name should be
18026 appended with a sequential number starting from 1.
18027
18028 @item -fenable-rtl-@var{pass}
18029 @itemx -fenable-rtl-@var{pass}=@var{range-list}
18030 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
18031 description and examples.
18032
18033 @item -fenable-tree-@var{pass}
18034 @itemx -fenable-tree-@var{pass}=@var{range-list}
18035 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
18036 of option arguments.
18037
18038 @end table
18039
18040 Here are some examples showing uses of these options.
18041
18042 @smallexample
18043
18044 # disable ccp1 for all functions
18045 -fdisable-tree-ccp1
18046 # disable complete unroll for function whose cgraph node uid is 1
18047 -fenable-tree-cunroll=1
18048 # disable gcse2 for functions at the following ranges [1,1],
18049 # [300,400], and [400,1000]
18050 # disable gcse2 for functions foo and foo2
18051 -fdisable-rtl-gcse2=foo,foo2
18052 # disable early inlining
18053 -fdisable-tree-einline
18054 # disable ipa inlining
18055 -fdisable-ipa-inline
18056 # enable tree full unroll
18057 -fenable-tree-unroll
18058
18059 @end smallexample
18060
18061 @item -fchecking
18062 @itemx -fchecking=@var{n}
18063 @opindex fchecking
18064 @opindex fno-checking
18065 Enable internal consistency checking. The default depends on
18066 the compiler configuration. @option{-fchecking=2} enables further
18067 internal consistency checking that might affect code generation.
18068
18069 @item -frandom-seed=@var{string}
18070 @opindex frandom-seed
18071 This option provides a seed that GCC uses in place of
18072 random numbers in generating certain symbol names
18073 that have to be different in every compiled file. It is also used to
18074 place unique stamps in coverage data files and the object files that
18075 produce them. You can use the @option{-frandom-seed} option to produce
18076 reproducibly identical object files.
18077
18078 The @var{string} can either be a number (decimal, octal or hex) or an
18079 arbitrary string (in which case it's converted to a number by
18080 computing CRC32).
18081
18082 The @var{string} should be different for every file you compile.
18083
18084 @item -save-temps
18085 @opindex save-temps
18086 Store the usual ``temporary'' intermediate files permanently; name them
18087 as auxiliary output files, as specified described under
18088 @option{-dumpbase} and @option{-dumpdir}.
18089
18090 When used in combination with the @option{-x} command-line option,
18091 @option{-save-temps} is sensible enough to avoid overwriting an
18092 input source file with the same extension as an intermediate file.
18093 The corresponding intermediate file may be obtained by renaming the
18094 source file before using @option{-save-temps}.
18095
18096 @item -save-temps=cwd
18097 @opindex save-temps=cwd
18098 Equivalent to @option{-save-temps -dumpdir ./}.
18099
18100 @item -save-temps=obj
18101 @opindex save-temps=obj
18102 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
18103 @file{outdir/} is the directory of the output file specified after the
18104 @option{-o} option, including any directory separators. If the
18105 @option{-o} option is not used, the @option{-save-temps=obj} switch
18106 behaves like @option{-save-temps=cwd}.
18107
18108 @item -time@r{[}=@var{file}@r{]}
18109 @opindex time
18110 Report the CPU time taken by each subprocess in the compilation
18111 sequence. For C source files, this is the compiler proper and assembler
18112 (plus the linker if linking is done).
18113
18114 Without the specification of an output file, the output looks like this:
18115
18116 @smallexample
18117 # cc1 0.12 0.01
18118 # as 0.00 0.01
18119 @end smallexample
18120
18121 The first number on each line is the ``user time'', that is time spent
18122 executing the program itself. The second number is ``system time'',
18123 time spent executing operating system routines on behalf of the program.
18124 Both numbers are in seconds.
18125
18126 With the specification of an output file, the output is appended to the
18127 named file, and it looks like this:
18128
18129 @smallexample
18130 0.12 0.01 cc1 @var{options}
18131 0.00 0.01 as @var{options}
18132 @end smallexample
18133
18134 The ``user time'' and the ``system time'' are moved before the program
18135 name, and the options passed to the program are displayed, so that one
18136 can later tell what file was being compiled, and with which options.
18137
18138 @item -fdump-final-insns@r{[}=@var{file}@r{]}
18139 @opindex fdump-final-insns
18140 Dump the final internal representation (RTL) to @var{file}. If the
18141 optional argument is omitted (or if @var{file} is @code{.}), the name
18142 of the dump file is determined by appending @code{.gkd} to the
18143 dump base name, see @option{-dumpbase}.
18144
18145 @item -fcompare-debug@r{[}=@var{opts}@r{]}
18146 @opindex fcompare-debug
18147 @opindex fno-compare-debug
18148 If no error occurs during compilation, run the compiler a second time,
18149 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
18150 passed to the second compilation. Dump the final internal
18151 representation in both compilations, and print an error if they differ.
18152
18153 If the equal sign is omitted, the default @option{-gtoggle} is used.
18154
18155 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
18156 and nonzero, implicitly enables @option{-fcompare-debug}. If
18157 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
18158 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
18159 is used.
18160
18161 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
18162 is equivalent to @option{-fno-compare-debug}, which disables the dumping
18163 of the final representation and the second compilation, preventing even
18164 @env{GCC_COMPARE_DEBUG} from taking effect.
18165
18166 To verify full coverage during @option{-fcompare-debug} testing, set
18167 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
18168 which GCC rejects as an invalid option in any actual compilation
18169 (rather than preprocessing, assembly or linking). To get just a
18170 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
18171 not overridden} will do.
18172
18173 @item -fcompare-debug-second
18174 @opindex fcompare-debug-second
18175 This option is implicitly passed to the compiler for the second
18176 compilation requested by @option{-fcompare-debug}, along with options to
18177 silence warnings, and omitting other options that would cause the compiler
18178 to produce output to files or to standard output as a side effect. Dump
18179 files and preserved temporary files are renamed so as to contain the
18180 @code{.gk} additional extension during the second compilation, to avoid
18181 overwriting those generated by the first.
18182
18183 When this option is passed to the compiler driver, it causes the
18184 @emph{first} compilation to be skipped, which makes it useful for little
18185 other than debugging the compiler proper.
18186
18187 @item -gtoggle
18188 @opindex gtoggle
18189 Turn off generation of debug info, if leaving out this option
18190 generates it, or turn it on at level 2 otherwise. The position of this
18191 argument in the command line does not matter; it takes effect after all
18192 other options are processed, and it does so only once, no matter how
18193 many times it is given. This is mainly intended to be used with
18194 @option{-fcompare-debug}.
18195
18196 @item -fvar-tracking-assignments-toggle
18197 @opindex fvar-tracking-assignments-toggle
18198 @opindex fno-var-tracking-assignments-toggle
18199 Toggle @option{-fvar-tracking-assignments}, in the same way that
18200 @option{-gtoggle} toggles @option{-g}.
18201
18202 @item -Q
18203 @opindex Q
18204 Makes the compiler print out each function name as it is compiled, and
18205 print some statistics about each pass when it finishes.
18206
18207 @item -ftime-report
18208 @opindex ftime-report
18209 Makes the compiler print some statistics about the time consumed by each
18210 pass when it finishes.
18211
18212 @item -ftime-report-details
18213 @opindex ftime-report-details
18214 Record the time consumed by infrastructure parts separately for each pass.
18215
18216 @item -fira-verbose=@var{n}
18217 @opindex fira-verbose
18218 Control the verbosity of the dump file for the integrated register allocator.
18219 The default value is 5. If the value @var{n} is greater or equal to 10,
18220 the dump output is sent to stderr using the same format as @var{n} minus 10.
18221
18222 @item -flto-report
18223 @opindex flto-report
18224 Prints a report with internal details on the workings of the link-time
18225 optimizer. The contents of this report vary from version to version.
18226 It is meant to be useful to GCC developers when processing object
18227 files in LTO mode (via @option{-flto}).
18228
18229 Disabled by default.
18230
18231 @item -flto-report-wpa
18232 @opindex flto-report-wpa
18233 Like @option{-flto-report}, but only print for the WPA phase of link-time
18234 optimization.
18235
18236 @item -fmem-report
18237 @opindex fmem-report
18238 Makes the compiler print some statistics about permanent memory
18239 allocation when it finishes.
18240
18241 @item -fmem-report-wpa
18242 @opindex fmem-report-wpa
18243 Makes the compiler print some statistics about permanent memory
18244 allocation for the WPA phase only.
18245
18246 @item -fpre-ipa-mem-report
18247 @opindex fpre-ipa-mem-report
18248 @item -fpost-ipa-mem-report
18249 @opindex fpost-ipa-mem-report
18250 Makes the compiler print some statistics about permanent memory
18251 allocation before or after interprocedural optimization.
18252
18253 @item -fprofile-report
18254 @opindex fprofile-report
18255 Makes the compiler print some statistics about consistency of the
18256 (estimated) profile and effect of individual passes.
18257
18258 @item -fstack-usage
18259 @opindex fstack-usage
18260 Makes the compiler output stack usage information for the program, on a
18261 per-function basis. The filename for the dump is made by appending
18262 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
18263 the output file, if explicitly specified and it is not an executable,
18264 otherwise it is the basename of the source file. An entry is made up
18265 of three fields:
18266
18267 @itemize
18268 @item
18269 The name of the function.
18270 @item
18271 A number of bytes.
18272 @item
18273 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
18274 @end itemize
18275
18276 The qualifier @code{static} means that the function manipulates the stack
18277 statically: a fixed number of bytes are allocated for the frame on function
18278 entry and released on function exit; no stack adjustments are otherwise made
18279 in the function. The second field is this fixed number of bytes.
18280
18281 The qualifier @code{dynamic} means that the function manipulates the stack
18282 dynamically: in addition to the static allocation described above, stack
18283 adjustments are made in the body of the function, for example to push/pop
18284 arguments around function calls. If the qualifier @code{bounded} is also
18285 present, the amount of these adjustments is bounded at compile time and
18286 the second field is an upper bound of the total amount of stack used by
18287 the function. If it is not present, the amount of these adjustments is
18288 not bounded at compile time and the second field only represents the
18289 bounded part.
18290
18291 @item -fstats
18292 @opindex fstats
18293 Emit statistics about front-end processing at the end of the compilation.
18294 This option is supported only by the C++ front end, and
18295 the information is generally only useful to the G++ development team.
18296
18297 @item -fdbg-cnt-list
18298 @opindex fdbg-cnt-list
18299 Print the name and the counter upper bound for all debug counters.
18300
18301
18302 @item -fdbg-cnt=@var{counter-value-list}
18303 @opindex fdbg-cnt
18304 Set the internal debug counter lower and upper bound. @var{counter-value-list}
18305 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
18306 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
18307 the name of the counter and list of closed intervals.
18308 The @var{lower_bound} is optional and is zero
18309 initialized if not set.
18310 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
18311 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
18312 eleventh invocation.
18313 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
18314
18315 @item -print-file-name=@var{library}
18316 @opindex print-file-name
18317 Print the full absolute name of the library file @var{library} that
18318 would be used when linking---and don't do anything else. With this
18319 option, GCC does not compile or link anything; it just prints the
18320 file name.
18321
18322 @item -print-multi-directory
18323 @opindex print-multi-directory
18324 Print the directory name corresponding to the multilib selected by any
18325 other switches present in the command line. This directory is supposed
18326 to exist in @env{GCC_EXEC_PREFIX}.
18327
18328 @item -print-multi-lib
18329 @opindex print-multi-lib
18330 Print the mapping from multilib directory names to compiler switches
18331 that enable them. The directory name is separated from the switches by
18332 @samp{;}, and each switch starts with an @samp{@@} instead of the
18333 @samp{-}, without spaces between multiple switches. This is supposed to
18334 ease shell processing.
18335
18336 @item -print-multi-os-directory
18337 @opindex print-multi-os-directory
18338 Print the path to OS libraries for the selected
18339 multilib, relative to some @file{lib} subdirectory. If OS libraries are
18340 present in the @file{lib} subdirectory and no multilibs are used, this is
18341 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
18342 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
18343 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
18344 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
18345
18346 @item -print-multiarch
18347 @opindex print-multiarch
18348 Print the path to OS libraries for the selected multiarch,
18349 relative to some @file{lib} subdirectory.
18350
18351 @item -print-prog-name=@var{program}
18352 @opindex print-prog-name
18353 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
18354
18355 @item -print-libgcc-file-name
18356 @opindex print-libgcc-file-name
18357 Same as @option{-print-file-name=libgcc.a}.
18358
18359 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
18360 but you do want to link with @file{libgcc.a}. You can do:
18361
18362 @smallexample
18363 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
18364 @end smallexample
18365
18366 @item -print-search-dirs
18367 @opindex print-search-dirs
18368 Print the name of the configured installation directory and a list of
18369 program and library directories @command{gcc} searches---and don't do anything else.
18370
18371 This is useful when @command{gcc} prints the error message
18372 @samp{installation problem, cannot exec cpp0: No such file or directory}.
18373 To resolve this you either need to put @file{cpp0} and the other compiler
18374 components where @command{gcc} expects to find them, or you can set the environment
18375 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
18376 Don't forget the trailing @samp{/}.
18377 @xref{Environment Variables}.
18378
18379 @item -print-sysroot
18380 @opindex print-sysroot
18381 Print the target sysroot directory that is used during
18382 compilation. This is the target sysroot specified either at configure
18383 time or using the @option{--sysroot} option, possibly with an extra
18384 suffix that depends on compilation options. If no target sysroot is
18385 specified, the option prints nothing.
18386
18387 @item -print-sysroot-headers-suffix
18388 @opindex print-sysroot-headers-suffix
18389 Print the suffix added to the target sysroot when searching for
18390 headers, or give an error if the compiler is not configured with such
18391 a suffix---and don't do anything else.
18392
18393 @item -dumpmachine
18394 @opindex dumpmachine
18395 Print the compiler's target machine (for example,
18396 @samp{i686-pc-linux-gnu})---and don't do anything else.
18397
18398 @item -dumpversion
18399 @opindex dumpversion
18400 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
18401 anything else. This is the compiler version used in filesystem paths and
18402 specs. Depending on how the compiler has been configured it can be just
18403 a single number (major version), two numbers separated by a dot (major and
18404 minor version) or three numbers separated by dots (major, minor and patchlevel
18405 version).
18406
18407 @item -dumpfullversion
18408 @opindex dumpfullversion
18409 Print the full compiler version---and don't do anything else. The output is
18410 always three numbers separated by dots, major, minor and patchlevel version.
18411
18412 @item -dumpspecs
18413 @opindex dumpspecs
18414 Print the compiler's built-in specs---and don't do anything else. (This
18415 is used when GCC itself is being built.) @xref{Spec Files}.
18416 @end table
18417
18418 @node Submodel Options
18419 @section Machine-Dependent Options
18420 @cindex submodel options
18421 @cindex specifying hardware config
18422 @cindex hardware models and configurations, specifying
18423 @cindex target-dependent options
18424 @cindex machine-dependent options
18425
18426 Each target machine supported by GCC can have its own options---for
18427 example, to allow you to compile for a particular processor variant or
18428 ABI, or to control optimizations specific to that machine. By
18429 convention, the names of machine-specific options start with
18430 @samp{-m}.
18431
18432 Some configurations of the compiler also support additional target-specific
18433 options, usually for compatibility with other compilers on the same
18434 platform.
18435
18436 @c This list is ordered alphanumerically by subsection name.
18437 @c It should be the same order and spelling as these options are listed
18438 @c in Machine Dependent Options
18439
18440 @menu
18441 * AArch64 Options::
18442 * Adapteva Epiphany Options::
18443 * AMD GCN Options::
18444 * ARC Options::
18445 * ARM Options::
18446 * AVR Options::
18447 * Blackfin Options::
18448 * C6X Options::
18449 * CRIS Options::
18450 * CR16 Options::
18451 * C-SKY Options::
18452 * Darwin Options::
18453 * DEC Alpha Options::
18454 * eBPF Options::
18455 * FR30 Options::
18456 * FT32 Options::
18457 * FRV Options::
18458 * GNU/Linux Options::
18459 * H8/300 Options::
18460 * HPPA Options::
18461 * IA-64 Options::
18462 * LM32 Options::
18463 * M32C Options::
18464 * M32R/D Options::
18465 * M680x0 Options::
18466 * MCore Options::
18467 * MeP Options::
18468 * MicroBlaze Options::
18469 * MIPS Options::
18470 * MMIX Options::
18471 * MN10300 Options::
18472 * Moxie Options::
18473 * MSP430 Options::
18474 * NDS32 Options::
18475 * Nios II Options::
18476 * Nvidia PTX Options::
18477 * OpenRISC Options::
18478 * PDP-11 Options::
18479 * picoChip Options::
18480 * PowerPC Options::
18481 * PRU Options::
18482 * RISC-V Options::
18483 * RL78 Options::
18484 * RS/6000 and PowerPC Options::
18485 * RX Options::
18486 * S/390 and zSeries Options::
18487 * Score Options::
18488 * SH Options::
18489 * Solaris 2 Options::
18490 * SPARC Options::
18491 * System V Options::
18492 * TILE-Gx Options::
18493 * TILEPro Options::
18494 * V850 Options::
18495 * VAX Options::
18496 * Visium Options::
18497 * VMS Options::
18498 * VxWorks Options::
18499 * x86 Options::
18500 * x86 Windows Options::
18501 * Xstormy16 Options::
18502 * Xtensa Options::
18503 * zSeries Options::
18504 @end menu
18505
18506 @node AArch64 Options
18507 @subsection AArch64 Options
18508 @cindex AArch64 Options
18509
18510 These options are defined for AArch64 implementations:
18511
18512 @table @gcctabopt
18513
18514 @item -mabi=@var{name}
18515 @opindex mabi
18516 Generate code for the specified data model. Permissible values
18517 are @samp{ilp32} for SysV-like data model where int, long int and pointers
18518 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
18519 but long int and pointers are 64 bits.
18520
18521 The default depends on the specific target configuration. Note that
18522 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
18523 entire program with the same ABI, and link with a compatible set of libraries.
18524
18525 @item -mbig-endian
18526 @opindex mbig-endian
18527 Generate big-endian code. This is the default when GCC is configured for an
18528 @samp{aarch64_be-*-*} target.
18529
18530 @item -mgeneral-regs-only
18531 @opindex mgeneral-regs-only
18532 Generate code which uses only the general-purpose registers. This will prevent
18533 the compiler from using floating-point and Advanced SIMD registers but will not
18534 impose any restrictions on the assembler.
18535
18536 @item -mlittle-endian
18537 @opindex mlittle-endian
18538 Generate little-endian code. This is the default when GCC is configured for an
18539 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
18540
18541 @item -mcmodel=tiny
18542 @opindex mcmodel=tiny
18543 Generate code for the tiny code model. The program and its statically defined
18544 symbols must be within 1MB of each other. Programs can be statically or
18545 dynamically linked.
18546
18547 @item -mcmodel=small
18548 @opindex mcmodel=small
18549 Generate code for the small code model. The program and its statically defined
18550 symbols must be within 4GB of each other. Programs can be statically or
18551 dynamically linked. This is the default code model.
18552
18553 @item -mcmodel=large
18554 @opindex mcmodel=large
18555 Generate code for the large code model. This makes no assumptions about
18556 addresses and sizes of sections. Programs can be statically linked only. The
18557 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
18558 @option{-fpic} and @option{-fPIC}.
18559
18560 @item -mstrict-align
18561 @itemx -mno-strict-align
18562 @opindex mstrict-align
18563 @opindex mno-strict-align
18564 Avoid or allow generating memory accesses that may not be aligned on a natural
18565 object boundary as described in the architecture specification.
18566
18567 @item -momit-leaf-frame-pointer
18568 @itemx -mno-omit-leaf-frame-pointer
18569 @opindex momit-leaf-frame-pointer
18570 @opindex mno-omit-leaf-frame-pointer
18571 Omit or keep the frame pointer in leaf functions. The former behavior is the
18572 default.
18573
18574 @item -mstack-protector-guard=@var{guard}
18575 @itemx -mstack-protector-guard-reg=@var{reg}
18576 @itemx -mstack-protector-guard-offset=@var{offset}
18577 @opindex mstack-protector-guard
18578 @opindex mstack-protector-guard-reg
18579 @opindex mstack-protector-guard-offset
18580 Generate stack protection code using canary at @var{guard}. Supported
18581 locations are @samp{global} for a global canary or @samp{sysreg} for a
18582 canary in an appropriate system register.
18583
18584 With the latter choice the options
18585 @option{-mstack-protector-guard-reg=@var{reg}} and
18586 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
18587 which system register to use as base register for reading the canary,
18588 and from what offset from that base register. There is no default
18589 register or offset as this is entirely for use within the Linux
18590 kernel.
18591
18592 @item -mtls-dialect=desc
18593 @opindex mtls-dialect=desc
18594 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
18595 of TLS variables. This is the default.
18596
18597 @item -mtls-dialect=traditional
18598 @opindex mtls-dialect=traditional
18599 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
18600 of TLS variables.
18601
18602 @item -mtls-size=@var{size}
18603 @opindex mtls-size
18604 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
18605 This option requires binutils 2.26 or newer.
18606
18607 @item -mfix-cortex-a53-835769
18608 @itemx -mno-fix-cortex-a53-835769
18609 @opindex mfix-cortex-a53-835769
18610 @opindex mno-fix-cortex-a53-835769
18611 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
18612 This involves inserting a NOP instruction between memory instructions and
18613 64-bit integer multiply-accumulate instructions.
18614
18615 @item -mfix-cortex-a53-843419
18616 @itemx -mno-fix-cortex-a53-843419
18617 @opindex mfix-cortex-a53-843419
18618 @opindex mno-fix-cortex-a53-843419
18619 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
18620 This erratum workaround is made at link time and this will only pass the
18621 corresponding flag to the linker.
18622
18623 @item -mlow-precision-recip-sqrt
18624 @itemx -mno-low-precision-recip-sqrt
18625 @opindex mlow-precision-recip-sqrt
18626 @opindex mno-low-precision-recip-sqrt
18627 Enable or disable the reciprocal square root approximation.
18628 This option only has an effect if @option{-ffast-math} or
18629 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18630 precision of reciprocal square root results to about 16 bits for
18631 single precision and to 32 bits for double precision.
18632
18633 @item -mlow-precision-sqrt
18634 @itemx -mno-low-precision-sqrt
18635 @opindex mlow-precision-sqrt
18636 @opindex mno-low-precision-sqrt
18637 Enable or disable the square root approximation.
18638 This option only has an effect if @option{-ffast-math} or
18639 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18640 precision of square root results to about 16 bits for
18641 single precision and to 32 bits for double precision.
18642 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
18643
18644 @item -mlow-precision-div
18645 @itemx -mno-low-precision-div
18646 @opindex mlow-precision-div
18647 @opindex mno-low-precision-div
18648 Enable or disable the division approximation.
18649 This option only has an effect if @option{-ffast-math} or
18650 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18651 precision of division results to about 16 bits for
18652 single precision and to 32 bits for double precision.
18653
18654 @item -mtrack-speculation
18655 @itemx -mno-track-speculation
18656 Enable or disable generation of additional code to track speculative
18657 execution through conditional branches. The tracking state can then
18658 be used by the compiler when expanding calls to
18659 @code{__builtin_speculation_safe_copy} to permit a more efficient code
18660 sequence to be generated.
18661
18662 @item -moutline-atomics
18663 @itemx -mno-outline-atomics
18664 Enable or disable calls to out-of-line helpers to implement atomic operations.
18665 These helpers will, at runtime, determine if the LSE instructions from
18666 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
18667 instructions that are present in the base ARMv8.0 ISA.
18668
18669 This option is only applicable when compiling for the base ARMv8.0
18670 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
18671 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
18672 used directly. The same applies when using @option{-mcpu=} when the
18673 selected cpu supports the @samp{lse} feature.
18674 This option is on by default.
18675
18676 @item -march=@var{name}
18677 @opindex march
18678 Specify the name of the target architecture and, optionally, one or
18679 more feature modifiers. This option has the form
18680 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
18681
18682 The table below summarizes the permissible values for @var{arch}
18683 and the features that they enable by default:
18684
18685 @multitable @columnfractions 0.20 0.20 0.60
18686 @headitem @var{arch} value @tab Architecture @tab Includes by default
18687 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
18688 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
18689 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
18690 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
18691 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
18692 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
18693 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
18694 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
18695 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
18696 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
18697 @end multitable
18698
18699 The value @samp{native} is available on native AArch64 GNU/Linux and
18700 causes the compiler to pick the architecture of the host system. This
18701 option has no effect if the compiler is unable to recognize the
18702 architecture of the host system,
18703
18704 The permissible values for @var{feature} are listed in the sub-section
18705 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18706 Feature Modifiers}. Where conflicting feature modifiers are
18707 specified, the right-most feature is used.
18708
18709 GCC uses @var{name} to determine what kind of instructions it can emit
18710 when generating assembly code. If @option{-march} is specified
18711 without either of @option{-mtune} or @option{-mcpu} also being
18712 specified, the code is tuned to perform well across a range of target
18713 processors implementing the target architecture.
18714
18715 @item -mtune=@var{name}
18716 @opindex mtune
18717 Specify the name of the target processor for which GCC should tune the
18718 performance of the code. Permissible values for this option are:
18719 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18720 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18721 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18722 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
18723 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
18724 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
18725 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
18726 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{qdf24xx},
18727 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
18728 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
18729 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
18730 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
18731 @samp{octeontx2f95mm},
18732 @samp{a64fx},
18733 @samp{thunderx}, @samp{thunderxt88},
18734 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
18735 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
18736 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18737 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18738 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
18739 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x2},
18740 @samp{cortex-a510}, @samp{cortex-a710}, @samp{ampere1}, @samp{native}.
18741
18742 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18743 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18744 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
18745 should tune for a big.LITTLE system.
18746
18747 The value @samp{neoverse-512tvb} specifies that GCC should tune
18748 for Neoverse cores that (a) implement SVE and (b) have a total vector
18749 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
18750 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
18751 instructions a cycle and that can execute an equivalent number of SVE
18752 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
18753 This is more general than tuning for a specific core like Neoverse V1
18754 but is more specific than the default tuning described below.
18755
18756 Additionally on native AArch64 GNU/Linux systems the value
18757 @samp{native} tunes performance to the host system. This option has no effect
18758 if the compiler is unable to recognize the processor of the host system.
18759
18760 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
18761 are specified, the code is tuned to perform well across a range
18762 of target processors.
18763
18764 This option cannot be suffixed by feature modifiers.
18765
18766 @item -mcpu=@var{name}
18767 @opindex mcpu
18768 Specify the name of the target processor, optionally suffixed by one
18769 or more feature modifiers. This option has the form
18770 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
18771 the permissible values for @var{cpu} are the same as those available
18772 for @option{-mtune}. The permissible values for @var{feature} are
18773 documented in the sub-section on
18774 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18775 Feature Modifiers}. Where conflicting feature modifiers are
18776 specified, the right-most feature is used.
18777
18778 GCC uses @var{name} to determine what kind of instructions it can emit when
18779 generating assembly code (as if by @option{-march}) and to determine
18780 the target processor for which to tune for performance (as if
18781 by @option{-mtune}). Where this option is used in conjunction
18782 with @option{-march} or @option{-mtune}, those options take precedence
18783 over the appropriate part of this option.
18784
18785 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
18786 to a specific core, but instead refers to all Neoverse cores that
18787 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
18788 a cycle. Unless overridden by @option{-march},
18789 @option{-mcpu=neoverse-512tvb} generates code that can run on a
18790 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
18791 these properties. Unless overridden by @option{-mtune},
18792 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
18793 @option{-mtune=neoverse-512tvb}.
18794
18795 @item -moverride=@var{string}
18796 @opindex moverride
18797 Override tuning decisions made by the back-end in response to a
18798 @option{-mtune=} switch. The syntax, semantics, and accepted values
18799 for @var{string} in this option are not guaranteed to be consistent
18800 across releases.
18801
18802 This option is only intended to be useful when developing GCC.
18803
18804 @item -mverbose-cost-dump
18805 @opindex mverbose-cost-dump
18806 Enable verbose cost model dumping in the debug dump files. This option is
18807 provided for use in debugging the compiler.
18808
18809 @item -mpc-relative-literal-loads
18810 @itemx -mno-pc-relative-literal-loads
18811 @opindex mpc-relative-literal-loads
18812 @opindex mno-pc-relative-literal-loads
18813 Enable or disable PC-relative literal loads. With this option literal pools are
18814 accessed using a single instruction and emitted after each function. This
18815 limits the maximum size of functions to 1MB. This is enabled by default for
18816 @option{-mcmodel=tiny}.
18817
18818 @item -msign-return-address=@var{scope}
18819 @opindex msign-return-address
18820 Select the function scope on which return address signing will be applied.
18821 Permissible values are @samp{none}, which disables return address signing,
18822 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
18823 functions, and @samp{all}, which enables pointer signing for all functions. The
18824 default value is @samp{none}. This option has been deprecated by
18825 -mbranch-protection.
18826
18827 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
18828 @opindex mbranch-protection
18829 Select the branch protection features to use.
18830 @samp{none} is the default and turns off all types of branch protection.
18831 @samp{standard} turns on all types of branch protection features. If a feature
18832 has additional tuning options, then @samp{standard} sets it to its standard
18833 level.
18834 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
18835 level: signing functions that save the return address to memory (non-leaf
18836 functions will practically always do this) using the a-key. The optional
18837 argument @samp{leaf} can be used to extend the signing to include leaf
18838 functions. The optional argument @samp{b-key} can be used to sign the functions
18839 with the B-key instead of the A-key.
18840 @samp{bti} turns on branch target identification mechanism.
18841
18842 @item -mharden-sls=@var{opts}
18843 @opindex mharden-sls
18844 Enable compiler hardening against straight line speculation (SLS).
18845 @var{opts} is a comma-separated list of the following options:
18846 @table @samp
18847 @item retbr
18848 @item blr
18849 @end table
18850 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
18851 @samp{-mharden-sls=none} disables all SLS hardening.
18852
18853 @item -msve-vector-bits=@var{bits}
18854 @opindex msve-vector-bits
18855 Specify the number of bits in an SVE vector register. This option only has
18856 an effect when SVE is enabled.
18857
18858 GCC supports two forms of SVE code generation: ``vector-length
18859 agnostic'' output that works with any size of vector register and
18860 ``vector-length specific'' output that allows GCC to make assumptions
18861 about the vector length when it is useful for optimization reasons.
18862 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
18863 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
18864 Specifying @samp{scalable} selects vector-length agnostic
18865 output. At present @samp{-msve-vector-bits=128} also generates vector-length
18866 agnostic output for big-endian targets. All other values generate
18867 vector-length specific code. The behavior of these values may change
18868 in future releases and no value except @samp{scalable} should be
18869 relied on for producing code that is portable across different
18870 hardware SVE vector lengths.
18871
18872 The default is @samp{-msve-vector-bits=scalable}, which produces
18873 vector-length agnostic code.
18874 @end table
18875
18876 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
18877 @anchor{aarch64-feature-modifiers}
18878 @cindex @option{-march} feature modifiers
18879 @cindex @option{-mcpu} feature modifiers
18880 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
18881 the following and their inverses @option{no@var{feature}}:
18882
18883 @table @samp
18884 @item crc
18885 Enable CRC extension. This is on by default for
18886 @option{-march=armv8.1-a}.
18887 @item crypto
18888 Enable Crypto extension. This also enables Advanced SIMD and floating-point
18889 instructions.
18890 @item fp
18891 Enable floating-point instructions. This is on by default for all possible
18892 values for options @option{-march} and @option{-mcpu}.
18893 @item simd
18894 Enable Advanced SIMD instructions. This also enables floating-point
18895 instructions. This is on by default for all possible values for options
18896 @option{-march} and @option{-mcpu}.
18897 @item sve
18898 Enable Scalable Vector Extension instructions. This also enables Advanced
18899 SIMD and floating-point instructions.
18900 @item lse
18901 Enable Large System Extension instructions. This is on by default for
18902 @option{-march=armv8.1-a}.
18903 @item rdma
18904 Enable Round Double Multiply Accumulate instructions. This is on by default
18905 for @option{-march=armv8.1-a}.
18906 @item fp16
18907 Enable FP16 extension. This also enables floating-point instructions.
18908 @item fp16fml
18909 Enable FP16 fmla extension. This also enables FP16 extensions and
18910 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.
18911
18912 @item rcpc
18913 Enable the RcPc extension. This does not change code generation from GCC,
18914 but is passed on to the assembler, enabling inline asm statements to use
18915 instructions from the RcPc extension.
18916 @item dotprod
18917 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
18918 @item aes
18919 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
18920 SIMD instructions.
18921 @item sha2
18922 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
18923 @item sha3
18924 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
18925 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
18926 @item sm4
18927 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
18928 Use of this option with architectures prior to Armv8.2-A is not supported.
18929 @item profile
18930 Enable the Statistical Profiling extension. This option is only to enable the
18931 extension at the assembler level and does not affect code generation.
18932 @item rng
18933 Enable the Armv8.5-a Random Number instructions. This option is only to
18934 enable the extension at the assembler level and does not affect code
18935 generation.
18936 @item memtag
18937 Enable the Armv8.5-a Memory Tagging Extensions.
18938 Use of this option with architectures prior to Armv8.5-A is not supported.
18939 @item sb
18940 Enable the Armv8-a Speculation Barrier instruction. This option is only to
18941 enable the extension at the assembler level and does not affect code
18942 generation. This option is enabled by default for @option{-march=armv8.5-a}.
18943 @item ssbs
18944 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
18945 is only to enable the extension at the assembler level and does not affect code
18946 generation. This option is enabled by default for @option{-march=armv8.5-a}.
18947 @item predres
18948 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
18949 This option is only to enable the extension at the assembler level and does
18950 not affect code generation. This option is enabled by default for
18951 @option{-march=armv8.5-a}.
18952 @item sve2
18953 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
18954 instructions.
18955 @item sve2-bitperm
18956 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
18957 @item sve2-sm4
18958 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
18959 @item sve2-aes
18960 Enable SVE2 aes instructions. This also enables SVE2 instructions.
18961 @item sve2-sha3
18962 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
18963 @item tme
18964 Enable the Transactional Memory Extension.
18965 @item i8mm
18966 Enable 8-bit Integer Matrix Multiply instructions. This also enables
18967 Advanced SIMD and floating-point instructions. This option is enabled by
18968 default for @option{-march=armv8.6-a}. Use of this option with architectures
18969 prior to Armv8.2-A is not supported.
18970 @item f32mm
18971 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
18972 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
18973 not supported.
18974 @item f64mm
18975 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
18976 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
18977 not supported.
18978 @item bf16
18979 Enable brain half-precision floating-point instructions. This also enables
18980 Advanced SIMD and floating-point instructions. This option is enabled by
18981 default for @option{-march=armv8.6-a}. Use of this option with architectures
18982 prior to Armv8.2-A is not supported.
18983 @item ls64
18984 Enable the 64-byte atomic load and store instructions for accelerators.
18985 This option is enabled by default for @option{-march=armv8.7-a}.
18986 @item flagm
18987 Enable the Flag Manipulation instructions Extension.
18988 @item pauth
18989 Enable the Pointer Authentication Extension.
18990
18991 @end table
18992
18993 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
18994 which implies @option{fp}.
18995 Conversely, @option{nofp} implies @option{nosimd}, which implies
18996 @option{nocrypto}, @option{noaes} and @option{nosha2}.
18997
18998 @node Adapteva Epiphany Options
18999 @subsection Adapteva Epiphany Options
19000
19001 These @samp{-m} options are defined for Adapteva Epiphany:
19002
19003 @table @gcctabopt
19004 @item -mhalf-reg-file
19005 @opindex mhalf-reg-file
19006 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
19007 That allows code to run on hardware variants that lack these registers.
19008
19009 @item -mprefer-short-insn-regs
19010 @opindex mprefer-short-insn-regs
19011 Preferentially allocate registers that allow short instruction generation.
19012 This can result in increased instruction count, so this may either reduce or
19013 increase overall code size.
19014
19015 @item -mbranch-cost=@var{num}
19016 @opindex mbranch-cost
19017 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19018 This cost is only a heuristic and is not guaranteed to produce
19019 consistent results across releases.
19020
19021 @item -mcmove
19022 @opindex mcmove
19023 Enable the generation of conditional moves.
19024
19025 @item -mnops=@var{num}
19026 @opindex mnops
19027 Emit @var{num} NOPs before every other generated instruction.
19028
19029 @item -mno-soft-cmpsf
19030 @opindex mno-soft-cmpsf
19031 @opindex msoft-cmpsf
19032 For single-precision floating-point comparisons, emit an @code{fsub} instruction
19033 and test the flags. This is faster than a software comparison, but can
19034 get incorrect results in the presence of NaNs, or when two different small
19035 numbers are compared such that their difference is calculated as zero.
19036 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
19037 software comparisons.
19038
19039 @item -mstack-offset=@var{num}
19040 @opindex mstack-offset
19041 Set the offset between the top of the stack and the stack pointer.
19042 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
19043 can be used by leaf functions without stack allocation.
19044 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
19045 Note also that this option changes the ABI; compiling a program with a
19046 different stack offset than the libraries have been compiled with
19047 generally does not work.
19048 This option can be useful if you want to evaluate if a different stack
19049 offset would give you better code, but to actually use a different stack
19050 offset to build working programs, it is recommended to configure the
19051 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
19052
19053 @item -mno-round-nearest
19054 @opindex mno-round-nearest
19055 @opindex mround-nearest
19056 Make the scheduler assume that the rounding mode has been set to
19057 truncating. The default is @option{-mround-nearest}.
19058
19059 @item -mlong-calls
19060 @opindex mlong-calls
19061 If not otherwise specified by an attribute, assume all calls might be beyond
19062 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
19063 function address into a register before performing a (otherwise direct) call.
19064 This is the default.
19065
19066 @item -mshort-calls
19067 @opindex short-calls
19068 If not otherwise specified by an attribute, assume all direct calls are
19069 in the range of the @code{b} / @code{bl} instructions, so use these instructions
19070 for direct calls. The default is @option{-mlong-calls}.
19071
19072 @item -msmall16
19073 @opindex msmall16
19074 Assume addresses can be loaded as 16-bit unsigned values. This does not
19075 apply to function addresses for which @option{-mlong-calls} semantics
19076 are in effect.
19077
19078 @item -mfp-mode=@var{mode}
19079 @opindex mfp-mode
19080 Set the prevailing mode of the floating-point unit.
19081 This determines the floating-point mode that is provided and expected
19082 at function call and return time. Making this mode match the mode you
19083 predominantly need at function start can make your programs smaller and
19084 faster by avoiding unnecessary mode switches.
19085
19086 @var{mode} can be set to one the following values:
19087
19088 @table @samp
19089 @item caller
19090 Any mode at function entry is valid, and retained or restored when
19091 the function returns, and when it calls other functions.
19092 This mode is useful for compiling libraries or other compilation units
19093 you might want to incorporate into different programs with different
19094 prevailing FPU modes, and the convenience of being able to use a single
19095 object file outweighs the size and speed overhead for any extra
19096 mode switching that might be needed, compared with what would be needed
19097 with a more specific choice of prevailing FPU mode.
19098
19099 @item truncate
19100 This is the mode used for floating-point calculations with
19101 truncating (i.e.@: round towards zero) rounding mode. That includes
19102 conversion from floating point to integer.
19103
19104 @item round-nearest
19105 This is the mode used for floating-point calculations with
19106 round-to-nearest-or-even rounding mode.
19107
19108 @item int
19109 This is the mode used to perform integer calculations in the FPU, e.g.@:
19110 integer multiply, or integer multiply-and-accumulate.
19111 @end table
19112
19113 The default is @option{-mfp-mode=caller}
19114
19115 @item -mno-split-lohi
19116 @itemx -mno-postinc
19117 @itemx -mno-postmodify
19118 @opindex mno-split-lohi
19119 @opindex msplit-lohi
19120 @opindex mno-postinc
19121 @opindex mpostinc
19122 @opindex mno-postmodify
19123 @opindex mpostmodify
19124 Code generation tweaks that disable, respectively, splitting of 32-bit
19125 loads, generation of post-increment addresses, and generation of
19126 post-modify addresses. The defaults are @option{msplit-lohi},
19127 @option{-mpost-inc}, and @option{-mpost-modify}.
19128
19129 @item -mnovect-double
19130 @opindex mno-vect-double
19131 @opindex mvect-double
19132 Change the preferred SIMD mode to SImode. The default is
19133 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
19134
19135 @item -max-vect-align=@var{num}
19136 @opindex max-vect-align
19137 The maximum alignment for SIMD vector mode types.
19138 @var{num} may be 4 or 8. The default is 8.
19139 Note that this is an ABI change, even though many library function
19140 interfaces are unaffected if they don't use SIMD vector modes
19141 in places that affect size and/or alignment of relevant types.
19142
19143 @item -msplit-vecmove-early
19144 @opindex msplit-vecmove-early
19145 Split vector moves into single word moves before reload. In theory this
19146 can give better register allocation, but so far the reverse seems to be
19147 generally the case.
19148
19149 @item -m1reg-@var{reg}
19150 @opindex m1reg-
19151 Specify a register to hold the constant @minus{}1, which makes loading small negative
19152 constants and certain bitmasks faster.
19153 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
19154 which specify use of that register as a fixed register,
19155 and @samp{none}, which means that no register is used for this
19156 purpose. The default is @option{-m1reg-none}.
19157
19158 @end table
19159
19160 @node AMD GCN Options
19161 @subsection AMD GCN Options
19162 @cindex AMD GCN Options
19163
19164 These options are defined specifically for the AMD GCN port.
19165
19166 @table @gcctabopt
19167
19168 @item -march=@var{gpu}
19169 @opindex march
19170 @itemx -mtune=@var{gpu}
19171 @opindex mtune
19172 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
19173 are
19174
19175 @table @samp
19176 @opindex fiji
19177 @item fiji
19178 Compile for GCN3 Fiji devices (gfx803).
19179
19180 @item gfx900
19181 Compile for GCN5 Vega 10 devices (gfx900).
19182
19183 @item gfx906
19184 Compile for GCN5 Vega 20 devices (gfx906).
19185
19186 @end table
19187
19188 @item -msram-ecc=on
19189 @itemx -msram-ecc=off
19190 @itemx -msram-ecc=any
19191 @opindex msram-ecc
19192 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
19193 disabled, or either mode. This feature can be enabled per-process on some
19194 devices. The compiled code must match the device mode. The default is
19195 @samp{any}, for devices that support it.
19196
19197 @item -mstack-size=@var{bytes}
19198 @opindex mstack-size
19199 Specify how many @var{bytes} of stack space will be requested for each GPU
19200 thread (wave-front). Beware that there may be many threads and limited memory
19201 available. The size of the stack allocation may also have an impact on
19202 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
19203 1MB otherwise.
19204
19205 @item -mxnack
19206 @opindex mxnack
19207 Compile binaries suitable for devices with the XNACK feature enabled. Some
19208 devices always require XNACK and some allow the user to configure XNACK. The
19209 compiled code must match the device mode. The default is @samp{-mno-xnack}.
19210 At present this option is a placeholder for support that is not yet
19211 implemented.
19212
19213 @end table
19214
19215 @node ARC Options
19216 @subsection ARC Options
19217 @cindex ARC options
19218
19219 The following options control the architecture variant for which code
19220 is being compiled:
19221
19222 @c architecture variants
19223 @table @gcctabopt
19224
19225 @item -mbarrel-shifter
19226 @opindex mbarrel-shifter
19227 Generate instructions supported by barrel shifter. This is the default
19228 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
19229
19230 @item -mjli-always
19231 @opindex mjli-alawys
19232 Force to call a function using jli_s instruction. This option is
19233 valid only for ARCv2 architecture.
19234
19235 @item -mcpu=@var{cpu}
19236 @opindex mcpu
19237 Set architecture type, register usage, and instruction scheduling
19238 parameters for @var{cpu}. There are also shortcut alias options
19239 available for backward compatibility and convenience. Supported
19240 values for @var{cpu} are
19241
19242 @table @samp
19243 @opindex mA6
19244 @opindex mARC600
19245 @item arc600
19246 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
19247
19248 @item arc601
19249 @opindex mARC601
19250 Compile for ARC601. Alias: @option{-mARC601}.
19251
19252 @item arc700
19253 @opindex mA7
19254 @opindex mARC700
19255 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
19256 This is the default when configured with @option{--with-cpu=arc700}@.
19257
19258 @item arcem
19259 Compile for ARC EM.
19260
19261 @item archs
19262 Compile for ARC HS.
19263
19264 @item em
19265 Compile for ARC EM CPU with no hardware extensions.
19266
19267 @item em4
19268 Compile for ARC EM4 CPU.
19269
19270 @item em4_dmips
19271 Compile for ARC EM4 DMIPS CPU.
19272
19273 @item em4_fpus
19274 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
19275 extension.
19276
19277 @item em4_fpuda
19278 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
19279 double assist instructions.
19280
19281 @item hs
19282 Compile for ARC HS CPU with no hardware extensions except the atomic
19283 instructions.
19284
19285 @item hs34
19286 Compile for ARC HS34 CPU.
19287
19288 @item hs38
19289 Compile for ARC HS38 CPU.
19290
19291 @item hs38_linux
19292 Compile for ARC HS38 CPU with all hardware extensions on.
19293
19294 @item arc600_norm
19295 Compile for ARC 600 CPU with @code{norm} instructions enabled.
19296
19297 @item arc600_mul32x16
19298 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
19299 instructions enabled.
19300
19301 @item arc600_mul64
19302 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
19303 instructions enabled.
19304
19305 @item arc601_norm
19306 Compile for ARC 601 CPU with @code{norm} instructions enabled.
19307
19308 @item arc601_mul32x16
19309 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
19310 instructions enabled.
19311
19312 @item arc601_mul64
19313 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
19314 instructions enabled.
19315
19316 @item nps400
19317 Compile for ARC 700 on NPS400 chip.
19318
19319 @item em_mini
19320 Compile for ARC EM minimalist configuration featuring reduced register
19321 set.
19322
19323 @end table
19324
19325 @item -mdpfp
19326 @opindex mdpfp
19327 @itemx -mdpfp-compact
19328 @opindex mdpfp-compact
19329 Generate double-precision FPX instructions, tuned for the compact
19330 implementation.
19331
19332 @item -mdpfp-fast
19333 @opindex mdpfp-fast
19334 Generate double-precision FPX instructions, tuned for the fast
19335 implementation.
19336
19337 @item -mno-dpfp-lrsr
19338 @opindex mno-dpfp-lrsr
19339 Disable @code{lr} and @code{sr} instructions from using FPX extension
19340 aux registers.
19341
19342 @item -mea
19343 @opindex mea
19344 Generate extended arithmetic instructions. Currently only
19345 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
19346 supported. Only valid for @option{-mcpu=ARC700}.
19347
19348 @item -mno-mpy
19349 @opindex mno-mpy
19350 @opindex mmpy
19351 Do not generate @code{mpy}-family instructions for ARC700. This option is
19352 deprecated.
19353
19354 @item -mmul32x16
19355 @opindex mmul32x16
19356 Generate 32x16-bit multiply and multiply-accumulate instructions.
19357
19358 @item -mmul64
19359 @opindex mmul64
19360 Generate @code{mul64} and @code{mulu64} instructions.
19361 Only valid for @option{-mcpu=ARC600}.
19362
19363 @item -mnorm
19364 @opindex mnorm
19365 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
19366 is in effect.
19367
19368 @item -mspfp
19369 @opindex mspfp
19370 @itemx -mspfp-compact
19371 @opindex mspfp-compact
19372 Generate single-precision FPX instructions, tuned for the compact
19373 implementation.
19374
19375 @item -mspfp-fast
19376 @opindex mspfp-fast
19377 Generate single-precision FPX instructions, tuned for the fast
19378 implementation.
19379
19380 @item -msimd
19381 @opindex msimd
19382 Enable generation of ARC SIMD instructions via target-specific
19383 builtins. Only valid for @option{-mcpu=ARC700}.
19384
19385 @item -msoft-float
19386 @opindex msoft-float
19387 This option ignored; it is provided for compatibility purposes only.
19388 Software floating-point code is emitted by default, and this default
19389 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
19390 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
19391 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
19392
19393 @item -mswap
19394 @opindex mswap
19395 Generate @code{swap} instructions.
19396
19397 @item -matomic
19398 @opindex matomic
19399 This enables use of the locked load/store conditional extension to implement
19400 atomic memory built-in functions. Not available for ARC 6xx or ARC
19401 EM cores.
19402
19403 @item -mdiv-rem
19404 @opindex mdiv-rem
19405 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
19406
19407 @item -mcode-density
19408 @opindex mcode-density
19409 Enable code density instructions for ARC EM.
19410 This option is on by default for ARC HS.
19411
19412 @item -mll64
19413 @opindex mll64
19414 Enable double load/store operations for ARC HS cores.
19415
19416 @item -mtp-regno=@var{regno}
19417 @opindex mtp-regno
19418 Specify thread pointer register number.
19419
19420 @item -mmpy-option=@var{multo}
19421 @opindex mmpy-option
19422 Compile ARCv2 code with a multiplier design option. You can specify
19423 the option using either a string or numeric value for @var{multo}.
19424 @samp{wlh1} is the default value. The recognized values are:
19425
19426 @table @samp
19427 @item 0
19428 @itemx none
19429 No multiplier available.
19430
19431 @item 1
19432 @itemx w
19433 16x16 multiplier, fully pipelined.
19434 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
19435
19436 @item 2
19437 @itemx wlh1
19438 32x32 multiplier, fully
19439 pipelined (1 stage). The following instructions are additionally
19440 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19441
19442 @item 3
19443 @itemx wlh2
19444 32x32 multiplier, fully pipelined
19445 (2 stages). The following instructions are additionally enabled: @code{mpy},
19446 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19447
19448 @item 4
19449 @itemx wlh3
19450 Two 16x16 multipliers, blocking,
19451 sequential. The following instructions are additionally enabled: @code{mpy},
19452 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19453
19454 @item 5
19455 @itemx wlh4
19456 One 16x16 multiplier, blocking,
19457 sequential. The following instructions are additionally enabled: @code{mpy},
19458 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19459
19460 @item 6
19461 @itemx wlh5
19462 One 32x4 multiplier, blocking,
19463 sequential. The following instructions are additionally enabled: @code{mpy},
19464 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19465
19466 @item 7
19467 @itemx plus_dmpy
19468 ARC HS SIMD support.
19469
19470 @item 8
19471 @itemx plus_macd
19472 ARC HS SIMD support.
19473
19474 @item 9
19475 @itemx plus_qmacw
19476 ARC HS SIMD support.
19477
19478 @end table
19479
19480 This option is only available for ARCv2 cores@.
19481
19482 @item -mfpu=@var{fpu}
19483 @opindex mfpu
19484 Enables support for specific floating-point hardware extensions for ARCv2
19485 cores. Supported values for @var{fpu} are:
19486
19487 @table @samp
19488
19489 @item fpus
19490 Enables support for single-precision floating-point hardware
19491 extensions@.
19492
19493 @item fpud
19494 Enables support for double-precision floating-point hardware
19495 extensions. The single-precision floating-point extension is also
19496 enabled. Not available for ARC EM@.
19497
19498 @item fpuda
19499 Enables support for double-precision floating-point hardware
19500 extensions using double-precision assist instructions. The single-precision
19501 floating-point extension is also enabled. This option is
19502 only available for ARC EM@.
19503
19504 @item fpuda_div
19505 Enables support for double-precision floating-point hardware
19506 extensions using double-precision assist instructions.
19507 The single-precision floating-point, square-root, and divide
19508 extensions are also enabled. This option is
19509 only available for ARC EM@.
19510
19511 @item fpuda_fma
19512 Enables support for double-precision floating-point hardware
19513 extensions using double-precision assist instructions.
19514 The single-precision floating-point and fused multiply and add
19515 hardware extensions are also enabled. This option is
19516 only available for ARC EM@.
19517
19518 @item fpuda_all
19519 Enables support for double-precision floating-point hardware
19520 extensions using double-precision assist instructions.
19521 All single-precision floating-point hardware extensions are also
19522 enabled. This option is only available for ARC EM@.
19523
19524 @item fpus_div
19525 Enables support for single-precision floating-point, square-root and divide
19526 hardware extensions@.
19527
19528 @item fpud_div
19529 Enables support for double-precision floating-point, square-root and divide
19530 hardware extensions. This option
19531 includes option @samp{fpus_div}. Not available for ARC EM@.
19532
19533 @item fpus_fma
19534 Enables support for single-precision floating-point and
19535 fused multiply and add hardware extensions@.
19536
19537 @item fpud_fma
19538 Enables support for double-precision floating-point and
19539 fused multiply and add hardware extensions. This option
19540 includes option @samp{fpus_fma}. Not available for ARC EM@.
19541
19542 @item fpus_all
19543 Enables support for all single-precision floating-point hardware
19544 extensions@.
19545
19546 @item fpud_all
19547 Enables support for all single- and double-precision floating-point
19548 hardware extensions. Not available for ARC EM@.
19549
19550 @end table
19551
19552 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
19553 @opindex mirq-ctrl-saved
19554 Specifies general-purposes registers that the processor automatically
19555 saves/restores on interrupt entry and exit. @var{register-range} is
19556 specified as two registers separated by a dash. The register range
19557 always starts with @code{r0}, the upper limit is @code{fp} register.
19558 @var{blink} and @var{lp_count} are optional. This option is only
19559 valid for ARC EM and ARC HS cores.
19560
19561 @item -mrgf-banked-regs=@var{number}
19562 @opindex mrgf-banked-regs
19563 Specifies the number of registers replicated in second register bank
19564 on entry to fast interrupt. Fast interrupts are interrupts with the
19565 highest priority level P0. These interrupts save only PC and STATUS32
19566 registers to avoid memory transactions during interrupt entry and exit
19567 sequences. Use this option when you are using fast interrupts in an
19568 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
19569
19570 @item -mlpc-width=@var{width}
19571 @opindex mlpc-width
19572 Specify the width of the @code{lp_count} register. Valid values for
19573 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
19574 fixed to 32 bits. If the width is less than 32, the compiler does not
19575 attempt to transform loops in your program to use the zero-delay loop
19576 mechanism unless it is known that the @code{lp_count} register can
19577 hold the required loop-counter value. Depending on the width
19578 specified, the compiler and run-time library might continue to use the
19579 loop mechanism for various needs. This option defines macro
19580 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
19581
19582 @item -mrf16
19583 @opindex mrf16
19584 This option instructs the compiler to generate code for a 16-entry
19585 register file. This option defines the @code{__ARC_RF16__}
19586 preprocessor macro.
19587
19588 @item -mbranch-index
19589 @opindex mbranch-index
19590 Enable use of @code{bi} or @code{bih} instructions to implement jump
19591 tables.
19592
19593 @end table
19594
19595 The following options are passed through to the assembler, and also
19596 define preprocessor macro symbols.
19597
19598 @c Flags used by the assembler, but for which we define preprocessor
19599 @c macro symbols as well.
19600 @table @gcctabopt
19601 @item -mdsp-packa
19602 @opindex mdsp-packa
19603 Passed down to the assembler to enable the DSP Pack A extensions.
19604 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
19605 deprecated.
19606
19607 @item -mdvbf
19608 @opindex mdvbf
19609 Passed down to the assembler to enable the dual Viterbi butterfly
19610 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
19611 option is deprecated.
19612
19613 @c ARC700 4.10 extension instruction
19614 @item -mlock
19615 @opindex mlock
19616 Passed down to the assembler to enable the locked load/store
19617 conditional extension. Also sets the preprocessor symbol
19618 @code{__Xlock}.
19619
19620 @item -mmac-d16
19621 @opindex mmac-d16
19622 Passed down to the assembler. Also sets the preprocessor symbol
19623 @code{__Xxmac_d16}. This option is deprecated.
19624
19625 @item -mmac-24
19626 @opindex mmac-24
19627 Passed down to the assembler. Also sets the preprocessor symbol
19628 @code{__Xxmac_24}. This option is deprecated.
19629
19630 @c ARC700 4.10 extension instruction
19631 @item -mrtsc
19632 @opindex mrtsc
19633 Passed down to the assembler to enable the 64-bit time-stamp counter
19634 extension instruction. Also sets the preprocessor symbol
19635 @code{__Xrtsc}. This option is deprecated.
19636
19637 @c ARC700 4.10 extension instruction
19638 @item -mswape
19639 @opindex mswape
19640 Passed down to the assembler to enable the swap byte ordering
19641 extension instruction. Also sets the preprocessor symbol
19642 @code{__Xswape}.
19643
19644 @item -mtelephony
19645 @opindex mtelephony
19646 Passed down to the assembler to enable dual- and single-operand
19647 instructions for telephony. Also sets the preprocessor symbol
19648 @code{__Xtelephony}. This option is deprecated.
19649
19650 @item -mxy
19651 @opindex mxy
19652 Passed down to the assembler to enable the XY memory extension. Also
19653 sets the preprocessor symbol @code{__Xxy}.
19654
19655 @end table
19656
19657 The following options control how the assembly code is annotated:
19658
19659 @c Assembly annotation options
19660 @table @gcctabopt
19661 @item -misize
19662 @opindex misize
19663 Annotate assembler instructions with estimated addresses.
19664
19665 @item -mannotate-align
19666 @opindex mannotate-align
19667 Explain what alignment considerations lead to the decision to make an
19668 instruction short or long.
19669
19670 @end table
19671
19672 The following options are passed through to the linker:
19673
19674 @c options passed through to the linker
19675 @table @gcctabopt
19676 @item -marclinux
19677 @opindex marclinux
19678 Passed through to the linker, to specify use of the @code{arclinux} emulation.
19679 This option is enabled by default in tool chains built for
19680 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
19681 when profiling is not requested.
19682
19683 @item -marclinux_prof
19684 @opindex marclinux_prof
19685 Passed through to the linker, to specify use of the
19686 @code{arclinux_prof} emulation. This option is enabled by default in
19687 tool chains built for @w{@code{arc-linux-uclibc}} and
19688 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
19689
19690 @end table
19691
19692 The following options control the semantics of generated code:
19693
19694 @c semantically relevant code generation options
19695 @table @gcctabopt
19696 @item -mlong-calls
19697 @opindex mlong-calls
19698 Generate calls as register indirect calls, thus providing access
19699 to the full 32-bit address range.
19700
19701 @item -mmedium-calls
19702 @opindex mmedium-calls
19703 Don't use less than 25-bit addressing range for calls, which is the
19704 offset available for an unconditional branch-and-link
19705 instruction. Conditional execution of function calls is suppressed, to
19706 allow use of the 25-bit range, rather than the 21-bit range with
19707 conditional branch-and-link. This is the default for tool chains built
19708 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
19709
19710 @item -G @var{num}
19711 @opindex G
19712 Put definitions of externally-visible data in a small data section if
19713 that data is no bigger than @var{num} bytes. The default value of
19714 @var{num} is 4 for any ARC configuration, or 8 when we have double
19715 load/store operations.
19716
19717 @item -mno-sdata
19718 @opindex mno-sdata
19719 @opindex msdata
19720 Do not generate sdata references. This is the default for tool chains
19721 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
19722 targets.
19723
19724 @item -mvolatile-cache
19725 @opindex mvolatile-cache
19726 Use ordinarily cached memory accesses for volatile references. This is the
19727 default.
19728
19729 @item -mno-volatile-cache
19730 @opindex mno-volatile-cache
19731 @opindex mvolatile-cache
19732 Enable cache bypass for volatile references.
19733
19734 @end table
19735
19736 The following options fine tune code generation:
19737 @c code generation tuning options
19738 @table @gcctabopt
19739 @item -malign-call
19740 @opindex malign-call
19741 Does nothing. Preserved for backward compatibility.
19742
19743 @item -mauto-modify-reg
19744 @opindex mauto-modify-reg
19745 Enable the use of pre/post modify with register displacement.
19746
19747 @item -mbbit-peephole
19748 @opindex mbbit-peephole
19749 Enable bbit peephole2.
19750
19751 @item -mno-brcc
19752 @opindex mno-brcc
19753 This option disables a target-specific pass in @file{arc_reorg} to
19754 generate compare-and-branch (@code{br@var{cc}}) instructions.
19755 It has no effect on
19756 generation of these instructions driven by the combiner pass.
19757
19758 @item -mcase-vector-pcrel
19759 @opindex mcase-vector-pcrel
19760 Use PC-relative switch case tables to enable case table shortening.
19761 This is the default for @option{-Os}.
19762
19763 @item -mcompact-casesi
19764 @opindex mcompact-casesi
19765 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
19766 and only available for ARCv1 cores. This option is deprecated.
19767
19768 @item -mno-cond-exec
19769 @opindex mno-cond-exec
19770 Disable the ARCompact-specific pass to generate conditional
19771 execution instructions.
19772
19773 Due to delay slot scheduling and interactions between operand numbers,
19774 literal sizes, instruction lengths, and the support for conditional execution,
19775 the target-independent pass to generate conditional execution is often lacking,
19776 so the ARC port has kept a special pass around that tries to find more
19777 conditional execution generation opportunities after register allocation,
19778 branch shortening, and delay slot scheduling have been done. This pass
19779 generally, but not always, improves performance and code size, at the cost of
19780 extra compilation time, which is why there is an option to switch it off.
19781 If you have a problem with call instructions exceeding their allowable
19782 offset range because they are conditionalized, you should consider using
19783 @option{-mmedium-calls} instead.
19784
19785 @item -mearly-cbranchsi
19786 @opindex mearly-cbranchsi
19787 Enable pre-reload use of the @code{cbranchsi} pattern.
19788
19789 @item -mexpand-adddi
19790 @opindex mexpand-adddi
19791 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
19792 @code{add.f}, @code{adc} etc. This option is deprecated.
19793
19794 @item -mindexed-loads
19795 @opindex mindexed-loads
19796 Enable the use of indexed loads. This can be problematic because some
19797 optimizers then assume that indexed stores exist, which is not
19798 the case.
19799
19800 @item -mlra
19801 @opindex mlra
19802 Enable Local Register Allocation. This is still experimental for ARC,
19803 so by default the compiler uses standard reload
19804 (i.e.@: @option{-mno-lra}).
19805
19806 @item -mlra-priority-none
19807 @opindex mlra-priority-none
19808 Don't indicate any priority for target registers.
19809
19810 @item -mlra-priority-compact
19811 @opindex mlra-priority-compact
19812 Indicate target register priority for r0..r3 / r12..r15.
19813
19814 @item -mlra-priority-noncompact
19815 @opindex mlra-priority-noncompact
19816 Reduce target register priority for r0..r3 / r12..r15.
19817
19818 @item -mmillicode
19819 @opindex mmillicode
19820 When optimizing for size (using @option{-Os}), prologues and epilogues
19821 that have to save or restore a large number of registers are often
19822 shortened by using call to a special function in libgcc; this is
19823 referred to as a @emph{millicode} call. As these calls can pose
19824 performance issues, and/or cause linking issues when linking in a
19825 nonstandard way, this option is provided to turn on or off millicode
19826 call generation.
19827
19828 @item -mcode-density-frame
19829 @opindex mcode-density-frame
19830 This option enable the compiler to emit @code{enter} and @code{leave}
19831 instructions. These instructions are only valid for CPUs with
19832 code-density feature.
19833
19834 @item -mmixed-code
19835 @opindex mmixed-code
19836 Does nothing. Preserved for backward compatibility.
19837
19838 @item -mq-class
19839 @opindex mq-class
19840 Ths option is deprecated. Enable @samp{q} instruction alternatives.
19841 This is the default for @option{-Os}.
19842
19843 @item -mRcq
19844 @opindex mRcq
19845 Enable @samp{Rcq} constraint handling.
19846 Most short code generation depends on this.
19847 This is the default.
19848
19849 @item -mRcw
19850 @opindex mRcw
19851 Enable @samp{Rcw} constraint handling.
19852 Most ccfsm condexec mostly depends on this.
19853 This is the default.
19854
19855 @item -msize-level=@var{level}
19856 @opindex msize-level
19857 Fine-tune size optimization with regards to instruction lengths and alignment.
19858 The recognized values for @var{level} are:
19859 @table @samp
19860 @item 0
19861 No size optimization. This level is deprecated and treated like @samp{1}.
19862
19863 @item 1
19864 Short instructions are used opportunistically.
19865
19866 @item 2
19867 In addition, alignment of loops and of code after barriers are dropped.
19868
19869 @item 3
19870 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
19871
19872 @end table
19873
19874 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
19875 the behavior when this is not set is equivalent to level @samp{1}.
19876
19877 @item -mtune=@var{cpu}
19878 @opindex mtune
19879 Set instruction scheduling parameters for @var{cpu}, overriding any implied
19880 by @option{-mcpu=}.
19881
19882 Supported values for @var{cpu} are
19883
19884 @table @samp
19885 @item ARC600
19886 Tune for ARC600 CPU.
19887
19888 @item ARC601
19889 Tune for ARC601 CPU.
19890
19891 @item ARC700
19892 Tune for ARC700 CPU with standard multiplier block.
19893
19894 @item ARC700-xmac
19895 Tune for ARC700 CPU with XMAC block.
19896
19897 @item ARC725D
19898 Tune for ARC725D CPU.
19899
19900 @item ARC750D
19901 Tune for ARC750D CPU.
19902
19903 @end table
19904
19905 @item -mmultcost=@var{num}
19906 @opindex mmultcost
19907 Cost to assume for a multiply instruction, with @samp{4} being equal to a
19908 normal instruction.
19909
19910 @item -munalign-prob-threshold=@var{probability}
19911 @opindex munalign-prob-threshold
19912 Does nothing. Preserved for backward compatibility.
19913
19914 @end table
19915
19916 The following options are maintained for backward compatibility, but
19917 are now deprecated and will be removed in a future release:
19918
19919 @c Deprecated options
19920 @table @gcctabopt
19921
19922 @item -margonaut
19923 @opindex margonaut
19924 Obsolete FPX.
19925
19926 @item -mbig-endian
19927 @opindex mbig-endian
19928 @itemx -EB
19929 @opindex EB
19930 Compile code for big-endian targets. Use of these options is now
19931 deprecated. Big-endian code is supported by configuring GCC to build
19932 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
19933 for which big endian is the default.
19934
19935 @item -mlittle-endian
19936 @opindex mlittle-endian
19937 @itemx -EL
19938 @opindex EL
19939 Compile code for little-endian targets. Use of these options is now
19940 deprecated. Little-endian code is supported by configuring GCC to build
19941 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
19942 for which little endian is the default.
19943
19944 @item -mbarrel_shifter
19945 @opindex mbarrel_shifter
19946 Replaced by @option{-mbarrel-shifter}.
19947
19948 @item -mdpfp_compact
19949 @opindex mdpfp_compact
19950 Replaced by @option{-mdpfp-compact}.
19951
19952 @item -mdpfp_fast
19953 @opindex mdpfp_fast
19954 Replaced by @option{-mdpfp-fast}.
19955
19956 @item -mdsp_packa
19957 @opindex mdsp_packa
19958 Replaced by @option{-mdsp-packa}.
19959
19960 @item -mEA
19961 @opindex mEA
19962 Replaced by @option{-mea}.
19963
19964 @item -mmac_24
19965 @opindex mmac_24
19966 Replaced by @option{-mmac-24}.
19967
19968 @item -mmac_d16
19969 @opindex mmac_d16
19970 Replaced by @option{-mmac-d16}.
19971
19972 @item -mspfp_compact
19973 @opindex mspfp_compact
19974 Replaced by @option{-mspfp-compact}.
19975
19976 @item -mspfp_fast
19977 @opindex mspfp_fast
19978 Replaced by @option{-mspfp-fast}.
19979
19980 @item -mtune=@var{cpu}
19981 @opindex mtune
19982 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
19983 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
19984 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
19985
19986 @item -multcost=@var{num}
19987 @opindex multcost
19988 Replaced by @option{-mmultcost}.
19989
19990 @end table
19991
19992 @node ARM Options
19993 @subsection ARM Options
19994 @cindex ARM options
19995
19996 These @samp{-m} options are defined for the ARM port:
19997
19998 @table @gcctabopt
19999 @item -mabi=@var{name}
20000 @opindex mabi
20001 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
20002 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
20003
20004 @item -mapcs-frame
20005 @opindex mapcs-frame
20006 Generate a stack frame that is compliant with the ARM Procedure Call
20007 Standard for all functions, even if this is not strictly necessary for
20008 correct execution of the code. Specifying @option{-fomit-frame-pointer}
20009 with this option causes the stack frames not to be generated for
20010 leaf functions. The default is @option{-mno-apcs-frame}.
20011 This option is deprecated.
20012
20013 @item -mapcs
20014 @opindex mapcs
20015 This is a synonym for @option{-mapcs-frame} and is deprecated.
20016
20017 @ignore
20018 @c not currently implemented
20019 @item -mapcs-stack-check
20020 @opindex mapcs-stack-check
20021 Generate code to check the amount of stack space available upon entry to
20022 every function (that actually uses some stack space). If there is
20023 insufficient space available then either the function
20024 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
20025 called, depending upon the amount of stack space required. The runtime
20026 system is required to provide these functions. The default is
20027 @option{-mno-apcs-stack-check}, since this produces smaller code.
20028
20029 @c not currently implemented
20030 @item -mapcs-reentrant
20031 @opindex mapcs-reentrant
20032 Generate reentrant, position-independent code. The default is
20033 @option{-mno-apcs-reentrant}.
20034 @end ignore
20035
20036 @item -mthumb-interwork
20037 @opindex mthumb-interwork
20038 Generate code that supports calling between the ARM and Thumb
20039 instruction sets. Without this option, on pre-v5 architectures, the
20040 two instruction sets cannot be reliably used inside one program. The
20041 default is @option{-mno-thumb-interwork}, since slightly larger code
20042 is generated when @option{-mthumb-interwork} is specified. In AAPCS
20043 configurations this option is meaningless.
20044
20045 @item -mno-sched-prolog
20046 @opindex mno-sched-prolog
20047 @opindex msched-prolog
20048 Prevent the reordering of instructions in the function prologue, or the
20049 merging of those instruction with the instructions in the function's
20050 body. This means that all functions start with a recognizable set
20051 of instructions (or in fact one of a choice from a small set of
20052 different function prologues), and this information can be used to
20053 locate the start of functions inside an executable piece of code. The
20054 default is @option{-msched-prolog}.
20055
20056 @item -mfloat-abi=@var{name}
20057 @opindex mfloat-abi
20058 Specifies which floating-point ABI to use. Permissible values
20059 are: @samp{soft}, @samp{softfp} and @samp{hard}.
20060
20061 Specifying @samp{soft} causes GCC to generate output containing
20062 library calls for floating-point operations.
20063 @samp{softfp} allows the generation of code using hardware floating-point
20064 instructions, but still uses the soft-float calling conventions.
20065 @samp{hard} allows generation of floating-point instructions
20066 and uses FPU-specific calling conventions.
20067
20068 The default depends on the specific target configuration. Note that
20069 the hard-float and soft-float ABIs are not link-compatible; you must
20070 compile your entire program with the same ABI, and link with a
20071 compatible set of libraries.
20072
20073 @item -mgeneral-regs-only
20074 @opindex mgeneral-regs-only
20075 Generate code which uses only the general-purpose registers. This will prevent
20076 the compiler from using floating-point and Advanced SIMD registers but will not
20077 impose any restrictions on the assembler.
20078
20079 @item -mlittle-endian
20080 @opindex mlittle-endian
20081 Generate code for a processor running in little-endian mode. This is
20082 the default for all standard configurations.
20083
20084 @item -mbig-endian
20085 @opindex mbig-endian
20086 Generate code for a processor running in big-endian mode; the default is
20087 to compile code for a little-endian processor.
20088
20089 @item -mbe8
20090 @itemx -mbe32
20091 @opindex mbe8
20092 When linking a big-endian image select between BE8 and BE32 formats.
20093 The option has no effect for little-endian images and is ignored. The
20094 default is dependent on the selected target architecture. For ARMv6
20095 and later architectures the default is BE8, for older architectures
20096 the default is BE32. BE32 format has been deprecated by ARM.
20097
20098 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
20099 @opindex march
20100 This specifies the name of the target ARM architecture. GCC uses this
20101 name to determine what kind of instructions it can emit when generating
20102 assembly code. This option can be used in conjunction with or instead
20103 of the @option{-mcpu=} option.
20104
20105 Permissible names are:
20106 @samp{armv4t},
20107 @samp{armv5t}, @samp{armv5te},
20108 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
20109 @samp{armv6z}, @samp{armv6zk},
20110 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
20111 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
20112 @samp{armv8.4-a},
20113 @samp{armv8.5-a},
20114 @samp{armv8.6-a},
20115 @samp{armv9-a},
20116 @samp{armv7-r},
20117 @samp{armv8-r},
20118 @samp{armv6-m}, @samp{armv6s-m},
20119 @samp{armv7-m}, @samp{armv7e-m},
20120 @samp{armv8-m.base}, @samp{armv8-m.main},
20121 @samp{armv8.1-m.main},
20122 @samp{armv9-a},
20123 @samp{iwmmxt} and @samp{iwmmxt2}.
20124
20125 Additionally, the following architectures, which lack support for the
20126 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
20127
20128 Many of the architectures support extensions. These can be added by
20129 appending @samp{+@var{extension}} to the architecture name. Extension
20130 options are processed in order and capabilities accumulate. An extension
20131 will also enable any necessary base extensions
20132 upon which it depends. For example, the @samp{+crypto} extension
20133 will always enable the @samp{+simd} extension. The exception to the
20134 additive construction is for extensions that are prefixed with
20135 @samp{+no@dots{}}: these extensions disable the specified option and
20136 any other extensions that may depend on the presence of that
20137 extension.
20138
20139 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
20140 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
20141 entirely disabled by the @samp{+nofp} option that follows it.
20142
20143 Most extension names are generically named, but have an effect that is
20144 dependent upon the architecture to which it is applied. For example,
20145 the @samp{+simd} option can be applied to both @samp{armv7-a} and
20146 @samp{armv8-a} architectures, but will enable the original ARMv7-A
20147 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
20148 variant for @samp{armv8-a}.
20149
20150 The table below lists the supported extensions for each architecture.
20151 Architectures not mentioned do not support any extensions.
20152
20153 @table @samp
20154 @item armv5te
20155 @itemx armv6
20156 @itemx armv6j
20157 @itemx armv6k
20158 @itemx armv6kz
20159 @itemx armv6t2
20160 @itemx armv6z
20161 @itemx armv6zk
20162 @table @samp
20163 @item +fp
20164 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
20165 used as an alias for this extension.
20166
20167 @item +nofp
20168 Disable the floating-point instructions.
20169 @end table
20170
20171 @item armv7
20172 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
20173 @table @samp
20174 @item +fp
20175 The VFPv3 floating-point instructions, with 16 double-precision
20176 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20177 for this extension. Note that floating-point is not supported by the
20178 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
20179 ARMv7-R architectures.
20180
20181 @item +nofp
20182 Disable the floating-point instructions.
20183 @end table
20184
20185 @item armv7-a
20186 @table @samp
20187 @item +mp
20188 The multiprocessing extension.
20189
20190 @item +sec
20191 The security extension.
20192
20193 @item +fp
20194 The VFPv3 floating-point instructions, with 16 double-precision
20195 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20196 for this extension.
20197
20198 @item +simd
20199 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20200 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
20201 for this extension.
20202
20203 @item +vfpv3
20204 The VFPv3 floating-point instructions, with 32 double-precision
20205 registers.
20206
20207 @item +vfpv3-d16-fp16
20208 The VFPv3 floating-point instructions, with 16 double-precision
20209 registers and the half-precision floating-point conversion operations.
20210
20211 @item +vfpv3-fp16
20212 The VFPv3 floating-point instructions, with 32 double-precision
20213 registers and the half-precision floating-point conversion operations.
20214
20215 @item +vfpv4-d16
20216 The VFPv4 floating-point instructions, with 16 double-precision
20217 registers.
20218
20219 @item +vfpv4
20220 The VFPv4 floating-point instructions, with 32 double-precision
20221 registers.
20222
20223 @item +neon-fp16
20224 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20225 the half-precision floating-point conversion operations.
20226
20227 @item +neon-vfpv4
20228 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
20229
20230 @item +nosimd
20231 Disable the Advanced SIMD instructions (does not disable floating point).
20232
20233 @item +nofp
20234 Disable the floating-point and Advanced SIMD instructions.
20235 @end table
20236
20237 @item armv7ve
20238 The extended version of the ARMv7-A architecture with support for
20239 virtualization.
20240 @table @samp
20241 @item +fp
20242 The VFPv4 floating-point instructions, with 16 double-precision registers.
20243 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
20244
20245 @item +simd
20246 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
20247 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
20248
20249 @item +vfpv3-d16
20250 The VFPv3 floating-point instructions, with 16 double-precision
20251 registers.
20252
20253 @item +vfpv3
20254 The VFPv3 floating-point instructions, with 32 double-precision
20255 registers.
20256
20257 @item +vfpv3-d16-fp16
20258 The VFPv3 floating-point instructions, with 16 double-precision
20259 registers and the half-precision floating-point conversion operations.
20260
20261 @item +vfpv3-fp16
20262 The VFPv3 floating-point instructions, with 32 double-precision
20263 registers and the half-precision floating-point conversion operations.
20264
20265 @item +vfpv4-d16
20266 The VFPv4 floating-point instructions, with 16 double-precision
20267 registers.
20268
20269 @item +vfpv4
20270 The VFPv4 floating-point instructions, with 32 double-precision
20271 registers.
20272
20273 @item +neon
20274 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20275 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
20276
20277 @item +neon-fp16
20278 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20279 the half-precision floating-point conversion operations.
20280
20281 @item +nosimd
20282 Disable the Advanced SIMD instructions (does not disable floating point).
20283
20284 @item +nofp
20285 Disable the floating-point and Advanced SIMD instructions.
20286 @end table
20287
20288 @item armv8-a
20289 @table @samp
20290 @item +crc
20291 The Cyclic Redundancy Check (CRC) instructions.
20292 @item +simd
20293 The ARMv8-A Advanced SIMD and floating-point instructions.
20294 @item +crypto
20295 The cryptographic instructions.
20296 @item +nocrypto
20297 Disable the cryptographic instructions.
20298 @item +nofp
20299 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20300 @item +sb
20301 Speculation Barrier Instruction.
20302 @item +predres
20303 Execution and Data Prediction Restriction Instructions.
20304 @end table
20305
20306 @item armv8.1-a
20307 @table @samp
20308 @item +simd
20309 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20310
20311 @item +crypto
20312 The cryptographic instructions. This also enables the Advanced SIMD and
20313 floating-point instructions.
20314
20315 @item +nocrypto
20316 Disable the cryptographic instructions.
20317
20318 @item +nofp
20319 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20320
20321 @item +sb
20322 Speculation Barrier Instruction.
20323
20324 @item +predres
20325 Execution and Data Prediction Restriction Instructions.
20326 @end table
20327
20328 @item armv8.2-a
20329 @itemx armv8.3-a
20330 @table @samp
20331 @item +fp16
20332 The half-precision floating-point data processing instructions.
20333 This also enables the Advanced SIMD and floating-point instructions.
20334
20335 @item +fp16fml
20336 The half-precision floating-point fmla extension. This also enables
20337 the half-precision floating-point extension and Advanced SIMD and
20338 floating-point instructions.
20339
20340 @item +simd
20341 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20342
20343 @item +crypto
20344 The cryptographic instructions. This also enables the Advanced SIMD and
20345 floating-point instructions.
20346
20347 @item +dotprod
20348 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20349
20350 @item +nocrypto
20351 Disable the cryptographic extension.
20352
20353 @item +nofp
20354 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20355
20356 @item +sb
20357 Speculation Barrier Instruction.
20358
20359 @item +predres
20360 Execution and Data Prediction Restriction Instructions.
20361
20362 @item +i8mm
20363 8-bit Integer Matrix Multiply instructions.
20364 This also enables Advanced SIMD and floating-point instructions.
20365
20366 @item +bf16
20367 Brain half-precision floating-point instructions.
20368 This also enables Advanced SIMD and floating-point instructions.
20369 @end table
20370
20371 @item armv8.4-a
20372 @table @samp
20373 @item +fp16
20374 The half-precision floating-point data processing instructions.
20375 This also enables the Advanced SIMD and floating-point instructions as well
20376 as the Dot Product extension and the half-precision floating-point fmla
20377 extension.
20378
20379 @item +simd
20380 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20381 Dot Product extension.
20382
20383 @item +crypto
20384 The cryptographic instructions. This also enables the Advanced SIMD and
20385 floating-point instructions as well as the Dot Product extension.
20386
20387 @item +nocrypto
20388 Disable the cryptographic extension.
20389
20390 @item +nofp
20391 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20392
20393 @item +sb
20394 Speculation Barrier Instruction.
20395
20396 @item +predres
20397 Execution and Data Prediction Restriction Instructions.
20398
20399 @item +i8mm
20400 8-bit Integer Matrix Multiply instructions.
20401 This also enables Advanced SIMD and floating-point instructions.
20402
20403 @item +bf16
20404 Brain half-precision floating-point instructions.
20405 This also enables Advanced SIMD and floating-point instructions.
20406 @end table
20407
20408 @item armv8.5-a
20409 @table @samp
20410 @item +fp16
20411 The half-precision floating-point data processing instructions.
20412 This also enables the Advanced SIMD and floating-point instructions as well
20413 as the Dot Product extension and the half-precision floating-point fmla
20414 extension.
20415
20416 @item +simd
20417 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20418 Dot Product extension.
20419
20420 @item +crypto
20421 The cryptographic instructions. This also enables the Advanced SIMD and
20422 floating-point instructions as well as the Dot Product extension.
20423
20424 @item +nocrypto
20425 Disable the cryptographic extension.
20426
20427 @item +nofp
20428 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20429
20430 @item +i8mm
20431 8-bit Integer Matrix Multiply instructions.
20432 This also enables Advanced SIMD and floating-point instructions.
20433
20434 @item +bf16
20435 Brain half-precision floating-point instructions.
20436 This also enables Advanced SIMD and floating-point instructions.
20437 @end table
20438
20439 @item armv8.6-a
20440 @table @samp
20441 @item +fp16
20442 The half-precision floating-point data processing instructions.
20443 This also enables the Advanced SIMD and floating-point instructions as well
20444 as the Dot Product extension and the half-precision floating-point fmla
20445 extension.
20446
20447 @item +simd
20448 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20449 Dot Product extension.
20450
20451 @item +crypto
20452 The cryptographic instructions. This also enables the Advanced SIMD and
20453 floating-point instructions as well as the Dot Product extension.
20454
20455 @item +nocrypto
20456 Disable the cryptographic extension.
20457
20458 @item +nofp
20459 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20460
20461 @item +i8mm
20462 8-bit Integer Matrix Multiply instructions.
20463 This also enables Advanced SIMD and floating-point instructions.
20464
20465 @item +bf16
20466 Brain half-precision floating-point instructions.
20467 This also enables Advanced SIMD and floating-point instructions.
20468 @end table
20469
20470 @item armv7-r
20471 @table @samp
20472 @item +fp.sp
20473 The single-precision VFPv3 floating-point instructions. The extension
20474 @samp{+vfpv3xd} can be used as an alias for this extension.
20475
20476 @item +fp
20477 The VFPv3 floating-point instructions with 16 double-precision registers.
20478 The extension +vfpv3-d16 can be used as an alias for this extension.
20479
20480 @item +vfpv3xd-d16-fp16
20481 The single-precision VFPv3 floating-point instructions with 16 double-precision
20482 registers and the half-precision floating-point conversion operations.
20483
20484 @item +vfpv3-d16-fp16
20485 The VFPv3 floating-point instructions with 16 double-precision
20486 registers and the half-precision floating-point conversion operations.
20487
20488 @item +nofp
20489 Disable the floating-point extension.
20490
20491 @item +idiv
20492 The ARM-state integer division instructions.
20493
20494 @item +noidiv
20495 Disable the ARM-state integer division extension.
20496 @end table
20497
20498 @item armv7e-m
20499 @table @samp
20500 @item +fp
20501 The single-precision VFPv4 floating-point instructions.
20502
20503 @item +fpv5
20504 The single-precision FPv5 floating-point instructions.
20505
20506 @item +fp.dp
20507 The single- and double-precision FPv5 floating-point instructions.
20508
20509 @item +nofp
20510 Disable the floating-point extensions.
20511 @end table
20512
20513 @item armv8.1-m.main
20514 @table @samp
20515
20516 @item +dsp
20517 The DSP instructions.
20518
20519 @item +mve
20520 The M-Profile Vector Extension (MVE) integer instructions.
20521
20522 @item +mve.fp
20523 The M-Profile Vector Extension (MVE) integer and single precision
20524 floating-point instructions.
20525
20526 @item +fp
20527 The single-precision floating-point instructions.
20528
20529 @item +fp.dp
20530 The single- and double-precision floating-point instructions.
20531
20532 @item +nofp
20533 Disable the floating-point extension.
20534
20535 @item +cdecp0, +cdecp1, ... , +cdecp7
20536 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20537 to the numbers given in the options in the range 0 to 7.
20538 @end table
20539
20540 @item armv8-m.main
20541 @table @samp
20542 @item +dsp
20543 The DSP instructions.
20544
20545 @item +nodsp
20546 Disable the DSP extension.
20547
20548 @item +fp
20549 The single-precision floating-point instructions.
20550
20551 @item +fp.dp
20552 The single- and double-precision floating-point instructions.
20553
20554 @item +nofp
20555 Disable the floating-point extension.
20556
20557 @item +cdecp0, +cdecp1, ... , +cdecp7
20558 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20559 to the numbers given in the options in the range 0 to 7.
20560 @end table
20561
20562 @item armv8-r
20563 @table @samp
20564 @item +crc
20565 The Cyclic Redundancy Check (CRC) instructions.
20566 @item +fp.sp
20567 The single-precision FPv5 floating-point instructions.
20568 @item +simd
20569 The ARMv8-A Advanced SIMD and floating-point instructions.
20570 @item +crypto
20571 The cryptographic instructions.
20572 @item +nocrypto
20573 Disable the cryptographic instructions.
20574 @item +nofp
20575 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20576 @end table
20577
20578 @end table
20579
20580 @option{-march=native} causes the compiler to auto-detect the architecture
20581 of the build computer. At present, this feature is only supported on
20582 GNU/Linux, and not all architectures are recognized. If the auto-detect
20583 is unsuccessful the option has no effect.
20584
20585 @item -mtune=@var{name}
20586 @opindex mtune
20587 This option specifies the name of the target ARM processor for
20588 which GCC should tune the performance of the code.
20589 For some ARM implementations better performance can be obtained by using
20590 this option.
20591 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
20592 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
20593 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
20594 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
20595 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
20596 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
20597 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
20598 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
20599 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
20600 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
20601 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
20602 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20603 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20604 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20605 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20606 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
20607 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
20608 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
20609 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
20610 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
20611 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
20612 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
20613 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
20614 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
20615 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
20616
20617 Additionally, this option can specify that GCC should tune the performance
20618 of the code for a big.LITTLE system. Permissible names are:
20619 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
20620 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20621 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
20622 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
20623
20624 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
20625 performance for a blend of processors within architecture @var{arch}.
20626 The aim is to generate code that run well on the current most popular
20627 processors, balancing between optimizations that benefit some CPUs in the
20628 range, and avoiding performance pitfalls of other CPUs. The effects of
20629 this option may change in future GCC versions as CPU models come and go.
20630
20631 @option{-mtune} permits the same extension options as @option{-mcpu}, but
20632 the extension options do not affect the tuning of the generated code.
20633
20634 @option{-mtune=native} causes the compiler to auto-detect the CPU
20635 of the build computer. At present, this feature is only supported on
20636 GNU/Linux, and not all architectures are recognized. If the auto-detect is
20637 unsuccessful the option has no effect.
20638
20639 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
20640 @opindex mcpu
20641 This specifies the name of the target ARM processor. GCC uses this name
20642 to derive the name of the target ARM architecture (as if specified
20643 by @option{-march}) and the ARM processor type for which to tune for
20644 performance (as if specified by @option{-mtune}). Where this option
20645 is used in conjunction with @option{-march} or @option{-mtune},
20646 those options take precedence over the appropriate part of this option.
20647
20648 Many of the supported CPUs implement optional architectural
20649 extensions. Where this is so the architectural extensions are
20650 normally enabled by default. If implementations that lack the
20651 extension exist, then the extension syntax can be used to disable
20652 those extensions that have been omitted. For floating-point and
20653 Advanced SIMD (Neon) instructions, the settings of the options
20654 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
20655 floating-point and Advanced SIMD instructions will only be used if
20656 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
20657 @option{-mfpu} other than @samp{auto} will override the available
20658 floating-point and SIMD extension instructions.
20659
20660 For example, @samp{cortex-a9} can be found in three major
20661 configurations: integer only, with just a floating-point unit or with
20662 floating-point and Advanced SIMD. The default is to enable all the
20663 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
20664 be used to disable just the SIMD or both the SIMD and floating-point
20665 instructions respectively.
20666
20667 Permissible names for this option are the same as those for
20668 @option{-mtune}.
20669
20670 The following extension options are common to the listed CPUs:
20671
20672 @table @samp
20673 @item +nodsp
20674 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
20675
20676 @item +nofp
20677 Disables the floating-point instructions on @samp{arm9e},
20678 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
20679 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
20680 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
20681 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
20682 Disables the floating-point and SIMD instructions on
20683 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
20684 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
20685 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
20686 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
20687 @samp{cortex-a53} and @samp{cortex-a55}.
20688
20689 @item +nofp.dp
20690 Disables the double-precision component of the floating-point instructions
20691 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
20692 @samp{cortex-r52plus} and @samp{cortex-m7}.
20693
20694 @item +nosimd
20695 Disables the SIMD (but not floating-point) instructions on
20696 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
20697 and @samp{cortex-a9}.
20698
20699 @item +crypto
20700 Enables the cryptographic instructions on @samp{cortex-a32},
20701 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
20702 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
20703 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20704 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
20705 @samp{cortex-a75.cortex-a55}.
20706 @end table
20707
20708 Additionally the @samp{generic-armv7-a} pseudo target defaults to
20709 VFPv3 with 16 double-precision registers. It supports the following
20710 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
20711 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
20712 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
20713 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
20714 the extensions to @option{-march=armv7-a}.
20715
20716 @option{-mcpu=generic-@var{arch}} is also permissible, and is
20717 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
20718 See @option{-mtune} for more information.
20719
20720 @option{-mcpu=native} causes the compiler to auto-detect the CPU
20721 of the build computer. At present, this feature is only supported on
20722 GNU/Linux, and not all architectures are recognized. If the auto-detect
20723 is unsuccessful the option has no effect.
20724
20725 @item -mfpu=@var{name}
20726 @opindex mfpu
20727 This specifies what floating-point hardware (or hardware emulation) is
20728 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
20729 @samp{vfpv3},
20730 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
20731 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
20732 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
20733 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
20734 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
20735 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
20736 is an alias for @samp{vfpv2}.
20737
20738 The setting @samp{auto} is the default and is special. It causes the
20739 compiler to select the floating-point and Advanced SIMD instructions
20740 based on the settings of @option{-mcpu} and @option{-march}.
20741
20742 If the selected floating-point hardware includes the NEON extension
20743 (e.g.@: @option{-mfpu=neon}), note that floating-point
20744 operations are not generated by GCC's auto-vectorization pass unless
20745 @option{-funsafe-math-optimizations} is also specified. This is
20746 because NEON hardware does not fully implement the IEEE 754 standard for
20747 floating-point arithmetic (in particular denormal values are treated as
20748 zero), so the use of NEON instructions may lead to a loss of precision.
20749
20750 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}).
20751
20752 @item -mfp16-format=@var{name}
20753 @opindex mfp16-format
20754 Specify the format of the @code{__fp16} half-precision floating-point type.
20755 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
20756 the default is @samp{none}, in which case the @code{__fp16} type is not
20757 defined. @xref{Half-Precision}, for more information.
20758
20759 @item -mstructure-size-boundary=@var{n}
20760 @opindex mstructure-size-boundary
20761 The sizes of all structures and unions are rounded up to a multiple
20762 of the number of bits set by this option. Permissible values are 8, 32
20763 and 64. The default value varies for different toolchains. For the COFF
20764 targeted toolchain the default value is 8. A value of 64 is only allowed
20765 if the underlying ABI supports it.
20766
20767 Specifying a larger number can produce faster, more efficient code, but
20768 can also increase the size of the program. Different values are potentially
20769 incompatible. Code compiled with one value cannot necessarily expect to
20770 work with code or libraries compiled with another value, if they exchange
20771 information using structures or unions.
20772
20773 This option is deprecated.
20774
20775 @item -mabort-on-noreturn
20776 @opindex mabort-on-noreturn
20777 Generate a call to the function @code{abort} at the end of a
20778 @code{noreturn} function. It is executed if the function tries to
20779 return.
20780
20781 @item -mlong-calls
20782 @itemx -mno-long-calls
20783 @opindex mlong-calls
20784 @opindex mno-long-calls
20785 Tells the compiler to perform function calls by first loading the
20786 address of the function into a register and then performing a subroutine
20787 call on this register. This switch is needed if the target function
20788 lies outside of the 64-megabyte addressing range of the offset-based
20789 version of subroutine call instruction.
20790
20791 Even if this switch is enabled, not all function calls are turned
20792 into long calls. The heuristic is that static functions, functions
20793 that have the @code{short_call} attribute, functions that are inside
20794 the scope of a @code{#pragma no_long_calls} directive, and functions whose
20795 definitions have already been compiled within the current compilation
20796 unit are not turned into long calls. The exceptions to this rule are
20797 that weak function definitions, functions with the @code{long_call}
20798 attribute or the @code{section} attribute, and functions that are within
20799 the scope of a @code{#pragma long_calls} directive are always
20800 turned into long calls.
20801
20802 This feature is not enabled by default. Specifying
20803 @option{-mno-long-calls} restores the default behavior, as does
20804 placing the function calls within the scope of a @code{#pragma
20805 long_calls_off} directive. Note these switches have no effect on how
20806 the compiler generates code to handle function calls via function
20807 pointers.
20808
20809 @item -msingle-pic-base
20810 @opindex msingle-pic-base
20811 Treat the register used for PIC addressing as read-only, rather than
20812 loading it in the prologue for each function. The runtime system is
20813 responsible for initializing this register with an appropriate value
20814 before execution begins.
20815
20816 @item -mpic-register=@var{reg}
20817 @opindex mpic-register
20818 Specify the register to be used for PIC addressing.
20819 For standard PIC base case, the default is any suitable register
20820 determined by compiler. For single PIC base case, the default is
20821 @samp{R9} if target is EABI based or stack-checking is enabled,
20822 otherwise the default is @samp{R10}.
20823
20824 @item -mpic-data-is-text-relative
20825 @opindex mpic-data-is-text-relative
20826 Assume that the displacement between the text and data segments is fixed
20827 at static link time. This permits using PC-relative addressing
20828 operations to access data known to be in the data segment. For
20829 non-VxWorks RTP targets, this option is enabled by default. When
20830 disabled on such targets, it will enable @option{-msingle-pic-base} by
20831 default.
20832
20833 @item -mpoke-function-name
20834 @opindex mpoke-function-name
20835 Write the name of each function into the text section, directly
20836 preceding the function prologue. The generated code is similar to this:
20837
20838 @smallexample
20839 t0
20840 .ascii "arm_poke_function_name", 0
20841 .align
20842 t1
20843 .word 0xff000000 + (t1 - t0)
20844 arm_poke_function_name
20845 mov ip, sp
20846 stmfd sp!, @{fp, ip, lr, pc@}
20847 sub fp, ip, #4
20848 @end smallexample
20849
20850 When performing a stack backtrace, code can inspect the value of
20851 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
20852 location @code{pc - 12} and the top 8 bits are set, then we know that
20853 there is a function name embedded immediately preceding this location
20854 and has length @code{((pc[-3]) & 0xff000000)}.
20855
20856 @item -mthumb
20857 @itemx -marm
20858 @opindex marm
20859 @opindex mthumb
20860
20861 Select between generating code that executes in ARM and Thumb
20862 states. The default for most configurations is to generate code
20863 that executes in ARM state, but the default can be changed by
20864 configuring GCC with the @option{--with-mode=}@var{state}
20865 configure option.
20866
20867 You can also override the ARM and Thumb mode for each function
20868 by using the @code{target("thumb")} and @code{target("arm")} function attributes
20869 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
20870
20871 @item -mflip-thumb
20872 @opindex mflip-thumb
20873 Switch ARM/Thumb modes on alternating functions.
20874 This option is provided for regression testing of mixed Thumb/ARM code
20875 generation, and is not intended for ordinary use in compiling code.
20876
20877 @item -mtpcs-frame
20878 @opindex mtpcs-frame
20879 Generate a stack frame that is compliant with the Thumb Procedure Call
20880 Standard for all non-leaf functions. (A leaf function is one that does
20881 not call any other functions.) The default is @option{-mno-tpcs-frame}.
20882
20883 @item -mtpcs-leaf-frame
20884 @opindex mtpcs-leaf-frame
20885 Generate a stack frame that is compliant with the Thumb Procedure Call
20886 Standard for all leaf functions. (A leaf function is one that does
20887 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
20888
20889 @item -mcallee-super-interworking
20890 @opindex mcallee-super-interworking
20891 Gives all externally visible functions in the file being compiled an ARM
20892 instruction set header which switches to Thumb mode before executing the
20893 rest of the function. This allows these functions to be called from
20894 non-interworking code. This option is not valid in AAPCS configurations
20895 because interworking is enabled by default.
20896
20897 @item -mcaller-super-interworking
20898 @opindex mcaller-super-interworking
20899 Allows calls via function pointers (including virtual functions) to
20900 execute correctly regardless of whether the target code has been
20901 compiled for interworking or not. There is a small overhead in the cost
20902 of executing a function pointer if this option is enabled. This option
20903 is not valid in AAPCS configurations because interworking is enabled
20904 by default.
20905
20906 @item -mtp=@var{name}
20907 @opindex mtp
20908 Specify the access model for the thread local storage pointer. The valid
20909 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
20910 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
20911 (supported in the arm6k architecture), and @samp{auto}, which uses the
20912 best available method for the selected processor. The default setting is
20913 @samp{auto}.
20914
20915 @item -mtls-dialect=@var{dialect}
20916 @opindex mtls-dialect
20917 Specify the dialect to use for accessing thread local storage. Two
20918 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
20919 @samp{gnu} dialect selects the original GNU scheme for supporting
20920 local and global dynamic TLS models. The @samp{gnu2} dialect
20921 selects the GNU descriptor scheme, which provides better performance
20922 for shared libraries. The GNU descriptor scheme is compatible with
20923 the original scheme, but does require new assembler, linker and
20924 library support. Initial and local exec TLS models are unaffected by
20925 this option and always use the original scheme.
20926
20927 @item -mword-relocations
20928 @opindex mword-relocations
20929 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
20930 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
20931 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
20932 is specified. This option conflicts with @option{-mslow-flash-data}.
20933
20934 @item -mfix-cortex-m3-ldrd
20935 @opindex mfix-cortex-m3-ldrd
20936 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
20937 with overlapping destination and base registers are used. This option avoids
20938 generating these instructions. This option is enabled by default when
20939 @option{-mcpu=cortex-m3} is specified.
20940
20941 @item -munaligned-access
20942 @itemx -mno-unaligned-access
20943 @opindex munaligned-access
20944 @opindex mno-unaligned-access
20945 Enables (or disables) reading and writing of 16- and 32- bit values
20946 from addresses that are not 16- or 32- bit aligned. By default
20947 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
20948 ARMv8-M Baseline architectures, and enabled for all other
20949 architectures. If unaligned access is not enabled then words in packed
20950 data structures are accessed a byte at a time.
20951
20952 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
20953 generated object file to either true or false, depending upon the
20954 setting of this option. If unaligned access is enabled then the
20955 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
20956 defined.
20957
20958 @item -mneon-for-64bits
20959 @opindex mneon-for-64bits
20960 This option is deprecated and has no effect.
20961
20962 @item -mslow-flash-data
20963 @opindex mslow-flash-data
20964 Assume loading data from flash is slower than fetching instruction.
20965 Therefore literal load is minimized for better performance.
20966 This option is only supported when compiling for ARMv7 M-profile and
20967 off by default. It conflicts with @option{-mword-relocations}.
20968
20969 @item -masm-syntax-unified
20970 @opindex masm-syntax-unified
20971 Assume inline assembler is using unified asm syntax. The default is
20972 currently off which implies divided syntax. This option has no impact
20973 on Thumb2. However, this may change in future releases of GCC.
20974 Divided syntax should be considered deprecated.
20975
20976 @item -mrestrict-it
20977 @opindex mrestrict-it
20978 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
20979 IT blocks can only contain a single 16-bit instruction from a select
20980 set of instructions. This option is on by default for ARMv8-A Thumb mode.
20981
20982 @item -mprint-tune-info
20983 @opindex mprint-tune-info
20984 Print CPU tuning information as comment in assembler file. This is
20985 an option used only for regression testing of the compiler and not
20986 intended for ordinary use in compiling code. This option is disabled
20987 by default.
20988
20989 @item -mverbose-cost-dump
20990 @opindex mverbose-cost-dump
20991 Enable verbose cost model dumping in the debug dump files. This option is
20992 provided for use in debugging the compiler.
20993
20994 @item -mpure-code
20995 @opindex mpure-code
20996 Do not allow constant data to be placed in code sections.
20997 Additionally, when compiling for ELF object format give all text sections the
20998 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
20999 is only available when generating non-pic code for M-profile targets.
21000
21001 @item -mcmse
21002 @opindex mcmse
21003 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
21004 Development Tools Engineering Specification", which can be found on
21005 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
21006
21007 @item -mfix-cmse-cve-2021-35465
21008 @opindex mfix-cmse-cve-2021-35465
21009 Mitigate against a potential security issue with the @code{VLLDM} instruction
21010 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
21011 enabled by default when the option @option{-mcpu=} is used with
21012 @code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
21013 @option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
21014
21015 @item -mfdpic
21016 @itemx -mno-fdpic
21017 @opindex mfdpic
21018 @opindex mno-fdpic
21019 Select the FDPIC ABI, which uses 64-bit function descriptors to
21020 represent pointers to functions. When the compiler is configured for
21021 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
21022 and implies @option{-fPIE} if none of the PIC/PIE-related options is
21023 provided. On other targets, it only enables the FDPIC-specific code
21024 generation features, and the user should explicitly provide the
21025 PIC/PIE-related options as needed.
21026
21027 Note that static linking is not supported because it would still
21028 involve the dynamic linker when the program self-relocates. If such
21029 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
21030
21031 The opposite @option{-mno-fdpic} option is useful (and required) to
21032 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
21033 toolchain as the one used to build the userland programs.
21034
21035 @end table
21036
21037 @node AVR Options
21038 @subsection AVR Options
21039 @cindex AVR Options
21040
21041 These options are defined for AVR implementations:
21042
21043 @table @gcctabopt
21044 @item -mmcu=@var{mcu}
21045 @opindex mmcu
21046 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
21047
21048 The default for this option is@tie{}@samp{avr2}.
21049
21050 GCC supports the following AVR devices and ISAs:
21051
21052 @include avr-mmcu.texi
21053
21054 @item -mabsdata
21055 @opindex mabsdata
21056
21057 Assume that all data in static storage can be accessed by LDS / STS
21058 instructions. This option has only an effect on reduced Tiny devices like
21059 ATtiny40. See also the @code{absdata}
21060 @ref{AVR Variable Attributes,variable attribute}.
21061
21062 @item -maccumulate-args
21063 @opindex maccumulate-args
21064 Accumulate outgoing function arguments and acquire/release the needed
21065 stack space for outgoing function arguments once in function
21066 prologue/epilogue. Without this option, outgoing arguments are pushed
21067 before calling a function and popped afterwards.
21068
21069 Popping the arguments after the function call can be expensive on
21070 AVR so that accumulating the stack space might lead to smaller
21071 executables because arguments need not be removed from the
21072 stack after such a function call.
21073
21074 This option can lead to reduced code size for functions that perform
21075 several calls to functions that get their arguments on the stack like
21076 calls to printf-like functions.
21077
21078 @item -mbranch-cost=@var{cost}
21079 @opindex mbranch-cost
21080 Set the branch costs for conditional branch instructions to
21081 @var{cost}. Reasonable values for @var{cost} are small, non-negative
21082 integers. The default branch cost is 0.
21083
21084 @item -mcall-prologues
21085 @opindex mcall-prologues
21086 Functions prologues/epilogues are expanded as calls to appropriate
21087 subroutines. Code size is smaller.
21088
21089 @item -mdouble=@var{bits}
21090 @itemx -mlong-double=@var{bits}
21091 @opindex mdouble
21092 @opindex mlong-double
21093 Set the size (in bits) of the @code{double} or @code{long double} type,
21094 respectively. Possible values for @var{bits} are 32 and 64.
21095 Whether or not a specific value for @var{bits} is allowed depends on
21096 the @code{--with-double=} and @code{--with-long-double=}
21097 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
21098 and the same applies for the default values of the options.
21099
21100 @item -mgas-isr-prologues
21101 @opindex mgas-isr-prologues
21102 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
21103 instruction supported by GNU Binutils.
21104 If this option is on, the feature can still be disabled for individual
21105 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
21106 function attribute. This feature is activated per default
21107 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
21108 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
21109
21110 @item -mint8
21111 @opindex mint8
21112 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
21113 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
21114 and @code{long long} is 4 bytes. Please note that this option does not
21115 conform to the C standards, but it results in smaller code
21116 size.
21117
21118 @item -mmain-is-OS_task
21119 @opindex mmain-is-OS_task
21120 Do not save registers in @code{main}. The effect is the same like
21121 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
21122 to @code{main}. It is activated per default if optimization is on.
21123
21124 @item -mn-flash=@var{num}
21125 @opindex mn-flash
21126 Assume that the flash memory has a size of
21127 @var{num} times 64@tie{}KiB.
21128
21129 @item -mno-interrupts
21130 @opindex mno-interrupts
21131 Generated code is not compatible with hardware interrupts.
21132 Code size is smaller.
21133
21134 @item -mrelax
21135 @opindex mrelax
21136 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
21137 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
21138 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
21139 the assembler's command line and the @option{--relax} option to the
21140 linker's command line.
21141
21142 Jump relaxing is performed by the linker because jump offsets are not
21143 known before code is located. Therefore, the assembler code generated by the
21144 compiler is the same, but the instructions in the executable may
21145 differ from instructions in the assembler code.
21146
21147 Relaxing must be turned on if linker stubs are needed, see the
21148 section on @code{EIND} and linker stubs below.
21149
21150 @item -mrmw
21151 @opindex mrmw
21152 Assume that the device supports the Read-Modify-Write
21153 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
21154
21155 @item -mshort-calls
21156 @opindex mshort-calls
21157
21158 Assume that @code{RJMP} and @code{RCALL} can target the whole
21159 program memory.
21160
21161 This option is used internally for multilib selection. It is
21162 not an optimization option, and you don't need to set it by hand.
21163
21164 @item -msp8
21165 @opindex msp8
21166 Treat the stack pointer register as an 8-bit register,
21167 i.e.@: assume the high byte of the stack pointer is zero.
21168 In general, you don't need to set this option by hand.
21169
21170 This option is used internally by the compiler to select and
21171 build multilibs for architectures @code{avr2} and @code{avr25}.
21172 These architectures mix devices with and without @code{SPH}.
21173 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
21174 the compiler driver adds or removes this option from the compiler
21175 proper's command line, because the compiler then knows if the device
21176 or architecture has an 8-bit stack pointer and thus no @code{SPH}
21177 register or not.
21178
21179 @item -mstrict-X
21180 @opindex mstrict-X
21181 Use address register @code{X} in a way proposed by the hardware. This means
21182 that @code{X} is only used in indirect, post-increment or
21183 pre-decrement addressing.
21184
21185 Without this option, the @code{X} register may be used in the same way
21186 as @code{Y} or @code{Z} which then is emulated by additional
21187 instructions.
21188 For example, loading a value with @code{X+const} addressing with a
21189 small non-negative @code{const < 64} to a register @var{Rn} is
21190 performed as
21191
21192 @example
21193 adiw r26, const ; X += const
21194 ld @var{Rn}, X ; @var{Rn} = *X
21195 sbiw r26, const ; X -= const
21196 @end example
21197
21198 @item -mtiny-stack
21199 @opindex mtiny-stack
21200 Only change the lower 8@tie{}bits of the stack pointer.
21201
21202 @item -mfract-convert-truncate
21203 @opindex mfract-convert-truncate
21204 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
21205
21206 @item -nodevicelib
21207 @opindex nodevicelib
21208 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
21209
21210 @item -nodevicespecs
21211 @opindex nodevicespecs
21212 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
21213 command line. The user takes responsibility for supplying the sub-processes
21214 like compiler proper, assembler and linker with appropriate command line
21215 options. This means that the user has to supply her private device specs
21216 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
21217 more need for option @option{-mmcu=@var{mcu}}.
21218
21219 This option can also serve as a replacement for the older way of
21220 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
21221 which contains a folder named @code{device-specs} which contains a specs file named
21222 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
21223
21224 @item -Waddr-space-convert
21225 @opindex Waddr-space-convert
21226 @opindex Wno-addr-space-convert
21227 Warn about conversions between address spaces in the case where the
21228 resulting address space is not contained in the incoming address space.
21229
21230 @item -Wmisspelled-isr
21231 @opindex Wmisspelled-isr
21232 @opindex Wno-misspelled-isr
21233 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
21234 Enabled by default.
21235 @end table
21236
21237 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
21238 @cindex @code{EIND}
21239 Pointers in the implementation are 16@tie{}bits wide.
21240 The address of a function or label is represented as word address so
21241 that indirect jumps and calls can target any code address in the
21242 range of 64@tie{}Ki words.
21243
21244 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
21245 bytes of program memory space, there is a special function register called
21246 @code{EIND} that serves as most significant part of the target address
21247 when @code{EICALL} or @code{EIJMP} instructions are used.
21248
21249 Indirect jumps and calls on these devices are handled as follows by
21250 the compiler and are subject to some limitations:
21251
21252 @itemize @bullet
21253
21254 @item
21255 The compiler never sets @code{EIND}.
21256
21257 @item
21258 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
21259 instructions or might read @code{EIND} directly in order to emulate an
21260 indirect call/jump by means of a @code{RET} instruction.
21261
21262 @item
21263 The compiler assumes that @code{EIND} never changes during the startup
21264 code or during the application. In particular, @code{EIND} is not
21265 saved/restored in function or interrupt service routine
21266 prologue/epilogue.
21267
21268 @item
21269 For indirect calls to functions and computed goto, the linker
21270 generates @emph{stubs}. Stubs are jump pads sometimes also called
21271 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
21272 The stub contains a direct jump to the desired address.
21273
21274 @item
21275 Linker relaxation must be turned on so that the linker generates
21276 the stubs correctly in all situations. See the compiler option
21277 @option{-mrelax} and the linker option @option{--relax}.
21278 There are corner cases where the linker is supposed to generate stubs
21279 but aborts without relaxation and without a helpful error message.
21280
21281 @item
21282 The default linker script is arranged for code with @code{EIND = 0}.
21283 If code is supposed to work for a setup with @code{EIND != 0}, a custom
21284 linker script has to be used in order to place the sections whose
21285 name start with @code{.trampolines} into the segment where @code{EIND}
21286 points to.
21287
21288 @item
21289 The startup code from libgcc never sets @code{EIND}.
21290 Notice that startup code is a blend of code from libgcc and AVR-LibC.
21291 For the impact of AVR-LibC on @code{EIND}, see the
21292 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
21293
21294 @item
21295 It is legitimate for user-specific startup code to set up @code{EIND}
21296 early, for example by means of initialization code located in
21297 section @code{.init3}. Such code runs prior to general startup code
21298 that initializes RAM and calls constructors, but after the bit
21299 of startup code from AVR-LibC that sets @code{EIND} to the segment
21300 where the vector table is located.
21301 @example
21302 #include <avr/io.h>
21303
21304 static void
21305 __attribute__((section(".init3"),naked,used,no_instrument_function))
21306 init3_set_eind (void)
21307 @{
21308 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
21309 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
21310 @}
21311 @end example
21312
21313 @noindent
21314 The @code{__trampolines_start} symbol is defined in the linker script.
21315
21316 @item
21317 Stubs are generated automatically by the linker if
21318 the following two conditions are met:
21319 @itemize @minus
21320
21321 @item The address of a label is taken by means of the @code{gs} modifier
21322 (short for @emph{generate stubs}) like so:
21323 @example
21324 LDI r24, lo8(gs(@var{func}))
21325 LDI r25, hi8(gs(@var{func}))
21326 @end example
21327 @item The final location of that label is in a code segment
21328 @emph{outside} the segment where the stubs are located.
21329 @end itemize
21330
21331 @item
21332 The compiler emits such @code{gs} modifiers for code labels in the
21333 following situations:
21334 @itemize @minus
21335 @item Taking address of a function or code label.
21336 @item Computed goto.
21337 @item If prologue-save function is used, see @option{-mcall-prologues}
21338 command-line option.
21339 @item Switch/case dispatch tables. If you do not want such dispatch
21340 tables you can specify the @option{-fno-jump-tables} command-line option.
21341 @item C and C++ constructors/destructors called during startup/shutdown.
21342 @item If the tools hit a @code{gs()} modifier explained above.
21343 @end itemize
21344
21345 @item
21346 Jumping to non-symbolic addresses like so is @emph{not} supported:
21347
21348 @example
21349 int main (void)
21350 @{
21351 /* Call function at word address 0x2 */
21352 return ((int(*)(void)) 0x2)();
21353 @}
21354 @end example
21355
21356 Instead, a stub has to be set up, i.e.@: the function has to be called
21357 through a symbol (@code{func_4} in the example):
21358
21359 @example
21360 int main (void)
21361 @{
21362 extern int func_4 (void);
21363
21364 /* Call function at byte address 0x4 */
21365 return func_4();
21366 @}
21367 @end example
21368
21369 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
21370 Alternatively, @code{func_4} can be defined in the linker script.
21371 @end itemize
21372
21373 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
21374 @cindex @code{RAMPD}
21375 @cindex @code{RAMPX}
21376 @cindex @code{RAMPY}
21377 @cindex @code{RAMPZ}
21378 Some AVR devices support memories larger than the 64@tie{}KiB range
21379 that can be accessed with 16-bit pointers. To access memory locations
21380 outside this 64@tie{}KiB range, the content of a @code{RAMP}
21381 register is used as high part of the address:
21382 The @code{X}, @code{Y}, @code{Z} address register is concatenated
21383 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
21384 register, respectively, to get a wide address. Similarly,
21385 @code{RAMPD} is used together with direct addressing.
21386
21387 @itemize
21388 @item
21389 The startup code initializes the @code{RAMP} special function
21390 registers with zero.
21391
21392 @item
21393 If a @ref{AVR Named Address Spaces,named address space} other than
21394 generic or @code{__flash} is used, then @code{RAMPZ} is set
21395 as needed before the operation.
21396
21397 @item
21398 If the device supports RAM larger than 64@tie{}KiB and the compiler
21399 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
21400 is reset to zero after the operation.
21401
21402 @item
21403 If the device comes with a specific @code{RAMP} register, the ISR
21404 prologue/epilogue saves/restores that SFR and initializes it with
21405 zero in case the ISR code might (implicitly) use it.
21406
21407 @item
21408 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
21409 If you use inline assembler to read from locations outside the
21410 16-bit address range and change one of the @code{RAMP} registers,
21411 you must reset it to zero after the access.
21412
21413 @end itemize
21414
21415 @subsubsection AVR Built-in Macros
21416
21417 GCC defines several built-in macros so that the user code can test
21418 for the presence or absence of features. Almost any of the following
21419 built-in macros are deduced from device capabilities and thus
21420 triggered by the @option{-mmcu=} command-line option.
21421
21422 For even more AVR-specific built-in macros see
21423 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
21424
21425 @table @code
21426
21427 @item __AVR_ARCH__
21428 Build-in macro that resolves to a decimal number that identifies the
21429 architecture and depends on the @option{-mmcu=@var{mcu}} option.
21430 Possible values are:
21431
21432 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
21433 @code{4}, @code{5}, @code{51}, @code{6}
21434
21435 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
21436 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
21437
21438 respectively and
21439
21440 @code{100},
21441 @code{102}, @code{103}, @code{104},
21442 @code{105}, @code{106}, @code{107}
21443
21444 for @var{mcu}=@code{avrtiny},
21445 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
21446 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
21447 If @var{mcu} specifies a device, this built-in macro is set
21448 accordingly. For example, with @option{-mmcu=atmega8} the macro is
21449 defined to @code{4}.
21450
21451 @item __AVR_@var{Device}__
21452 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
21453 the device's name. For example, @option{-mmcu=atmega8} defines the
21454 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
21455 @code{__AVR_ATtiny261A__}, etc.
21456
21457 The built-in macros' names follow
21458 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
21459 the device name as from the AVR user manual. The difference between
21460 @var{Device} in the built-in macro and @var{device} in
21461 @option{-mmcu=@var{device}} is that the latter is always lowercase.
21462
21463 If @var{device} is not a device but only a core architecture like
21464 @samp{avr51}, this macro is not defined.
21465
21466 @item __AVR_DEVICE_NAME__
21467 Setting @option{-mmcu=@var{device}} defines this built-in macro to
21468 the device's name. For example, with @option{-mmcu=atmega8} the macro
21469 is defined to @code{atmega8}.
21470
21471 If @var{device} is not a device but only a core architecture like
21472 @samp{avr51}, this macro is not defined.
21473
21474 @item __AVR_XMEGA__
21475 The device / architecture belongs to the XMEGA family of devices.
21476
21477 @item __AVR_HAVE_ELPM__
21478 The device has the @code{ELPM} instruction.
21479
21480 @item __AVR_HAVE_ELPMX__
21481 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
21482 R@var{n},Z+} instructions.
21483
21484 @item __AVR_HAVE_MOVW__
21485 The device has the @code{MOVW} instruction to perform 16-bit
21486 register-register moves.
21487
21488 @item __AVR_HAVE_LPMX__
21489 The device has the @code{LPM R@var{n},Z} and
21490 @code{LPM R@var{n},Z+} instructions.
21491
21492 @item __AVR_HAVE_MUL__
21493 The device has a hardware multiplier.
21494
21495 @item __AVR_HAVE_JMP_CALL__
21496 The device has the @code{JMP} and @code{CALL} instructions.
21497 This is the case for devices with more than 8@tie{}KiB of program
21498 memory.
21499
21500 @item __AVR_HAVE_EIJMP_EICALL__
21501 @itemx __AVR_3_BYTE_PC__
21502 The device has the @code{EIJMP} and @code{EICALL} instructions.
21503 This is the case for devices with more than 128@tie{}KiB of program memory.
21504 This also means that the program counter
21505 (PC) is 3@tie{}bytes wide.
21506
21507 @item __AVR_2_BYTE_PC__
21508 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
21509 with up to 128@tie{}KiB of program memory.
21510
21511 @item __AVR_HAVE_8BIT_SP__
21512 @itemx __AVR_HAVE_16BIT_SP__
21513 The stack pointer (SP) register is treated as 8-bit respectively
21514 16-bit register by the compiler.
21515 The definition of these macros is affected by @option{-mtiny-stack}.
21516
21517 @item __AVR_HAVE_SPH__
21518 @itemx __AVR_SP8__
21519 The device has the SPH (high part of stack pointer) special function
21520 register or has an 8-bit stack pointer, respectively.
21521 The definition of these macros is affected by @option{-mmcu=} and
21522 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
21523 by @option{-msp8}.
21524
21525 @item __AVR_HAVE_RAMPD__
21526 @itemx __AVR_HAVE_RAMPX__
21527 @itemx __AVR_HAVE_RAMPY__
21528 @itemx __AVR_HAVE_RAMPZ__
21529 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
21530 @code{RAMPZ} special function register, respectively.
21531
21532 @item __NO_INTERRUPTS__
21533 This macro reflects the @option{-mno-interrupts} command-line option.
21534
21535 @item __AVR_ERRATA_SKIP__
21536 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
21537 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
21538 instructions because of a hardware erratum. Skip instructions are
21539 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
21540 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
21541 set.
21542
21543 @item __AVR_ISA_RMW__
21544 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
21545
21546 @item __AVR_SFR_OFFSET__=@var{offset}
21547 Instructions that can address I/O special function registers directly
21548 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
21549 address as if addressed by an instruction to access RAM like @code{LD}
21550 or @code{STS}. This offset depends on the device architecture and has
21551 to be subtracted from the RAM address in order to get the
21552 respective I/O@tie{}address.
21553
21554 @item __AVR_SHORT_CALLS__
21555 The @option{-mshort-calls} command line option is set.
21556
21557 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
21558 Some devices support reading from flash memory by means of @code{LD*}
21559 instructions. The flash memory is seen in the data address space
21560 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
21561 is not defined, this feature is not available. If defined,
21562 the address space is linear and there is no need to put
21563 @code{.rodata} into RAM. This is handled by the default linker
21564 description file, and is currently available for
21565 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
21566 there is no need to use address spaces like @code{__flash} or
21567 features like attribute @code{progmem} and @code{pgm_read_*}.
21568
21569 @item __WITH_AVRLIBC__
21570 The compiler is configured to be used together with AVR-Libc.
21571 See the @option{--with-avrlibc} configure option.
21572
21573 @item __HAVE_DOUBLE_MULTILIB__
21574 Defined if @option{-mdouble=} acts as a multilib option.
21575
21576 @item __HAVE_DOUBLE32__
21577 @itemx __HAVE_DOUBLE64__
21578 Defined if the compiler supports 32-bit double resp. 64-bit double.
21579 The actual layout is specified by option @option{-mdouble=}.
21580
21581 @item __DEFAULT_DOUBLE__
21582 The size in bits of @code{double} if @option{-mdouble=} is not set.
21583 To test the layout of @code{double} in a program, use the built-in
21584 macro @code{__SIZEOF_DOUBLE__}.
21585
21586 @item __HAVE_LONG_DOUBLE32__
21587 @itemx __HAVE_LONG_DOUBLE64__
21588 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
21589 @itemx __DEFAULT_LONG_DOUBLE__
21590 Same as above, but for @code{long double} instead of @code{double}.
21591
21592 @item __WITH_DOUBLE_COMPARISON__
21593 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
21594 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
21595 and is defined to @code{2} or @code{3}.
21596
21597 @item __WITH_LIBF7_LIBGCC__
21598 @itemx __WITH_LIBF7_MATH__
21599 @itemx __WITH_LIBF7_MATH_SYMBOLS__
21600 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
21601 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
21602
21603 @end table
21604
21605 @node Blackfin Options
21606 @subsection Blackfin Options
21607 @cindex Blackfin Options
21608
21609 @table @gcctabopt
21610 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
21611 @opindex mcpu=
21612 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
21613 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
21614 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
21615 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
21616 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
21617 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
21618 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
21619 @samp{bf561}, @samp{bf592}.
21620
21621 The optional @var{sirevision} specifies the silicon revision of the target
21622 Blackfin processor. Any workarounds available for the targeted silicon revision
21623 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
21624 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
21625 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
21626 hexadecimal digits representing the major and minor numbers in the silicon
21627 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
21628 is not defined. If @var{sirevision} is @samp{any}, the
21629 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
21630 If this optional @var{sirevision} is not used, GCC assumes the latest known
21631 silicon revision of the targeted Blackfin processor.
21632
21633 GCC defines a preprocessor macro for the specified @var{cpu}.
21634 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
21635 provided by libgloss to be linked in if @option{-msim} is not given.
21636
21637 Without this option, @samp{bf532} is used as the processor by default.
21638
21639 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
21640 only the preprocessor macro is defined.
21641
21642 @item -msim
21643 @opindex msim
21644 Specifies that the program will be run on the simulator. This causes
21645 the simulator BSP provided by libgloss to be linked in. This option
21646 has effect only for @samp{bfin-elf} toolchain.
21647 Certain other options, such as @option{-mid-shared-library} and
21648 @option{-mfdpic}, imply @option{-msim}.
21649
21650 @item -momit-leaf-frame-pointer
21651 @opindex momit-leaf-frame-pointer
21652 Don't keep the frame pointer in a register for leaf functions. This
21653 avoids the instructions to save, set up and restore frame pointers and
21654 makes an extra register available in leaf functions.
21655
21656 @item -mspecld-anomaly
21657 @opindex mspecld-anomaly
21658 When enabled, the compiler ensures that the generated code does not
21659 contain speculative loads after jump instructions. If this option is used,
21660 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
21661
21662 @item -mno-specld-anomaly
21663 @opindex mno-specld-anomaly
21664 @opindex mspecld-anomaly
21665 Don't generate extra code to prevent speculative loads from occurring.
21666
21667 @item -mcsync-anomaly
21668 @opindex mcsync-anomaly
21669 When enabled, the compiler ensures that the generated code does not
21670 contain CSYNC or SSYNC instructions too soon after conditional branches.
21671 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
21672
21673 @item -mno-csync-anomaly
21674 @opindex mno-csync-anomaly
21675 @opindex mcsync-anomaly
21676 Don't generate extra code to prevent CSYNC or SSYNC instructions from
21677 occurring too soon after a conditional branch.
21678
21679 @item -mlow64k
21680 @opindex mlow64k
21681 When enabled, the compiler is free to take advantage of the knowledge that
21682 the entire program fits into the low 64k of memory.
21683
21684 @item -mno-low64k
21685 @opindex mno-low64k
21686 Assume that the program is arbitrarily large. This is the default.
21687
21688 @item -mstack-check-l1
21689 @opindex mstack-check-l1
21690 Do stack checking using information placed into L1 scratchpad memory by the
21691 uClinux kernel.
21692
21693 @item -mid-shared-library
21694 @opindex mid-shared-library
21695 Generate code that supports shared libraries via the library ID method.
21696 This allows for execute in place and shared libraries in an environment
21697 without virtual memory management. This option implies @option{-fPIC}.
21698 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21699
21700 @item -mno-id-shared-library
21701 @opindex mno-id-shared-library
21702 @opindex mid-shared-library
21703 Generate code that doesn't assume ID-based shared libraries are being used.
21704 This is the default.
21705
21706 @item -mleaf-id-shared-library
21707 @opindex mleaf-id-shared-library
21708 Generate code that supports shared libraries via the library ID method,
21709 but assumes that this library or executable won't link against any other
21710 ID shared libraries. That allows the compiler to use faster code for jumps
21711 and calls.
21712
21713 @item -mno-leaf-id-shared-library
21714 @opindex mno-leaf-id-shared-library
21715 @opindex mleaf-id-shared-library
21716 Do not assume that the code being compiled won't link against any ID shared
21717 libraries. Slower code is generated for jump and call insns.
21718
21719 @item -mshared-library-id=n
21720 @opindex mshared-library-id
21721 Specifies the identification number of the ID-based shared library being
21722 compiled. Specifying a value of 0 generates more compact code; specifying
21723 other values forces the allocation of that number to the current
21724 library but is no more space- or time-efficient than omitting this option.
21725
21726 @item -msep-data
21727 @opindex msep-data
21728 Generate code that allows the data segment to be located in a different
21729 area of memory from the text segment. This allows for execute in place in
21730 an environment without virtual memory management by eliminating relocations
21731 against the text section.
21732
21733 @item -mno-sep-data
21734 @opindex mno-sep-data
21735 @opindex msep-data
21736 Generate code that assumes that the data segment follows the text segment.
21737 This is the default.
21738
21739 @item -mlong-calls
21740 @itemx -mno-long-calls
21741 @opindex mlong-calls
21742 @opindex mno-long-calls
21743 Tells the compiler to perform function calls by first loading the
21744 address of the function into a register and then performing a subroutine
21745 call on this register. This switch is needed if the target function
21746 lies outside of the 24-bit addressing range of the offset-based
21747 version of subroutine call instruction.
21748
21749 This feature is not enabled by default. Specifying
21750 @option{-mno-long-calls} restores the default behavior. Note these
21751 switches have no effect on how the compiler generates code to handle
21752 function calls via function pointers.
21753
21754 @item -mfast-fp
21755 @opindex mfast-fp
21756 Link with the fast floating-point library. This library relaxes some of
21757 the IEEE floating-point standard's rules for checking inputs against
21758 Not-a-Number (NAN), in the interest of performance.
21759
21760 @item -minline-plt
21761 @opindex minline-plt
21762 Enable inlining of PLT entries in function calls to functions that are
21763 not known to bind locally. It has no effect without @option{-mfdpic}.
21764
21765 @item -mmulticore
21766 @opindex mmulticore
21767 Build a standalone application for multicore Blackfin processors.
21768 This option causes proper start files and link scripts supporting
21769 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
21770 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
21771
21772 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
21773 selects the one-application-per-core programming model. Without
21774 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
21775 programming model is used. In this model, the main function of Core B
21776 should be named as @code{coreb_main}.
21777
21778 If this option is not used, the single-core application programming
21779 model is used.
21780
21781 @item -mcorea
21782 @opindex mcorea
21783 Build a standalone application for Core A of BF561 when using
21784 the one-application-per-core programming model. Proper start files
21785 and link scripts are used to support Core A, and the macro
21786 @code{__BFIN_COREA} is defined.
21787 This option can only be used in conjunction with @option{-mmulticore}.
21788
21789 @item -mcoreb
21790 @opindex mcoreb
21791 Build a standalone application for Core B of BF561 when using
21792 the one-application-per-core programming model. Proper start files
21793 and link scripts are used to support Core B, and the macro
21794 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
21795 should be used instead of @code{main}.
21796 This option can only be used in conjunction with @option{-mmulticore}.
21797
21798 @item -msdram
21799 @opindex msdram
21800 Build a standalone application for SDRAM. Proper start files and
21801 link scripts are used to put the application into SDRAM, and the macro
21802 @code{__BFIN_SDRAM} is defined.
21803 The loader should initialize SDRAM before loading the application.
21804
21805 @item -micplb
21806 @opindex micplb
21807 Assume that ICPLBs are enabled at run time. This has an effect on certain
21808 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
21809 are enabled; for standalone applications the default is off.
21810 @end table
21811
21812 @node C6X Options
21813 @subsection C6X Options
21814 @cindex C6X Options
21815
21816 @table @gcctabopt
21817 @item -march=@var{name}
21818 @opindex march
21819 This specifies the name of the target architecture. GCC uses this
21820 name to determine what kind of instructions it can emit when generating
21821 assembly code. Permissible names are: @samp{c62x},
21822 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
21823
21824 @item -mbig-endian
21825 @opindex mbig-endian
21826 Generate code for a big-endian target.
21827
21828 @item -mlittle-endian
21829 @opindex mlittle-endian
21830 Generate code for a little-endian target. This is the default.
21831
21832 @item -msim
21833 @opindex msim
21834 Choose startup files and linker script suitable for the simulator.
21835
21836 @item -msdata=default
21837 @opindex msdata=default
21838 Put small global and static data in the @code{.neardata} section,
21839 which is pointed to by register @code{B14}. Put small uninitialized
21840 global and static data in the @code{.bss} section, which is adjacent
21841 to the @code{.neardata} section. Put small read-only data into the
21842 @code{.rodata} section. The corresponding sections used for large
21843 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
21844
21845 @item -msdata=all
21846 @opindex msdata=all
21847 Put all data, not just small objects, into the sections reserved for
21848 small data, and use addressing relative to the @code{B14} register to
21849 access them.
21850
21851 @item -msdata=none
21852 @opindex msdata=none
21853 Make no use of the sections reserved for small data, and use absolute
21854 addresses to access all data. Put all initialized global and static
21855 data in the @code{.fardata} section, and all uninitialized data in the
21856 @code{.far} section. Put all constant data into the @code{.const}
21857 section.
21858 @end table
21859
21860 @node CRIS Options
21861 @subsection CRIS Options
21862 @cindex CRIS Options
21863
21864 These options are defined specifically for the CRIS ports.
21865
21866 @table @gcctabopt
21867 @item -march=@var{architecture-type}
21868 @itemx -mcpu=@var{architecture-type}
21869 @opindex march
21870 @opindex mcpu
21871 Generate code for the specified architecture. The choices for
21872 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
21873 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
21874 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
21875 @samp{v10}.
21876
21877 @item -mtune=@var{architecture-type}
21878 @opindex mtune
21879 Tune to @var{architecture-type} everything applicable about the generated
21880 code, except for the ABI and the set of available instructions. The
21881 choices for @var{architecture-type} are the same as for
21882 @option{-march=@var{architecture-type}}.
21883
21884 @item -mmax-stack-frame=@var{n}
21885 @opindex mmax-stack-frame
21886 Warn when the stack frame of a function exceeds @var{n} bytes.
21887
21888 @item -metrax4
21889 @itemx -metrax100
21890 @opindex metrax4
21891 @opindex metrax100
21892 The options @option{-metrax4} and @option{-metrax100} are synonyms for
21893 @option{-march=v3} and @option{-march=v8} respectively.
21894
21895 @item -mmul-bug-workaround
21896 @itemx -mno-mul-bug-workaround
21897 @opindex mmul-bug-workaround
21898 @opindex mno-mul-bug-workaround
21899 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
21900 models where it applies. This option is active by default.
21901
21902 @item -mpdebug
21903 @opindex mpdebug
21904 Enable CRIS-specific verbose debug-related information in the assembly
21905 code. This option also has the effect of turning off the @samp{#NO_APP}
21906 formatted-code indicator to the assembler at the beginning of the
21907 assembly file.
21908
21909 @item -mcc-init
21910 @opindex mcc-init
21911 Do not use condition-code results from previous instruction; always emit
21912 compare and test instructions before use of condition codes.
21913
21914 @item -mno-side-effects
21915 @opindex mno-side-effects
21916 @opindex mside-effects
21917 Do not emit instructions with side effects in addressing modes other than
21918 post-increment.
21919
21920 @item -mstack-align
21921 @itemx -mno-stack-align
21922 @itemx -mdata-align
21923 @itemx -mno-data-align
21924 @itemx -mconst-align
21925 @itemx -mno-const-align
21926 @opindex mstack-align
21927 @opindex mno-stack-align
21928 @opindex mdata-align
21929 @opindex mno-data-align
21930 @opindex mconst-align
21931 @opindex mno-const-align
21932 These options (@samp{no-} options) arrange (eliminate arrangements) for the
21933 stack frame, individual data and constants to be aligned for the maximum
21934 single data access size for the chosen CPU model. The default is to
21935 arrange for 32-bit alignment. ABI details such as structure layout are
21936 not affected by these options.
21937
21938 @item -m32-bit
21939 @itemx -m16-bit
21940 @itemx -m8-bit
21941 @opindex m32-bit
21942 @opindex m16-bit
21943 @opindex m8-bit
21944 Similar to the stack- data- and const-align options above, these options
21945 arrange for stack frame, writable data and constants to all be 32-bit,
21946 16-bit or 8-bit aligned. The default is 32-bit alignment.
21947
21948 @item -mno-prologue-epilogue
21949 @itemx -mprologue-epilogue
21950 @opindex mno-prologue-epilogue
21951 @opindex mprologue-epilogue
21952 With @option{-mno-prologue-epilogue}, the normal function prologue and
21953 epilogue which set up the stack frame are omitted and no return
21954 instructions or return sequences are generated in the code. Use this
21955 option only together with visual inspection of the compiled code: no
21956 warnings or errors are generated when call-saved registers must be saved,
21957 or storage for local variables needs to be allocated.
21958
21959 @item -mno-gotplt
21960 @itemx -mgotplt
21961 @opindex mno-gotplt
21962 @opindex mgotplt
21963 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
21964 instruction sequences that load addresses for functions from the PLT part
21965 of the GOT rather than (traditional on other architectures) calls to the
21966 PLT@. The default is @option{-mgotplt}.
21967
21968 @item -melf
21969 @opindex melf
21970 Legacy no-op option only recognized with the cris-axis-elf and
21971 cris-axis-linux-gnu targets.
21972
21973 @item -mlinux
21974 @opindex mlinux
21975 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
21976
21977 @item -sim
21978 @opindex sim
21979 This option, recognized for the cris-axis-elf, arranges
21980 to link with input-output functions from a simulator library. Code,
21981 initialized data and zero-initialized data are allocated consecutively.
21982
21983 @item -sim2
21984 @opindex sim2
21985 Like @option{-sim}, but pass linker options to locate initialized data at
21986 0x40000000 and zero-initialized data at 0x80000000.
21987 @end table
21988
21989 @node CR16 Options
21990 @subsection CR16 Options
21991 @cindex CR16 Options
21992
21993 These options are defined specifically for the CR16 ports.
21994
21995 @table @gcctabopt
21996
21997 @item -mmac
21998 @opindex mmac
21999 Enable the use of multiply-accumulate instructions. Disabled by default.
22000
22001 @item -mcr16cplus
22002 @itemx -mcr16c
22003 @opindex mcr16cplus
22004 @opindex mcr16c
22005 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
22006 is default.
22007
22008 @item -msim
22009 @opindex msim
22010 Links the library libsim.a which is in compatible with simulator. Applicable
22011 to ELF compiler only.
22012
22013 @item -mint32
22014 @opindex mint32
22015 Choose integer type as 32-bit wide.
22016
22017 @item -mbit-ops
22018 @opindex mbit-ops
22019 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
22020
22021 @item -mdata-model=@var{model}
22022 @opindex mdata-model
22023 Choose a data model. The choices for @var{model} are @samp{near},
22024 @samp{far} or @samp{medium}. @samp{medium} is default.
22025 However, @samp{far} is not valid with @option{-mcr16c}, as the
22026 CR16C architecture does not support the far data model.
22027 @end table
22028
22029 @node C-SKY Options
22030 @subsection C-SKY Options
22031 @cindex C-SKY Options
22032
22033 GCC supports these options when compiling for C-SKY V2 processors.
22034
22035 @table @gcctabopt
22036
22037 @item -march=@var{arch}
22038 @opindex march=
22039 Specify the C-SKY target architecture. Valid values for @var{arch} are:
22040 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
22041 The default is @samp{ck810}.
22042
22043 @item -mcpu=@var{cpu}
22044 @opindex mcpu=
22045 Specify the C-SKY target processor. Valid values for @var{cpu} are:
22046 @samp{ck801}, @samp{ck801t},
22047 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
22048 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
22049 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
22050 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
22051 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
22052 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
22053 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
22054 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
22055 @samp{ck803eftr1}, @samp{ck803efhtr1},
22056 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
22057 @samp{ck803sef}, @samp{ck803seft},
22058 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
22059 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
22060 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
22061 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
22062
22063 @item -mbig-endian
22064 @opindex mbig-endian
22065 @itemx -EB
22066 @opindex EB
22067 @itemx -mlittle-endian
22068 @opindex mlittle-endian
22069 @itemx -EL
22070 @opindex EL
22071
22072 Select big- or little-endian code. The default is little-endian.
22073
22074 @item -mfloat-abi=@var{name}
22075 @opindex mfloat-abi
22076 Specifies which floating-point ABI to use. Permissible values
22077 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22078
22079 Specifying @samp{soft} causes GCC to generate output containing
22080 library calls for floating-point operations.
22081 @samp{softfp} allows the generation of code using hardware floating-point
22082 instructions, but still uses the soft-float calling conventions.
22083 @samp{hard} allows generation of floating-point instructions
22084 and uses FPU-specific calling conventions.
22085
22086 The default depends on the specific target configuration. Note that
22087 the hard-float and soft-float ABIs are not link-compatible; you must
22088 compile your entire program with the same ABI, and link with a
22089 compatible set of libraries.
22090
22091 @item -mhard-float
22092 @opindex mhard-float
22093 @itemx -msoft-float
22094 @opindex msoft-float
22095
22096 Select hardware or software floating-point implementations.
22097 The default is soft float.
22098
22099 @item -mdouble-float
22100 @itemx -mno-double-float
22101 @opindex mdouble-float
22102 When @option{-mhard-float} is in effect, enable generation of
22103 double-precision float instructions. This is the default except
22104 when compiling for CK803.
22105
22106 @item -mfdivdu
22107 @itemx -mno-fdivdu
22108 @opindex mfdivdu
22109 When @option{-mhard-float} is in effect, enable generation of
22110 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
22111 This is the default except when compiling for CK803.
22112
22113 @item -mfpu=@var{fpu}
22114 @opindex mfpu=
22115 Select the floating-point processor. This option can only be used with
22116 @option{-mhard-float}.
22117 Values for @var{fpu} are
22118 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
22119 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
22120 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
22121
22122 @item -melrw
22123 @itemx -mno-elrw
22124 @opindex melrw
22125 Enable the extended @code{lrw} instruction. This option defaults to on
22126 for CK801 and off otherwise.
22127
22128 @item -mistack
22129 @itemx -mno-istack
22130 @opindex mistack
22131 Enable interrupt stack instructions; the default is off.
22132
22133 The @option{-mistack} option is required to handle the
22134 @code{interrupt} and @code{isr} function attributes
22135 (@pxref{C-SKY Function Attributes}).
22136
22137 @item -mmp
22138 @opindex mmp
22139 Enable multiprocessor instructions; the default is off.
22140
22141 @item -mcp
22142 @opindex mcp
22143 Enable coprocessor instructions; the default is off.
22144
22145 @item -mcache
22146 @opindex mcache
22147 Enable coprocessor instructions; the default is off.
22148
22149 @item -msecurity
22150 @opindex msecurity
22151 Enable C-SKY security instructions; the default is off.
22152
22153 @item -mtrust
22154 @opindex mtrust
22155 Enable C-SKY trust instructions; the default is off.
22156
22157 @item -mdsp
22158 @opindex mdsp
22159 @itemx -medsp
22160 @opindex medsp
22161 @itemx -mvdsp
22162 @opindex mvdsp
22163 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
22164 All of these options default to off.
22165
22166 @item -mdiv
22167 @itemx -mno-div
22168 @opindex mdiv
22169 Generate divide instructions. Default is off.
22170
22171 @item -msmart
22172 @itemx -mno-smart
22173 @opindex msmart
22174 Generate code for Smart Mode, using only registers numbered 0-7 to allow
22175 use of 16-bit instructions. This option is ignored for CK801 where this
22176 is the required behavior, and it defaults to on for CK802.
22177 For other targets, the default is off.
22178
22179 @item -mhigh-registers
22180 @itemx -mno-high-registers
22181 @opindex mhigh-registers
22182 Generate code using the high registers numbered 16-31. This option
22183 is not supported on CK801, CK802, or CK803, and is enabled by default
22184 for other processors.
22185
22186 @item -manchor
22187 @itemx -mno-anchor
22188 @opindex manchor
22189 Generate code using global anchor symbol addresses.
22190
22191 @item -mpushpop
22192 @itemx -mno-pushpop
22193 @opindex mpushpop
22194 Generate code using @code{push} and @code{pop} instructions. This option
22195 defaults to on.
22196
22197 @item -mmultiple-stld
22198 @itemx -mstm
22199 @itemx -mno-multiple-stld
22200 @itemx -mno-stm
22201 @opindex mmultiple-stld
22202 Generate code using @code{stm} and @code{ldm} instructions. This option
22203 isn't supported on CK801 but is enabled by default on other processors.
22204
22205 @item -mconstpool
22206 @itemx -mno-constpool
22207 @opindex mconstpool
22208 Create constant pools in the compiler instead of deferring it to the
22209 assembler. This option is the default and required for correct code
22210 generation on CK801 and CK802, and is optional on other processors.
22211
22212 @item -mstack-size
22213 @item -mno-stack-size
22214 @opindex mstack-size
22215 Emit @code{.stack_size} directives for each function in the assembly
22216 output. This option defaults to off.
22217
22218 @item -mccrt
22219 @itemx -mno-ccrt
22220 @opindex mccrt
22221 Generate code for the C-SKY compiler runtime instead of libgcc. This
22222 option defaults to off.
22223
22224 @item -mbranch-cost=@var{n}
22225 @opindex mbranch-cost=
22226 Set the branch costs to roughly @code{n} instructions. The default is 1.
22227
22228 @item -msched-prolog
22229 @itemx -mno-sched-prolog
22230 @opindex msched-prolog
22231 Permit scheduling of function prologue and epilogue sequences. Using
22232 this option can result in code that is not compliant with the C-SKY V2 ABI
22233 prologue requirements and that cannot be debugged or backtraced.
22234 It is disabled by default.
22235
22236 @item -msim
22237 @opindex msim
22238 Links the library libsemi.a which is in compatible with simulator. Applicable
22239 to ELF compiler only.
22240
22241 @end table
22242
22243 @node Darwin Options
22244 @subsection Darwin Options
22245 @cindex Darwin options
22246
22247 These options are defined for all architectures running the Darwin operating
22248 system.
22249
22250 FSF GCC on Darwin does not create ``fat'' object files; it creates
22251 an object file for the single architecture that GCC was built to
22252 target. Apple's GCC on Darwin does create ``fat'' files if multiple
22253 @option{-arch} options are used; it does so by running the compiler or
22254 linker multiple times and joining the results together with
22255 @file{lipo}.
22256
22257 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
22258 @samp{i686}) is determined by the flags that specify the ISA
22259 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
22260 @option{-force_cpusubtype_ALL} option can be used to override this.
22261
22262 The Darwin tools vary in their behavior when presented with an ISA
22263 mismatch. The assembler, @file{as}, only permits instructions to
22264 be used that are valid for the subtype of the file it is generating,
22265 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
22266 The linker for shared libraries, @file{/usr/bin/libtool}, fails
22267 and prints an error if asked to create a shared library with a less
22268 restrictive subtype than its input files (for instance, trying to put
22269 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
22270 for executables, @command{ld}, quietly gives the executable the most
22271 restrictive subtype of any of its input files.
22272
22273 @table @gcctabopt
22274 @item -F@var{dir}
22275 @opindex F
22276 Add the framework directory @var{dir} to the head of the list of
22277 directories to be searched for header files. These directories are
22278 interleaved with those specified by @option{-I} options and are
22279 scanned in a left-to-right order.
22280
22281 A framework directory is a directory with frameworks in it. A
22282 framework is a directory with a @file{Headers} and/or
22283 @file{PrivateHeaders} directory contained directly in it that ends
22284 in @file{.framework}. The name of a framework is the name of this
22285 directory excluding the @file{.framework}. Headers associated with
22286 the framework are found in one of those two directories, with
22287 @file{Headers} being searched first. A subframework is a framework
22288 directory that is in a framework's @file{Frameworks} directory.
22289 Includes of subframework headers can only appear in a header of a
22290 framework that contains the subframework, or in a sibling subframework
22291 header. Two subframeworks are siblings if they occur in the same
22292 framework. A subframework should not have the same name as a
22293 framework; a warning is issued if this is violated. Currently a
22294 subframework cannot have subframeworks; in the future, the mechanism
22295 may be extended to support this. The standard frameworks can be found
22296 in @file{/System/Library/Frameworks} and
22297 @file{/Library/Frameworks}. An example include looks like
22298 @code{#include <Framework/header.h>}, where @file{Framework} denotes
22299 the name of the framework and @file{header.h} is found in the
22300 @file{PrivateHeaders} or @file{Headers} directory.
22301
22302 @item -iframework@var{dir}
22303 @opindex iframework
22304 Like @option{-F} except the directory is a treated as a system
22305 directory. The main difference between this @option{-iframework} and
22306 @option{-F} is that with @option{-iframework} the compiler does not
22307 warn about constructs contained within header files found via
22308 @var{dir}. This option is valid only for the C family of languages.
22309
22310 @item -gused
22311 @opindex gused
22312 Emit debugging information for symbols that are used. For stabs
22313 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
22314 This is by default ON@.
22315
22316 @item -gfull
22317 @opindex gfull
22318 Emit debugging information for all symbols and types.
22319
22320 @item -mmacosx-version-min=@var{version}
22321 The earliest version of MacOS X that this executable will run on
22322 is @var{version}. Typical values of @var{version} include @code{10.1},
22323 @code{10.2}, and @code{10.3.9}.
22324
22325 If the compiler was built to use the system's headers by default,
22326 then the default for this option is the system version on which the
22327 compiler is running, otherwise the default is to make choices that
22328 are compatible with as many systems and code bases as possible.
22329
22330 @item -mkernel
22331 @opindex mkernel
22332 Enable kernel development mode. The @option{-mkernel} option sets
22333 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
22334 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
22335 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
22336 applicable. This mode also sets @option{-mno-altivec},
22337 @option{-msoft-float}, @option{-fno-builtin} and
22338 @option{-mlong-branch} for PowerPC targets.
22339
22340 @item -mone-byte-bool
22341 @opindex mone-byte-bool
22342 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
22343 By default @code{sizeof(bool)} is @code{4} when compiling for
22344 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
22345 option has no effect on x86.
22346
22347 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
22348 to generate code that is not binary compatible with code generated
22349 without that switch. Using this switch may require recompiling all
22350 other modules in a program, including system libraries. Use this
22351 switch to conform to a non-default data model.
22352
22353 @item -mfix-and-continue
22354 @itemx -ffix-and-continue
22355 @itemx -findirect-data
22356 @opindex mfix-and-continue
22357 @opindex ffix-and-continue
22358 @opindex findirect-data
22359 Generate code suitable for fast turnaround development, such as to
22360 allow GDB to dynamically load @file{.o} files into already-running
22361 programs. @option{-findirect-data} and @option{-ffix-and-continue}
22362 are provided for backwards compatibility.
22363
22364 @item -all_load
22365 @opindex all_load
22366 Loads all members of static archive libraries.
22367 See man ld(1) for more information.
22368
22369 @item -arch_errors_fatal
22370 @opindex arch_errors_fatal
22371 Cause the errors having to do with files that have the wrong architecture
22372 to be fatal.
22373
22374 @item -bind_at_load
22375 @opindex bind_at_load
22376 Causes the output file to be marked such that the dynamic linker will
22377 bind all undefined references when the file is loaded or launched.
22378
22379 @item -bundle
22380 @opindex bundle
22381 Produce a Mach-o bundle format file.
22382 See man ld(1) for more information.
22383
22384 @item -bundle_loader @var{executable}
22385 @opindex bundle_loader
22386 This option specifies the @var{executable} that will load the build
22387 output file being linked. See man ld(1) for more information.
22388
22389 @item -dynamiclib
22390 @opindex dynamiclib
22391 When passed this option, GCC produces a dynamic library instead of
22392 an executable when linking, using the Darwin @file{libtool} command.
22393
22394 @item -force_cpusubtype_ALL
22395 @opindex force_cpusubtype_ALL
22396 This causes GCC's output file to have the @samp{ALL} subtype, instead of
22397 one controlled by the @option{-mcpu} or @option{-march} option.
22398
22399 @item -allowable_client @var{client_name}
22400 @itemx -client_name
22401 @itemx -compatibility_version
22402 @itemx -current_version
22403 @itemx -dead_strip
22404 @itemx -dependency-file
22405 @itemx -dylib_file
22406 @itemx -dylinker_install_name
22407 @itemx -dynamic
22408 @itemx -exported_symbols_list
22409 @itemx -filelist
22410 @need 800
22411 @itemx -flat_namespace
22412 @itemx -force_flat_namespace
22413 @itemx -headerpad_max_install_names
22414 @itemx -image_base
22415 @itemx -init
22416 @itemx -install_name
22417 @itemx -keep_private_externs
22418 @itemx -multi_module
22419 @itemx -multiply_defined
22420 @itemx -multiply_defined_unused
22421 @need 800
22422 @itemx -noall_load
22423 @itemx -no_dead_strip_inits_and_terms
22424 @itemx -nofixprebinding
22425 @itemx -nomultidefs
22426 @itemx -noprebind
22427 @itemx -noseglinkedit
22428 @itemx -pagezero_size
22429 @itemx -prebind
22430 @itemx -prebind_all_twolevel_modules
22431 @itemx -private_bundle
22432 @need 800
22433 @itemx -read_only_relocs
22434 @itemx -sectalign
22435 @itemx -sectobjectsymbols
22436 @itemx -whyload
22437 @itemx -seg1addr
22438 @itemx -sectcreate
22439 @itemx -sectobjectsymbols
22440 @itemx -sectorder
22441 @itemx -segaddr
22442 @itemx -segs_read_only_addr
22443 @need 800
22444 @itemx -segs_read_write_addr
22445 @itemx -seg_addr_table
22446 @itemx -seg_addr_table_filename
22447 @itemx -seglinkedit
22448 @itemx -segprot
22449 @itemx -segs_read_only_addr
22450 @itemx -segs_read_write_addr
22451 @itemx -single_module
22452 @itemx -static
22453 @itemx -sub_library
22454 @need 800
22455 @itemx -sub_umbrella
22456 @itemx -twolevel_namespace
22457 @itemx -umbrella
22458 @itemx -undefined
22459 @itemx -unexported_symbols_list
22460 @itemx -weak_reference_mismatches
22461 @itemx -whatsloaded
22462 @opindex allowable_client
22463 @opindex client_name
22464 @opindex compatibility_version
22465 @opindex current_version
22466 @opindex dead_strip
22467 @opindex dependency-file
22468 @opindex dylib_file
22469 @opindex dylinker_install_name
22470 @opindex dynamic
22471 @opindex exported_symbols_list
22472 @opindex filelist
22473 @opindex flat_namespace
22474 @opindex force_flat_namespace
22475 @opindex headerpad_max_install_names
22476 @opindex image_base
22477 @opindex init
22478 @opindex install_name
22479 @opindex keep_private_externs
22480 @opindex multi_module
22481 @opindex multiply_defined
22482 @opindex multiply_defined_unused
22483 @opindex noall_load
22484 @opindex no_dead_strip_inits_and_terms
22485 @opindex nofixprebinding
22486 @opindex nomultidefs
22487 @opindex noprebind
22488 @opindex noseglinkedit
22489 @opindex pagezero_size
22490 @opindex prebind
22491 @opindex prebind_all_twolevel_modules
22492 @opindex private_bundle
22493 @opindex read_only_relocs
22494 @opindex sectalign
22495 @opindex sectobjectsymbols
22496 @opindex whyload
22497 @opindex seg1addr
22498 @opindex sectcreate
22499 @opindex sectobjectsymbols
22500 @opindex sectorder
22501 @opindex segaddr
22502 @opindex segs_read_only_addr
22503 @opindex segs_read_write_addr
22504 @opindex seg_addr_table
22505 @opindex seg_addr_table_filename
22506 @opindex seglinkedit
22507 @opindex segprot
22508 @opindex segs_read_only_addr
22509 @opindex segs_read_write_addr
22510 @opindex single_module
22511 @opindex static
22512 @opindex sub_library
22513 @opindex sub_umbrella
22514 @opindex twolevel_namespace
22515 @opindex umbrella
22516 @opindex undefined
22517 @opindex unexported_symbols_list
22518 @opindex weak_reference_mismatches
22519 @opindex whatsloaded
22520 These options are passed to the Darwin linker. The Darwin linker man page
22521 describes them in detail.
22522 @end table
22523
22524 @node DEC Alpha Options
22525 @subsection DEC Alpha Options
22526
22527 These @samp{-m} options are defined for the DEC Alpha implementations:
22528
22529 @table @gcctabopt
22530 @item -mno-soft-float
22531 @itemx -msoft-float
22532 @opindex mno-soft-float
22533 @opindex msoft-float
22534 Use (do not use) the hardware floating-point instructions for
22535 floating-point operations. When @option{-msoft-float} is specified,
22536 functions in @file{libgcc.a} are used to perform floating-point
22537 operations. Unless they are replaced by routines that emulate the
22538 floating-point operations, or compiled in such a way as to call such
22539 emulations routines, these routines issue floating-point
22540 operations. If you are compiling for an Alpha without floating-point
22541 operations, you must ensure that the library is built so as not to call
22542 them.
22543
22544 Note that Alpha implementations without floating-point operations are
22545 required to have floating-point registers.
22546
22547 @item -mfp-reg
22548 @itemx -mno-fp-regs
22549 @opindex mfp-reg
22550 @opindex mno-fp-regs
22551 Generate code that uses (does not use) the floating-point register set.
22552 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
22553 register set is not used, floating-point operands are passed in integer
22554 registers as if they were integers and floating-point results are passed
22555 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
22556 so any function with a floating-point argument or return value called by code
22557 compiled with @option{-mno-fp-regs} must also be compiled with that
22558 option.
22559
22560 A typical use of this option is building a kernel that does not use,
22561 and hence need not save and restore, any floating-point registers.
22562
22563 @item -mieee
22564 @opindex mieee
22565 The Alpha architecture implements floating-point hardware optimized for
22566 maximum performance. It is mostly compliant with the IEEE floating-point
22567 standard. However, for full compliance, software assistance is
22568 required. This option generates code fully IEEE-compliant code
22569 @emph{except} that the @var{inexact-flag} is not maintained (see below).
22570 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
22571 defined during compilation. The resulting code is less efficient but is
22572 able to correctly support denormalized numbers and exceptional IEEE
22573 values such as not-a-number and plus/minus infinity. Other Alpha
22574 compilers call this option @option{-ieee_with_no_inexact}.
22575
22576 @item -mieee-with-inexact
22577 @opindex mieee-with-inexact
22578 This is like @option{-mieee} except the generated code also maintains
22579 the IEEE @var{inexact-flag}. Turning on this option causes the
22580 generated code to implement fully-compliant IEEE math. In addition to
22581 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
22582 macro. On some Alpha implementations the resulting code may execute
22583 significantly slower than the code generated by default. Since there is
22584 very little code that depends on the @var{inexact-flag}, you should
22585 normally not specify this option. Other Alpha compilers call this
22586 option @option{-ieee_with_inexact}.
22587
22588 @item -mfp-trap-mode=@var{trap-mode}
22589 @opindex mfp-trap-mode
22590 This option controls what floating-point related traps are enabled.
22591 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
22592 The trap mode can be set to one of four values:
22593
22594 @table @samp
22595 @item n
22596 This is the default (normal) setting. The only traps that are enabled
22597 are the ones that cannot be disabled in software (e.g., division by zero
22598 trap).
22599
22600 @item u
22601 In addition to the traps enabled by @samp{n}, underflow traps are enabled
22602 as well.
22603
22604 @item su
22605 Like @samp{u}, but the instructions are marked to be safe for software
22606 completion (see Alpha architecture manual for details).
22607
22608 @item sui
22609 Like @samp{su}, but inexact traps are enabled as well.
22610 @end table
22611
22612 @item -mfp-rounding-mode=@var{rounding-mode}
22613 @opindex mfp-rounding-mode
22614 Selects the IEEE rounding mode. Other Alpha compilers call this option
22615 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
22616 of:
22617
22618 @table @samp
22619 @item n
22620 Normal IEEE rounding mode. Floating-point numbers are rounded towards
22621 the nearest machine number or towards the even machine number in case
22622 of a tie.
22623
22624 @item m
22625 Round towards minus infinity.
22626
22627 @item c
22628 Chopped rounding mode. Floating-point numbers are rounded towards zero.
22629
22630 @item d
22631 Dynamic rounding mode. A field in the floating-point control register
22632 (@var{fpcr}, see Alpha architecture reference manual) controls the
22633 rounding mode in effect. The C library initializes this register for
22634 rounding towards plus infinity. Thus, unless your program modifies the
22635 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
22636 @end table
22637
22638 @item -mtrap-precision=@var{trap-precision}
22639 @opindex mtrap-precision
22640 In the Alpha architecture, floating-point traps are imprecise. This
22641 means without software assistance it is impossible to recover from a
22642 floating trap and program execution normally needs to be terminated.
22643 GCC can generate code that can assist operating system trap handlers
22644 in determining the exact location that caused a floating-point trap.
22645 Depending on the requirements of an application, different levels of
22646 precisions can be selected:
22647
22648 @table @samp
22649 @item p
22650 Program precision. This option is the default and means a trap handler
22651 can only identify which program caused a floating-point exception.
22652
22653 @item f
22654 Function precision. The trap handler can determine the function that
22655 caused a floating-point exception.
22656
22657 @item i
22658 Instruction precision. The trap handler can determine the exact
22659 instruction that caused a floating-point exception.
22660 @end table
22661
22662 Other Alpha compilers provide the equivalent options called
22663 @option{-scope_safe} and @option{-resumption_safe}.
22664
22665 @item -mieee-conformant
22666 @opindex mieee-conformant
22667 This option marks the generated code as IEEE conformant. You must not
22668 use this option unless you also specify @option{-mtrap-precision=i} and either
22669 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
22670 is to emit the line @samp{.eflag 48} in the function prologue of the
22671 generated assembly file.
22672
22673 @item -mbuild-constants
22674 @opindex mbuild-constants
22675 Normally GCC examines a 32- or 64-bit integer constant to
22676 see if it can construct it from smaller constants in two or three
22677 instructions. If it cannot, it outputs the constant as a literal and
22678 generates code to load it from the data segment at run time.
22679
22680 Use this option to require GCC to construct @emph{all} integer constants
22681 using code, even if it takes more instructions (the maximum is six).
22682
22683 You typically use this option to build a shared library dynamic
22684 loader. Itself a shared library, it must relocate itself in memory
22685 before it can find the variables and constants in its own data segment.
22686
22687 @item -mbwx
22688 @itemx -mno-bwx
22689 @itemx -mcix
22690 @itemx -mno-cix
22691 @itemx -mfix
22692 @itemx -mno-fix
22693 @itemx -mmax
22694 @itemx -mno-max
22695 @opindex mbwx
22696 @opindex mno-bwx
22697 @opindex mcix
22698 @opindex mno-cix
22699 @opindex mfix
22700 @opindex mno-fix
22701 @opindex mmax
22702 @opindex mno-max
22703 Indicate whether GCC should generate code to use the optional BWX,
22704 CIX, FIX and MAX instruction sets. The default is to use the instruction
22705 sets supported by the CPU type specified via @option{-mcpu=} option or that
22706 of the CPU on which GCC was built if none is specified.
22707
22708 @item -mfloat-vax
22709 @itemx -mfloat-ieee
22710 @opindex mfloat-vax
22711 @opindex mfloat-ieee
22712 Generate code that uses (does not use) VAX F and G floating-point
22713 arithmetic instead of IEEE single and double precision.
22714
22715 @item -mexplicit-relocs
22716 @itemx -mno-explicit-relocs
22717 @opindex mexplicit-relocs
22718 @opindex mno-explicit-relocs
22719 Older Alpha assemblers provided no way to generate symbol relocations
22720 except via assembler macros. Use of these macros does not allow
22721 optimal instruction scheduling. GNU binutils as of version 2.12
22722 supports a new syntax that allows the compiler to explicitly mark
22723 which relocations should apply to which instructions. This option
22724 is mostly useful for debugging, as GCC detects the capabilities of
22725 the assembler when it is built and sets the default accordingly.
22726
22727 @item -msmall-data
22728 @itemx -mlarge-data
22729 @opindex msmall-data
22730 @opindex mlarge-data
22731 When @option{-mexplicit-relocs} is in effect, static data is
22732 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
22733 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
22734 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
22735 16-bit relocations off of the @code{$gp} register. This limits the
22736 size of the small data area to 64KB, but allows the variables to be
22737 directly accessed via a single instruction.
22738
22739 The default is @option{-mlarge-data}. With this option the data area
22740 is limited to just below 2GB@. Programs that require more than 2GB of
22741 data must use @code{malloc} or @code{mmap} to allocate the data in the
22742 heap instead of in the program's data segment.
22743
22744 When generating code for shared libraries, @option{-fpic} implies
22745 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
22746
22747 @item -msmall-text
22748 @itemx -mlarge-text
22749 @opindex msmall-text
22750 @opindex mlarge-text
22751 When @option{-msmall-text} is used, the compiler assumes that the
22752 code of the entire program (or shared library) fits in 4MB, and is
22753 thus reachable with a branch instruction. When @option{-msmall-data}
22754 is used, the compiler can assume that all local symbols share the
22755 same @code{$gp} value, and thus reduce the number of instructions
22756 required for a function call from 4 to 1.
22757
22758 The default is @option{-mlarge-text}.
22759
22760 @item -mcpu=@var{cpu_type}
22761 @opindex mcpu
22762 Set the instruction set and instruction scheduling parameters for
22763 machine type @var{cpu_type}. You can specify either the @samp{EV}
22764 style name or the corresponding chip number. GCC supports scheduling
22765 parameters for the EV4, EV5 and EV6 family of processors and
22766 chooses the default values for the instruction set from the processor
22767 you specify. If you do not specify a processor type, GCC defaults
22768 to the processor on which the compiler was built.
22769
22770 Supported values for @var{cpu_type} are
22771
22772 @table @samp
22773 @item ev4
22774 @itemx ev45
22775 @itemx 21064
22776 Schedules as an EV4 and has no instruction set extensions.
22777
22778 @item ev5
22779 @itemx 21164
22780 Schedules as an EV5 and has no instruction set extensions.
22781
22782 @item ev56
22783 @itemx 21164a
22784 Schedules as an EV5 and supports the BWX extension.
22785
22786 @item pca56
22787 @itemx 21164pc
22788 @itemx 21164PC
22789 Schedules as an EV5 and supports the BWX and MAX extensions.
22790
22791 @item ev6
22792 @itemx 21264
22793 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
22794
22795 @item ev67
22796 @itemx 21264a
22797 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
22798 @end table
22799
22800 Native toolchains also support the value @samp{native},
22801 which selects the best architecture option for the host processor.
22802 @option{-mcpu=native} has no effect if GCC does not recognize
22803 the processor.
22804
22805 @item -mtune=@var{cpu_type}
22806 @opindex mtune
22807 Set only the instruction scheduling parameters for machine type
22808 @var{cpu_type}. The instruction set is not changed.
22809
22810 Native toolchains also support the value @samp{native},
22811 which selects the best architecture option for the host processor.
22812 @option{-mtune=native} has no effect if GCC does not recognize
22813 the processor.
22814
22815 @item -mmemory-latency=@var{time}
22816 @opindex mmemory-latency
22817 Sets the latency the scheduler should assume for typical memory
22818 references as seen by the application. This number is highly
22819 dependent on the memory access patterns used by the application
22820 and the size of the external cache on the machine.
22821
22822 Valid options for @var{time} are
22823
22824 @table @samp
22825 @item @var{number}
22826 A decimal number representing clock cycles.
22827
22828 @item L1
22829 @itemx L2
22830 @itemx L3
22831 @itemx main
22832 The compiler contains estimates of the number of clock cycles for
22833 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
22834 (also called Dcache, Scache, and Bcache), as well as to main memory.
22835 Note that L3 is only valid for EV5.
22836
22837 @end table
22838 @end table
22839
22840 @node eBPF Options
22841 @subsection eBPF Options
22842 @cindex eBPF Options
22843
22844 @table @gcctabopt
22845 @item -mframe-limit=@var{bytes}
22846 This specifies the hard limit for frame sizes, in bytes. Currently,
22847 the value that can be specified should be less than or equal to
22848 @samp{32767}. Defaults to whatever limit is imposed by the version of
22849 the Linux kernel targeted.
22850
22851 @item -mkernel=@var{version}
22852 @opindex mkernel
22853 This specifies the minimum version of the kernel that will run the
22854 compiled program. GCC uses this version to determine which
22855 instructions to use, what kernel helpers to allow, etc. Currently,
22856 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
22857 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
22858 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
22859 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
22860 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
22861 @samp{5.2}, @samp{latest} and @samp{native}.
22862
22863 @item -mbig-endian
22864 @opindex mbig-endian
22865 Generate code for a big-endian target.
22866
22867 @item -mlittle-endian
22868 @opindex mlittle-endian
22869 Generate code for a little-endian target. This is the default.
22870
22871 @item -mjmpext
22872 @opindex mjmpext
22873 Enable generation of extra conditional-branch instructions.
22874 Enabled for CPU v2 and above.
22875
22876 @item -mjmp32
22877 @opindex mjmp32
22878 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
22879
22880 @item -malu32
22881 @opindex malu32
22882 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
22883
22884 @item -mcpu=@var{version}
22885 @opindex mcpu
22886 This specifies which version of the eBPF ISA to target. Newer versions
22887 may not be supported by all kernels. The default is @samp{v3}.
22888
22889 Supported values for @var{version} are:
22890
22891 @table @samp
22892 @item v1
22893 The first stable eBPF ISA with no special features or extensions.
22894
22895 @item v2
22896 Supports the jump extensions, as in @option{-mjmpext}.
22897
22898 @item v3
22899 All features of v2, plus:
22900 @itemize @minus
22901 @item 32-bit jump operations, as in @option{-mjmp32}
22902 @item 32-bit ALU operations, as in @option{-malu32}
22903 @end itemize
22904
22905 @end table
22906
22907 @item -mco-re
22908 @opindex mco-re
22909 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
22910 is implied by @option{-gbtf}.
22911
22912 @item -mno-co-re
22913 @opindex mno-co-re
22914 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
22915 support is enabled by default when generating BTF debug information for
22916 the BPF target.
22917
22918 @item -mxbpf
22919 Generate code for an expanded version of BPF, which relaxes some of
22920 the restrictions imposed by the BPF architecture:
22921 @itemize @minus
22922 @item Save and restore callee-saved registers at function entry and
22923 exit, respectively.
22924 @end itemize
22925 @end table
22926
22927 @node FR30 Options
22928 @subsection FR30 Options
22929 @cindex FR30 Options
22930
22931 These options are defined specifically for the FR30 port.
22932
22933 @table @gcctabopt
22934
22935 @item -msmall-model
22936 @opindex msmall-model
22937 Use the small address space model. This can produce smaller code, but
22938 it does assume that all symbolic values and addresses fit into a
22939 20-bit range.
22940
22941 @item -mno-lsim
22942 @opindex mno-lsim
22943 Assume that runtime support has been provided and so there is no need
22944 to include the simulator library (@file{libsim.a}) on the linker
22945 command line.
22946
22947 @end table
22948
22949 @node FT32 Options
22950 @subsection FT32 Options
22951 @cindex FT32 Options
22952
22953 These options are defined specifically for the FT32 port.
22954
22955 @table @gcctabopt
22956
22957 @item -msim
22958 @opindex msim
22959 Specifies that the program will be run on the simulator. This causes
22960 an alternate runtime startup and library to be linked.
22961 You must not use this option when generating programs that will run on
22962 real hardware; you must provide your own runtime library for whatever
22963 I/O functions are needed.
22964
22965 @item -mlra
22966 @opindex mlra
22967 Enable Local Register Allocation. This is still experimental for FT32,
22968 so by default the compiler uses standard reload.
22969
22970 @item -mnodiv
22971 @opindex mnodiv
22972 Do not use div and mod instructions.
22973
22974 @item -mft32b
22975 @opindex mft32b
22976 Enable use of the extended instructions of the FT32B processor.
22977
22978 @item -mcompress
22979 @opindex mcompress
22980 Compress all code using the Ft32B code compression scheme.
22981
22982 @item -mnopm
22983 @opindex mnopm
22984 Do not generate code that reads program memory.
22985
22986 @end table
22987
22988 @node FRV Options
22989 @subsection FRV Options
22990 @cindex FRV Options
22991
22992 @table @gcctabopt
22993 @item -mgpr-32
22994 @opindex mgpr-32
22995
22996 Only use the first 32 general-purpose registers.
22997
22998 @item -mgpr-64
22999 @opindex mgpr-64
23000
23001 Use all 64 general-purpose registers.
23002
23003 @item -mfpr-32
23004 @opindex mfpr-32
23005
23006 Use only the first 32 floating-point registers.
23007
23008 @item -mfpr-64
23009 @opindex mfpr-64
23010
23011 Use all 64 floating-point registers.
23012
23013 @item -mhard-float
23014 @opindex mhard-float
23015
23016 Use hardware instructions for floating-point operations.
23017
23018 @item -msoft-float
23019 @opindex msoft-float
23020
23021 Use library routines for floating-point operations.
23022
23023 @item -malloc-cc
23024 @opindex malloc-cc
23025
23026 Dynamically allocate condition code registers.
23027
23028 @item -mfixed-cc
23029 @opindex mfixed-cc
23030
23031 Do not try to dynamically allocate condition code registers, only
23032 use @code{icc0} and @code{fcc0}.
23033
23034 @item -mdword
23035 @opindex mdword
23036
23037 Change ABI to use double word insns.
23038
23039 @item -mno-dword
23040 @opindex mno-dword
23041 @opindex mdword
23042
23043 Do not use double word instructions.
23044
23045 @item -mdouble
23046 @opindex mdouble
23047
23048 Use floating-point double instructions.
23049
23050 @item -mno-double
23051 @opindex mno-double
23052
23053 Do not use floating-point double instructions.
23054
23055 @item -mmedia
23056 @opindex mmedia
23057
23058 Use media instructions.
23059
23060 @item -mno-media
23061 @opindex mno-media
23062
23063 Do not use media instructions.
23064
23065 @item -mmuladd
23066 @opindex mmuladd
23067
23068 Use multiply and add/subtract instructions.
23069
23070 @item -mno-muladd
23071 @opindex mno-muladd
23072
23073 Do not use multiply and add/subtract instructions.
23074
23075 @item -mfdpic
23076 @opindex mfdpic
23077
23078 Select the FDPIC ABI, which uses function descriptors to represent
23079 pointers to functions. Without any PIC/PIE-related options, it
23080 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
23081 assumes GOT entries and small data are within a 12-bit range from the
23082 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
23083 are computed with 32 bits.
23084 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23085
23086 @item -minline-plt
23087 @opindex minline-plt
23088
23089 Enable inlining of PLT entries in function calls to functions that are
23090 not known to bind locally. It has no effect without @option{-mfdpic}.
23091 It's enabled by default if optimizing for speed and compiling for
23092 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
23093 optimization option such as @option{-O3} or above is present in the
23094 command line.
23095
23096 @item -mTLS
23097 @opindex mTLS
23098
23099 Assume a large TLS segment when generating thread-local code.
23100
23101 @item -mtls
23102 @opindex mtls
23103
23104 Do not assume a large TLS segment when generating thread-local code.
23105
23106 @item -mgprel-ro
23107 @opindex mgprel-ro
23108
23109 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
23110 that is known to be in read-only sections. It's enabled by default,
23111 except for @option{-fpic} or @option{-fpie}: even though it may help
23112 make the global offset table smaller, it trades 1 instruction for 4.
23113 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
23114 one of which may be shared by multiple symbols, and it avoids the need
23115 for a GOT entry for the referenced symbol, so it's more likely to be a
23116 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
23117
23118 @item -multilib-library-pic
23119 @opindex multilib-library-pic
23120
23121 Link with the (library, not FD) pic libraries. It's implied by
23122 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
23123 @option{-fpic} without @option{-mfdpic}. You should never have to use
23124 it explicitly.
23125
23126 @item -mlinked-fp
23127 @opindex mlinked-fp
23128
23129 Follow the EABI requirement of always creating a frame pointer whenever
23130 a stack frame is allocated. This option is enabled by default and can
23131 be disabled with @option{-mno-linked-fp}.
23132
23133 @item -mlong-calls
23134 @opindex mlong-calls
23135
23136 Use indirect addressing to call functions outside the current
23137 compilation unit. This allows the functions to be placed anywhere
23138 within the 32-bit address space.
23139
23140 @item -malign-labels
23141 @opindex malign-labels
23142
23143 Try to align labels to an 8-byte boundary by inserting NOPs into the
23144 previous packet. This option only has an effect when VLIW packing
23145 is enabled. It doesn't create new packets; it merely adds NOPs to
23146 existing ones.
23147
23148 @item -mlibrary-pic
23149 @opindex mlibrary-pic
23150
23151 Generate position-independent EABI code.
23152
23153 @item -macc-4
23154 @opindex macc-4
23155
23156 Use only the first four media accumulator registers.
23157
23158 @item -macc-8
23159 @opindex macc-8
23160
23161 Use all eight media accumulator registers.
23162
23163 @item -mpack
23164 @opindex mpack
23165
23166 Pack VLIW instructions.
23167
23168 @item -mno-pack
23169 @opindex mno-pack
23170
23171 Do not pack VLIW instructions.
23172
23173 @item -mno-eflags
23174 @opindex mno-eflags
23175
23176 Do not mark ABI switches in e_flags.
23177
23178 @item -mcond-move
23179 @opindex mcond-move
23180
23181 Enable the use of conditional-move instructions (default).
23182
23183 This switch is mainly for debugging the compiler and will likely be removed
23184 in a future version.
23185
23186 @item -mno-cond-move
23187 @opindex mno-cond-move
23188
23189 Disable the use of conditional-move instructions.
23190
23191 This switch is mainly for debugging the compiler and will likely be removed
23192 in a future version.
23193
23194 @item -mscc
23195 @opindex mscc
23196
23197 Enable the use of conditional set instructions (default).
23198
23199 This switch is mainly for debugging the compiler and will likely be removed
23200 in a future version.
23201
23202 @item -mno-scc
23203 @opindex mno-scc
23204
23205 Disable the use of conditional set instructions.
23206
23207 This switch is mainly for debugging the compiler and will likely be removed
23208 in a future version.
23209
23210 @item -mcond-exec
23211 @opindex mcond-exec
23212
23213 Enable the use of conditional execution (default).
23214
23215 This switch is mainly for debugging the compiler and will likely be removed
23216 in a future version.
23217
23218 @item -mno-cond-exec
23219 @opindex mno-cond-exec
23220
23221 Disable the use of conditional execution.
23222
23223 This switch is mainly for debugging the compiler and will likely be removed
23224 in a future version.
23225
23226 @item -mvliw-branch
23227 @opindex mvliw-branch
23228
23229 Run a pass to pack branches into VLIW instructions (default).
23230
23231 This switch is mainly for debugging the compiler and will likely be removed
23232 in a future version.
23233
23234 @item -mno-vliw-branch
23235 @opindex mno-vliw-branch
23236
23237 Do not run a pass to pack branches into VLIW instructions.
23238
23239 This switch is mainly for debugging the compiler and will likely be removed
23240 in a future version.
23241
23242 @item -mmulti-cond-exec
23243 @opindex mmulti-cond-exec
23244
23245 Enable optimization of @code{&&} and @code{||} in conditional execution
23246 (default).
23247
23248 This switch is mainly for debugging the compiler and will likely be removed
23249 in a future version.
23250
23251 @item -mno-multi-cond-exec
23252 @opindex mno-multi-cond-exec
23253
23254 Disable optimization of @code{&&} and @code{||} in conditional execution.
23255
23256 This switch is mainly for debugging the compiler and will likely be removed
23257 in a future version.
23258
23259 @item -mnested-cond-exec
23260 @opindex mnested-cond-exec
23261
23262 Enable nested conditional execution optimizations (default).
23263
23264 This switch is mainly for debugging the compiler and will likely be removed
23265 in a future version.
23266
23267 @item -mno-nested-cond-exec
23268 @opindex mno-nested-cond-exec
23269
23270 Disable nested conditional execution optimizations.
23271
23272 This switch is mainly for debugging the compiler and will likely be removed
23273 in a future version.
23274
23275 @item -moptimize-membar
23276 @opindex moptimize-membar
23277
23278 This switch removes redundant @code{membar} instructions from the
23279 compiler-generated code. It is enabled by default.
23280
23281 @item -mno-optimize-membar
23282 @opindex mno-optimize-membar
23283 @opindex moptimize-membar
23284
23285 This switch disables the automatic removal of redundant @code{membar}
23286 instructions from the generated code.
23287
23288 @item -mtomcat-stats
23289 @opindex mtomcat-stats
23290
23291 Cause gas to print out tomcat statistics.
23292
23293 @item -mcpu=@var{cpu}
23294 @opindex mcpu
23295
23296 Select the processor type for which to generate code. Possible values are
23297 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
23298 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
23299
23300 @end table
23301
23302 @node GNU/Linux Options
23303 @subsection GNU/Linux Options
23304
23305 These @samp{-m} options are defined for GNU/Linux targets:
23306
23307 @table @gcctabopt
23308 @item -mglibc
23309 @opindex mglibc
23310 Use the GNU C library. This is the default except
23311 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
23312 @samp{*-*-linux-*android*} targets.
23313
23314 @item -muclibc
23315 @opindex muclibc
23316 Use uClibc C library. This is the default on
23317 @samp{*-*-linux-*uclibc*} targets.
23318
23319 @item -mmusl
23320 @opindex mmusl
23321 Use the musl C library. This is the default on
23322 @samp{*-*-linux-*musl*} targets.
23323
23324 @item -mbionic
23325 @opindex mbionic
23326 Use Bionic C library. This is the default on
23327 @samp{*-*-linux-*android*} targets.
23328
23329 @item -mandroid
23330 @opindex mandroid
23331 Compile code compatible with Android platform. This is the default on
23332 @samp{*-*-linux-*android*} targets.
23333
23334 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
23335 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
23336 this option makes the GCC driver pass Android-specific options to the linker.
23337 Finally, this option causes the preprocessor macro @code{__ANDROID__}
23338 to be defined.
23339
23340 @item -tno-android-cc
23341 @opindex tno-android-cc
23342 Disable compilation effects of @option{-mandroid}, i.e., do not enable
23343 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
23344 @option{-fno-rtti} by default.
23345
23346 @item -tno-android-ld
23347 @opindex tno-android-ld
23348 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
23349 linking options to the linker.
23350
23351 @end table
23352
23353 @node H8/300 Options
23354 @subsection H8/300 Options
23355
23356 These @samp{-m} options are defined for the H8/300 implementations:
23357
23358 @table @gcctabopt
23359 @item -mrelax
23360 @opindex mrelax
23361 Shorten some address references at link time, when possible; uses the
23362 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
23363 ld, Using ld}, for a fuller description.
23364
23365 @item -mh
23366 @opindex mh
23367 Generate code for the H8/300H@.
23368
23369 @item -ms
23370 @opindex ms
23371 Generate code for the H8S@.
23372
23373 @item -mn
23374 @opindex mn
23375 Generate code for the H8S and H8/300H in the normal mode. This switch
23376 must be used either with @option{-mh} or @option{-ms}.
23377
23378 @item -ms2600
23379 @opindex ms2600
23380 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
23381
23382 @item -mexr
23383 @opindex mexr
23384 Extended registers are stored on stack before execution of function
23385 with monitor attribute. Default option is @option{-mexr}.
23386 This option is valid only for H8S targets.
23387
23388 @item -mno-exr
23389 @opindex mno-exr
23390 @opindex mexr
23391 Extended registers are not stored on stack before execution of function
23392 with monitor attribute. Default option is @option{-mno-exr}.
23393 This option is valid only for H8S targets.
23394
23395 @item -mint32
23396 @opindex mint32
23397 Make @code{int} data 32 bits by default.
23398
23399 @item -malign-300
23400 @opindex malign-300
23401 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
23402 The default for the H8/300H and H8S is to align longs and floats on
23403 4-byte boundaries.
23404 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
23405 This option has no effect on the H8/300.
23406 @end table
23407
23408 @node HPPA Options
23409 @subsection HPPA Options
23410 @cindex HPPA Options
23411
23412 These @samp{-m} options are defined for the HPPA family of computers:
23413
23414 @table @gcctabopt
23415 @item -march=@var{architecture-type}
23416 @opindex march
23417 Generate code for the specified architecture. The choices for
23418 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
23419 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
23420 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
23421 architecture option for your machine. Code compiled for lower numbered
23422 architectures runs on higher numbered architectures, but not the
23423 other way around.
23424
23425 @item -mpa-risc-1-0
23426 @itemx -mpa-risc-1-1
23427 @itemx -mpa-risc-2-0
23428 @opindex mpa-risc-1-0
23429 @opindex mpa-risc-1-1
23430 @opindex mpa-risc-2-0
23431 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
23432
23433 @item -mcaller-copies
23434 @opindex mcaller-copies
23435 The caller copies function arguments passed by hidden reference. This
23436 option should be used with care as it is not compatible with the default
23437 32-bit runtime. However, only aggregates larger than eight bytes are
23438 passed by hidden reference and the option provides better compatibility
23439 with OpenMP.
23440
23441 @item -mjump-in-delay
23442 @opindex mjump-in-delay
23443 This option is ignored and provided for compatibility purposes only.
23444
23445 @item -mdisable-fpregs
23446 @opindex mdisable-fpregs
23447 Prevent floating-point registers from being used in any manner. This is
23448 necessary for compiling kernels that perform lazy context switching of
23449 floating-point registers. If you use this option and attempt to perform
23450 floating-point operations, the compiler aborts.
23451
23452 @item -mdisable-indexing
23453 @opindex mdisable-indexing
23454 Prevent the compiler from using indexing address modes. This avoids some
23455 rather obscure problems when compiling MIG generated code under MACH@.
23456
23457 @item -mno-space-regs
23458 @opindex mno-space-regs
23459 @opindex mspace-regs
23460 Generate code that assumes the target has no space registers. This allows
23461 GCC to generate faster indirect calls and use unscaled index address modes.
23462
23463 Such code is suitable for level 0 PA systems and kernels.
23464
23465 @item -mfast-indirect-calls
23466 @opindex mfast-indirect-calls
23467 Generate code that assumes calls never cross space boundaries. This
23468 allows GCC to emit code that performs faster indirect calls.
23469
23470 This option does not work in the presence of shared libraries or nested
23471 functions.
23472
23473 @item -mfixed-range=@var{register-range}
23474 @opindex mfixed-range
23475 Generate code treating the given register range as fixed registers.
23476 A fixed register is one that the register allocator cannot use. This is
23477 useful when compiling kernel code. A register range is specified as
23478 two registers separated by a dash. Multiple register ranges can be
23479 specified separated by a comma.
23480
23481 @item -mlong-load-store
23482 @opindex mlong-load-store
23483 Generate 3-instruction load and store sequences as sometimes required by
23484 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
23485 the HP compilers.
23486
23487 @item -mportable-runtime
23488 @opindex mportable-runtime
23489 Use the portable calling conventions proposed by HP for ELF systems.
23490
23491 @item -mgas
23492 @opindex mgas
23493 Enable the use of assembler directives only GAS understands.
23494
23495 @item -mschedule=@var{cpu-type}
23496 @opindex mschedule
23497 Schedule code according to the constraints for the machine type
23498 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
23499 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
23500 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
23501 proper scheduling option for your machine. The default scheduling is
23502 @samp{8000}.
23503
23504 @item -mlinker-opt
23505 @opindex mlinker-opt
23506 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
23507 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
23508 linkers in which they give bogus error messages when linking some programs.
23509
23510 @item -msoft-float
23511 @opindex msoft-float
23512 Generate output containing library calls for floating point.
23513 @strong{Warning:} the requisite libraries are not available for all HPPA
23514 targets. Normally the facilities of the machine's usual C compiler are
23515 used, but this cannot be done directly in cross-compilation. You must make
23516 your own arrangements to provide suitable library functions for
23517 cross-compilation.
23518
23519 @option{-msoft-float} changes the calling convention in the output file;
23520 therefore, it is only useful if you compile @emph{all} of a program with
23521 this option. In particular, you need to compile @file{libgcc.a}, the
23522 library that comes with GCC, with @option{-msoft-float} in order for
23523 this to work.
23524
23525 @item -msio
23526 @opindex msio
23527 Generate the predefine, @code{_SIO}, for server IO@. The default is
23528 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
23529 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
23530 options are available under HP-UX and HI-UX@.
23531
23532 @item -mgnu-ld
23533 @opindex mgnu-ld
23534 Use options specific to GNU @command{ld}.
23535 This passes @option{-shared} to @command{ld} when
23536 building a shared library. It is the default when GCC is configured,
23537 explicitly or implicitly, with the GNU linker. This option does not
23538 affect which @command{ld} is called; it only changes what parameters
23539 are passed to that @command{ld}.
23540 The @command{ld} that is called is determined by the
23541 @option{--with-ld} configure option, GCC's program search path, and
23542 finally by the user's @env{PATH}. The linker used by GCC can be printed
23543 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
23544 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23545
23546 @item -mhp-ld
23547 @opindex mhp-ld
23548 Use options specific to HP @command{ld}.
23549 This passes @option{-b} to @command{ld} when building
23550 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
23551 links. It is the default when GCC is configured, explicitly or
23552 implicitly, with the HP linker. This option does not affect
23553 which @command{ld} is called; it only changes what parameters are passed to that
23554 @command{ld}.
23555 The @command{ld} that is called is determined by the @option{--with-ld}
23556 configure option, GCC's program search path, and finally by the user's
23557 @env{PATH}. The linker used by GCC can be printed using @samp{which
23558 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
23559 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23560
23561 @item -mlong-calls
23562 @opindex mno-long-calls
23563 @opindex mlong-calls
23564 Generate code that uses long call sequences. This ensures that a call
23565 is always able to reach linker generated stubs. The default is to generate
23566 long calls only when the distance from the call site to the beginning
23567 of the function or translation unit, as the case may be, exceeds a
23568 predefined limit set by the branch type being used. The limits for
23569 normal calls are 7,600,000 and 240,000 bytes, respectively for the
23570 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
23571 240,000 bytes.
23572
23573 Distances are measured from the beginning of functions when using the
23574 @option{-ffunction-sections} option, or when using the @option{-mgas}
23575 and @option{-mno-portable-runtime} options together under HP-UX with
23576 the SOM linker.
23577
23578 It is normally not desirable to use this option as it degrades
23579 performance. However, it may be useful in large applications,
23580 particularly when partial linking is used to build the application.
23581
23582 The types of long calls used depends on the capabilities of the
23583 assembler and linker, and the type of code being generated. The
23584 impact on systems that support long absolute calls, and long pic
23585 symbol-difference or pc-relative calls should be relatively small.
23586 However, an indirect call is used on 32-bit ELF systems in pic code
23587 and it is quite long.
23588
23589 @item -munix=@var{unix-std}
23590 @opindex march
23591 Generate compiler predefines and select a startfile for the specified
23592 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
23593 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
23594 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
23595 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
23596 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
23597 and later.
23598
23599 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
23600 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
23601 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
23602 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
23603 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
23604 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
23605
23606 It is @emph{important} to note that this option changes the interfaces
23607 for various library routines. It also affects the operational behavior
23608 of the C library. Thus, @emph{extreme} care is needed in using this
23609 option.
23610
23611 Library code that is intended to operate with more than one UNIX
23612 standard must test, set and restore the variable @code{__xpg4_extended_mask}
23613 as appropriate. Most GNU software doesn't provide this capability.
23614
23615 @item -nolibdld
23616 @opindex nolibdld
23617 Suppress the generation of link options to search libdld.sl when the
23618 @option{-static} option is specified on HP-UX 10 and later.
23619
23620 @item -static
23621 @opindex static
23622 The HP-UX implementation of setlocale in libc has a dependency on
23623 libdld.sl. There isn't an archive version of libdld.sl. Thus,
23624 when the @option{-static} option is specified, special link options
23625 are needed to resolve this dependency.
23626
23627 On HP-UX 10 and later, the GCC driver adds the necessary options to
23628 link with libdld.sl when the @option{-static} option is specified.
23629 This causes the resulting binary to be dynamic. On the 64-bit port,
23630 the linkers generate dynamic binaries by default in any case. The
23631 @option{-nolibdld} option can be used to prevent the GCC driver from
23632 adding these link options.
23633
23634 @item -threads
23635 @opindex threads
23636 Add support for multithreading with the @dfn{dce thread} library
23637 under HP-UX@. This option sets flags for both the preprocessor and
23638 linker.
23639 @end table
23640
23641 @node IA-64 Options
23642 @subsection IA-64 Options
23643 @cindex IA-64 Options
23644
23645 These are the @samp{-m} options defined for the Intel IA-64 architecture.
23646
23647 @table @gcctabopt
23648 @item -mbig-endian
23649 @opindex mbig-endian
23650 Generate code for a big-endian target. This is the default for HP-UX@.
23651
23652 @item -mlittle-endian
23653 @opindex mlittle-endian
23654 Generate code for a little-endian target. This is the default for AIX5
23655 and GNU/Linux.
23656
23657 @item -mgnu-as
23658 @itemx -mno-gnu-as
23659 @opindex mgnu-as
23660 @opindex mno-gnu-as
23661 Generate (or don't) code for the GNU assembler. This is the default.
23662 @c Also, this is the default if the configure option @option{--with-gnu-as}
23663 @c is used.
23664
23665 @item -mgnu-ld
23666 @itemx -mno-gnu-ld
23667 @opindex mgnu-ld
23668 @opindex mno-gnu-ld
23669 Generate (or don't) code for the GNU linker. This is the default.
23670 @c Also, this is the default if the configure option @option{--with-gnu-ld}
23671 @c is used.
23672
23673 @item -mno-pic
23674 @opindex mno-pic
23675 Generate code that does not use a global pointer register. The result
23676 is not position independent code, and violates the IA-64 ABI@.
23677
23678 @item -mvolatile-asm-stop
23679 @itemx -mno-volatile-asm-stop
23680 @opindex mvolatile-asm-stop
23681 @opindex mno-volatile-asm-stop
23682 Generate (or don't) a stop bit immediately before and after volatile asm
23683 statements.
23684
23685 @item -mregister-names
23686 @itemx -mno-register-names
23687 @opindex mregister-names
23688 @opindex mno-register-names
23689 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
23690 the stacked registers. This may make assembler output more readable.
23691
23692 @item -mno-sdata
23693 @itemx -msdata
23694 @opindex mno-sdata
23695 @opindex msdata
23696 Disable (or enable) optimizations that use the small data section. This may
23697 be useful for working around optimizer bugs.
23698
23699 @item -mconstant-gp
23700 @opindex mconstant-gp
23701 Generate code that uses a single constant global pointer value. This is
23702 useful when compiling kernel code.
23703
23704 @item -mauto-pic
23705 @opindex mauto-pic
23706 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
23707 This is useful when compiling firmware code.
23708
23709 @item -minline-float-divide-min-latency
23710 @opindex minline-float-divide-min-latency
23711 Generate code for inline divides of floating-point values
23712 using the minimum latency algorithm.
23713
23714 @item -minline-float-divide-max-throughput
23715 @opindex minline-float-divide-max-throughput
23716 Generate code for inline divides of floating-point values
23717 using the maximum throughput algorithm.
23718
23719 @item -mno-inline-float-divide
23720 @opindex mno-inline-float-divide
23721 Do not generate inline code for divides of floating-point values.
23722
23723 @item -minline-int-divide-min-latency
23724 @opindex minline-int-divide-min-latency
23725 Generate code for inline divides of integer values
23726 using the minimum latency algorithm.
23727
23728 @item -minline-int-divide-max-throughput
23729 @opindex minline-int-divide-max-throughput
23730 Generate code for inline divides of integer values
23731 using the maximum throughput algorithm.
23732
23733 @item -mno-inline-int-divide
23734 @opindex mno-inline-int-divide
23735 @opindex minline-int-divide
23736 Do not generate inline code for divides of integer values.
23737
23738 @item -minline-sqrt-min-latency
23739 @opindex minline-sqrt-min-latency
23740 Generate code for inline square roots
23741 using the minimum latency algorithm.
23742
23743 @item -minline-sqrt-max-throughput
23744 @opindex minline-sqrt-max-throughput
23745 Generate code for inline square roots
23746 using the maximum throughput algorithm.
23747
23748 @item -mno-inline-sqrt
23749 @opindex mno-inline-sqrt
23750 Do not generate inline code for @code{sqrt}.
23751
23752 @item -mfused-madd
23753 @itemx -mno-fused-madd
23754 @opindex mfused-madd
23755 @opindex mno-fused-madd
23756 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
23757 instructions. The default is to use these instructions.
23758
23759 @item -mno-dwarf2-asm
23760 @itemx -mdwarf2-asm
23761 @opindex mno-dwarf2-asm
23762 @opindex mdwarf2-asm
23763 Don't (or do) generate assembler code for the DWARF line number debugging
23764 info. This may be useful when not using the GNU assembler.
23765
23766 @item -mearly-stop-bits
23767 @itemx -mno-early-stop-bits
23768 @opindex mearly-stop-bits
23769 @opindex mno-early-stop-bits
23770 Allow stop bits to be placed earlier than immediately preceding the
23771 instruction that triggered the stop bit. This can improve instruction
23772 scheduling, but does not always do so.
23773
23774 @item -mfixed-range=@var{register-range}
23775 @opindex mfixed-range
23776 Generate code treating the given register range as fixed registers.
23777 A fixed register is one that the register allocator cannot use. This is
23778 useful when compiling kernel code. A register range is specified as
23779 two registers separated by a dash. Multiple register ranges can be
23780 specified separated by a comma.
23781
23782 @item -mtls-size=@var{tls-size}
23783 @opindex mtls-size
23784 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
23785 64.
23786
23787 @item -mtune=@var{cpu-type}
23788 @opindex mtune
23789 Tune the instruction scheduling for a particular CPU, Valid values are
23790 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
23791 and @samp{mckinley}.
23792
23793 @item -milp32
23794 @itemx -mlp64
23795 @opindex milp32
23796 @opindex mlp64
23797 Generate code for a 32-bit or 64-bit environment.
23798 The 32-bit environment sets int, long and pointer to 32 bits.
23799 The 64-bit environment sets int to 32 bits and long and pointer
23800 to 64 bits. These are HP-UX specific flags.
23801
23802 @item -mno-sched-br-data-spec
23803 @itemx -msched-br-data-spec
23804 @opindex mno-sched-br-data-spec
23805 @opindex msched-br-data-spec
23806 (Dis/En)able data speculative scheduling before reload.
23807 This results in generation of @code{ld.a} instructions and
23808 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23809 The default setting is disabled.
23810
23811 @item -msched-ar-data-spec
23812 @itemx -mno-sched-ar-data-spec
23813 @opindex msched-ar-data-spec
23814 @opindex mno-sched-ar-data-spec
23815 (En/Dis)able data speculative scheduling after reload.
23816 This results in generation of @code{ld.a} instructions and
23817 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23818 The default setting is enabled.
23819
23820 @item -mno-sched-control-spec
23821 @itemx -msched-control-spec
23822 @opindex mno-sched-control-spec
23823 @opindex msched-control-spec
23824 (Dis/En)able control speculative scheduling. This feature is
23825 available only during region scheduling (i.e.@: before reload).
23826 This results in generation of the @code{ld.s} instructions and
23827 the corresponding check instructions @code{chk.s}.
23828 The default setting is disabled.
23829
23830 @item -msched-br-in-data-spec
23831 @itemx -mno-sched-br-in-data-spec
23832 @opindex msched-br-in-data-spec
23833 @opindex mno-sched-br-in-data-spec
23834 (En/Dis)able speculative scheduling of the instructions that
23835 are dependent on the data speculative loads before reload.
23836 This is effective only with @option{-msched-br-data-spec} enabled.
23837 The default setting is enabled.
23838
23839 @item -msched-ar-in-data-spec
23840 @itemx -mno-sched-ar-in-data-spec
23841 @opindex msched-ar-in-data-spec
23842 @opindex mno-sched-ar-in-data-spec
23843 (En/Dis)able speculative scheduling of the instructions that
23844 are dependent on the data speculative loads after reload.
23845 This is effective only with @option{-msched-ar-data-spec} enabled.
23846 The default setting is enabled.
23847
23848 @item -msched-in-control-spec
23849 @itemx -mno-sched-in-control-spec
23850 @opindex msched-in-control-spec
23851 @opindex mno-sched-in-control-spec
23852 (En/Dis)able speculative scheduling of the instructions that
23853 are dependent on the control speculative loads.
23854 This is effective only with @option{-msched-control-spec} enabled.
23855 The default setting is enabled.
23856
23857 @item -mno-sched-prefer-non-data-spec-insns
23858 @itemx -msched-prefer-non-data-spec-insns
23859 @opindex mno-sched-prefer-non-data-spec-insns
23860 @opindex msched-prefer-non-data-spec-insns
23861 If enabled, data-speculative instructions are chosen for schedule
23862 only if there are no other choices at the moment. This makes
23863 the use of the data speculation much more conservative.
23864 The default setting is disabled.
23865
23866 @item -mno-sched-prefer-non-control-spec-insns
23867 @itemx -msched-prefer-non-control-spec-insns
23868 @opindex mno-sched-prefer-non-control-spec-insns
23869 @opindex msched-prefer-non-control-spec-insns
23870 If enabled, control-speculative instructions are chosen for schedule
23871 only if there are no other choices at the moment. This makes
23872 the use of the control speculation much more conservative.
23873 The default setting is disabled.
23874
23875 @item -mno-sched-count-spec-in-critical-path
23876 @itemx -msched-count-spec-in-critical-path
23877 @opindex mno-sched-count-spec-in-critical-path
23878 @opindex msched-count-spec-in-critical-path
23879 If enabled, speculative dependencies are considered during
23880 computation of the instructions priorities. This makes the use of the
23881 speculation a bit more conservative.
23882 The default setting is disabled.
23883
23884 @item -msched-spec-ldc
23885 @opindex msched-spec-ldc
23886 Use a simple data speculation check. This option is on by default.
23887
23888 @item -msched-control-spec-ldc
23889 @opindex msched-spec-ldc
23890 Use a simple check for control speculation. This option is on by default.
23891
23892 @item -msched-stop-bits-after-every-cycle
23893 @opindex msched-stop-bits-after-every-cycle
23894 Place a stop bit after every cycle when scheduling. This option is on
23895 by default.
23896
23897 @item -msched-fp-mem-deps-zero-cost
23898 @opindex msched-fp-mem-deps-zero-cost
23899 Assume that floating-point stores and loads are not likely to cause a conflict
23900 when placed into the same instruction group. This option is disabled by
23901 default.
23902
23903 @item -msel-sched-dont-check-control-spec
23904 @opindex msel-sched-dont-check-control-spec
23905 Generate checks for control speculation in selective scheduling.
23906 This flag is disabled by default.
23907
23908 @item -msched-max-memory-insns=@var{max-insns}
23909 @opindex msched-max-memory-insns
23910 Limit on the number of memory insns per instruction group, giving lower
23911 priority to subsequent memory insns attempting to schedule in the same
23912 instruction group. Frequently useful to prevent cache bank conflicts.
23913 The default value is 1.
23914
23915 @item -msched-max-memory-insns-hard-limit
23916 @opindex msched-max-memory-insns-hard-limit
23917 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
23918 disallowing more than that number in an instruction group.
23919 Otherwise, the limit is ``soft'', meaning that non-memory operations
23920 are preferred when the limit is reached, but memory operations may still
23921 be scheduled.
23922
23923 @end table
23924
23925 @node LM32 Options
23926 @subsection LM32 Options
23927 @cindex LM32 options
23928
23929 These @option{-m} options are defined for the LatticeMico32 architecture:
23930
23931 @table @gcctabopt
23932 @item -mbarrel-shift-enabled
23933 @opindex mbarrel-shift-enabled
23934 Enable barrel-shift instructions.
23935
23936 @item -mdivide-enabled
23937 @opindex mdivide-enabled
23938 Enable divide and modulus instructions.
23939
23940 @item -mmultiply-enabled
23941 @opindex multiply-enabled
23942 Enable multiply instructions.
23943
23944 @item -msign-extend-enabled
23945 @opindex msign-extend-enabled
23946 Enable sign extend instructions.
23947
23948 @item -muser-enabled
23949 @opindex muser-enabled
23950 Enable user-defined instructions.
23951
23952 @end table
23953
23954 @node M32C Options
23955 @subsection M32C Options
23956 @cindex M32C options
23957
23958 @table @gcctabopt
23959 @item -mcpu=@var{name}
23960 @opindex mcpu=
23961 Select the CPU for which code is generated. @var{name} may be one of
23962 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
23963 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
23964 the M32C/80 series.
23965
23966 @item -msim
23967 @opindex msim
23968 Specifies that the program will be run on the simulator. This causes
23969 an alternate runtime library to be linked in which supports, for
23970 example, file I/O@. You must not use this option when generating
23971 programs that will run on real hardware; you must provide your own
23972 runtime library for whatever I/O functions are needed.
23973
23974 @item -memregs=@var{number}
23975 @opindex memregs=
23976 Specifies the number of memory-based pseudo-registers GCC uses
23977 during code generation. These pseudo-registers are used like real
23978 registers, so there is a tradeoff between GCC's ability to fit the
23979 code into available registers, and the performance penalty of using
23980 memory instead of registers. Note that all modules in a program must
23981 be compiled with the same value for this option. Because of that, you
23982 must not use this option with GCC's default runtime libraries.
23983
23984 @end table
23985
23986 @node M32R/D Options
23987 @subsection M32R/D Options
23988 @cindex M32R/D options
23989
23990 These @option{-m} options are defined for Renesas M32R/D architectures:
23991
23992 @table @gcctabopt
23993 @item -m32r2
23994 @opindex m32r2
23995 Generate code for the M32R/2@.
23996
23997 @item -m32rx
23998 @opindex m32rx
23999 Generate code for the M32R/X@.
24000
24001 @item -m32r
24002 @opindex m32r
24003 Generate code for the M32R@. This is the default.
24004
24005 @item -mmodel=small
24006 @opindex mmodel=small
24007 Assume all objects live in the lower 16MB of memory (so that their addresses
24008 can be loaded with the @code{ld24} instruction), and assume all subroutines
24009 are reachable with the @code{bl} instruction.
24010 This is the default.
24011
24012 The addressability of a particular object can be set with the
24013 @code{model} attribute.
24014
24015 @item -mmodel=medium
24016 @opindex mmodel=medium
24017 Assume objects may be anywhere in the 32-bit address space (the compiler
24018 generates @code{seth/add3} instructions to load their addresses), and
24019 assume all subroutines are reachable with the @code{bl} instruction.
24020
24021 @item -mmodel=large
24022 @opindex mmodel=large
24023 Assume objects may be anywhere in the 32-bit address space (the compiler
24024 generates @code{seth/add3} instructions to load their addresses), and
24025 assume subroutines may not be reachable with the @code{bl} instruction
24026 (the compiler generates the much slower @code{seth/add3/jl}
24027 instruction sequence).
24028
24029 @item -msdata=none
24030 @opindex msdata=none
24031 Disable use of the small data area. Variables are put into
24032 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
24033 @code{section} attribute has been specified).
24034 This is the default.
24035
24036 The small data area consists of sections @code{.sdata} and @code{.sbss}.
24037 Objects may be explicitly put in the small data area with the
24038 @code{section} attribute using one of these sections.
24039
24040 @item -msdata=sdata
24041 @opindex msdata=sdata
24042 Put small global and static data in the small data area, but do not
24043 generate special code to reference them.
24044
24045 @item -msdata=use
24046 @opindex msdata=use
24047 Put small global and static data in the small data area, and generate
24048 special instructions to reference them.
24049
24050 @item -G @var{num}
24051 @opindex G
24052 @cindex smaller data references
24053 Put global and static objects less than or equal to @var{num} bytes
24054 into the small data or BSS sections instead of the normal data or BSS
24055 sections. The default value of @var{num} is 8.
24056 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
24057 for this option to have any effect.
24058
24059 All modules should be compiled with the same @option{-G @var{num}} value.
24060 Compiling with different values of @var{num} may or may not work; if it
24061 doesn't the linker gives an error message---incorrect code is not
24062 generated.
24063
24064 @item -mdebug
24065 @opindex mdebug
24066 Makes the M32R-specific code in the compiler display some statistics
24067 that might help in debugging programs.
24068
24069 @item -malign-loops
24070 @opindex malign-loops
24071 Align all loops to a 32-byte boundary.
24072
24073 @item -mno-align-loops
24074 @opindex mno-align-loops
24075 Do not enforce a 32-byte alignment for loops. This is the default.
24076
24077 @item -missue-rate=@var{number}
24078 @opindex missue-rate=@var{number}
24079 Issue @var{number} instructions per cycle. @var{number} can only be 1
24080 or 2.
24081
24082 @item -mbranch-cost=@var{number}
24083 @opindex mbranch-cost=@var{number}
24084 @var{number} can only be 1 or 2. If it is 1 then branches are
24085 preferred over conditional code, if it is 2, then the opposite applies.
24086
24087 @item -mflush-trap=@var{number}
24088 @opindex mflush-trap=@var{number}
24089 Specifies the trap number to use to flush the cache. The default is
24090 12. Valid numbers are between 0 and 15 inclusive.
24091
24092 @item -mno-flush-trap
24093 @opindex mno-flush-trap
24094 Specifies that the cache cannot be flushed by using a trap.
24095
24096 @item -mflush-func=@var{name}
24097 @opindex mflush-func=@var{name}
24098 Specifies the name of the operating system function to call to flush
24099 the cache. The default is @samp{_flush_cache}, but a function call
24100 is only used if a trap is not available.
24101
24102 @item -mno-flush-func
24103 @opindex mno-flush-func
24104 Indicates that there is no OS function for flushing the cache.
24105
24106 @end table
24107
24108 @node M680x0 Options
24109 @subsection M680x0 Options
24110 @cindex M680x0 options
24111
24112 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
24113 The default settings depend on which architecture was selected when
24114 the compiler was configured; the defaults for the most common choices
24115 are given below.
24116
24117 @table @gcctabopt
24118 @item -march=@var{arch}
24119 @opindex march
24120 Generate code for a specific M680x0 or ColdFire instruction set
24121 architecture. Permissible values of @var{arch} for M680x0
24122 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
24123 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
24124 architectures are selected according to Freescale's ISA classification
24125 and the permissible values are: @samp{isaa}, @samp{isaaplus},
24126 @samp{isab} and @samp{isac}.
24127
24128 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
24129 code for a ColdFire target. The @var{arch} in this macro is one of the
24130 @option{-march} arguments given above.
24131
24132 When used together, @option{-march} and @option{-mtune} select code
24133 that runs on a family of similar processors but that is optimized
24134 for a particular microarchitecture.
24135
24136 @item -mcpu=@var{cpu}
24137 @opindex mcpu
24138 Generate code for a specific M680x0 or ColdFire processor.
24139 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
24140 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
24141 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
24142 below, which also classifies the CPUs into families:
24143
24144 @multitable @columnfractions 0.20 0.80
24145 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
24146 @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}
24147 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
24148 @item @samp{5206e} @tab @samp{5206e}
24149 @item @samp{5208} @tab @samp{5207} @samp{5208}
24150 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
24151 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
24152 @item @samp{5216} @tab @samp{5214} @samp{5216}
24153 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
24154 @item @samp{5225} @tab @samp{5224} @samp{5225}
24155 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
24156 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
24157 @item @samp{5249} @tab @samp{5249}
24158 @item @samp{5250} @tab @samp{5250}
24159 @item @samp{5271} @tab @samp{5270} @samp{5271}
24160 @item @samp{5272} @tab @samp{5272}
24161 @item @samp{5275} @tab @samp{5274} @samp{5275}
24162 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
24163 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
24164 @item @samp{5307} @tab @samp{5307}
24165 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
24166 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
24167 @item @samp{5407} @tab @samp{5407}
24168 @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}
24169 @end multitable
24170
24171 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
24172 @var{arch} is compatible with @var{cpu}. Other combinations of
24173 @option{-mcpu} and @option{-march} are rejected.
24174
24175 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
24176 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
24177 where the value of @var{family} is given by the table above.
24178
24179 @item -mtune=@var{tune}
24180 @opindex mtune
24181 Tune the code for a particular microarchitecture within the
24182 constraints set by @option{-march} and @option{-mcpu}.
24183 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
24184 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
24185 and @samp{cpu32}. The ColdFire microarchitectures
24186 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
24187
24188 You can also use @option{-mtune=68020-40} for code that needs
24189 to run relatively well on 68020, 68030 and 68040 targets.
24190 @option{-mtune=68020-60} is similar but includes 68060 targets
24191 as well. These two options select the same tuning decisions as
24192 @option{-m68020-40} and @option{-m68020-60} respectively.
24193
24194 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
24195 when tuning for 680x0 architecture @var{arch}. It also defines
24196 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
24197 option is used. If GCC is tuning for a range of architectures,
24198 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
24199 it defines the macros for every architecture in the range.
24200
24201 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
24202 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
24203 of the arguments given above.
24204
24205 @item -m68000
24206 @itemx -mc68000
24207 @opindex m68000
24208 @opindex mc68000
24209 Generate output for a 68000. This is the default
24210 when the compiler is configured for 68000-based systems.
24211 It is equivalent to @option{-march=68000}.
24212
24213 Use this option for microcontrollers with a 68000 or EC000 core,
24214 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
24215
24216 @item -m68010
24217 @opindex m68010
24218 Generate output for a 68010. This is the default
24219 when the compiler is configured for 68010-based systems.
24220 It is equivalent to @option{-march=68010}.
24221
24222 @item -m68020
24223 @itemx -mc68020
24224 @opindex m68020
24225 @opindex mc68020
24226 Generate output for a 68020. This is the default
24227 when the compiler is configured for 68020-based systems.
24228 It is equivalent to @option{-march=68020}.
24229
24230 @item -m68030
24231 @opindex m68030
24232 Generate output for a 68030. This is the default when the compiler is
24233 configured for 68030-based systems. It is equivalent to
24234 @option{-march=68030}.
24235
24236 @item -m68040
24237 @opindex m68040
24238 Generate output for a 68040. This is the default when the compiler is
24239 configured for 68040-based systems. It is equivalent to
24240 @option{-march=68040}.
24241
24242 This option inhibits the use of 68881/68882 instructions that have to be
24243 emulated by software on the 68040. Use this option if your 68040 does not
24244 have code to emulate those instructions.
24245
24246 @item -m68060
24247 @opindex m68060
24248 Generate output for a 68060. This is the default when the compiler is
24249 configured for 68060-based systems. It is equivalent to
24250 @option{-march=68060}.
24251
24252 This option inhibits the use of 68020 and 68881/68882 instructions that
24253 have to be emulated by software on the 68060. Use this option if your 68060
24254 does not have code to emulate those instructions.
24255
24256 @item -mcpu32
24257 @opindex mcpu32
24258 Generate output for a CPU32. This is the default
24259 when the compiler is configured for CPU32-based systems.
24260 It is equivalent to @option{-march=cpu32}.
24261
24262 Use this option for microcontrollers with a
24263 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
24264 68336, 68340, 68341, 68349 and 68360.
24265
24266 @item -m5200
24267 @opindex m5200
24268 Generate output for a 520X ColdFire CPU@. This is the default
24269 when the compiler is configured for 520X-based systems.
24270 It is equivalent to @option{-mcpu=5206}, and is now deprecated
24271 in favor of that option.
24272
24273 Use this option for microcontroller with a 5200 core, including
24274 the MCF5202, MCF5203, MCF5204 and MCF5206.
24275
24276 @item -m5206e
24277 @opindex m5206e
24278 Generate output for a 5206e ColdFire CPU@. The option is now
24279 deprecated in favor of the equivalent @option{-mcpu=5206e}.
24280
24281 @item -m528x
24282 @opindex m528x
24283 Generate output for a member of the ColdFire 528X family.
24284 The option is now deprecated in favor of the equivalent
24285 @option{-mcpu=528x}.
24286
24287 @item -m5307
24288 @opindex m5307
24289 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
24290 in favor of the equivalent @option{-mcpu=5307}.
24291
24292 @item -m5407
24293 @opindex m5407
24294 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
24295 in favor of the equivalent @option{-mcpu=5407}.
24296
24297 @item -mcfv4e
24298 @opindex mcfv4e
24299 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
24300 This includes use of hardware floating-point instructions.
24301 The option is equivalent to @option{-mcpu=547x}, and is now
24302 deprecated in favor of that option.
24303
24304 @item -m68020-40
24305 @opindex m68020-40
24306 Generate output for a 68040, without using any of the new instructions.
24307 This results in code that can run relatively efficiently on either a
24308 68020/68881 or a 68030 or a 68040. The generated code does use the
24309 68881 instructions that are emulated on the 68040.
24310
24311 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
24312
24313 @item -m68020-60
24314 @opindex m68020-60
24315 Generate output for a 68060, without using any of the new instructions.
24316 This results in code that can run relatively efficiently on either a
24317 68020/68881 or a 68030 or a 68040. The generated code does use the
24318 68881 instructions that are emulated on the 68060.
24319
24320 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
24321
24322 @item -mhard-float
24323 @itemx -m68881
24324 @opindex mhard-float
24325 @opindex m68881
24326 Generate floating-point instructions. This is the default for 68020
24327 and above, and for ColdFire devices that have an FPU@. It defines the
24328 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
24329 on ColdFire targets.
24330
24331 @item -msoft-float
24332 @opindex msoft-float
24333 Do not generate floating-point instructions; use library calls instead.
24334 This is the default for 68000, 68010, and 68832 targets. It is also
24335 the default for ColdFire devices that have no FPU.
24336
24337 @item -mdiv
24338 @itemx -mno-div
24339 @opindex mdiv
24340 @opindex mno-div
24341 Generate (do not generate) ColdFire hardware divide and remainder
24342 instructions. If @option{-march} is used without @option{-mcpu},
24343 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
24344 architectures. Otherwise, the default is taken from the target CPU
24345 (either the default CPU, or the one specified by @option{-mcpu}). For
24346 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
24347 @option{-mcpu=5206e}.
24348
24349 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
24350
24351 @item -mshort
24352 @opindex mshort
24353 Consider type @code{int} to be 16 bits wide, like @code{short int}.
24354 Additionally, parameters passed on the stack are also aligned to a
24355 16-bit boundary even on targets whose API mandates promotion to 32-bit.
24356
24357 @item -mno-short
24358 @opindex mno-short
24359 Do not consider type @code{int} to be 16 bits wide. This is the default.
24360
24361 @item -mnobitfield
24362 @itemx -mno-bitfield
24363 @opindex mnobitfield
24364 @opindex mno-bitfield
24365 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
24366 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
24367
24368 @item -mbitfield
24369 @opindex mbitfield
24370 Do use the bit-field instructions. The @option{-m68020} option implies
24371 @option{-mbitfield}. This is the default if you use a configuration
24372 designed for a 68020.
24373
24374 @item -mrtd
24375 @opindex mrtd
24376 Use a different function-calling convention, in which functions
24377 that take a fixed number of arguments return with the @code{rtd}
24378 instruction, which pops their arguments while returning. This
24379 saves one instruction in the caller since there is no need to pop
24380 the arguments there.
24381
24382 This calling convention is incompatible with the one normally
24383 used on Unix, so you cannot use it if you need to call libraries
24384 compiled with the Unix compiler.
24385
24386 Also, you must provide function prototypes for all functions that
24387 take variable numbers of arguments (including @code{printf});
24388 otherwise incorrect code is generated for calls to those
24389 functions.
24390
24391 In addition, seriously incorrect code results if you call a
24392 function with too many arguments. (Normally, extra arguments are
24393 harmlessly ignored.)
24394
24395 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
24396 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
24397
24398 The default is @option{-mno-rtd}.
24399
24400 @item -malign-int
24401 @itemx -mno-align-int
24402 @opindex malign-int
24403 @opindex mno-align-int
24404 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
24405 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
24406 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
24407 Aligning variables on 32-bit boundaries produces code that runs somewhat
24408 faster on processors with 32-bit busses at the expense of more memory.
24409
24410 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
24411 aligns structures containing the above types differently than
24412 most published application binary interface specifications for the m68k.
24413
24414 @opindex mpcrel
24415 Use the pc-relative addressing mode of the 68000 directly, instead of
24416 using a global offset table. At present, this option implies @option{-fpic},
24417 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
24418 not presently supported with @option{-mpcrel}, though this could be supported for
24419 68020 and higher processors.
24420
24421 @item -mno-strict-align
24422 @itemx -mstrict-align
24423 @opindex mno-strict-align
24424 @opindex mstrict-align
24425 Do not (do) assume that unaligned memory references are handled by
24426 the system.
24427
24428 @item -msep-data
24429 Generate code that allows the data segment to be located in a different
24430 area of memory from the text segment. This allows for execute-in-place in
24431 an environment without virtual memory management. This option implies
24432 @option{-fPIC}.
24433
24434 @item -mno-sep-data
24435 Generate code that assumes that the data segment follows the text segment.
24436 This is the default.
24437
24438 @item -mid-shared-library
24439 Generate code that supports shared libraries via the library ID method.
24440 This allows for execute-in-place and shared libraries in an environment
24441 without virtual memory management. This option implies @option{-fPIC}.
24442
24443 @item -mno-id-shared-library
24444 Generate code that doesn't assume ID-based shared libraries are being used.
24445 This is the default.
24446
24447 @item -mshared-library-id=n
24448 Specifies the identification number of the ID-based shared library being
24449 compiled. Specifying a value of 0 generates more compact code; specifying
24450 other values forces the allocation of that number to the current
24451 library, but is no more space- or time-efficient than omitting this option.
24452
24453 @item -mxgot
24454 @itemx -mno-xgot
24455 @opindex mxgot
24456 @opindex mno-xgot
24457 When generating position-independent code for ColdFire, generate code
24458 that works if the GOT has more than 8192 entries. This code is
24459 larger and slower than code generated without this option. On M680x0
24460 processors, this option is not needed; @option{-fPIC} suffices.
24461
24462 GCC normally uses a single instruction to load values from the GOT@.
24463 While this is relatively efficient, it only works if the GOT
24464 is smaller than about 64k. Anything larger causes the linker
24465 to report an error such as:
24466
24467 @cindex relocation truncated to fit (ColdFire)
24468 @smallexample
24469 relocation truncated to fit: R_68K_GOT16O foobar
24470 @end smallexample
24471
24472 If this happens, you should recompile your code with @option{-mxgot}.
24473 It should then work with very large GOTs. However, code generated with
24474 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
24475 the value of a global symbol.
24476
24477 Note that some linkers, including newer versions of the GNU linker,
24478 can create multiple GOTs and sort GOT entries. If you have such a linker,
24479 you should only need to use @option{-mxgot} when compiling a single
24480 object file that accesses more than 8192 GOT entries. Very few do.
24481
24482 These options have no effect unless GCC is generating
24483 position-independent code.
24484
24485 @item -mlong-jump-table-offsets
24486 @opindex mlong-jump-table-offsets
24487 Use 32-bit offsets in @code{switch} tables. The default is to use
24488 16-bit offsets.
24489
24490 @end table
24491
24492 @node MCore Options
24493 @subsection MCore Options
24494 @cindex MCore options
24495
24496 These are the @samp{-m} options defined for the Motorola M*Core
24497 processors.
24498
24499 @table @gcctabopt
24500
24501 @item -mhardlit
24502 @itemx -mno-hardlit
24503 @opindex mhardlit
24504 @opindex mno-hardlit
24505 Inline constants into the code stream if it can be done in two
24506 instructions or less.
24507
24508 @item -mdiv
24509 @itemx -mno-div
24510 @opindex mdiv
24511 @opindex mno-div
24512 Use the divide instruction. (Enabled by default).
24513
24514 @item -mrelax-immediate
24515 @itemx -mno-relax-immediate
24516 @opindex mrelax-immediate
24517 @opindex mno-relax-immediate
24518 Allow arbitrary-sized immediates in bit operations.
24519
24520 @item -mwide-bitfields
24521 @itemx -mno-wide-bitfields
24522 @opindex mwide-bitfields
24523 @opindex mno-wide-bitfields
24524 Always treat bit-fields as @code{int}-sized.
24525
24526 @item -m4byte-functions
24527 @itemx -mno-4byte-functions
24528 @opindex m4byte-functions
24529 @opindex mno-4byte-functions
24530 Force all functions to be aligned to a 4-byte boundary.
24531
24532 @item -mcallgraph-data
24533 @itemx -mno-callgraph-data
24534 @opindex mcallgraph-data
24535 @opindex mno-callgraph-data
24536 Emit callgraph information.
24537
24538 @item -mslow-bytes
24539 @itemx -mno-slow-bytes
24540 @opindex mslow-bytes
24541 @opindex mno-slow-bytes
24542 Prefer word access when reading byte quantities.
24543
24544 @item -mlittle-endian
24545 @itemx -mbig-endian
24546 @opindex mlittle-endian
24547 @opindex mbig-endian
24548 Generate code for a little-endian target.
24549
24550 @item -m210
24551 @itemx -m340
24552 @opindex m210
24553 @opindex m340
24554 Generate code for the 210 processor.
24555
24556 @item -mno-lsim
24557 @opindex mno-lsim
24558 Assume that runtime support has been provided and so omit the
24559 simulator library (@file{libsim.a)} from the linker command line.
24560
24561 @item -mstack-increment=@var{size}
24562 @opindex mstack-increment
24563 Set the maximum amount for a single stack increment operation. Large
24564 values can increase the speed of programs that contain functions
24565 that need a large amount of stack space, but they can also trigger a
24566 segmentation fault if the stack is extended too much. The default
24567 value is 0x1000.
24568
24569 @end table
24570
24571 @node MeP Options
24572 @subsection MeP Options
24573 @cindex MeP options
24574
24575 @table @gcctabopt
24576
24577 @item -mabsdiff
24578 @opindex mabsdiff
24579 Enables the @code{abs} instruction, which is the absolute difference
24580 between two registers.
24581
24582 @item -mall-opts
24583 @opindex mall-opts
24584 Enables all the optional instructions---average, multiply, divide, bit
24585 operations, leading zero, absolute difference, min/max, clip, and
24586 saturation.
24587
24588
24589 @item -maverage
24590 @opindex maverage
24591 Enables the @code{ave} instruction, which computes the average of two
24592 registers.
24593
24594 @item -mbased=@var{n}
24595 @opindex mbased=
24596 Variables of size @var{n} bytes or smaller are placed in the
24597 @code{.based} section by default. Based variables use the @code{$tp}
24598 register as a base register, and there is a 128-byte limit to the
24599 @code{.based} section.
24600
24601 @item -mbitops
24602 @opindex mbitops
24603 Enables the bit operation instructions---bit test (@code{btstm}), set
24604 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
24605 test-and-set (@code{tas}).
24606
24607 @item -mc=@var{name}
24608 @opindex mc=
24609 Selects which section constant data is placed in. @var{name} may
24610 be @samp{tiny}, @samp{near}, or @samp{far}.
24611
24612 @item -mclip
24613 @opindex mclip
24614 Enables the @code{clip} instruction. Note that @option{-mclip} is not
24615 useful unless you also provide @option{-mminmax}.
24616
24617 @item -mconfig=@var{name}
24618 @opindex mconfig=
24619 Selects one of the built-in core configurations. Each MeP chip has
24620 one or more modules in it; each module has a core CPU and a variety of
24621 coprocessors, optional instructions, and peripherals. The
24622 @code{MeP-Integrator} tool, not part of GCC, provides these
24623 configurations through this option; using this option is the same as
24624 using all the corresponding command-line options. The default
24625 configuration is @samp{default}.
24626
24627 @item -mcop
24628 @opindex mcop
24629 Enables the coprocessor instructions. By default, this is a 32-bit
24630 coprocessor. Note that the coprocessor is normally enabled via the
24631 @option{-mconfig=} option.
24632
24633 @item -mcop32
24634 @opindex mcop32
24635 Enables the 32-bit coprocessor's instructions.
24636
24637 @item -mcop64
24638 @opindex mcop64
24639 Enables the 64-bit coprocessor's instructions.
24640
24641 @item -mivc2
24642 @opindex mivc2
24643 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
24644
24645 @item -mdc
24646 @opindex mdc
24647 Causes constant variables to be placed in the @code{.near} section.
24648
24649 @item -mdiv
24650 @opindex mdiv
24651 Enables the @code{div} and @code{divu} instructions.
24652
24653 @item -meb
24654 @opindex meb
24655 Generate big-endian code.
24656
24657 @item -mel
24658 @opindex mel
24659 Generate little-endian code.
24660
24661 @item -mio-volatile
24662 @opindex mio-volatile
24663 Tells the compiler that any variable marked with the @code{io}
24664 attribute is to be considered volatile.
24665
24666 @item -ml
24667 @opindex ml
24668 Causes variables to be assigned to the @code{.far} section by default.
24669
24670 @item -mleadz
24671 @opindex mleadz
24672 Enables the @code{leadz} (leading zero) instruction.
24673
24674 @item -mm
24675 @opindex mm
24676 Causes variables to be assigned to the @code{.near} section by default.
24677
24678 @item -mminmax
24679 @opindex mminmax
24680 Enables the @code{min} and @code{max} instructions.
24681
24682 @item -mmult
24683 @opindex mmult
24684 Enables the multiplication and multiply-accumulate instructions.
24685
24686 @item -mno-opts
24687 @opindex mno-opts
24688 Disables all the optional instructions enabled by @option{-mall-opts}.
24689
24690 @item -mrepeat
24691 @opindex mrepeat
24692 Enables the @code{repeat} and @code{erepeat} instructions, used for
24693 low-overhead looping.
24694
24695 @item -ms
24696 @opindex ms
24697 Causes all variables to default to the @code{.tiny} section. Note
24698 that there is a 65536-byte limit to this section. Accesses to these
24699 variables use the @code{%gp} base register.
24700
24701 @item -msatur
24702 @opindex msatur
24703 Enables the saturation instructions. Note that the compiler does not
24704 currently generate these itself, but this option is included for
24705 compatibility with other tools, like @code{as}.
24706
24707 @item -msdram
24708 @opindex msdram
24709 Link the SDRAM-based runtime instead of the default ROM-based runtime.
24710
24711 @item -msim
24712 @opindex msim
24713 Link the simulator run-time libraries.
24714
24715 @item -msimnovec
24716 @opindex msimnovec
24717 Link the simulator runtime libraries, excluding built-in support
24718 for reset and exception vectors and tables.
24719
24720 @item -mtf
24721 @opindex mtf
24722 Causes all functions to default to the @code{.far} section. Without
24723 this option, functions default to the @code{.near} section.
24724
24725 @item -mtiny=@var{n}
24726 @opindex mtiny=
24727 Variables that are @var{n} bytes or smaller are allocated to the
24728 @code{.tiny} section. These variables use the @code{$gp} base
24729 register. The default for this option is 4, but note that there's a
24730 65536-byte limit to the @code{.tiny} section.
24731
24732 @end table
24733
24734 @node MicroBlaze Options
24735 @subsection MicroBlaze Options
24736 @cindex MicroBlaze Options
24737
24738 @table @gcctabopt
24739
24740 @item -msoft-float
24741 @opindex msoft-float
24742 Use software emulation for floating point (default).
24743
24744 @item -mhard-float
24745 @opindex mhard-float
24746 Use hardware floating-point instructions.
24747
24748 @item -mmemcpy
24749 @opindex mmemcpy
24750 Do not optimize block moves, use @code{memcpy}.
24751
24752 @item -mno-clearbss
24753 @opindex mno-clearbss
24754 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
24755
24756 @item -mcpu=@var{cpu-type}
24757 @opindex mcpu=
24758 Use features of, and schedule code for, the given CPU.
24759 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
24760 where @var{X} is a major version, @var{YY} is the minor version, and
24761 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
24762 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
24763
24764 @item -mxl-soft-mul
24765 @opindex mxl-soft-mul
24766 Use software multiply emulation (default).
24767
24768 @item -mxl-soft-div
24769 @opindex mxl-soft-div
24770 Use software emulation for divides (default).
24771
24772 @item -mxl-barrel-shift
24773 @opindex mxl-barrel-shift
24774 Use the hardware barrel shifter.
24775
24776 @item -mxl-pattern-compare
24777 @opindex mxl-pattern-compare
24778 Use pattern compare instructions.
24779
24780 @item -msmall-divides
24781 @opindex msmall-divides
24782 Use table lookup optimization for small signed integer divisions.
24783
24784 @item -mxl-stack-check
24785 @opindex mxl-stack-check
24786 This option is deprecated. Use @option{-fstack-check} instead.
24787
24788 @item -mxl-gp-opt
24789 @opindex mxl-gp-opt
24790 Use GP-relative @code{.sdata}/@code{.sbss} sections.
24791
24792 @item -mxl-multiply-high
24793 @opindex mxl-multiply-high
24794 Use multiply high instructions for high part of 32x32 multiply.
24795
24796 @item -mxl-float-convert
24797 @opindex mxl-float-convert
24798 Use hardware floating-point conversion instructions.
24799
24800 @item -mxl-float-sqrt
24801 @opindex mxl-float-sqrt
24802 Use hardware floating-point square root instruction.
24803
24804 @item -mbig-endian
24805 @opindex mbig-endian
24806 Generate code for a big-endian target.
24807
24808 @item -mlittle-endian
24809 @opindex mlittle-endian
24810 Generate code for a little-endian target.
24811
24812 @item -mxl-reorder
24813 @opindex mxl-reorder
24814 Use reorder instructions (swap and byte reversed load/store).
24815
24816 @item -mxl-mode-@var{app-model}
24817 Select application model @var{app-model}. Valid models are
24818 @table @samp
24819 @item executable
24820 normal executable (default), uses startup code @file{crt0.o}.
24821
24822 @item xmdstub
24823 for use with Xilinx Microprocessor Debugger (XMD) based
24824 software intrusive debug agent called xmdstub. This uses startup file
24825 @file{crt1.o} and sets the start address of the program to 0x800.
24826
24827 @item bootstrap
24828 for applications that are loaded using a bootloader.
24829 This model uses startup file @file{crt2.o} which does not contain a processor
24830 reset vector handler. This is suitable for transferring control on a
24831 processor reset to the bootloader rather than the application.
24832
24833 @item novectors
24834 for applications that do not require any of the
24835 MicroBlaze vectors. This option may be useful for applications running
24836 within a monitoring application. This model uses @file{crt3.o} as a startup file.
24837 @end table
24838
24839 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
24840 @option{-mxl-mode-@var{app-model}}.
24841
24842 @item -mpic-data-is-text-relative
24843 @opindex mpic-data-is-text-relative
24844 Assume that the displacement between the text and data segments is fixed
24845 at static link time. This allows data to be referenced by offset from start of
24846 text address instead of GOT since PC-relative addressing is not supported.
24847
24848 @end table
24849
24850 @node MIPS Options
24851 @subsection MIPS Options
24852 @cindex MIPS options
24853
24854 @table @gcctabopt
24855
24856 @item -EB
24857 @opindex EB
24858 Generate big-endian code.
24859
24860 @item -EL
24861 @opindex EL
24862 Generate little-endian code. This is the default for @samp{mips*el-*-*}
24863 configurations.
24864
24865 @item -march=@var{arch}
24866 @opindex march
24867 Generate code that runs on @var{arch}, which can be the name of a
24868 generic MIPS ISA, or the name of a particular processor.
24869 The ISA names are:
24870 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
24871 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
24872 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
24873 @samp{mips64r5} and @samp{mips64r6}.
24874 The processor names are:
24875 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
24876 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
24877 @samp{5kc}, @samp{5kf},
24878 @samp{20kc},
24879 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
24880 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
24881 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
24882 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
24883 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
24884 @samp{i6400}, @samp{i6500},
24885 @samp{interaptiv},
24886 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
24887 @samp{gs464e}, @samp{gs264e},
24888 @samp{m4k},
24889 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
24890 @samp{m5100}, @samp{m5101},
24891 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
24892 @samp{orion},
24893 @samp{p5600}, @samp{p6600},
24894 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
24895 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
24896 @samp{r6000}, @samp{r8000},
24897 @samp{rm7000}, @samp{rm9000},
24898 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
24899 @samp{sb1},
24900 @samp{sr71000},
24901 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
24902 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
24903 @samp{xlr} and @samp{xlp}.
24904 The special value @samp{from-abi} selects the
24905 most compatible architecture for the selected ABI (that is,
24906 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
24907
24908 The native Linux/GNU toolchain also supports the value @samp{native},
24909 which selects the best architecture option for the host processor.
24910 @option{-march=native} has no effect if GCC does not recognize
24911 the processor.
24912
24913 In processor names, a final @samp{000} can be abbreviated as @samp{k}
24914 (for example, @option{-march=r2k}). Prefixes are optional, and
24915 @samp{vr} may be written @samp{r}.
24916
24917 Names of the form @samp{@var{n}f2_1} refer to processors with
24918 FPUs clocked at half the rate of the core, names of the form
24919 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
24920 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
24921 processors with FPUs clocked a ratio of 3:2 with respect to the core.
24922 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
24923 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
24924 accepted as synonyms for @samp{@var{n}f1_1}.
24925
24926 GCC defines two macros based on the value of this option. The first
24927 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
24928 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
24929 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
24930 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
24931 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
24932
24933 Note that the @code{_MIPS_ARCH} macro uses the processor names given
24934 above. In other words, it has the full prefix and does not
24935 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
24936 the macro names the resolved architecture (either @code{"mips1"} or
24937 @code{"mips3"}). It names the default architecture when no
24938 @option{-march} option is given.
24939
24940 @item -mtune=@var{arch}
24941 @opindex mtune
24942 Optimize for @var{arch}. Among other things, this option controls
24943 the way instructions are scheduled, and the perceived cost of arithmetic
24944 operations. The list of @var{arch} values is the same as for
24945 @option{-march}.
24946
24947 When this option is not used, GCC optimizes for the processor
24948 specified by @option{-march}. By using @option{-march} and
24949 @option{-mtune} together, it is possible to generate code that
24950 runs on a family of processors, but optimize the code for one
24951 particular member of that family.
24952
24953 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
24954 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
24955 @option{-march} ones described above.
24956
24957 @item -mips1
24958 @opindex mips1
24959 Equivalent to @option{-march=mips1}.
24960
24961 @item -mips2
24962 @opindex mips2
24963 Equivalent to @option{-march=mips2}.
24964
24965 @item -mips3
24966 @opindex mips3
24967 Equivalent to @option{-march=mips3}.
24968
24969 @item -mips4
24970 @opindex mips4
24971 Equivalent to @option{-march=mips4}.
24972
24973 @item -mips32
24974 @opindex mips32
24975 Equivalent to @option{-march=mips32}.
24976
24977 @item -mips32r3
24978 @opindex mips32r3
24979 Equivalent to @option{-march=mips32r3}.
24980
24981 @item -mips32r5
24982 @opindex mips32r5
24983 Equivalent to @option{-march=mips32r5}.
24984
24985 @item -mips32r6
24986 @opindex mips32r6
24987 Equivalent to @option{-march=mips32r6}.
24988
24989 @item -mips64
24990 @opindex mips64
24991 Equivalent to @option{-march=mips64}.
24992
24993 @item -mips64r2
24994 @opindex mips64r2
24995 Equivalent to @option{-march=mips64r2}.
24996
24997 @item -mips64r3
24998 @opindex mips64r3
24999 Equivalent to @option{-march=mips64r3}.
25000
25001 @item -mips64r5
25002 @opindex mips64r5
25003 Equivalent to @option{-march=mips64r5}.
25004
25005 @item -mips64r6
25006 @opindex mips64r6
25007 Equivalent to @option{-march=mips64r6}.
25008
25009 @item -mips16
25010 @itemx -mno-mips16
25011 @opindex mips16
25012 @opindex mno-mips16
25013 Generate (do not generate) MIPS16 code. If GCC is targeting a
25014 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
25015
25016 MIPS16 code generation can also be controlled on a per-function basis
25017 by means of @code{mips16} and @code{nomips16} attributes.
25018 @xref{Function Attributes}, for more information.
25019
25020 @item -mflip-mips16
25021 @opindex mflip-mips16
25022 Generate MIPS16 code on alternating functions. This option is provided
25023 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
25024 not intended for ordinary use in compiling user code.
25025
25026 @item -minterlink-compressed
25027 @itemx -mno-interlink-compressed
25028 @opindex minterlink-compressed
25029 @opindex mno-interlink-compressed
25030 Require (do not require) that code using the standard (uncompressed) MIPS ISA
25031 be link-compatible with MIPS16 and microMIPS code, and vice versa.
25032
25033 For example, code using the standard ISA encoding cannot jump directly
25034 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
25035 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
25036 knows that the target of the jump is not compressed.
25037
25038 @item -minterlink-mips16
25039 @itemx -mno-interlink-mips16
25040 @opindex minterlink-mips16
25041 @opindex mno-interlink-mips16
25042 Aliases of @option{-minterlink-compressed} and
25043 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
25044 and are retained for backwards compatibility.
25045
25046 @item -mabi=32
25047 @itemx -mabi=o64
25048 @itemx -mabi=n32
25049 @itemx -mabi=64
25050 @itemx -mabi=eabi
25051 @opindex mabi=32
25052 @opindex mabi=o64
25053 @opindex mabi=n32
25054 @opindex mabi=64
25055 @opindex mabi=eabi
25056 Generate code for the given ABI@.
25057
25058 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
25059 generates 64-bit code when you select a 64-bit architecture, but you
25060 can use @option{-mgp32} to get 32-bit code instead.
25061
25062 For information about the O64 ABI, see
25063 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
25064
25065 GCC supports a variant of the o32 ABI in which floating-point registers
25066 are 64 rather than 32 bits wide. You can select this combination with
25067 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
25068 and @code{mfhc1} instructions and is therefore only supported for
25069 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
25070
25071 The register assignments for arguments and return values remain the
25072 same, but each scalar value is passed in a single 64-bit register
25073 rather than a pair of 32-bit registers. For example, scalar
25074 floating-point values are returned in @samp{$f0} only, not a
25075 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
25076 remains the same in that the even-numbered double-precision registers
25077 are saved.
25078
25079 Two additional variants of the o32 ABI are supported to enable
25080 a transition from 32-bit to 64-bit registers. These are FPXX
25081 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
25082 The FPXX extension mandates that all code must execute correctly
25083 when run using 32-bit or 64-bit registers. The code can be interlinked
25084 with either FP32 or FP64, but not both.
25085 The FP64A extension is similar to the FP64 extension but forbids the
25086 use of odd-numbered single-precision registers. This can be used
25087 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
25088 processors and allows both FP32 and FP64A code to interlink and
25089 run in the same process without changing FPU modes.
25090
25091 @item -mabicalls
25092 @itemx -mno-abicalls
25093 @opindex mabicalls
25094 @opindex mno-abicalls
25095 Generate (do not generate) code that is suitable for SVR4-style
25096 dynamic objects. @option{-mabicalls} is the default for SVR4-based
25097 systems.
25098
25099 @item -mshared
25100 @itemx -mno-shared
25101 Generate (do not generate) code that is fully position-independent,
25102 and that can therefore be linked into shared libraries. This option
25103 only affects @option{-mabicalls}.
25104
25105 All @option{-mabicalls} code has traditionally been position-independent,
25106 regardless of options like @option{-fPIC} and @option{-fpic}. However,
25107 as an extension, the GNU toolchain allows executables to use absolute
25108 accesses for locally-binding symbols. It can also use shorter GP
25109 initialization sequences and generate direct calls to locally-defined
25110 functions. This mode is selected by @option{-mno-shared}.
25111
25112 @option{-mno-shared} depends on binutils 2.16 or higher and generates
25113 objects that can only be linked by the GNU linker. However, the option
25114 does not affect the ABI of the final executable; it only affects the ABI
25115 of relocatable objects. Using @option{-mno-shared} generally makes
25116 executables both smaller and quicker.
25117
25118 @option{-mshared} is the default.
25119
25120 @item -mplt
25121 @itemx -mno-plt
25122 @opindex mplt
25123 @opindex mno-plt
25124 Assume (do not assume) that the static and dynamic linkers
25125 support PLTs and copy relocations. This option only affects
25126 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
25127 has no effect without @option{-msym32}.
25128
25129 You can make @option{-mplt} the default by configuring
25130 GCC with @option{--with-mips-plt}. The default is
25131 @option{-mno-plt} otherwise.
25132
25133 @item -mxgot
25134 @itemx -mno-xgot
25135 @opindex mxgot
25136 @opindex mno-xgot
25137 Lift (do not lift) the usual restrictions on the size of the global
25138 offset table.
25139
25140 GCC normally uses a single instruction to load values from the GOT@.
25141 While this is relatively efficient, it only works if the GOT
25142 is smaller than about 64k. Anything larger causes the linker
25143 to report an error such as:
25144
25145 @cindex relocation truncated to fit (MIPS)
25146 @smallexample
25147 relocation truncated to fit: R_MIPS_GOT16 foobar
25148 @end smallexample
25149
25150 If this happens, you should recompile your code with @option{-mxgot}.
25151 This works with very large GOTs, although the code is also
25152 less efficient, since it takes three instructions to fetch the
25153 value of a global symbol.
25154
25155 Note that some linkers can create multiple GOTs. If you have such a
25156 linker, you should only need to use @option{-mxgot} when a single object
25157 file accesses more than 64k's worth of GOT entries. Very few do.
25158
25159 These options have no effect unless GCC is generating position
25160 independent code.
25161
25162 @item -mgp32
25163 @opindex mgp32
25164 Assume that general-purpose registers are 32 bits wide.
25165
25166 @item -mgp64
25167 @opindex mgp64
25168 Assume that general-purpose registers are 64 bits wide.
25169
25170 @item -mfp32
25171 @opindex mfp32
25172 Assume that floating-point registers are 32 bits wide.
25173
25174 @item -mfp64
25175 @opindex mfp64
25176 Assume that floating-point registers are 64 bits wide.
25177
25178 @item -mfpxx
25179 @opindex mfpxx
25180 Do not assume the width of floating-point registers.
25181
25182 @item -mhard-float
25183 @opindex mhard-float
25184 Use floating-point coprocessor instructions.
25185
25186 @item -msoft-float
25187 @opindex msoft-float
25188 Do not use floating-point coprocessor instructions. Implement
25189 floating-point calculations using library calls instead.
25190
25191 @item -mno-float
25192 @opindex mno-float
25193 Equivalent to @option{-msoft-float}, but additionally asserts that the
25194 program being compiled does not perform any floating-point operations.
25195 This option is presently supported only by some bare-metal MIPS
25196 configurations, where it may select a special set of libraries
25197 that lack all floating-point support (including, for example, the
25198 floating-point @code{printf} formats).
25199 If code compiled with @option{-mno-float} accidentally contains
25200 floating-point operations, it is likely to suffer a link-time
25201 or run-time failure.
25202
25203 @item -msingle-float
25204 @opindex msingle-float
25205 Assume that the floating-point coprocessor only supports single-precision
25206 operations.
25207
25208 @item -mdouble-float
25209 @opindex mdouble-float
25210 Assume that the floating-point coprocessor supports double-precision
25211 operations. This is the default.
25212
25213 @item -modd-spreg
25214 @itemx -mno-odd-spreg
25215 @opindex modd-spreg
25216 @opindex mno-odd-spreg
25217 Enable the use of odd-numbered single-precision floating-point registers
25218 for the o32 ABI. This is the default for processors that are known to
25219 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
25220 is set by default.
25221
25222 @item -mabs=2008
25223 @itemx -mabs=legacy
25224 @opindex mabs=2008
25225 @opindex mabs=legacy
25226 These options control the treatment of the special not-a-number (NaN)
25227 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
25228 @code{neg.@i{fmt}} machine instructions.
25229
25230 By default or when @option{-mabs=legacy} is used the legacy
25231 treatment is selected. In this case these instructions are considered
25232 arithmetic and avoided where correct operation is required and the
25233 input operand might be a NaN. A longer sequence of instructions that
25234 manipulate the sign bit of floating-point datum manually is used
25235 instead unless the @option{-ffinite-math-only} option has also been
25236 specified.
25237
25238 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
25239 this case these instructions are considered non-arithmetic and therefore
25240 operating correctly in all cases, including in particular where the
25241 input operand is a NaN. These instructions are therefore always used
25242 for the respective operations.
25243
25244 @item -mnan=2008
25245 @itemx -mnan=legacy
25246 @opindex mnan=2008
25247 @opindex mnan=legacy
25248 These options control the encoding of the special not-a-number (NaN)
25249 IEEE 754 floating-point data.
25250
25251 The @option{-mnan=legacy} option selects the legacy encoding. In this
25252 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
25253 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
25254 by the first bit of their trailing significand field being 1.
25255
25256 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
25257 this case qNaNs are denoted by the first bit of their trailing
25258 significand field being 1, whereas sNaNs are denoted by the first bit of
25259 their trailing significand field being 0.
25260
25261 The default is @option{-mnan=legacy} unless GCC has been configured with
25262 @option{--with-nan=2008}.
25263
25264 @item -mllsc
25265 @itemx -mno-llsc
25266 @opindex mllsc
25267 @opindex mno-llsc
25268 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
25269 implement atomic memory built-in functions. When neither option is
25270 specified, GCC uses the instructions if the target architecture
25271 supports them.
25272
25273 @option{-mllsc} is useful if the runtime environment can emulate the
25274 instructions and @option{-mno-llsc} can be useful when compiling for
25275 nonstandard ISAs. You can make either option the default by
25276 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
25277 respectively. @option{--with-llsc} is the default for some
25278 configurations; see the installation documentation for details.
25279
25280 @item -mdsp
25281 @itemx -mno-dsp
25282 @opindex mdsp
25283 @opindex mno-dsp
25284 Use (do not use) revision 1 of the MIPS DSP ASE@.
25285 @xref{MIPS DSP Built-in Functions}. This option defines the
25286 preprocessor macro @code{__mips_dsp}. It also defines
25287 @code{__mips_dsp_rev} to 1.
25288
25289 @item -mdspr2
25290 @itemx -mno-dspr2
25291 @opindex mdspr2
25292 @opindex mno-dspr2
25293 Use (do not use) revision 2 of the MIPS DSP ASE@.
25294 @xref{MIPS DSP Built-in Functions}. This option defines the
25295 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
25296 It also defines @code{__mips_dsp_rev} to 2.
25297
25298 @item -msmartmips
25299 @itemx -mno-smartmips
25300 @opindex msmartmips
25301 @opindex mno-smartmips
25302 Use (do not use) the MIPS SmartMIPS ASE.
25303
25304 @item -mpaired-single
25305 @itemx -mno-paired-single
25306 @opindex mpaired-single
25307 @opindex mno-paired-single
25308 Use (do not use) paired-single floating-point instructions.
25309 @xref{MIPS Paired-Single Support}. This option requires
25310 hardware floating-point support to be enabled.
25311
25312 @item -mdmx
25313 @itemx -mno-mdmx
25314 @opindex mdmx
25315 @opindex mno-mdmx
25316 Use (do not use) MIPS Digital Media Extension instructions.
25317 This option can only be used when generating 64-bit code and requires
25318 hardware floating-point support to be enabled.
25319
25320 @item -mips3d
25321 @itemx -mno-mips3d
25322 @opindex mips3d
25323 @opindex mno-mips3d
25324 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
25325 The option @option{-mips3d} implies @option{-mpaired-single}.
25326
25327 @item -mmicromips
25328 @itemx -mno-micromips
25329 @opindex mmicromips
25330 @opindex mno-mmicromips
25331 Generate (do not generate) microMIPS code.
25332
25333 MicroMIPS code generation can also be controlled on a per-function basis
25334 by means of @code{micromips} and @code{nomicromips} attributes.
25335 @xref{Function Attributes}, for more information.
25336
25337 @item -mmt
25338 @itemx -mno-mt
25339 @opindex mmt
25340 @opindex mno-mt
25341 Use (do not use) MT Multithreading instructions.
25342
25343 @item -mmcu
25344 @itemx -mno-mcu
25345 @opindex mmcu
25346 @opindex mno-mcu
25347 Use (do not use) the MIPS MCU ASE instructions.
25348
25349 @item -meva
25350 @itemx -mno-eva
25351 @opindex meva
25352 @opindex mno-eva
25353 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
25354
25355 @item -mvirt
25356 @itemx -mno-virt
25357 @opindex mvirt
25358 @opindex mno-virt
25359 Use (do not use) the MIPS Virtualization (VZ) instructions.
25360
25361 @item -mxpa
25362 @itemx -mno-xpa
25363 @opindex mxpa
25364 @opindex mno-xpa
25365 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
25366
25367 @item -mcrc
25368 @itemx -mno-crc
25369 @opindex mcrc
25370 @opindex mno-crc
25371 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
25372
25373 @item -mginv
25374 @itemx -mno-ginv
25375 @opindex mginv
25376 @opindex mno-ginv
25377 Use (do not use) the MIPS Global INValidate (GINV) instructions.
25378
25379 @item -mloongson-mmi
25380 @itemx -mno-loongson-mmi
25381 @opindex mloongson-mmi
25382 @opindex mno-loongson-mmi
25383 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
25384
25385 @item -mloongson-ext
25386 @itemx -mno-loongson-ext
25387 @opindex mloongson-ext
25388 @opindex mno-loongson-ext
25389 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
25390
25391 @item -mloongson-ext2
25392 @itemx -mno-loongson-ext2
25393 @opindex mloongson-ext2
25394 @opindex mno-loongson-ext2
25395 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
25396
25397 @item -mlong64
25398 @opindex mlong64
25399 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
25400 an explanation of the default and the way that the pointer size is
25401 determined.
25402
25403 @item -mlong32
25404 @opindex mlong32
25405 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
25406
25407 The default size of @code{int}s, @code{long}s and pointers depends on
25408 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
25409 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
25410 32-bit @code{long}s. Pointers are the same size as @code{long}s,
25411 or the same size as integer registers, whichever is smaller.
25412
25413 @item -msym32
25414 @itemx -mno-sym32
25415 @opindex msym32
25416 @opindex mno-sym32
25417 Assume (do not assume) that all symbols have 32-bit values, regardless
25418 of the selected ABI@. This option is useful in combination with
25419 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
25420 to generate shorter and faster references to symbolic addresses.
25421
25422 @item -G @var{num}
25423 @opindex G
25424 Put definitions of externally-visible data in a small data section
25425 if that data is no bigger than @var{num} bytes. GCC can then generate
25426 more efficient accesses to the data; see @option{-mgpopt} for details.
25427
25428 The default @option{-G} option depends on the configuration.
25429
25430 @item -mlocal-sdata
25431 @itemx -mno-local-sdata
25432 @opindex mlocal-sdata
25433 @opindex mno-local-sdata
25434 Extend (do not extend) the @option{-G} behavior to local data too,
25435 such as to static variables in C@. @option{-mlocal-sdata} is the
25436 default for all configurations.
25437
25438 If the linker complains that an application is using too much small data,
25439 you might want to try rebuilding the less performance-critical parts with
25440 @option{-mno-local-sdata}. You might also want to build large
25441 libraries with @option{-mno-local-sdata}, so that the libraries leave
25442 more room for the main program.
25443
25444 @item -mextern-sdata
25445 @itemx -mno-extern-sdata
25446 @opindex mextern-sdata
25447 @opindex mno-extern-sdata
25448 Assume (do not assume) that externally-defined data is in
25449 a small data section if the size of that data is within the @option{-G} limit.
25450 @option{-mextern-sdata} is the default for all configurations.
25451
25452 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
25453 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
25454 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
25455 is placed in a small data section. If @var{Var} is defined by another
25456 module, you must either compile that module with a high-enough
25457 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
25458 definition. If @var{Var} is common, you must link the application
25459 with a high-enough @option{-G} setting.
25460
25461 The easiest way of satisfying these restrictions is to compile
25462 and link every module with the same @option{-G} option. However,
25463 you may wish to build a library that supports several different
25464 small data limits. You can do this by compiling the library with
25465 the highest supported @option{-G} setting and additionally using
25466 @option{-mno-extern-sdata} to stop the library from making assumptions
25467 about externally-defined data.
25468
25469 @item -mgpopt
25470 @itemx -mno-gpopt
25471 @opindex mgpopt
25472 @opindex mno-gpopt
25473 Use (do not use) GP-relative accesses for symbols that are known to be
25474 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
25475 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
25476 configurations.
25477
25478 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
25479 might not hold the value of @code{_gp}. For example, if the code is
25480 part of a library that might be used in a boot monitor, programs that
25481 call boot monitor routines pass an unknown value in @code{$gp}.
25482 (In such situations, the boot monitor itself is usually compiled
25483 with @option{-G0}.)
25484
25485 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
25486 @option{-mno-extern-sdata}.
25487
25488 @item -membedded-data
25489 @itemx -mno-embedded-data
25490 @opindex membedded-data
25491 @opindex mno-embedded-data
25492 Allocate variables to the read-only data section first if possible, then
25493 next in the small data section if possible, otherwise in data. This gives
25494 slightly slower code than the default, but reduces the amount of RAM required
25495 when executing, and thus may be preferred for some embedded systems.
25496
25497 @item -muninit-const-in-rodata
25498 @itemx -mno-uninit-const-in-rodata
25499 @opindex muninit-const-in-rodata
25500 @opindex mno-uninit-const-in-rodata
25501 Put uninitialized @code{const} variables in the read-only data section.
25502 This option is only meaningful in conjunction with @option{-membedded-data}.
25503
25504 @item -mcode-readable=@var{setting}
25505 @opindex mcode-readable
25506 Specify whether GCC may generate code that reads from executable sections.
25507 There are three possible settings:
25508
25509 @table @gcctabopt
25510 @item -mcode-readable=yes
25511 Instructions may freely access executable sections. This is the
25512 default setting.
25513
25514 @item -mcode-readable=pcrel
25515 MIPS16 PC-relative load instructions can access executable sections,
25516 but other instructions must not do so. This option is useful on 4KSc
25517 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
25518 It is also useful on processors that can be configured to have a dual
25519 instruction/data SRAM interface and that, like the M4K, automatically
25520 redirect PC-relative loads to the instruction RAM.
25521
25522 @item -mcode-readable=no
25523 Instructions must not access executable sections. This option can be
25524 useful on targets that are configured to have a dual instruction/data
25525 SRAM interface but that (unlike the M4K) do not automatically redirect
25526 PC-relative loads to the instruction RAM.
25527 @end table
25528
25529 @item -msplit-addresses
25530 @itemx -mno-split-addresses
25531 @opindex msplit-addresses
25532 @opindex mno-split-addresses
25533 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
25534 relocation operators. This option has been superseded by
25535 @option{-mexplicit-relocs} but is retained for backwards compatibility.
25536
25537 @item -mexplicit-relocs
25538 @itemx -mno-explicit-relocs
25539 @opindex mexplicit-relocs
25540 @opindex mno-explicit-relocs
25541 Use (do not use) assembler relocation operators when dealing with symbolic
25542 addresses. The alternative, selected by @option{-mno-explicit-relocs},
25543 is to use assembler macros instead.
25544
25545 @option{-mexplicit-relocs} is the default if GCC was configured
25546 to use an assembler that supports relocation operators.
25547
25548 @item -mcheck-zero-division
25549 @itemx -mno-check-zero-division
25550 @opindex mcheck-zero-division
25551 @opindex mno-check-zero-division
25552 Trap (do not trap) on integer division by zero.
25553
25554 The default is @option{-mcheck-zero-division}.
25555
25556 @item -mdivide-traps
25557 @itemx -mdivide-breaks
25558 @opindex mdivide-traps
25559 @opindex mdivide-breaks
25560 MIPS systems check for division by zero by generating either a
25561 conditional trap or a break instruction. Using traps results in
25562 smaller code, but is only supported on MIPS II and later. Also, some
25563 versions of the Linux kernel have a bug that prevents trap from
25564 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
25565 allow conditional traps on architectures that support them and
25566 @option{-mdivide-breaks} to force the use of breaks.
25567
25568 The default is usually @option{-mdivide-traps}, but this can be
25569 overridden at configure time using @option{--with-divide=breaks}.
25570 Divide-by-zero checks can be completely disabled using
25571 @option{-mno-check-zero-division}.
25572
25573 @item -mload-store-pairs
25574 @itemx -mno-load-store-pairs
25575 @opindex mload-store-pairs
25576 @opindex mno-load-store-pairs
25577 Enable (disable) an optimization that pairs consecutive load or store
25578 instructions to enable load/store bonding. This option is enabled by
25579 default but only takes effect when the selected architecture is known
25580 to support bonding.
25581
25582 @item -mmemcpy
25583 @itemx -mno-memcpy
25584 @opindex mmemcpy
25585 @opindex mno-memcpy
25586 Force (do not force) the use of @code{memcpy} for non-trivial block
25587 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
25588 most constant-sized copies.
25589
25590 @item -mlong-calls
25591 @itemx -mno-long-calls
25592 @opindex mlong-calls
25593 @opindex mno-long-calls
25594 Disable (do not disable) use of the @code{jal} instruction. Calling
25595 functions using @code{jal} is more efficient but requires the caller
25596 and callee to be in the same 256 megabyte segment.
25597
25598 This option has no effect on abicalls code. The default is
25599 @option{-mno-long-calls}.
25600
25601 @item -mmad
25602 @itemx -mno-mad
25603 @opindex mmad
25604 @opindex mno-mad
25605 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
25606 instructions, as provided by the R4650 ISA@.
25607
25608 @item -mimadd
25609 @itemx -mno-imadd
25610 @opindex mimadd
25611 @opindex mno-imadd
25612 Enable (disable) use of the @code{madd} and @code{msub} integer
25613 instructions. The default is @option{-mimadd} on architectures
25614 that support @code{madd} and @code{msub} except for the 74k
25615 architecture where it was found to generate slower code.
25616
25617 @item -mfused-madd
25618 @itemx -mno-fused-madd
25619 @opindex mfused-madd
25620 @opindex mno-fused-madd
25621 Enable (disable) use of the floating-point multiply-accumulate
25622 instructions, when they are available. The default is
25623 @option{-mfused-madd}.
25624
25625 On the R8000 CPU when multiply-accumulate instructions are used,
25626 the intermediate product is calculated to infinite precision
25627 and is not subject to the FCSR Flush to Zero bit. This may be
25628 undesirable in some circumstances. On other processors the result
25629 is numerically identical to the equivalent computation using
25630 separate multiply, add, subtract and negate instructions.
25631
25632 @item -nocpp
25633 @opindex nocpp
25634 Tell the MIPS assembler to not run its preprocessor over user
25635 assembler files (with a @samp{.s} suffix) when assembling them.
25636
25637 @item -mfix-24k
25638 @itemx -mno-fix-24k
25639 @opindex mfix-24k
25640 @opindex mno-fix-24k
25641 Work around the 24K E48 (lost data on stores during refill) errata.
25642 The workarounds are implemented by the assembler rather than by GCC@.
25643
25644 @item -mfix-r4000
25645 @itemx -mno-fix-r4000
25646 @opindex mfix-r4000
25647 @opindex mno-fix-r4000
25648 Work around certain R4000 CPU errata:
25649 @itemize @minus
25650 @item
25651 A double-word or a variable shift may give an incorrect result if executed
25652 immediately after starting an integer division.
25653 @item
25654 A double-word or a variable shift may give an incorrect result if executed
25655 while an integer multiplication is in progress.
25656 @item
25657 An integer division may give an incorrect result if started in a delay slot
25658 of a taken branch or a jump.
25659 @end itemize
25660
25661 @item -mfix-r4400
25662 @itemx -mno-fix-r4400
25663 @opindex mfix-r4400
25664 @opindex mno-fix-r4400
25665 Work around certain R4400 CPU errata:
25666 @itemize @minus
25667 @item
25668 A double-word or a variable shift may give an incorrect result if executed
25669 immediately after starting an integer division.
25670 @end itemize
25671
25672 @item -mfix-r10000
25673 @itemx -mno-fix-r10000
25674 @opindex mfix-r10000
25675 @opindex mno-fix-r10000
25676 Work around certain R10000 errata:
25677 @itemize @minus
25678 @item
25679 @code{ll}/@code{sc} sequences may not behave atomically on revisions
25680 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
25681 @end itemize
25682
25683 This option can only be used if the target architecture supports
25684 branch-likely instructions. @option{-mfix-r10000} is the default when
25685 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
25686 otherwise.
25687
25688 @item -mfix-r5900
25689 @itemx -mno-fix-r5900
25690 @opindex mfix-r5900
25691 Do not attempt to schedule the preceding instruction into the delay slot
25692 of a branch instruction placed at the end of a short loop of six
25693 instructions or fewer and always schedule a @code{nop} instruction there
25694 instead. The short loop bug under certain conditions causes loops to
25695 execute only once or twice, due to a hardware bug in the R5900 chip. The
25696 workaround is implemented by the assembler rather than by GCC@.
25697
25698 @item -mfix-rm7000
25699 @itemx -mno-fix-rm7000
25700 @opindex mfix-rm7000
25701 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
25702 workarounds are implemented by the assembler rather than by GCC@.
25703
25704 @item -mfix-vr4120
25705 @itemx -mno-fix-vr4120
25706 @opindex mfix-vr4120
25707 Work around certain VR4120 errata:
25708 @itemize @minus
25709 @item
25710 @code{dmultu} does not always produce the correct result.
25711 @item
25712 @code{div} and @code{ddiv} do not always produce the correct result if one
25713 of the operands is negative.
25714 @end itemize
25715 The workarounds for the division errata rely on special functions in
25716 @file{libgcc.a}. At present, these functions are only provided by
25717 the @code{mips64vr*-elf} configurations.
25718
25719 Other VR4120 errata require a NOP to be inserted between certain pairs of
25720 instructions. These errata are handled by the assembler, not by GCC itself.
25721
25722 @item -mfix-vr4130
25723 @opindex mfix-vr4130
25724 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
25725 workarounds are implemented by the assembler rather than by GCC,
25726 although GCC avoids using @code{mflo} and @code{mfhi} if the
25727 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
25728 instructions are available instead.
25729
25730 @item -mfix-sb1
25731 @itemx -mno-fix-sb1
25732 @opindex mfix-sb1
25733 Work around certain SB-1 CPU core errata.
25734 (This flag currently works around the SB-1 revision 2
25735 ``F1'' and ``F2'' floating-point errata.)
25736
25737 @item -mr10k-cache-barrier=@var{setting}
25738 @opindex mr10k-cache-barrier
25739 Specify whether GCC should insert cache barriers to avoid the
25740 side effects of speculation on R10K processors.
25741
25742 In common with many processors, the R10K tries to predict the outcome
25743 of a conditional branch and speculatively executes instructions from
25744 the ``taken'' branch. It later aborts these instructions if the
25745 predicted outcome is wrong. However, on the R10K, even aborted
25746 instructions can have side effects.
25747
25748 This problem only affects kernel stores and, depending on the system,
25749 kernel loads. As an example, a speculatively-executed store may load
25750 the target memory into cache and mark the cache line as dirty, even if
25751 the store itself is later aborted. If a DMA operation writes to the
25752 same area of memory before the ``dirty'' line is flushed, the cached
25753 data overwrites the DMA-ed data. See the R10K processor manual
25754 for a full description, including other potential problems.
25755
25756 One workaround is to insert cache barrier instructions before every memory
25757 access that might be speculatively executed and that might have side
25758 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
25759 controls GCC's implementation of this workaround. It assumes that
25760 aborted accesses to any byte in the following regions does not have
25761 side effects:
25762
25763 @enumerate
25764 @item
25765 the memory occupied by the current function's stack frame;
25766
25767 @item
25768 the memory occupied by an incoming stack argument;
25769
25770 @item
25771 the memory occupied by an object with a link-time-constant address.
25772 @end enumerate
25773
25774 It is the kernel's responsibility to ensure that speculative
25775 accesses to these regions are indeed safe.
25776
25777 If the input program contains a function declaration such as:
25778
25779 @smallexample
25780 void foo (void);
25781 @end smallexample
25782
25783 then the implementation of @code{foo} must allow @code{j foo} and
25784 @code{jal foo} to be executed speculatively. GCC honors this
25785 restriction for functions it compiles itself. It expects non-GCC
25786 functions (such as hand-written assembly code) to do the same.
25787
25788 The option has three forms:
25789
25790 @table @gcctabopt
25791 @item -mr10k-cache-barrier=load-store
25792 Insert a cache barrier before a load or store that might be
25793 speculatively executed and that might have side effects even
25794 if aborted.
25795
25796 @item -mr10k-cache-barrier=store
25797 Insert a cache barrier before a store that might be speculatively
25798 executed and that might have side effects even if aborted.
25799
25800 @item -mr10k-cache-barrier=none
25801 Disable the insertion of cache barriers. This is the default setting.
25802 @end table
25803
25804 @item -mflush-func=@var{func}
25805 @itemx -mno-flush-func
25806 @opindex mflush-func
25807 Specifies the function to call to flush the I and D caches, or to not
25808 call any such function. If called, the function must take the same
25809 arguments as the common @code{_flush_func}, that is, the address of the
25810 memory range for which the cache is being flushed, the size of the
25811 memory range, and the number 3 (to flush both caches). The default
25812 depends on the target GCC was configured for, but commonly is either
25813 @code{_flush_func} or @code{__cpu_flush}.
25814
25815 @item mbranch-cost=@var{num}
25816 @opindex mbranch-cost
25817 Set the cost of branches to roughly @var{num} ``simple'' instructions.
25818 This cost is only a heuristic and is not guaranteed to produce
25819 consistent results across releases. A zero cost redundantly selects
25820 the default, which is based on the @option{-mtune} setting.
25821
25822 @item -mbranch-likely
25823 @itemx -mno-branch-likely
25824 @opindex mbranch-likely
25825 @opindex mno-branch-likely
25826 Enable or disable use of Branch Likely instructions, regardless of the
25827 default for the selected architecture. By default, Branch Likely
25828 instructions may be generated if they are supported by the selected
25829 architecture. An exception is for the MIPS32 and MIPS64 architectures
25830 and processors that implement those architectures; for those, Branch
25831 Likely instructions are not be generated by default because the MIPS32
25832 and MIPS64 architectures specifically deprecate their use.
25833
25834 @item -mcompact-branches=never
25835 @itemx -mcompact-branches=optimal
25836 @itemx -mcompact-branches=always
25837 @opindex mcompact-branches=never
25838 @opindex mcompact-branches=optimal
25839 @opindex mcompact-branches=always
25840 These options control which form of branches will be generated. The
25841 default is @option{-mcompact-branches=optimal}.
25842
25843 The @option{-mcompact-branches=never} option ensures that compact branch
25844 instructions will never be generated.
25845
25846 The @option{-mcompact-branches=always} option ensures that a compact
25847 branch instruction will be generated if available. If a compact branch
25848 instruction is not available, a delay slot form of the branch will be
25849 used instead.
25850
25851 This option is supported from MIPS Release 6 onwards.
25852
25853 The @option{-mcompact-branches=optimal} option will cause a delay slot
25854 branch to be used if one is available in the current ISA and the delay
25855 slot is successfully filled. If the delay slot is not filled, a compact
25856 branch will be chosen if one is available.
25857
25858 @item -mfp-exceptions
25859 @itemx -mno-fp-exceptions
25860 @opindex mfp-exceptions
25861 Specifies whether FP exceptions are enabled. This affects how
25862 FP instructions are scheduled for some processors.
25863 The default is that FP exceptions are
25864 enabled.
25865
25866 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
25867 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
25868 FP pipe.
25869
25870 @item -mvr4130-align
25871 @itemx -mno-vr4130-align
25872 @opindex mvr4130-align
25873 The VR4130 pipeline is two-way superscalar, but can only issue two
25874 instructions together if the first one is 8-byte aligned. When this
25875 option is enabled, GCC aligns pairs of instructions that it
25876 thinks should execute in parallel.
25877
25878 This option only has an effect when optimizing for the VR4130.
25879 It normally makes code faster, but at the expense of making it bigger.
25880 It is enabled by default at optimization level @option{-O3}.
25881
25882 @item -msynci
25883 @itemx -mno-synci
25884 @opindex msynci
25885 Enable (disable) generation of @code{synci} instructions on
25886 architectures that support it. The @code{synci} instructions (if
25887 enabled) are generated when @code{__builtin___clear_cache} is
25888 compiled.
25889
25890 This option defaults to @option{-mno-synci}, but the default can be
25891 overridden by configuring GCC with @option{--with-synci}.
25892
25893 When compiling code for single processor systems, it is generally safe
25894 to use @code{synci}. However, on many multi-core (SMP) systems, it
25895 does not invalidate the instruction caches on all cores and may lead
25896 to undefined behavior.
25897
25898 @item -mrelax-pic-calls
25899 @itemx -mno-relax-pic-calls
25900 @opindex mrelax-pic-calls
25901 Try to turn PIC calls that are normally dispatched via register
25902 @code{$25} into direct calls. This is only possible if the linker can
25903 resolve the destination at link time and if the destination is within
25904 range for a direct call.
25905
25906 @option{-mrelax-pic-calls} is the default if GCC was configured to use
25907 an assembler and a linker that support the @code{.reloc} assembly
25908 directive and @option{-mexplicit-relocs} is in effect. With
25909 @option{-mno-explicit-relocs}, this optimization can be performed by the
25910 assembler and the linker alone without help from the compiler.
25911
25912 @item -mmcount-ra-address
25913 @itemx -mno-mcount-ra-address
25914 @opindex mmcount-ra-address
25915 @opindex mno-mcount-ra-address
25916 Emit (do not emit) code that allows @code{_mcount} to modify the
25917 calling function's return address. When enabled, this option extends
25918 the usual @code{_mcount} interface with a new @var{ra-address}
25919 parameter, which has type @code{intptr_t *} and is passed in register
25920 @code{$12}. @code{_mcount} can then modify the return address by
25921 doing both of the following:
25922 @itemize
25923 @item
25924 Returning the new address in register @code{$31}.
25925 @item
25926 Storing the new address in @code{*@var{ra-address}},
25927 if @var{ra-address} is nonnull.
25928 @end itemize
25929
25930 The default is @option{-mno-mcount-ra-address}.
25931
25932 @item -mframe-header-opt
25933 @itemx -mno-frame-header-opt
25934 @opindex mframe-header-opt
25935 Enable (disable) frame header optimization in the o32 ABI. When using the
25936 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
25937 function to write out register arguments. When enabled, this optimization
25938 will suppress the allocation of the frame header if it can be determined that
25939 it is unused.
25940
25941 This optimization is off by default at all optimization levels.
25942
25943 @item -mlxc1-sxc1
25944 @itemx -mno-lxc1-sxc1
25945 @opindex mlxc1-sxc1
25946 When applicable, enable (disable) the generation of @code{lwxc1},
25947 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
25948
25949 @item -mmadd4
25950 @itemx -mno-madd4
25951 @opindex mmadd4
25952 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
25953 @code{madd.d} and related instructions. Enabled by default.
25954
25955 @end table
25956
25957 @node MMIX Options
25958 @subsection MMIX Options
25959 @cindex MMIX Options
25960
25961 These options are defined for the MMIX:
25962
25963 @table @gcctabopt
25964 @item -mlibfuncs
25965 @itemx -mno-libfuncs
25966 @opindex mlibfuncs
25967 @opindex mno-libfuncs
25968 Specify that intrinsic library functions are being compiled, passing all
25969 values in registers, no matter the size.
25970
25971 @item -mepsilon
25972 @itemx -mno-epsilon
25973 @opindex mepsilon
25974 @opindex mno-epsilon
25975 Generate floating-point comparison instructions that compare with respect
25976 to the @code{rE} epsilon register.
25977
25978 @item -mabi=mmixware
25979 @itemx -mabi=gnu
25980 @opindex mabi=mmixware
25981 @opindex mabi=gnu
25982 Generate code that passes function parameters and return values that (in
25983 the called function) are seen as registers @code{$0} and up, as opposed to
25984 the GNU ABI which uses global registers @code{$231} and up.
25985
25986 @item -mzero-extend
25987 @itemx -mno-zero-extend
25988 @opindex mzero-extend
25989 @opindex mno-zero-extend
25990 When reading data from memory in sizes shorter than 64 bits, use (do not
25991 use) zero-extending load instructions by default, rather than
25992 sign-extending ones.
25993
25994 @item -mknuthdiv
25995 @itemx -mno-knuthdiv
25996 @opindex mknuthdiv
25997 @opindex mno-knuthdiv
25998 Make the result of a division yielding a remainder have the same sign as
25999 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
26000 remainder follows the sign of the dividend. Both methods are
26001 arithmetically valid, the latter being almost exclusively used.
26002
26003 @item -mtoplevel-symbols
26004 @itemx -mno-toplevel-symbols
26005 @opindex mtoplevel-symbols
26006 @opindex mno-toplevel-symbols
26007 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
26008 code can be used with the @code{PREFIX} assembly directive.
26009
26010 @item -melf
26011 @opindex melf
26012 Generate an executable in the ELF format, rather than the default
26013 @samp{mmo} format used by the @command{mmix} simulator.
26014
26015 @item -mbranch-predict
26016 @itemx -mno-branch-predict
26017 @opindex mbranch-predict
26018 @opindex mno-branch-predict
26019 Use (do not use) the probable-branch instructions, when static branch
26020 prediction indicates a probable branch.
26021
26022 @item -mbase-addresses
26023 @itemx -mno-base-addresses
26024 @opindex mbase-addresses
26025 @opindex mno-base-addresses
26026 Generate (do not generate) code that uses @emph{base addresses}. Using a
26027 base address automatically generates a request (handled by the assembler
26028 and the linker) for a constant to be set up in a global register. The
26029 register is used for one or more base address requests within the range 0
26030 to 255 from the value held in the register. The generally leads to short
26031 and fast code, but the number of different data items that can be
26032 addressed is limited. This means that a program that uses lots of static
26033 data may require @option{-mno-base-addresses}.
26034
26035 @item -msingle-exit
26036 @itemx -mno-single-exit
26037 @opindex msingle-exit
26038 @opindex mno-single-exit
26039 Force (do not force) generated code to have a single exit point in each
26040 function.
26041 @end table
26042
26043 @node MN10300 Options
26044 @subsection MN10300 Options
26045 @cindex MN10300 options
26046
26047 These @option{-m} options are defined for Matsushita MN10300 architectures:
26048
26049 @table @gcctabopt
26050 @item -mmult-bug
26051 @opindex mmult-bug
26052 Generate code to avoid bugs in the multiply instructions for the MN10300
26053 processors. This is the default.
26054
26055 @item -mno-mult-bug
26056 @opindex mno-mult-bug
26057 Do not generate code to avoid bugs in the multiply instructions for the
26058 MN10300 processors.
26059
26060 @item -mam33
26061 @opindex mam33
26062 Generate code using features specific to the AM33 processor.
26063
26064 @item -mno-am33
26065 @opindex mno-am33
26066 Do not generate code using features specific to the AM33 processor. This
26067 is the default.
26068
26069 @item -mam33-2
26070 @opindex mam33-2
26071 Generate code using features specific to the AM33/2.0 processor.
26072
26073 @item -mam34
26074 @opindex mam34
26075 Generate code using features specific to the AM34 processor.
26076
26077 @item -mtune=@var{cpu-type}
26078 @opindex mtune
26079 Use the timing characteristics of the indicated CPU type when
26080 scheduling instructions. This does not change the targeted processor
26081 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
26082 @samp{am33-2} or @samp{am34}.
26083
26084 @item -mreturn-pointer-on-d0
26085 @opindex mreturn-pointer-on-d0
26086 When generating a function that returns a pointer, return the pointer
26087 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
26088 only in @code{a0}, and attempts to call such functions without a prototype
26089 result in errors. Note that this option is on by default; use
26090 @option{-mno-return-pointer-on-d0} to disable it.
26091
26092 @item -mno-crt0
26093 @opindex mno-crt0
26094 Do not link in the C run-time initialization object file.
26095
26096 @item -mrelax
26097 @opindex mrelax
26098 Indicate to the linker that it should perform a relaxation optimization pass
26099 to shorten branches, calls and absolute memory addresses. This option only
26100 has an effect when used on the command line for the final link step.
26101
26102 This option makes symbolic debugging impossible.
26103
26104 @item -mliw
26105 @opindex mliw
26106 Allow the compiler to generate @emph{Long Instruction Word}
26107 instructions if the target is the @samp{AM33} or later. This is the
26108 default. This option defines the preprocessor macro @code{__LIW__}.
26109
26110 @item -mno-liw
26111 @opindex mno-liw
26112 Do not allow the compiler to generate @emph{Long Instruction Word}
26113 instructions. This option defines the preprocessor macro
26114 @code{__NO_LIW__}.
26115
26116 @item -msetlb
26117 @opindex msetlb
26118 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
26119 instructions if the target is the @samp{AM33} or later. This is the
26120 default. This option defines the preprocessor macro @code{__SETLB__}.
26121
26122 @item -mno-setlb
26123 @opindex mno-setlb
26124 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
26125 instructions. This option defines the preprocessor macro
26126 @code{__NO_SETLB__}.
26127
26128 @end table
26129
26130 @node Moxie Options
26131 @subsection Moxie Options
26132 @cindex Moxie Options
26133
26134 @table @gcctabopt
26135
26136 @item -meb
26137 @opindex meb
26138 Generate big-endian code. This is the default for @samp{moxie-*-*}
26139 configurations.
26140
26141 @item -mel
26142 @opindex mel
26143 Generate little-endian code.
26144
26145 @item -mmul.x
26146 @opindex mmul.x
26147 Generate mul.x and umul.x instructions. This is the default for
26148 @samp{moxiebox-*-*} configurations.
26149
26150 @item -mno-crt0
26151 @opindex mno-crt0
26152 Do not link in the C run-time initialization object file.
26153
26154 @end table
26155
26156 @node MSP430 Options
26157 @subsection MSP430 Options
26158 @cindex MSP430 Options
26159
26160 These options are defined for the MSP430:
26161
26162 @table @gcctabopt
26163
26164 @item -masm-hex
26165 @opindex masm-hex
26166 Force assembly output to always use hex constants. Normally such
26167 constants are signed decimals, but this option is available for
26168 testsuite and/or aesthetic purposes.
26169
26170 @item -mmcu=
26171 @opindex mmcu=
26172 Select the MCU to target. This is used to create a C preprocessor
26173 symbol based upon the MCU name, converted to upper case and pre- and
26174 post-fixed with @samp{__}. This in turn is used by the
26175 @file{msp430.h} header file to select an MCU-specific supplementary
26176 header file.
26177
26178 The option also sets the ISA to use. If the MCU name is one that is
26179 known to only support the 430 ISA then that is selected, otherwise the
26180 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
26181 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
26182 name selects the 430X ISA.
26183
26184 In addition an MCU-specific linker script is added to the linker
26185 command line. The script's name is the name of the MCU with
26186 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
26187 command line defines the C preprocessor symbol @code{__XXX__} and
26188 cause the linker to search for a script called @file{xxx.ld}.
26189
26190 The ISA and hardware multiply supported for the different MCUs is hard-coded
26191 into GCC. However, an external @samp{devices.csv} file can be used to
26192 extend device support beyond those that have been hard-coded.
26193
26194 GCC searches for the @samp{devices.csv} file using the following methods in the
26195 given precedence order, where the first method takes precendence over the
26196 second which takes precedence over the third.
26197
26198 @table @asis
26199 @item Include path specified with @code{-I} and @code{-L}
26200 @samp{devices.csv} will be searched for in each of the directories specified by
26201 include paths and linker library search paths.
26202 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
26203 Define the value of the global environment variable
26204 @samp{MSP430_GCC_INCLUDE_DIR}
26205 to the full path to the directory containing devices.csv, and GCC will search
26206 this directory for devices.csv. If devices.csv is found, this directory will
26207 also be registered as an include path, and linker library path. Header files
26208 and linker scripts in this directory can therefore be used without manually
26209 specifying @code{-I} and @code{-L} on the command line.
26210 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
26211 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
26212 toolchain root directory. This directory does not exist in a default
26213 installation, but if the user has created it and copied @samp{devices.csv}
26214 there, then the MCU data will be read. As above, this directory will
26215 also be registered as an include path, and linker library path.
26216
26217 @end table
26218 If none of the above search methods find @samp{devices.csv}, then the
26219 hard-coded MCU data is used.
26220
26221
26222 @item -mwarn-mcu
26223 @itemx -mno-warn-mcu
26224 @opindex mwarn-mcu
26225 @opindex mno-warn-mcu
26226 This option enables or disables warnings about conflicts between the
26227 MCU name specified by the @option{-mmcu} option and the ISA set by the
26228 @option{-mcpu} option and/or the hardware multiply support set by the
26229 @option{-mhwmult} option. It also toggles warnings about unrecognized
26230 MCU names. This option is on by default.
26231
26232 @item -mcpu=
26233 @opindex mcpu=
26234 Specifies the ISA to use. Accepted values are @samp{msp430},
26235 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
26236 @option{-mmcu=} option should be used to select the ISA.
26237
26238 @item -msim
26239 @opindex msim
26240 Link to the simulator runtime libraries and linker script. Overrides
26241 any scripts that would be selected by the @option{-mmcu=} option.
26242
26243 @item -mlarge
26244 @opindex mlarge
26245 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
26246
26247 @item -msmall
26248 @opindex msmall
26249 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
26250
26251 @item -mrelax
26252 @opindex mrelax
26253 This option is passed to the assembler and linker, and allows the
26254 linker to perform certain optimizations that cannot be done until
26255 the final link.
26256
26257 @item mhwmult=
26258 @opindex mhwmult=
26259 Describes the type of hardware multiply supported by the target.
26260 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
26261 for the original 16-bit-only multiply supported by early MCUs.
26262 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
26263 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
26264 A value of @samp{auto} can also be given. This tells GCC to deduce
26265 the hardware multiply support based upon the MCU name provided by the
26266 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
26267 the MCU name is not recognized then no hardware multiply support is
26268 assumed. @code{auto} is the default setting.
26269
26270 Hardware multiplies are normally performed by calling a library
26271 routine. This saves space in the generated code. When compiling at
26272 @option{-O3} or higher however the hardware multiplier is invoked
26273 inline. This makes for bigger, but faster code.
26274
26275 The hardware multiply routines disable interrupts whilst running and
26276 restore the previous interrupt state when they finish. This makes
26277 them safe to use inside interrupt handlers as well as in normal code.
26278
26279 @item -minrt
26280 @opindex minrt
26281 Enable the use of a minimum runtime environment - no static
26282 initializers or constructors. This is intended for memory-constrained
26283 devices. The compiler includes special symbols in some objects
26284 that tell the linker and runtime which code fragments are required.
26285
26286 @item -mtiny-printf
26287 @opindex mtiny-printf
26288 Enable reduced code size @code{printf} and @code{puts} library functions.
26289 The @samp{tiny} implementations of these functions are not reentrant, so
26290 must be used with caution in multi-threaded applications.
26291
26292 Support for streams has been removed and the string to be printed will
26293 always be sent to stdout via the @code{write} syscall. The string is not
26294 buffered before it is sent to write.
26295
26296 This option requires Newlib Nano IO, so GCC must be configured with
26297 @samp{--enable-newlib-nano-formatted-io}.
26298
26299 @item -mmax-inline-shift=
26300 @opindex mmax-inline-shift=
26301 This option takes an integer between 0 and 64 inclusive, and sets
26302 the maximum number of inline shift instructions which should be emitted to
26303 perform a shift operation by a constant amount. When this value needs to be
26304 exceeded, an mspabi helper function is used instead. The default value is 4.
26305
26306 This only affects cases where a shift by multiple positions cannot be
26307 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
26308
26309 Shifts of a 32-bit value are at least twice as costly, so the value passed for
26310 this option is divided by 2 and the resulting value used instead.
26311
26312 @item -mcode-region=
26313 @itemx -mdata-region=
26314 @opindex mcode-region
26315 @opindex mdata-region
26316 These options tell the compiler where to place functions and data that
26317 do not have one of the @code{lower}, @code{upper}, @code{either} or
26318 @code{section} attributes. Possible values are @code{lower},
26319 @code{upper}, @code{either} or @code{any}. The first three behave
26320 like the corresponding attribute. The fourth possible value -
26321 @code{any} - is the default. It leaves placement entirely up to the
26322 linker script and how it assigns the standard sections
26323 (@code{.text}, @code{.data}, etc) to the memory regions.
26324
26325 @item -msilicon-errata=
26326 @opindex msilicon-errata
26327 This option passes on a request to assembler to enable the fixes for
26328 the named silicon errata.
26329
26330 @item -msilicon-errata-warn=
26331 @opindex msilicon-errata-warn
26332 This option passes on a request to the assembler to enable warning
26333 messages when a silicon errata might need to be applied.
26334
26335 @item -mwarn-devices-csv
26336 @itemx -mno-warn-devices-csv
26337 @opindex mwarn-devices-csv
26338 @opindex mno-warn-devices-csv
26339 Warn if @samp{devices.csv} is not found or there are problem parsing it
26340 (default: on).
26341
26342 @end table
26343
26344 @node NDS32 Options
26345 @subsection NDS32 Options
26346 @cindex NDS32 Options
26347
26348 These options are defined for NDS32 implementations:
26349
26350 @table @gcctabopt
26351
26352 @item -mbig-endian
26353 @opindex mbig-endian
26354 Generate code in big-endian mode.
26355
26356 @item -mlittle-endian
26357 @opindex mlittle-endian
26358 Generate code in little-endian mode.
26359
26360 @item -mreduced-regs
26361 @opindex mreduced-regs
26362 Use reduced-set registers for register allocation.
26363
26364 @item -mfull-regs
26365 @opindex mfull-regs
26366 Use full-set registers for register allocation.
26367
26368 @item -mcmov
26369 @opindex mcmov
26370 Generate conditional move instructions.
26371
26372 @item -mno-cmov
26373 @opindex mno-cmov
26374 Do not generate conditional move instructions.
26375
26376 @item -mext-perf
26377 @opindex mext-perf
26378 Generate performance extension instructions.
26379
26380 @item -mno-ext-perf
26381 @opindex mno-ext-perf
26382 Do not generate performance extension instructions.
26383
26384 @item -mext-perf2
26385 @opindex mext-perf2
26386 Generate performance extension 2 instructions.
26387
26388 @item -mno-ext-perf2
26389 @opindex mno-ext-perf2
26390 Do not generate performance extension 2 instructions.
26391
26392 @item -mext-string
26393 @opindex mext-string
26394 Generate string extension instructions.
26395
26396 @item -mno-ext-string
26397 @opindex mno-ext-string
26398 Do not generate string extension instructions.
26399
26400 @item -mv3push
26401 @opindex mv3push
26402 Generate v3 push25/pop25 instructions.
26403
26404 @item -mno-v3push
26405 @opindex mno-v3push
26406 Do not generate v3 push25/pop25 instructions.
26407
26408 @item -m16-bit
26409 @opindex m16-bit
26410 Generate 16-bit instructions.
26411
26412 @item -mno-16-bit
26413 @opindex mno-16-bit
26414 Do not generate 16-bit instructions.
26415
26416 @item -misr-vector-size=@var{num}
26417 @opindex misr-vector-size
26418 Specify the size of each interrupt vector, which must be 4 or 16.
26419
26420 @item -mcache-block-size=@var{num}
26421 @opindex mcache-block-size
26422 Specify the size of each cache block,
26423 which must be a power of 2 between 4 and 512.
26424
26425 @item -march=@var{arch}
26426 @opindex march
26427 Specify the name of the target architecture.
26428
26429 @item -mcmodel=@var{code-model}
26430 @opindex mcmodel
26431 Set the code model to one of
26432 @table @asis
26433 @item @samp{small}
26434 All the data and read-only data segments must be within 512KB addressing space.
26435 The text segment must be within 16MB addressing space.
26436 @item @samp{medium}
26437 The data segment must be within 512KB while the read-only data segment can be
26438 within 4GB addressing space. The text segment should be still within 16MB
26439 addressing space.
26440 @item @samp{large}
26441 All the text and data segments can be within 4GB addressing space.
26442 @end table
26443
26444 @item -mctor-dtor
26445 @opindex mctor-dtor
26446 Enable constructor/destructor feature.
26447
26448 @item -mrelax
26449 @opindex mrelax
26450 Guide linker to relax instructions.
26451
26452 @end table
26453
26454 @node Nios II Options
26455 @subsection Nios II Options
26456 @cindex Nios II options
26457 @cindex Altera Nios II options
26458
26459 These are the options defined for the Altera Nios II processor.
26460
26461 @table @gcctabopt
26462
26463 @item -G @var{num}
26464 @opindex G
26465 @cindex smaller data references
26466 Put global and static objects less than or equal to @var{num} bytes
26467 into the small data or BSS sections instead of the normal data or BSS
26468 sections. The default value of @var{num} is 8.
26469
26470 @item -mgpopt=@var{option}
26471 @itemx -mgpopt
26472 @itemx -mno-gpopt
26473 @opindex mgpopt
26474 @opindex mno-gpopt
26475 Generate (do not generate) GP-relative accesses. The following
26476 @var{option} names are recognized:
26477
26478 @table @samp
26479
26480 @item none
26481 Do not generate GP-relative accesses.
26482
26483 @item local
26484 Generate GP-relative accesses for small data objects that are not
26485 external, weak, or uninitialized common symbols.
26486 Also use GP-relative addressing for objects that
26487 have been explicitly placed in a small data section via a @code{section}
26488 attribute.
26489
26490 @item global
26491 As for @samp{local}, but also generate GP-relative accesses for
26492 small data objects that are external, weak, or common. If you use this option,
26493 you must ensure that all parts of your program (including libraries) are
26494 compiled with the same @option{-G} setting.
26495
26496 @item data
26497 Generate GP-relative accesses for all data objects in the program. If you
26498 use this option, the entire data and BSS segments
26499 of your program must fit in 64K of memory and you must use an appropriate
26500 linker script to allocate them within the addressable range of the
26501 global pointer.
26502
26503 @item all
26504 Generate GP-relative addresses for function pointers as well as data
26505 pointers. If you use this option, the entire text, data, and BSS segments
26506 of your program must fit in 64K of memory and you must use an appropriate
26507 linker script to allocate them within the addressable range of the
26508 global pointer.
26509
26510 @end table
26511
26512 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
26513 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
26514
26515 The default is @option{-mgpopt} except when @option{-fpic} or
26516 @option{-fPIC} is specified to generate position-independent code.
26517 Note that the Nios II ABI does not permit GP-relative accesses from
26518 shared libraries.
26519
26520 You may need to specify @option{-mno-gpopt} explicitly when building
26521 programs that include large amounts of small data, including large
26522 GOT data sections. In this case, the 16-bit offset for GP-relative
26523 addressing may not be large enough to allow access to the entire
26524 small data section.
26525
26526 @item -mgprel-sec=@var{regexp}
26527 @opindex mgprel-sec
26528 This option specifies additional section names that can be accessed via
26529 GP-relative addressing. It is most useful in conjunction with
26530 @code{section} attributes on variable declarations
26531 (@pxref{Common Variable Attributes}) and a custom linker script.
26532 The @var{regexp} is a POSIX Extended Regular Expression.
26533
26534 This option does not affect the behavior of the @option{-G} option, and
26535 the specified sections are in addition to the standard @code{.sdata}
26536 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
26537
26538 @item -mr0rel-sec=@var{regexp}
26539 @opindex mr0rel-sec
26540 This option specifies names of sections that can be accessed via a
26541 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
26542 of the 32-bit address space. It is most useful in conjunction with
26543 @code{section} attributes on variable declarations
26544 (@pxref{Common Variable Attributes}) and a custom linker script.
26545 The @var{regexp} is a POSIX Extended Regular Expression.
26546
26547 In contrast to the use of GP-relative addressing for small data,
26548 zero-based addressing is never generated by default and there are no
26549 conventional section names used in standard linker scripts for sections
26550 in the low or high areas of memory.
26551
26552 @item -mel
26553 @itemx -meb
26554 @opindex mel
26555 @opindex meb
26556 Generate little-endian (default) or big-endian (experimental) code,
26557 respectively.
26558
26559 @item -march=@var{arch}
26560 @opindex march
26561 This specifies the name of the target Nios II architecture. GCC uses this
26562 name to determine what kind of instructions it can emit when generating
26563 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
26564
26565 The preprocessor macro @code{__nios2_arch__} is available to programs,
26566 with value 1 or 2, indicating the targeted ISA level.
26567
26568 @item -mbypass-cache
26569 @itemx -mno-bypass-cache
26570 @opindex mno-bypass-cache
26571 @opindex mbypass-cache
26572 Force all load and store instructions to always bypass cache by
26573 using I/O variants of the instructions. The default is not to
26574 bypass the cache.
26575
26576 @item -mno-cache-volatile
26577 @itemx -mcache-volatile
26578 @opindex mcache-volatile
26579 @opindex mno-cache-volatile
26580 Volatile memory access bypass the cache using the I/O variants of
26581 the load and store instructions. The default is not to bypass the cache.
26582
26583 @item -mno-fast-sw-div
26584 @itemx -mfast-sw-div
26585 @opindex mno-fast-sw-div
26586 @opindex mfast-sw-div
26587 Do not use table-based fast divide for small numbers. The default
26588 is to use the fast divide at @option{-O3} and above.
26589
26590 @item -mno-hw-mul
26591 @itemx -mhw-mul
26592 @itemx -mno-hw-mulx
26593 @itemx -mhw-mulx
26594 @itemx -mno-hw-div
26595 @itemx -mhw-div
26596 @opindex mno-hw-mul
26597 @opindex mhw-mul
26598 @opindex mno-hw-mulx
26599 @opindex mhw-mulx
26600 @opindex mno-hw-div
26601 @opindex mhw-div
26602 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
26603 instructions by the compiler. The default is to emit @code{mul}
26604 and not emit @code{div} and @code{mulx}.
26605
26606 @item -mbmx
26607 @itemx -mno-bmx
26608 @itemx -mcdx
26609 @itemx -mno-cdx
26610 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
26611 CDX (code density) instructions. Enabling these instructions also
26612 requires @option{-march=r2}. Since these instructions are optional
26613 extensions to the R2 architecture, the default is not to emit them.
26614
26615 @item -mcustom-@var{insn}=@var{N}
26616 @itemx -mno-custom-@var{insn}
26617 @opindex mcustom-@var{insn}
26618 @opindex mno-custom-@var{insn}
26619 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
26620 custom instruction with encoding @var{N} when generating code that uses
26621 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
26622 instruction 253 for single-precision floating-point add operations instead
26623 of the default behavior of using a library call.
26624
26625 The following values of @var{insn} are supported. Except as otherwise
26626 noted, floating-point operations are expected to be implemented with
26627 normal IEEE 754 semantics and correspond directly to the C operators or the
26628 equivalent GCC built-in functions (@pxref{Other Builtins}).
26629
26630 Single-precision floating point:
26631 @table @asis
26632
26633 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
26634 Binary arithmetic operations.
26635
26636 @item @samp{fnegs}
26637 Unary negation.
26638
26639 @item @samp{fabss}
26640 Unary absolute value.
26641
26642 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
26643 Comparison operations.
26644
26645 @item @samp{fmins}, @samp{fmaxs}
26646 Floating-point minimum and maximum. These instructions are only
26647 generated if @option{-ffinite-math-only} is specified.
26648
26649 @item @samp{fsqrts}
26650 Unary square root operation.
26651
26652 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
26653 Floating-point trigonometric and exponential functions. These instructions
26654 are only generated if @option{-funsafe-math-optimizations} is also specified.
26655
26656 @end table
26657
26658 Double-precision floating point:
26659 @table @asis
26660
26661 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
26662 Binary arithmetic operations.
26663
26664 @item @samp{fnegd}
26665 Unary negation.
26666
26667 @item @samp{fabsd}
26668 Unary absolute value.
26669
26670 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
26671 Comparison operations.
26672
26673 @item @samp{fmind}, @samp{fmaxd}
26674 Double-precision minimum and maximum. These instructions are only
26675 generated if @option{-ffinite-math-only} is specified.
26676
26677 @item @samp{fsqrtd}
26678 Unary square root operation.
26679
26680 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
26681 Double-precision trigonometric and exponential functions. These instructions
26682 are only generated if @option{-funsafe-math-optimizations} is also specified.
26683
26684 @end table
26685
26686 Conversions:
26687 @table @asis
26688 @item @samp{fextsd}
26689 Conversion from single precision to double precision.
26690
26691 @item @samp{ftruncds}
26692 Conversion from double precision to single precision.
26693
26694 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
26695 Conversion from floating point to signed or unsigned integer types, with
26696 truncation towards zero.
26697
26698 @item @samp{round}
26699 Conversion from single-precision floating point to signed integer,
26700 rounding to the nearest integer and ties away from zero.
26701 This corresponds to the @code{__builtin_lroundf} function when
26702 @option{-fno-math-errno} is used.
26703
26704 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
26705 Conversion from signed or unsigned integer types to floating-point types.
26706
26707 @end table
26708
26709 In addition, all of the following transfer instructions for internal
26710 registers X and Y must be provided to use any of the double-precision
26711 floating-point instructions. Custom instructions taking two
26712 double-precision source operands expect the first operand in the
26713 64-bit register X. The other operand (or only operand of a unary
26714 operation) is given to the custom arithmetic instruction with the
26715 least significant half in source register @var{src1} and the most
26716 significant half in @var{src2}. A custom instruction that returns a
26717 double-precision result returns the most significant 32 bits in the
26718 destination register and the other half in 32-bit register Y.
26719 GCC automatically generates the necessary code sequences to write
26720 register X and/or read register Y when double-precision floating-point
26721 instructions are used.
26722
26723 @table @asis
26724
26725 @item @samp{fwrx}
26726 Write @var{src1} into the least significant half of X and @var{src2} into
26727 the most significant half of X.
26728
26729 @item @samp{fwry}
26730 Write @var{src1} into Y.
26731
26732 @item @samp{frdxhi}, @samp{frdxlo}
26733 Read the most or least (respectively) significant half of X and store it in
26734 @var{dest}.
26735
26736 @item @samp{frdy}
26737 Read the value of Y and store it into @var{dest}.
26738 @end table
26739
26740 Note that you can gain more local control over generation of Nios II custom
26741 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
26742 and @code{target("no-custom-@var{insn}")} function attributes
26743 (@pxref{Function Attributes})
26744 or pragmas (@pxref{Function Specific Option Pragmas}).
26745
26746 @item -mcustom-fpu-cfg=@var{name}
26747 @opindex mcustom-fpu-cfg
26748
26749 This option enables a predefined, named set of custom instruction encodings
26750 (see @option{-mcustom-@var{insn}} above).
26751 Currently, the following sets are defined:
26752
26753 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
26754 @gccoptlist{-mcustom-fmuls=252 @gol
26755 -mcustom-fadds=253 @gol
26756 -mcustom-fsubs=254 @gol
26757 -fsingle-precision-constant}
26758
26759 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
26760 @gccoptlist{-mcustom-fmuls=252 @gol
26761 -mcustom-fadds=253 @gol
26762 -mcustom-fsubs=254 @gol
26763 -mcustom-fdivs=255 @gol
26764 -fsingle-precision-constant}
26765
26766 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
26767 @gccoptlist{-mcustom-floatus=243 @gol
26768 -mcustom-fixsi=244 @gol
26769 -mcustom-floatis=245 @gol
26770 -mcustom-fcmpgts=246 @gol
26771 -mcustom-fcmples=249 @gol
26772 -mcustom-fcmpeqs=250 @gol
26773 -mcustom-fcmpnes=251 @gol
26774 -mcustom-fmuls=252 @gol
26775 -mcustom-fadds=253 @gol
26776 -mcustom-fsubs=254 @gol
26777 -mcustom-fdivs=255 @gol
26778 -fsingle-precision-constant}
26779
26780 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
26781 @gccoptlist{-mcustom-fabss=224 @gol
26782 -mcustom-fnegs=225 @gol
26783 -mcustom-fcmpnes=226 @gol
26784 -mcustom-fcmpeqs=227 @gol
26785 -mcustom-fcmpges=228 @gol
26786 -mcustom-fcmpgts=229 @gol
26787 -mcustom-fcmples=230 @gol
26788 -mcustom-fcmplts=231 @gol
26789 -mcustom-fmaxs=232 @gol
26790 -mcustom-fmins=233 @gol
26791 -mcustom-round=248 @gol
26792 -mcustom-fixsi=249 @gol
26793 -mcustom-floatis=250 @gol
26794 -mcustom-fsqrts=251 @gol
26795 -mcustom-fmuls=252 @gol
26796 -mcustom-fadds=253 @gol
26797 -mcustom-fsubs=254 @gol
26798 -mcustom-fdivs=255 @gol}
26799
26800 Custom instruction assignments given by individual
26801 @option{-mcustom-@var{insn}=} options override those given by
26802 @option{-mcustom-fpu-cfg=}, regardless of the
26803 order of the options on the command line.
26804
26805 Note that you can gain more local control over selection of a FPU
26806 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
26807 function attribute (@pxref{Function Attributes})
26808 or pragma (@pxref{Function Specific Option Pragmas}).
26809
26810 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
26811 Hardware 2 Component}. Please note that the custom instructions enabled by
26812 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
26813 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
26814 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
26815 specified. In contrast to the other configurations,
26816 @option{-fsingle-precision-constant} is not set.
26817
26818 @end table
26819
26820 These additional @samp{-m} options are available for the Altera Nios II
26821 ELF (bare-metal) target:
26822
26823 @table @gcctabopt
26824
26825 @item -mhal
26826 @opindex mhal
26827 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
26828 startup and termination code, and is typically used in conjunction with
26829 @option{-msys-crt0=} to specify the location of the alternate startup code
26830 provided by the HAL BSP.
26831
26832 @item -msmallc
26833 @opindex msmallc
26834 Link with a limited version of the C library, @option{-lsmallc}, rather than
26835 Newlib.
26836
26837 @item -msys-crt0=@var{startfile}
26838 @opindex msys-crt0
26839 @var{startfile} is the file name of the startfile (crt0) to use
26840 when linking. This option is only useful in conjunction with @option{-mhal}.
26841
26842 @item -msys-lib=@var{systemlib}
26843 @opindex msys-lib
26844 @var{systemlib} is the library name of the library that provides
26845 low-level system calls required by the C library,
26846 e.g.@: @code{read} and @code{write}.
26847 This option is typically used to link with a library provided by a HAL BSP.
26848
26849 @end table
26850
26851 @node Nvidia PTX Options
26852 @subsection Nvidia PTX Options
26853 @cindex Nvidia PTX options
26854 @cindex nvptx options
26855
26856 These options are defined for Nvidia PTX:
26857
26858 @table @gcctabopt
26859
26860 @item -m64
26861 @opindex m64
26862 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
26863 supported.
26864
26865 @item -misa=@var{ISA-string}
26866 @opindex march
26867 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
26868 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
26869 @samp{sm_35}. The default ISA is sm_35.
26870
26871 @item -mptx=@var{version-string}
26872 @opindex mptx
26873 Generate code for given the specified PTX version (e.g.@: @samp{6.3}).
26874 Valid version strings include @samp{3.1} and @samp{6.3}. The default PTX
26875 version is 3.1.
26876
26877 @item -mmainkernel
26878 @opindex mmainkernel
26879 Link in code for a __main kernel. This is for stand-alone instead of
26880 offloading execution.
26881
26882 @item -moptimize
26883 @opindex moptimize
26884 Apply partitioned execution optimizations. This is the default when any
26885 level of optimization is selected.
26886
26887 @item -msoft-stack
26888 @opindex msoft-stack
26889 Generate code that does not use @code{.local} memory
26890 directly for stack storage. Instead, a per-warp stack pointer is
26891 maintained explicitly. This enables variable-length stack allocation (with
26892 variable-length arrays or @code{alloca}), and when global memory is used for
26893 underlying storage, makes it possible to access automatic variables from other
26894 threads, or with atomic instructions. This code generation variant is used
26895 for OpenMP offloading, but the option is exposed on its own for the purpose
26896 of testing the compiler; to generate code suitable for linking into programs
26897 using OpenMP offloading, use option @option{-mgomp}.
26898
26899 @item -muniform-simt
26900 @opindex muniform-simt
26901 Switch to code generation variant that allows to execute all threads in each
26902 warp, while maintaining memory state and side effects as if only one thread
26903 in each warp was active outside of OpenMP SIMD regions. All atomic operations
26904 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
26905 current lane index equals the master lane index), and the register being
26906 assigned is copied via a shuffle instruction from the master lane. Outside of
26907 SIMD regions lane 0 is the master; inside, each thread sees itself as the
26908 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
26909 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
26910 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
26911 with current lane index to compute the master lane index.
26912
26913 @item -mgomp
26914 @opindex mgomp
26915 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
26916 @option{-muniform-simt} options, and selects corresponding multilib variant.
26917
26918 @end table
26919
26920 @node OpenRISC Options
26921 @subsection OpenRISC Options
26922 @cindex OpenRISC Options
26923
26924 These options are defined for OpenRISC:
26925
26926 @table @gcctabopt
26927
26928 @item -mboard=@var{name}
26929 @opindex mboard
26930 Configure a board specific runtime. This will be passed to the linker for
26931 newlib board library linking. The default is @code{or1ksim}.
26932
26933 @item -mnewlib
26934 @opindex mnewlib
26935 This option is ignored; it is for compatibility purposes only. This used to
26936 select linker and preprocessor options for use with newlib.
26937
26938 @item -msoft-div
26939 @itemx -mhard-div
26940 @opindex msoft-div
26941 @opindex mhard-div
26942 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
26943 This default is hardware divide.
26944
26945 @item -msoft-mul
26946 @itemx -mhard-mul
26947 @opindex msoft-mul
26948 @opindex mhard-mul
26949 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
26950 This default is hardware multiply.
26951
26952 @item -msoft-float
26953 @itemx -mhard-float
26954 @opindex msoft-float
26955 @opindex mhard-float
26956 Select software or hardware for floating point operations.
26957 The default is software.
26958
26959 @item -mdouble-float
26960 @opindex mdouble-float
26961 When @option{-mhard-float} is selected, enables generation of double-precision
26962 floating point instructions. By default functions from @file{libgcc} are used
26963 to perform double-precision floating point operations.
26964
26965 @item -munordered-float
26966 @opindex munordered-float
26967 When @option{-mhard-float} is selected, enables generation of unordered
26968 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
26969 functions from @file{libgcc} are used to perform unordered floating point
26970 compare and set flag operations.
26971
26972 @item -mcmov
26973 @opindex mcmov
26974 Enable generation of conditional move (@code{l.cmov}) instructions. By
26975 default the equivalent will be generated using set and branch.
26976
26977 @item -mror
26978 @opindex mror
26979 Enable generation of rotate right (@code{l.ror}) instructions. By default
26980 functions from @file{libgcc} are used to perform rotate right operations.
26981
26982 @item -mrori
26983 @opindex mrori
26984 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
26985 By default functions from @file{libgcc} are used to perform rotate right with
26986 immediate operations.
26987
26988 @item -msext
26989 @opindex msext
26990 Enable generation of sign extension (@code{l.ext*}) instructions. By default
26991 memory loads are used to perform sign extension.
26992
26993 @item -msfimm
26994 @opindex msfimm
26995 Enable generation of compare and set flag with immediate (@code{l.sf*i})
26996 instructions. By default extra instructions will be generated to store the
26997 immediate to a register first.
26998
26999 @item -mshftimm
27000 @opindex mshftimm
27001 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
27002 @code{l.slli}) instructions. By default extra instructions will be generated
27003 to store the immediate to a register first.
27004
27005 @item -mcmodel=small
27006 @opindex mcmodel=small
27007 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
27008 the default model.
27009
27010 @item -mcmodel=large
27011 @opindex mcmodel=large
27012 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
27013
27014
27015 @end table
27016
27017 @node PDP-11 Options
27018 @subsection PDP-11 Options
27019 @cindex PDP-11 Options
27020
27021 These options are defined for the PDP-11:
27022
27023 @table @gcctabopt
27024 @item -mfpu
27025 @opindex mfpu
27026 Use hardware FPP floating point. This is the default. (FIS floating
27027 point on the PDP-11/40 is not supported.) Implies -m45.
27028
27029 @item -msoft-float
27030 @opindex msoft-float
27031 Do not use hardware floating point.
27032
27033 @item -mac0
27034 @opindex mac0
27035 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
27036
27037 @item -mno-ac0
27038 @opindex mno-ac0
27039 Return floating-point results in memory. This is the default.
27040
27041 @item -m40
27042 @opindex m40
27043 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
27044
27045 @item -m45
27046 @opindex m45
27047 Generate code for a PDP-11/45. This is the default.
27048
27049 @item -m10
27050 @opindex m10
27051 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
27052
27053 @item -mint16
27054 @itemx -mno-int32
27055 @opindex mint16
27056 @opindex mno-int32
27057 Use 16-bit @code{int}. This is the default.
27058
27059 @item -mint32
27060 @itemx -mno-int16
27061 @opindex mint32
27062 @opindex mno-int16
27063 Use 32-bit @code{int}.
27064
27065 @item -msplit
27066 @opindex msplit
27067 Target has split instruction and data space. Implies -m45.
27068
27069 @item -munix-asm
27070 @opindex munix-asm
27071 Use Unix assembler syntax.
27072
27073 @item -mdec-asm
27074 @opindex mdec-asm
27075 Use DEC assembler syntax.
27076
27077 @item -mgnu-asm
27078 @opindex mgnu-asm
27079 Use GNU assembler syntax. This is the default.
27080
27081 @item -mlra
27082 @opindex mlra
27083 Use the new LRA register allocator. By default, the old ``reload''
27084 allocator is used.
27085 @end table
27086
27087 @node picoChip Options
27088 @subsection picoChip Options
27089 @cindex picoChip options
27090
27091 These @samp{-m} options are defined for picoChip implementations:
27092
27093 @table @gcctabopt
27094
27095 @item -mae=@var{ae_type}
27096 @opindex mcpu
27097 Set the instruction set, register set, and instruction scheduling
27098 parameters for array element type @var{ae_type}. Supported values
27099 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
27100
27101 @option{-mae=ANY} selects a completely generic AE type. Code
27102 generated with this option runs on any of the other AE types. The
27103 code is not as efficient as it would be if compiled for a specific
27104 AE type, and some types of operation (e.g., multiplication) do not
27105 work properly on all types of AE.
27106
27107 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
27108 for compiled code, and is the default.
27109
27110 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
27111 option may suffer from poor performance of byte (char) manipulation,
27112 since the DSP AE does not provide hardware support for byte load/stores.
27113
27114 @item -msymbol-as-address
27115 Enable the compiler to directly use a symbol name as an address in a
27116 load/store instruction, without first loading it into a
27117 register. Typically, the use of this option generates larger
27118 programs, which run faster than when the option isn't used. However, the
27119 results vary from program to program, so it is left as a user option,
27120 rather than being permanently enabled.
27121
27122 @item -mno-inefficient-warnings
27123 Disables warnings about the generation of inefficient code. These
27124 warnings can be generated, for example, when compiling code that
27125 performs byte-level memory operations on the MAC AE type. The MAC AE has
27126 no hardware support for byte-level memory operations, so all byte
27127 load/stores must be synthesized from word load/store operations. This is
27128 inefficient and a warning is generated to indicate
27129 that you should rewrite the code to avoid byte operations, or to target
27130 an AE type that has the necessary hardware support. This option disables
27131 these warnings.
27132
27133 @end table
27134
27135 @node PowerPC Options
27136 @subsection PowerPC Options
27137 @cindex PowerPC options
27138
27139 These are listed under @xref{RS/6000 and PowerPC Options}.
27140
27141 @node PRU Options
27142 @subsection PRU Options
27143 @cindex PRU Options
27144
27145 These command-line options are defined for PRU target:
27146
27147 @table @gcctabopt
27148 @item -minrt
27149 @opindex minrt
27150 Link with a minimum runtime environment, with no support for static
27151 initializers and constructors. Using this option can significantly reduce
27152 the size of the final ELF binary. Beware that the compiler could still
27153 generate code with static initializers and constructors. It is up to the
27154 programmer to ensure that the source program will not use those features.
27155
27156 @item -mmcu=@var{mcu}
27157 @opindex mmcu
27158 Specify the PRU MCU variant to use. Check Newlib for the exact list of
27159 supported MCUs.
27160
27161 @item -mno-relax
27162 @opindex mno-relax
27163 Make GCC pass the @option{--no-relax} command-line option to the linker
27164 instead of the @option{--relax} option.
27165
27166 @item -mloop
27167 @opindex mloop
27168 Allow (or do not allow) GCC to use the LOOP instruction.
27169
27170 @item -mabi=@var{variant}
27171 @opindex mabi
27172 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
27173 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
27174 more naturally with certain GCC assumptions. These are the differences:
27175
27176 @table @samp
27177 @item Function Pointer Size
27178 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
27179 supports only 32-bit data and code pointers.
27180
27181 @item Optional Return Value Pointer
27182 Function return values larger than 64 bits are passed by using a hidden
27183 pointer as the first argument of the function. TI ABI, though, mandates that
27184 the pointer can be NULL in case the caller is not using the returned value.
27185 GNU always passes and expects a valid return value pointer.
27186
27187 @end table
27188
27189 The current @option{-mabi=ti} implementation simply raises a compile error
27190 when any of the above code constructs is detected. As a consequence
27191 the standard C library cannot be built and it is omitted when linking with
27192 @option{-mabi=ti}.
27193
27194 Relaxation is a GNU feature and for safety reasons is disabled when using
27195 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
27196 instructions, so the GNU linker cannot adjust them when shortening adjacent
27197 LDI32 pseudo instructions.
27198
27199 @end table
27200
27201 @node RISC-V Options
27202 @subsection RISC-V Options
27203 @cindex RISC-V Options
27204
27205 These command-line options are defined for RISC-V targets:
27206
27207 @table @gcctabopt
27208 @item -mbranch-cost=@var{n}
27209 @opindex mbranch-cost
27210 Set the cost of branches to roughly @var{n} instructions.
27211
27212 @item -mplt
27213 @itemx -mno-plt
27214 @opindex plt
27215 When generating PIC code, do or don't allow the use of PLTs. Ignored for
27216 non-PIC. The default is @option{-mplt}.
27217
27218 @item -mabi=@var{ABI-string}
27219 @opindex mabi
27220 Specify integer and floating-point calling convention. @var{ABI-string}
27221 contains two parts: the size of integer types and the registers used for
27222 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
27223 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
27224 32-bit), and that floating-point values up to 64 bits wide are passed in F
27225 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
27226 allows the compiler to generate code that uses the F and D extensions but only
27227 allows floating-point values up to 32 bits long to be passed in registers; or
27228 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
27229 passed in registers.
27230
27231 The default for this argument is system dependent, users who want a specific
27232 calling convention should specify one explicitly. The valid calling
27233 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
27234 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
27235 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
27236 invalid because the ABI requires 64-bit values be passed in F registers, but F
27237 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
27238 only be used with the @samp{rv32e} architecture. This ABI is not well
27239 specified at present, and is subject to change.
27240
27241 @item -mfdiv
27242 @itemx -mno-fdiv
27243 @opindex mfdiv
27244 Do or don't use hardware floating-point divide and square root instructions.
27245 This requires the F or D extensions for floating-point registers. The default
27246 is to use them if the specified architecture has these instructions.
27247
27248 @item -mdiv
27249 @itemx -mno-div
27250 @opindex mdiv
27251 Do or don't use hardware instructions for integer division. This requires the
27252 M extension. The default is to use them if the specified architecture has
27253 these instructions.
27254
27255 @item -march=@var{ISA-string}
27256 @opindex march
27257 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
27258 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
27259 @samp{rv32imaf}.
27260
27261 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
27262
27263 If both @option{-march} and @option{-mcpu=} are not specified, the default for
27264 this argument is system dependent, users who want a specific architecture
27265 extensions should specify one explicitly.
27266
27267 @item -mcpu=@var{processor-string}
27268 @opindex mcpu
27269 Use architecture of and optimize the output for the given processor, specified
27270 by particular CPU name.
27271 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
27272 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
27273 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
27274 @samp{sifive-u54}, and @samp{sifive-u74}.
27275
27276 @item -mtune=@var{processor-string}
27277 @opindex mtune
27278 Optimize the output for the given processor, specified by microarchitecture or
27279 particular CPU name. Permissible values for this option are: @samp{rocket},
27280 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
27281 @samp{size}, and all valid options for @option{-mcpu=}.
27282
27283 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
27284 the default is @samp{rocket} if both are not specified.
27285
27286 The @samp{size} choice is not intended for use by end-users. This is used
27287 when @option{-Os} is specified. It overrides the instruction cost info
27288 provided by @option{-mtune=}, but does not override the pipeline info. This
27289 helps reduce code size while still giving good performance.
27290
27291 @item -mpreferred-stack-boundary=@var{num}
27292 @opindex mpreferred-stack-boundary
27293 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27294 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27295 the default is 4 (16 bytes or 128-bits).
27296
27297 @strong{Warning:} If you use this switch, then you must build all modules with
27298 the same value, including any libraries. This includes the system libraries
27299 and startup modules.
27300
27301 @item -msmall-data-limit=@var{n}
27302 @opindex msmall-data-limit
27303 Put global and static data smaller than @var{n} bytes into a special section
27304 (on some targets).
27305
27306 @item -msave-restore
27307 @itemx -mno-save-restore
27308 @opindex msave-restore
27309 Do or don't use smaller but slower prologue and epilogue code that uses
27310 library function calls. The default is to use fast inline prologues and
27311 epilogues.
27312
27313 @item -mshorten-memrefs
27314 @itemx -mno-shorten-memrefs
27315 @opindex mshorten-memrefs
27316 Do or do not attempt to make more use of compressed load/store instructions by
27317 replacing a load/store of 'base register + large offset' with a new load/store
27318 of 'new base + small offset'. If the new base gets stored in a compressed
27319 register, then the new load/store can be compressed. Currently targets 32-bit
27320 integer load/stores only.
27321
27322 @item -mstrict-align
27323 @itemx -mno-strict-align
27324 @opindex mstrict-align
27325 Do not or do generate unaligned memory accesses. The default is set depending
27326 on whether the processor we are optimizing for supports fast unaligned access
27327 or not.
27328
27329 @item -mcmodel=medlow
27330 @opindex mcmodel=medlow
27331 Generate code for the medium-low code model. The program and its statically
27332 defined symbols must lie within a single 2 GiB address range and must lie
27333 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
27334 statically or dynamically linked. This is the default code model.
27335
27336 @item -mcmodel=medany
27337 @opindex mcmodel=medany
27338 Generate code for the medium-any code model. The program and its statically
27339 defined symbols must be within any single 2 GiB address range. Programs can be
27340 statically or dynamically linked.
27341
27342 @item -mexplicit-relocs
27343 @itemx -mno-exlicit-relocs
27344 Use or do not use assembler relocation operators when dealing with symbolic
27345 addresses. The alternative is to use assembler macros instead, which may
27346 limit optimization.
27347
27348 @item -mrelax
27349 @itemx -mno-relax
27350 Take advantage of linker relaxations to reduce the number of instructions
27351 required to materialize symbol addresses. The default is to take advantage of
27352 linker relaxations.
27353
27354 @item -memit-attribute
27355 @itemx -mno-emit-attribute
27356 Emit (do not emit) RISC-V attribute to record extra information into ELF
27357 objects. This feature requires at least binutils 2.32.
27358
27359 @item -malign-data=@var{type}
27360 @opindex malign-data
27361 Control how GCC aligns variables and constants of array, structure, or union
27362 types. Supported values for @var{type} are @samp{xlen} which uses x register
27363 width as the alignment value, and @samp{natural} which uses natural alignment.
27364 @samp{xlen} is the default.
27365
27366 @item -mbig-endian
27367 @opindex mbig-endian
27368 Generate big-endian code. This is the default when GCC is configured for a
27369 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
27370
27371 @item -mlittle-endian
27372 @opindex mlittle-endian
27373 Generate little-endian code. This is the default when GCC is configured for a
27374 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
27375 @samp{riscv32be-*-*} target.
27376
27377 @item -mstack-protector-guard=@var{guard}
27378 @itemx -mstack-protector-guard-reg=@var{reg}
27379 @itemx -mstack-protector-guard-offset=@var{offset}
27380 @opindex mstack-protector-guard
27381 @opindex mstack-protector-guard-reg
27382 @opindex mstack-protector-guard-offset
27383 Generate stack protection code using canary at @var{guard}. Supported
27384 locations are @samp{global} for a global canary or @samp{tls} for per-thread
27385 canary in the TLS block.
27386
27387 With the latter choice the options
27388 @option{-mstack-protector-guard-reg=@var{reg}} and
27389 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27390 which register to use as base register for reading the canary,
27391 and from what offset from that base register. There is no default
27392 register or offset as this is entirely for use within the Linux
27393 kernel.
27394 @end table
27395
27396 @node RL78 Options
27397 @subsection RL78 Options
27398 @cindex RL78 Options
27399
27400 @table @gcctabopt
27401
27402 @item -msim
27403 @opindex msim
27404 Links in additional target libraries to support operation within a
27405 simulator.
27406
27407 @item -mmul=none
27408 @itemx -mmul=g10
27409 @itemx -mmul=g13
27410 @itemx -mmul=g14
27411 @itemx -mmul=rl78
27412 @opindex mmul
27413 Specifies the type of hardware multiplication and division support to
27414 be used. The simplest is @code{none}, which uses software for both
27415 multiplication and division. This is the default. The @code{g13}
27416 value is for the hardware multiply/divide peripheral found on the
27417 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
27418 the multiplication and division instructions supported by the RL78/G14
27419 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
27420 the value @code{mg10} is an alias for @code{none}.
27421
27422 In addition a C preprocessor macro is defined, based upon the setting
27423 of this option. Possible values are: @code{__RL78_MUL_NONE__},
27424 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
27425
27426 @item -mcpu=g10
27427 @itemx -mcpu=g13
27428 @itemx -mcpu=g14
27429 @itemx -mcpu=rl78
27430 @opindex mcpu
27431 Specifies the RL78 core to target. The default is the G14 core, also
27432 known as an S3 core or just RL78. The G13 or S2 core does not have
27433 multiply or divide instructions, instead it uses a hardware peripheral
27434 for these operations. The G10 or S1 core does not have register
27435 banks, so it uses a different calling convention.
27436
27437 If this option is set it also selects the type of hardware multiply
27438 support to use, unless this is overridden by an explicit
27439 @option{-mmul=none} option on the command line. Thus specifying
27440 @option{-mcpu=g13} enables the use of the G13 hardware multiply
27441 peripheral and specifying @option{-mcpu=g10} disables the use of
27442 hardware multiplications altogether.
27443
27444 Note, although the RL78/G14 core is the default target, specifying
27445 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
27446 change the behavior of the toolchain since it also enables G14
27447 hardware multiply support. If these options are not specified on the
27448 command line then software multiplication routines will be used even
27449 though the code targets the RL78 core. This is for backwards
27450 compatibility with older toolchains which did not have hardware
27451 multiply and divide support.
27452
27453 In addition a C preprocessor macro is defined, based upon the setting
27454 of this option. Possible values are: @code{__RL78_G10__},
27455 @code{__RL78_G13__} or @code{__RL78_G14__}.
27456
27457 @item -mg10
27458 @itemx -mg13
27459 @itemx -mg14
27460 @itemx -mrl78
27461 @opindex mg10
27462 @opindex mg13
27463 @opindex mg14
27464 @opindex mrl78
27465 These are aliases for the corresponding @option{-mcpu=} option. They
27466 are provided for backwards compatibility.
27467
27468 @item -mallregs
27469 @opindex mallregs
27470 Allow the compiler to use all of the available registers. By default
27471 registers @code{r24..r31} are reserved for use in interrupt handlers.
27472 With this option enabled these registers can be used in ordinary
27473 functions as well.
27474
27475 @item -m64bit-doubles
27476 @itemx -m32bit-doubles
27477 @opindex m64bit-doubles
27478 @opindex m32bit-doubles
27479 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
27480 or 32 bits (@option{-m32bit-doubles}) in size. The default is
27481 @option{-m32bit-doubles}.
27482
27483 @item -msave-mduc-in-interrupts
27484 @itemx -mno-save-mduc-in-interrupts
27485 @opindex msave-mduc-in-interrupts
27486 @opindex mno-save-mduc-in-interrupts
27487 Specifies that interrupt handler functions should preserve the
27488 MDUC registers. This is only necessary if normal code might use
27489 the MDUC registers, for example because it performs multiplication
27490 and division operations. The default is to ignore the MDUC registers
27491 as this makes the interrupt handlers faster. The target option -mg13
27492 needs to be passed for this to work as this feature is only available
27493 on the G13 target (S2 core). The MDUC registers will only be saved
27494 if the interrupt handler performs a multiplication or division
27495 operation or it calls another function.
27496
27497 @end table
27498
27499 @node RS/6000 and PowerPC Options
27500 @subsection IBM RS/6000 and PowerPC Options
27501 @cindex RS/6000 and PowerPC Options
27502 @cindex IBM RS/6000 and PowerPC Options
27503
27504 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
27505 @table @gcctabopt
27506 @item -mpowerpc-gpopt
27507 @itemx -mno-powerpc-gpopt
27508 @itemx -mpowerpc-gfxopt
27509 @itemx -mno-powerpc-gfxopt
27510 @need 800
27511 @itemx -mpowerpc64
27512 @itemx -mno-powerpc64
27513 @itemx -mmfcrf
27514 @itemx -mno-mfcrf
27515 @itemx -mpopcntb
27516 @itemx -mno-popcntb
27517 @itemx -mpopcntd
27518 @itemx -mno-popcntd
27519 @itemx -mfprnd
27520 @itemx -mno-fprnd
27521 @need 800
27522 @itemx -mcmpb
27523 @itemx -mno-cmpb
27524 @itemx -mhard-dfp
27525 @itemx -mno-hard-dfp
27526 @opindex mpowerpc-gpopt
27527 @opindex mno-powerpc-gpopt
27528 @opindex mpowerpc-gfxopt
27529 @opindex mno-powerpc-gfxopt
27530 @opindex mpowerpc64
27531 @opindex mno-powerpc64
27532 @opindex mmfcrf
27533 @opindex mno-mfcrf
27534 @opindex mpopcntb
27535 @opindex mno-popcntb
27536 @opindex mpopcntd
27537 @opindex mno-popcntd
27538 @opindex mfprnd
27539 @opindex mno-fprnd
27540 @opindex mcmpb
27541 @opindex mno-cmpb
27542 @opindex mhard-dfp
27543 @opindex mno-hard-dfp
27544 You use these options to specify which instructions are available on the
27545 processor you are using. The default value of these options is
27546 determined when configuring GCC@. Specifying the
27547 @option{-mcpu=@var{cpu_type}} overrides the specification of these
27548 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
27549 rather than the options listed above.
27550
27551 Specifying @option{-mpowerpc-gpopt} allows
27552 GCC to use the optional PowerPC architecture instructions in the
27553 General Purpose group, including floating-point square root. Specifying
27554 @option{-mpowerpc-gfxopt} allows GCC to
27555 use the optional PowerPC architecture instructions in the Graphics
27556 group, including floating-point select.
27557
27558 The @option{-mmfcrf} option allows GCC to generate the move from
27559 condition register field instruction implemented on the POWER4
27560 processor and other processors that support the PowerPC V2.01
27561 architecture.
27562 The @option{-mpopcntb} option allows GCC to generate the popcount and
27563 double-precision FP reciprocal estimate instruction implemented on the
27564 POWER5 processor and other processors that support the PowerPC V2.02
27565 architecture.
27566 The @option{-mpopcntd} option allows GCC to generate the popcount
27567 instruction implemented on the POWER7 processor and other processors
27568 that support the PowerPC V2.06 architecture.
27569 The @option{-mfprnd} option allows GCC to generate the FP round to
27570 integer instructions implemented on the POWER5+ processor and other
27571 processors that support the PowerPC V2.03 architecture.
27572 The @option{-mcmpb} option allows GCC to generate the compare bytes
27573 instruction implemented on the POWER6 processor and other processors
27574 that support the PowerPC V2.05 architecture.
27575 The @option{-mhard-dfp} option allows GCC to generate the decimal
27576 floating-point instructions implemented on some POWER processors.
27577
27578 The @option{-mpowerpc64} option allows GCC to generate the additional
27579 64-bit instructions that are found in the full PowerPC64 architecture
27580 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
27581 @option{-mno-powerpc64}.
27582
27583 @item -mcpu=@var{cpu_type}
27584 @opindex mcpu
27585 Set architecture type, register usage, and
27586 instruction scheduling parameters for machine type @var{cpu_type}.
27587 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
27588 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
27589 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
27590 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
27591 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
27592 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
27593 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
27594 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
27595 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
27596 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
27597 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
27598 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
27599
27600 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
27601 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
27602 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
27603 architecture machine types, with an appropriate, generic processor
27604 model assumed for scheduling purposes.
27605
27606 Specifying @samp{native} as cpu type detects and selects the
27607 architecture option that corresponds to the host processor of the
27608 system performing the compilation.
27609 @option{-mcpu=native} has no effect if GCC does not recognize the
27610 processor.
27611
27612 The other options specify a specific processor. Code generated under
27613 those options runs best on that processor, and may not run at all on
27614 others.
27615
27616 The @option{-mcpu} options automatically enable or disable the
27617 following options:
27618
27619 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
27620 -mpopcntb -mpopcntd -mpowerpc64 @gol
27621 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
27622 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
27623 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
27624 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
27625 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
27626 -mrop-protect}
27627
27628 The particular options set for any particular CPU varies between
27629 compiler versions, depending on what setting seems to produce optimal
27630 code for that CPU; it doesn't necessarily reflect the actual hardware's
27631 capabilities. If you wish to set an individual option to a particular
27632 value, you may specify it after the @option{-mcpu} option, like
27633 @option{-mcpu=970 -mno-altivec}.
27634
27635 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
27636 not enabled or disabled by the @option{-mcpu} option at present because
27637 AIX does not have full support for these options. You may still
27638 enable or disable them individually if you're sure it'll work in your
27639 environment.
27640
27641 @item -mtune=@var{cpu_type}
27642 @opindex mtune
27643 Set the instruction scheduling parameters for machine type
27644 @var{cpu_type}, but do not set the architecture type or register usage,
27645 as @option{-mcpu=@var{cpu_type}} does. The same
27646 values for @var{cpu_type} are used for @option{-mtune} as for
27647 @option{-mcpu}. If both are specified, the code generated uses the
27648 architecture and registers set by @option{-mcpu}, but the
27649 scheduling parameters set by @option{-mtune}.
27650
27651 @item -mcmodel=small
27652 @opindex mcmodel=small
27653 Generate PowerPC64 code for the small model: The TOC is limited to
27654 64k.
27655
27656 @item -mcmodel=medium
27657 @opindex mcmodel=medium
27658 Generate PowerPC64 code for the medium model: The TOC and other static
27659 data may be up to a total of 4G in size. This is the default for 64-bit
27660 Linux.
27661
27662 @item -mcmodel=large
27663 @opindex mcmodel=large
27664 Generate PowerPC64 code for the large model: The TOC may be up to 4G
27665 in size. Other data and code is only limited by the 64-bit address
27666 space.
27667
27668 @item -maltivec
27669 @itemx -mno-altivec
27670 @opindex maltivec
27671 @opindex mno-altivec
27672 Generate code that uses (does not use) AltiVec instructions, and also
27673 enable the use of built-in functions that allow more direct access to
27674 the AltiVec instruction set. You may also need to set
27675 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
27676 enhancements.
27677
27678 When @option{-maltivec} is used, the element order for AltiVec intrinsics
27679 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
27680 match array element order corresponding to the endianness of the
27681 target. That is, element zero identifies the leftmost element in a
27682 vector register when targeting a big-endian platform, and identifies
27683 the rightmost element in a vector register when targeting a
27684 little-endian platform.
27685
27686 @item -mvrsave
27687 @itemx -mno-vrsave
27688 @opindex mvrsave
27689 @opindex mno-vrsave
27690 Generate VRSAVE instructions when generating AltiVec code.
27691
27692 @item -msecure-plt
27693 @opindex msecure-plt
27694 Generate code that allows @command{ld} and @command{ld.so}
27695 to build executables and shared
27696 libraries with non-executable @code{.plt} and @code{.got} sections.
27697 This is a PowerPC
27698 32-bit SYSV ABI option.
27699
27700 @item -mbss-plt
27701 @opindex mbss-plt
27702 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
27703 fills in, and
27704 requires @code{.plt} and @code{.got}
27705 sections that are both writable and executable.
27706 This is a PowerPC 32-bit SYSV ABI option.
27707
27708 @item -misel
27709 @itemx -mno-isel
27710 @opindex misel
27711 @opindex mno-isel
27712 This switch enables or disables the generation of ISEL instructions.
27713
27714 @item -mvsx
27715 @itemx -mno-vsx
27716 @opindex mvsx
27717 @opindex mno-vsx
27718 Generate code that uses (does not use) vector/scalar (VSX)
27719 instructions, and also enable the use of built-in functions that allow
27720 more direct access to the VSX instruction set.
27721
27722 @item -mcrypto
27723 @itemx -mno-crypto
27724 @opindex mcrypto
27725 @opindex mno-crypto
27726 Enable the use (disable) of the built-in functions that allow direct
27727 access to the cryptographic instructions that were added in version
27728 2.07 of the PowerPC ISA.
27729
27730 @item -mhtm
27731 @itemx -mno-htm
27732 @opindex mhtm
27733 @opindex mno-htm
27734 Enable (disable) the use of the built-in functions that allow direct
27735 access to the Hardware Transactional Memory (HTM) instructions that
27736 were added in version 2.07 of the PowerPC ISA.
27737
27738 @item -mpower8-fusion
27739 @itemx -mno-power8-fusion
27740 @opindex mpower8-fusion
27741 @opindex mno-power8-fusion
27742 Generate code that keeps (does not keeps) some integer operations
27743 adjacent so that the instructions can be fused together on power8 and
27744 later processors.
27745
27746 @item -mpower8-vector
27747 @itemx -mno-power8-vector
27748 @opindex mpower8-vector
27749 @opindex mno-power8-vector
27750 Generate code that uses (does not use) the vector and scalar
27751 instructions that were added in version 2.07 of the PowerPC ISA. Also
27752 enable the use of built-in functions that allow more direct access to
27753 the vector instructions.
27754
27755 @item -mquad-memory
27756 @itemx -mno-quad-memory
27757 @opindex mquad-memory
27758 @opindex mno-quad-memory
27759 Generate code that uses (does not use) the non-atomic quad word memory
27760 instructions. The @option{-mquad-memory} option requires use of
27761 64-bit mode.
27762
27763 @item -mquad-memory-atomic
27764 @itemx -mno-quad-memory-atomic
27765 @opindex mquad-memory-atomic
27766 @opindex mno-quad-memory-atomic
27767 Generate code that uses (does not use) the atomic quad word memory
27768 instructions. The @option{-mquad-memory-atomic} option requires use of
27769 64-bit mode.
27770
27771 @item -mfloat128
27772 @itemx -mno-float128
27773 @opindex mfloat128
27774 @opindex mno-float128
27775 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
27776 and use either software emulation for IEEE 128-bit floating point or
27777 hardware instructions.
27778
27779 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
27780 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
27781 use the IEEE 128-bit floating point support. The IEEE 128-bit
27782 floating point support only works on PowerPC Linux systems.
27783
27784 The default for @option{-mfloat128} is enabled on PowerPC Linux
27785 systems using the VSX instruction set, and disabled on other systems.
27786
27787 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
27788 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
27789 point support will also enable the generation of ISA 3.0 IEEE 128-bit
27790 floating point instructions. Otherwise, if you do not specify to
27791 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
27792 system, IEEE 128-bit floating point will be done with software
27793 emulation.
27794
27795 @item -mfloat128-hardware
27796 @itemx -mno-float128-hardware
27797 @opindex mfloat128-hardware
27798 @opindex mno-float128-hardware
27799 Enable/disable using ISA 3.0 hardware instructions to support the
27800 @var{__float128} data type.
27801
27802 The default for @option{-mfloat128-hardware} is enabled on PowerPC
27803 Linux systems using the ISA 3.0 instruction set, and disabled on other
27804 systems.
27805
27806 @item -m32
27807 @itemx -m64
27808 @opindex m32
27809 @opindex m64
27810 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
27811 targets (including GNU/Linux). The 32-bit environment sets int, long
27812 and pointer to 32 bits and generates code that runs on any PowerPC
27813 variant. The 64-bit environment sets int to 32 bits and long and
27814 pointer to 64 bits, and generates code for PowerPC64, as for
27815 @option{-mpowerpc64}.
27816
27817 @item -mfull-toc
27818 @itemx -mno-fp-in-toc
27819 @itemx -mno-sum-in-toc
27820 @itemx -mminimal-toc
27821 @opindex mfull-toc
27822 @opindex mno-fp-in-toc
27823 @opindex mno-sum-in-toc
27824 @opindex mminimal-toc
27825 Modify generation of the TOC (Table Of Contents), which is created for
27826 every executable file. The @option{-mfull-toc} option is selected by
27827 default. In that case, GCC allocates at least one TOC entry for
27828 each unique non-automatic variable reference in your program. GCC
27829 also places floating-point constants in the TOC@. However, only
27830 16,384 entries are available in the TOC@.
27831
27832 If you receive a linker error message that saying you have overflowed
27833 the available TOC space, you can reduce the amount of TOC space used
27834 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
27835 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
27836 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
27837 generate code to calculate the sum of an address and a constant at
27838 run time instead of putting that sum into the TOC@. You may specify one
27839 or both of these options. Each causes GCC to produce very slightly
27840 slower and larger code at the expense of conserving TOC space.
27841
27842 If you still run out of space in the TOC even when you specify both of
27843 these options, specify @option{-mminimal-toc} instead. This option causes
27844 GCC to make only one TOC entry for every file. When you specify this
27845 option, GCC produces code that is slower and larger but which
27846 uses extremely little TOC space. You may wish to use this option
27847 only on files that contain less frequently-executed code.
27848
27849 @item -maix64
27850 @itemx -maix32
27851 @opindex maix64
27852 @opindex maix32
27853 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
27854 @code{long} type, and the infrastructure needed to support them.
27855 Specifying @option{-maix64} implies @option{-mpowerpc64},
27856 while @option{-maix32} disables the 64-bit ABI and
27857 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
27858
27859 @item -mxl-compat
27860 @itemx -mno-xl-compat
27861 @opindex mxl-compat
27862 @opindex mno-xl-compat
27863 Produce code that conforms more closely to IBM XL compiler semantics
27864 when using AIX-compatible ABI@. Pass floating-point arguments to
27865 prototyped functions beyond the register save area (RSA) on the stack
27866 in addition to argument FPRs. Do not assume that most significant
27867 double in 128-bit long double value is properly rounded when comparing
27868 values and converting to double. Use XL symbol names for long double
27869 support routines.
27870
27871 The AIX calling convention was extended but not initially documented to
27872 handle an obscure K&R C case of calling a function that takes the
27873 address of its arguments with fewer arguments than declared. IBM XL
27874 compilers access floating-point arguments that do not fit in the
27875 RSA from the stack when a subroutine is compiled without
27876 optimization. Because always storing floating-point arguments on the
27877 stack is inefficient and rarely needed, this option is not enabled by
27878 default and only is necessary when calling subroutines compiled by IBM
27879 XL compilers without optimization.
27880
27881 @item -mpe
27882 @opindex mpe
27883 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
27884 application written to use message passing with special startup code to
27885 enable the application to run. The system must have PE installed in the
27886 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
27887 must be overridden with the @option{-specs=} option to specify the
27888 appropriate directory location. The Parallel Environment does not
27889 support threads, so the @option{-mpe} option and the @option{-pthread}
27890 option are incompatible.
27891
27892 @item -malign-natural
27893 @itemx -malign-power
27894 @opindex malign-natural
27895 @opindex malign-power
27896 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
27897 @option{-malign-natural} overrides the ABI-defined alignment of larger
27898 types, such as floating-point doubles, on their natural size-based boundary.
27899 The option @option{-malign-power} instructs GCC to follow the ABI-specified
27900 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
27901
27902 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
27903 is not supported.
27904
27905 @item -msoft-float
27906 @itemx -mhard-float
27907 @opindex msoft-float
27908 @opindex mhard-float
27909 Generate code that does not use (uses) the floating-point register set.
27910 Software floating-point emulation is provided if you use the
27911 @option{-msoft-float} option, and pass the option to GCC when linking.
27912
27913 @item -mmultiple
27914 @itemx -mno-multiple
27915 @opindex mmultiple
27916 @opindex mno-multiple
27917 Generate code that uses (does not use) the load multiple word
27918 instructions and the store multiple word instructions. These
27919 instructions are generated by default on POWER systems, and not
27920 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
27921 PowerPC systems, since those instructions do not work when the
27922 processor is in little-endian mode. The exceptions are PPC740 and
27923 PPC750 which permit these instructions in little-endian mode.
27924
27925 @item -mupdate
27926 @itemx -mno-update
27927 @opindex mupdate
27928 @opindex mno-update
27929 Generate code that uses (does not use) the load or store instructions
27930 that update the base register to the address of the calculated memory
27931 location. These instructions are generated by default. If you use
27932 @option{-mno-update}, there is a small window between the time that the
27933 stack pointer is updated and the address of the previous frame is
27934 stored, which means code that walks the stack frame across interrupts or
27935 signals may get corrupted data.
27936
27937 @item -mavoid-indexed-addresses
27938 @itemx -mno-avoid-indexed-addresses
27939 @opindex mavoid-indexed-addresses
27940 @opindex mno-avoid-indexed-addresses
27941 Generate code that tries to avoid (not avoid) the use of indexed load
27942 or store instructions. These instructions can incur a performance
27943 penalty on Power6 processors in certain situations, such as when
27944 stepping through large arrays that cross a 16M boundary. This option
27945 is enabled by default when targeting Power6 and disabled otherwise.
27946
27947 @item -mfused-madd
27948 @itemx -mno-fused-madd
27949 @opindex mfused-madd
27950 @opindex mno-fused-madd
27951 Generate code that uses (does not use) the floating-point multiply and
27952 accumulate instructions. These instructions are generated by default
27953 if hardware floating point is used. The machine-dependent
27954 @option{-mfused-madd} option is now mapped to the machine-independent
27955 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27956 mapped to @option{-ffp-contract=off}.
27957
27958 @item -mmulhw
27959 @itemx -mno-mulhw
27960 @opindex mmulhw
27961 @opindex mno-mulhw
27962 Generate code that uses (does not use) the half-word multiply and
27963 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
27964 These instructions are generated by default when targeting those
27965 processors.
27966
27967 @item -mdlmzb
27968 @itemx -mno-dlmzb
27969 @opindex mdlmzb
27970 @opindex mno-dlmzb
27971 Generate code that uses (does not use) the string-search @samp{dlmzb}
27972 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
27973 generated by default when targeting those processors.
27974
27975 @item -mno-bit-align
27976 @itemx -mbit-align
27977 @opindex mno-bit-align
27978 @opindex mbit-align
27979 On System V.4 and embedded PowerPC systems do not (do) force structures
27980 and unions that contain bit-fields to be aligned to the base type of the
27981 bit-field.
27982
27983 For example, by default a structure containing nothing but 8
27984 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
27985 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
27986 the structure is aligned to a 1-byte boundary and is 1 byte in
27987 size.
27988
27989 @item -mno-strict-align
27990 @itemx -mstrict-align
27991 @opindex mno-strict-align
27992 @opindex mstrict-align
27993 On System V.4 and embedded PowerPC systems do not (do) assume that
27994 unaligned memory references are handled by the system.
27995
27996 @item -mrelocatable
27997 @itemx -mno-relocatable
27998 @opindex mrelocatable
27999 @opindex mno-relocatable
28000 Generate code that allows (does not allow) a static executable to be
28001 relocated to a different address at run time. A simple embedded
28002 PowerPC system loader should relocate the entire contents of
28003 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
28004 a table of 32-bit addresses generated by this option. For this to
28005 work, all objects linked together must be compiled with
28006 @option{-mrelocatable} or @option{-mrelocatable-lib}.
28007 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
28008
28009 @item -mrelocatable-lib
28010 @itemx -mno-relocatable-lib
28011 @opindex mrelocatable-lib
28012 @opindex mno-relocatable-lib
28013 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
28014 @code{.fixup} section to allow static executables to be relocated at
28015 run time, but @option{-mrelocatable-lib} does not use the smaller stack
28016 alignment of @option{-mrelocatable}. Objects compiled with
28017 @option{-mrelocatable-lib} may be linked with objects compiled with
28018 any combination of the @option{-mrelocatable} options.
28019
28020 @item -mno-toc
28021 @itemx -mtoc
28022 @opindex mno-toc
28023 @opindex mtoc
28024 On System V.4 and embedded PowerPC systems do not (do) assume that
28025 register 2 contains a pointer to a global area pointing to the addresses
28026 used in the program.
28027
28028 @item -mlittle
28029 @itemx -mlittle-endian
28030 @opindex mlittle
28031 @opindex mlittle-endian
28032 On System V.4 and embedded PowerPC systems compile code for the
28033 processor in little-endian mode. The @option{-mlittle-endian} option is
28034 the same as @option{-mlittle}.
28035
28036 @item -mbig
28037 @itemx -mbig-endian
28038 @opindex mbig
28039 @opindex mbig-endian
28040 On System V.4 and embedded PowerPC systems compile code for the
28041 processor in big-endian mode. The @option{-mbig-endian} option is
28042 the same as @option{-mbig}.
28043
28044 @item -mdynamic-no-pic
28045 @opindex mdynamic-no-pic
28046 On Darwin and Mac OS X systems, compile code so that it is not
28047 relocatable, but that its external references are relocatable. The
28048 resulting code is suitable for applications, but not shared
28049 libraries.
28050
28051 @item -msingle-pic-base
28052 @opindex msingle-pic-base
28053 Treat the register used for PIC addressing as read-only, rather than
28054 loading it in the prologue for each function. The runtime system is
28055 responsible for initializing this register with an appropriate value
28056 before execution begins.
28057
28058 @item -mprioritize-restricted-insns=@var{priority}
28059 @opindex mprioritize-restricted-insns
28060 This option controls the priority that is assigned to
28061 dispatch-slot restricted instructions during the second scheduling
28062 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
28063 or @samp{2} to assign no, highest, or second-highest (respectively)
28064 priority to dispatch-slot restricted
28065 instructions.
28066
28067 @item -msched-costly-dep=@var{dependence_type}
28068 @opindex msched-costly-dep
28069 This option controls which dependences are considered costly
28070 by the target during instruction scheduling. The argument
28071 @var{dependence_type} takes one of the following values:
28072
28073 @table @asis
28074 @item @samp{no}
28075 No dependence is costly.
28076
28077 @item @samp{all}
28078 All dependences are costly.
28079
28080 @item @samp{true_store_to_load}
28081 A true dependence from store to load is costly.
28082
28083 @item @samp{store_to_load}
28084 Any dependence from store to load is costly.
28085
28086 @item @var{number}
28087 Any dependence for which the latency is greater than or equal to
28088 @var{number} is costly.
28089 @end table
28090
28091 @item -minsert-sched-nops=@var{scheme}
28092 @opindex minsert-sched-nops
28093 This option controls which NOP insertion scheme is used during
28094 the second scheduling pass. The argument @var{scheme} takes one of the
28095 following values:
28096
28097 @table @asis
28098 @item @samp{no}
28099 Don't insert NOPs.
28100
28101 @item @samp{pad}
28102 Pad with NOPs any dispatch group that has vacant issue slots,
28103 according to the scheduler's grouping.
28104
28105 @item @samp{regroup_exact}
28106 Insert NOPs to force costly dependent insns into
28107 separate groups. Insert exactly as many NOPs as needed to force an insn
28108 to a new group, according to the estimated processor grouping.
28109
28110 @item @var{number}
28111 Insert NOPs to force costly dependent insns into
28112 separate groups. Insert @var{number} NOPs to force an insn to a new group.
28113 @end table
28114
28115 @item -mcall-sysv
28116 @opindex mcall-sysv
28117 On System V.4 and embedded PowerPC systems compile code using calling
28118 conventions that adhere to the March 1995 draft of the System V
28119 Application Binary Interface, PowerPC processor supplement. This is the
28120 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
28121
28122 @item -mcall-sysv-eabi
28123 @itemx -mcall-eabi
28124 @opindex mcall-sysv-eabi
28125 @opindex mcall-eabi
28126 Specify both @option{-mcall-sysv} and @option{-meabi} options.
28127
28128 @item -mcall-sysv-noeabi
28129 @opindex mcall-sysv-noeabi
28130 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
28131
28132 @item -mcall-aixdesc
28133 @opindex m
28134 On System V.4 and embedded PowerPC systems compile code for the AIX
28135 operating system.
28136
28137 @item -mcall-linux
28138 @opindex mcall-linux
28139 On System V.4 and embedded PowerPC systems compile code for the
28140 Linux-based GNU system.
28141
28142 @item -mcall-freebsd
28143 @opindex mcall-freebsd
28144 On System V.4 and embedded PowerPC systems compile code for the
28145 FreeBSD operating system.
28146
28147 @item -mcall-netbsd
28148 @opindex mcall-netbsd
28149 On System V.4 and embedded PowerPC systems compile code for the
28150 NetBSD operating system.
28151
28152 @item -mcall-openbsd
28153 @opindex mcall-netbsd
28154 On System V.4 and embedded PowerPC systems compile code for the
28155 OpenBSD operating system.
28156
28157 @item -mtraceback=@var{traceback_type}
28158 @opindex mtraceback
28159 Select the type of traceback table. Valid values for @var{traceback_type}
28160 are @samp{full}, @samp{part}, and @samp{no}.
28161
28162 @item -maix-struct-return
28163 @opindex maix-struct-return
28164 Return all structures in memory (as specified by the AIX ABI)@.
28165
28166 @item -msvr4-struct-return
28167 @opindex msvr4-struct-return
28168 Return structures smaller than 8 bytes in registers (as specified by the
28169 SVR4 ABI)@.
28170
28171 @item -mabi=@var{abi-type}
28172 @opindex mabi
28173 Extend the current ABI with a particular extension, or remove such extension.
28174 Valid values are: @samp{altivec}, @samp{no-altivec},
28175 @samp{ibmlongdouble}, @samp{ieeelongdouble},
28176 @samp{elfv1}, @samp{elfv2},
28177 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
28178
28179 @item -mabi=ibmlongdouble
28180 @opindex mabi=ibmlongdouble
28181 Change the current ABI to use IBM extended-precision long double.
28182 This is not likely to work if your system defaults to using IEEE
28183 extended-precision long double. If you change the long double type
28184 from IEEE extended-precision, the compiler will issue a warning unless
28185 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28186 to be enabled.
28187
28188 @item -mabi=ieeelongdouble
28189 @opindex mabi=ieeelongdouble
28190 Change the current ABI to use IEEE extended-precision long double.
28191 This is not likely to work if your system defaults to using IBM
28192 extended-precision long double. If you change the long double type
28193 from IBM extended-precision, the compiler will issue a warning unless
28194 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28195 to be enabled.
28196
28197 @item -mabi=elfv1
28198 @opindex mabi=elfv1
28199 Change the current ABI to use the ELFv1 ABI.
28200 This is the default ABI for big-endian PowerPC 64-bit Linux.
28201 Overriding the default ABI requires special system support and is
28202 likely to fail in spectacular ways.
28203
28204 @item -mabi=elfv2
28205 @opindex mabi=elfv2
28206 Change the current ABI to use the ELFv2 ABI.
28207 This is the default ABI for little-endian PowerPC 64-bit Linux.
28208 Overriding the default ABI requires special system support and is
28209 likely to fail in spectacular ways.
28210
28211 @item -mgnu-attribute
28212 @itemx -mno-gnu-attribute
28213 @opindex mgnu-attribute
28214 @opindex mno-gnu-attribute
28215 Emit .gnu_attribute assembly directives to set tag/value pairs in a
28216 .gnu.attributes section that specify ABI variations in function
28217 parameters or return values.
28218
28219 @item -mprototype
28220 @itemx -mno-prototype
28221 @opindex mprototype
28222 @opindex mno-prototype
28223 On System V.4 and embedded PowerPC systems assume that all calls to
28224 variable argument functions are properly prototyped. Otherwise, the
28225 compiler must insert an instruction before every non-prototyped call to
28226 set or clear bit 6 of the condition code register (@code{CR}) to
28227 indicate whether floating-point values are passed in the floating-point
28228 registers in case the function takes variable arguments. With
28229 @option{-mprototype}, only calls to prototyped variable argument functions
28230 set or clear the bit.
28231
28232 @item -msim
28233 @opindex msim
28234 On embedded PowerPC systems, assume that the startup module is called
28235 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
28236 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
28237 configurations.
28238
28239 @item -mmvme
28240 @opindex mmvme
28241 On embedded PowerPC systems, assume that the startup module is called
28242 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
28243 @file{libc.a}.
28244
28245 @item -mads
28246 @opindex mads
28247 On embedded PowerPC systems, assume that the startup module is called
28248 @file{crt0.o} and the standard C libraries are @file{libads.a} and
28249 @file{libc.a}.
28250
28251 @item -myellowknife
28252 @opindex myellowknife
28253 On embedded PowerPC systems, assume that the startup module is called
28254 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
28255 @file{libc.a}.
28256
28257 @item -mvxworks
28258 @opindex mvxworks
28259 On System V.4 and embedded PowerPC systems, specify that you are
28260 compiling for a VxWorks system.
28261
28262 @item -memb
28263 @opindex memb
28264 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
28265 header to indicate that @samp{eabi} extended relocations are used.
28266
28267 @item -meabi
28268 @itemx -mno-eabi
28269 @opindex meabi
28270 @opindex mno-eabi
28271 On System V.4 and embedded PowerPC systems do (do not) adhere to the
28272 Embedded Applications Binary Interface (EABI), which is a set of
28273 modifications to the System V.4 specifications. Selecting @option{-meabi}
28274 means that the stack is aligned to an 8-byte boundary, a function
28275 @code{__eabi} is called from @code{main} to set up the EABI
28276 environment, and the @option{-msdata} option can use both @code{r2} and
28277 @code{r13} to point to two separate small data areas. Selecting
28278 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
28279 no EABI initialization function is called from @code{main}, and the
28280 @option{-msdata} option only uses @code{r13} to point to a single
28281 small data area. The @option{-meabi} option is on by default if you
28282 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
28283
28284 @item -msdata=eabi
28285 @opindex msdata=eabi
28286 On System V.4 and embedded PowerPC systems, put small initialized
28287 @code{const} global and static data in the @code{.sdata2} section, which
28288 is pointed to by register @code{r2}. Put small initialized
28289 non-@code{const} global and static data in the @code{.sdata} section,
28290 which is pointed to by register @code{r13}. Put small uninitialized
28291 global and static data in the @code{.sbss} section, which is adjacent to
28292 the @code{.sdata} section. The @option{-msdata=eabi} option is
28293 incompatible with the @option{-mrelocatable} option. The
28294 @option{-msdata=eabi} option also sets the @option{-memb} option.
28295
28296 @item -msdata=sysv
28297 @opindex msdata=sysv
28298 On System V.4 and embedded PowerPC systems, put small global and static
28299 data in the @code{.sdata} section, which is pointed to by register
28300 @code{r13}. Put small uninitialized global and static data in the
28301 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
28302 The @option{-msdata=sysv} option is incompatible with the
28303 @option{-mrelocatable} option.
28304
28305 @item -msdata=default
28306 @itemx -msdata
28307 @opindex msdata=default
28308 @opindex msdata
28309 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
28310 compile code the same as @option{-msdata=eabi}, otherwise compile code the
28311 same as @option{-msdata=sysv}.
28312
28313 @item -msdata=data
28314 @opindex msdata=data
28315 On System V.4 and embedded PowerPC systems, put small global
28316 data in the @code{.sdata} section. Put small uninitialized global
28317 data in the @code{.sbss} section. Do not use register @code{r13}
28318 to address small data however. This is the default behavior unless
28319 other @option{-msdata} options are used.
28320
28321 @item -msdata=none
28322 @itemx -mno-sdata
28323 @opindex msdata=none
28324 @opindex mno-sdata
28325 On embedded PowerPC systems, put all initialized global and static data
28326 in the @code{.data} section, and all uninitialized data in the
28327 @code{.bss} section.
28328
28329 @item -mreadonly-in-sdata
28330 @opindex mreadonly-in-sdata
28331 @opindex mno-readonly-in-sdata
28332 Put read-only objects in the @code{.sdata} section as well. This is the
28333 default.
28334
28335 @item -mblock-move-inline-limit=@var{num}
28336 @opindex mblock-move-inline-limit
28337 Inline all block moves (such as calls to @code{memcpy} or structure
28338 copies) less than or equal to @var{num} bytes. The minimum value for
28339 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
28340 targets. The default value is target-specific.
28341
28342 @item -mblock-compare-inline-limit=@var{num}
28343 @opindex mblock-compare-inline-limit
28344 Generate non-looping inline code for all block compares (such as calls
28345 to @code{memcmp} or structure compares) less than or equal to @var{num}
28346 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
28347 block compare is disabled. The default value is target-specific.
28348
28349 @item -mblock-compare-inline-loop-limit=@var{num}
28350 @opindex mblock-compare-inline-loop-limit
28351 Generate an inline expansion using loop code for all block compares that
28352 are less than or equal to @var{num} bytes, but greater than the limit
28353 for non-loop inline block compare expansion. If the block length is not
28354 constant, at most @var{num} bytes will be compared before @code{memcmp}
28355 is called to compare the remainder of the block. The default value is
28356 target-specific.
28357
28358 @item -mstring-compare-inline-limit=@var{num}
28359 @opindex mstring-compare-inline-limit
28360 Compare at most @var{num} string bytes with inline code.
28361 If the difference or end of string is not found at the
28362 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
28363 take care of the rest of the comparison. The default is 64 bytes.
28364
28365 @item -G @var{num}
28366 @opindex G
28367 @cindex smaller data references (PowerPC)
28368 @cindex .sdata/.sdata2 references (PowerPC)
28369 On embedded PowerPC systems, put global and static items less than or
28370 equal to @var{num} bytes into the small data or BSS sections instead of
28371 the normal data or BSS section. By default, @var{num} is 8. The
28372 @option{-G @var{num}} switch is also passed to the linker.
28373 All modules should be compiled with the same @option{-G @var{num}} value.
28374
28375 @item -mregnames
28376 @itemx -mno-regnames
28377 @opindex mregnames
28378 @opindex mno-regnames
28379 On System V.4 and embedded PowerPC systems do (do not) emit register
28380 names in the assembly language output using symbolic forms.
28381
28382 @item -mlongcall
28383 @itemx -mno-longcall
28384 @opindex mlongcall
28385 @opindex mno-longcall
28386 By default assume that all calls are far away so that a longer and more
28387 expensive calling sequence is required. This is required for calls
28388 farther than 32 megabytes (33,554,432 bytes) from the current location.
28389 A short call is generated if the compiler knows
28390 the call cannot be that far away. This setting can be overridden by
28391 the @code{shortcall} function attribute, or by @code{#pragma
28392 longcall(0)}.
28393
28394 Some linkers are capable of detecting out-of-range calls and generating
28395 glue code on the fly. On these systems, long calls are unnecessary and
28396 generate slower code. As of this writing, the AIX linker can do this,
28397 as can the GNU linker for PowerPC/64. It is planned to add this feature
28398 to the GNU linker for 32-bit PowerPC systems as well.
28399
28400 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
28401 GCC can generate long calls using an inline PLT call sequence (see
28402 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
28403 ELFv1 (big-endian) do not support inline PLT calls.
28404
28405 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
28406 callee, L42}, plus a @dfn{branch island} (glue code). The two target
28407 addresses represent the callee and the branch island. The
28408 Darwin/PPC linker prefers the first address and generates a @code{bl
28409 callee} if the PPC @code{bl} instruction reaches the callee directly;
28410 otherwise, the linker generates @code{bl L42} to call the branch
28411 island. The branch island is appended to the body of the
28412 calling function; it computes the full 32-bit address of the callee
28413 and jumps to it.
28414
28415 On Mach-O (Darwin) systems, this option directs the compiler emit to
28416 the glue for every direct call, and the Darwin linker decides whether
28417 to use or discard it.
28418
28419 In the future, GCC may ignore all longcall specifications
28420 when the linker is known to generate glue.
28421
28422 @item -mpltseq
28423 @itemx -mno-pltseq
28424 @opindex mpltseq
28425 @opindex mno-pltseq
28426 Implement (do not implement) -fno-plt and long calls using an inline
28427 PLT call sequence that supports lazy linking and long calls to
28428 functions in dlopen'd shared libraries. Inline PLT calls are only
28429 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
28430 linkers, and are enabled by default if the support is detected when
28431 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
28432 configured with @option{--enable-secureplt}. @option{-mpltseq} code
28433 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
28434 linked together.
28435
28436 @item -mtls-markers
28437 @itemx -mno-tls-markers
28438 @opindex mtls-markers
28439 @opindex mno-tls-markers
28440 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
28441 specifying the function argument. The relocation allows the linker to
28442 reliably associate function call with argument setup instructions for
28443 TLS optimization, which in turn allows GCC to better schedule the
28444 sequence.
28445
28446 @item -mrecip
28447 @itemx -mno-recip
28448 @opindex mrecip
28449 This option enables use of the reciprocal estimate and
28450 reciprocal square root estimate instructions with additional
28451 Newton-Raphson steps to increase precision instead of doing a divide or
28452 square root and divide for floating-point arguments. You should use
28453 the @option{-ffast-math} option when using @option{-mrecip} (or at
28454 least @option{-funsafe-math-optimizations},
28455 @option{-ffinite-math-only}, @option{-freciprocal-math} and
28456 @option{-fno-trapping-math}). Note that while the throughput of the
28457 sequence is generally higher than the throughput of the non-reciprocal
28458 instruction, the precision of the sequence can be decreased by up to 2
28459 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
28460 roots.
28461
28462 @item -mrecip=@var{opt}
28463 @opindex mrecip=opt
28464 This option controls which reciprocal estimate instructions
28465 may be used. @var{opt} is a comma-separated list of options, which may
28466 be preceded by a @code{!} to invert the option:
28467
28468 @table @samp
28469
28470 @item all
28471 Enable all estimate instructions.
28472
28473 @item default
28474 Enable the default instructions, equivalent to @option{-mrecip}.
28475
28476 @item none
28477 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28478
28479 @item div
28480 Enable the reciprocal approximation instructions for both
28481 single and double precision.
28482
28483 @item divf
28484 Enable the single-precision reciprocal approximation instructions.
28485
28486 @item divd
28487 Enable the double-precision reciprocal approximation instructions.
28488
28489 @item rsqrt
28490 Enable the reciprocal square root approximation instructions for both
28491 single and double precision.
28492
28493 @item rsqrtf
28494 Enable the single-precision reciprocal square root approximation instructions.
28495
28496 @item rsqrtd
28497 Enable the double-precision reciprocal square root approximation instructions.
28498
28499 @end table
28500
28501 So, for example, @option{-mrecip=all,!rsqrtd} enables
28502 all of the reciprocal estimate instructions, except for the
28503 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
28504 which handle the double-precision reciprocal square root calculations.
28505
28506 @item -mrecip-precision
28507 @itemx -mno-recip-precision
28508 @opindex mrecip-precision
28509 Assume (do not assume) that the reciprocal estimate instructions
28510 provide higher-precision estimates than is mandated by the PowerPC
28511 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
28512 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
28513 The double-precision square root estimate instructions are not generated by
28514 default on low-precision machines, since they do not provide an
28515 estimate that converges after three steps.
28516
28517 @item -mveclibabi=@var{type}
28518 @opindex mveclibabi
28519 Specifies the ABI type to use for vectorizing intrinsics using an
28520 external library. The only type supported at present is @samp{mass},
28521 which specifies to use IBM's Mathematical Acceleration Subsystem
28522 (MASS) libraries for vectorizing intrinsics using external libraries.
28523 GCC currently emits calls to @code{acosd2}, @code{acosf4},
28524 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
28525 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
28526 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
28527 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
28528 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
28529 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
28530 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
28531 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
28532 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
28533 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
28534 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
28535 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
28536 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
28537 for power7. Both @option{-ftree-vectorize} and
28538 @option{-funsafe-math-optimizations} must also be enabled. The MASS
28539 libraries must be specified at link time.
28540
28541 @item -mfriz
28542 @itemx -mno-friz
28543 @opindex mfriz
28544 Generate (do not generate) the @code{friz} instruction when the
28545 @option{-funsafe-math-optimizations} option is used to optimize
28546 rounding of floating-point values to 64-bit integer and back to floating
28547 point. The @code{friz} instruction does not return the same value if
28548 the floating-point number is too large to fit in an integer.
28549
28550 @item -mpointers-to-nested-functions
28551 @itemx -mno-pointers-to-nested-functions
28552 @opindex mpointers-to-nested-functions
28553 Generate (do not generate) code to load up the static chain register
28554 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
28555 systems where a function pointer points to a 3-word descriptor giving
28556 the function address, TOC value to be loaded in register @code{r2}, and
28557 static chain value to be loaded in register @code{r11}. The
28558 @option{-mpointers-to-nested-functions} is on by default. You cannot
28559 call through pointers to nested functions or pointers
28560 to functions compiled in other languages that use the static chain if
28561 you use @option{-mno-pointers-to-nested-functions}.
28562
28563 @item -msave-toc-indirect
28564 @itemx -mno-save-toc-indirect
28565 @opindex msave-toc-indirect
28566 Generate (do not generate) code to save the TOC value in the reserved
28567 stack location in the function prologue if the function calls through
28568 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
28569 saved in the prologue, it is saved just before the call through the
28570 pointer. The @option{-mno-save-toc-indirect} option is the default.
28571
28572 @item -mcompat-align-parm
28573 @itemx -mno-compat-align-parm
28574 @opindex mcompat-align-parm
28575 Generate (do not generate) code to pass structure parameters with a
28576 maximum alignment of 64 bits, for compatibility with older versions
28577 of GCC.
28578
28579 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
28580 structure parameter on a 128-bit boundary when that structure contained
28581 a member requiring 128-bit alignment. This is corrected in more
28582 recent versions of GCC. This option may be used to generate code
28583 that is compatible with functions compiled with older versions of
28584 GCC.
28585
28586 The @option{-mno-compat-align-parm} option is the default.
28587
28588 @item -mstack-protector-guard=@var{guard}
28589 @itemx -mstack-protector-guard-reg=@var{reg}
28590 @itemx -mstack-protector-guard-offset=@var{offset}
28591 @itemx -mstack-protector-guard-symbol=@var{symbol}
28592 @opindex mstack-protector-guard
28593 @opindex mstack-protector-guard-reg
28594 @opindex mstack-protector-guard-offset
28595 @opindex mstack-protector-guard-symbol
28596 Generate stack protection code using canary at @var{guard}. Supported
28597 locations are @samp{global} for global canary or @samp{tls} for per-thread
28598 canary in the TLS block (the default with GNU libc version 2.4 or later).
28599
28600 With the latter choice the options
28601 @option{-mstack-protector-guard-reg=@var{reg}} and
28602 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28603 which register to use as base register for reading the canary, and from what
28604 offset from that base register. The default for those is as specified in the
28605 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
28606 the offset with a symbol reference to a canary in the TLS block.
28607
28608 @item -mpcrel
28609 @itemx -mno-pcrel
28610 @opindex mpcrel
28611 @opindex mno-pcrel
28612 Generate (do not generate) pc-relative addressing when the option
28613 @option{-mcpu=future} is used. The @option{-mpcrel} option requires
28614 that the medium code model (@option{-mcmodel=medium}) and prefixed
28615 addressing (@option{-mprefixed}) options are enabled.
28616
28617 @item -mprefixed
28618 @itemx -mno-prefixed
28619 @opindex mprefixed
28620 @opindex mno-prefixed
28621 Generate (do not generate) addressing modes using prefixed load and
28622 store instructions when the option @option{-mcpu=future} is used.
28623
28624 @item -mmma
28625 @itemx -mno-mma
28626 @opindex mmma
28627 @opindex mno-mma
28628 Generate (do not generate) the MMA instructions when the option
28629 @option{-mcpu=future} is used.
28630
28631 @item -mrop-protect
28632 @itemx -mno-rop-protect
28633 @opindex mrop-protect
28634 @opindex mno-rop-protect
28635 Generate (do not generate) ROP protection instructions when the target
28636 processor supports them. Currently this option disables the shrink-wrap
28637 optimization (@option{-fshrink-wrap}).
28638
28639 @item -mprivileged
28640 @itemx -mno-privileged
28641 @opindex mprivileged
28642 @opindex mno-privileged
28643 Generate (do not generate) code that will run in privileged state.
28644
28645 @item -mblock-ops-unaligned-vsx
28646 @itemx -mno-block-ops-unaligned-vsx
28647 @opindex block-ops-unaligned-vsx
28648 @opindex no-block-ops-unaligned-vsx
28649 Generate (do not generate) unaligned vsx loads and stores for
28650 inline expansion of @code{memcpy} and @code{memmove}.
28651 @end table
28652
28653 @node RX Options
28654 @subsection RX Options
28655 @cindex RX Options
28656
28657 These command-line options are defined for RX targets:
28658
28659 @table @gcctabopt
28660 @item -m64bit-doubles
28661 @itemx -m32bit-doubles
28662 @opindex m64bit-doubles
28663 @opindex m32bit-doubles
28664 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28665 or 32 bits (@option{-m32bit-doubles}) in size. The default is
28666 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
28667 works on 32-bit values, which is why the default is
28668 @option{-m32bit-doubles}.
28669
28670 @item -fpu
28671 @itemx -nofpu
28672 @opindex fpu
28673 @opindex nofpu
28674 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
28675 floating-point hardware. The default is enabled for the RX600
28676 series and disabled for the RX200 series.
28677
28678 Floating-point instructions are only generated for 32-bit floating-point
28679 values, however, so the FPU hardware is not used for doubles if the
28680 @option{-m64bit-doubles} option is used.
28681
28682 @emph{Note} If the @option{-fpu} option is enabled then
28683 @option{-funsafe-math-optimizations} is also enabled automatically.
28684 This is because the RX FPU instructions are themselves unsafe.
28685
28686 @item -mcpu=@var{name}
28687 @opindex mcpu
28688 Selects the type of RX CPU to be targeted. Currently three types are
28689 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
28690 the specific @samp{RX610} CPU. The default is @samp{RX600}.
28691
28692 The only difference between @samp{RX600} and @samp{RX610} is that the
28693 @samp{RX610} does not support the @code{MVTIPL} instruction.
28694
28695 The @samp{RX200} series does not have a hardware floating-point unit
28696 and so @option{-nofpu} is enabled by default when this type is
28697 selected.
28698
28699 @item -mbig-endian-data
28700 @itemx -mlittle-endian-data
28701 @opindex mbig-endian-data
28702 @opindex mlittle-endian-data
28703 Store data (but not code) in the big-endian format. The default is
28704 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
28705 format.
28706
28707 @item -msmall-data-limit=@var{N}
28708 @opindex msmall-data-limit
28709 Specifies the maximum size in bytes of global and static variables
28710 which can be placed into the small data area. Using the small data
28711 area can lead to smaller and faster code, but the size of area is
28712 limited and it is up to the programmer to ensure that the area does
28713 not overflow. Also when the small data area is used one of the RX's
28714 registers (usually @code{r13}) is reserved for use pointing to this
28715 area, so it is no longer available for use by the compiler. This
28716 could result in slower and/or larger code if variables are pushed onto
28717 the stack instead of being held in this register.
28718
28719 Note, common variables (variables that have not been initialized) and
28720 constants are not placed into the small data area as they are assigned
28721 to other sections in the output executable.
28722
28723 The default value is zero, which disables this feature. Note, this
28724 feature is not enabled by default with higher optimization levels
28725 (@option{-O2} etc) because of the potentially detrimental effects of
28726 reserving a register. It is up to the programmer to experiment and
28727 discover whether this feature is of benefit to their program. See the
28728 description of the @option{-mpid} option for a description of how the
28729 actual register to hold the small data area pointer is chosen.
28730
28731 @item -msim
28732 @itemx -mno-sim
28733 @opindex msim
28734 @opindex mno-sim
28735 Use the simulator runtime. The default is to use the libgloss
28736 board-specific runtime.
28737
28738 @item -mas100-syntax
28739 @itemx -mno-as100-syntax
28740 @opindex mas100-syntax
28741 @opindex mno-as100-syntax
28742 When generating assembler output use a syntax that is compatible with
28743 Renesas's AS100 assembler. This syntax can also be handled by the GAS
28744 assembler, but it has some restrictions so it is not generated by default.
28745
28746 @item -mmax-constant-size=@var{N}
28747 @opindex mmax-constant-size
28748 Specifies the maximum size, in bytes, of a constant that can be used as
28749 an operand in a RX instruction. Although the RX instruction set does
28750 allow constants of up to 4 bytes in length to be used in instructions,
28751 a longer value equates to a longer instruction. Thus in some
28752 circumstances it can be beneficial to restrict the size of constants
28753 that are used in instructions. Constants that are too big are instead
28754 placed into a constant pool and referenced via register indirection.
28755
28756 The value @var{N} can be between 0 and 4. A value of 0 (the default)
28757 or 4 means that constants of any size are allowed.
28758
28759 @item -mrelax
28760 @opindex mrelax
28761 Enable linker relaxation. Linker relaxation is a process whereby the
28762 linker attempts to reduce the size of a program by finding shorter
28763 versions of various instructions. Disabled by default.
28764
28765 @item -mint-register=@var{N}
28766 @opindex mint-register
28767 Specify the number of registers to reserve for fast interrupt handler
28768 functions. The value @var{N} can be between 0 and 4. A value of 1
28769 means that register @code{r13} is reserved for the exclusive use
28770 of fast interrupt handlers. A value of 2 reserves @code{r13} and
28771 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
28772 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
28773 A value of 0, the default, does not reserve any registers.
28774
28775 @item -msave-acc-in-interrupts
28776 @opindex msave-acc-in-interrupts
28777 Specifies that interrupt handler functions should preserve the
28778 accumulator register. This is only necessary if normal code might use
28779 the accumulator register, for example because it performs 64-bit
28780 multiplications. The default is to ignore the accumulator as this
28781 makes the interrupt handlers faster.
28782
28783 @item -mpid
28784 @itemx -mno-pid
28785 @opindex mpid
28786 @opindex mno-pid
28787 Enables the generation of position independent data. When enabled any
28788 access to constant data is done via an offset from a base address
28789 held in a register. This allows the location of constant data to be
28790 determined at run time without requiring the executable to be
28791 relocated, which is a benefit to embedded applications with tight
28792 memory constraints. Data that can be modified is not affected by this
28793 option.
28794
28795 Note, using this feature reserves a register, usually @code{r13}, for
28796 the constant data base address. This can result in slower and/or
28797 larger code, especially in complicated functions.
28798
28799 The actual register chosen to hold the constant data base address
28800 depends upon whether the @option{-msmall-data-limit} and/or the
28801 @option{-mint-register} command-line options are enabled. Starting
28802 with register @code{r13} and proceeding downwards, registers are
28803 allocated first to satisfy the requirements of @option{-mint-register},
28804 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
28805 is possible for the small data area register to be @code{r8} if both
28806 @option{-mint-register=4} and @option{-mpid} are specified on the
28807 command line.
28808
28809 By default this feature is not enabled. The default can be restored
28810 via the @option{-mno-pid} command-line option.
28811
28812 @item -mno-warn-multiple-fast-interrupts
28813 @itemx -mwarn-multiple-fast-interrupts
28814 @opindex mno-warn-multiple-fast-interrupts
28815 @opindex mwarn-multiple-fast-interrupts
28816 Prevents GCC from issuing a warning message if it finds more than one
28817 fast interrupt handler when it is compiling a file. The default is to
28818 issue a warning for each extra fast interrupt handler found, as the RX
28819 only supports one such interrupt.
28820
28821 @item -mallow-string-insns
28822 @itemx -mno-allow-string-insns
28823 @opindex mallow-string-insns
28824 @opindex mno-allow-string-insns
28825 Enables or disables the use of the string manipulation instructions
28826 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
28827 @code{SWHILE} and also the @code{RMPA} instruction. These
28828 instructions may prefetch data, which is not safe to do if accessing
28829 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
28830 for more information).
28831
28832 The default is to allow these instructions, but it is not possible for
28833 GCC to reliably detect all circumstances where a string instruction
28834 might be used to access an I/O register, so their use cannot be
28835 disabled automatically. Instead it is reliant upon the programmer to
28836 use the @option{-mno-allow-string-insns} option if their program
28837 accesses I/O space.
28838
28839 When the instructions are enabled GCC defines the C preprocessor
28840 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
28841 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
28842
28843 @item -mjsr
28844 @itemx -mno-jsr
28845 @opindex mjsr
28846 @opindex mno-jsr
28847 Use only (or not only) @code{JSR} instructions to access functions.
28848 This option can be used when code size exceeds the range of @code{BSR}
28849 instructions. Note that @option{-mno-jsr} does not mean to not use
28850 @code{JSR} but instead means that any type of branch may be used.
28851 @end table
28852
28853 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
28854 has special significance to the RX port when used with the
28855 @code{interrupt} function attribute. This attribute indicates a
28856 function intended to process fast interrupts. GCC ensures
28857 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
28858 and/or @code{r13} and only provided that the normal use of the
28859 corresponding registers have been restricted via the
28860 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
28861 options.
28862
28863 @node S/390 and zSeries Options
28864 @subsection S/390 and zSeries Options
28865 @cindex S/390 and zSeries Options
28866
28867 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
28868
28869 @table @gcctabopt
28870 @item -mhard-float
28871 @itemx -msoft-float
28872 @opindex mhard-float
28873 @opindex msoft-float
28874 Use (do not use) the hardware floating-point instructions and registers
28875 for floating-point operations. When @option{-msoft-float} is specified,
28876 functions in @file{libgcc.a} are used to perform floating-point
28877 operations. When @option{-mhard-float} is specified, the compiler
28878 generates IEEE floating-point instructions. This is the default.
28879
28880 @item -mhard-dfp
28881 @itemx -mno-hard-dfp
28882 @opindex mhard-dfp
28883 @opindex mno-hard-dfp
28884 Use (do not use) the hardware decimal-floating-point instructions for
28885 decimal-floating-point operations. When @option{-mno-hard-dfp} is
28886 specified, functions in @file{libgcc.a} are used to perform
28887 decimal-floating-point operations. When @option{-mhard-dfp} is
28888 specified, the compiler generates decimal-floating-point hardware
28889 instructions. This is the default for @option{-march=z9-ec} or higher.
28890
28891 @item -mlong-double-64
28892 @itemx -mlong-double-128
28893 @opindex mlong-double-64
28894 @opindex mlong-double-128
28895 These switches control the size of @code{long double} type. A size
28896 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28897 type. This is the default.
28898
28899 @item -mbackchain
28900 @itemx -mno-backchain
28901 @opindex mbackchain
28902 @opindex mno-backchain
28903 Store (do not store) the address of the caller's frame as backchain pointer
28904 into the callee's stack frame.
28905 A backchain may be needed to allow debugging using tools that do not understand
28906 DWARF call frame information.
28907 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
28908 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
28909 the backchain is placed into the topmost word of the 96/160 byte register
28910 save area.
28911
28912 In general, code compiled with @option{-mbackchain} is call-compatible with
28913 code compiled with @option{-mno-backchain}; however, use of the backchain
28914 for debugging purposes usually requires that the whole binary is built with
28915 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
28916 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
28917 to build a linux kernel use @option{-msoft-float}.
28918
28919 The default is to not maintain the backchain.
28920
28921 @item -mpacked-stack
28922 @itemx -mno-packed-stack
28923 @opindex mpacked-stack
28924 @opindex mno-packed-stack
28925 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
28926 specified, the compiler uses the all fields of the 96/160 byte register save
28927 area only for their default purpose; unused fields still take up stack space.
28928 When @option{-mpacked-stack} is specified, register save slots are densely
28929 packed at the top of the register save area; unused space is reused for other
28930 purposes, allowing for more efficient use of the available stack space.
28931 However, when @option{-mbackchain} is also in effect, the topmost word of
28932 the save area is always used to store the backchain, and the return address
28933 register is always saved two words below the backchain.
28934
28935 As long as the stack frame backchain is not used, code generated with
28936 @option{-mpacked-stack} is call-compatible with code generated with
28937 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
28938 S/390 or zSeries generated code that uses the stack frame backchain at run
28939 time, not just for debugging purposes. Such code is not call-compatible
28940 with code compiled with @option{-mpacked-stack}. Also, note that the
28941 combination of @option{-mbackchain},
28942 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
28943 to build a linux kernel use @option{-msoft-float}.
28944
28945 The default is to not use the packed stack layout.
28946
28947 @item -msmall-exec
28948 @itemx -mno-small-exec
28949 @opindex msmall-exec
28950 @opindex mno-small-exec
28951 Generate (or do not generate) code using the @code{bras} instruction
28952 to do subroutine calls.
28953 This only works reliably if the total executable size does not
28954 exceed 64k. The default is to use the @code{basr} instruction instead,
28955 which does not have this limitation.
28956
28957 @item -m64
28958 @itemx -m31
28959 @opindex m64
28960 @opindex m31
28961 When @option{-m31} is specified, generate code compliant to the
28962 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
28963 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
28964 particular to generate 64-bit instructions. For the @samp{s390}
28965 targets, the default is @option{-m31}, while the @samp{s390x}
28966 targets default to @option{-m64}.
28967
28968 @item -mzarch
28969 @itemx -mesa
28970 @opindex mzarch
28971 @opindex mesa
28972 When @option{-mzarch} is specified, generate code using the
28973 instructions available on z/Architecture.
28974 When @option{-mesa} is specified, generate code using the
28975 instructions available on ESA/390. Note that @option{-mesa} is
28976 not possible with @option{-m64}.
28977 When generating code compliant to the GNU/Linux for S/390 ABI,
28978 the default is @option{-mesa}. When generating code compliant
28979 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
28980
28981 @item -mhtm
28982 @itemx -mno-htm
28983 @opindex mhtm
28984 @opindex mno-htm
28985 The @option{-mhtm} option enables a set of builtins making use of
28986 instructions available with the transactional execution facility
28987 introduced with the IBM zEnterprise EC12 machine generation
28988 @ref{S/390 System z Built-in Functions}.
28989 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
28990
28991 @item -mvx
28992 @itemx -mno-vx
28993 @opindex mvx
28994 @opindex mno-vx
28995 When @option{-mvx} is specified, generate code using the instructions
28996 available with the vector extension facility introduced with the IBM
28997 z13 machine generation.
28998 This option changes the ABI for some vector type values with regard to
28999 alignment and calling conventions. In case vector type values are
29000 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
29001 command will be added to mark the resulting binary with the ABI used.
29002 @option{-mvx} is enabled by default when using @option{-march=z13}.
29003
29004 @item -mzvector
29005 @itemx -mno-zvector
29006 @opindex mzvector
29007 @opindex mno-zvector
29008 The @option{-mzvector} option enables vector language extensions and
29009 builtins using instructions available with the vector extension
29010 facility introduced with the IBM z13 machine generation.
29011 This option adds support for @samp{vector} to be used as a keyword to
29012 define vector type variables and arguments. @samp{vector} is only
29013 available when GNU extensions are enabled. It will not be expanded
29014 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
29015 In addition to the GCC low-level builtins @option{-mzvector} enables
29016 a set of builtins added for compatibility with AltiVec-style
29017 implementations like Power and Cell. In order to make use of these
29018 builtins the header file @file{vecintrin.h} needs to be included.
29019 @option{-mzvector} is disabled by default.
29020
29021 @item -mmvcle
29022 @itemx -mno-mvcle
29023 @opindex mmvcle
29024 @opindex mno-mvcle
29025 Generate (or do not generate) code using the @code{mvcle} instruction
29026 to perform block moves. When @option{-mno-mvcle} is specified,
29027 use a @code{mvc} loop instead. This is the default unless optimizing for
29028 size.
29029
29030 @item -mdebug
29031 @itemx -mno-debug
29032 @opindex mdebug
29033 @opindex mno-debug
29034 Print (or do not print) additional debug information when compiling.
29035 The default is to not print debug information.
29036
29037 @item -march=@var{cpu-type}
29038 @opindex march
29039 Generate code that runs on @var{cpu-type}, which is the name of a
29040 system representing a certain processor type. Possible values for
29041 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
29042 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
29043 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
29044 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
29045
29046 The default is @option{-march=z900}.
29047
29048 Specifying @samp{native} as cpu type can be used to select the best
29049 architecture option for the host processor.
29050 @option{-march=native} has no effect if GCC does not recognize the
29051 processor.
29052
29053 @item -mtune=@var{cpu-type}
29054 @opindex mtune
29055 Tune to @var{cpu-type} everything applicable about the generated code,
29056 except for the ABI and the set of available instructions.
29057 The list of @var{cpu-type} values is the same as for @option{-march}.
29058 The default is the value used for @option{-march}.
29059
29060 @item -mtpf-trace
29061 @itemx -mno-tpf-trace
29062 @opindex mtpf-trace
29063 @opindex mno-tpf-trace
29064 Generate code that adds (does not add) in TPF OS specific branches to trace
29065 routines in the operating system. This option is off by default, even
29066 when compiling for the TPF OS@.
29067
29068 @item -mtpf-trace-skip
29069 @itemx -mno-tpf-trace-skip
29070 @opindex mtpf-trace-skip
29071 @opindex mno-tpf-trace-skip
29072 Generate code that changes (does not change) the default branch
29073 targets enabled by @option{-mtpf-trace} to point to specialized trace
29074 routines providing the ability of selectively skipping function trace
29075 entries for the TPF OS. This option is off by default, even when
29076 compiling for the TPF OS and specifying @option{-mtpf-trace}.
29077
29078 @item -mfused-madd
29079 @itemx -mno-fused-madd
29080 @opindex mfused-madd
29081 @opindex mno-fused-madd
29082 Generate code that uses (does not use) the floating-point multiply and
29083 accumulate instructions. These instructions are generated by default if
29084 hardware floating point is used.
29085
29086 @item -mwarn-framesize=@var{framesize}
29087 @opindex mwarn-framesize
29088 Emit a warning if the current function exceeds the given frame size. Because
29089 this is a compile-time check it doesn't need to be a real problem when the program
29090 runs. It is intended to identify functions that most probably cause
29091 a stack overflow. It is useful to be used in an environment with limited stack
29092 size e.g.@: the linux kernel.
29093
29094 @item -mwarn-dynamicstack
29095 @opindex mwarn-dynamicstack
29096 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
29097 arrays. This is generally a bad idea with a limited stack size.
29098
29099 @item -mstack-guard=@var{stack-guard}
29100 @itemx -mstack-size=@var{stack-size}
29101 @opindex mstack-guard
29102 @opindex mstack-size
29103 If these options are provided the S/390 back end emits additional instructions in
29104 the function prologue that trigger a trap if the stack size is @var{stack-guard}
29105 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
29106 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
29107 the frame size of the compiled function is chosen.
29108 These options are intended to be used to help debugging stack overflow problems.
29109 The additionally emitted code causes only little overhead and hence can also be
29110 used in production-like systems without greater performance degradation. The given
29111 values have to be exact powers of 2 and @var{stack-size} has to be greater than
29112 @var{stack-guard} without exceeding 64k.
29113 In order to be efficient the extra code makes the assumption that the stack starts
29114 at an address aligned to the value given by @var{stack-size}.
29115 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
29116
29117 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
29118 @opindex mhotpatch
29119 If the hotpatch option is enabled, a ``hot-patching'' function
29120 prologue is generated for all functions in the compilation unit.
29121 The funtion label is prepended with the given number of two-byte
29122 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
29123 the label, 2 * @var{post-halfwords} bytes are appended, using the
29124 largest NOP like instructions the architecture allows (maximum
29125 1000000).
29126
29127 If both arguments are zero, hotpatching is disabled.
29128
29129 This option can be overridden for individual functions with the
29130 @code{hotpatch} attribute.
29131 @end table
29132
29133 @node Score Options
29134 @subsection Score Options
29135 @cindex Score Options
29136
29137 These options are defined for Score implementations:
29138
29139 @table @gcctabopt
29140 @item -meb
29141 @opindex meb
29142 Compile code for big-endian mode. This is the default.
29143
29144 @item -mel
29145 @opindex mel
29146 Compile code for little-endian mode.
29147
29148 @item -mnhwloop
29149 @opindex mnhwloop
29150 Disable generation of @code{bcnz} instructions.
29151
29152 @item -muls
29153 @opindex muls
29154 Enable generation of unaligned load and store instructions.
29155
29156 @item -mmac
29157 @opindex mmac
29158 Enable the use of multiply-accumulate instructions. Disabled by default.
29159
29160 @item -mscore5
29161 @opindex mscore5
29162 Specify the SCORE5 as the target architecture.
29163
29164 @item -mscore5u
29165 @opindex mscore5u
29166 Specify the SCORE5U of the target architecture.
29167
29168 @item -mscore7
29169 @opindex mscore7
29170 Specify the SCORE7 as the target architecture. This is the default.
29171
29172 @item -mscore7d
29173 @opindex mscore7d
29174 Specify the SCORE7D as the target architecture.
29175 @end table
29176
29177 @node SH Options
29178 @subsection SH Options
29179
29180 These @samp{-m} options are defined for the SH implementations:
29181
29182 @table @gcctabopt
29183 @item -m1
29184 @opindex m1
29185 Generate code for the SH1.
29186
29187 @item -m2
29188 @opindex m2
29189 Generate code for the SH2.
29190
29191 @item -m2e
29192 Generate code for the SH2e.
29193
29194 @item -m2a-nofpu
29195 @opindex m2a-nofpu
29196 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
29197 that the floating-point unit is not used.
29198
29199 @item -m2a-single-only
29200 @opindex m2a-single-only
29201 Generate code for the SH2a-FPU, in such a way that no double-precision
29202 floating-point operations are used.
29203
29204 @item -m2a-single
29205 @opindex m2a-single
29206 Generate code for the SH2a-FPU assuming the floating-point unit is in
29207 single-precision mode by default.
29208
29209 @item -m2a
29210 @opindex m2a
29211 Generate code for the SH2a-FPU assuming the floating-point unit is in
29212 double-precision mode by default.
29213
29214 @item -m3
29215 @opindex m3
29216 Generate code for the SH3.
29217
29218 @item -m3e
29219 @opindex m3e
29220 Generate code for the SH3e.
29221
29222 @item -m4-nofpu
29223 @opindex m4-nofpu
29224 Generate code for the SH4 without a floating-point unit.
29225
29226 @item -m4-single-only
29227 @opindex m4-single-only
29228 Generate code for the SH4 with a floating-point unit that only
29229 supports single-precision arithmetic.
29230
29231 @item -m4-single
29232 @opindex m4-single
29233 Generate code for the SH4 assuming the floating-point unit is in
29234 single-precision mode by default.
29235
29236 @item -m4
29237 @opindex m4
29238 Generate code for the SH4.
29239
29240 @item -m4-100
29241 @opindex m4-100
29242 Generate code for SH4-100.
29243
29244 @item -m4-100-nofpu
29245 @opindex m4-100-nofpu
29246 Generate code for SH4-100 in such a way that the
29247 floating-point unit is not used.
29248
29249 @item -m4-100-single
29250 @opindex m4-100-single
29251 Generate code for SH4-100 assuming the floating-point unit is in
29252 single-precision mode by default.
29253
29254 @item -m4-100-single-only
29255 @opindex m4-100-single-only
29256 Generate code for SH4-100 in such a way that no double-precision
29257 floating-point operations are used.
29258
29259 @item -m4-200
29260 @opindex m4-200
29261 Generate code for SH4-200.
29262
29263 @item -m4-200-nofpu
29264 @opindex m4-200-nofpu
29265 Generate code for SH4-200 without in such a way that the
29266 floating-point unit is not used.
29267
29268 @item -m4-200-single
29269 @opindex m4-200-single
29270 Generate code for SH4-200 assuming the floating-point unit is in
29271 single-precision mode by default.
29272
29273 @item -m4-200-single-only
29274 @opindex m4-200-single-only
29275 Generate code for SH4-200 in such a way that no double-precision
29276 floating-point operations are used.
29277
29278 @item -m4-300
29279 @opindex m4-300
29280 Generate code for SH4-300.
29281
29282 @item -m4-300-nofpu
29283 @opindex m4-300-nofpu
29284 Generate code for SH4-300 without in such a way that the
29285 floating-point unit is not used.
29286
29287 @item -m4-300-single
29288 @opindex m4-300-single
29289 Generate code for SH4-300 in such a way that no double-precision
29290 floating-point operations are used.
29291
29292 @item -m4-300-single-only
29293 @opindex m4-300-single-only
29294 Generate code for SH4-300 in such a way that no double-precision
29295 floating-point operations are used.
29296
29297 @item -m4-340
29298 @opindex m4-340
29299 Generate code for SH4-340 (no MMU, no FPU).
29300
29301 @item -m4-500
29302 @opindex m4-500
29303 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
29304 assembler.
29305
29306 @item -m4a-nofpu
29307 @opindex m4a-nofpu
29308 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
29309 floating-point unit is not used.
29310
29311 @item -m4a-single-only
29312 @opindex m4a-single-only
29313 Generate code for the SH4a, in such a way that no double-precision
29314 floating-point operations are used.
29315
29316 @item -m4a-single
29317 @opindex m4a-single
29318 Generate code for the SH4a assuming the floating-point unit is in
29319 single-precision mode by default.
29320
29321 @item -m4a
29322 @opindex m4a
29323 Generate code for the SH4a.
29324
29325 @item -m4al
29326 @opindex m4al
29327 Same as @option{-m4a-nofpu}, except that it implicitly passes
29328 @option{-dsp} to the assembler. GCC doesn't generate any DSP
29329 instructions at the moment.
29330
29331 @item -mb
29332 @opindex mb
29333 Compile code for the processor in big-endian mode.
29334
29335 @item -ml
29336 @opindex ml
29337 Compile code for the processor in little-endian mode.
29338
29339 @item -mdalign
29340 @opindex mdalign
29341 Align doubles at 64-bit boundaries. Note that this changes the calling
29342 conventions, and thus some functions from the standard C library do
29343 not work unless you recompile it first with @option{-mdalign}.
29344
29345 @item -mrelax
29346 @opindex mrelax
29347 Shorten some address references at link time, when possible; uses the
29348 linker option @option{-relax}.
29349
29350 @item -mbigtable
29351 @opindex mbigtable
29352 Use 32-bit offsets in @code{switch} tables. The default is to use
29353 16-bit offsets.
29354
29355 @item -mbitops
29356 @opindex mbitops
29357 Enable the use of bit manipulation instructions on SH2A.
29358
29359 @item -mfmovd
29360 @opindex mfmovd
29361 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
29362 alignment constraints.
29363
29364 @item -mrenesas
29365 @opindex mrenesas
29366 Comply with the calling conventions defined by Renesas.
29367
29368 @item -mno-renesas
29369 @opindex mno-renesas
29370 Comply with the calling conventions defined for GCC before the Renesas
29371 conventions were available. This option is the default for all
29372 targets of the SH toolchain.
29373
29374 @item -mnomacsave
29375 @opindex mnomacsave
29376 Mark the @code{MAC} register as call-clobbered, even if
29377 @option{-mrenesas} is given.
29378
29379 @item -mieee
29380 @itemx -mno-ieee
29381 @opindex mieee
29382 @opindex mno-ieee
29383 Control the IEEE compliance of floating-point comparisons, which affects the
29384 handling of cases where the result of a comparison is unordered. By default
29385 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
29386 enabled @option{-mno-ieee} is implicitly set, which results in faster
29387 floating-point greater-equal and less-equal comparisons. The implicit settings
29388 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
29389
29390 @item -minline-ic_invalidate
29391 @opindex minline-ic_invalidate
29392 Inline code to invalidate instruction cache entries after setting up
29393 nested function trampolines.
29394 This option has no effect if @option{-musermode} is in effect and the selected
29395 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
29396 instruction.
29397 If the selected code generation option does not allow the use of the @code{icbi}
29398 instruction, and @option{-musermode} is not in effect, the inlined code
29399 manipulates the instruction cache address array directly with an associative
29400 write. This not only requires privileged mode at run time, but it also
29401 fails if the cache line had been mapped via the TLB and has become unmapped.
29402
29403 @item -misize
29404 @opindex misize
29405 Dump instruction size and location in the assembly code.
29406
29407 @item -mpadstruct
29408 @opindex mpadstruct
29409 This option is deprecated. It pads structures to multiple of 4 bytes,
29410 which is incompatible with the SH ABI@.
29411
29412 @item -matomic-model=@var{model}
29413 @opindex matomic-model=@var{model}
29414 Sets the model of atomic operations and additional parameters as a comma
29415 separated list. For details on the atomic built-in functions see
29416 @ref{__atomic Builtins}. The following models and parameters are supported:
29417
29418 @table @samp
29419
29420 @item none
29421 Disable compiler generated atomic sequences and emit library calls for atomic
29422 operations. This is the default if the target is not @code{sh*-*-linux*}.
29423
29424 @item soft-gusa
29425 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
29426 built-in functions. The generated atomic sequences require additional support
29427 from the interrupt/exception handling code of the system and are only suitable
29428 for SH3* and SH4* single-core systems. This option is enabled by default when
29429 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
29430 this option also partially utilizes the hardware atomic instructions
29431 @code{movli.l} and @code{movco.l} to create more efficient code, unless
29432 @samp{strict} is specified.
29433
29434 @item soft-tcb
29435 Generate software atomic sequences that use a variable in the thread control
29436 block. This is a variation of the gUSA sequences which can also be used on
29437 SH1* and SH2* targets. The generated atomic sequences require additional
29438 support from the interrupt/exception handling code of the system and are only
29439 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
29440 parameter has to be specified as well.
29441
29442 @item soft-imask
29443 Generate software atomic sequences that temporarily disable interrupts by
29444 setting @code{SR.IMASK = 1111}. This model works only when the program runs
29445 in privileged mode and is only suitable for single-core systems. Additional
29446 support from the interrupt/exception handling code of the system is not
29447 required. This model is enabled by default when the target is
29448 @code{sh*-*-linux*} and SH1* or SH2*.
29449
29450 @item hard-llcs
29451 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
29452 instructions only. This is only available on SH4A and is suitable for
29453 multi-core systems. Since the hardware instructions support only 32 bit atomic
29454 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
29455 Code compiled with this option is also compatible with other software
29456 atomic model interrupt/exception handling systems if executed on an SH4A
29457 system. Additional support from the interrupt/exception handling code of the
29458 system is not required for this model.
29459
29460 @item gbr-offset=
29461 This parameter specifies the offset in bytes of the variable in the thread
29462 control block structure that should be used by the generated atomic sequences
29463 when the @samp{soft-tcb} model has been selected. For other models this
29464 parameter is ignored. The specified value must be an integer multiple of four
29465 and in the range 0-1020.
29466
29467 @item strict
29468 This parameter prevents mixed usage of multiple atomic models, even if they
29469 are compatible, and makes the compiler generate atomic sequences of the
29470 specified model only.
29471
29472 @end table
29473
29474 @item -mtas
29475 @opindex mtas
29476 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
29477 Notice that depending on the particular hardware and software configuration
29478 this can degrade overall performance due to the operand cache line flushes
29479 that are implied by the @code{tas.b} instruction. On multi-core SH4A
29480 processors the @code{tas.b} instruction must be used with caution since it
29481 can result in data corruption for certain cache configurations.
29482
29483 @item -mprefergot
29484 @opindex mprefergot
29485 When generating position-independent code, emit function calls using
29486 the Global Offset Table instead of the Procedure Linkage Table.
29487
29488 @item -musermode
29489 @itemx -mno-usermode
29490 @opindex musermode
29491 @opindex mno-usermode
29492 Don't allow (allow) the compiler generating privileged mode code. Specifying
29493 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
29494 inlined code would not work in user mode. @option{-musermode} is the default
29495 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
29496 @option{-musermode} has no effect, since there is no user mode.
29497
29498 @item -multcost=@var{number}
29499 @opindex multcost=@var{number}
29500 Set the cost to assume for a multiply insn.
29501
29502 @item -mdiv=@var{strategy}
29503 @opindex mdiv=@var{strategy}
29504 Set the division strategy to be used for integer division operations.
29505 @var{strategy} can be one of:
29506
29507 @table @samp
29508
29509 @item call-div1
29510 Calls a library function that uses the single-step division instruction
29511 @code{div1} to perform the operation. Division by zero calculates an
29512 unspecified result and does not trap. This is the default except for SH4,
29513 SH2A and SHcompact.
29514
29515 @item call-fp
29516 Calls a library function that performs the operation in double precision
29517 floating point. Division by zero causes a floating-point exception. This is
29518 the default for SHcompact with FPU. Specifying this for targets that do not
29519 have a double precision FPU defaults to @code{call-div1}.
29520
29521 @item call-table
29522 Calls a library function that uses a lookup table for small divisors and
29523 the @code{div1} instruction with case distinction for larger divisors. Division
29524 by zero calculates an unspecified result and does not trap. This is the default
29525 for SH4. Specifying this for targets that do not have dynamic shift
29526 instructions defaults to @code{call-div1}.
29527
29528 @end table
29529
29530 When a division strategy has not been specified the default strategy is
29531 selected based on the current target. For SH2A the default strategy is to
29532 use the @code{divs} and @code{divu} instructions instead of library function
29533 calls.
29534
29535 @item -maccumulate-outgoing-args
29536 @opindex maccumulate-outgoing-args
29537 Reserve space once for outgoing arguments in the function prologue rather
29538 than around each call. Generally beneficial for performance and size. Also
29539 needed for unwinding to avoid changing the stack frame around conditional code.
29540
29541 @item -mdivsi3_libfunc=@var{name}
29542 @opindex mdivsi3_libfunc=@var{name}
29543 Set the name of the library function used for 32-bit signed division to
29544 @var{name}.
29545 This only affects the name used in the @samp{call} division strategies, and
29546 the compiler still expects the same sets of input/output/clobbered registers as
29547 if this option were not present.
29548
29549 @item -mfixed-range=@var{register-range}
29550 @opindex mfixed-range
29551 Generate code treating the given register range as fixed registers.
29552 A fixed register is one that the register allocator cannot use. This is
29553 useful when compiling kernel code. A register range is specified as
29554 two registers separated by a dash. Multiple register ranges can be
29555 specified separated by a comma.
29556
29557 @item -mbranch-cost=@var{num}
29558 @opindex mbranch-cost=@var{num}
29559 Assume @var{num} to be the cost for a branch instruction. Higher numbers
29560 make the compiler try to generate more branch-free code if possible.
29561 If not specified the value is selected depending on the processor type that
29562 is being compiled for.
29563
29564 @item -mzdcbranch
29565 @itemx -mno-zdcbranch
29566 @opindex mzdcbranch
29567 @opindex mno-zdcbranch
29568 Assume (do not assume) that zero displacement conditional branch instructions
29569 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
29570 compiler prefers zero displacement branch code sequences. This is
29571 enabled by default when generating code for SH4 and SH4A. It can be explicitly
29572 disabled by specifying @option{-mno-zdcbranch}.
29573
29574 @item -mcbranch-force-delay-slot
29575 @opindex mcbranch-force-delay-slot
29576 Force the usage of delay slots for conditional branches, which stuffs the delay
29577 slot with a @code{nop} if a suitable instruction cannot be found. By default
29578 this option is disabled. It can be enabled to work around hardware bugs as
29579 found in the original SH7055.
29580
29581 @item -mfused-madd
29582 @itemx -mno-fused-madd
29583 @opindex mfused-madd
29584 @opindex mno-fused-madd
29585 Generate code that uses (does not use) the floating-point multiply and
29586 accumulate instructions. These instructions are generated by default
29587 if hardware floating point is used. The machine-dependent
29588 @option{-mfused-madd} option is now mapped to the machine-independent
29589 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29590 mapped to @option{-ffp-contract=off}.
29591
29592 @item -mfsca
29593 @itemx -mno-fsca
29594 @opindex mfsca
29595 @opindex mno-fsca
29596 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
29597 and cosine approximations. The option @option{-mfsca} must be used in
29598 combination with @option{-funsafe-math-optimizations}. It is enabled by default
29599 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
29600 approximations even if @option{-funsafe-math-optimizations} is in effect.
29601
29602 @item -mfsrra
29603 @itemx -mno-fsrra
29604 @opindex mfsrra
29605 @opindex mno-fsrra
29606 Allow or disallow the compiler to emit the @code{fsrra} instruction for
29607 reciprocal square root approximations. The option @option{-mfsrra} must be used
29608 in combination with @option{-funsafe-math-optimizations} and
29609 @option{-ffinite-math-only}. It is enabled by default when generating code for
29610 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
29611 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
29612 in effect.
29613
29614 @item -mpretend-cmove
29615 @opindex mpretend-cmove
29616 Prefer zero-displacement conditional branches for conditional move instruction
29617 patterns. This can result in faster code on the SH4 processor.
29618
29619 @item -mfdpic
29620 @opindex fdpic
29621 Generate code using the FDPIC ABI.
29622
29623 @end table
29624
29625 @node Solaris 2 Options
29626 @subsection Solaris 2 Options
29627 @cindex Solaris 2 options
29628
29629 These @samp{-m} options are supported on Solaris 2:
29630
29631 @table @gcctabopt
29632 @item -mclear-hwcap
29633 @opindex mclear-hwcap
29634 @option{-mclear-hwcap} tells the compiler to remove the hardware
29635 capabilities generated by the Solaris assembler. This is only necessary
29636 when object files use ISA extensions not supported by the current
29637 machine, but check at runtime whether or not to use them.
29638
29639 @item -mimpure-text
29640 @opindex mimpure-text
29641 @option{-mimpure-text}, used in addition to @option{-shared}, tells
29642 the compiler to not pass @option{-z text} to the linker when linking a
29643 shared object. Using this option, you can link position-dependent
29644 code into a shared object.
29645
29646 @option{-mimpure-text} suppresses the ``relocations remain against
29647 allocatable but non-writable sections'' linker error message.
29648 However, the necessary relocations trigger copy-on-write, and the
29649 shared object is not actually shared across processes. Instead of
29650 using @option{-mimpure-text}, you should compile all source code with
29651 @option{-fpic} or @option{-fPIC}.
29652
29653 @end table
29654
29655 These switches are supported in addition to the above on Solaris 2:
29656
29657 @table @gcctabopt
29658 @item -pthreads
29659 @opindex pthreads
29660 This is a synonym for @option{-pthread}.
29661 @end table
29662
29663 @node SPARC Options
29664 @subsection SPARC Options
29665 @cindex SPARC options
29666
29667 These @samp{-m} options are supported on the SPARC:
29668
29669 @table @gcctabopt
29670 @item -mno-app-regs
29671 @itemx -mapp-regs
29672 @opindex mno-app-regs
29673 @opindex mapp-regs
29674 Specify @option{-mapp-regs} to generate output using the global registers
29675 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
29676 global register 1, each global register 2 through 4 is then treated as an
29677 allocable register that is clobbered by function calls. This is the default.
29678
29679 To be fully SVR4 ABI-compliant at the cost of some performance loss,
29680 specify @option{-mno-app-regs}. You should compile libraries and system
29681 software with this option.
29682
29683 @item -mflat
29684 @itemx -mno-flat
29685 @opindex mflat
29686 @opindex mno-flat
29687 With @option{-mflat}, the compiler does not generate save/restore instructions
29688 and uses a ``flat'' or single register window model. This model is compatible
29689 with the regular register window model. The local registers and the input
29690 registers (0--5) are still treated as ``call-saved'' registers and are
29691 saved on the stack as needed.
29692
29693 With @option{-mno-flat} (the default), the compiler generates save/restore
29694 instructions (except for leaf functions). This is the normal operating mode.
29695
29696 @item -mfpu
29697 @itemx -mhard-float
29698 @opindex mfpu
29699 @opindex mhard-float
29700 Generate output containing floating-point instructions. This is the
29701 default.
29702
29703 @item -mno-fpu
29704 @itemx -msoft-float
29705 @opindex mno-fpu
29706 @opindex msoft-float
29707 Generate output containing library calls for floating point.
29708 @strong{Warning:} the requisite libraries are not available for all SPARC
29709 targets. Normally the facilities of the machine's usual C compiler are
29710 used, but this cannot be done directly in cross-compilation. You must make
29711 your own arrangements to provide suitable library functions for
29712 cross-compilation. The embedded targets @samp{sparc-*-aout} and
29713 @samp{sparclite-*-*} do provide software floating-point support.
29714
29715 @option{-msoft-float} changes the calling convention in the output file;
29716 therefore, it is only useful if you compile @emph{all} of a program with
29717 this option. In particular, you need to compile @file{libgcc.a}, the
29718 library that comes with GCC, with @option{-msoft-float} in order for
29719 this to work.
29720
29721 @item -mhard-quad-float
29722 @opindex mhard-quad-float
29723 Generate output containing quad-word (long double) floating-point
29724 instructions.
29725
29726 @item -msoft-quad-float
29727 @opindex msoft-quad-float
29728 Generate output containing library calls for quad-word (long double)
29729 floating-point instructions. The functions called are those specified
29730 in the SPARC ABI@. This is the default.
29731
29732 As of this writing, there are no SPARC implementations that have hardware
29733 support for the quad-word floating-point instructions. They all invoke
29734 a trap handler for one of these instructions, and then the trap handler
29735 emulates the effect of the instruction. Because of the trap handler overhead,
29736 this is much slower than calling the ABI library routines. Thus the
29737 @option{-msoft-quad-float} option is the default.
29738
29739 @item -mno-unaligned-doubles
29740 @itemx -munaligned-doubles
29741 @opindex mno-unaligned-doubles
29742 @opindex munaligned-doubles
29743 Assume that doubles have 8-byte alignment. This is the default.
29744
29745 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
29746 alignment only if they are contained in another type, or if they have an
29747 absolute address. Otherwise, it assumes they have 4-byte alignment.
29748 Specifying this option avoids some rare compatibility problems with code
29749 generated by other compilers. It is not the default because it results
29750 in a performance loss, especially for floating-point code.
29751
29752 @item -muser-mode
29753 @itemx -mno-user-mode
29754 @opindex muser-mode
29755 @opindex mno-user-mode
29756 Do not generate code that can only run in supervisor mode. This is relevant
29757 only for the @code{casa} instruction emitted for the LEON3 processor. This
29758 is the default.
29759
29760 @item -mfaster-structs
29761 @itemx -mno-faster-structs
29762 @opindex mfaster-structs
29763 @opindex mno-faster-structs
29764 With @option{-mfaster-structs}, the compiler assumes that structures
29765 should have 8-byte alignment. This enables the use of pairs of
29766 @code{ldd} and @code{std} instructions for copies in structure
29767 assignment, in place of twice as many @code{ld} and @code{st} pairs.
29768 However, the use of this changed alignment directly violates the SPARC
29769 ABI@. Thus, it's intended only for use on targets where the developer
29770 acknowledges that their resulting code is not directly in line with
29771 the rules of the ABI@.
29772
29773 @item -mstd-struct-return
29774 @itemx -mno-std-struct-return
29775 @opindex mstd-struct-return
29776 @opindex mno-std-struct-return
29777 With @option{-mstd-struct-return}, the compiler generates checking code
29778 in functions returning structures or unions to detect size mismatches
29779 between the two sides of function calls, as per the 32-bit ABI@.
29780
29781 The default is @option{-mno-std-struct-return}. This option has no effect
29782 in 64-bit mode.
29783
29784 @item -mlra
29785 @itemx -mno-lra
29786 @opindex mlra
29787 @opindex mno-lra
29788 Enable Local Register Allocation. This is the default for SPARC since GCC 7
29789 so @option{-mno-lra} needs to be passed to get old Reload.
29790
29791 @item -mcpu=@var{cpu_type}
29792 @opindex mcpu
29793 Set the instruction set, register set, and instruction scheduling parameters
29794 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
29795 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
29796 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
29797 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
29798 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
29799 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
29800 @samp{m8}.
29801
29802 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
29803 which selects the best architecture option for the host processor.
29804 @option{-mcpu=native} has no effect if GCC does not recognize
29805 the processor.
29806
29807 Default instruction scheduling parameters are used for values that select
29808 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
29809 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
29810
29811 Here is a list of each supported architecture and their supported
29812 implementations.
29813
29814 @table @asis
29815 @item v7
29816 cypress, leon3v7
29817
29818 @item v8
29819 supersparc, hypersparc, leon, leon3, leon5
29820
29821 @item sparclite
29822 f930, f934, sparclite86x
29823
29824 @item sparclet
29825 tsc701
29826
29827 @item v9
29828 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
29829 niagara7, m8
29830 @end table
29831
29832 By default (unless configured otherwise), GCC generates code for the V7
29833 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
29834 additionally optimizes it for the Cypress CY7C602 chip, as used in the
29835 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
29836 SPARCStation 1, 2, IPX etc.
29837
29838 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
29839 architecture. The only difference from V7 code is that the compiler emits
29840 the integer multiply and integer divide instructions which exist in SPARC-V8
29841 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
29842 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
29843 2000 series.
29844
29845 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
29846 the SPARC architecture. This adds the integer multiply, integer divide step
29847 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
29848 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
29849 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
29850 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
29851 MB86934 chip, which is the more recent SPARClite with FPU@.
29852
29853 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
29854 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
29855 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
29856 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
29857 optimizes it for the TEMIC SPARClet chip.
29858
29859 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
29860 architecture. This adds 64-bit integer and floating-point move instructions,
29861 3 additional floating-point condition code registers and conditional move
29862 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
29863 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
29864 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
29865 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
29866 @option{-mcpu=niagara}, the compiler additionally optimizes it for
29867 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
29868 additionally optimizes it for Sun UltraSPARC T2 chips. With
29869 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
29870 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
29871 additionally optimizes it for Sun UltraSPARC T4 chips. With
29872 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
29873 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
29874 additionally optimizes it for Oracle M8 chips.
29875
29876 @item -mtune=@var{cpu_type}
29877 @opindex mtune
29878 Set the instruction scheduling parameters for machine type
29879 @var{cpu_type}, but do not set the instruction set or register set that the
29880 option @option{-mcpu=@var{cpu_type}} does.
29881
29882 The same values for @option{-mcpu=@var{cpu_type}} can be used for
29883 @option{-mtune=@var{cpu_type}}, but the only useful values are those
29884 that select a particular CPU implementation. Those are
29885 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
29886 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
29887 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
29888 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
29889 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
29890 and GNU/Linux toolchains, @samp{native} can also be used.
29891
29892 @item -mv8plus
29893 @itemx -mno-v8plus
29894 @opindex mv8plus
29895 @opindex mno-v8plus
29896 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
29897 difference from the V8 ABI is that the global and out registers are
29898 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
29899 mode for all SPARC-V9 processors.
29900
29901 @item -mvis
29902 @itemx -mno-vis
29903 @opindex mvis
29904 @opindex mno-vis
29905 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
29906 Visual Instruction Set extensions. The default is @option{-mno-vis}.
29907
29908 @item -mvis2
29909 @itemx -mno-vis2
29910 @opindex mvis2
29911 @opindex mno-vis2
29912 With @option{-mvis2}, GCC generates code that takes advantage of
29913 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
29914 default is @option{-mvis2} when targeting a cpu that supports such
29915 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
29916 also sets @option{-mvis}.
29917
29918 @item -mvis3
29919 @itemx -mno-vis3
29920 @opindex mvis3
29921 @opindex mno-vis3
29922 With @option{-mvis3}, GCC generates code that takes advantage of
29923 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
29924 default is @option{-mvis3} when targeting a cpu that supports such
29925 instructions, such as niagara-3 and later. Setting @option{-mvis3}
29926 also sets @option{-mvis2} and @option{-mvis}.
29927
29928 @item -mvis4
29929 @itemx -mno-vis4
29930 @opindex mvis4
29931 @opindex mno-vis4
29932 With @option{-mvis4}, GCC generates code that takes advantage of
29933 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
29934 default is @option{-mvis4} when targeting a cpu that supports such
29935 instructions, such as niagara-7 and later. Setting @option{-mvis4}
29936 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
29937
29938 @item -mvis4b
29939 @itemx -mno-vis4b
29940 @opindex mvis4b
29941 @opindex mno-vis4b
29942 With @option{-mvis4b}, GCC generates code that takes advantage of
29943 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
29944 the additional VIS instructions introduced in the Oracle SPARC
29945 Architecture 2017. The default is @option{-mvis4b} when targeting a
29946 cpu that supports such instructions, such as m8 and later. Setting
29947 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
29948 @option{-mvis2} and @option{-mvis}.
29949
29950 @item -mcbcond
29951 @itemx -mno-cbcond
29952 @opindex mcbcond
29953 @opindex mno-cbcond
29954 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
29955 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
29956 when targeting a CPU that supports such instructions, such as Niagara-4 and
29957 later.
29958
29959 @item -mfmaf
29960 @itemx -mno-fmaf
29961 @opindex mfmaf
29962 @opindex mno-fmaf
29963 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
29964 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
29965 when targeting a CPU that supports such instructions, such as Niagara-3 and
29966 later.
29967
29968 @item -mfsmuld
29969 @itemx -mno-fsmuld
29970 @opindex mfsmuld
29971 @opindex mno-fsmuld
29972 With @option{-mfsmuld}, GCC generates code that takes advantage of the
29973 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
29974 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
29975 or V9 with FPU except @option{-mcpu=leon}.
29976
29977 @item -mpopc
29978 @itemx -mno-popc
29979 @opindex mpopc
29980 @opindex mno-popc
29981 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
29982 Population Count instruction. The default is @option{-mpopc}
29983 when targeting a CPU that supports such an instruction, such as Niagara-2 and
29984 later.
29985
29986 @item -msubxc
29987 @itemx -mno-subxc
29988 @opindex msubxc
29989 @opindex mno-subxc
29990 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
29991 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
29992 when targeting a CPU that supports such an instruction, such as Niagara-7 and
29993 later.
29994
29995 @item -mfix-at697f
29996 @opindex mfix-at697f
29997 Enable the documented workaround for the single erratum of the Atmel AT697F
29998 processor (which corresponds to erratum #13 of the AT697E processor).
29999
30000 @item -mfix-ut699
30001 @opindex mfix-ut699
30002 Enable the documented workarounds for the floating-point errata and the data
30003 cache nullify errata of the UT699 processor.
30004
30005 @item -mfix-ut700
30006 @opindex mfix-ut700
30007 Enable the documented workaround for the back-to-back store errata of
30008 the UT699E/UT700 processor.
30009
30010 @item -mfix-gr712rc
30011 @opindex mfix-gr712rc
30012 Enable the documented workaround for the back-to-back store errata of
30013 the GR712RC processor.
30014 @end table
30015
30016 These @samp{-m} options are supported in addition to the above
30017 on SPARC-V9 processors in 64-bit environments:
30018
30019 @table @gcctabopt
30020 @item -m32
30021 @itemx -m64
30022 @opindex m32
30023 @opindex m64
30024 Generate code for a 32-bit or 64-bit environment.
30025 The 32-bit environment sets int, long and pointer to 32 bits.
30026 The 64-bit environment sets int to 32 bits and long and pointer
30027 to 64 bits.
30028
30029 @item -mcmodel=@var{which}
30030 @opindex mcmodel
30031 Set the code model to one of
30032
30033 @table @samp
30034 @item medlow
30035 The Medium/Low code model: 64-bit addresses, programs
30036 must be linked in the low 32 bits of memory. Programs can be statically
30037 or dynamically linked.
30038
30039 @item medmid
30040 The Medium/Middle code model: 64-bit addresses, programs
30041 must be linked in the low 44 bits of memory, the text and data segments must
30042 be less than 2GB in size and the data segment must be located within 2GB of
30043 the text segment.
30044
30045 @item medany
30046 The Medium/Anywhere code model: 64-bit addresses, programs
30047 may be linked anywhere in memory, the text and data segments must be less
30048 than 2GB in size and the data segment must be located within 2GB of the
30049 text segment.
30050
30051 @item embmedany
30052 The Medium/Anywhere code model for embedded systems:
30053 64-bit addresses, the text and data segments must be less than 2GB in
30054 size, both starting anywhere in memory (determined at link time). The
30055 global register %g4 points to the base of the data segment. Programs
30056 are statically linked and PIC is not supported.
30057 @end table
30058
30059 @item -mmemory-model=@var{mem-model}
30060 @opindex mmemory-model
30061 Set the memory model in force on the processor to one of
30062
30063 @table @samp
30064 @item default
30065 The default memory model for the processor and operating system.
30066
30067 @item rmo
30068 Relaxed Memory Order
30069
30070 @item pso
30071 Partial Store Order
30072
30073 @item tso
30074 Total Store Order
30075
30076 @item sc
30077 Sequential Consistency
30078 @end table
30079
30080 These memory models are formally defined in Appendix D of the SPARC-V9
30081 architecture manual, as set in the processor's @code{PSTATE.MM} field.
30082
30083 @item -mstack-bias
30084 @itemx -mno-stack-bias
30085 @opindex mstack-bias
30086 @opindex mno-stack-bias
30087 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
30088 frame pointer if present, are offset by @minus{}2047 which must be added back
30089 when making stack frame references. This is the default in 64-bit mode.
30090 Otherwise, assume no such offset is present.
30091 @end table
30092
30093 @node System V Options
30094 @subsection Options for System V
30095
30096 These additional options are available on System V Release 4 for
30097 compatibility with other compilers on those systems:
30098
30099 @table @gcctabopt
30100 @item -G
30101 @opindex G
30102 Create a shared object.
30103 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
30104
30105 @item -Qy
30106 @opindex Qy
30107 Identify the versions of each tool used by the compiler, in a
30108 @code{.ident} assembler directive in the output.
30109
30110 @item -Qn
30111 @opindex Qn
30112 Refrain from adding @code{.ident} directives to the output file (this is
30113 the default).
30114
30115 @item -YP,@var{dirs}
30116 @opindex YP
30117 Search the directories @var{dirs}, and no others, for libraries
30118 specified with @option{-l}.
30119
30120 @item -Ym,@var{dir}
30121 @opindex Ym
30122 Look in the directory @var{dir} to find the M4 preprocessor.
30123 The assembler uses this option.
30124 @c This is supposed to go with a -Yd for predefined M4 macro files, but
30125 @c the generic assembler that comes with Solaris takes just -Ym.
30126 @end table
30127
30128 @node TILE-Gx Options
30129 @subsection TILE-Gx Options
30130 @cindex TILE-Gx options
30131
30132 These @samp{-m} options are supported on the TILE-Gx:
30133
30134 @table @gcctabopt
30135 @item -mcmodel=small
30136 @opindex mcmodel=small
30137 Generate code for the small model. The distance for direct calls is
30138 limited to 500M in either direction. PC-relative addresses are 32
30139 bits. Absolute addresses support the full address range.
30140
30141 @item -mcmodel=large
30142 @opindex mcmodel=large
30143 Generate code for the large model. There is no limitation on call
30144 distance, pc-relative addresses, or absolute addresses.
30145
30146 @item -mcpu=@var{name}
30147 @opindex mcpu
30148 Selects the type of CPU to be targeted. Currently the only supported
30149 type is @samp{tilegx}.
30150
30151 @item -m32
30152 @itemx -m64
30153 @opindex m32
30154 @opindex m64
30155 Generate code for a 32-bit or 64-bit environment. The 32-bit
30156 environment sets int, long, and pointer to 32 bits. The 64-bit
30157 environment sets int to 32 bits and long and pointer to 64 bits.
30158
30159 @item -mbig-endian
30160 @itemx -mlittle-endian
30161 @opindex mbig-endian
30162 @opindex mlittle-endian
30163 Generate code in big/little endian mode, respectively.
30164 @end table
30165
30166 @node TILEPro Options
30167 @subsection TILEPro Options
30168 @cindex TILEPro options
30169
30170 These @samp{-m} options are supported on the TILEPro:
30171
30172 @table @gcctabopt
30173 @item -mcpu=@var{name}
30174 @opindex mcpu
30175 Selects the type of CPU to be targeted. Currently the only supported
30176 type is @samp{tilepro}.
30177
30178 @item -m32
30179 @opindex m32
30180 Generate code for a 32-bit environment, which sets int, long, and
30181 pointer to 32 bits. This is the only supported behavior so the flag
30182 is essentially ignored.
30183 @end table
30184
30185 @node V850 Options
30186 @subsection V850 Options
30187 @cindex V850 Options
30188
30189 These @samp{-m} options are defined for V850 implementations:
30190
30191 @table @gcctabopt
30192 @item -mlong-calls
30193 @itemx -mno-long-calls
30194 @opindex mlong-calls
30195 @opindex mno-long-calls
30196 Treat all calls as being far away (near). If calls are assumed to be
30197 far away, the compiler always loads the function's address into a
30198 register, and calls indirect through the pointer.
30199
30200 @item -mno-ep
30201 @itemx -mep
30202 @opindex mno-ep
30203 @opindex mep
30204 Do not optimize (do optimize) basic blocks that use the same index
30205 pointer 4 or more times to copy pointer into the @code{ep} register, and
30206 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
30207 option is on by default if you optimize.
30208
30209 @item -mno-prolog-function
30210 @itemx -mprolog-function
30211 @opindex mno-prolog-function
30212 @opindex mprolog-function
30213 Do not use (do use) external functions to save and restore registers
30214 at the prologue and epilogue of a function. The external functions
30215 are slower, but use less code space if more than one function saves
30216 the same number of registers. The @option{-mprolog-function} option
30217 is on by default if you optimize.
30218
30219 @item -mspace
30220 @opindex mspace
30221 Try to make the code as small as possible. At present, this just turns
30222 on the @option{-mep} and @option{-mprolog-function} options.
30223
30224 @item -mtda=@var{n}
30225 @opindex mtda
30226 Put static or global variables whose size is @var{n} bytes or less into
30227 the tiny data area that register @code{ep} points to. The tiny data
30228 area can hold up to 256 bytes in total (128 bytes for byte references).
30229
30230 @item -msda=@var{n}
30231 @opindex msda
30232 Put static or global variables whose size is @var{n} bytes or less into
30233 the small data area that register @code{gp} points to. The small data
30234 area can hold up to 64 kilobytes.
30235
30236 @item -mzda=@var{n}
30237 @opindex mzda
30238 Put static or global variables whose size is @var{n} bytes or less into
30239 the first 32 kilobytes of memory.
30240
30241 @item -mv850
30242 @opindex mv850
30243 Specify that the target processor is the V850.
30244
30245 @item -mv850e3v5
30246 @opindex mv850e3v5
30247 Specify that the target processor is the V850E3V5. The preprocessor
30248 constant @code{__v850e3v5__} is defined if this option is used.
30249
30250 @item -mv850e2v4
30251 @opindex mv850e2v4
30252 Specify that the target processor is the V850E3V5. This is an alias for
30253 the @option{-mv850e3v5} option.
30254
30255 @item -mv850e2v3
30256 @opindex mv850e2v3
30257 Specify that the target processor is the V850E2V3. The preprocessor
30258 constant @code{__v850e2v3__} is defined if this option is used.
30259
30260 @item -mv850e2
30261 @opindex mv850e2
30262 Specify that the target processor is the V850E2. The preprocessor
30263 constant @code{__v850e2__} is defined if this option is used.
30264
30265 @item -mv850e1
30266 @opindex mv850e1
30267 Specify that the target processor is the V850E1. The preprocessor
30268 constants @code{__v850e1__} and @code{__v850e__} are defined if
30269 this option is used.
30270
30271 @item -mv850es
30272 @opindex mv850es
30273 Specify that the target processor is the V850ES. This is an alias for
30274 the @option{-mv850e1} option.
30275
30276 @item -mv850e
30277 @opindex mv850e
30278 Specify that the target processor is the V850E@. The preprocessor
30279 constant @code{__v850e__} is defined if this option is used.
30280
30281 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
30282 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
30283 are defined then a default target processor is chosen and the
30284 relevant @samp{__v850*__} preprocessor constant is defined.
30285
30286 The preprocessor constants @code{__v850} and @code{__v851__} are always
30287 defined, regardless of which processor variant is the target.
30288
30289 @item -mdisable-callt
30290 @itemx -mno-disable-callt
30291 @opindex mdisable-callt
30292 @opindex mno-disable-callt
30293 This option suppresses generation of the @code{CALLT} instruction for the
30294 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
30295 architecture.
30296
30297 This option is enabled by default when the RH850 ABI is
30298 in use (see @option{-mrh850-abi}), and disabled by default when the
30299 GCC ABI is in use. If @code{CALLT} instructions are being generated
30300 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
30301
30302 @item -mrelax
30303 @itemx -mno-relax
30304 @opindex mrelax
30305 @opindex mno-relax
30306 Pass on (or do not pass on) the @option{-mrelax} command-line option
30307 to the assembler.
30308
30309 @item -mlong-jumps
30310 @itemx -mno-long-jumps
30311 @opindex mlong-jumps
30312 @opindex mno-long-jumps
30313 Disable (or re-enable) the generation of PC-relative jump instructions.
30314
30315 @item -msoft-float
30316 @itemx -mhard-float
30317 @opindex msoft-float
30318 @opindex mhard-float
30319 Disable (or re-enable) the generation of hardware floating point
30320 instructions. This option is only significant when the target
30321 architecture is @samp{V850E2V3} or higher. If hardware floating point
30322 instructions are being generated then the C preprocessor symbol
30323 @code{__FPU_OK__} is defined, otherwise the symbol
30324 @code{__NO_FPU__} is defined.
30325
30326 @item -mloop
30327 @opindex mloop
30328 Enables the use of the e3v5 LOOP instruction. The use of this
30329 instruction is not enabled by default when the e3v5 architecture is
30330 selected because its use is still experimental.
30331
30332 @item -mrh850-abi
30333 @itemx -mghs
30334 @opindex mrh850-abi
30335 @opindex mghs
30336 Enables support for the RH850 version of the V850 ABI. This is the
30337 default. With this version of the ABI the following rules apply:
30338
30339 @itemize
30340 @item
30341 Integer sized structures and unions are returned via a memory pointer
30342 rather than a register.
30343
30344 @item
30345 Large structures and unions (more than 8 bytes in size) are passed by
30346 value.
30347
30348 @item
30349 Functions are aligned to 16-bit boundaries.
30350
30351 @item
30352 The @option{-m8byte-align} command-line option is supported.
30353
30354 @item
30355 The @option{-mdisable-callt} command-line option is enabled by
30356 default. The @option{-mno-disable-callt} command-line option is not
30357 supported.
30358 @end itemize
30359
30360 When this version of the ABI is enabled the C preprocessor symbol
30361 @code{__V850_RH850_ABI__} is defined.
30362
30363 @item -mgcc-abi
30364 @opindex mgcc-abi
30365 Enables support for the old GCC version of the V850 ABI. With this
30366 version of the ABI the following rules apply:
30367
30368 @itemize
30369 @item
30370 Integer sized structures and unions are returned in register @code{r10}.
30371
30372 @item
30373 Large structures and unions (more than 8 bytes in size) are passed by
30374 reference.
30375
30376 @item
30377 Functions are aligned to 32-bit boundaries, unless optimizing for
30378 size.
30379
30380 @item
30381 The @option{-m8byte-align} command-line option is not supported.
30382
30383 @item
30384 The @option{-mdisable-callt} command-line option is supported but not
30385 enabled by default.
30386 @end itemize
30387
30388 When this version of the ABI is enabled the C preprocessor symbol
30389 @code{__V850_GCC_ABI__} is defined.
30390
30391 @item -m8byte-align
30392 @itemx -mno-8byte-align
30393 @opindex m8byte-align
30394 @opindex mno-8byte-align
30395 Enables support for @code{double} and @code{long long} types to be
30396 aligned on 8-byte boundaries. The default is to restrict the
30397 alignment of all objects to at most 4-bytes. When
30398 @option{-m8byte-align} is in effect the C preprocessor symbol
30399 @code{__V850_8BYTE_ALIGN__} is defined.
30400
30401 @item -mbig-switch
30402 @opindex mbig-switch
30403 Generate code suitable for big switch tables. Use this option only if
30404 the assembler/linker complain about out of range branches within a switch
30405 table.
30406
30407 @item -mapp-regs
30408 @opindex mapp-regs
30409 This option causes r2 and r5 to be used in the code generated by
30410 the compiler. This setting is the default.
30411
30412 @item -mno-app-regs
30413 @opindex mno-app-regs
30414 This option causes r2 and r5 to be treated as fixed registers.
30415
30416 @end table
30417
30418 @node VAX Options
30419 @subsection VAX Options
30420 @cindex VAX options
30421
30422 These @samp{-m} options are defined for the VAX:
30423
30424 @table @gcctabopt
30425 @item -munix
30426 @opindex munix
30427 Do not output certain jump instructions (@code{aobleq} and so on)
30428 that the Unix assembler for the VAX cannot handle across long
30429 ranges.
30430
30431 @item -mgnu
30432 @opindex mgnu
30433 Do output those jump instructions, on the assumption that the
30434 GNU assembler is being used.
30435
30436 @item -mg
30437 @opindex mg
30438 Output code for G-format floating-point numbers instead of D-format.
30439 @end table
30440
30441 @node Visium Options
30442 @subsection Visium Options
30443 @cindex Visium options
30444
30445 @table @gcctabopt
30446
30447 @item -mdebug
30448 @opindex mdebug
30449 A program which performs file I/O and is destined to run on an MCM target
30450 should be linked with this option. It causes the libraries libc.a and
30451 libdebug.a to be linked. The program should be run on the target under
30452 the control of the GDB remote debugging stub.
30453
30454 @item -msim
30455 @opindex msim
30456 A program which performs file I/O and is destined to run on the simulator
30457 should be linked with option. This causes libraries libc.a and libsim.a to
30458 be linked.
30459
30460 @item -mfpu
30461 @itemx -mhard-float
30462 @opindex mfpu
30463 @opindex mhard-float
30464 Generate code containing floating-point instructions. This is the
30465 default.
30466
30467 @item -mno-fpu
30468 @itemx -msoft-float
30469 @opindex mno-fpu
30470 @opindex msoft-float
30471 Generate code containing library calls for floating-point.
30472
30473 @option{-msoft-float} changes the calling convention in the output file;
30474 therefore, it is only useful if you compile @emph{all} of a program with
30475 this option. In particular, you need to compile @file{libgcc.a}, the
30476 library that comes with GCC, with @option{-msoft-float} in order for
30477 this to work.
30478
30479 @item -mcpu=@var{cpu_type}
30480 @opindex mcpu
30481 Set the instruction set, register set, and instruction scheduling parameters
30482 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
30483 @samp{mcm}, @samp{gr5} and @samp{gr6}.
30484
30485 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
30486
30487 By default (unless configured otherwise), GCC generates code for the GR5
30488 variant of the Visium architecture.
30489
30490 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
30491 architecture. The only difference from GR5 code is that the compiler will
30492 generate block move instructions.
30493
30494 @item -mtune=@var{cpu_type}
30495 @opindex mtune
30496 Set the instruction scheduling parameters for machine type @var{cpu_type},
30497 but do not set the instruction set or register set that the option
30498 @option{-mcpu=@var{cpu_type}} would.
30499
30500 @item -msv-mode
30501 @opindex msv-mode
30502 Generate code for the supervisor mode, where there are no restrictions on
30503 the access to general registers. This is the default.
30504
30505 @item -muser-mode
30506 @opindex muser-mode
30507 Generate code for the user mode, where the access to some general registers
30508 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
30509 mode; on the GR6, only registers r29 to r31 are affected.
30510 @end table
30511
30512 @node VMS Options
30513 @subsection VMS Options
30514
30515 These @samp{-m} options are defined for the VMS implementations:
30516
30517 @table @gcctabopt
30518 @item -mvms-return-codes
30519 @opindex mvms-return-codes
30520 Return VMS condition codes from @code{main}. The default is to return POSIX-style
30521 condition (e.g.@: error) codes.
30522
30523 @item -mdebug-main=@var{prefix}
30524 @opindex mdebug-main=@var{prefix}
30525 Flag the first routine whose name starts with @var{prefix} as the main
30526 routine for the debugger.
30527
30528 @item -mmalloc64
30529 @opindex mmalloc64
30530 Default to 64-bit memory allocation routines.
30531
30532 @item -mpointer-size=@var{size}
30533 @opindex mpointer-size=@var{size}
30534 Set the default size of pointers. Possible options for @var{size} are
30535 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
30536 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
30537 The later option disables @code{pragma pointer_size}.
30538 @end table
30539
30540 @node VxWorks Options
30541 @subsection VxWorks Options
30542 @cindex VxWorks Options
30543
30544 The options in this section are defined for all VxWorks targets.
30545 Options specific to the target hardware are listed with the other
30546 options for that target.
30547
30548 @table @gcctabopt
30549 @item -mrtp
30550 @opindex mrtp
30551 GCC can generate code for both VxWorks kernels and real time processes
30552 (RTPs). This option switches from the former to the latter. It also
30553 defines the preprocessor macro @code{__RTP__}.
30554
30555 @item -non-static
30556 @opindex non-static
30557 Link an RTP executable against shared libraries rather than static
30558 libraries. The options @option{-static} and @option{-shared} can
30559 also be used for RTPs (@pxref{Link Options}); @option{-static}
30560 is the default.
30561
30562 @item -Bstatic
30563 @itemx -Bdynamic
30564 @opindex Bstatic
30565 @opindex Bdynamic
30566 These options are passed down to the linker. They are defined for
30567 compatibility with Diab.
30568
30569 @item -Xbind-lazy
30570 @opindex Xbind-lazy
30571 Enable lazy binding of function calls. This option is equivalent to
30572 @option{-Wl,-z,now} and is defined for compatibility with Diab.
30573
30574 @item -Xbind-now
30575 @opindex Xbind-now
30576 Disable lazy binding of function calls. This option is the default and
30577 is defined for compatibility with Diab.
30578 @end table
30579
30580 @node x86 Options
30581 @subsection x86 Options
30582 @cindex x86 Options
30583
30584 These @samp{-m} options are defined for the x86 family of computers.
30585
30586 @table @gcctabopt
30587
30588 @item -march=@var{cpu-type}
30589 @opindex march
30590 Generate instructions for the machine type @var{cpu-type}. In contrast to
30591 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
30592 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
30593 to generate code that may not run at all on processors other than the one
30594 indicated. Specifying @option{-march=@var{cpu-type}} implies
30595 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
30596
30597 The choices for @var{cpu-type} are:
30598
30599 @table @samp
30600 @item native
30601 This selects the CPU to generate code for at compilation time by determining
30602 the processor type of the compiling machine. Using @option{-march=native}
30603 enables all instruction subsets supported by the local machine (hence
30604 the result might not run on different machines). Using @option{-mtune=native}
30605 produces code optimized for the local machine under the constraints
30606 of the selected instruction set.
30607
30608 @item x86-64
30609 A generic CPU with 64-bit extensions.
30610
30611 @item x86-64-v2
30612 @itemx x86-64-v3
30613 @itemx x86-64-v4
30614 These choices for @var{cpu-type} select the corresponding
30615 micro-architecture level from the x86-64 psABI. On ABIs other than
30616 the x86-64 psABI they select the same CPU features as the x86-64 psABI
30617 documents for the particular micro-architecture level.
30618
30619 Since these @var{cpu-type} values do not have a corresponding
30620 @option{-mtune} setting, using @option{-march} with these values enables
30621 generic tuning. Specific tuning can be enabled using the
30622 @option{-mtune=@var{other-cpu-type}} option with an appropriate
30623 @var{other-cpu-type} value.
30624
30625 @item i386
30626 Original Intel i386 CPU@.
30627
30628 @item i486
30629 Intel i486 CPU@. (No scheduling is implemented for this chip.)
30630
30631 @item i586
30632 @itemx pentium
30633 Intel Pentium CPU with no MMX support.
30634
30635 @item lakemont
30636 Intel Lakemont MCU, based on Intel Pentium CPU.
30637
30638 @item pentium-mmx
30639 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
30640
30641 @item pentiumpro
30642 Intel Pentium Pro CPU@.
30643
30644 @item i686
30645 When used with @option{-march}, the Pentium Pro
30646 instruction set is used, so the code runs on all i686 family chips.
30647 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
30648
30649 @item pentium2
30650 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
30651 support.
30652
30653 @item pentium3
30654 @itemx pentium3m
30655 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
30656 set support.
30657
30658 @item pentium-m
30659 Intel Pentium M; low-power version of Intel Pentium III CPU
30660 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
30661
30662 @item pentium4
30663 @itemx pentium4m
30664 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
30665
30666 @item prescott
30667 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
30668 set support.
30669
30670 @item nocona
30671 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
30672 SSE2 and SSE3 instruction set support.
30673
30674 @item core2
30675 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
30676 instruction set support.
30677
30678 @item nehalem
30679 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30680 SSE4.1, SSE4.2 and POPCNT instruction set support.
30681
30682 @item westmere
30683 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30684 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
30685
30686 @item sandybridge
30687 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30688 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
30689
30690 @item ivybridge
30691 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30692 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
30693 instruction set support.
30694
30695 @item haswell
30696 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30697 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30698 BMI, BMI2 and F16C instruction set support.
30699
30700 @item broadwell
30701 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30702 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
30703 F16C, RDSEED ADCX and PREFETCHW instruction set support.
30704
30705 @item skylake
30706 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30707 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30708 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
30709 instruction set support.
30710
30711 @item bonnell
30712 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
30713 instruction set support.
30714
30715 @item silvermont
30716 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30717 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
30718
30719 @item goldmont
30720 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30721 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30722 XSAVEOPT and FSGSBASE instruction set support.
30723
30724 @item goldmont-plus
30725 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30726 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
30727 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
30728
30729 @item tremont
30730 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30731 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30732 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30733 MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
30734
30735 @item knl
30736 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30737 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30738 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30739 AVX512ER and AVX512CD instruction set support.
30740
30741 @item knm
30742 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30743 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30744 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30745 AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
30746 set support.
30747
30748 @item skylake-avx512
30749 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30750 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30751 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30752 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
30753
30754 @item cannonlake
30755 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30756 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30757 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30758 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30759 AVX512IFMA, SHA and UMIP instruction set support.
30760
30761 @item icelake-client
30762 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30763 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30764 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30765 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30766 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30767 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30768
30769 @item icelake-server
30770 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30771 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30772 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30773 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30774 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30775 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
30776 set support.
30777
30778 @item cascadelake
30779 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30780 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30781 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30782 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
30783
30784 @item cooperlake
30785 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30786 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30787 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30788 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
30789 set support.
30790
30791 @item tigerlake
30792 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30793 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30794 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30795 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
30796 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
30797 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
30798 instruction set support.
30799
30800 @item sapphirerapids
30801 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30802 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
30803 FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
30804 AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
30805 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
30806 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8 and AVX-VNNI
30807 instruction set support.
30808
30809 @item alderlake
30810 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30811 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30812 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30813 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
30814 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI
30815 instruction set support.
30816
30817 @item rocketlake
30818 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30819 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30820 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30821 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30822 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30823 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30824
30825 @item k6
30826 AMD K6 CPU with MMX instruction set support.
30827
30828 @item k6-2
30829 @itemx k6-3
30830 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
30831
30832 @item athlon
30833 @itemx athlon-tbird
30834 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
30835 support.
30836
30837 @item athlon-4
30838 @itemx athlon-xp
30839 @itemx athlon-mp
30840 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
30841 instruction set support.
30842
30843 @item k8
30844 @itemx opteron
30845 @itemx athlon64
30846 @itemx athlon-fx
30847 Processors based on the AMD K8 core with x86-64 instruction set support,
30848 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
30849 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
30850 instruction set extensions.)
30851
30852 @item k8-sse3
30853 @itemx opteron-sse3
30854 @itemx athlon64-sse3
30855 Improved versions of AMD K8 cores with SSE3 instruction set support.
30856
30857 @item amdfam10
30858 @itemx barcelona
30859 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
30860 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
30861 instruction set extensions.)
30862
30863 @item bdver1
30864 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
30865 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
30866 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
30867
30868 @item bdver2
30869 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
30870 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
30871 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
30872 extensions.)
30873
30874 @item bdver3
30875 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
30876 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
30877 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
30878 64-bit instruction set extensions.)
30879
30880 @item bdver4
30881 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
30882 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
30883 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
30884 SSE4.2, ABM and 64-bit instruction set extensions.)
30885
30886 @item znver1
30887 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
30888 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
30889 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
30890 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
30891 instruction set extensions.)
30892
30893 @item znver2
30894 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
30895 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
30896 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
30897 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
30898 WBNOINVD, and 64-bit instruction set extensions.)
30899
30900 @item znver3
30901 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
30902 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
30903 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
30904 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
30905 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
30906
30907 @item btver1
30908 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
30909 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
30910 instruction set extensions.)
30911
30912 @item btver2
30913 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
30914 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
30915 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
30916
30917 @item winchip-c6
30918 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
30919 set support.
30920
30921 @item winchip2
30922 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
30923 instruction set support.
30924
30925 @item c3
30926 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
30927 (No scheduling is implemented for this chip.)
30928
30929 @item c3-2
30930 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
30931 (No scheduling is implemented for this chip.)
30932
30933 @item c7
30934 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
30935 (No scheduling is implemented for this chip.)
30936
30937 @item samuel-2
30938 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
30939 (No scheduling is implemented for this chip.)
30940
30941 @item nehemiah
30942 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
30943 (No scheduling is implemented for this chip.)
30944
30945 @item esther
30946 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
30947 (No scheduling is implemented for this chip.)
30948
30949 @item eden-x2
30950 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
30951 (No scheduling is implemented for this chip.)
30952
30953 @item eden-x4
30954 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
30955 AVX and AVX2 instruction set support.
30956 (No scheduling is implemented for this chip.)
30957
30958 @item nano
30959 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30960 instruction set support.
30961 (No scheduling is implemented for this chip.)
30962
30963 @item nano-1000
30964 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30965 instruction set support.
30966 (No scheduling is implemented for this chip.)
30967
30968 @item nano-2000
30969 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30970 instruction set support.
30971 (No scheduling is implemented for this chip.)
30972
30973 @item nano-3000
30974 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30975 instruction set support.
30976 (No scheduling is implemented for this chip.)
30977
30978 @item nano-x2
30979 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30980 instruction set support.
30981 (No scheduling is implemented for this chip.)
30982
30983 @item nano-x4
30984 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30985 instruction set support.
30986 (No scheduling is implemented for this chip.)
30987
30988 @item geode
30989 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
30990 @end table
30991
30992 @item -mtune=@var{cpu-type}
30993 @opindex mtune
30994 Tune to @var{cpu-type} everything applicable about the generated code, except
30995 for the ABI and the set of available instructions.
30996 While picking a specific @var{cpu-type} schedules things appropriately
30997 for that particular chip, the compiler does not generate any code that
30998 cannot run on the default machine type unless you use a
30999 @option{-march=@var{cpu-type}} option.
31000 For example, if GCC is configured for i686-pc-linux-gnu
31001 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
31002 but still runs on i686 machines.
31003
31004 The choices for @var{cpu-type} are the same as for @option{-march}.
31005 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
31006
31007 @table @samp
31008 @item generic
31009 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
31010 If you know the CPU on which your code will run, then you should use
31011 the corresponding @option{-mtune} or @option{-march} option instead of
31012 @option{-mtune=generic}. But, if you do not know exactly what CPU users
31013 of your application will have, then you should use this option.
31014
31015 As new processors are deployed in the marketplace, the behavior of this
31016 option will change. Therefore, if you upgrade to a newer version of
31017 GCC, code generation controlled by this option will change to reflect
31018 the processors
31019 that are most common at the time that version of GCC is released.
31020
31021 There is no @option{-march=generic} option because @option{-march}
31022 indicates the instruction set the compiler can use, and there is no
31023 generic instruction set applicable to all processors. In contrast,
31024 @option{-mtune} indicates the processor (or, in this case, collection of
31025 processors) for which the code is optimized.
31026
31027 @item intel
31028 Produce code optimized for the most current Intel processors, which are
31029 Haswell and Silvermont for this version of GCC. If you know the CPU
31030 on which your code will run, then you should use the corresponding
31031 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
31032 But, if you want your application performs better on both Haswell and
31033 Silvermont, then you should use this option.
31034
31035 As new Intel processors are deployed in the marketplace, the behavior of
31036 this option will change. Therefore, if you upgrade to a newer version of
31037 GCC, code generation controlled by this option will change to reflect
31038 the most current Intel processors at the time that version of GCC is
31039 released.
31040
31041 There is no @option{-march=intel} option because @option{-march} indicates
31042 the instruction set the compiler can use, and there is no common
31043 instruction set applicable to all processors. In contrast,
31044 @option{-mtune} indicates the processor (or, in this case, collection of
31045 processors) for which the code is optimized.
31046 @end table
31047
31048 @item -mcpu=@var{cpu-type}
31049 @opindex mcpu
31050 A deprecated synonym for @option{-mtune}.
31051
31052 @item -mfpmath=@var{unit}
31053 @opindex mfpmath
31054 Generate floating-point arithmetic for selected unit @var{unit}. The choices
31055 for @var{unit} are:
31056
31057 @table @samp
31058 @item 387
31059 Use the standard 387 floating-point coprocessor present on the majority of chips and
31060 emulated otherwise. Code compiled with this option runs almost everywhere.
31061 The temporary results are computed in 80-bit precision instead of the precision
31062 specified by the type, resulting in slightly different results compared to most
31063 of other chips. See @option{-ffloat-store} for more detailed description.
31064
31065 This is the default choice for non-Darwin x86-32 targets.
31066
31067 @item sse
31068 Use scalar floating-point instructions present in the SSE instruction set.
31069 This instruction set is supported by Pentium III and newer chips,
31070 and in the AMD line
31071 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
31072 instruction set supports only single-precision arithmetic, thus the double and
31073 extended-precision arithmetic are still done using 387. A later version, present
31074 only in Pentium 4 and AMD x86-64 chips, supports double-precision
31075 arithmetic too.
31076
31077 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
31078 or @option{-msse2} switches to enable SSE extensions and make this option
31079 effective. For the x86-64 compiler, these extensions are enabled by default.
31080
31081 The resulting code should be considerably faster in the majority of cases and avoid
31082 the numerical instability problems of 387 code, but may break some existing
31083 code that expects temporaries to be 80 bits.
31084
31085 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
31086 and the default choice for x86-32 targets with the SSE2 instruction set
31087 when @option{-ffast-math} is enabled.
31088
31089 @item sse,387
31090 @itemx sse+387
31091 @itemx both
31092 Attempt to utilize both instruction sets at once. This effectively doubles the
31093 amount of available registers, and on chips with separate execution units for
31094 387 and SSE the execution resources too. Use this option with care, as it is
31095 still experimental, because the GCC register allocator does not model separate
31096 functional units well, resulting in unstable performance.
31097 @end table
31098
31099 @item -masm=@var{dialect}
31100 @opindex masm=@var{dialect}
31101 Output assembly instructions using selected @var{dialect}. Also affects
31102 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
31103 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
31104 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
31105 not support @samp{intel}.
31106
31107 @item -mieee-fp
31108 @itemx -mno-ieee-fp
31109 @opindex mieee-fp
31110 @opindex mno-ieee-fp
31111 Control whether or not the compiler uses IEEE floating-point
31112 comparisons. These correctly handle the case where the result of a
31113 comparison is unordered.
31114
31115 @item -m80387
31116 @itemx -mhard-float
31117 @opindex 80387
31118 @opindex mhard-float
31119 Generate output containing 80387 instructions for floating point.
31120
31121 @item -mno-80387
31122 @itemx -msoft-float
31123 @opindex no-80387
31124 @opindex msoft-float
31125 Generate output containing library calls for floating point.
31126
31127 @strong{Warning:} the requisite libraries are not part of GCC@.
31128 Normally the facilities of the machine's usual C compiler are used, but
31129 this cannot be done directly in cross-compilation. You must make your
31130 own arrangements to provide suitable library functions for
31131 cross-compilation.
31132
31133 On machines where a function returns floating-point results in the 80387
31134 register stack, some floating-point opcodes may be emitted even if
31135 @option{-msoft-float} is used.
31136
31137 @item -mno-fp-ret-in-387
31138 @opindex mno-fp-ret-in-387
31139 @opindex mfp-ret-in-387
31140 Do not use the FPU registers for return values of functions.
31141
31142 The usual calling convention has functions return values of types
31143 @code{float} and @code{double} in an FPU register, even if there
31144 is no FPU@. The idea is that the operating system should emulate
31145 an FPU@.
31146
31147 The option @option{-mno-fp-ret-in-387} causes such values to be returned
31148 in ordinary CPU registers instead.
31149
31150 @item -mno-fancy-math-387
31151 @opindex mno-fancy-math-387
31152 @opindex mfancy-math-387
31153 Some 387 emulators do not support the @code{sin}, @code{cos} and
31154 @code{sqrt} instructions for the 387. Specify this option to avoid
31155 generating those instructions.
31156 This option is overridden when @option{-march}
31157 indicates that the target CPU always has an FPU and so the
31158 instruction does not need emulation. These
31159 instructions are not generated unless you also use the
31160 @option{-funsafe-math-optimizations} switch.
31161
31162 @item -malign-double
31163 @itemx -mno-align-double
31164 @opindex malign-double
31165 @opindex mno-align-double
31166 Control whether GCC aligns @code{double}, @code{long double}, and
31167 @code{long long} variables on a two-word boundary or a one-word
31168 boundary. Aligning @code{double} variables on a two-word boundary
31169 produces code that runs somewhat faster on a Pentium at the
31170 expense of more memory.
31171
31172 On x86-64, @option{-malign-double} is enabled by default.
31173
31174 @strong{Warning:} if you use the @option{-malign-double} switch,
31175 structures containing the above types are aligned differently than
31176 the published application binary interface specifications for the x86-32
31177 and are not binary compatible with structures in code compiled
31178 without that switch.
31179
31180 @item -m96bit-long-double
31181 @itemx -m128bit-long-double
31182 @opindex m96bit-long-double
31183 @opindex m128bit-long-double
31184 These switches control the size of @code{long double} type. The x86-32
31185 application binary interface specifies the size to be 96 bits,
31186 so @option{-m96bit-long-double} is the default in 32-bit mode.
31187
31188 Modern architectures (Pentium and newer) prefer @code{long double}
31189 to be aligned to an 8- or 16-byte boundary. In arrays or structures
31190 conforming to the ABI, this is not possible. So specifying
31191 @option{-m128bit-long-double} aligns @code{long double}
31192 to a 16-byte boundary by padding the @code{long double} with an additional
31193 32-bit zero.
31194
31195 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
31196 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
31197
31198 Notice that neither of these options enable any extra precision over the x87
31199 standard of 80 bits for a @code{long double}.
31200
31201 @strong{Warning:} if you override the default value for your target ABI, this
31202 changes the size of
31203 structures and arrays containing @code{long double} variables,
31204 as well as modifying the function calling convention for functions taking
31205 @code{long double}. Hence they are not binary-compatible
31206 with code compiled without that switch.
31207
31208 @item -mlong-double-64
31209 @itemx -mlong-double-80
31210 @itemx -mlong-double-128
31211 @opindex mlong-double-64
31212 @opindex mlong-double-80
31213 @opindex mlong-double-128
31214 These switches control the size of @code{long double} type. A size
31215 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31216 type. This is the default for 32-bit Bionic C library. A size
31217 of 128 bits makes the @code{long double} type equivalent to the
31218 @code{__float128} type. This is the default for 64-bit Bionic C library.
31219
31220 @strong{Warning:} if you override the default value for your target ABI, this
31221 changes the size of
31222 structures and arrays containing @code{long double} variables,
31223 as well as modifying the function calling convention for functions taking
31224 @code{long double}. Hence they are not binary-compatible
31225 with code compiled without that switch.
31226
31227 @item -malign-data=@var{type}
31228 @opindex malign-data
31229 Control how GCC aligns variables. Supported values for @var{type} are
31230 @samp{compat} uses increased alignment value compatible uses GCC 4.8
31231 and earlier, @samp{abi} uses alignment value as specified by the
31232 psABI, and @samp{cacheline} uses increased alignment value to match
31233 the cache line size. @samp{compat} is the default.
31234
31235 @item -mlarge-data-threshold=@var{threshold}
31236 @opindex mlarge-data-threshold
31237 When @option{-mcmodel=medium} is specified, data objects larger than
31238 @var{threshold} are placed in the large data section. This value must be the
31239 same across all objects linked into the binary, and defaults to 65535.
31240
31241 @item -mrtd
31242 @opindex mrtd
31243 Use a different function-calling convention, in which functions that
31244 take a fixed number of arguments return with the @code{ret @var{num}}
31245 instruction, which pops their arguments while returning. This saves one
31246 instruction in the caller since there is no need to pop the arguments
31247 there.
31248
31249 You can specify that an individual function is called with this calling
31250 sequence with the function attribute @code{stdcall}. You can also
31251 override the @option{-mrtd} option by using the function attribute
31252 @code{cdecl}. @xref{Function Attributes}.
31253
31254 @strong{Warning:} this calling convention is incompatible with the one
31255 normally used on Unix, so you cannot use it if you need to call
31256 libraries compiled with the Unix compiler.
31257
31258 Also, you must provide function prototypes for all functions that
31259 take variable numbers of arguments (including @code{printf});
31260 otherwise incorrect code is generated for calls to those
31261 functions.
31262
31263 In addition, seriously incorrect code results if you call a
31264 function with too many arguments. (Normally, extra arguments are
31265 harmlessly ignored.)
31266
31267 @item -mregparm=@var{num}
31268 @opindex mregparm
31269 Control how many registers are used to pass integer arguments. By
31270 default, no registers are used to pass arguments, and at most 3
31271 registers can be used. You can control this behavior for a specific
31272 function by using the function attribute @code{regparm}.
31273 @xref{Function Attributes}.
31274
31275 @strong{Warning:} if you use this switch, and
31276 @var{num} is nonzero, then you must build all modules with the same
31277 value, including any libraries. This includes the system libraries and
31278 startup modules.
31279
31280 @item -msseregparm
31281 @opindex msseregparm
31282 Use SSE register passing conventions for float and double arguments
31283 and return values. You can control this behavior for a specific
31284 function by using the function attribute @code{sseregparm}.
31285 @xref{Function Attributes}.
31286
31287 @strong{Warning:} if you use this switch then you must build all
31288 modules with the same value, including any libraries. This includes
31289 the system libraries and startup modules.
31290
31291 @item -mvect8-ret-in-mem
31292 @opindex mvect8-ret-in-mem
31293 Return 8-byte vectors in memory instead of MMX registers. This is the
31294 default on VxWorks to match the ABI of the Sun Studio compilers until
31295 version 12. @emph{Only} use this option if you need to remain
31296 compatible with existing code produced by those previous compiler
31297 versions or older versions of GCC@.
31298
31299 @item -mpc32
31300 @itemx -mpc64
31301 @itemx -mpc80
31302 @opindex mpc32
31303 @opindex mpc64
31304 @opindex mpc80
31305
31306 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
31307 is specified, the significands of results of floating-point operations are
31308 rounded to 24 bits (single precision); @option{-mpc64} rounds the
31309 significands of results of floating-point operations to 53 bits (double
31310 precision) and @option{-mpc80} rounds the significands of results of
31311 floating-point operations to 64 bits (extended double precision), which is
31312 the default. When this option is used, floating-point operations in higher
31313 precisions are not available to the programmer without setting the FPU
31314 control word explicitly.
31315
31316 Setting the rounding of floating-point operations to less than the default
31317 80 bits can speed some programs by 2% or more. Note that some mathematical
31318 libraries assume that extended-precision (80-bit) floating-point operations
31319 are enabled by default; routines in such libraries could suffer significant
31320 loss of accuracy, typically through so-called ``catastrophic cancellation'',
31321 when this option is used to set the precision to less than extended precision.
31322
31323 @item -mstackrealign
31324 @opindex mstackrealign
31325 Realign the stack at entry. On the x86, the @option{-mstackrealign}
31326 option generates an alternate prologue and epilogue that realigns the
31327 run-time stack if necessary. This supports mixing legacy codes that keep
31328 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
31329 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
31330 applicable to individual functions.
31331
31332 @item -mpreferred-stack-boundary=@var{num}
31333 @opindex mpreferred-stack-boundary
31334 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
31335 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
31336 the default is 4 (16 bytes or 128 bits).
31337
31338 @strong{Warning:} When generating code for the x86-64 architecture with
31339 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
31340 used to keep the stack boundary aligned to 8 byte boundary. Since
31341 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
31342 intended to be used in controlled environment where stack space is
31343 important limitation. This option leads to wrong code when functions
31344 compiled with 16 byte stack alignment (such as functions from a standard
31345 library) are called with misaligned stack. In this case, SSE
31346 instructions may lead to misaligned memory access traps. In addition,
31347 variable arguments are handled incorrectly for 16 byte aligned
31348 objects (including x87 long double and __int128), leading to wrong
31349 results. You must build all modules with
31350 @option{-mpreferred-stack-boundary=3}, including any libraries. This
31351 includes the system libraries and startup modules.
31352
31353 @item -mincoming-stack-boundary=@var{num}
31354 @opindex mincoming-stack-boundary
31355 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
31356 boundary. If @option{-mincoming-stack-boundary} is not specified,
31357 the one specified by @option{-mpreferred-stack-boundary} is used.
31358
31359 On Pentium and Pentium Pro, @code{double} and @code{long double} values
31360 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
31361 suffer significant run time performance penalties. On Pentium III, the
31362 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
31363 properly if it is not 16-byte aligned.
31364
31365 To ensure proper alignment of this values on the stack, the stack boundary
31366 must be as aligned as that required by any value stored on the stack.
31367 Further, every function must be generated such that it keeps the stack
31368 aligned. Thus calling a function compiled with a higher preferred
31369 stack boundary from a function compiled with a lower preferred stack
31370 boundary most likely misaligns the stack. It is recommended that
31371 libraries that use callbacks always use the default setting.
31372
31373 This extra alignment does consume extra stack space, and generally
31374 increases code size. Code that is sensitive to stack space usage, such
31375 as embedded systems and operating system kernels, may want to reduce the
31376 preferred alignment to @option{-mpreferred-stack-boundary=2}.
31377
31378 @need 200
31379 @item -mmmx
31380 @opindex mmmx
31381 @need 200
31382 @itemx -msse
31383 @opindex msse
31384 @need 200
31385 @itemx -msse2
31386 @opindex msse2
31387 @need 200
31388 @itemx -msse3
31389 @opindex msse3
31390 @need 200
31391 @itemx -mssse3
31392 @opindex mssse3
31393 @need 200
31394 @itemx -msse4
31395 @opindex msse4
31396 @need 200
31397 @itemx -msse4a
31398 @opindex msse4a
31399 @need 200
31400 @itemx -msse4.1
31401 @opindex msse4.1
31402 @need 200
31403 @itemx -msse4.2
31404 @opindex msse4.2
31405 @need 200
31406 @itemx -mavx
31407 @opindex mavx
31408 @need 200
31409 @itemx -mavx2
31410 @opindex mavx2
31411 @need 200
31412 @itemx -mavx512f
31413 @opindex mavx512f
31414 @need 200
31415 @itemx -mavx512pf
31416 @opindex mavx512pf
31417 @need 200
31418 @itemx -mavx512er
31419 @opindex mavx512er
31420 @need 200
31421 @itemx -mavx512cd
31422 @opindex mavx512cd
31423 @need 200
31424 @itemx -mavx512vl
31425 @opindex mavx512vl
31426 @need 200
31427 @itemx -mavx512bw
31428 @opindex mavx512bw
31429 @need 200
31430 @itemx -mavx512dq
31431 @opindex mavx512dq
31432 @need 200
31433 @itemx -mavx512ifma
31434 @opindex mavx512ifma
31435 @need 200
31436 @itemx -mavx512vbmi
31437 @opindex mavx512vbmi
31438 @need 200
31439 @itemx -msha
31440 @opindex msha
31441 @need 200
31442 @itemx -maes
31443 @opindex maes
31444 @need 200
31445 @itemx -mpclmul
31446 @opindex mpclmul
31447 @need 200
31448 @itemx -mclflushopt
31449 @opindex mclflushopt
31450 @need 200
31451 @itemx -mclwb
31452 @opindex mclwb
31453 @need 200
31454 @itemx -mfsgsbase
31455 @opindex mfsgsbase
31456 @need 200
31457 @itemx -mptwrite
31458 @opindex mptwrite
31459 @need 200
31460 @itemx -mrdrnd
31461 @opindex mrdrnd
31462 @need 200
31463 @itemx -mf16c
31464 @opindex mf16c
31465 @need 200
31466 @itemx -mfma
31467 @opindex mfma
31468 @need 200
31469 @itemx -mpconfig
31470 @opindex mpconfig
31471 @need 200
31472 @itemx -mwbnoinvd
31473 @opindex mwbnoinvd
31474 @need 200
31475 @itemx -mfma4
31476 @opindex mfma4
31477 @need 200
31478 @itemx -mprfchw
31479 @opindex mprfchw
31480 @need 200
31481 @itemx -mrdpid
31482 @opindex mrdpid
31483 @need 200
31484 @itemx -mprefetchwt1
31485 @opindex mprefetchwt1
31486 @need 200
31487 @itemx -mrdseed
31488 @opindex mrdseed
31489 @need 200
31490 @itemx -msgx
31491 @opindex msgx
31492 @need 200
31493 @itemx -mxop
31494 @opindex mxop
31495 @need 200
31496 @itemx -mlwp
31497 @opindex mlwp
31498 @need 200
31499 @itemx -m3dnow
31500 @opindex m3dnow
31501 @need 200
31502 @itemx -m3dnowa
31503 @opindex m3dnowa
31504 @need 200
31505 @itemx -mpopcnt
31506 @opindex mpopcnt
31507 @need 200
31508 @itemx -mabm
31509 @opindex mabm
31510 @need 200
31511 @itemx -madx
31512 @opindex madx
31513 @need 200
31514 @itemx -mbmi
31515 @opindex mbmi
31516 @need 200
31517 @itemx -mbmi2
31518 @opindex mbmi2
31519 @need 200
31520 @itemx -mlzcnt
31521 @opindex mlzcnt
31522 @need 200
31523 @itemx -mfxsr
31524 @opindex mfxsr
31525 @need 200
31526 @itemx -mxsave
31527 @opindex mxsave
31528 @need 200
31529 @itemx -mxsaveopt
31530 @opindex mxsaveopt
31531 @need 200
31532 @itemx -mxsavec
31533 @opindex mxsavec
31534 @need 200
31535 @itemx -mxsaves
31536 @opindex mxsaves
31537 @need 200
31538 @itemx -mrtm
31539 @opindex mrtm
31540 @need 200
31541 @itemx -mhle
31542 @opindex mhle
31543 @need 200
31544 @itemx -mtbm
31545 @opindex mtbm
31546 @need 200
31547 @itemx -mmwaitx
31548 @opindex mmwaitx
31549 @need 200
31550 @itemx -mclzero
31551 @opindex mclzero
31552 @need 200
31553 @itemx -mpku
31554 @opindex mpku
31555 @need 200
31556 @itemx -mavx512vbmi2
31557 @opindex mavx512vbmi2
31558 @need 200
31559 @itemx -mavx512bf16
31560 @opindex mavx512bf16
31561 @need 200
31562 @itemx -mavx512fp16
31563 @opindex mavx512fp16
31564 @need 200
31565 @itemx -mgfni
31566 @opindex mgfni
31567 @need 200
31568 @itemx -mvaes
31569 @opindex mvaes
31570 @need 200
31571 @itemx -mwaitpkg
31572 @opindex mwaitpkg
31573 @need 200
31574 @itemx -mvpclmulqdq
31575 @opindex mvpclmulqdq
31576 @need 200
31577 @itemx -mavx512bitalg
31578 @opindex mavx512bitalg
31579 @need 200
31580 @itemx -mmovdiri
31581 @opindex mmovdiri
31582 @need 200
31583 @itemx -mmovdir64b
31584 @opindex mmovdir64b
31585 @need 200
31586 @itemx -menqcmd
31587 @opindex menqcmd
31588 @itemx -muintr
31589 @opindex muintr
31590 @need 200
31591 @itemx -mtsxldtrk
31592 @opindex mtsxldtrk
31593 @need 200
31594 @itemx -mavx512vpopcntdq
31595 @opindex mavx512vpopcntdq
31596 @need 200
31597 @itemx -mavx512vp2intersect
31598 @opindex mavx512vp2intersect
31599 @need 200
31600 @itemx -mavx5124fmaps
31601 @opindex mavx5124fmaps
31602 @need 200
31603 @itemx -mavx512vnni
31604 @opindex mavx512vnni
31605 @need 200
31606 @itemx -mavxvnni
31607 @opindex mavxvnni
31608 @need 200
31609 @itemx -mavx5124vnniw
31610 @opindex mavx5124vnniw
31611 @need 200
31612 @itemx -mcldemote
31613 @opindex mcldemote
31614 @need 200
31615 @itemx -mserialize
31616 @opindex mserialize
31617 @need 200
31618 @itemx -mamx-tile
31619 @opindex mamx-tile
31620 @need 200
31621 @itemx -mamx-int8
31622 @opindex mamx-int8
31623 @need 200
31624 @itemx -mamx-bf16
31625 @opindex mamx-bf16
31626 @need 200
31627 @itemx -mhreset
31628 @opindex mhreset
31629 @itemx -mkl
31630 @opindex mkl
31631 @need 200
31632 @itemx -mwidekl
31633 @opindex mwidekl
31634 These switches enable the use of instructions in the MMX, SSE,
31635 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
31636 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
31637 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
31638 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
31639 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
31640 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
31641 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
31642 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
31643 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16
31644 or CLDEMOTE extended instruction sets. Each has a corresponding
31645 @option{-mno-} option to disable use of these instructions.
31646
31647 These extensions are also available as built-in functions: see
31648 @ref{x86 Built-in Functions}, for details of the functions enabled and
31649 disabled by these switches.
31650
31651 To generate SSE/SSE2 instructions automatically from floating-point
31652 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
31653
31654 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
31655 generates new AVX instructions or AVX equivalence for all SSEx instructions
31656 when needed.
31657
31658 These options enable GCC to use these extended instructions in
31659 generated code, even without @option{-mfpmath=sse}. Applications that
31660 perform run-time CPU detection must compile separate files for each
31661 supported architecture, using the appropriate flags. In particular,
31662 the file containing the CPU detection code should be compiled without
31663 these options.
31664
31665 @item -mdump-tune-features
31666 @opindex mdump-tune-features
31667 This option instructs GCC to dump the names of the x86 performance
31668 tuning features and default settings. The names can be used in
31669 @option{-mtune-ctrl=@var{feature-list}}.
31670
31671 @item -mtune-ctrl=@var{feature-list}
31672 @opindex mtune-ctrl=@var{feature-list}
31673 This option is used to do fine grain control of x86 code generation features.
31674 @var{feature-list} is a comma separated list of @var{feature} names. See also
31675 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
31676 on if it is not preceded with @samp{^}, otherwise, it is turned off.
31677 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
31678 developers. Using it may lead to code paths not covered by testing and can
31679 potentially result in compiler ICEs or runtime errors.
31680
31681 @item -mno-default
31682 @opindex mno-default
31683 This option instructs GCC to turn off all tunable features. See also
31684 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
31685
31686 @item -mcld
31687 @opindex mcld
31688 This option instructs GCC to emit a @code{cld} instruction in the prologue
31689 of functions that use string instructions. String instructions depend on
31690 the DF flag to select between autoincrement or autodecrement mode. While the
31691 ABI specifies the DF flag to be cleared on function entry, some operating
31692 systems violate this specification by not clearing the DF flag in their
31693 exception dispatchers. The exception handler can be invoked with the DF flag
31694 set, which leads to wrong direction mode when string instructions are used.
31695 This option can be enabled by default on 32-bit x86 targets by configuring
31696 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
31697 instructions can be suppressed with the @option{-mno-cld} compiler option
31698 in this case.
31699
31700 @item -mvzeroupper
31701 @opindex mvzeroupper
31702 This option instructs GCC to emit a @code{vzeroupper} instruction
31703 before a transfer of control flow out of the function to minimize
31704 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
31705 intrinsics.
31706
31707 @item -mprefer-avx128
31708 @opindex mprefer-avx128
31709 This option instructs GCC to use 128-bit AVX instructions instead of
31710 256-bit AVX instructions in the auto-vectorizer.
31711
31712 @item -mprefer-vector-width=@var{opt}
31713 @opindex mprefer-vector-width
31714 This option instructs GCC to use @var{opt}-bit vector width in instructions
31715 instead of default on the selected platform.
31716
31717 @table @samp
31718 @item none
31719 No extra limitations applied to GCC other than defined by the selected platform.
31720
31721 @item 128
31722 Prefer 128-bit vector width for instructions.
31723
31724 @item 256
31725 Prefer 256-bit vector width for instructions.
31726
31727 @item 512
31728 Prefer 512-bit vector width for instructions.
31729 @end table
31730
31731 @item -mcx16
31732 @opindex mcx16
31733 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
31734 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
31735 objects. This is useful for atomic updates of data structures exceeding one
31736 machine word in size. The compiler uses this instruction to implement
31737 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
31738 128-bit integers, a library call is always used.
31739
31740 @item -msahf
31741 @opindex msahf
31742 This option enables generation of @code{SAHF} instructions in 64-bit code.
31743 Early Intel Pentium 4 CPUs with Intel 64 support,
31744 prior to the introduction of Pentium 4 G1 step in December 2005,
31745 lacked the @code{LAHF} and @code{SAHF} instructions
31746 which are supported by AMD64.
31747 These are load and store instructions, respectively, for certain status flags.
31748 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
31749 @code{drem}, and @code{remainder} built-in functions;
31750 see @ref{Other Builtins} for details.
31751
31752 @item -mmovbe
31753 @opindex mmovbe
31754 This option enables use of the @code{movbe} instruction to implement
31755 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
31756
31757 @item -mshstk
31758 @opindex mshstk
31759 The @option{-mshstk} option enables shadow stack built-in functions
31760 from x86 Control-flow Enforcement Technology (CET).
31761
31762 @item -mcrc32
31763 @opindex mcrc32
31764 This option enables built-in functions @code{__builtin_ia32_crc32qi},
31765 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
31766 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
31767
31768 @item -mmwait
31769 @opindex mmwait
31770 This option enables built-in functions @code{__builtin_ia32_monitor},
31771 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
31772 @code{mwait} machine instructions.
31773
31774 @item -mrecip
31775 @opindex mrecip
31776 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
31777 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
31778 with an additional Newton-Raphson step
31779 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
31780 (and their vectorized
31781 variants) for single-precision floating-point arguments. These instructions
31782 are generated only when @option{-funsafe-math-optimizations} is enabled
31783 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
31784 Note that while the throughput of the sequence is higher than the throughput
31785 of the non-reciprocal instruction, the precision of the sequence can be
31786 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
31787
31788 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
31789 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
31790 combination), and doesn't need @option{-mrecip}.
31791
31792 Also note that GCC emits the above sequence with additional Newton-Raphson step
31793 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
31794 already with @option{-ffast-math} (or the above option combination), and
31795 doesn't need @option{-mrecip}.
31796
31797 @item -mrecip=@var{opt}
31798 @opindex mrecip=opt
31799 This option controls which reciprocal estimate instructions
31800 may be used. @var{opt} is a comma-separated list of options, which may
31801 be preceded by a @samp{!} to invert the option:
31802
31803 @table @samp
31804 @item all
31805 Enable all estimate instructions.
31806
31807 @item default
31808 Enable the default instructions, equivalent to @option{-mrecip}.
31809
31810 @item none
31811 Disable all estimate instructions, equivalent to @option{-mno-recip}.
31812
31813 @item div
31814 Enable the approximation for scalar division.
31815
31816 @item vec-div
31817 Enable the approximation for vectorized division.
31818
31819 @item sqrt
31820 Enable the approximation for scalar square root.
31821
31822 @item vec-sqrt
31823 Enable the approximation for vectorized square root.
31824 @end table
31825
31826 So, for example, @option{-mrecip=all,!sqrt} enables
31827 all of the reciprocal approximations, except for square root.
31828
31829 @item -mveclibabi=@var{type}
31830 @opindex mveclibabi
31831 Specifies the ABI type to use for vectorizing intrinsics using an
31832 external library. Supported values for @var{type} are @samp{svml}
31833 for the Intel short
31834 vector math library and @samp{acml} for the AMD math core library.
31835 To use this option, both @option{-ftree-vectorize} and
31836 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
31837 ABI-compatible library must be specified at link time.
31838
31839 GCC currently emits calls to @code{vmldExp2},
31840 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
31841 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
31842 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
31843 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
31844 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
31845 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
31846 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
31847 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
31848 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
31849 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
31850 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
31851 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
31852 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
31853 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
31854 when @option{-mveclibabi=acml} is used.
31855
31856 @item -mabi=@var{name}
31857 @opindex mabi
31858 Generate code for the specified calling convention. Permissible values
31859 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
31860 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
31861 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
31862 You can control this behavior for specific functions by
31863 using the function attributes @code{ms_abi} and @code{sysv_abi}.
31864 @xref{Function Attributes}.
31865
31866 @item -mforce-indirect-call
31867 @opindex mforce-indirect-call
31868 Force all calls to functions to be indirect. This is useful
31869 when using Intel Processor Trace where it generates more precise timing
31870 information for function calls.
31871
31872 @item -mmanual-endbr
31873 @opindex mmanual-endbr
31874 Insert ENDBR instruction at function entry only via the @code{cf_check}
31875 function attribute. This is useful when used with the option
31876 @option{-fcf-protection=branch} to control ENDBR insertion at the
31877 function entry.
31878
31879 @item -mcall-ms2sysv-xlogues
31880 @opindex mcall-ms2sysv-xlogues
31881 @opindex mno-call-ms2sysv-xlogues
31882 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
31883 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
31884 default, the code for saving and restoring these registers is emitted inline,
31885 resulting in fairly lengthy prologues and epilogues. Using
31886 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
31887 use stubs in the static portion of libgcc to perform these saves and restores,
31888 thus reducing function size at the cost of a few extra instructions.
31889
31890 @item -mtls-dialect=@var{type}
31891 @opindex mtls-dialect
31892 Generate code to access thread-local storage using the @samp{gnu} or
31893 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
31894 @samp{gnu2} is more efficient, but it may add compile- and run-time
31895 requirements that cannot be satisfied on all systems.
31896
31897 @item -mpush-args
31898 @itemx -mno-push-args
31899 @opindex mpush-args
31900 @opindex mno-push-args
31901 Use PUSH operations to store outgoing parameters. This method is shorter
31902 and usually equally fast as method using SUB/MOV operations and is enabled
31903 by default. In some cases disabling it may improve performance because of
31904 improved scheduling and reduced dependencies.
31905
31906 @item -maccumulate-outgoing-args
31907 @opindex maccumulate-outgoing-args
31908 If enabled, the maximum amount of space required for outgoing arguments is
31909 computed in the function prologue. This is faster on most modern CPUs
31910 because of reduced dependencies, improved scheduling and reduced stack usage
31911 when the preferred stack boundary is not equal to 2. The drawback is a notable
31912 increase in code size. This switch implies @option{-mno-push-args}.
31913
31914 @item -mthreads
31915 @opindex mthreads
31916 Support thread-safe exception handling on MinGW. Programs that rely
31917 on thread-safe exception handling must compile and link all code with the
31918 @option{-mthreads} option. When compiling, @option{-mthreads} defines
31919 @option{-D_MT}; when linking, it links in a special thread helper library
31920 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
31921
31922 @item -mms-bitfields
31923 @itemx -mno-ms-bitfields
31924 @opindex mms-bitfields
31925 @opindex mno-ms-bitfields
31926
31927 Enable/disable bit-field layout compatible with the native Microsoft
31928 Windows compiler.
31929
31930 If @code{packed} is used on a structure, or if bit-fields are used,
31931 it may be that the Microsoft ABI lays out the structure differently
31932 than the way GCC normally does. Particularly when moving packed
31933 data between functions compiled with GCC and the native Microsoft compiler
31934 (either via function call or as data in a file), it may be necessary to access
31935 either format.
31936
31937 This option is enabled by default for Microsoft Windows
31938 targets. This behavior can also be controlled locally by use of variable
31939 or type attributes. For more information, see @ref{x86 Variable Attributes}
31940 and @ref{x86 Type Attributes}.
31941
31942 The Microsoft structure layout algorithm is fairly simple with the exception
31943 of the bit-field packing.
31944 The padding and alignment of members of structures and whether a bit-field
31945 can straddle a storage-unit boundary are determine by these rules:
31946
31947 @enumerate
31948 @item Structure members are stored sequentially in the order in which they are
31949 declared: the first member has the lowest memory address and the last member
31950 the highest.
31951
31952 @item Every data object has an alignment requirement. The alignment requirement
31953 for all data except structures, unions, and arrays is either the size of the
31954 object or the current packing size (specified with either the
31955 @code{aligned} attribute or the @code{pack} pragma),
31956 whichever is less. For structures, unions, and arrays,
31957 the alignment requirement is the largest alignment requirement of its members.
31958 Every object is allocated an offset so that:
31959
31960 @smallexample
31961 offset % alignment_requirement == 0
31962 @end smallexample
31963
31964 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
31965 unit if the integral types are the same size and if the next bit-field fits
31966 into the current allocation unit without crossing the boundary imposed by the
31967 common alignment requirements of the bit-fields.
31968 @end enumerate
31969
31970 MSVC interprets zero-length bit-fields in the following ways:
31971
31972 @enumerate
31973 @item If a zero-length bit-field is inserted between two bit-fields that
31974 are normally coalesced, the bit-fields are not coalesced.
31975
31976 For example:
31977
31978 @smallexample
31979 struct
31980 @{
31981 unsigned long bf_1 : 12;
31982 unsigned long : 0;
31983 unsigned long bf_2 : 12;
31984 @} t1;
31985 @end smallexample
31986
31987 @noindent
31988 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
31989 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
31990
31991 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
31992 alignment of the zero-length bit-field is greater than the member that follows it,
31993 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
31994
31995 For example:
31996
31997 @smallexample
31998 struct
31999 @{
32000 char foo : 4;
32001 short : 0;
32002 char bar;
32003 @} t2;
32004
32005 struct
32006 @{
32007 char foo : 4;
32008 short : 0;
32009 double bar;
32010 @} t3;
32011 @end smallexample
32012
32013 @noindent
32014 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
32015 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
32016 bit-field does not affect the alignment of @code{bar} or, as a result, the size
32017 of the structure.
32018
32019 Taking this into account, it is important to note the following:
32020
32021 @enumerate
32022 @item If a zero-length bit-field follows a normal bit-field, the type of the
32023 zero-length bit-field may affect the alignment of the structure as whole. For
32024 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
32025 normal bit-field, and is of type short.
32026
32027 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
32028 still affect the alignment of the structure:
32029
32030 @smallexample
32031 struct
32032 @{
32033 char foo : 6;
32034 long : 0;
32035 @} t4;
32036 @end smallexample
32037
32038 @noindent
32039 Here, @code{t4} takes up 4 bytes.
32040 @end enumerate
32041
32042 @item Zero-length bit-fields following non-bit-field members are ignored:
32043
32044 @smallexample
32045 struct
32046 @{
32047 char foo;
32048 long : 0;
32049 char bar;
32050 @} t5;
32051 @end smallexample
32052
32053 @noindent
32054 Here, @code{t5} takes up 2 bytes.
32055 @end enumerate
32056
32057
32058 @item -mno-align-stringops
32059 @opindex mno-align-stringops
32060 @opindex malign-stringops
32061 Do not align the destination of inlined string operations. This switch reduces
32062 code size and improves performance in case the destination is already aligned,
32063 but GCC doesn't know about it.
32064
32065 @item -minline-all-stringops
32066 @opindex minline-all-stringops
32067 By default GCC inlines string operations only when the destination is
32068 known to be aligned to least a 4-byte boundary.
32069 This enables more inlining and increases code
32070 size, but may improve performance of code that depends on fast
32071 @code{memcpy} and @code{memset} for short lengths.
32072 The option enables inline expansion of @code{strlen} for all
32073 pointer alignments.
32074
32075 @item -minline-stringops-dynamically
32076 @opindex minline-stringops-dynamically
32077 For string operations of unknown size, use run-time checks with
32078 inline code for small blocks and a library call for large blocks.
32079
32080 @item -mstringop-strategy=@var{alg}
32081 @opindex mstringop-strategy=@var{alg}
32082 Override the internal decision heuristic for the particular algorithm to use
32083 for inlining string operations. The allowed values for @var{alg} are:
32084
32085 @table @samp
32086 @item rep_byte
32087 @itemx rep_4byte
32088 @itemx rep_8byte
32089 Expand using i386 @code{rep} prefix of the specified size.
32090
32091 @item byte_loop
32092 @itemx loop
32093 @itemx unrolled_loop
32094 Expand into an inline loop.
32095
32096 @item libcall
32097 Always use a library call.
32098 @end table
32099
32100 @item -mmemcpy-strategy=@var{strategy}
32101 @opindex mmemcpy-strategy=@var{strategy}
32102 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
32103 should be inlined and what inline algorithm to use when the expected size
32104 of the copy operation is known. @var{strategy}
32105 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
32106 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
32107 the max byte size with which inline algorithm @var{alg} is allowed. For the last
32108 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
32109 in the list must be specified in increasing order. The minimal byte size for
32110 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
32111 preceding range.
32112
32113 @item -mmemset-strategy=@var{strategy}
32114 @opindex mmemset-strategy=@var{strategy}
32115 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
32116 @code{__builtin_memset} expansion.
32117
32118 @item -momit-leaf-frame-pointer
32119 @opindex momit-leaf-frame-pointer
32120 Don't keep the frame pointer in a register for leaf functions. This
32121 avoids the instructions to save, set up, and restore frame pointers and
32122 makes an extra register available in leaf functions. The option
32123 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
32124 which might make debugging harder.
32125
32126 @item -mtls-direct-seg-refs
32127 @itemx -mno-tls-direct-seg-refs
32128 @opindex mtls-direct-seg-refs
32129 Controls whether TLS variables may be accessed with offsets from the
32130 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
32131 or whether the thread base pointer must be added. Whether or not this
32132 is valid depends on the operating system, and whether it maps the
32133 segment to cover the entire TLS area.
32134
32135 For systems that use the GNU C Library, the default is on.
32136
32137 @item -msse2avx
32138 @itemx -mno-sse2avx
32139 @opindex msse2avx
32140 Specify that the assembler should encode SSE instructions with VEX
32141 prefix. The option @option{-mavx} turns this on by default.
32142
32143 @item -mfentry
32144 @itemx -mno-fentry
32145 @opindex mfentry
32146 If profiling is active (@option{-pg}), put the profiling
32147 counter call before the prologue.
32148 Note: On x86 architectures the attribute @code{ms_hook_prologue}
32149 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
32150
32151 @item -mrecord-mcount
32152 @itemx -mno-record-mcount
32153 @opindex mrecord-mcount
32154 If profiling is active (@option{-pg}), generate a __mcount_loc section
32155 that contains pointers to each profiling call. This is useful for
32156 automatically patching and out calls.
32157
32158 @item -mnop-mcount
32159 @itemx -mno-nop-mcount
32160 @opindex mnop-mcount
32161 If profiling is active (@option{-pg}), generate the calls to
32162 the profiling functions as NOPs. This is useful when they
32163 should be patched in later dynamically. This is likely only
32164 useful together with @option{-mrecord-mcount}.
32165
32166 @item -minstrument-return=@var{type}
32167 @opindex minstrument-return
32168 Instrument function exit in -pg -mfentry instrumented functions with
32169 call to specified function. This only instruments true returns ending
32170 with ret, but not sibling calls ending with jump. Valid types
32171 are @var{none} to not instrument, @var{call} to generate a call to __return__,
32172 or @var{nop5} to generate a 5 byte nop.
32173
32174 @item -mrecord-return
32175 @itemx -mno-record-return
32176 @opindex mrecord-return
32177 Generate a __return_loc section pointing to all return instrumentation code.
32178
32179 @item -mfentry-name=@var{name}
32180 @opindex mfentry-name
32181 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
32182
32183 @item -mfentry-section=@var{name}
32184 @opindex mfentry-section
32185 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
32186
32187 @item -mskip-rax-setup
32188 @itemx -mno-skip-rax-setup
32189 @opindex mskip-rax-setup
32190 When generating code for the x86-64 architecture with SSE extensions
32191 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
32192 register when there are no variable arguments passed in vector registers.
32193
32194 @strong{Warning:} Since RAX register is used to avoid unnecessarily
32195 saving vector registers on stack when passing variable arguments, the
32196 impacts of this option are callees may waste some stack space,
32197 misbehave or jump to a random location. GCC 4.4 or newer don't have
32198 those issues, regardless the RAX register value.
32199
32200 @item -m8bit-idiv
32201 @itemx -mno-8bit-idiv
32202 @opindex m8bit-idiv
32203 On some processors, like Intel Atom, 8-bit unsigned integer divide is
32204 much faster than 32-bit/64-bit integer divide. This option generates a
32205 run-time check. If both dividend and divisor are within range of 0
32206 to 255, 8-bit unsigned integer divide is used instead of
32207 32-bit/64-bit integer divide.
32208
32209 @item -mavx256-split-unaligned-load
32210 @itemx -mavx256-split-unaligned-store
32211 @opindex mavx256-split-unaligned-load
32212 @opindex mavx256-split-unaligned-store
32213 Split 32-byte AVX unaligned load and store.
32214
32215 @item -mstack-protector-guard=@var{guard}
32216 @itemx -mstack-protector-guard-reg=@var{reg}
32217 @itemx -mstack-protector-guard-offset=@var{offset}
32218 @opindex mstack-protector-guard
32219 @opindex mstack-protector-guard-reg
32220 @opindex mstack-protector-guard-offset
32221 Generate stack protection code using canary at @var{guard}. Supported
32222 locations are @samp{global} for global canary or @samp{tls} for per-thread
32223 canary in the TLS block (the default). This option has effect only when
32224 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
32225
32226 With the latter choice the options
32227 @option{-mstack-protector-guard-reg=@var{reg}} and
32228 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32229 which segment register (@code{%fs} or @code{%gs}) to use as base register
32230 for reading the canary, and from what offset from that base register.
32231 The default for those is as specified in the relevant ABI.
32232
32233 @item -mgeneral-regs-only
32234 @opindex mgeneral-regs-only
32235 Generate code that uses only the general-purpose registers. This
32236 prevents the compiler from using floating-point, vector, mask and bound
32237 registers.
32238
32239 @item -mindirect-branch=@var{choice}
32240 @opindex mindirect-branch
32241 Convert indirect call and jump with @var{choice}. The default is
32242 @samp{keep}, which keeps indirect call and jump unmodified.
32243 @samp{thunk} converts indirect call and jump to call and return thunk.
32244 @samp{thunk-inline} converts indirect call and jump to inlined call
32245 and return thunk. @samp{thunk-extern} converts indirect call and jump
32246 to external call and return thunk provided in a separate object file.
32247 You can control this behavior for a specific function by using the
32248 function attribute @code{indirect_branch}. @xref{Function Attributes}.
32249
32250 Note that @option{-mcmodel=large} is incompatible with
32251 @option{-mindirect-branch=thunk} and
32252 @option{-mindirect-branch=thunk-extern} since the thunk function may
32253 not be reachable in the large code model.
32254
32255 Note that @option{-mindirect-branch=thunk-extern} is compatible with
32256 @option{-fcf-protection=branch} since the external thunk can be made
32257 to enable control-flow check.
32258
32259 @item -mfunction-return=@var{choice}
32260 @opindex mfunction-return
32261 Convert function return with @var{choice}. The default is @samp{keep},
32262 which keeps function return unmodified. @samp{thunk} converts function
32263 return to call and return thunk. @samp{thunk-inline} converts function
32264 return to inlined call and return thunk. @samp{thunk-extern} converts
32265 function return to external call and return thunk provided in a separate
32266 object file. You can control this behavior for a specific function by
32267 using the function attribute @code{function_return}.
32268 @xref{Function Attributes}.
32269
32270 Note that @option{-mindirect-return=thunk-extern} is compatible with
32271 @option{-fcf-protection=branch} since the external thunk can be made
32272 to enable control-flow check.
32273
32274 Note that @option{-mcmodel=large} is incompatible with
32275 @option{-mfunction-return=thunk} and
32276 @option{-mfunction-return=thunk-extern} since the thunk function may
32277 not be reachable in the large code model.
32278
32279
32280 @item -mindirect-branch-register
32281 @opindex mindirect-branch-register
32282 Force indirect call and jump via register.
32283
32284 @end table
32285
32286 These @samp{-m} switches are supported in addition to the above
32287 on x86-64 processors in 64-bit environments.
32288
32289 @table @gcctabopt
32290 @item -m32
32291 @itemx -m64
32292 @itemx -mx32
32293 @itemx -m16
32294 @itemx -miamcu
32295 @opindex m32
32296 @opindex m64
32297 @opindex mx32
32298 @opindex m16
32299 @opindex miamcu
32300 Generate code for a 16-bit, 32-bit or 64-bit environment.
32301 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
32302 to 32 bits, and
32303 generates code that runs on any i386 system.
32304
32305 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
32306 types to 64 bits, and generates code for the x86-64 architecture.
32307 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
32308 and @option{-mdynamic-no-pic} options.
32309
32310 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
32311 to 32 bits, and
32312 generates code for the x86-64 architecture.
32313
32314 The @option{-m16} option is the same as @option{-m32}, except for that
32315 it outputs the @code{.code16gcc} assembly directive at the beginning of
32316 the assembly output so that the binary can run in 16-bit mode.
32317
32318 The @option{-miamcu} option generates code which conforms to Intel MCU
32319 psABI. It requires the @option{-m32} option to be turned on.
32320
32321 @item -mno-red-zone
32322 @opindex mno-red-zone
32323 @opindex mred-zone
32324 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
32325 by the x86-64 ABI; it is a 128-byte area beyond the location of the
32326 stack pointer that is not modified by signal or interrupt handlers
32327 and therefore can be used for temporary data without adjusting the stack
32328 pointer. The flag @option{-mno-red-zone} disables this red zone.
32329
32330 @item -mcmodel=small
32331 @opindex mcmodel=small
32332 Generate code for the small code model: the program and its symbols must
32333 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
32334 Programs can be statically or dynamically linked. This is the default
32335 code model.
32336
32337 @item -mcmodel=kernel
32338 @opindex mcmodel=kernel
32339 Generate code for the kernel code model. The kernel runs in the
32340 negative 2 GB of the address space.
32341 This model has to be used for Linux kernel code.
32342
32343 @item -mcmodel=medium
32344 @opindex mcmodel=medium
32345 Generate code for the medium model: the program is linked in the lower 2
32346 GB of the address space. Small symbols are also placed there. Symbols
32347 with sizes larger than @option{-mlarge-data-threshold} are put into
32348 large data or BSS sections and can be located above 2GB. Programs can
32349 be statically or dynamically linked.
32350
32351 @item -mcmodel=large
32352 @opindex mcmodel=large
32353 Generate code for the large model. This model makes no assumptions
32354 about addresses and sizes of sections.
32355
32356 @item -maddress-mode=long
32357 @opindex maddress-mode=long
32358 Generate code for long address mode. This is only supported for 64-bit
32359 and x32 environments. It is the default address mode for 64-bit
32360 environments.
32361
32362 @item -maddress-mode=short
32363 @opindex maddress-mode=short
32364 Generate code for short address mode. This is only supported for 32-bit
32365 and x32 environments. It is the default address mode for 32-bit and
32366 x32 environments.
32367
32368 @item -mneeded
32369 @itemx -mno-needed
32370 @opindex mneeded
32371 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
32372 indicate the micro-architecture ISA level required to execute the binary.
32373 @end table
32374
32375 @node x86 Windows Options
32376 @subsection x86 Windows Options
32377 @cindex x86 Windows Options
32378 @cindex Windows Options for x86
32379
32380 These additional options are available for Microsoft Windows targets:
32381
32382 @table @gcctabopt
32383 @item -mconsole
32384 @opindex mconsole
32385 This option
32386 specifies that a console application is to be generated, by
32387 instructing the linker to set the PE header subsystem type
32388 required for console applications.
32389 This option is available for Cygwin and MinGW targets and is
32390 enabled by default on those targets.
32391
32392 @item -mdll
32393 @opindex mdll
32394 This option is available for Cygwin and MinGW targets. It
32395 specifies that a DLL---a dynamic link library---is to be
32396 generated, enabling the selection of the required runtime
32397 startup object and entry point.
32398
32399 @item -mnop-fun-dllimport
32400 @opindex mnop-fun-dllimport
32401 This option is available for Cygwin and MinGW targets. It
32402 specifies that the @code{dllimport} attribute should be ignored.
32403
32404 @item -mthreads
32405 @opindex mthreads
32406 This option is available for MinGW targets. It specifies
32407 that MinGW-specific thread support is to be used.
32408
32409 @item -municode
32410 @opindex municode
32411 This option is available for MinGW-w64 targets. It causes
32412 the @code{UNICODE} preprocessor macro to be predefined, and
32413 chooses Unicode-capable runtime startup code.
32414
32415 @item -mwin32
32416 @opindex mwin32
32417 This option is available for Cygwin and MinGW targets. It
32418 specifies that the typical Microsoft Windows predefined macros are to
32419 be set in the pre-processor, but does not influence the choice
32420 of runtime library/startup code.
32421
32422 @item -mwindows
32423 @opindex mwindows
32424 This option is available for Cygwin and MinGW targets. It
32425 specifies that a GUI application is to be generated by
32426 instructing the linker to set the PE header subsystem type
32427 appropriately.
32428
32429 @item -fno-set-stack-executable
32430 @opindex fno-set-stack-executable
32431 @opindex fset-stack-executable
32432 This option is available for MinGW targets. It specifies that
32433 the executable flag for the stack used by nested functions isn't
32434 set. This is necessary for binaries running in kernel mode of
32435 Microsoft Windows, as there the User32 API, which is used to set executable
32436 privileges, isn't available.
32437
32438 @item -fwritable-relocated-rdata
32439 @opindex fno-writable-relocated-rdata
32440 @opindex fwritable-relocated-rdata
32441 This option is available for MinGW and Cygwin targets. It specifies
32442 that relocated-data in read-only section is put into the @code{.data}
32443 section. This is a necessary for older runtimes not supporting
32444 modification of @code{.rdata} sections for pseudo-relocation.
32445
32446 @item -mpe-aligned-commons
32447 @opindex mpe-aligned-commons
32448 This option is available for Cygwin and MinGW targets. It
32449 specifies that the GNU extension to the PE file format that
32450 permits the correct alignment of COMMON variables should be
32451 used when generating code. It is enabled by default if
32452 GCC detects that the target assembler found during configuration
32453 supports the feature.
32454 @end table
32455
32456 See also under @ref{x86 Options} for standard options.
32457
32458 @node Xstormy16 Options
32459 @subsection Xstormy16 Options
32460 @cindex Xstormy16 Options
32461
32462 These options are defined for Xstormy16:
32463
32464 @table @gcctabopt
32465 @item -msim
32466 @opindex msim
32467 Choose startup files and linker script suitable for the simulator.
32468 @end table
32469
32470 @node Xtensa Options
32471 @subsection Xtensa Options
32472 @cindex Xtensa Options
32473
32474 These options are supported for Xtensa targets:
32475
32476 @table @gcctabopt
32477 @item -mconst16
32478 @itemx -mno-const16
32479 @opindex mconst16
32480 @opindex mno-const16
32481 Enable or disable use of @code{CONST16} instructions for loading
32482 constant values. The @code{CONST16} instruction is currently not a
32483 standard option from Tensilica. When enabled, @code{CONST16}
32484 instructions are always used in place of the standard @code{L32R}
32485 instructions. The use of @code{CONST16} is enabled by default only if
32486 the @code{L32R} instruction is not available.
32487
32488 @item -mfused-madd
32489 @itemx -mno-fused-madd
32490 @opindex mfused-madd
32491 @opindex mno-fused-madd
32492 Enable or disable use of fused multiply/add and multiply/subtract
32493 instructions in the floating-point option. This has no effect if the
32494 floating-point option is not also enabled. Disabling fused multiply/add
32495 and multiply/subtract instructions forces the compiler to use separate
32496 instructions for the multiply and add/subtract operations. This may be
32497 desirable in some cases where strict IEEE 754-compliant results are
32498 required: the fused multiply add/subtract instructions do not round the
32499 intermediate result, thereby producing results with @emph{more} bits of
32500 precision than specified by the IEEE standard. Disabling fused multiply
32501 add/subtract instructions also ensures that the program output is not
32502 sensitive to the compiler's ability to combine multiply and add/subtract
32503 operations.
32504
32505 @item -mserialize-volatile
32506 @itemx -mno-serialize-volatile
32507 @opindex mserialize-volatile
32508 @opindex mno-serialize-volatile
32509 When this option is enabled, GCC inserts @code{MEMW} instructions before
32510 @code{volatile} memory references to guarantee sequential consistency.
32511 The default is @option{-mserialize-volatile}. Use
32512 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
32513
32514 @item -mforce-no-pic
32515 @opindex mforce-no-pic
32516 For targets, like GNU/Linux, where all user-mode Xtensa code must be
32517 position-independent code (PIC), this option disables PIC for compiling
32518 kernel code.
32519
32520 @item -mtext-section-literals
32521 @itemx -mno-text-section-literals
32522 @opindex mtext-section-literals
32523 @opindex mno-text-section-literals
32524 These options control the treatment of literal pools. The default is
32525 @option{-mno-text-section-literals}, which places literals in a separate
32526 section in the output file. This allows the literal pool to be placed
32527 in a data RAM/ROM, and it also allows the linker to combine literal
32528 pools from separate object files to remove redundant literals and
32529 improve code size. With @option{-mtext-section-literals}, the literals
32530 are interspersed in the text section in order to keep them as close as
32531 possible to their references. This may be necessary for large assembly
32532 files. Literals for each function are placed right before that function.
32533
32534 @item -mauto-litpools
32535 @itemx -mno-auto-litpools
32536 @opindex mauto-litpools
32537 @opindex mno-auto-litpools
32538 These options control the treatment of literal pools. The default is
32539 @option{-mno-auto-litpools}, which places literals in a separate
32540 section in the output file unless @option{-mtext-section-literals} is
32541 used. With @option{-mauto-litpools} the literals are interspersed in
32542 the text section by the assembler. Compiler does not produce explicit
32543 @code{.literal} directives and loads literals into registers with
32544 @code{MOVI} instructions instead of @code{L32R} to let the assembler
32545 do relaxation and place literals as necessary. This option allows
32546 assembler to create several literal pools per function and assemble
32547 very big functions, which may not be possible with
32548 @option{-mtext-section-literals}.
32549
32550 @item -mtarget-align
32551 @itemx -mno-target-align
32552 @opindex mtarget-align
32553 @opindex mno-target-align
32554 When this option is enabled, GCC instructs the assembler to
32555 automatically align instructions to reduce branch penalties at the
32556 expense of some code density. The assembler attempts to widen density
32557 instructions to align branch targets and the instructions following call
32558 instructions. If there are not enough preceding safe density
32559 instructions to align a target, no widening is performed. The
32560 default is @option{-mtarget-align}. These options do not affect the
32561 treatment of auto-aligned instructions like @code{LOOP}, which the
32562 assembler always aligns, either by widening density instructions or
32563 by inserting NOP instructions.
32564
32565 @item -mlongcalls
32566 @itemx -mno-longcalls
32567 @opindex mlongcalls
32568 @opindex mno-longcalls
32569 When this option is enabled, GCC instructs the assembler to translate
32570 direct calls to indirect calls unless it can determine that the target
32571 of a direct call is in the range allowed by the call instruction. This
32572 translation typically occurs for calls to functions in other source
32573 files. Specifically, the assembler translates a direct @code{CALL}
32574 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
32575 The default is @option{-mno-longcalls}. This option should be used in
32576 programs where the call target can potentially be out of range. This
32577 option is implemented in the assembler, not the compiler, so the
32578 assembly code generated by GCC still shows direct call
32579 instructions---look at the disassembled object code to see the actual
32580 instructions. Note that the assembler uses an indirect call for
32581 every cross-file call, not just those that really are out of range.
32582
32583 @item -mabi=@var{name}
32584 @opindex mabi
32585 Generate code for the specified ABI@. Permissible values are: @samp{call0},
32586 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
32587
32588 @item -mabi=call0
32589 @opindex mabi=call0
32590 When this option is enabled function parameters are passed in registers
32591 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
32592 caller-saved, and register @code{a15} may be used as a frame pointer.
32593 When this version of the ABI is enabled the C preprocessor symbol
32594 @code{__XTENSA_CALL0_ABI__} is defined.
32595
32596 @item -mabi=windowed
32597 @opindex mabi=windowed
32598 When this option is enabled function parameters are passed in registers
32599 @code{a10} through @code{a15}, and called function rotates register window
32600 by 8 registers on entry so that its arguments are found in registers
32601 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
32602 pointer. Register window is rotated 8 registers back upon return.
32603 When this version of the ABI is enabled the C preprocessor symbol
32604 @code{__XTENSA_WINDOWED_ABI__} is defined.
32605 @end table
32606
32607 @node zSeries Options
32608 @subsection zSeries Options
32609 @cindex zSeries options
32610
32611 These are listed under @xref{S/390 and zSeries Options}.
32612
32613
32614 @c man end
32615
32616 @node Spec Files
32617 @section Specifying Subprocesses and the Switches to Pass to Them
32618 @cindex Spec Files
32619
32620 @command{gcc} is a driver program. It performs its job by invoking a
32621 sequence of other programs to do the work of compiling, assembling and
32622 linking. GCC interprets its command-line parameters and uses these to
32623 deduce which programs it should invoke, and which command-line options
32624 it ought to place on their command lines. This behavior is controlled
32625 by @dfn{spec strings}. In most cases there is one spec string for each
32626 program that GCC can invoke, but a few programs have multiple spec
32627 strings to control their behavior. The spec strings built into GCC can
32628 be overridden by using the @option{-specs=} command-line switch to specify
32629 a spec file.
32630
32631 @dfn{Spec files} are plain-text files that are used to construct spec
32632 strings. They consist of a sequence of directives separated by blank
32633 lines. The type of directive is determined by the first non-whitespace
32634 character on the line, which can be one of the following:
32635
32636 @table @code
32637 @item %@var{command}
32638 Issues a @var{command} to the spec file processor. The commands that can
32639 appear here are:
32640
32641 @table @code
32642 @item %include <@var{file}>
32643 @cindex @code{%include}
32644 Search for @var{file} and insert its text at the current point in the
32645 specs file.
32646
32647 @item %include_noerr <@var{file}>
32648 @cindex @code{%include_noerr}
32649 Just like @samp{%include}, but do not generate an error message if the include
32650 file cannot be found.
32651
32652 @item %rename @var{old_name} @var{new_name}
32653 @cindex @code{%rename}
32654 Rename the spec string @var{old_name} to @var{new_name}.
32655
32656 @end table
32657
32658 @item *[@var{spec_name}]:
32659 This tells the compiler to create, override or delete the named spec
32660 string. All lines after this directive up to the next directive or
32661 blank line are considered to be the text for the spec string. If this
32662 results in an empty string then the spec is deleted. (Or, if the
32663 spec did not exist, then nothing happens.) Otherwise, if the spec
32664 does not currently exist a new spec is created. If the spec does
32665 exist then its contents are overridden by the text of this
32666 directive, unless the first character of that text is the @samp{+}
32667 character, in which case the text is appended to the spec.
32668
32669 @item [@var{suffix}]:
32670 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
32671 and up to the next directive or blank line are considered to make up the
32672 spec string for the indicated suffix. When the compiler encounters an
32673 input file with the named suffix, it processes the spec string in
32674 order to work out how to compile that file. For example:
32675
32676 @smallexample
32677 .ZZ:
32678 z-compile -input %i
32679 @end smallexample
32680
32681 This says that any input file whose name ends in @samp{.ZZ} should be
32682 passed to the program @samp{z-compile}, which should be invoked with the
32683 command-line switch @option{-input} and with the result of performing the
32684 @samp{%i} substitution. (See below.)
32685
32686 As an alternative to providing a spec string, the text following a
32687 suffix directive can be one of the following:
32688
32689 @table @code
32690 @item @@@var{language}
32691 This says that the suffix is an alias for a known @var{language}. This is
32692 similar to using the @option{-x} command-line switch to GCC to specify a
32693 language explicitly. For example:
32694
32695 @smallexample
32696 .ZZ:
32697 @@c++
32698 @end smallexample
32699
32700 Says that .ZZ files are, in fact, C++ source files.
32701
32702 @item #@var{name}
32703 This causes an error messages saying:
32704
32705 @smallexample
32706 @var{name} compiler not installed on this system.
32707 @end smallexample
32708 @end table
32709
32710 GCC already has an extensive list of suffixes built into it.
32711 This directive adds an entry to the end of the list of suffixes, but
32712 since the list is searched from the end backwards, it is effectively
32713 possible to override earlier entries using this technique.
32714
32715 @end table
32716
32717 GCC has the following spec strings built into it. Spec files can
32718 override these strings or create their own. Note that individual
32719 targets can also add their own spec strings to this list.
32720
32721 @smallexample
32722 asm Options to pass to the assembler
32723 asm_final Options to pass to the assembler post-processor
32724 cpp Options to pass to the C preprocessor
32725 cc1 Options to pass to the C compiler
32726 cc1plus Options to pass to the C++ compiler
32727 endfile Object files to include at the end of the link
32728 link Options to pass to the linker
32729 lib Libraries to include on the command line to the linker
32730 libgcc Decides which GCC support library to pass to the linker
32731 linker Sets the name of the linker
32732 predefines Defines to be passed to the C preprocessor
32733 signed_char Defines to pass to CPP to say whether @code{char} is signed
32734 by default
32735 startfile Object files to include at the start of the link
32736 @end smallexample
32737
32738 Here is a small example of a spec file:
32739
32740 @smallexample
32741 %rename lib old_lib
32742
32743 *lib:
32744 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
32745 @end smallexample
32746
32747 This example renames the spec called @samp{lib} to @samp{old_lib} and
32748 then overrides the previous definition of @samp{lib} with a new one.
32749 The new definition adds in some extra command-line options before
32750 including the text of the old definition.
32751
32752 @dfn{Spec strings} are a list of command-line options to be passed to their
32753 corresponding program. In addition, the spec strings can contain
32754 @samp{%}-prefixed sequences to substitute variable text or to
32755 conditionally insert text into the command line. Using these constructs
32756 it is possible to generate quite complex command lines.
32757
32758 Here is a table of all defined @samp{%}-sequences for spec
32759 strings. Note that spaces are not generated automatically around the
32760 results of expanding these sequences. Therefore you can concatenate them
32761 together or combine them with constant text in a single argument.
32762
32763 @table @code
32764 @item %%
32765 Substitute one @samp{%} into the program name or argument.
32766
32767 @item %"
32768 Substitute an empty argument.
32769
32770 @item %i
32771 Substitute the name of the input file being processed.
32772
32773 @item %b
32774 Substitute the basename for outputs related with the input file being
32775 processed. This is often the substring up to (and not including) the
32776 last period and not including the directory but, unless %w is active, it
32777 expands to the basename for auxiliary outputs, which may be influenced
32778 by an explicit output name, and by various other options that control
32779 how auxiliary outputs are named.
32780
32781 @item %B
32782 This is the same as @samp{%b}, but include the file suffix (text after
32783 the last period). Without %w, it expands to the basename for dump
32784 outputs.
32785
32786 @item %d
32787 Marks the argument containing or following the @samp{%d} as a
32788 temporary file name, so that that file is deleted if GCC exits
32789 successfully. Unlike @samp{%g}, this contributes no text to the
32790 argument.
32791
32792 @item %g@var{suffix}
32793 Substitute a file name that has suffix @var{suffix} and is chosen
32794 once per compilation, and mark the argument in the same way as
32795 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
32796 name is now chosen in a way that is hard to predict even when previously
32797 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
32798 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
32799 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
32800 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
32801 was simply substituted with a file name chosen once per compilation,
32802 without regard to any appended suffix (which was therefore treated
32803 just like ordinary text), making such attacks more likely to succeed.
32804
32805 @item %u@var{suffix}
32806 Like @samp{%g}, but generates a new temporary file name
32807 each time it appears instead of once per compilation.
32808
32809 @item %U@var{suffix}
32810 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
32811 new one if there is no such last file name. In the absence of any
32812 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
32813 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
32814 involves the generation of two distinct file names, one
32815 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
32816 simply substituted with a file name chosen for the previous @samp{%u},
32817 without regard to any appended suffix.
32818
32819 @item %j@var{suffix}
32820 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
32821 writable, and if @option{-save-temps} is not used;
32822 otherwise, substitute the name
32823 of a temporary file, just like @samp{%u}. This temporary file is not
32824 meant for communication between processes, but rather as a junk
32825 disposal mechanism.
32826
32827 @item %|@var{suffix}
32828 @itemx %m@var{suffix}
32829 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
32830 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
32831 all. These are the two most common ways to instruct a program that it
32832 should read from standard input or write to standard output. If you
32833 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
32834 construct: see for example @file{gcc/fortran/lang-specs.h}.
32835
32836 @item %.@var{SUFFIX}
32837 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
32838 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
32839 terminated by the next space or %.
32840
32841 @item %w
32842 Marks the argument containing or following the @samp{%w} as the
32843 designated output file of this compilation. This puts the argument
32844 into the sequence of arguments that @samp{%o} substitutes.
32845
32846 @item %V
32847 Indicates that this compilation produces no output file.
32848
32849 @item %o
32850 Substitutes the names of all the output files, with spaces
32851 automatically placed around them. You should write spaces
32852 around the @samp{%o} as well or the results are undefined.
32853 @samp{%o} is for use in the specs for running the linker.
32854 Input files whose names have no recognized suffix are not compiled
32855 at all, but they are included among the output files, so they are
32856 linked.
32857
32858 @item %O
32859 Substitutes the suffix for object files. Note that this is
32860 handled specially when it immediately follows @samp{%g, %u, or %U},
32861 because of the need for those to form complete file names. The
32862 handling is such that @samp{%O} is treated exactly as if it had already
32863 been substituted, except that @samp{%g, %u, and %U} do not currently
32864 support additional @var{suffix} characters following @samp{%O} as they do
32865 following, for example, @samp{.o}.
32866
32867 @item %I
32868 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
32869 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
32870 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
32871 and @option{-imultilib} as necessary.
32872
32873 @item %s
32874 Current argument is the name of a library or startup file of some sort.
32875 Search for that file in a standard list of directories and substitute
32876 the full name found. The current working directory is included in the
32877 list of directories scanned.
32878
32879 @item %T
32880 Current argument is the name of a linker script. Search for that file
32881 in the current list of directories to scan for libraries. If the file
32882 is located insert a @option{--script} option into the command line
32883 followed by the full path name found. If the file is not found then
32884 generate an error message. Note: the current working directory is not
32885 searched.
32886
32887 @item %e@var{str}
32888 Print @var{str} as an error message. @var{str} is terminated by a newline.
32889 Use this when inconsistent options are detected.
32890
32891 @item %n@var{str}
32892 Print @var{str} as a notice. @var{str} is terminated by a newline.
32893
32894 @item %(@var{name})
32895 Substitute the contents of spec string @var{name} at this point.
32896
32897 @item %x@{@var{option}@}
32898 Accumulate an option for @samp{%X}.
32899
32900 @item %X
32901 Output the accumulated linker options specified by a @samp{%x} spec string.
32902
32903 @item %Y
32904 Output the accumulated assembler options specified by @option{-Wa}.
32905
32906 @item %Z
32907 Output the accumulated preprocessor options specified by @option{-Wp}.
32908
32909 @item %M
32910 Output @code{multilib_os_dir}.
32911
32912 @item %R
32913 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
32914
32915 @item %a
32916 Process the @code{asm} spec. This is used to compute the
32917 switches to be passed to the assembler.
32918
32919 @item %A
32920 Process the @code{asm_final} spec. This is a spec string for
32921 passing switches to an assembler post-processor, if such a program is
32922 needed.
32923
32924 @item %l
32925 Process the @code{link} spec. This is the spec for computing the
32926 command line passed to the linker. Typically it makes use of the
32927 @samp{%L %G %S %D and %E} sequences.
32928
32929 @item %D
32930 Dump out a @option{-L} option for each directory that GCC believes might
32931 contain startup files. If the target supports multilibs then the
32932 current multilib directory is prepended to each of these paths.
32933
32934 @item %L
32935 Process the @code{lib} spec. This is a spec string for deciding which
32936 libraries are included on the command line to the linker.
32937
32938 @item %G
32939 Process the @code{libgcc} spec. This is a spec string for deciding
32940 which GCC support library is included on the command line to the linker.
32941
32942 @item %S
32943 Process the @code{startfile} spec. This is a spec for deciding which
32944 object files are the first ones passed to the linker. Typically
32945 this might be a file named @file{crt0.o}.
32946
32947 @item %E
32948 Process the @code{endfile} spec. This is a spec string that specifies
32949 the last object files that are passed to the linker.
32950
32951 @item %C
32952 Process the @code{cpp} spec. This is used to construct the arguments
32953 to be passed to the C preprocessor.
32954
32955 @item %1
32956 Process the @code{cc1} spec. This is used to construct the options to be
32957 passed to the actual C compiler (@command{cc1}).
32958
32959 @item %2
32960 Process the @code{cc1plus} spec. This is used to construct the options to be
32961 passed to the actual C++ compiler (@command{cc1plus}).
32962
32963 @item %*
32964 Substitute the variable part of a matched option. See below.
32965 Note that each comma in the substituted string is replaced by
32966 a single space.
32967
32968 @item %<S
32969 Remove all occurrences of @code{-S} from the command line. Note---this
32970 command is position dependent. @samp{%} commands in the spec string
32971 before this one see @code{-S}, @samp{%} commands in the spec string
32972 after this one do not.
32973
32974 @item %<S*
32975 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
32976
32977 @item %>S
32978 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
32979
32980 @item %:@var{function}(@var{args})
32981 Call the named function @var{function}, passing it @var{args}.
32982 @var{args} is first processed as a nested spec string, then split
32983 into an argument vector in the usual fashion. The function returns
32984 a string which is processed as if it had appeared literally as part
32985 of the current spec.
32986
32987 The following built-in spec functions are provided:
32988
32989 @table @code
32990 @item @code{getenv}
32991 The @code{getenv} spec function takes two arguments: an environment
32992 variable name and a string. If the environment variable is not
32993 defined, a fatal error is issued. Otherwise, the return value is the
32994 value of the environment variable concatenated with the string. For
32995 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
32996
32997 @smallexample
32998 %:getenv(TOPDIR /include)
32999 @end smallexample
33000
33001 expands to @file{/path/to/top/include}.
33002
33003 @item @code{if-exists}
33004 The @code{if-exists} spec function takes one argument, an absolute
33005 pathname to a file. If the file exists, @code{if-exists} returns the
33006 pathname. Here is a small example of its usage:
33007
33008 @smallexample
33009 *startfile:
33010 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
33011 @end smallexample
33012
33013 @item @code{if-exists-else}
33014 The @code{if-exists-else} spec function is similar to the @code{if-exists}
33015 spec function, except that it takes two arguments. The first argument is
33016 an absolute pathname to a file. If the file exists, @code{if-exists-else}
33017 returns the pathname. If it does not exist, it returns the second argument.
33018 This way, @code{if-exists-else} can be used to select one file or another,
33019 based on the existence of the first. Here is a small example of its usage:
33020
33021 @smallexample
33022 *startfile:
33023 crt0%O%s %:if-exists(crti%O%s) \
33024 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
33025 @end smallexample
33026
33027 @item @code{if-exists-then-else}
33028 The @code{if-exists-then-else} spec function takes at least two arguments
33029 and an optional third one. The first argument is an absolute pathname to a
33030 file. If the file exists, the function returns the second argument.
33031 If the file does not exist, the function returns the third argument if there
33032 is one, or NULL otherwise. This can be used to expand one text, or optionally
33033 another, based on the existence of a file. Here is a small example of its
33034 usage:
33035
33036 @smallexample
33037 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
33038 @end smallexample
33039
33040 @item @code{sanitize}
33041 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
33042 any address, thread or undefined behavior sanitizers are active.
33043
33044 @smallexample
33045 %@{%:sanitize(address):-funwind-tables@}
33046 @end smallexample
33047
33048 @item @code{replace-outfile}
33049 The @code{replace-outfile} spec function takes two arguments. It looks for the
33050 first argument in the outfiles array and replaces it with the second argument. Here
33051 is a small example of its usage:
33052
33053 @smallexample
33054 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
33055 @end smallexample
33056
33057 @item @code{remove-outfile}
33058 The @code{remove-outfile} spec function takes one argument. It looks for the
33059 first argument in the outfiles array and removes it. Here is a small example
33060 its usage:
33061
33062 @smallexample
33063 %:remove-outfile(-lm)
33064 @end smallexample
33065
33066 @item @code{version-compare}
33067 The @code{version-compare} spec function takes four or five arguments of the following
33068 form:
33069
33070 @smallexample
33071 <comparison-op> <arg1> [<arg2>] <switch> <result>
33072 @end smallexample
33073
33074 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
33075 The supported @code{comparison-op} values are:
33076
33077 @table @code
33078 @item >=
33079 True if @code{switch} is a later (or same) version than @code{arg1}
33080
33081 @item !>
33082 Opposite of @code{>=}
33083
33084 @item <
33085 True if @code{switch} is an earlier version than @code{arg1}
33086
33087 @item !<
33088 Opposite of @code{<}
33089
33090 @item ><
33091 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
33092
33093 @item <>
33094 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
33095 @end table
33096
33097 If the @code{switch} is not present at all, the condition is false unless the first character
33098 of the @code{comparison-op} is @code{!}.
33099
33100 @smallexample
33101 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
33102 @end smallexample
33103
33104 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
33105 passed.
33106
33107 @item @code{include}
33108 The @code{include} spec function behaves much like @code{%include}, with the advantage
33109 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
33110 the filename, and looks for it in the startfile path. It always returns NULL.
33111
33112 @smallexample
33113 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
33114 @end smallexample
33115
33116 @item @code{pass-through-libs}
33117 The @code{pass-through-libs} spec function takes any number of arguments. It
33118 finds any @option{-l} options and any non-options ending in @file{.a} (which it
33119 assumes are the names of linker input library archive files) and returns a
33120 result containing all the found arguments each prepended by
33121 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
33122 intended to be passed to the LTO linker plugin.
33123
33124 @smallexample
33125 %:pass-through-libs(%G %L %G)
33126 @end smallexample
33127
33128 @item @code{print-asm-header}
33129 The @code{print-asm-header} function takes no arguments and simply
33130 prints a banner like:
33131
33132 @smallexample
33133 Assembler options
33134 =================
33135
33136 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
33137 @end smallexample
33138
33139 It is used to separate compiler options from assembler options
33140 in the @option{--target-help} output.
33141
33142 @item @code{gt}
33143 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
33144 empty string) if the second-to-last argument is greater than the last argument, and NULL
33145 otherwise. The following example inserts the @code{link_gomp} spec if the last
33146 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
33147
33148 @smallexample
33149 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
33150 @end smallexample
33151
33152 @item @code{debug-level-gt}
33153 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
33154 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
33155 otherwise.
33156
33157 @smallexample
33158 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
33159 @end smallexample
33160 @end table
33161
33162 @item %@{S@}
33163 Substitutes the @code{-S} switch, if that switch is given to GCC@.
33164 If that switch is not specified, this substitutes nothing. Note that
33165 the leading dash is omitted when specifying this option, and it is
33166 automatically inserted if the substitution is performed. Thus the spec
33167 string @samp{%@{foo@}} matches the command-line option @option{-foo}
33168 and outputs the command-line option @option{-foo}.
33169
33170 @item %W@{S@}
33171 Like %@{@code{S}@} but mark last argument supplied within as a file to be
33172 deleted on failure.
33173
33174 @item %@@@{S@}
33175 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
33176 @code{@@FILE} if an @code{@@file} argument has been supplied.
33177
33178 @item %@{S*@}
33179 Substitutes all the switches specified to GCC whose names start
33180 with @code{-S}, but which also take an argument. This is used for
33181 switches like @option{-o}, @option{-D}, @option{-I}, etc.
33182 GCC considers @option{-o foo} as being
33183 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
33184 text, including the space. Thus two arguments are generated.
33185
33186 @item %@{S*&T*@}
33187 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
33188 (the order of @code{S} and @code{T} in the spec is not significant).
33189 There can be any number of ampersand-separated variables; for each the
33190 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
33191
33192 @item %@{S:X@}
33193 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
33194
33195 @item %@{!S:X@}
33196 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
33197
33198 @item %@{S*:X@}
33199 Substitutes @code{X} if one or more switches whose names start with
33200 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
33201 once, no matter how many such switches appeared. However, if @code{%*}
33202 appears somewhere in @code{X}, then @code{X} is substituted once
33203 for each matching switch, with the @code{%*} replaced by the part of
33204 that switch matching the @code{*}.
33205
33206 If @code{%*} appears as the last part of a spec sequence then a space
33207 is added after the end of the last substitution. If there is more
33208 text in the sequence, however, then a space is not generated. This
33209 allows the @code{%*} substitution to be used as part of a larger
33210 string. For example, a spec string like this:
33211
33212 @smallexample
33213 %@{mcu=*:--script=%*/memory.ld@}
33214 @end smallexample
33215
33216 @noindent
33217 when matching an option like @option{-mcu=newchip} produces:
33218
33219 @smallexample
33220 --script=newchip/memory.ld
33221 @end smallexample
33222
33223 @item %@{.S:X@}
33224 Substitutes @code{X}, if processing a file with suffix @code{S}.
33225
33226 @item %@{!.S:X@}
33227 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
33228
33229 @item %@{,S:X@}
33230 Substitutes @code{X}, if processing a file for language @code{S}.
33231
33232 @item %@{!,S:X@}
33233 Substitutes @code{X}, if not processing a file for language @code{S}.
33234
33235 @item %@{S|P:X@}
33236 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
33237 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
33238 @code{*} sequences as well, although they have a stronger binding than
33239 the @samp{|}. If @code{%*} appears in @code{X}, all of the
33240 alternatives must be starred, and only the first matching alternative
33241 is substituted.
33242
33243 For example, a spec string like this:
33244
33245 @smallexample
33246 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
33247 @end smallexample
33248
33249 @noindent
33250 outputs the following command-line options from the following input
33251 command-line options:
33252
33253 @smallexample
33254 fred.c -foo -baz
33255 jim.d -bar -boggle
33256 -d fred.c -foo -baz -boggle
33257 -d jim.d -bar -baz -boggle
33258 @end smallexample
33259
33260 @item %@{%:@var{function}(@var{args}):X@}
33261
33262 Call function named @var{function} with args @var{args}. If the
33263 function returns non-NULL, then @code{X} is substituted, if it returns
33264 NULL, it isn't substituted.
33265
33266 @item %@{S:X; T:Y; :D@}
33267
33268 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
33269 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
33270 be as many clauses as you need. This may be combined with @code{.},
33271 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
33272
33273
33274 @end table
33275
33276 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
33277 or similar construct can use a backslash to ignore the special meaning
33278 of the character following it, thus allowing literal matching of a
33279 character that is otherwise specially treated. For example,
33280 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
33281 @option{-std=iso9899:1999} option is given.
33282
33283 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
33284 construct may contain other nested @samp{%} constructs or spaces, or
33285 even newlines. They are processed as usual, as described above.
33286 Trailing white space in @code{X} is ignored. White space may also
33287 appear anywhere on the left side of the colon in these constructs,
33288 except between @code{.} or @code{*} and the corresponding word.
33289
33290 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
33291 handled specifically in these constructs. If another value of
33292 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
33293 @option{-W} switch is found later in the command line, the earlier
33294 switch value is ignored, except with @{@code{S}*@} where @code{S} is
33295 just one letter, which passes all matching options.
33296
33297 The character @samp{|} at the beginning of the predicate text is used to
33298 indicate that a command should be piped to the following command, but
33299 only if @option{-pipe} is specified.
33300
33301 It is built into GCC which switches take arguments and which do not.
33302 (You might think it would be useful to generalize this to allow each
33303 compiler's spec to say which switches take arguments. But this cannot
33304 be done in a consistent fashion. GCC cannot even decide which input
33305 files have been specified without knowing which switches take arguments,
33306 and it must know which input files to compile in order to tell which
33307 compilers to run).
33308
33309 GCC also knows implicitly that arguments starting in @option{-l} are to be
33310 treated as compiler output files, and passed to the linker in their
33311 proper position among the other output files.
33312
33313 @node Environment Variables
33314 @section Environment Variables Affecting GCC
33315 @cindex environment variables
33316
33317 @c man begin ENVIRONMENT
33318 This section describes several environment variables that affect how GCC
33319 operates. Some of them work by specifying directories or prefixes to use
33320 when searching for various kinds of files. Some are used to specify other
33321 aspects of the compilation environment.
33322
33323 Note that you can also specify places to search using options such as
33324 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
33325 take precedence over places specified using environment variables, which
33326 in turn take precedence over those specified by the configuration of GCC@.
33327 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
33328 GNU Compiler Collection (GCC) Internals}.
33329
33330 @table @env
33331 @item LANG
33332 @itemx LC_CTYPE
33333 @c @itemx LC_COLLATE
33334 @itemx LC_MESSAGES
33335 @c @itemx LC_MONETARY
33336 @c @itemx LC_NUMERIC
33337 @c @itemx LC_TIME
33338 @itemx LC_ALL
33339 @findex LANG
33340 @findex LC_CTYPE
33341 @c @findex LC_COLLATE
33342 @findex LC_MESSAGES
33343 @c @findex LC_MONETARY
33344 @c @findex LC_NUMERIC
33345 @c @findex LC_TIME
33346 @findex LC_ALL
33347 @cindex locale
33348 These environment variables control the way that GCC uses
33349 localization information which allows GCC to work with different
33350 national conventions. GCC inspects the locale categories
33351 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
33352 so. These locale categories can be set to any value supported by your
33353 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
33354 Kingdom encoded in UTF-8.
33355
33356 The @env{LC_CTYPE} environment variable specifies character
33357 classification. GCC uses it to determine the character boundaries in
33358 a string; this is needed for some multibyte encodings that contain quote
33359 and escape characters that are otherwise interpreted as a string
33360 end or escape.
33361
33362 The @env{LC_MESSAGES} environment variable specifies the language to
33363 use in diagnostic messages.
33364
33365 If the @env{LC_ALL} environment variable is set, it overrides the value
33366 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
33367 and @env{LC_MESSAGES} default to the value of the @env{LANG}
33368 environment variable. If none of these variables are set, GCC
33369 defaults to traditional C English behavior.
33370
33371 @item TMPDIR
33372 @findex TMPDIR
33373 If @env{TMPDIR} is set, it specifies the directory to use for temporary
33374 files. GCC uses temporary files to hold the output of one stage of
33375 compilation which is to be used as input to the next stage: for example,
33376 the output of the preprocessor, which is the input to the compiler
33377 proper.
33378
33379 @item GCC_COMPARE_DEBUG
33380 @findex GCC_COMPARE_DEBUG
33381 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
33382 @option{-fcompare-debug} to the compiler driver. See the documentation
33383 of this option for more details.
33384
33385 @item GCC_EXEC_PREFIX
33386 @findex GCC_EXEC_PREFIX
33387 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
33388 names of the subprograms executed by the compiler. No slash is added
33389 when this prefix is combined with the name of a subprogram, but you can
33390 specify a prefix that ends with a slash if you wish.
33391
33392 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
33393 an appropriate prefix to use based on the pathname it is invoked with.
33394
33395 If GCC cannot find the subprogram using the specified prefix, it
33396 tries looking in the usual places for the subprogram.
33397
33398 The default value of @env{GCC_EXEC_PREFIX} is
33399 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
33400 the installed compiler. In many cases @var{prefix} is the value
33401 of @code{prefix} when you ran the @file{configure} script.
33402
33403 Other prefixes specified with @option{-B} take precedence over this prefix.
33404
33405 This prefix is also used for finding files such as @file{crt0.o} that are
33406 used for linking.
33407
33408 In addition, the prefix is used in an unusual way in finding the
33409 directories to search for header files. For each of the standard
33410 directories whose name normally begins with @samp{/usr/local/lib/gcc}
33411 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
33412 replacing that beginning with the specified prefix to produce an
33413 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
33414 @file{foo/bar} just before it searches the standard directory
33415 @file{/usr/local/lib/bar}.
33416 If a standard directory begins with the configured
33417 @var{prefix} then the value of @var{prefix} is replaced by
33418 @env{GCC_EXEC_PREFIX} when looking for header files.
33419
33420 @item COMPILER_PATH
33421 @findex COMPILER_PATH
33422 The value of @env{COMPILER_PATH} is a colon-separated list of
33423 directories, much like @env{PATH}. GCC tries the directories thus
33424 specified when searching for subprograms, if it cannot find the
33425 subprograms using @env{GCC_EXEC_PREFIX}.
33426
33427 @item LIBRARY_PATH
33428 @findex LIBRARY_PATH
33429 The value of @env{LIBRARY_PATH} is a colon-separated list of
33430 directories, much like @env{PATH}. When configured as a native compiler,
33431 GCC tries the directories thus specified when searching for special
33432 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
33433 using GCC also uses these directories when searching for ordinary
33434 libraries for the @option{-l} option (but directories specified with
33435 @option{-L} come first).
33436
33437 @item LANG
33438 @findex LANG
33439 @cindex locale definition
33440 This variable is used to pass locale information to the compiler. One way in
33441 which this information is used is to determine the character set to be used
33442 when character literals, string literals and comments are parsed in C and C++.
33443 When the compiler is configured to allow multibyte characters,
33444 the following values for @env{LANG} are recognized:
33445
33446 @table @samp
33447 @item C-JIS
33448 Recognize JIS characters.
33449 @item C-SJIS
33450 Recognize SJIS characters.
33451 @item C-EUCJP
33452 Recognize EUCJP characters.
33453 @end table
33454
33455 If @env{LANG} is not defined, or if it has some other value, then the
33456 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
33457 recognize and translate multibyte characters.
33458
33459 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
33460 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
33461 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
33462 then additional text will be emitted to stderr when fix-it hints are
33463 emitted. @option{-fdiagnostics-parseable-fixits} and
33464 @option{-fno-diagnostics-parseable-fixits} take precedence over this
33465 environment variable.
33466
33467 @table @samp
33468 @item fixits-v1
33469 Emit parseable fix-it hints, equivalent to
33470 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
33471 expressed as a count of bytes, starting at byte 1 for the initial column.
33472
33473 @item fixits-v2
33474 As @code{fixits-v1}, but columns are expressed as display columns,
33475 as per @option{-fdiagnostics-column-unit=display}.
33476 @end table
33477
33478 @end table
33479
33480 @noindent
33481 Some additional environment variables affect the behavior of the
33482 preprocessor.
33483
33484 @include cppenv.texi
33485
33486 @c man end
33487
33488 @node Precompiled Headers
33489 @section Using Precompiled Headers
33490 @cindex precompiled headers
33491 @cindex speed of compilation
33492
33493 Often large projects have many header files that are included in every
33494 source file. The time the compiler takes to process these header files
33495 over and over again can account for nearly all of the time required to
33496 build the project. To make builds faster, GCC allows you to
33497 @dfn{precompile} a header file.
33498
33499 To create a precompiled header file, simply compile it as you would any
33500 other file, if necessary using the @option{-x} option to make the driver
33501 treat it as a C or C++ header file. You may want to use a
33502 tool like @command{make} to keep the precompiled header up-to-date when
33503 the headers it contains change.
33504
33505 A precompiled header file is searched for when @code{#include} is
33506 seen in the compilation. As it searches for the included file
33507 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
33508 compiler looks for a precompiled header in each directory just before it
33509 looks for the include file in that directory. The name searched for is
33510 the name specified in the @code{#include} with @samp{.gch} appended. If
33511 the precompiled header file cannot be used, it is ignored.
33512
33513 For instance, if you have @code{#include "all.h"}, and you have
33514 @file{all.h.gch} in the same directory as @file{all.h}, then the
33515 precompiled header file is used if possible, and the original
33516 header is used otherwise.
33517
33518 Alternatively, you might decide to put the precompiled header file in a
33519 directory and use @option{-I} to ensure that directory is searched
33520 before (or instead of) the directory containing the original header.
33521 Then, if you want to check that the precompiled header file is always
33522 used, you can put a file of the same name as the original header in this
33523 directory containing an @code{#error} command.
33524
33525 This also works with @option{-include}. So yet another way to use
33526 precompiled headers, good for projects not designed with precompiled
33527 header files in mind, is to simply take most of the header files used by
33528 a project, include them from another header file, precompile that header
33529 file, and @option{-include} the precompiled header. If the header files
33530 have guards against multiple inclusion, they are skipped because
33531 they've already been included (in the precompiled header).
33532
33533 If you need to precompile the same header file for different
33534 languages, targets, or compiler options, you can instead make a
33535 @emph{directory} named like @file{all.h.gch}, and put each precompiled
33536 header in the directory, perhaps using @option{-o}. It doesn't matter
33537 what you call the files in the directory; every precompiled header in
33538 the directory is considered. The first precompiled header
33539 encountered in the directory that is valid for this compilation is
33540 used; they're searched in no particular order.
33541
33542 There are many other possibilities, limited only by your imagination,
33543 good sense, and the constraints of your build system.
33544
33545 A precompiled header file can be used only when these conditions apply:
33546
33547 @itemize
33548 @item
33549 Only one precompiled header can be used in a particular compilation.
33550
33551 @item
33552 A precompiled header cannot be used once the first C token is seen. You
33553 can have preprocessor directives before a precompiled header; you cannot
33554 include a precompiled header from inside another header.
33555
33556 @item
33557 The precompiled header file must be produced for the same language as
33558 the current compilation. You cannot use a C precompiled header for a C++
33559 compilation.
33560
33561 @item
33562 The precompiled header file must have been produced by the same compiler
33563 binary as the current compilation is using.
33564
33565 @item
33566 Any macros defined before the precompiled header is included must
33567 either be defined in the same way as when the precompiled header was
33568 generated, or must not affect the precompiled header, which usually
33569 means that they don't appear in the precompiled header at all.
33570
33571 The @option{-D} option is one way to define a macro before a
33572 precompiled header is included; using a @code{#define} can also do it.
33573 There are also some options that define macros implicitly, like
33574 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
33575 defined this way.
33576
33577 @item If debugging information is output when using the precompiled
33578 header, using @option{-g} or similar, the same kind of debugging information
33579 must have been output when building the precompiled header. However,
33580 a precompiled header built using @option{-g} can be used in a compilation
33581 when no debugging information is being output.
33582
33583 @item The same @option{-m} options must generally be used when building
33584 and using the precompiled header. @xref{Submodel Options},
33585 for any cases where this rule is relaxed.
33586
33587 @item Each of the following options must be the same when building and using
33588 the precompiled header:
33589
33590 @gccoptlist{-fexceptions}
33591
33592 @item
33593 Some other command-line options starting with @option{-f},
33594 @option{-p}, or @option{-O} must be defined in the same way as when
33595 the precompiled header was generated. At present, it's not clear
33596 which options are safe to change and which are not; the safest choice
33597 is to use exactly the same options when generating and using the
33598 precompiled header. The following are known to be safe:
33599
33600 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
33601 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
33602 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
33603 -pedantic-errors}
33604
33605 @item Address space layout randomization (ASLR) can lead to not binary identical
33606 PCH files. If you rely on stable PCH file contents disable ASLR when generating
33607 PCH files.
33608
33609 @end itemize
33610
33611 For all of these except the last, the compiler automatically
33612 ignores the precompiled header if the conditions aren't met. If you
33613 find an option combination that doesn't work and doesn't cause the
33614 precompiled header to be ignored, please consider filing a bug report,
33615 see @ref{Bugs}.
33616
33617 If you do use differing options when generating and using the
33618 precompiled header, the actual behavior is a mixture of the
33619 behavior for the options. For instance, if you use @option{-g} to
33620 generate the precompiled header but not when using it, you may or may
33621 not get debugging information for routines in the precompiled header.
33622
33623 @node C++ Modules
33624 @section C++ Modules
33625 @cindex speed of compilation
33626
33627 Modules are a C++20 language feature. As the name suggests, they
33628 provides a modular compilation system, intending to provide both
33629 faster builds and better library isolation. The ``Merging Modules''
33630 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
33631 of changes to the standard, although it does not capture later
33632 changes. That specification is now part of C++20,
33633 @uref{git@@github.com:cplusplus/draft.git}, it is considered complete
33634 (there may be defect reports to come).
33635
33636 @emph{G++'s modules support is not complete.} Other than bugs, the
33637 known missing pieces are:
33638
33639 @table @emph
33640
33641 @item Private Module Fragment
33642 The Private Module Fragment is recognized, but an error is emitted.
33643
33644 @item Partition definition visibility rules
33645 Entities may be defined in implementation partitions, and those
33646 definitions are not available outside of the module. This is not
33647 implemented, and the definitions are available to extra-module use.
33648
33649 @item Textual merging of reachable GM entities
33650 Entities may be multiply defined across different header-units.
33651 These must be de-duplicated, and this is implemented across imports,
33652 or when an import redefines a textually-defined entity. However the
33653 reverse is not implemented---textually redefining an entity that has
33654 been defined in an imported header-unit. A redefinition error is
33655 emitted.
33656
33657 @item Translation-Unit local referencing rules
33658 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
33659 (@uref{https://wg21.link/p2003}) add limitations on which entities an
33660 exported region may reference (for instance, the entities an exported
33661 template definition may reference). These are not fully implemented.
33662
33663 @item Language-linkage module attachment
33664 Declarations with explicit language linkage (@code{extern "C"} or
33665 @code{extern "C++"}) are attached to the global module, even when in
33666 the purview of a named module. This is not implemented. Such
33667 declarations will be attached to the module, if any, in which they are
33668 declared.
33669
33670 @item Standard Library Header Units
33671 The Standard Library is not provided as importable header units. If
33672 you want to import such units, you must explicitly build them first.
33673 If you do not do this with care, you may have multiple declarations,
33674 which the module machinery must merge---compiler resource usage can be
33675 affected by how you partition header files into header units.
33676
33677 @end table
33678
33679 Modular compilation is @emph{not} enabled with just the
33680 @option{-std=c++20} option. You must explicitly enable it with the
33681 @option{-fmodules-ts} option. It is independent of the language
33682 version selected, although in pre-C++20 versions, it is of course an
33683 extension.
33684
33685 No new source file suffixes are required or supported. If you wish to
33686 use a non-standard suffix (@pxref{Overall Options}), you also need
33687 to provide a @option{-x c++} option too.@footnote{Some users like to
33688 distinguish module interface files with a new suffix, such as naming
33689 the source @code{module.cppm}, which involves
33690 teaching all tools about the new suffix. A different scheme, such as
33691 naming @code{module-m.cpp} would be less invasive.}
33692
33693 Compiling a module interface unit produces an additional output (to
33694 the assembly or object file), called a Compiled Module Interface
33695 (CMI). This encodes the exported declarations of the module.
33696 Importing a module reads in the CMI. The import graph is a Directed
33697 Acyclic Graph (DAG). You must build imports before the importer.
33698
33699 Header files may themselves be compiled to header units, which are a
33700 transitional ability aiming at faster compilation. The
33701 @option{-fmodule-header} option is used to enable this, and implies
33702 the @option{-fmodules-ts} option. These CMIs are named by the fully
33703 resolved underlying header file, and thus may be a complete pathname
33704 containing subdirectories. If the header file is found at an absolute
33705 pathname, the CMI location is still relative to a CMI root directory.
33706
33707 As header files often have no suffix, you commonly have to specify a
33708 @option{-x} option to tell the compiler the source is a header file.
33709 You may use @option{-x c++-header}, @option{-x c++-user-header} or
33710 @option{-x c++-system-header}. When used in conjunction with
33711 @option{-fmodules-ts}, these all imply an appropriate
33712 @option{-fmodule-header} option. The latter two variants use the
33713 user or system include path to search for the file specified. This
33714 allows you to, for instance, compile standard library header files as
33715 header units, without needing to know exactly where they are
33716 installed. Specifying the language as one of these variants also
33717 inhibits output of the object file, as header files have no associated
33718 object file.
33719
33720 The @option{-fmodule-only} option disables generation of the
33721 associated object file for compiling a module interface. Only the CMI
33722 is generated. This option is implied when using the
33723 @option{-fmodule-header} option.
33724
33725 The @option{-flang-info-include-translate} and
33726 @option{-flang-info-include-translate-not} options notes whether
33727 include translation occurs or not. With no argument, the first will
33728 note all include translation. The second will note all
33729 non-translations of include files not known to intentionally be
33730 textual. With an argument, queries about include translation of a
33731 header files with that particular trailing pathname are noted. You
33732 may repeat this form to cover several different header files. This
33733 option may be helpful in determining whether include translation is
33734 happening---if it is working correctly, it behaves as if it isn't
33735 there at all.
33736
33737 The @option{-flang-info-module-cmi} option can be used to determine
33738 where the compiler is reading a CMI from. Without the option, the
33739 compiler is silent when such a read is successful. This option has an
33740 optional argument, which will restrict the notification to just the
33741 set of named modules or header units specified.
33742
33743 The @option{-Winvalid-imported-macros} option causes all imported macros
33744 to be resolved at the end of compilation. Without this, imported
33745 macros are only resolved when expanded or (re)defined. This option
33746 detects conflicting import definitions for all macros.
33747
33748 For details of the @option{-fmodule-mapper} family of options,
33749 @pxref{C++ Module Mapper}.
33750
33751 @menu
33752 * C++ Module Mapper:: Module Mapper
33753 * C++ Module Preprocessing:: Module Preprocessing
33754 * C++ Compiled Module Interface:: Compiled Module Interface
33755 @end menu
33756
33757 @node C++ Module Mapper
33758 @subsection Module Mapper
33759 @cindex C++ Module Mapper
33760
33761 A module mapper provides a server or file that the compiler queries to
33762 determine the mapping between module names and CMI files. It is also
33763 used to build CMIs on demand. @emph{Mapper functionality is in its
33764 infancy and is intended for experimentation with build system
33765 interactions.}
33766
33767 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
33768 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
33769 have one of the following forms:
33770
33771 @table @gcctabopt
33772
33773 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
33774 An optional hostname and a numeric port number to connect to. If the
33775 hostname is omitted, the loopback address is used. If the hostname
33776 corresponds to multiple IPV6 addresses, these are tried in turn, until
33777 one is successful. If your host lacks IPv6, this form is
33778 non-functional. If you must use IPv4 use
33779 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
33780
33781 @item =@var{socket}@r{[}?@var{ident}@r{]}
33782 A local domain socket. If your host lacks local domain sockets, this
33783 form is non-functional.
33784
33785 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
33786 A program to spawn, and communicate with on its stdin/stdout streams.
33787 Your @var{PATH} environment variable is searched for the program.
33788 Arguments are separated by space characters, (it is not possible for
33789 one of the arguments delivered to the program to contain a space). An
33790 exception is if @var{program} begins with @@. In that case
33791 @var{program} (sans @@) is looked for in the compiler's internal
33792 binary directory. Thus the sample mapper-server can be specified
33793 with @code{@@g++-mapper-server}.
33794
33795 @item <>@r{[}?@var{ident}@r{]}
33796 @item <>@var{inout}@r{[}?@var{ident}@r{]}
33797 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
33798 Named pipes or file descriptors to communicate over. The first form,
33799 @option{<>}, communicates over stdin and stdout. The other forms
33800 allow you to specify a file descriptor or name a pipe. A numeric value
33801 is interpreted as a file descriptor, otherwise named pipe is opened.
33802 The second form specifies a bidirectional pipe and the last form
33803 allows specifying two independent pipes. Using file descriptors
33804 directly in this manner is fragile in general, as it can require the
33805 cooperation of intermediate processes. In particular using stdin &
33806 stdout is fraught with danger as other compiler options might also
33807 cause the compiler to read stdin or write stdout, and it can have
33808 unfortunate interactions with signal delivery from the terminal.
33809
33810 @item @var{file}@r{[}?@var{ident}@r{]}
33811 A mapping file consisting of space-separated module-name, filename
33812 pairs, one per line. Only the mappings for the direct imports and any
33813 module export name need be provided. If other mappings are provided,
33814 they override those stored in any imported CMI files. A repository
33815 root may be specified in the mapping file by using @samp{$root} as the
33816 module name in the first active line. Use of this option will disable
33817 any default module->CMI name mapping.
33818
33819 @end table
33820
33821 As shown, an optional @var{ident} may suffix the first word of the
33822 option, indicated by a @samp{?} prefix. The value is used in the
33823 initial handshake with the module server, or to specify a prefix on
33824 mapping file lines. In the server case, the main source file name is
33825 used if no @var{ident} is specified. In the file case, all non-blank
33826 lines are significant, unless a value is specified, in which case only
33827 lines beginning with @var{ident} are significant. The @var{ident}
33828 must be separated by whitespace from the module name. Be aware that
33829 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
33830 significant to the shell, and therefore may need quoting.
33831
33832 The mapper is connected to or loaded lazily, when the first module
33833 mapping is required. The networking protocols are only supported on
33834 hosts that provide networking. If no mapper is specified a default is
33835 provided.
33836
33837 A project-specific mapper is expected to be provided by the build
33838 system that invokes the compiler. It is not expected that a
33839 general-purpose server is provided for all compilations. As such, the
33840 server will know the build configuration, the compiler it invoked, and
33841 the environment (such as working directory) in which that is
33842 operating. As it may parallelize builds, several compilations may
33843 connect to the same socket.
33844
33845 The default mapper generates CMI files in a @samp{gcm.cache}
33846 directory. CMI files have a @samp{.gcm} suffix. The module unit name
33847 is used directly to provide the basename. Header units construct a
33848 relative path using the underlying header file name. If the path is
33849 already relative, a @samp{,} directory is prepended. Internal
33850 @samp{..} components are translated to @samp{,,}. No attempt is made
33851 to canonicalize these filenames beyond that done by the preprocessor's
33852 include search algorithm, as in general it is ambiguous when symbolic
33853 links are present.
33854
33855 The mapper protocol was published as ``A Module Mapper''
33856 @uref{https://wg21.link/p1184}. The implementation is provided by
33857 @command{libcody}, @uref{https://github.com/urnathan/libcody},
33858 which specifies the canonical protocol definition. A proof of concept
33859 server implementation embedded in @command{make} was described in
33860 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
33861
33862 @node C++ Module Preprocessing
33863 @subsection Module Preprocessing
33864 @cindex C++ Module Preprocessing
33865
33866 Modules affect preprocessing because of header units and include
33867 translation. Some uses of the preprocessor as a separate step either
33868 do not produce a correct output, or require CMIs to be available.
33869
33870 Header units import macros. These macros can affect later conditional
33871 inclusion, which therefore can cascade to differing import sets. When
33872 preprocessing, it is necessary to load the CMI. If a header unit is
33873 unavailable, the preprocessor issues a warning and continue (when
33874 not just preprocessing, an error is emitted). Detecting such imports
33875 requires preprocessor tokenization of the input stream to phase 4
33876 (macro expansion).
33877
33878 Include translation converts @code{#include}, @code{#include_next} and
33879 @code{#import} directives to internal @code{import} declarations.
33880 Whether a particular directive is translated is controlled by the
33881 module mapper. Header unit names are canonicalized during
33882 preprocessing.
33883
33884 Dependency information can be emitted for macro import, extending the
33885 functionality of @option{-MD} and @option{-MMD} options. Detection of
33886 import declarations also requires phase 4 preprocessing, and thus
33887 requires full preprocessing (or compilation).
33888
33889 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
33890 preprocessing before phase 4.
33891
33892 The @option{-save-temps} option uses @option{-fdirectives-only} for
33893 preprocessing, and preserve the macro definitions in the preprocessed
33894 output. Usually you also want to use this option when explicitly
33895 preprocessing a header-unit, or consuming such preprocessed output:
33896
33897 @smallexample
33898 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
33899 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
33900 @end smallexample
33901
33902 @node C++ Compiled Module Interface
33903 @subsection Compiled Module Interface
33904 @cindex C++ Compiled Module Interface
33905
33906 CMIs are an additional artifact when compiling named module
33907 interfaces, partitions or header units. These are read when
33908 importing. CMI contents are implementation-specific, and in GCC's
33909 case tied to the compiler version. Consider them a rebuildable cache
33910 artifact, not a distributable object.
33911
33912 When creating an output CMI, any missing directory components are
33913 created in a manner that is safe for concurrent builds creating
33914 multiple, different, CMIs within a common subdirectory tree.
33915
33916 CMI contents are written to a temporary file, which is then atomically
33917 renamed. Observers either see old contents (if there is an
33918 existing file), or complete new contents. They do not observe the
33919 CMI during its creation. This is unlike object file writing, which
33920 may be observed by an external process.
33921
33922 CMIs are read in lazily, if the host OS provides @code{mmap}
33923 functionality. Generally blocks are read when name lookup or template
33924 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
33925 option may be used.
33926
33927 The @option{--param lazy-modules=@var{n}} parameter controls the limit
33928 on the number of concurrently open module files during lazy loading.
33929 Should more modules be imported, an LRU algorithm is used to determine
33930 which files to close---until that file is needed again. This limit
33931 may be exceeded with deep module dependency hierarchies. With large
33932 code bases there may be more imports than the process limit of file
33933 descriptors. By default, the limit is a few less than the per-process
33934 file descriptor hard limit, if that is determinable.@footnote{Where
33935 applicable the soft limit is incremented as needed towards the hard limit.}
33936
33937 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
33938 You may use @command{readelf} to inspect them, although section
33939 contents are largely undecipherable. There is a section named
33940 @code{.gnu.c++.README}, which contains human-readable text. Other
33941 than the first line, each line consists of @code{@var{tag}: @code{value}}
33942 tuples.
33943
33944 @smallexample
33945 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
33946
33947 String dump of section '.gnu.c++.README':
33948 [ 0] GNU C++ primary module interface
33949 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
33950 [ 6f] version: 2020/11/16-04:54
33951 [ 89] module: foo
33952 [ 95] source: c_b.ii
33953 [ a4] dialect: C++20/coroutines
33954 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
33955 [ ee] repository: gcm.cache
33956 [ 104] buildtime: 2020/11/16 15:03:21 UTC
33957 [ 127] localtime: 2020/11/16 07:03:21 PST
33958 [ 14a] export: foo:part1 foo-part1.gcm
33959 @end smallexample
33960
33961 Amongst other things, this lists the source that was built, C++
33962 dialect used and imports of the module.@footnote{The precise contents
33963 of this output may change.} The timestamp is the same value as that
33964 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
33965 explicitly specified with the environment variable
33966 @code{SOURCE_DATE_EPOCH}. For further details
33967 @pxref{Environment Variables}.
33968
33969 A set of related CMIs may be copied, provided the relative pathnames
33970 are preserved.
33971
33972 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
33973 it may be removed or altered. The section numbering of the sections
33974 whose names do not begin with @code{.gnu.c++.}, or are not the string
33975 section is significant and must not be altered.