]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
8a70adaeb28209614dfa1fa65a89dba7824579e2
[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 @gol
331 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]} @gol
332 -Wbool-compare -Wbool-operation @gol
333 -Wno-builtin-declaration-mismatch @gol
334 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
335 -Wc11-c2x-compat @gol
336 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
337 -Wc++20-compat @gol
338 -Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions @gol
339 -Wno-c++20-extensions -Wno-c++23-extensions @gol
340 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
341 -Wchar-subscripts @gol
342 -Wclobbered -Wcomment @gol
343 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
344 -Wdangling-else -Wdate-time @gol
345 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
346 -Wdisabled-optimization @gol
347 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
348 -Wno-div-by-zero -Wdouble-promotion @gol
349 -Wduplicated-branches -Wduplicated-cond @gol
350 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
351 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
352 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
353 -Wno-format-contains-nul -Wno-format-extra-args @gol
354 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
355 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
356 -Wformat-y2k -Wframe-address @gol
357 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
358 -Wno-if-not-aligned -Wno-ignored-attributes @gol
359 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
360 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
361 -Wno-implicit-function-declaration -Wno-implicit-int @gol
362 -Winfinite-recursion @gol
363 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
364 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
365 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
366 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
367 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
368 -Wmemset-elt-size -Wmemset-transposed-args @gol
369 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
370 -Wmissing-field-initializers -Wmissing-format-attribute @gol
371 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
372 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
373 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
374 -Wnull-dereference -Wno-odr @gol
375 -Wopenacc-parallelism @gol
376 -Wopenmp-simd @gol
377 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
378 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
379 -Wparentheses -Wno-pedantic-ms-format @gol
380 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
381 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
382 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
383 -Wno-scalar-storage-order -Wsequence-point @gol
384 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
385 -Wno-shadow-ivar @gol
386 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
387 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
388 -Wsign-compare -Wsign-conversion @gol
389 -Wno-sizeof-array-argument @gol
390 -Wsizeof-array-div @gol
391 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
392 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
393 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
394 -Wstring-compare @gol
395 -Wno-stringop-overflow -Wno-stringop-overread @gol
396 -Wno-stringop-truncation @gol
397 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
398 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
399 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
400 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
401 -Wtsan -Wtype-limits -Wundef @gol
402 -Wuninitialized -Wunknown-pragmas @gol
403 -Wunsuffixed-float-constants -Wunused @gol
404 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
405 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
406 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
407 -Wunused-macros @gol
408 -Wunused-parameter -Wno-unused-result @gol
409 -Wunused-value -Wunused-variable @gol
410 -Wno-varargs -Wvariadic-macros @gol
411 -Wvector-operation-performance @gol
412 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
413 -Wvolatile-register-var -Wwrite-strings @gol
414 -Wzero-length-bounds}
415
416 @item Static Analyzer Options
417 @gccoptlist{
418 -fanalyzer @gol
419 -fanalyzer-call-summaries @gol
420 -fanalyzer-checker=@var{name} @gol
421 -fno-analyzer-feasibility @gol
422 -fanalyzer-fine-grained @gol
423 -fanalyzer-state-merge @gol
424 -fanalyzer-state-purge @gol
425 -fanalyzer-transitivity @gol
426 -fanalyzer-verbose-edges @gol
427 -fanalyzer-verbose-state-changes @gol
428 -fanalyzer-verbosity=@var{level} @gol
429 -fdump-analyzer @gol
430 -fdump-analyzer-stderr @gol
431 -fdump-analyzer-callgraph @gol
432 -fdump-analyzer-exploded-graph @gol
433 -fdump-analyzer-exploded-nodes @gol
434 -fdump-analyzer-exploded-nodes-2 @gol
435 -fdump-analyzer-exploded-nodes-3 @gol
436 -fdump-analyzer-exploded-paths @gol
437 -fdump-analyzer-feasibility @gol
438 -fdump-analyzer-json @gol
439 -fdump-analyzer-state-purge @gol
440 -fdump-analyzer-supergraph @gol
441 -Wno-analyzer-double-fclose @gol
442 -Wno-analyzer-double-free @gol
443 -Wno-analyzer-exposure-through-output-file @gol
444 -Wno-analyzer-file-leak @gol
445 -Wno-analyzer-free-of-non-heap @gol
446 -Wno-analyzer-malloc-leak @gol
447 -Wno-analyzer-mismatching-deallocation @gol
448 -Wno-analyzer-null-argument @gol
449 -Wno-analyzer-null-dereference @gol
450 -Wno-analyzer-possible-null-argument @gol
451 -Wno-analyzer-possible-null-dereference @gol
452 -Wno-analyzer-shift-count-negative @gol
453 -Wno-analyzer-shift-count-overflow @gol
454 -Wno-analyzer-stale-setjmp-buffer @gol
455 -Wno-analyzer-tainted-allocation-size @gol
456 -Wno-analyzer-tainted-array-index @gol
457 -Wno-analyzer-tainted-divisor @gol
458 -Wno-analyzer-tainted-offset @gol
459 -Wno-analyzer-tainted-size @gol
460 -Wanalyzer-too-complex @gol
461 -Wno-analyzer-unsafe-call-within-signal-handler @gol
462 -Wno-analyzer-use-after-free @gol
463 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
464 -Wno-analyzer-use-of-uninitialized-value @gol
465 -Wno-analyzer-write-to-const @gol
466 -Wno-analyzer-write-to-string-literal @gol
467 }
468
469 @item C and Objective-C-only Warning Options
470 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
471 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
472 -Wold-style-declaration -Wold-style-definition @gol
473 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
474 -Wdeclaration-after-statement -Wpointer-sign}
475
476 @item Debugging Options
477 @xref{Debugging Options,,Options for Debugging Your Program}.
478 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
479 -gbtf -gctf -gctf@var{level} @gol
480 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
481 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
482 -gas-loc-support -gno-as-loc-support @gol
483 -gas-locview-support -gno-as-locview-support @gol
484 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol
485 -gstatement-frontiers -gno-statement-frontiers @gol
486 -gvariable-location-views -gno-variable-location-views @gol
487 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
488 -ginline-points -gno-inline-points @gol
489 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
490 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
491 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
492 -fno-eliminate-unused-debug-types @gol
493 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
494 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
495 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
496 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
497 -fvar-tracking -fvar-tracking-assignments}
498
499 @item Optimization Options
500 @xref{Optimize Options,,Options that Control Optimization}.
501 @gccoptlist{-faggressive-loop-optimizations @gol
502 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
503 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
504 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
505 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
506 -fno-allocation-dce -fallow-store-data-races @gol
507 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
508 -fauto-inc-dec -fbranch-probabilities @gol
509 -fcaller-saves @gol
510 -fcombine-stack-adjustments -fconserve-stack @gol
511 -fcompare-elim -fcprop-registers -fcrossjumping @gol
512 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
513 -fcx-limited-range @gol
514 -fdata-sections -fdce -fdelayed-branch @gol
515 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
516 -fdevirtualize-at-ltrans -fdse @gol
517 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
518 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
519 -ffinite-loops @gol
520 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
521 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
522 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
523 -fif-conversion2 -findirect-inlining @gol
524 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
525 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol
526 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
527 -fipa-reference -fipa-reference-addressable @gol
528 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
529 -flive-patching=@var{level} @gol
530 -fira-region=@var{region} -fira-hoist-pressure @gol
531 -fira-loop-pressure -fno-ira-share-save-slots @gol
532 -fno-ira-share-spill-slots @gol
533 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
534 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
535 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
536 -floop-block -floop-interchange -floop-strip-mine @gol
537 -floop-unroll-and-jam -floop-nest-optimize @gol
538 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
539 -flto-partition=@var{alg} -fmerge-all-constants @gol
540 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
541 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg @gol
542 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
543 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
544 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
545 -fno-sched-spec -fno-signed-zeros @gol
546 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
547 -fomit-frame-pointer -foptimize-sibling-calls @gol
548 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
549 -fprefetch-loop-arrays @gol
550 -fprofile-correction @gol
551 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
552 -fprofile-values -fprofile-reorder-functions @gol
553 -freciprocal-math -free -frename-registers -freorder-blocks @gol
554 -freorder-blocks-algorithm=@var{algorithm} @gol
555 -freorder-blocks-and-partition -freorder-functions @gol
556 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
557 -frounding-math -fsave-optimization-record @gol
558 -fsched2-use-superblocks -fsched-pressure @gol
559 -fsched-spec-load -fsched-spec-load-dangerous @gol
560 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
561 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
562 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
563 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
564 -fschedule-fusion @gol
565 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
566 -fselective-scheduling -fselective-scheduling2 @gol
567 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
568 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
569 -fsignaling-nans @gol
570 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
571 -fsplit-paths @gol
572 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
573 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
574 -fthread-jumps -ftracer -ftree-bit-ccp @gol
575 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
576 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
577 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
578 -ftree-loop-if-convert -ftree-loop-im @gol
579 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
580 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
581 -ftree-loop-vectorize @gol
582 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
583 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
584 -ftree-switch-conversion -ftree-tail-merge @gol
585 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init @gol
586 -funconstrained-commons -funit-at-a-time -funroll-all-loops @gol
587 -funroll-loops -funsafe-math-optimizations -funswitch-loops @gol
588 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
589 -fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol
590 --param @var{name}=@var{value}
591 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
592
593 @item Program Instrumentation Options
594 @xref{Instrumentation Options,,Program Instrumentation Options}.
595 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
596 -fprofile-abs-path @gol
597 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
598 -fprofile-info-section -fprofile-info-section=@var{name} @gol
599 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
600 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
601 -fprofile-exclude-files=@var{regex} @gol
602 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
603 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
604 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
605 -fsanitize-undefined-trap-on-error -fbounds-check @gol
606 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
607 -fharden-compares -fharden-conditional-branches @gol
608 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
609 -fstack-protector-explicit -fstack-check @gol
610 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
611 -fno-stack-limit -fsplit-stack @gol
612 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
613 -fvtv-counts -fvtv-debug @gol
614 -finstrument-functions @gol
615 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
616 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} @gol
617 -fprofile-prefix-map=@var{old}=@var{new}
618
619 @item Preprocessor Options
620 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
621 @gccoptlist{-A@var{question}=@var{answer} @gol
622 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
623 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
624 -dD -dI -dM -dN -dU @gol
625 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
626 -fexec-charset=@var{charset} -fextended-identifiers @gol
627 -finput-charset=@var{charset} -flarge-source-files @gol
628 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
629 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
630 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
631 -fwide-exec-charset=@var{charset} -fworking-directory @gol
632 -H -imacros @var{file} -include @var{file} @gol
633 -M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules @gol
634 -no-integrated-cpp -P -pthread -remap @gol
635 -traditional -traditional-cpp -trigraphs @gol
636 -U@var{macro} -undef @gol
637 -Wp,@var{option} -Xpreprocessor @var{option}}
638
639 @item Assembler Options
640 @xref{Assembler Options,,Passing Options to the Assembler}.
641 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
642
643 @item Linker Options
644 @xref{Link Options,,Options for Linking}.
645 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
646 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
647 -e @var{entry} --entry=@var{entry} @gol
648 -pie -pthread -r -rdynamic @gol
649 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
650 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
651 -shared -shared-libgcc -symbolic @gol
652 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
653 -u @var{symbol} -z @var{keyword}}
654
655 @item Directory Options
656 @xref{Directory Options,,Options for Directory Search}.
657 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
658 -idirafter @var{dir} @gol
659 -imacros @var{file} -imultilib @var{dir} @gol
660 -iplugindir=@var{dir} -iprefix @var{file} @gol
661 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
662 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
663 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
664 -nostdinc -nostdinc++ --sysroot=@var{dir}}
665
666 @item Code Generation Options
667 @xref{Code Gen Options,,Options for Code Generation Conventions}.
668 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
669 -ffixed-@var{reg} -fexceptions @gol
670 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
671 -fasynchronous-unwind-tables @gol
672 -fno-gnu-unique @gol
673 -finhibit-size-directive -fcommon -fno-ident @gol
674 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
675 -fno-jump-tables -fno-bit-tests @gol
676 -frecord-gcc-switches @gol
677 -freg-struct-return -fshort-enums -fshort-wchar @gol
678 -fverbose-asm -fpack-struct[=@var{n}] @gol
679 -fleading-underscore -ftls-model=@var{model} @gol
680 -fstack-reuse=@var{reuse_level} @gol
681 -ftrampolines -ftrapv -fwrapv @gol
682 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
683 -fstrict-volatile-bitfields -fsync-libcalls}
684
685 @item Developer Options
686 @xref{Developer Options,,GCC Developer Options}.
687 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
688 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
689 -fchecking -fchecking=@var{n}
690 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
691 -fdisable-ipa-@var{pass_name} @gol
692 -fdisable-rtl-@var{pass_name} @gol
693 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
694 -fdisable-tree-@var{pass_name} @gol
695 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
696 -fdump-debug -fdump-earlydebug @gol
697 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
698 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
699 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
700 -fdump-lang-all @gol
701 -fdump-lang-@var{switch} @gol
702 -fdump-lang-@var{switch}-@var{options} @gol
703 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
704 -fdump-passes @gol
705 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
706 -fdump-statistics @gol
707 -fdump-tree-all @gol
708 -fdump-tree-@var{switch} @gol
709 -fdump-tree-@var{switch}-@var{options} @gol
710 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
711 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
712 -fenable-@var{kind}-@var{pass} @gol
713 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
714 -fira-verbose=@var{n} @gol
715 -flto-report -flto-report-wpa -fmem-report-wpa @gol
716 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
717 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
718 -fprofile-report @gol
719 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
720 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
721 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
722 -fvar-tracking-assignments-toggle -gtoggle @gol
723 -print-file-name=@var{library} -print-libgcc-file-name @gol
724 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
725 -print-prog-name=@var{program} -print-search-dirs -Q @gol
726 -print-sysroot -print-sysroot-headers-suffix @gol
727 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
728
729 @item Machine-Dependent Options
730 @xref{Submodel Options,,Machine-Dependent Options}.
731 @c This list is ordered alphanumerically by subsection name.
732 @c Try and put the significant identifier (CPU or system) first,
733 @c so users have a clue at guessing where the ones they want will be.
734
735 @emph{AArch64 Options}
736 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
737 -mgeneral-regs-only @gol
738 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
739 -mstrict-align -mno-strict-align @gol
740 -momit-leaf-frame-pointer @gol
741 -mtls-dialect=desc -mtls-dialect=traditional @gol
742 -mtls-size=@var{size} @gol
743 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
744 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
745 -mpc-relative-literal-loads @gol
746 -msign-return-address=@var{scope} @gol
747 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
748 +@var{b-key}]|@var{bti} @gol
749 -mharden-sls=@var{opts} @gol
750 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
751 -moverride=@var{string} -mverbose-cost-dump @gol
752 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
753 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
754 -moutline-atomics }
755
756 @emph{Adapteva Epiphany Options}
757 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
758 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
759 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
760 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
761 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
762 -msplit-vecmove-early -m1reg-@var{reg}}
763
764 @emph{AMD GCN Options}
765 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
766
767 @emph{ARC Options}
768 @gccoptlist{-mbarrel-shifter -mjli-always @gol
769 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
770 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
771 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
772 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
773 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
774 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
775 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
776 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
777 -mvolatile-cache -mtp-regno=@var{regno} @gol
778 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
779 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
780 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
781 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
782 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
783 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
784 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
785 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
786
787 @emph{ARM Options}
788 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
789 -mabi=@var{name} @gol
790 -mapcs-stack-check -mno-apcs-stack-check @gol
791 -mapcs-reentrant -mno-apcs-reentrant @gol
792 -mgeneral-regs-only @gol
793 -msched-prolog -mno-sched-prolog @gol
794 -mlittle-endian -mbig-endian @gol
795 -mbe8 -mbe32 @gol
796 -mfloat-abi=@var{name} @gol
797 -mfp16-format=@var{name}
798 -mthumb-interwork -mno-thumb-interwork @gol
799 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
800 -mtune=@var{name} -mprint-tune-info @gol
801 -mstructure-size-boundary=@var{n} @gol
802 -mabort-on-noreturn @gol
803 -mlong-calls -mno-long-calls @gol
804 -msingle-pic-base -mno-single-pic-base @gol
805 -mpic-register=@var{reg} @gol
806 -mnop-fun-dllimport @gol
807 -mpoke-function-name @gol
808 -mthumb -marm -mflip-thumb @gol
809 -mtpcs-frame -mtpcs-leaf-frame @gol
810 -mcaller-super-interworking -mcallee-super-interworking @gol
811 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
812 -mword-relocations @gol
813 -mfix-cortex-m3-ldrd @gol
814 -munaligned-access @gol
815 -mneon-for-64bits @gol
816 -mslow-flash-data @gol
817 -masm-syntax-unified @gol
818 -mrestrict-it @gol
819 -mverbose-cost-dump @gol
820 -mpure-code @gol
821 -mcmse @gol
822 -mfix-cmse-cve-2021-35465 @gol
823 -mfdpic}
824
825 @emph{AVR Options}
826 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
827 -mbranch-cost=@var{cost} @gol
828 -mcall-prologues -mgas-isr-prologues -mint8 @gol
829 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
830 -mn_flash=@var{size} -mno-interrupts @gol
831 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
832 -mfract-convert-truncate @gol
833 -mshort-calls -nodevicelib -nodevicespecs @gol
834 -Waddr-space-convert -Wmisspelled-isr}
835
836 @emph{Blackfin Options}
837 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
838 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
839 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
840 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
841 -mno-id-shared-library -mshared-library-id=@var{n} @gol
842 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
843 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
844 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
845 -micplb}
846
847 @emph{C6X Options}
848 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
849 -msim -msdata=@var{sdata-type}}
850
851 @emph{CRIS Options}
852 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
853 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
854 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
855 -mstack-align -mdata-align -mconst-align @gol
856 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
857 -melf -maout -melinux -mlinux -sim -sim2 @gol
858 -mmul-bug-workaround -mno-mul-bug-workaround}
859
860 @emph{CR16 Options}
861 @gccoptlist{-mmac @gol
862 -mcr16cplus -mcr16c @gol
863 -msim -mint32 -mbit-ops
864 -mdata-model=@var{model}}
865
866 @emph{C-SKY Options}
867 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
868 -mbig-endian -EB -mlittle-endian -EL @gol
869 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
870 -mfloat-abi=@var{name} @gol
871 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
872 -mdsp -medsp -mvdsp @gol
873 -mdiv -msmart -mhigh-registers -manchor @gol
874 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
875 -mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim}
876
877 @emph{Darwin Options}
878 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
879 -arch_only -bind_at_load -bundle -bundle_loader @gol
880 -client_name -compatibility_version -current_version @gol
881 -dead_strip @gol
882 -dependency-file -dylib_file -dylinker_install_name @gol
883 -dynamic -dynamiclib -exported_symbols_list @gol
884 -filelist -flat_namespace -force_cpusubtype_ALL @gol
885 -force_flat_namespace -headerpad_max_install_names @gol
886 -iframework @gol
887 -image_base -init -install_name -keep_private_externs @gol
888 -multi_module -multiply_defined -multiply_defined_unused @gol
889 -noall_load -no_dead_strip_inits_and_terms @gol
890 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
891 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
892 -private_bundle -read_only_relocs -sectalign @gol
893 -sectobjectsymbols -whyload -seg1addr @gol
894 -sectcreate -sectobjectsymbols -sectorder @gol
895 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
896 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
897 -segprot -segs_read_only_addr -segs_read_write_addr @gol
898 -single_module -static -sub_library -sub_umbrella @gol
899 -twolevel_namespace -umbrella -undefined @gol
900 -unexported_symbols_list -weak_reference_mismatches @gol
901 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
902 -mkernel -mone-byte-bool}
903
904 @emph{DEC Alpha Options}
905 @gccoptlist{-mno-fp-regs -msoft-float @gol
906 -mieee -mieee-with-inexact -mieee-conformant @gol
907 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
908 -mtrap-precision=@var{mode} -mbuild-constants @gol
909 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
910 -mbwx -mmax -mfix -mcix @gol
911 -mfloat-vax -mfloat-ieee @gol
912 -mexplicit-relocs -msmall-data -mlarge-data @gol
913 -msmall-text -mlarge-text @gol
914 -mmemory-latency=@var{time}}
915
916 @emph{eBPF Options}
917 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
918 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
919 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
920
921 @emph{FR30 Options}
922 @gccoptlist{-msmall-model -mno-lsim}
923
924 @emph{FT32 Options}
925 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
926
927 @emph{FRV Options}
928 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
929 -mhard-float -msoft-float @gol
930 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
931 -mdouble -mno-double @gol
932 -mmedia -mno-media -mmuladd -mno-muladd @gol
933 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
934 -mlinked-fp -mlong-calls -malign-labels @gol
935 -mlibrary-pic -macc-4 -macc-8 @gol
936 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
937 -moptimize-membar -mno-optimize-membar @gol
938 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
939 -mvliw-branch -mno-vliw-branch @gol
940 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
941 -mno-nested-cond-exec -mtomcat-stats @gol
942 -mTLS -mtls @gol
943 -mcpu=@var{cpu}}
944
945 @emph{GNU/Linux Options}
946 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
947 -tno-android-cc -tno-android-ld}
948
949 @emph{H8/300 Options}
950 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
951
952 @emph{HPPA Options}
953 @gccoptlist{-march=@var{architecture-type} @gol
954 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
955 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
956 -mfixed-range=@var{register-range} @gol
957 -mjump-in-delay -mlinker-opt -mlong-calls @gol
958 -mlong-load-store -mno-disable-fpregs @gol
959 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
960 -mno-jump-in-delay -mno-long-load-store @gol
961 -mno-portable-runtime -mno-soft-float @gol
962 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
963 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
964 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
965 -munix=@var{unix-std} -nolibdld -static -threads}
966
967 @emph{IA-64 Options}
968 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
969 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
970 -mconstant-gp -mauto-pic -mfused-madd @gol
971 -minline-float-divide-min-latency @gol
972 -minline-float-divide-max-throughput @gol
973 -mno-inline-float-divide @gol
974 -minline-int-divide-min-latency @gol
975 -minline-int-divide-max-throughput @gol
976 -mno-inline-int-divide @gol
977 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
978 -mno-inline-sqrt @gol
979 -mdwarf2-asm -mearly-stop-bits @gol
980 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
981 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
982 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
983 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
984 -msched-spec-ldc -msched-spec-control-ldc @gol
985 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
986 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
987 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
988 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
989
990 @emph{LM32 Options}
991 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
992 -msign-extend-enabled -muser-enabled}
993
994 @emph{M32R/D Options}
995 @gccoptlist{-m32r2 -m32rx -m32r @gol
996 -mdebug @gol
997 -malign-loops -mno-align-loops @gol
998 -missue-rate=@var{number} @gol
999 -mbranch-cost=@var{number} @gol
1000 -mmodel=@var{code-size-model-type} @gol
1001 -msdata=@var{sdata-type} @gol
1002 -mno-flush-func -mflush-func=@var{name} @gol
1003 -mno-flush-trap -mflush-trap=@var{number} @gol
1004 -G @var{num}}
1005
1006 @emph{M32C Options}
1007 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
1008
1009 @emph{M680x0 Options}
1010 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
1011 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
1012 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
1013 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
1014 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
1015 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
1016 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
1017 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
1018 -mxgot -mno-xgot -mlong-jump-table-offsets}
1019
1020 @emph{MCore Options}
1021 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
1022 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
1023 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
1024 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
1025 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
1026
1027 @emph{MeP Options}
1028 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
1029 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
1030 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
1031 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
1032 -mtiny=@var{n}}
1033
1034 @emph{MicroBlaze Options}
1035 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
1036 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
1037 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
1038 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
1039 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
1040 -mpic-data-is-text-relative}
1041
1042 @emph{MIPS Options}
1043 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
1044 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
1045 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
1046 -mips16 -mno-mips16 -mflip-mips16 @gol
1047 -minterlink-compressed -mno-interlink-compressed @gol
1048 -minterlink-mips16 -mno-interlink-mips16 @gol
1049 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
1050 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
1051 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1052 -mno-float -msingle-float -mdouble-float @gol
1053 -modd-spreg -mno-odd-spreg @gol
1054 -mabs=@var{mode} -mnan=@var{encoding} @gol
1055 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1056 -mmcu -mmno-mcu @gol
1057 -meva -mno-eva @gol
1058 -mvirt -mno-virt @gol
1059 -mxpa -mno-xpa @gol
1060 -mcrc -mno-crc @gol
1061 -mginv -mno-ginv @gol
1062 -mmicromips -mno-micromips @gol
1063 -mmsa -mno-msa @gol
1064 -mloongson-mmi -mno-loongson-mmi @gol
1065 -mloongson-ext -mno-loongson-ext @gol
1066 -mloongson-ext2 -mno-loongson-ext2 @gol
1067 -mfpu=@var{fpu-type} @gol
1068 -msmartmips -mno-smartmips @gol
1069 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1070 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1071 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1072 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1073 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1074 -membedded-data -mno-embedded-data @gol
1075 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1076 -mcode-readable=@var{setting} @gol
1077 -msplit-addresses -mno-split-addresses @gol
1078 -mexplicit-relocs -mno-explicit-relocs @gol
1079 -mcheck-zero-division -mno-check-zero-division @gol
1080 -mdivide-traps -mdivide-breaks @gol
1081 -mload-store-pairs -mno-load-store-pairs @gol
1082 -munaligned-access -mno-unaligned-access @gol
1083 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1084 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1085 -mfix-24k -mno-fix-24k @gol
1086 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1087 -mfix-r5900 -mno-fix-r5900 @gol
1088 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1089 -mfix-vr4120 -mno-fix-vr4120 @gol
1090 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1091 -mflush-func=@var{func} -mno-flush-func @gol
1092 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1093 -mcompact-branches=@var{policy} @gol
1094 -mfp-exceptions -mno-fp-exceptions @gol
1095 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1096 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1097 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1098 -mframe-header-opt -mno-frame-header-opt}
1099
1100 @emph{MMIX Options}
1101 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1102 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1103 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1104 -mno-base-addresses -msingle-exit -mno-single-exit}
1105
1106 @emph{MN10300 Options}
1107 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1108 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1109 -mtune=@var{cpu-type} @gol
1110 -mreturn-pointer-on-d0 @gol
1111 -mno-crt0 -mrelax -mliw -msetlb}
1112
1113 @emph{Moxie Options}
1114 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1115
1116 @emph{MSP430 Options}
1117 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1118 -mwarn-mcu @gol
1119 -mcode-region= -mdata-region= @gol
1120 -msilicon-errata= -msilicon-errata-warn= @gol
1121 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1122
1123 @emph{NDS32 Options}
1124 @gccoptlist{-mbig-endian -mlittle-endian @gol
1125 -mreduced-regs -mfull-regs @gol
1126 -mcmov -mno-cmov @gol
1127 -mext-perf -mno-ext-perf @gol
1128 -mext-perf2 -mno-ext-perf2 @gol
1129 -mext-string -mno-ext-string @gol
1130 -mv3push -mno-v3push @gol
1131 -m16bit -mno-16bit @gol
1132 -misr-vector-size=@var{num} @gol
1133 -mcache-block-size=@var{num} @gol
1134 -march=@var{arch} @gol
1135 -mcmodel=@var{code-model} @gol
1136 -mctor-dtor -mrelax}
1137
1138 @emph{Nios II Options}
1139 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1140 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1141 -mel -meb @gol
1142 -mno-bypass-cache -mbypass-cache @gol
1143 -mno-cache-volatile -mcache-volatile @gol
1144 -mno-fast-sw-div -mfast-sw-div @gol
1145 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1146 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1147 -mcustom-fpu-cfg=@var{name} @gol
1148 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1149 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1150
1151 @emph{Nvidia PTX Options}
1152 @gccoptlist{-m64 -mmainkernel -moptimize}
1153
1154 @emph{OpenRISC Options}
1155 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1156 -msoft-mul -msoft-div @gol
1157 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1158 -mcmov -mror -mrori -msext -msfimm -mshftimm @gol
1159 -mcmodel=@var{code-model}}
1160
1161 @emph{PDP-11 Options}
1162 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1163 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1164 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1165
1166 @emph{picoChip Options}
1167 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1168 -msymbol-as-address -mno-inefficient-warnings}
1169
1170 @emph{PowerPC Options}
1171 See RS/6000 and PowerPC Options.
1172
1173 @emph{PRU Options}
1174 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1175 -mabi=@var{variant} @gol}
1176
1177 @emph{RISC-V Options}
1178 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1179 -mplt -mno-plt @gol
1180 -mabi=@var{ABI-string} @gol
1181 -mfdiv -mno-fdiv @gol
1182 -mdiv -mno-div @gol
1183 -march=@var{ISA-string} @gol
1184 -mtune=@var{processor-string} @gol
1185 -mpreferred-stack-boundary=@var{num} @gol
1186 -msmall-data-limit=@var{N-bytes} @gol
1187 -msave-restore -mno-save-restore @gol
1188 -mshorten-memrefs -mno-shorten-memrefs @gol
1189 -mstrict-align -mno-strict-align @gol
1190 -mcmodel=medlow -mcmodel=medany @gol
1191 -mexplicit-relocs -mno-explicit-relocs @gol
1192 -mrelax -mno-relax @gol
1193 -mriscv-attribute -mmo-riscv-attribute @gol
1194 -malign-data=@var{type} @gol
1195 -mbig-endian -mlittle-endian @gol
1196 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1197 -mstack-protector-guard-offset=@var{offset}}
1198
1199 @emph{RL78 Options}
1200 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1201 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1202 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1203
1204 @emph{RS/6000 and PowerPC Options}
1205 @gccoptlist{-mcpu=@var{cpu-type} @gol
1206 -mtune=@var{cpu-type} @gol
1207 -mcmodel=@var{code-model} @gol
1208 -mpowerpc64 @gol
1209 -maltivec -mno-altivec @gol
1210 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1211 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1212 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1213 -mfprnd -mno-fprnd @gol
1214 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1215 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1216 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1217 -malign-power -malign-natural @gol
1218 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1219 -mupdate -mno-update @gol
1220 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1221 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1222 -mstrict-align -mno-strict-align -mrelocatable @gol
1223 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1224 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1225 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1226 -mprioritize-restricted-insns=@var{priority} @gol
1227 -msched-costly-dep=@var{dependence_type} @gol
1228 -minsert-sched-nops=@var{scheme} @gol
1229 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1230 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1231 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1232 -mtraceback=@var{traceback_type} @gol
1233 -maix-struct-return -msvr4-struct-return @gol
1234 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1235 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1236 -mblock-move-inline-limit=@var{num} @gol
1237 -mblock-compare-inline-limit=@var{num} @gol
1238 -mblock-compare-inline-loop-limit=@var{num} @gol
1239 -mno-block-ops-unaligned-vsx @gol
1240 -mstring-compare-inline-limit=@var{num} @gol
1241 -misel -mno-isel @gol
1242 -mvrsave -mno-vrsave @gol
1243 -mmulhw -mno-mulhw @gol
1244 -mdlmzb -mno-dlmzb @gol
1245 -mprototype -mno-prototype @gol
1246 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1247 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1248 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1249 -mno-recip-precision @gol
1250 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1251 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1252 -msave-toc-indirect -mno-save-toc-indirect @gol
1253 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1254 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1255 -mquad-memory -mno-quad-memory @gol
1256 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1257 -mcompat-align-parm -mno-compat-align-parm @gol
1258 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1259 -mgnu-attribute -mno-gnu-attribute @gol
1260 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1261 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1262 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1263 -mprivileged -mno-privileged}
1264
1265 @emph{RX Options}
1266 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1267 -mcpu=@gol
1268 -mbig-endian-data -mlittle-endian-data @gol
1269 -msmall-data @gol
1270 -msim -mno-sim@gol
1271 -mas100-syntax -mno-as100-syntax@gol
1272 -mrelax@gol
1273 -mmax-constant-size=@gol
1274 -mint-register=@gol
1275 -mpid@gol
1276 -mallow-string-insns -mno-allow-string-insns@gol
1277 -mjsr@gol
1278 -mno-warn-multiple-fast-interrupts@gol
1279 -msave-acc-in-interrupts}
1280
1281 @emph{S/390 and zSeries Options}
1282 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1283 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1284 -mlong-double-64 -mlong-double-128 @gol
1285 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1286 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1287 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1288 -mhtm -mvx -mzvector @gol
1289 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1290 -mfused-madd -mno-fused-madd @gol
1291 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1292 -mhotpatch=@var{halfwords},@var{halfwords}}
1293
1294 @emph{Score Options}
1295 @gccoptlist{-meb -mel @gol
1296 -mnhwloop @gol
1297 -muls @gol
1298 -mmac @gol
1299 -mscore5 -mscore5u -mscore7 -mscore7d}
1300
1301 @emph{SH Options}
1302 @gccoptlist{-m1 -m2 -m2e @gol
1303 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1304 -m3 -m3e @gol
1305 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1306 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1307 -mb -ml -mdalign -mrelax @gol
1308 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1309 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1310 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1311 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1312 -maccumulate-outgoing-args @gol
1313 -matomic-model=@var{atomic-model} @gol
1314 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1315 -mcbranch-force-delay-slot @gol
1316 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1317 -mpretend-cmove -mtas}
1318
1319 @emph{Solaris 2 Options}
1320 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1321 -pthreads}
1322
1323 @emph{SPARC Options}
1324 @gccoptlist{-mcpu=@var{cpu-type} @gol
1325 -mtune=@var{cpu-type} @gol
1326 -mcmodel=@var{code-model} @gol
1327 -mmemory-model=@var{mem-model} @gol
1328 -m32 -m64 -mapp-regs -mno-app-regs @gol
1329 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1330 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1331 -mhard-quad-float -msoft-quad-float @gol
1332 -mstack-bias -mno-stack-bias @gol
1333 -mstd-struct-return -mno-std-struct-return @gol
1334 -munaligned-doubles -mno-unaligned-doubles @gol
1335 -muser-mode -mno-user-mode @gol
1336 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1337 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1338 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1339 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1340 -mpopc -mno-popc -msubxc -mno-subxc @gol
1341 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1342 -mlra -mno-lra}
1343
1344 @emph{System V Options}
1345 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1346
1347 @emph{TILE-Gx Options}
1348 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1349 -mcmodel=@var{code-model}}
1350
1351 @emph{TILEPro Options}
1352 @gccoptlist{-mcpu=@var{cpu} -m32}
1353
1354 @emph{V850 Options}
1355 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1356 -mprolog-function -mno-prolog-function -mspace @gol
1357 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1358 -mapp-regs -mno-app-regs @gol
1359 -mdisable-callt -mno-disable-callt @gol
1360 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1361 -mv850e -mv850 -mv850e3v5 @gol
1362 -mloop @gol
1363 -mrelax @gol
1364 -mlong-jumps @gol
1365 -msoft-float @gol
1366 -mhard-float @gol
1367 -mgcc-abi @gol
1368 -mrh850-abi @gol
1369 -mbig-switch}
1370
1371 @emph{VAX Options}
1372 @gccoptlist{-mg -mgnu -munix -mlra}
1373
1374 @emph{Visium Options}
1375 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1376 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1377
1378 @emph{VMS Options}
1379 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1380 -mpointer-size=@var{size}}
1381
1382 @emph{VxWorks Options}
1383 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1384 -Xbind-lazy -Xbind-now}
1385
1386 @emph{x86 Options}
1387 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1388 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1389 -mfpmath=@var{unit} @gol
1390 -masm=@var{dialect} -mno-fancy-math-387 @gol
1391 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1392 -mno-wide-multiply -mrtd -malign-double @gol
1393 -mpreferred-stack-boundary=@var{num} @gol
1394 -mincoming-stack-boundary=@var{num} @gol
1395 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait @gol
1396 -mrecip -mrecip=@var{opt} @gol
1397 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1398 -mmove-max=@var{bits} -mstore-max=@var{bits} @gol
1399 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1400 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1401 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1402 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1403 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1404 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1405 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1406 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1407 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1408 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1409 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1410 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1411 -mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1412 -mavx512fp16 @gol
1413 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1414 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1415 -mkl -mwidekl @gol
1416 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1417 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1418 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1419 -mregparm=@var{num} -msseregparm @gol
1420 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1421 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1422 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1423 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1424 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1425 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1426 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1427 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1428 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1429 -mstack-protector-guard-reg=@var{reg} @gol
1430 -mstack-protector-guard-offset=@var{offset} @gol
1431 -mstack-protector-guard-symbol=@var{symbol} @gol
1432 -mgeneral-regs-only -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop @gol
1433 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1434 -mindirect-branch-register -mharden-sls=@var{choice} @gol
1435 -mindirect-branch-cs-prefix -mneeded}
1436
1437 @emph{x86 Windows Options}
1438 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1439 -mnop-fun-dllimport -mthread @gol
1440 -municode -mwin32 -mwindows -fno-set-stack-executable}
1441
1442 @emph{Xstormy16 Options}
1443 @gccoptlist{-msim}
1444
1445 @emph{Xtensa Options}
1446 @gccoptlist{-mconst16 -mno-const16 @gol
1447 -mfused-madd -mno-fused-madd @gol
1448 -mforce-no-pic @gol
1449 -mserialize-volatile -mno-serialize-volatile @gol
1450 -mtext-section-literals -mno-text-section-literals @gol
1451 -mauto-litpools -mno-auto-litpools @gol
1452 -mtarget-align -mno-target-align @gol
1453 -mlongcalls -mno-longcalls @gol
1454 -mabi=@var{abi-type}}
1455
1456 @emph{zSeries Options}
1457 See S/390 and zSeries Options.
1458 @end table
1459
1460
1461 @node Overall Options
1462 @section Options Controlling the Kind of Output
1463
1464 Compilation can involve up to four stages: preprocessing, compilation
1465 proper, assembly and linking, always in that order. GCC is capable of
1466 preprocessing and compiling several files either into several
1467 assembler input files, or into one assembler input file; then each
1468 assembler input file produces an object file, and linking combines all
1469 the object files (those newly compiled, and those specified as input)
1470 into an executable file.
1471
1472 @cindex file name suffix
1473 For any given input file, the file name suffix determines what kind of
1474 compilation is done:
1475
1476 @table @gcctabopt
1477 @item @var{file}.c
1478 C source code that must be preprocessed.
1479
1480 @item @var{file}.i
1481 C source code that should not be preprocessed.
1482
1483 @item @var{file}.ii
1484 C++ source code that should not be preprocessed.
1485
1486 @item @var{file}.m
1487 Objective-C source code. Note that you must link with the @file{libobjc}
1488 library to make an Objective-C program work.
1489
1490 @item @var{file}.mi
1491 Objective-C source code that should not be preprocessed.
1492
1493 @item @var{file}.mm
1494 @itemx @var{file}.M
1495 Objective-C++ source code. Note that you must link with the @file{libobjc}
1496 library to make an Objective-C++ program work. Note that @samp{.M} refers
1497 to a literal capital M@.
1498
1499 @item @var{file}.mii
1500 Objective-C++ source code that should not be preprocessed.
1501
1502 @item @var{file}.h
1503 C, C++, Objective-C or Objective-C++ header file to be turned into a
1504 precompiled header (default), or C, C++ header file to be turned into an
1505 Ada spec (via the @option{-fdump-ada-spec} switch).
1506
1507 @item @var{file}.cc
1508 @itemx @var{file}.cp
1509 @itemx @var{file}.cxx
1510 @itemx @var{file}.cpp
1511 @itemx @var{file}.CPP
1512 @itemx @var{file}.c++
1513 @itemx @var{file}.C
1514 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1515 the last two letters must both be literally @samp{x}. Likewise,
1516 @samp{.C} refers to a literal capital C@.
1517
1518 @item @var{file}.mm
1519 @itemx @var{file}.M
1520 Objective-C++ source code that must be preprocessed.
1521
1522 @item @var{file}.mii
1523 Objective-C++ source code that should not be preprocessed.
1524
1525 @item @var{file}.hh
1526 @itemx @var{file}.H
1527 @itemx @var{file}.hp
1528 @itemx @var{file}.hxx
1529 @itemx @var{file}.hpp
1530 @itemx @var{file}.HPP
1531 @itemx @var{file}.h++
1532 @itemx @var{file}.tcc
1533 C++ header file to be turned into a precompiled header or Ada spec.
1534
1535 @item @var{file}.f
1536 @itemx @var{file}.for
1537 @itemx @var{file}.ftn
1538 Fixed form Fortran source code that should not be preprocessed.
1539
1540 @item @var{file}.F
1541 @itemx @var{file}.FOR
1542 @itemx @var{file}.fpp
1543 @itemx @var{file}.FPP
1544 @itemx @var{file}.FTN
1545 Fixed form Fortran source code that must be preprocessed (with the traditional
1546 preprocessor).
1547
1548 @item @var{file}.f90
1549 @itemx @var{file}.f95
1550 @itemx @var{file}.f03
1551 @itemx @var{file}.f08
1552 Free form Fortran source code that should not be preprocessed.
1553
1554 @item @var{file}.F90
1555 @itemx @var{file}.F95
1556 @itemx @var{file}.F03
1557 @itemx @var{file}.F08
1558 Free form Fortran source code that must be preprocessed (with the
1559 traditional preprocessor).
1560
1561 @item @var{file}.go
1562 Go source code.
1563
1564 @item @var{file}.d
1565 D source code.
1566
1567 @item @var{file}.di
1568 D interface file.
1569
1570 @item @var{file}.dd
1571 D documentation code (Ddoc).
1572
1573 @item @var{file}.ads
1574 Ada source code file that contains a library unit declaration (a
1575 declaration of a package, subprogram, or generic, or a generic
1576 instantiation), or a library unit renaming declaration (a package,
1577 generic, or subprogram renaming declaration). Such files are also
1578 called @dfn{specs}.
1579
1580 @item @var{file}.adb
1581 Ada source code file containing a library unit body (a subprogram or
1582 package body). Such files are also called @dfn{bodies}.
1583
1584 @c GCC also knows about some suffixes for languages not yet included:
1585 @c Ratfor:
1586 @c @var{file}.r
1587
1588 @item @var{file}.s
1589 Assembler code.
1590
1591 @item @var{file}.S
1592 @itemx @var{file}.sx
1593 Assembler code that must be preprocessed.
1594
1595 @item @var{other}
1596 An object file to be fed straight into linking.
1597 Any file name with no recognized suffix is treated this way.
1598 @end table
1599
1600 @opindex x
1601 You can specify the input language explicitly with the @option{-x} option:
1602
1603 @table @gcctabopt
1604 @item -x @var{language}
1605 Specify explicitly the @var{language} for the following input files
1606 (rather than letting the compiler choose a default based on the file
1607 name suffix). This option applies to all following input files until
1608 the next @option{-x} option. Possible values for @var{language} are:
1609 @smallexample
1610 c c-header cpp-output
1611 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1612 objective-c objective-c-header objective-c-cpp-output
1613 objective-c++ objective-c++-header objective-c++-cpp-output
1614 assembler assembler-with-cpp
1615 ada
1616 d
1617 f77 f77-cpp-input f95 f95-cpp-input
1618 go
1619 @end smallexample
1620
1621 @item -x none
1622 Turn off any specification of a language, so that subsequent files are
1623 handled according to their file name suffixes (as they are if @option{-x}
1624 has not been used at all).
1625 @end table
1626
1627 If you only want some of the stages of compilation, you can use
1628 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1629 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1630 @command{gcc} is to stop. Note that some combinations (for example,
1631 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1632
1633 @table @gcctabopt
1634 @item -c
1635 @opindex c
1636 Compile or assemble the source files, but do not link. The linking
1637 stage simply is not done. The ultimate output is in the form of an
1638 object file for each source file.
1639
1640 By default, the object file name for a source file is made by replacing
1641 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1642
1643 Unrecognized input files, not requiring compilation or assembly, are
1644 ignored.
1645
1646 @item -S
1647 @opindex S
1648 Stop after the stage of compilation proper; do not assemble. The output
1649 is in the form of an assembler code file for each non-assembler input
1650 file specified.
1651
1652 By default, the assembler file name for a source file is made by
1653 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1654
1655 Input files that don't require compilation are ignored.
1656
1657 @item -E
1658 @opindex E
1659 Stop after the preprocessing stage; do not run the compiler proper. The
1660 output is in the form of preprocessed source code, which is sent to the
1661 standard output.
1662
1663 Input files that don't require preprocessing are ignored.
1664
1665 @cindex output file option
1666 @item -o @var{file}
1667 @opindex o
1668 Place the primary output in file @var{file}. This applies to whatever
1669 sort of output is being produced, whether it be an executable file, an
1670 object file, an assembler file or preprocessed C code.
1671
1672 If @option{-o} is not specified, the default is to put an executable
1673 file in @file{a.out}, the object file for
1674 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1675 assembler file in @file{@var{source}.s}, a precompiled header file in
1676 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1677 standard output.
1678
1679 Though @option{-o} names only the primary output, it also affects the
1680 naming of auxiliary and dump outputs. See the examples below. Unless
1681 overridden, both auxiliary outputs and dump outputs are placed in the
1682 same directory as the primary output. In auxiliary outputs, the suffix
1683 of the input file is replaced with that of the auxiliary output file
1684 type; in dump outputs, the suffix of the dump file is appended to the
1685 input file suffix. In compilation commands, the base name of both
1686 auxiliary and dump outputs is that of the primary output; in compile and
1687 link commands, the primary output name, minus the executable suffix, is
1688 combined with the input file name. If both share the same base name,
1689 disregarding the suffix, the result of the combination is that base
1690 name, otherwise, they are concatenated, separated by a dash.
1691
1692 @smallexample
1693 gcc -c foo.c ...
1694 @end smallexample
1695
1696 will use @file{foo.o} as the primary output, and place aux outputs and
1697 dumps next to it, e.g., aux file @file{foo.dwo} for
1698 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1699 @option{-fdump-rtl-final}.
1700
1701 If a non-linker output file is explicitly specified, aux and dump files
1702 by default take the same base name:
1703
1704 @smallexample
1705 gcc -c foo.c -o dir/foobar.o ...
1706 @end smallexample
1707
1708 will name aux outputs @file{dir/foobar.*} and dump outputs
1709 @file{dir/foobar.c.*}.
1710
1711 A linker output will instead prefix aux and dump outputs:
1712
1713 @smallexample
1714 gcc foo.c bar.c -o dir/foobar ...
1715 @end smallexample
1716
1717 will generally name aux outputs @file{dir/foobar-foo.*} and
1718 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1719 @file{dir/foobar-bar.c.*}.
1720
1721 The one exception to the above is when the executable shares the base
1722 name with the single input:
1723
1724 @smallexample
1725 gcc foo.c -o dir/foo ...
1726 @end smallexample
1727
1728 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1729 named @file{dir/foo.c.*}.
1730
1731 The location and the names of auxiliary and dump outputs can be adjusted
1732 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1733 @option{-dumpdir}, @option{-save-temps=cwd}, and
1734 @option{-save-temps=obj}.
1735
1736
1737 @item -dumpbase @var{dumpbase}
1738 @opindex dumpbase
1739 This option sets the base name for auxiliary and dump output files. It
1740 does not affect the name of the primary output file. Intermediate
1741 outputs, when preserved, are not regarded as primary outputs, but as
1742 auxiliary outputs:
1743
1744 @smallexample
1745 gcc -save-temps -S foo.c
1746 @end smallexample
1747
1748 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1749 then compiles to the (implied) output file @file{foo.s}, whereas:
1750
1751 @smallexample
1752 gcc -save-temps -dumpbase save-foo -c foo.c
1753 @end smallexample
1754
1755 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1756 an intermediate, thus auxiliary output), and then assembles to the
1757 (implied) output file @file{foo.o}.
1758
1759 Absent this option, dump and aux files take their names from the input
1760 file, or from the (non-linker) output file, if one is explicitly
1761 specified: dump output files (e.g. those requested by @option{-fdump-*}
1762 options) with the input name suffix, and aux output files (those
1763 requested by other non-dump options, e.g. @code{-save-temps},
1764 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1765
1766 Similar suffix differentiation of dump and aux outputs can be attained
1767 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1768 @option{-dumpbase-ext .suf}.
1769
1770 If @var{dumpbase} is explicitly specified with any directory component,
1771 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1772 @option{-save-temps=*}) is ignored, and instead of appending to it,
1773 @var{dumpbase} fully overrides it:
1774
1775 @smallexample
1776 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1777 -dumpdir pfx- -save-temps=cwd ...
1778 @end smallexample
1779
1780 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1781 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1782 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1783
1784 When @option{-dumpbase} is specified in a command that compiles multiple
1785 inputs, or that compiles and then links, it may be combined with
1786 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1787 file is compiled using the combined @var{dumppfx}, and default values
1788 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1789 file:
1790
1791 @smallexample
1792 gcc foo.c bar.c -c -dumpbase main ...
1793 @end smallexample
1794
1795 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1796 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1797 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1798 and @file{main-bar.*}.
1799
1800 An empty string specified as @var{dumpbase} avoids the influence of the
1801 output basename in the naming of auxiliary and dump outputs during
1802 compilation, computing default values :
1803
1804 @smallexample
1805 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1806 @end smallexample
1807
1808 will name aux outputs @file{dir/foo.*} and dump outputs
1809 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1810 name, but the directory still defaults to that of the output.
1811
1812 The empty-string dumpbase does not prevent the use of the output
1813 basename for outputs during linking:
1814
1815 @smallexample
1816 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1817 @end smallexample
1818
1819 The compilation of the source files will name auxiliary outputs
1820 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1821 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1822 linking will use @file{dir/foobar.} as the prefix for dumps and
1823 auxiliary files.
1824
1825
1826 @item -dumpbase-ext @var{auxdropsuf}
1827 @opindex dumpbase-ext
1828 When forming the name of an auxiliary (but not a dump) output file, drop
1829 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1830 suffixes. If not specified, this option defaults to the suffix of a
1831 default @var{dumpbase}, i.e., the suffix of the input file when
1832 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1833 is combined with @var{dumppfx}.
1834
1835 @smallexample
1836 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1837 @end smallexample
1838
1839 creates @file{dir/foo.o} as the main output, and generates auxiliary
1840 outputs in @file{dir/x-foo.*}, taking the location of the primary
1841 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1842 outputs retain the suffix: @file{dir/x-foo.c.*}.
1843
1844 This option is disregarded if it does not match the suffix of a
1845 specified @var{dumpbase}, except as an alternative to the executable
1846 suffix when appending the linker output base name to @var{dumppfx}, as
1847 specified below:
1848
1849 @smallexample
1850 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1851 @end smallexample
1852
1853 creates @file{main.out} as the primary output, and avoids overwriting
1854 the auxiliary and dump outputs by using the executable name minus
1855 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1856 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1857 @file{main-foo.c.*} and @file{main-bar.c.*}.
1858
1859
1860 @item -dumpdir @var{dumppfx}
1861 @opindex dumpdir
1862 When forming the name of an auxiliary or dump output file, use
1863 @var{dumppfx} as a prefix:
1864
1865 @smallexample
1866 gcc -dumpdir pfx- -c foo.c ...
1867 @end smallexample
1868
1869 creates @file{foo.o} as the primary output, and auxiliary outputs named
1870 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1871 @var{dumpbase} derived from the default primary output, derived in turn
1872 from the input name. Dump outputs also take the input name suffix:
1873 @file{pfx-foo.c.*}.
1874
1875 If @var{dumppfx} is to be used as a directory name, it must end with a
1876 directory separator:
1877
1878 @smallexample
1879 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1880 @end smallexample
1881
1882 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1883 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1884 default @var{dumpbase} derived from the primary output name. Dump
1885 outputs also take the input name suffix: @file{dir/bar.c.*}.
1886
1887 It defaults to the location of the output file, unless the output
1888 file is a special file like @code{/dev/null}. Options
1889 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1890 default, just like an explicit @option{-dumpdir} option. In case
1891 multiple such options are given, the last one prevails:
1892
1893 @smallexample
1894 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1895 @end smallexample
1896
1897 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1898 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1899 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1900 default for @option{-save-temps}, nor that the output directory is
1901 implicitly the current directory. Dump outputs are named
1902 @file{foo.c.*}.
1903
1904 When compiling from multiple input files, if @option{-dumpbase} is
1905 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1906 are appended to (or override, if containing any directory components) an
1907 explicit or defaulted @var{dumppfx}, so that each of the multiple
1908 compilations gets differently-named aux and dump outputs.
1909
1910 @smallexample
1911 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1912 @end smallexample
1913
1914 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1915 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1916 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1917 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1918 single-input compilation:
1919
1920 @smallexample
1921 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1922 @end smallexample
1923
1924 that, applying @option{-dumpbase} to a single source, does not compute
1925 and append a separate @var{dumpbase} per input file. Its auxiliary and
1926 dump outputs go in @file{dir/pfx-main.*}.
1927
1928 When compiling and then linking from multiple input files, a defaulted
1929 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1930 transformation above (e.g. the compilation of @file{foo.c} and
1931 @file{bar.c} above, but without @option{-c}). If neither
1932 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1933 base name, minus @var{auxdropsuf}, if specified, or the executable
1934 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1935 instead. Note, however, that unlike earlier cases of linking:
1936
1937 @smallexample
1938 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1939 @end smallexample
1940
1941 does not append the output name @file{main} to @var{dumppfx}, because
1942 @option{-dumpdir} is explicitly specified. The goal is that the
1943 explicitly-specified @var{dumppfx} may contain the specified output name
1944 as part of the prefix, if desired; only an explicitly-specified
1945 @option{-dumpbase} would be combined with it, in order to avoid simply
1946 discarding a meaningful option.
1947
1948 When compiling and then linking from a single input file, the linker
1949 output base name will only be appended to the default @var{dumppfx} as
1950 above if it does not share the base name with the single input file
1951 name. This has been covered in single-input linking cases above, but
1952 not with an explicit @option{-dumpdir} that inhibits the combination,
1953 even if overridden by @option{-save-temps=*}:
1954
1955 @smallexample
1956 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1957 @end smallexample
1958
1959 Auxiliary outputs are named @file{foo.*}, and dump outputs
1960 @file{foo.c.*}, in the current working directory as ultimately requested
1961 by @option{-save-temps=cwd}.
1962
1963 Summing it all up for an intuitive though slightly imprecise data flow:
1964 the primary output name is broken into a directory part and a basename
1965 part; @var{dumppfx} is set to the former, unless overridden by
1966 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1967 to the latter, unless overriden by @option{-dumpbase}. If there are
1968 multiple inputs or linking, this @var{dumpbase} may be combined with
1969 @var{dumppfx} and taken from each input file. Auxiliary output names
1970 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1971 minus suffix, and the auxiliary output suffix; dump output names are
1972 only different in that the suffix from @var{dumpbase} is retained.
1973
1974 When it comes to auxiliary and dump outputs created during LTO
1975 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1976 given or as derived from the linker output name but not from inputs,
1977 even in cases in which this combination would not otherwise be used as
1978 such, is passed down with a trailing period replacing the compiler-added
1979 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1980 being involved in linking, this program does not normally get any
1981 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1982
1983 When running sub-compilers, @command{lto-wrapper} appends LTO stage
1984 names to the received @var{dumppfx}, ensures it contains a directory
1985 component so that it overrides any @option{-dumpdir}, and passes that as
1986 @option{-dumpbase} to sub-compilers.
1987
1988 @item -v
1989 @opindex v
1990 Print (on standard error output) the commands executed to run the stages
1991 of compilation. Also print the version number of the compiler driver
1992 program and of the preprocessor and the compiler proper.
1993
1994 @item -###
1995 @opindex ###
1996 Like @option{-v} except the commands are not executed and arguments
1997 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1998 This is useful for shell scripts to capture the driver-generated command lines.
1999
2000 @item --help
2001 @opindex help
2002 Print (on the standard output) a description of the command-line options
2003 understood by @command{gcc}. If the @option{-v} option is also specified
2004 then @option{--help} is also passed on to the various processes
2005 invoked by @command{gcc}, so that they can display the command-line options
2006 they accept. If the @option{-Wextra} option has also been specified
2007 (prior to the @option{--help} option), then command-line options that
2008 have no documentation associated with them are also displayed.
2009
2010 @item --target-help
2011 @opindex target-help
2012 Print (on the standard output) a description of target-specific command-line
2013 options for each tool. For some targets extra target-specific
2014 information may also be printed.
2015
2016 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2017 Print (on the standard output) a description of the command-line
2018 options understood by the compiler that fit into all specified classes
2019 and qualifiers. These are the supported classes:
2020
2021 @table @asis
2022 @item @samp{optimizers}
2023 Display all of the optimization options supported by the
2024 compiler.
2025
2026 @item @samp{warnings}
2027 Display all of the options controlling warning messages
2028 produced by the compiler.
2029
2030 @item @samp{target}
2031 Display target-specific options. Unlike the
2032 @option{--target-help} option however, target-specific options of the
2033 linker and assembler are not displayed. This is because those
2034 tools do not currently support the extended @option{--help=} syntax.
2035
2036 @item @samp{params}
2037 Display the values recognized by the @option{--param}
2038 option.
2039
2040 @item @var{language}
2041 Display the options supported for @var{language}, where
2042 @var{language} is the name of one of the languages supported in this
2043 version of GCC@. If an option is supported by all languages, one needs
2044 to select @samp{common} class.
2045
2046 @item @samp{common}
2047 Display the options that are common to all languages.
2048 @end table
2049
2050 These are the supported qualifiers:
2051
2052 @table @asis
2053 @item @samp{undocumented}
2054 Display only those options that are undocumented.
2055
2056 @item @samp{joined}
2057 Display options taking an argument that appears after an equal
2058 sign in the same continuous piece of text, such as:
2059 @samp{--help=target}.
2060
2061 @item @samp{separate}
2062 Display options taking an argument that appears as a separate word
2063 following the original option, such as: @samp{-o output-file}.
2064 @end table
2065
2066 Thus for example to display all the undocumented target-specific
2067 switches supported by the compiler, use:
2068
2069 @smallexample
2070 --help=target,undocumented
2071 @end smallexample
2072
2073 The sense of a qualifier can be inverted by prefixing it with the
2074 @samp{^} character, so for example to display all binary warning
2075 options (i.e., ones that are either on or off and that do not take an
2076 argument) that have a description, use:
2077
2078 @smallexample
2079 --help=warnings,^joined,^undocumented
2080 @end smallexample
2081
2082 The argument to @option{--help=} should not consist solely of inverted
2083 qualifiers.
2084
2085 Combining several classes is possible, although this usually
2086 restricts the output so much that there is nothing to display. One
2087 case where it does work, however, is when one of the classes is
2088 @var{target}. For example, to display all the target-specific
2089 optimization options, use:
2090
2091 @smallexample
2092 --help=target,optimizers
2093 @end smallexample
2094
2095 The @option{--help=} option can be repeated on the command line. Each
2096 successive use displays its requested class of options, skipping
2097 those that have already been displayed. If @option{--help} is also
2098 specified anywhere on the command line then this takes precedence
2099 over any @option{--help=} option.
2100
2101 If the @option{-Q} option appears on the command line before the
2102 @option{--help=} option, then the descriptive text displayed by
2103 @option{--help=} is changed. Instead of describing the displayed
2104 options, an indication is given as to whether the option is enabled,
2105 disabled or set to a specific value (assuming that the compiler
2106 knows this at the point where the @option{--help=} option is used).
2107
2108 Here is a truncated example from the ARM port of @command{gcc}:
2109
2110 @smallexample
2111 % gcc -Q -mabi=2 --help=target -c
2112 The following options are target specific:
2113 -mabi= 2
2114 -mabort-on-noreturn [disabled]
2115 -mapcs [disabled]
2116 @end smallexample
2117
2118 The output is sensitive to the effects of previous command-line
2119 options, so for example it is possible to find out which optimizations
2120 are enabled at @option{-O2} by using:
2121
2122 @smallexample
2123 -Q -O2 --help=optimizers
2124 @end smallexample
2125
2126 Alternatively you can discover which binary optimizations are enabled
2127 by @option{-O3} by using:
2128
2129 @smallexample
2130 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2131 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2132 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2133 @end smallexample
2134
2135 @item --version
2136 @opindex version
2137 Display the version number and copyrights of the invoked GCC@.
2138
2139 @item -pass-exit-codes
2140 @opindex pass-exit-codes
2141 Normally the @command{gcc} program exits with the code of 1 if any
2142 phase of the compiler returns a non-success return code. If you specify
2143 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2144 the numerically highest error produced by any phase returning an error
2145 indication. The C, C++, and Fortran front ends return 4 if an internal
2146 compiler error is encountered.
2147
2148 @item -pipe
2149 @opindex pipe
2150 Use pipes rather than temporary files for communication between the
2151 various stages of compilation. This fails to work on some systems where
2152 the assembler is unable to read from a pipe; but the GNU assembler has
2153 no trouble.
2154
2155 @item -specs=@var{file}
2156 @opindex specs
2157 Process @var{file} after the compiler reads in the standard @file{specs}
2158 file, in order to override the defaults which the @command{gcc} driver
2159 program uses when determining what switches to pass to @command{cc1},
2160 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2161 @option{-specs=@var{file}} can be specified on the command line, and they
2162 are processed in order, from left to right. @xref{Spec Files}, for
2163 information about the format of the @var{file}.
2164
2165 @item -wrapper
2166 @opindex wrapper
2167 Invoke all subcommands under a wrapper program. The name of the
2168 wrapper program and its parameters are passed as a comma separated
2169 list.
2170
2171 @smallexample
2172 gcc -c t.c -wrapper gdb,--args
2173 @end smallexample
2174
2175 @noindent
2176 This invokes all subprograms of @command{gcc} under
2177 @samp{gdb --args}, thus the invocation of @command{cc1} is
2178 @samp{gdb --args cc1 @dots{}}.
2179
2180 @item -ffile-prefix-map=@var{old}=@var{new}
2181 @opindex ffile-prefix-map
2182 When compiling files residing in directory @file{@var{old}}, record
2183 any references to them in the result of the compilation as if the
2184 files resided in directory @file{@var{new}} instead. Specifying this
2185 option is equivalent to specifying all the individual
2186 @option{-f*-prefix-map} options. This can be used to make reproducible
2187 builds that are location independent. See also
2188 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map} and
2189 @option{-fprofile-prefix-map}.
2190
2191 @item -fplugin=@var{name}.so
2192 @opindex fplugin
2193 Load the plugin code in file @var{name}.so, assumed to be a
2194 shared object to be dlopen'd by the compiler. The base name of
2195 the shared object file is used to identify the plugin for the
2196 purposes of argument parsing (See
2197 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2198 Each plugin should define the callback functions specified in the
2199 Plugins API.
2200
2201 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2202 @opindex fplugin-arg
2203 Define an argument called @var{key} with a value of @var{value}
2204 for the plugin called @var{name}.
2205
2206 @item -fdump-ada-spec@r{[}-slim@r{]}
2207 @opindex fdump-ada-spec
2208 For C and C++ source and include files, generate corresponding Ada specs.
2209 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2210 GNAT User's Guide}, which provides detailed documentation on this feature.
2211
2212 @item -fada-spec-parent=@var{unit}
2213 @opindex fada-spec-parent
2214 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2215 Ada specs as child units of parent @var{unit}.
2216
2217 @item -fdump-go-spec=@var{file}
2218 @opindex fdump-go-spec
2219 For input files in any language, generate corresponding Go
2220 declarations in @var{file}. This generates Go @code{const},
2221 @code{type}, @code{var}, and @code{func} declarations which may be a
2222 useful way to start writing a Go interface to code written in some
2223 other language.
2224
2225 @include @value{srcdir}/../libiberty/at-file.texi
2226 @end table
2227
2228 @node Invoking G++
2229 @section Compiling C++ Programs
2230
2231 @cindex suffixes for C++ source
2232 @cindex C++ source file suffixes
2233 C++ source files conventionally use one of the suffixes @samp{.C},
2234 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2235 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2236 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2237 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2238 files with these names and compiles them as C++ programs even if you
2239 call the compiler the same way as for compiling C programs (usually
2240 with the name @command{gcc}).
2241
2242 @findex g++
2243 @findex c++
2244 However, the use of @command{gcc} does not add the C++ library.
2245 @command{g++} is a program that calls GCC and automatically specifies linking
2246 against the C++ library. It treats @samp{.c},
2247 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2248 files unless @option{-x} is used. This program is also useful when
2249 precompiling a C header file with a @samp{.h} extension for use in C++
2250 compilations. On many systems, @command{g++} is also installed with
2251 the name @command{c++}.
2252
2253 @cindex invoking @command{g++}
2254 When you compile C++ programs, you may specify many of the same
2255 command-line options that you use for compiling programs in any
2256 language; or command-line options meaningful for C and related
2257 languages; or options that are meaningful only for C++ programs.
2258 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2259 explanations of options for languages related to C@.
2260 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2261 explanations of options that are meaningful only for C++ programs.
2262
2263 @node C Dialect Options
2264 @section Options Controlling C Dialect
2265 @cindex dialect options
2266 @cindex language dialect options
2267 @cindex options, dialect
2268
2269 The following options control the dialect of C (or languages derived
2270 from C, such as C++, Objective-C and Objective-C++) that the compiler
2271 accepts:
2272
2273 @table @gcctabopt
2274 @cindex ANSI support
2275 @cindex ISO support
2276 @item -ansi
2277 @opindex ansi
2278 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2279 equivalent to @option{-std=c++98}.
2280
2281 This turns off certain features of GCC that are incompatible with ISO
2282 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2283 such as the @code{asm} and @code{typeof} keywords, and
2284 predefined macros such as @code{unix} and @code{vax} that identify the
2285 type of system you are using. It also enables the undesirable and
2286 rarely used ISO trigraph feature. For the C compiler,
2287 it disables recognition of C++ style @samp{//} comments as well as
2288 the @code{inline} keyword.
2289
2290 The alternate keywords @code{__asm__}, @code{__extension__},
2291 @code{__inline__} and @code{__typeof__} continue to work despite
2292 @option{-ansi}. You would not want to use them in an ISO C program, of
2293 course, but it is useful to put them in header files that might be included
2294 in compilations done with @option{-ansi}. Alternate predefined macros
2295 such as @code{__unix__} and @code{__vax__} are also available, with or
2296 without @option{-ansi}.
2297
2298 The @option{-ansi} option does not cause non-ISO programs to be
2299 rejected gratuitously. For that, @option{-Wpedantic} is required in
2300 addition to @option{-ansi}. @xref{Warning Options}.
2301
2302 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2303 option is used. Some header files may notice this macro and refrain
2304 from declaring certain functions or defining certain macros that the
2305 ISO standard doesn't call for; this is to avoid interfering with any
2306 programs that might use these names for other things.
2307
2308 Functions that are normally built in but do not have semantics
2309 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2310 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2311 built-in functions provided by GCC}, for details of the functions
2312 affected.
2313
2314 @item -std=
2315 @opindex std
2316 Determine the language standard. @xref{Standards,,Language Standards
2317 Supported by GCC}, for details of these standard versions. This option
2318 is currently only supported when compiling C or C++.
2319
2320 The compiler can accept several base standards, such as @samp{c90} or
2321 @samp{c++98}, and GNU dialects of those standards, such as
2322 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2323 compiler accepts all programs following that standard plus those
2324 using GNU extensions that do not contradict it. For example,
2325 @option{-std=c90} turns off certain features of GCC that are
2326 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2327 keywords, but not other GNU extensions that do not have a meaning in
2328 ISO C90, such as omitting the middle term of a @code{?:}
2329 expression. On the other hand, when a GNU dialect of a standard is
2330 specified, all features supported by the compiler are enabled, even when
2331 those features change the meaning of the base standard. As a result, some
2332 strict-conforming programs may be rejected. The particular standard
2333 is used by @option{-Wpedantic} to identify which features are GNU
2334 extensions given that version of the standard. For example
2335 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2336 comments, while @option{-std=gnu99 -Wpedantic} does not.
2337
2338 A value for this option must be provided; possible values are
2339
2340 @table @samp
2341 @item c90
2342 @itemx c89
2343 @itemx iso9899:1990
2344 Support all ISO C90 programs (certain GNU extensions that conflict
2345 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2346
2347 @item iso9899:199409
2348 ISO C90 as modified in amendment 1.
2349
2350 @item c99
2351 @itemx c9x
2352 @itemx iso9899:1999
2353 @itemx iso9899:199x
2354 ISO C99. This standard is substantially completely supported, modulo
2355 bugs and floating-point issues
2356 (mainly but not entirely relating to optional C99 features from
2357 Annexes F and G). See
2358 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
2359 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2360
2361 @item c11
2362 @itemx c1x
2363 @itemx iso9899:2011
2364 ISO C11, the 2011 revision of the ISO C standard. This standard is
2365 substantially completely supported, modulo bugs, floating-point issues
2366 (mainly but not entirely relating to optional C11 features from
2367 Annexes F and G) and the optional Annexes K (Bounds-checking
2368 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2369
2370 @item c17
2371 @itemx c18
2372 @itemx iso9899:2017
2373 @itemx iso9899:2018
2374 ISO C17, the 2017 revision of the ISO C standard
2375 (published in 2018). This standard is
2376 same as C11 except for corrections of defects (all of which are also
2377 applied with @option{-std=c11}) and a new value of
2378 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2379
2380 @item c2x
2381 The next version of the ISO C standard, still under development. The
2382 support for this version is experimental and incomplete.
2383
2384 @item gnu90
2385 @itemx gnu89
2386 GNU dialect of ISO C90 (including some C99 features).
2387
2388 @item gnu99
2389 @itemx gnu9x
2390 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2391
2392 @item gnu11
2393 @itemx gnu1x
2394 GNU dialect of ISO C11.
2395 The name @samp{gnu1x} is deprecated.
2396
2397 @item gnu17
2398 @itemx gnu18
2399 GNU dialect of ISO C17. This is the default for C code.
2400
2401 @item gnu2x
2402 The next version of the ISO C standard, still under development, plus
2403 GNU extensions. The support for this version is experimental and
2404 incomplete.
2405
2406 @item c++98
2407 @itemx c++03
2408 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2409 additional defect reports. Same as @option{-ansi} for C++ code.
2410
2411 @item gnu++98
2412 @itemx gnu++03
2413 GNU dialect of @option{-std=c++98}.
2414
2415 @item c++11
2416 @itemx c++0x
2417 The 2011 ISO C++ standard plus amendments.
2418 The name @samp{c++0x} is deprecated.
2419
2420 @item gnu++11
2421 @itemx gnu++0x
2422 GNU dialect of @option{-std=c++11}.
2423 The name @samp{gnu++0x} is deprecated.
2424
2425 @item c++14
2426 @itemx c++1y
2427 The 2014 ISO C++ standard plus amendments.
2428 The name @samp{c++1y} is deprecated.
2429
2430 @item gnu++14
2431 @itemx gnu++1y
2432 GNU dialect of @option{-std=c++14}.
2433 The name @samp{gnu++1y} is deprecated.
2434
2435 @item c++17
2436 @itemx c++1z
2437 The 2017 ISO C++ standard plus amendments.
2438 The name @samp{c++1z} is deprecated.
2439
2440 @item gnu++17
2441 @itemx gnu++1z
2442 GNU dialect of @option{-std=c++17}.
2443 This is the default for C++ code.
2444 The name @samp{gnu++1z} is deprecated.
2445
2446 @item c++20
2447 @itemx c++2a
2448 The 2020 ISO C++ standard plus amendments.
2449 Support is experimental, and could change in incompatible ways in
2450 future releases.
2451 The name @samp{c++2a} is deprecated.
2452
2453 @item gnu++20
2454 @itemx gnu++2a
2455 GNU dialect of @option{-std=c++20}.
2456 Support is experimental, and could change in incompatible ways in
2457 future releases.
2458 The name @samp{gnu++2a} is deprecated.
2459
2460 @item c++2b
2461 @itemx c++23
2462 The next revision of the ISO C++ standard, planned for
2463 2023. Support is highly experimental, and will almost certainly
2464 change in incompatible ways in future releases.
2465
2466 @item gnu++2b
2467 @itemx gnu++23
2468 GNU dialect of @option{-std=c++2b}. Support is highly experimental,
2469 and will almost certainly change in incompatible ways in future
2470 releases.
2471 @end table
2472
2473 @item -aux-info @var{filename}
2474 @opindex aux-info
2475 Output to the given filename prototyped declarations for all functions
2476 declared and/or defined in a translation unit, including those in header
2477 files. This option is silently ignored in any language other than C@.
2478
2479 Besides declarations, the file indicates, in comments, the origin of
2480 each declaration (source file and line), whether the declaration was
2481 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2482 @samp{O} for old, respectively, in the first character after the line
2483 number and the colon), and whether it came from a declaration or a
2484 definition (@samp{C} or @samp{F}, respectively, in the following
2485 character). In the case of function definitions, a K&R-style list of
2486 arguments followed by their declarations is also provided, inside
2487 comments, after the declaration.
2488
2489 @item -fallow-parameterless-variadic-functions
2490 @opindex fallow-parameterless-variadic-functions
2491 Accept variadic functions without named parameters.
2492
2493 Although it is possible to define such a function, this is not very
2494 useful as it is not possible to read the arguments. This is only
2495 supported for C as this construct is allowed by C++.
2496
2497 @item -fno-asm
2498 @opindex fno-asm
2499 @opindex fasm
2500 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2501 keyword, so that code can use these words as identifiers. You can use
2502 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2503 instead. In C, @option{-ansi} implies @option{-fno-asm}.
2504
2505 In C++, @code{inline} is a standard keyword and is not affected by
2506 this switch. You may want to use the @option{-fno-gnu-keywords} flag
2507 instead, which disables @code{typeof} but not @code{asm} and
2508 @code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2509 this switch only affects the @code{asm} and @code{typeof} keywords,
2510 since @code{inline} is a standard keyword in ISO C99.
2511
2512 @item -fno-builtin
2513 @itemx -fno-builtin-@var{function}
2514 @opindex fno-builtin
2515 @opindex fbuiltin
2516 @cindex built-in functions
2517 Don't recognize built-in functions that do not begin with
2518 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2519 functions provided by GCC}, for details of the functions affected,
2520 including those which are not built-in functions when @option{-ansi} or
2521 @option{-std} options for strict ISO C conformance are used because they
2522 do not have an ISO standard meaning.
2523
2524 GCC normally generates special code to handle certain built-in functions
2525 more efficiently; for instance, calls to @code{alloca} may become single
2526 instructions which adjust the stack directly, and calls to @code{memcpy}
2527 may become inline copy loops. The resulting code is often both smaller
2528 and faster, but since the function calls no longer appear as such, you
2529 cannot set a breakpoint on those calls, nor can you change the behavior
2530 of the functions by linking with a different library. In addition,
2531 when a function is recognized as a built-in function, GCC may use
2532 information about that function to warn about problems with calls to
2533 that function, or to generate more efficient code, even if the
2534 resulting code still contains calls to that function. For example,
2535 warnings are given with @option{-Wformat} for bad calls to
2536 @code{printf} when @code{printf} is built in and @code{strlen} is
2537 known not to modify global memory.
2538
2539 With the @option{-fno-builtin-@var{function}} option
2540 only the built-in function @var{function} is
2541 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2542 function is named that is not built-in in this version of GCC, this
2543 option is ignored. There is no corresponding
2544 @option{-fbuiltin-@var{function}} option; if you wish to enable
2545 built-in functions selectively when using @option{-fno-builtin} or
2546 @option{-ffreestanding}, you may define macros such as:
2547
2548 @smallexample
2549 #define abs(n) __builtin_abs ((n))
2550 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2551 @end smallexample
2552
2553 @item -fcond-mismatch
2554 @opindex fcond-mismatch
2555 Allow conditional expressions with mismatched types in the second and
2556 third arguments. The value of such an expression is void. This option
2557 is not supported for C++.
2558
2559 @item -ffreestanding
2560 @opindex ffreestanding
2561 @cindex hosted environment
2562
2563 Assert that compilation targets a freestanding environment. This
2564 implies @option{-fno-builtin}. A freestanding environment
2565 is one in which the standard library may not exist, and program startup may
2566 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2567 This is equivalent to @option{-fno-hosted}.
2568
2569 @xref{Standards,,Language Standards Supported by GCC}, for details of
2570 freestanding and hosted environments.
2571
2572 @item -fgimple
2573 @opindex fgimple
2574
2575 Enable parsing of function definitions marked with @code{__GIMPLE}.
2576 This is an experimental feature that allows unit testing of GIMPLE
2577 passes.
2578
2579 @item -fgnu-tm
2580 @opindex fgnu-tm
2581 When the option @option{-fgnu-tm} is specified, the compiler
2582 generates code for the Linux variant of Intel's current Transactional
2583 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2584 an experimental feature whose interface may change in future versions
2585 of GCC, as the official specification changes. Please note that not
2586 all architectures are supported for this feature.
2587
2588 For more information on GCC's support for transactional memory,
2589 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2590 Transactional Memory Library}.
2591
2592 Note that the transactional memory feature is not supported with
2593 non-call exceptions (@option{-fnon-call-exceptions}).
2594
2595 @item -fgnu89-inline
2596 @opindex fgnu89-inline
2597 The option @option{-fgnu89-inline} tells GCC to use the traditional
2598 GNU semantics for @code{inline} functions when in C99 mode.
2599 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2600 Using this option is roughly equivalent to adding the
2601 @code{gnu_inline} function attribute to all inline functions
2602 (@pxref{Function Attributes}).
2603
2604 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2605 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2606 specifies the default behavior).
2607 This option is not supported in @option{-std=c90} or
2608 @option{-std=gnu90} mode.
2609
2610 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2611 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2612 in effect for @code{inline} functions. @xref{Common Predefined
2613 Macros,,,cpp,The C Preprocessor}.
2614
2615 @item -fhosted
2616 @opindex fhosted
2617 @cindex hosted environment
2618
2619 Assert that compilation targets a hosted environment. This implies
2620 @option{-fbuiltin}. A hosted environment is one in which the
2621 entire standard library is available, and in which @code{main} has a return
2622 type of @code{int}. Examples are nearly everything except a kernel.
2623 This is equivalent to @option{-fno-freestanding}.
2624
2625 @item -flax-vector-conversions
2626 @opindex flax-vector-conversions
2627 Allow implicit conversions between vectors with differing numbers of
2628 elements and/or incompatible element types. This option should not be
2629 used for new code.
2630
2631 @item -fms-extensions
2632 @opindex fms-extensions
2633 Accept some non-standard constructs used in Microsoft header files.
2634
2635 In C++ code, this allows member names in structures to be similar
2636 to previous types declarations.
2637
2638 @smallexample
2639 typedef int UOW;
2640 struct ABC @{
2641 UOW UOW;
2642 @};
2643 @end smallexample
2644
2645 Some cases of unnamed fields in structures and unions are only
2646 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2647 fields within structs/unions}, for details.
2648
2649 Note that this option is off for all targets except for x86
2650 targets using ms-abi.
2651
2652 @item -foffload=disable
2653 @itemx -foffload=default
2654 @itemx -foffload=@var{target-list}
2655 @opindex foffload
2656 @cindex Offloading targets
2657 @cindex OpenACC offloading targets
2658 @cindex OpenMP offloading targets
2659 Specify for which OpenMP and OpenACC offload targets code should be generated.
2660 The default behavior, equivalent to @option{-foffload=default}, is to generate
2661 code for all supported offload targets. The @option{-foffload=disable} form
2662 generates code only for the host fallback, while
2663 @option{-foffload=@var{target-list}} generates code only for the specified
2664 comma-separated list of offload targets.
2665
2666 Offload targets are specified in GCC's internal target-triplet format. You can
2667 run the compiler with @option{-v} to show the list of configured offload targets
2668 under @code{OFFLOAD_TARGET_NAMES}.
2669
2670 @item -foffload-options=@var{options}
2671 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2672 @opindex foffload-options
2673 @cindex Offloading options
2674 @cindex OpenACC offloading options
2675 @cindex OpenMP offloading options
2676
2677 With @option{-foffload-options=@var{options}}, GCC passes the specified
2678 @var{options} to the compilers for all enabled offloading targets. You can
2679 specify options that apply only to a specific target or targets by using
2680 the @option{-foffload-options=@var{target-list}=@var{options}} form. The
2681 @var{target-list} is a comma-separated list in the same format as for the
2682 @option{-foffload=} option.
2683
2684 Typical command lines are
2685
2686 @smallexample
2687 -foffload-options=-lgfortran -foffload-options=-lm
2688 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2689 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2690 @end smallexample
2691
2692 @item -fopenacc
2693 @opindex fopenacc
2694 @cindex OpenACC accelerator programming
2695 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2696 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2697 compiler generates accelerated code according to the OpenACC Application
2698 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2699 implies @option{-pthread}, and thus is only supported on targets that
2700 have support for @option{-pthread}.
2701
2702 @item -fopenacc-dim=@var{geom}
2703 @opindex fopenacc-dim
2704 @cindex OpenACC accelerator programming
2705 Specify default compute dimensions for parallel offload regions that do
2706 not explicitly specify. The @var{geom} value is a triple of
2707 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2708 can be omitted, to use a target-specific default value.
2709
2710 @item -fopenmp
2711 @opindex fopenmp
2712 @cindex OpenMP parallel
2713 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2714 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2715 compiler generates parallel code according to the OpenMP Application
2716 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2717 implies @option{-pthread}, and thus is only supported on targets that
2718 have support for @option{-pthread}. @option{-fopenmp} implies
2719 @option{-fopenmp-simd}.
2720
2721 @item -fopenmp-simd
2722 @opindex fopenmp-simd
2723 @cindex OpenMP SIMD
2724 @cindex SIMD
2725 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2726 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2727 are ignored.
2728
2729 @item -fpermitted-flt-eval-methods=@var{style}
2730 @opindex fpermitted-flt-eval-methods
2731 @opindex fpermitted-flt-eval-methods=c11
2732 @opindex fpermitted-flt-eval-methods=ts-18661-3
2733 ISO/IEC TS 18661-3 defines new permissible values for
2734 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2735 a semantic type that is an interchange or extended format should be
2736 evaluated to the precision and range of that type. These new values are
2737 a superset of those permitted under C99/C11, which does not specify the
2738 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2739 conforming to C11 may not have been written expecting the possibility of
2740 the new values.
2741
2742 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2743 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2744 or the extended set of values specified in ISO/IEC TS 18661-3.
2745
2746 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2747
2748 The default when in a standards compliant mode (@option{-std=c11} or similar)
2749 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2750 dialect (@option{-std=gnu11} or similar) is
2751 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2752
2753 @item -fplan9-extensions
2754 @opindex fplan9-extensions
2755 Accept some non-standard constructs used in Plan 9 code.
2756
2757 This enables @option{-fms-extensions}, permits passing pointers to
2758 structures with anonymous fields to functions that expect pointers to
2759 elements of the type of the field, and permits referring to anonymous
2760 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2761 struct/union fields within structs/unions}, for details. This is only
2762 supported for C, not C++.
2763
2764 @item -fsigned-bitfields
2765 @itemx -funsigned-bitfields
2766 @itemx -fno-signed-bitfields
2767 @itemx -fno-unsigned-bitfields
2768 @opindex fsigned-bitfields
2769 @opindex funsigned-bitfields
2770 @opindex fno-signed-bitfields
2771 @opindex fno-unsigned-bitfields
2772 These options control whether a bit-field is signed or unsigned, when the
2773 declaration does not use either @code{signed} or @code{unsigned}. By
2774 default, such a bit-field is signed, because this is consistent: the
2775 basic integer types such as @code{int} are signed types.
2776
2777 @item -fsigned-char
2778 @opindex fsigned-char
2779 Let the type @code{char} be signed, like @code{signed char}.
2780
2781 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2782 the negative form of @option{-funsigned-char}. Likewise, the option
2783 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2784
2785 @item -funsigned-char
2786 @opindex funsigned-char
2787 Let the type @code{char} be unsigned, like @code{unsigned char}.
2788
2789 Each kind of machine has a default for what @code{char} should
2790 be. It is either like @code{unsigned char} by default or like
2791 @code{signed char} by default.
2792
2793 Ideally, a portable program should always use @code{signed char} or
2794 @code{unsigned char} when it depends on the signedness of an object.
2795 But many programs have been written to use plain @code{char} and
2796 expect it to be signed, or expect it to be unsigned, depending on the
2797 machines they were written for. This option, and its inverse, let you
2798 make such a program work with the opposite default.
2799
2800 The type @code{char} is always a distinct type from each of
2801 @code{signed char} or @code{unsigned char}, even though its behavior
2802 is always just like one of those two.
2803
2804 @item -fsso-struct=@var{endianness}
2805 @opindex fsso-struct
2806 Set the default scalar storage order of structures and unions to the
2807 specified endianness. The accepted values are @samp{big-endian},
2808 @samp{little-endian} and @samp{native} for the native endianness of
2809 the target (the default). This option is not supported for C++.
2810
2811 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2812 code that is not binary compatible with code generated without it if the
2813 specified endianness is not the native endianness of the target.
2814 @end table
2815
2816 @node C++ Dialect Options
2817 @section Options Controlling C++ Dialect
2818
2819 @cindex compiler options, C++
2820 @cindex C++ options, command-line
2821 @cindex options, C++
2822 This section describes the command-line options that are only meaningful
2823 for C++ programs. You can also use most of the GNU compiler options
2824 regardless of what language your program is in. For example, you
2825 might compile a file @file{firstClass.C} like this:
2826
2827 @smallexample
2828 g++ -g -fstrict-enums -O -c firstClass.C
2829 @end smallexample
2830
2831 @noindent
2832 In this example, only @option{-fstrict-enums} is an option meant
2833 only for C++ programs; you can use the other options with any
2834 language supported by GCC@.
2835
2836 Some options for compiling C programs, such as @option{-std}, are also
2837 relevant for C++ programs.
2838 @xref{C Dialect Options,,Options Controlling C Dialect}.
2839
2840 Here is a list of options that are @emph{only} for compiling C++ programs:
2841
2842 @table @gcctabopt
2843
2844 @item -fabi-version=@var{n}
2845 @opindex fabi-version
2846 Use version @var{n} of the C++ ABI@. The default is version 0.
2847
2848 Version 0 refers to the version conforming most closely to
2849 the C++ ABI specification. Therefore, the ABI obtained using version 0
2850 will change in different versions of G++ as ABI bugs are fixed.
2851
2852 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2853
2854 Version 2 is the version of the C++ ABI that first appeared in G++
2855 3.4, and was the default through G++ 4.9.
2856
2857 Version 3 corrects an error in mangling a constant address as a
2858 template argument.
2859
2860 Version 4, which first appeared in G++ 4.5, implements a standard
2861 mangling for vector types.
2862
2863 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2864 attribute const/volatile on function pointer types, decltype of a
2865 plain decl, and use of a function parameter in the declaration of
2866 another parameter.
2867
2868 Version 6, which first appeared in G++ 4.7, corrects the promotion
2869 behavior of C++11 scoped enums and the mangling of template argument
2870 packs, const/static_cast, prefix ++ and --, and a class scope function
2871 used as a template argument.
2872
2873 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2874 builtin type and corrects the mangling of lambdas in default argument
2875 scope.
2876
2877 Version 8, which first appeared in G++ 4.9, corrects the substitution
2878 behavior of function types with function-cv-qualifiers.
2879
2880 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2881 @code{nullptr_t}.
2882
2883 Version 10, which first appeared in G++ 6.1, adds mangling of
2884 attributes that affect type identity, such as ia32 calling convention
2885 attributes (e.g.@: @samp{stdcall}).
2886
2887 Version 11, which first appeared in G++ 7, corrects the mangling of
2888 sizeof... expressions and operator names. For multiple entities with
2889 the same name within a function, that are declared in different scopes,
2890 the mangling now changes starting with the twelfth occurrence. It also
2891 implies @option{-fnew-inheriting-ctors}.
2892
2893 Version 12, which first appeared in G++ 8, corrects the calling
2894 conventions for empty classes on the x86_64 target and for classes
2895 with only deleted copy/move constructors. It accidentally changes the
2896 calling convention for classes with a deleted copy constructor and a
2897 trivial move constructor.
2898
2899 Version 13, which first appeared in G++ 8.2, fixes the accidental
2900 change in version 12.
2901
2902 Version 14, which first appeared in G++ 10, corrects the mangling of
2903 the nullptr expression.
2904
2905 Version 15, which first appeared in G++ 11, changes the mangling of
2906 @code{__alignof__} to be distinct from that of @code{alignof}, and
2907 dependent operator names.
2908
2909 See also @option{-Wabi}.
2910
2911 @item -fabi-compat-version=@var{n}
2912 @opindex fabi-compat-version
2913 On targets that support strong aliases, G++
2914 works around mangling changes by creating an alias with the correct
2915 mangled name when defining a symbol with an incorrect mangled name.
2916 This switch specifies which ABI version to use for the alias.
2917
2918 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2919 compatibility). If another ABI version is explicitly selected, this
2920 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2921 use @option{-fabi-compat-version=2}.
2922
2923 If this option is not provided but @option{-Wabi=@var{n}} is, that
2924 version is used for compatibility aliases. If this option is provided
2925 along with @option{-Wabi} (without the version), the version from this
2926 option is used for the warning.
2927
2928 @item -fno-access-control
2929 @opindex fno-access-control
2930 @opindex faccess-control
2931 Turn off all access checking. This switch is mainly useful for working
2932 around bugs in the access control code.
2933
2934 @item -faligned-new
2935 @opindex faligned-new
2936 Enable support for C++17 @code{new} of types that require more
2937 alignment than @code{void* ::operator new(std::size_t)} provides. A
2938 numeric argument such as @code{-faligned-new=32} can be used to
2939 specify how much alignment (in bytes) is provided by that function,
2940 but few users will need to override the default of
2941 @code{alignof(std::max_align_t)}.
2942
2943 This flag is enabled by default for @option{-std=c++17}.
2944
2945 @item -fchar8_t
2946 @itemx -fno-char8_t
2947 @opindex fchar8_t
2948 @opindex fno-char8_t
2949 Enable support for @code{char8_t} as adopted for C++20. This includes
2950 the addition of a new @code{char8_t} fundamental type, changes to the
2951 types of UTF-8 string and character literals, new signatures for
2952 user-defined literals, associated standard library updates, and new
2953 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2954
2955 This option enables functions to be overloaded for ordinary and UTF-8
2956 strings:
2957
2958 @smallexample
2959 int f(const char *); // #1
2960 int f(const char8_t *); // #2
2961 int v1 = f("text"); // Calls #1
2962 int v2 = f(u8"text"); // Calls #2
2963 @end smallexample
2964
2965 @noindent
2966 and introduces new signatures for user-defined literals:
2967
2968 @smallexample
2969 int operator""_udl1(char8_t);
2970 int v3 = u8'x'_udl1;
2971 int operator""_udl2(const char8_t*, std::size_t);
2972 int v4 = u8"text"_udl2;
2973 template<typename T, T...> int operator""_udl3();
2974 int v5 = u8"text"_udl3;
2975 @end smallexample
2976
2977 @noindent
2978 The change to the types of UTF-8 string and character literals introduces
2979 incompatibilities with ISO C++11 and later standards. For example, the
2980 following code is well-formed under ISO C++11, but is ill-formed when
2981 @option{-fchar8_t} is specified.
2982
2983 @smallexample
2984 char ca[] = u8"xx"; // error: char-array initialized from wide
2985 // string
2986 const char *cp = u8"xx";// error: invalid conversion from
2987 // `const char8_t*' to `const char*'
2988 int f(const char*);
2989 auto v = f(u8"xx"); // error: invalid conversion from
2990 // `const char8_t*' to `const char*'
2991 std::string s@{u8"xx"@}; // error: no matching function for call to
2992 // `std::basic_string<char>::basic_string()'
2993 using namespace std::literals;
2994 s = u8"xx"s; // error: conversion from
2995 // `basic_string<char8_t>' to non-scalar
2996 // type `basic_string<char>' requested
2997 @end smallexample
2998
2999 @item -fcheck-new
3000 @opindex fcheck-new
3001 Check that the pointer returned by @code{operator new} is non-null
3002 before attempting to modify the storage allocated. This check is
3003 normally unnecessary because the C++ standard specifies that
3004 @code{operator new} only returns @code{0} if it is declared
3005 @code{throw()}, in which case the compiler always checks the
3006 return value even without this option. In all other cases, when
3007 @code{operator new} has a non-empty exception specification, memory
3008 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
3009 @samp{new (nothrow)}.
3010
3011 @item -fconcepts
3012 @itemx -fconcepts-ts
3013 @opindex fconcepts
3014 @opindex fconcepts-ts
3015 Below @option{-std=c++20}, @option{-fconcepts} enables support for the
3016 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
3017
3018 With @option{-std=c++20} and above, Concepts are part of the language
3019 standard, so @option{-fconcepts} defaults to on. But the standard
3020 specification of Concepts differs significantly from the TS, so some
3021 constructs that were allowed in the TS but didn't make it into the
3022 standard can still be enabled by @option{-fconcepts-ts}.
3023
3024 @item -fconstexpr-depth=@var{n}
3025 @opindex fconstexpr-depth
3026 Set the maximum nested evaluation depth for C++11 constexpr functions
3027 to @var{n}. A limit is needed to detect endless recursion during
3028 constant expression evaluation. The minimum specified by the standard
3029 is 512.
3030
3031 @item -fconstexpr-cache-depth=@var{n}
3032 @opindex fconstexpr-cache-depth
3033 Set the maximum level of nested evaluation depth for C++11 constexpr
3034 functions that will be cached to @var{n}. This is a heuristic that
3035 trades off compilation speed (when the cache avoids repeated
3036 calculations) against memory consumption (when the cache grows very
3037 large from highly recursive evaluations). The default is 8. Very few
3038 users are likely to want to adjust it, but if your code does heavy
3039 constexpr calculations you might want to experiment to find which
3040 value works best for you.
3041
3042 @item -fconstexpr-fp-except
3043 @opindex fconstexpr-fp-except
3044 Annex F of the C standard specifies that IEC559 floating point
3045 exceptions encountered at compile time should not stop compilation.
3046 C++ compilers have historically not followed this guidance, instead
3047 treating floating point division by zero as non-constant even though
3048 it has a well defined value. This flag tells the compiler to give
3049 Annex F priority over other rules saying that a particular operation
3050 is undefined.
3051
3052 @smallexample
3053 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3054 @end smallexample
3055
3056 @item -fconstexpr-loop-limit=@var{n}
3057 @opindex fconstexpr-loop-limit
3058 Set the maximum number of iterations for a loop in C++14 constexpr functions
3059 to @var{n}. A limit is needed to detect infinite loops during
3060 constant expression evaluation. The default is 262144 (1<<18).
3061
3062 @item -fconstexpr-ops-limit=@var{n}
3063 @opindex fconstexpr-ops-limit
3064 Set the maximum number of operations during a single constexpr evaluation.
3065 Even when number of iterations of a single loop is limited with the above limit,
3066 if there are several nested loops and each of them has many iterations but still
3067 smaller than the above limit, or if in a body of some loop or even outside
3068 of a loop too many expressions need to be evaluated, the resulting constexpr
3069 evaluation might take too long.
3070 The default is 33554432 (1<<25).
3071
3072 @item -fcoroutines
3073 @opindex fcoroutines
3074 Enable support for the C++ coroutines extension (experimental).
3075
3076 @item -fno-elide-constructors
3077 @opindex fno-elide-constructors
3078 @opindex felide-constructors
3079 The C++ standard allows an implementation to omit creating a temporary
3080 that is only used to initialize another object of the same type.
3081 Specifying this option disables that optimization, and forces G++ to
3082 call the copy constructor in all cases. This option also causes G++
3083 to call trivial member functions which otherwise would be expanded inline.
3084
3085 In C++17, the compiler is required to omit these temporaries, but this
3086 option still affects trivial member functions.
3087
3088 @item -fno-enforce-eh-specs
3089 @opindex fno-enforce-eh-specs
3090 @opindex fenforce-eh-specs
3091 Don't generate code to check for violation of exception specifications
3092 at run time. This option violates the C++ standard, but may be useful
3093 for reducing code size in production builds, much like defining
3094 @code{NDEBUG}. This does not give user code permission to throw
3095 exceptions in violation of the exception specifications; the compiler
3096 still optimizes based on the specifications, so throwing an
3097 unexpected exception results in undefined behavior at run time.
3098
3099 @item -fextern-tls-init
3100 @itemx -fno-extern-tls-init
3101 @opindex fextern-tls-init
3102 @opindex fno-extern-tls-init
3103 The C++11 and OpenMP standards allow @code{thread_local} and
3104 @code{threadprivate} variables to have dynamic (runtime)
3105 initialization. To support this, any use of such a variable goes
3106 through a wrapper function that performs any necessary initialization.
3107 When the use and definition of the variable are in the same
3108 translation unit, this overhead can be optimized away, but when the
3109 use is in a different translation unit there is significant overhead
3110 even if the variable doesn't actually need dynamic initialization. If
3111 the programmer can be sure that no use of the variable in a
3112 non-defining TU needs to trigger dynamic initialization (either
3113 because the variable is statically initialized, or a use of the
3114 variable in the defining TU will be executed before any uses in
3115 another TU), they can avoid this overhead with the
3116 @option{-fno-extern-tls-init} option.
3117
3118 On targets that support symbol aliases, the default is
3119 @option{-fextern-tls-init}. On targets that do not support symbol
3120 aliases, the default is @option{-fno-extern-tls-init}.
3121
3122 @item -fno-gnu-keywords
3123 @opindex fno-gnu-keywords
3124 @opindex fgnu-keywords
3125 Do not recognize @code{typeof} as a keyword, so that code can use this
3126 word as an identifier. You can use the keyword @code{__typeof__} instead.
3127 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3128 @option{-std=c++98}, @option{-std=c++11}, etc.
3129
3130 @item -fimplicit-constexpr
3131 @opindex fimplicit-constexpr
3132 Make inline functions implicitly constexpr, if they satisfy the
3133 requirements for a constexpr function. This option can be used in
3134 C++14 mode or later. This can result in initialization changing from
3135 dynamic to static and other optimizations.
3136
3137 @item -fno-implicit-templates
3138 @opindex fno-implicit-templates
3139 @opindex fimplicit-templates
3140 Never emit code for non-inline templates that are instantiated
3141 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3142 If you use this option, you must take care to structure your code to
3143 include all the necessary explicit instantiations to avoid getting
3144 undefined symbols at link time.
3145 @xref{Template Instantiation}, for more information.
3146
3147 @item -fno-implicit-inline-templates
3148 @opindex fno-implicit-inline-templates
3149 @opindex fimplicit-inline-templates
3150 Don't emit code for implicit instantiations of inline templates, either.
3151 The default is to handle inlines differently so that compiles with and
3152 without optimization need the same set of explicit instantiations.
3153
3154 @item -fno-implement-inlines
3155 @opindex fno-implement-inlines
3156 @opindex fimplement-inlines
3157 To save space, do not emit out-of-line copies of inline functions
3158 controlled by @code{#pragma implementation}. This causes linker
3159 errors if these functions are not inlined everywhere they are called.
3160
3161 @item -fmodules-ts
3162 @itemx -fno-modules-ts
3163 @opindex fmodules-ts
3164 @opindex fno-modules-ts
3165 Enable support for C++20 modules (@pxref{C++ Modules}). The
3166 @option{-fno-modules-ts} is usually not needed, as that is the
3167 default. Even though this is a C++20 feature, it is not currently
3168 implicitly enabled by selecting that standard version.
3169
3170 @item -fmodule-header
3171 @itemx -fmodule-header=user
3172 @itemx -fmodule-header=system
3173 @opindex fmodule-header
3174 Compile a header file to create an importable header unit.
3175
3176 @item -fmodule-implicit-inline
3177 @opindex fmodule-implicit-inline
3178 Member functions defined in their class definitions are not implicitly
3179 inline for modular code. This is different to traditional C++
3180 behavior, for good reasons. However, it may result in a difficulty
3181 during code porting. This option makes such function definitions
3182 implicitly inline. It does however generate an ABI incompatibility,
3183 so you must use it everywhere or nowhere. (Such definitions outside
3184 of a named module remain implicitly inline, regardless.)
3185
3186 @item -fno-module-lazy
3187 @opindex fno-module-lazy
3188 @opindex fmodule-lazy
3189 Disable lazy module importing and module mapper creation.
3190
3191 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3192 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3193 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3194 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3195 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3196 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3197 @vindex CXX_MODULE_MAPPER @r{environment variable}
3198 @opindex fmodule-mapper
3199 An oracle to query for module name to filename mappings. If
3200 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3201 and if that is unset, an in-process default is provided.
3202
3203 @item -fmodule-only
3204 @opindex fmodule-only
3205 Only emit the Compiled Module Interface, inhibiting any object file.
3206
3207 @item -fms-extensions
3208 @opindex fms-extensions
3209 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3210 int and getting a pointer to member function via non-standard syntax.
3211
3212 @item -fnew-inheriting-ctors
3213 @opindex fnew-inheriting-ctors
3214 Enable the P0136 adjustment to the semantics of C++11 constructor
3215 inheritance. This is part of C++17 but also considered to be a Defect
3216 Report against C++11 and C++14. This flag is enabled by default
3217 unless @option{-fabi-version=10} or lower is specified.
3218
3219 @item -fnew-ttp-matching
3220 @opindex fnew-ttp-matching
3221 Enable the P0522 resolution to Core issue 150, template template
3222 parameters and default arguments: this allows a template with default
3223 template arguments as an argument for a template template parameter
3224 with fewer template parameters. This flag is enabled by default for
3225 @option{-std=c++17}.
3226
3227 @item -fno-nonansi-builtins
3228 @opindex fno-nonansi-builtins
3229 @opindex fnonansi-builtins
3230 Disable built-in declarations of functions that are not mandated by
3231 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3232 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3233
3234 @item -fnothrow-opt
3235 @opindex fnothrow-opt
3236 Treat a @code{throw()} exception specification as if it were a
3237 @code{noexcept} specification to reduce or eliminate the text size
3238 overhead relative to a function with no exception specification. If
3239 the function has local variables of types with non-trivial
3240 destructors, the exception specification actually makes the
3241 function smaller because the EH cleanups for those variables can be
3242 optimized away. The semantic effect is that an exception thrown out of
3243 a function with such an exception specification results in a call
3244 to @code{terminate} rather than @code{unexpected}.
3245
3246 @item -fno-operator-names
3247 @opindex fno-operator-names
3248 @opindex foperator-names
3249 Do not treat the operator name keywords @code{and}, @code{bitand},
3250 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3251 synonyms as keywords.
3252
3253 @item -fno-optional-diags
3254 @opindex fno-optional-diags
3255 @opindex foptional-diags
3256 Disable diagnostics that the standard says a compiler does not need to
3257 issue. Currently, the only such diagnostic issued by G++ is the one for
3258 a name having multiple meanings within a class.
3259
3260 @item -fpermissive
3261 @opindex fpermissive
3262 Downgrade some diagnostics about nonconformant code from errors to
3263 warnings. Thus, using @option{-fpermissive} allows some
3264 nonconforming code to compile.
3265
3266 @item -fno-pretty-templates
3267 @opindex fno-pretty-templates
3268 @opindex fpretty-templates
3269 When an error message refers to a specialization of a function
3270 template, the compiler normally prints the signature of the
3271 template followed by the template arguments and any typedefs or
3272 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3273 rather than @code{void f(int)}) so that it's clear which template is
3274 involved. When an error message refers to a specialization of a class
3275 template, the compiler omits any template arguments that match
3276 the default template arguments for that template. If either of these
3277 behaviors make it harder to understand the error message rather than
3278 easier, you can use @option{-fno-pretty-templates} to disable them.
3279
3280 @item -fno-rtti
3281 @opindex fno-rtti
3282 @opindex frtti
3283 Disable generation of information about every class with virtual
3284 functions for use by the C++ run-time type identification features
3285 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3286 of the language, you can save some space by using this flag. Note that
3287 exception handling uses the same information, but G++ generates it as
3288 needed. The @code{dynamic_cast} operator can still be used for casts that
3289 do not require run-time type information, i.e.@: casts to @code{void *} or to
3290 unambiguous base classes.
3291
3292 Mixing code compiled with @option{-frtti} with that compiled with
3293 @option{-fno-rtti} may not work. For example, programs may
3294 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3295 for a class compiled with @option{-frtti}.
3296
3297 @item -fsized-deallocation
3298 @opindex fsized-deallocation
3299 Enable the built-in global declarations
3300 @smallexample
3301 void operator delete (void *, std::size_t) noexcept;
3302 void operator delete[] (void *, std::size_t) noexcept;
3303 @end smallexample
3304 as introduced in C++14. This is useful for user-defined replacement
3305 deallocation functions that, for example, use the size of the object
3306 to make deallocation faster. Enabled by default under
3307 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3308 warns about places that might want to add a definition.
3309
3310 @item -fstrict-enums
3311 @opindex fstrict-enums
3312 Allow the compiler to optimize using the assumption that a value of
3313 enumerated type can only be one of the values of the enumeration (as
3314 defined in the C++ standard; basically, a value that can be
3315 represented in the minimum number of bits needed to represent all the
3316 enumerators). This assumption may not be valid if the program uses a
3317 cast to convert an arbitrary integer value to the enumerated type.
3318
3319 @item -fstrong-eval-order
3320 @opindex fstrong-eval-order
3321 Evaluate member access, array subscripting, and shift expressions in
3322 left-to-right order, and evaluate assignment in right-to-left order,
3323 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3324 @option{-fstrong-eval-order=some} enables just the ordering of member
3325 access and shift expressions, and is the default without
3326 @option{-std=c++17}.
3327
3328 @item -ftemplate-backtrace-limit=@var{n}
3329 @opindex ftemplate-backtrace-limit
3330 Set the maximum number of template instantiation notes for a single
3331 warning or error to @var{n}. The default value is 10.
3332
3333 @item -ftemplate-depth=@var{n}
3334 @opindex ftemplate-depth
3335 Set the maximum instantiation depth for template classes to @var{n}.
3336 A limit on the template instantiation depth is needed to detect
3337 endless recursions during template class instantiation. ANSI/ISO C++
3338 conforming programs must not rely on a maximum depth greater than 17
3339 (changed to 1024 in C++11). The default value is 900, as the compiler
3340 can run out of stack space before hitting 1024 in some situations.
3341
3342 @item -fno-threadsafe-statics
3343 @opindex fno-threadsafe-statics
3344 @opindex fthreadsafe-statics
3345 Do not emit the extra code to use the routines specified in the C++
3346 ABI for thread-safe initialization of local statics. You can use this
3347 option to reduce code size slightly in code that doesn't need to be
3348 thread-safe.
3349
3350 @item -fuse-cxa-atexit
3351 @opindex fuse-cxa-atexit
3352 Register destructors for objects with static storage duration with the
3353 @code{__cxa_atexit} function rather than the @code{atexit} function.
3354 This option is required for fully standards-compliant handling of static
3355 destructors, but only works if your C library supports
3356 @code{__cxa_atexit}.
3357
3358 @item -fno-use-cxa-get-exception-ptr
3359 @opindex fno-use-cxa-get-exception-ptr
3360 @opindex fuse-cxa-get-exception-ptr
3361 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3362 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3363 if the runtime routine is not available.
3364
3365 @item -fvisibility-inlines-hidden
3366 @opindex fvisibility-inlines-hidden
3367 This switch declares that the user does not attempt to compare
3368 pointers to inline functions or methods where the addresses of the two functions
3369 are taken in different shared objects.
3370
3371 The effect of this is that GCC may, effectively, mark inline methods with
3372 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3373 appear in the export table of a DSO and do not require a PLT indirection
3374 when used within the DSO@. Enabling this option can have a dramatic effect
3375 on load and link times of a DSO as it massively reduces the size of the
3376 dynamic export table when the library makes heavy use of templates.
3377
3378 The behavior of this switch is not quite the same as marking the
3379 methods as hidden directly, because it does not affect static variables
3380 local to the function or cause the compiler to deduce that
3381 the function is defined in only one shared object.
3382
3383 You may mark a method as having a visibility explicitly to negate the
3384 effect of the switch for that method. For example, if you do want to
3385 compare pointers to a particular inline method, you might mark it as
3386 having default visibility. Marking the enclosing class with explicit
3387 visibility has no effect.
3388
3389 Explicitly instantiated inline methods are unaffected by this option
3390 as their linkage might otherwise cross a shared library boundary.
3391 @xref{Template Instantiation}.
3392
3393 @item -fvisibility-ms-compat
3394 @opindex fvisibility-ms-compat
3395 This flag attempts to use visibility settings to make GCC's C++
3396 linkage model compatible with that of Microsoft Visual Studio.
3397
3398 The flag makes these changes to GCC's linkage model:
3399
3400 @enumerate
3401 @item
3402 It sets the default visibility to @code{hidden}, like
3403 @option{-fvisibility=hidden}.
3404
3405 @item
3406 Types, but not their members, are not hidden by default.
3407
3408 @item
3409 The One Definition Rule is relaxed for types without explicit
3410 visibility specifications that are defined in more than one
3411 shared object: those declarations are permitted if they are
3412 permitted when this option is not used.
3413 @end enumerate
3414
3415 In new code it is better to use @option{-fvisibility=hidden} and
3416 export those classes that are intended to be externally visible.
3417 Unfortunately it is possible for code to rely, perhaps accidentally,
3418 on the Visual Studio behavior.
3419
3420 Among the consequences of these changes are that static data members
3421 of the same type with the same name but defined in different shared
3422 objects are different, so changing one does not change the other;
3423 and that pointers to function members defined in different shared
3424 objects may not compare equal. When this flag is given, it is a
3425 violation of the ODR to define types with the same name differently.
3426
3427 @item -fno-weak
3428 @opindex fno-weak
3429 @opindex fweak
3430 Do not use weak symbol support, even if it is provided by the linker.
3431 By default, G++ uses weak symbols if they are available. This
3432 option exists only for testing, and should not be used by end-users;
3433 it results in inferior code and has no benefits. This option may
3434 be removed in a future release of G++.
3435
3436 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3437 @opindex fext-numeric-literals
3438 @opindex fno-ext-numeric-literals
3439 Accept imaginary, fixed-point, or machine-defined
3440 literal number suffixes as GNU extensions.
3441 When this option is turned off these suffixes are treated
3442 as C++11 user-defined literal numeric suffixes.
3443 This is on by default for all pre-C++11 dialects and all GNU dialects:
3444 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3445 @option{-std=gnu++14}.
3446 This option is off by default
3447 for ISO C++11 onwards (@option{-std=c++11}, ...).
3448
3449 @item -nostdinc++
3450 @opindex nostdinc++
3451 Do not search for header files in the standard directories specific to
3452 C++, but do still search the other standard directories. (This option
3453 is used when building the C++ library.)
3454
3455 @item -flang-info-include-translate
3456 @itemx -flang-info-include-translate-not
3457 @itemx -flang-info-include-translate=@var{header}
3458 @opindex flang-info-include-translate
3459 @opindex flang-info-include-translate-not
3460 Inform of include translation events. The first will note accepted
3461 include translations, the second will note declined include
3462 translations. The @var{header} form will inform of include
3463 translations relating to that specific header. If @var{header} is of
3464 the form @code{"user"} or @code{<system>} it will be resolved to a
3465 specific user or system header using the include path.
3466
3467 @item -flang-info-module-cmi
3468 @itemx -flang-info-module-cmi=@var{module}
3469 @opindex flang-info-module-cmi
3470 Inform of Compiled Module Interface pathnames. The first will note
3471 all read CMI pathnames. The @var{module} form will not reading a
3472 specific module's CMI. @var{module} may be a named module or a
3473 header-unit (the latter indicated by either being a pathname containing
3474 directory separators or enclosed in @code{<>} or @code{""}).
3475
3476 @item -stdlib=@var{libstdc++,libc++}
3477 @opindex stdlib
3478 When G++ is configured to support this option, it allows specification of
3479 alternate C++ runtime libraries. Two options are available: @var{libstdc++}
3480 (the default, native C++ runtime for G++) and @var{libc++} which is the
3481 C++ runtime installed on some operating systems (e.g. Darwin versions from
3482 Darwin11 onwards). The option switches G++ to use the headers from the
3483 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3484 when a C++ runtime is required for linking.
3485 @end table
3486
3487 In addition, these warning options have meanings only for C++ programs:
3488
3489 @table @gcctabopt
3490 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3491 @opindex Wabi-tag
3492 Warn when a type with an ABI tag is used in a context that does not
3493 have that ABI tag. See @ref{C++ Attributes} for more information
3494 about ABI tags.
3495
3496 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3497 @opindex Wcomma-subscript
3498 @opindex Wno-comma-subscript
3499 Warn about uses of a comma expression within a subscripting expression.
3500 This usage was deprecated in C++20 and is going to be removed in C++23.
3501 However, a comma expression wrapped in @code{( )} is not deprecated. Example:
3502
3503 @smallexample
3504 @group
3505 void f(int *a, int b, int c) @{
3506 a[b,c]; // deprecated in C++20, invalid in C++23
3507 a[(b,c)]; // OK
3508 @}
3509 @end group
3510 @end smallexample
3511
3512 In C++23 it is valid to have comma separated expressions in a subscript
3513 when an overloaded subscript operator is found and supports the right
3514 number and types of arguments. G++ will accept the formerly valid syntax
3515 for code that is not valid in C++23 but used to be valid but deprecated
3516 in C++20 with a pedantic warning that can be disabled with
3517 @option{-Wno-comma-subscript}.
3518
3519 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3520 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3521
3522 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3523 @opindex Wctad-maybe-unsupported
3524 @opindex Wno-ctad-maybe-unsupported
3525 Warn when performing class template argument deduction (CTAD) on a type with
3526 no explicitly written deduction guides. This warning will point out cases
3527 where CTAD succeeded only because the compiler synthesized the implicit
3528 deduction guides, which might not be what the programmer intended. Certain
3529 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3530 types that are designed to support CTAD. This warning can be suppressed with
3531 the following pattern:
3532
3533 @smallexample
3534 struct allow_ctad_t; // any name works
3535 template <typename T> struct S @{
3536 S(T) @{ @}
3537 @};
3538 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3539 @end smallexample
3540
3541 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3542 @opindex Wctor-dtor-privacy
3543 @opindex Wno-ctor-dtor-privacy
3544 Warn when a class seems unusable because all the constructors or
3545 destructors in that class are private, and it has neither friends nor
3546 public static member functions. Also warn if there are no non-private
3547 methods, and there's at least one private member function that isn't
3548 a constructor or destructor.
3549
3550 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3551 @opindex Wdelete-non-virtual-dtor
3552 @opindex Wno-delete-non-virtual-dtor
3553 Warn when @code{delete} is used to destroy an instance of a class that
3554 has virtual functions and non-virtual destructor. It is unsafe to delete
3555 an instance of a derived class through a pointer to a base class if the
3556 base class does not have a virtual destructor. This warning is enabled
3557 by @option{-Wall}.
3558
3559 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3560 @opindex Wdeprecated-copy
3561 @opindex Wno-deprecated-copy
3562 Warn that the implicit declaration of a copy constructor or copy
3563 assignment operator is deprecated if the class has a user-provided
3564 copy constructor or copy assignment operator, in C++11 and up. This
3565 warning is enabled by @option{-Wextra}. With
3566 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3567 user-provided destructor.
3568
3569 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3570 @opindex Wdeprecated-enum-enum-conversion
3571 @opindex Wno-deprecated-enum-enum-conversion
3572 Disable the warning about the case when the usual arithmetic conversions
3573 are applied on operands where one is of enumeration type and the other is
3574 of a different enumeration type. This conversion was deprecated in C++20.
3575 For example:
3576
3577 @smallexample
3578 enum E1 @{ e @};
3579 enum E2 @{ f @};
3580 int k = f - e;
3581 @end smallexample
3582
3583 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3584 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3585 by @option{-Wenum-conversion}.
3586
3587 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3588 @opindex Wdeprecated-enum-float-conversion
3589 @opindex Wno-deprecated-enum-float-conversion
3590 Disable the warning about the case when the usual arithmetic conversions
3591 are applied on operands where one is of enumeration type and the other is
3592 of a floating-point type. This conversion was deprecated in C++20. For
3593 example:
3594
3595 @smallexample
3596 enum E1 @{ e @};
3597 enum E2 @{ f @};
3598 bool b = e <= 3.7;
3599 @end smallexample
3600
3601 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3602 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3603 by @option{-Wenum-conversion}.
3604
3605 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3606 @opindex Winit-list-lifetime
3607 @opindex Wno-init-list-lifetime
3608 Do not warn about uses of @code{std::initializer_list} that are likely
3609 to result in dangling pointers. Since the underlying array for an
3610 @code{initializer_list} is handled like a normal C++ temporary object,
3611 it is easy to inadvertently keep a pointer to the array past the end
3612 of the array's lifetime. For example:
3613
3614 @itemize @bullet
3615 @item
3616 If a function returns a temporary @code{initializer_list}, or a local
3617 @code{initializer_list} variable, the array's lifetime ends at the end
3618 of the return statement, so the value returned has a dangling pointer.
3619
3620 @item
3621 If a new-expression creates an @code{initializer_list}, the array only
3622 lives until the end of the enclosing full-expression, so the
3623 @code{initializer_list} in the heap has a dangling pointer.
3624
3625 @item
3626 When an @code{initializer_list} variable is assigned from a
3627 brace-enclosed initializer list, the temporary array created for the
3628 right side of the assignment only lives until the end of the
3629 full-expression, so at the next statement the @code{initializer_list}
3630 variable has a dangling pointer.
3631
3632 @smallexample
3633 // li's initial underlying array lives as long as li
3634 std::initializer_list<int> li = @{ 1,2,3 @};
3635 // assignment changes li to point to a temporary array
3636 li = @{ 4, 5 @};
3637 // now the temporary is gone and li has a dangling pointer
3638 int i = li.begin()[0] // undefined behavior
3639 @end smallexample
3640
3641 @item
3642 When a list constructor stores the @code{begin} pointer from the
3643 @code{initializer_list} argument, this doesn't extend the lifetime of
3644 the array, so if a class variable is constructed from a temporary
3645 @code{initializer_list}, the pointer is left dangling by the end of
3646 the variable declaration statement.
3647
3648 @end itemize
3649
3650 @item -Winvalid-imported-macros
3651 @opindex Winvalid-imported-macros
3652 @opindex Wno-invalid-imported-macros
3653 Verify all imported macro definitions are valid at the end of
3654 compilation. This is not enabled by default, as it requires
3655 additional processing to determine. It may be useful when preparing
3656 sets of header-units to ensure consistent macros.
3657
3658 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3659 @opindex Wliteral-suffix
3660 @opindex Wno-literal-suffix
3661 Do not warn when a string or character literal is followed by a
3662 ud-suffix which does not begin with an underscore. As a conforming
3663 extension, GCC treats such suffixes as separate preprocessing tokens
3664 in order to maintain backwards compatibility with code that uses
3665 formatting macros from @code{<inttypes.h>}. For example:
3666
3667 @smallexample
3668 #define __STDC_FORMAT_MACROS
3669 #include <inttypes.h>
3670 #include <stdio.h>
3671
3672 int main() @{
3673 int64_t i64 = 123;
3674 printf("My int64: %" PRId64"\n", i64);
3675 @}
3676 @end smallexample
3677
3678 In this case, @code{PRId64} is treated as a separate preprocessing token.
3679
3680 This option also controls warnings when a user-defined literal
3681 operator is declared with a literal suffix identifier that doesn't
3682 begin with an underscore. Literal suffix identifiers that don't begin
3683 with an underscore are reserved for future standardization.
3684
3685 These warnings are enabled by default.
3686
3687 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3688 @opindex Wnarrowing
3689 @opindex Wno-narrowing
3690 For C++11 and later standards, narrowing conversions are diagnosed by default,
3691 as required by the standard. A narrowing conversion from a constant produces
3692 an error, and a narrowing conversion from a non-constant produces a warning,
3693 but @option{-Wno-narrowing} suppresses the diagnostic.
3694 Note that this does not affect the meaning of well-formed code;
3695 narrowing conversions are still considered ill-formed in SFINAE contexts.
3696
3697 With @option{-Wnarrowing} in C++98, warn when a narrowing
3698 conversion prohibited by C++11 occurs within
3699 @samp{@{ @}}, e.g.
3700
3701 @smallexample
3702 int i = @{ 2.2 @}; // error: narrowing from double to int
3703 @end smallexample
3704
3705 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3706
3707 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3708 @opindex Wnoexcept
3709 @opindex Wno-noexcept
3710 Warn when a noexcept-expression evaluates to false because of a call
3711 to a function that does not have a non-throwing exception
3712 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3713 the compiler to never throw an exception.
3714
3715 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3716 @opindex Wnoexcept-type
3717 @opindex Wno-noexcept-type
3718 Warn if the C++17 feature making @code{noexcept} part of a function
3719 type changes the mangled name of a symbol relative to C++14. Enabled
3720 by @option{-Wabi} and @option{-Wc++17-compat}.
3721
3722 As an example:
3723
3724 @smallexample
3725 template <class T> void f(T t) @{ t(); @};
3726 void g() noexcept;
3727 void h() @{ f(g); @}
3728 @end smallexample
3729
3730 @noindent
3731 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3732 C++17 it calls @code{f<void(*)()noexcept>}.
3733
3734 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3735 @opindex Wclass-memaccess
3736 @opindex Wno-class-memaccess
3737 Warn when the destination of a call to a raw memory function such as
3738 @code{memset} or @code{memcpy} is an object of class type, and when writing
3739 into such an object might bypass the class non-trivial or deleted constructor
3740 or copy assignment, violate const-correctness or encapsulation, or corrupt
3741 virtual table pointers. Modifying the representation of such objects may
3742 violate invariants maintained by member functions of the class. For example,
3743 the call to @code{memset} below is undefined because it modifies a non-trivial
3744 class object and is, therefore, diagnosed. The safe way to either initialize
3745 or clear the storage of objects of such types is by using the appropriate
3746 constructor or assignment operator, if one is available.
3747 @smallexample
3748 std::string str = "abc";
3749 memset (&str, 0, sizeof str);
3750 @end smallexample
3751 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3752 Explicitly casting the pointer to the class object to @code{void *} or
3753 to a type that can be safely accessed by the raw memory function suppresses
3754 the warning.
3755
3756 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3757 @opindex Wnon-virtual-dtor
3758 @opindex Wno-non-virtual-dtor
3759 Warn when a class has virtual functions and an accessible non-virtual
3760 destructor itself or in an accessible polymorphic base class, in which
3761 case it is possible but unsafe to delete an instance of a derived
3762 class through a pointer to the class itself or base class. This
3763 warning is automatically enabled if @option{-Weffc++} is specified.
3764
3765 @item -Wregister @r{(C++ and Objective-C++ only)}
3766 @opindex Wregister
3767 @opindex Wno-register
3768 Warn on uses of the @code{register} storage class specifier, except
3769 when it is part of the GNU @ref{Explicit Register Variables} extension.
3770 The use of the @code{register} keyword as storage class specifier has
3771 been deprecated in C++11 and removed in C++17.
3772 Enabled by default with @option{-std=c++17}.
3773
3774 @item -Wreorder @r{(C++ and Objective-C++ only)}
3775 @opindex Wreorder
3776 @opindex Wno-reorder
3777 @cindex reordering, warning
3778 @cindex warning for reordering of member initializers
3779 Warn when the order of member initializers given in the code does not
3780 match the order in which they must be executed. For instance:
3781
3782 @smallexample
3783 struct A @{
3784 int i;
3785 int j;
3786 A(): j (0), i (1) @{ @}
3787 @};
3788 @end smallexample
3789
3790 @noindent
3791 The compiler rearranges the member initializers for @code{i}
3792 and @code{j} to match the declaration order of the members, emitting
3793 a warning to that effect. This warning is enabled by @option{-Wall}.
3794
3795 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3796 @opindex Wpessimizing-move
3797 @opindex Wno-pessimizing-move
3798 This warning warns when a call to @code{std::move} prevents copy
3799 elision. A typical scenario when copy elision can occur is when returning in
3800 a function with a class return type, when the expression being returned is the
3801 name of a non-volatile automatic object, and is not a function parameter, and
3802 has the same type as the function return type.
3803
3804 @smallexample
3805 struct T @{
3806 @dots{}
3807 @};
3808 T fn()
3809 @{
3810 T t;
3811 @dots{}
3812 return std::move (t);
3813 @}
3814 @end smallexample
3815
3816 But in this example, the @code{std::move} call prevents copy elision.
3817
3818 This warning is enabled by @option{-Wall}.
3819
3820 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3821 @opindex Wredundant-move
3822 @opindex Wno-redundant-move
3823 This warning warns about redundant calls to @code{std::move}; that is, when
3824 a move operation would have been performed even without the @code{std::move}
3825 call. This happens because the compiler is forced to treat the object as if
3826 it were an rvalue in certain situations such as returning a local variable,
3827 where copy elision isn't applicable. Consider:
3828
3829 @smallexample
3830 struct T @{
3831 @dots{}
3832 @};
3833 T fn(T t)
3834 @{
3835 @dots{}
3836 return std::move (t);
3837 @}
3838 @end smallexample
3839
3840 Here, the @code{std::move} call is redundant. Because G++ implements Core
3841 Issue 1579, another example is:
3842
3843 @smallexample
3844 struct T @{ // convertible to U
3845 @dots{}
3846 @};
3847 struct U @{
3848 @dots{}
3849 @};
3850 U fn()
3851 @{
3852 T t;
3853 @dots{}
3854 return std::move (t);
3855 @}
3856 @end smallexample
3857 In this example, copy elision isn't applicable because the type of the
3858 expression being returned and the function return type differ, yet G++
3859 treats the return value as if it were designated by an rvalue.
3860
3861 This warning is enabled by @option{-Wextra}.
3862
3863 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
3864 @opindex Wrange-loop-construct
3865 @opindex Wno-range-loop-construct
3866 This warning warns when a C++ range-based for-loop is creating an unnecessary
3867 copy. This can happen when the range declaration is not a reference, but
3868 probably should be. For example:
3869
3870 @smallexample
3871 struct S @{ char arr[128]; @};
3872 void fn () @{
3873 S arr[5];
3874 for (const auto x : arr) @{ @dots{} @}
3875 @}
3876 @end smallexample
3877
3878 It does not warn when the type being copied is a trivially-copyable type whose
3879 size is less than 64 bytes.
3880
3881 This warning also warns when a loop variable in a range-based for-loop is
3882 initialized with a value of a different type resulting in a copy. For example:
3883
3884 @smallexample
3885 void fn() @{
3886 int arr[10];
3887 for (const double &x : arr) @{ @dots{} @}
3888 @}
3889 @end smallexample
3890
3891 In the example above, in every iteration of the loop a temporary value of
3892 type @code{double} is created and destroyed, to which the reference
3893 @code{const double &} is bound.
3894
3895 This warning is enabled by @option{-Wall}.
3896
3897 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3898 @opindex Wredundant-tags
3899 @opindex Wno-redundant-tags
3900 Warn about redundant class-key and enum-key in references to class types
3901 and enumerated types in contexts where the key can be eliminated without
3902 causing an ambiguity. For example:
3903
3904 @smallexample
3905 struct foo;
3906 struct foo *p; // warn that keyword struct can be eliminated
3907 @end smallexample
3908
3909 @noindent
3910 On the other hand, in this example there is no warning:
3911
3912 @smallexample
3913 struct foo;
3914 void foo (); // "hides" struct foo
3915 void bar (struct foo&); // no warning, keyword struct is necessary
3916 @end smallexample
3917
3918 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3919 @opindex Wsubobject-linkage
3920 @opindex Wno-subobject-linkage
3921 Do not warn
3922 if a class type has a base or a field whose type uses the anonymous
3923 namespace or depends on a type with no linkage. If a type A depends on
3924 a type B with no or internal linkage, defining it in multiple
3925 translation units would be an ODR violation because the meaning of B
3926 is different in each translation unit. If A only appears in a single
3927 translation unit, the best way to silence the warning is to give it
3928 internal linkage by putting it in an anonymous namespace as well. The
3929 compiler doesn't give this warning for types defined in the main .C
3930 file, as those are unlikely to have multiple definitions.
3931 @option{-Wsubobject-linkage} is enabled by default.
3932
3933 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3934 @opindex Weffc++
3935 @opindex Wno-effc++
3936 Warn about violations of the following style guidelines from Scott Meyers'
3937 @cite{Effective C++} series of books:
3938
3939 @itemize @bullet
3940 @item
3941 Define a copy constructor and an assignment operator for classes
3942 with dynamically-allocated memory.
3943
3944 @item
3945 Prefer initialization to assignment in constructors.
3946
3947 @item
3948 Have @code{operator=} return a reference to @code{*this}.
3949
3950 @item
3951 Don't try to return a reference when you must return an object.
3952
3953 @item
3954 Distinguish between prefix and postfix forms of increment and
3955 decrement operators.
3956
3957 @item
3958 Never overload @code{&&}, @code{||}, or @code{,}.
3959
3960 @end itemize
3961
3962 This option also enables @option{-Wnon-virtual-dtor}, which is also
3963 one of the effective C++ recommendations. However, the check is
3964 extended to warn about the lack of virtual destructor in accessible
3965 non-polymorphic bases classes too.
3966
3967 When selecting this option, be aware that the standard library
3968 headers do not obey all of these guidelines; use @samp{grep -v}
3969 to filter out those warnings.
3970
3971 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
3972 @opindex Wexceptions
3973 @opindex Wno-exceptions
3974 Disable the warning about the case when an exception handler is shadowed by
3975 another handler, which can point out a wrong ordering of exception handlers.
3976
3977 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3978 @opindex Wstrict-null-sentinel
3979 @opindex Wno-strict-null-sentinel
3980 Warn about the use of an uncasted @code{NULL} as sentinel. When
3981 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3982 to @code{__null}. Although it is a null pointer constant rather than a
3983 null pointer, it is guaranteed to be of the same size as a pointer.
3984 But this use is not portable across different compilers.
3985
3986 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3987 @opindex Wno-non-template-friend
3988 @opindex Wnon-template-friend
3989 Disable warnings when non-template friend functions are declared
3990 within a template. In very old versions of GCC that predate implementation
3991 of the ISO standard, declarations such as
3992 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3993 could be interpreted as a particular specialization of a template
3994 function; the warning exists to diagnose compatibility problems,
3995 and is enabled by default.
3996
3997 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3998 @opindex Wold-style-cast
3999 @opindex Wno-old-style-cast
4000 Warn if an old-style (C-style) cast to a non-void type is used within
4001 a C++ program. The new-style casts (@code{dynamic_cast},
4002 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4003 less vulnerable to unintended effects and much easier to search for.
4004
4005 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4006 @opindex Woverloaded-virtual
4007 @opindex Wno-overloaded-virtual
4008 @cindex overloaded virtual function, warning
4009 @cindex warning for overloaded virtual function
4010 Warn when a function declaration hides virtual functions from a
4011 base class. For example, in:
4012
4013 @smallexample
4014 struct A @{
4015 virtual void f();
4016 @};
4017
4018 struct B: public A @{
4019 void f(int);
4020 @};
4021 @end smallexample
4022
4023 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4024 like:
4025
4026 @smallexample
4027 B* b;
4028 b->f();
4029 @end smallexample
4030
4031 @noindent
4032 fails to compile.
4033
4034 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4035 @opindex Wno-pmf-conversions
4036 @opindex Wpmf-conversions
4037 Disable the diagnostic for converting a bound pointer to member function
4038 to a plain pointer.
4039
4040 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4041 @opindex Wsign-promo
4042 @opindex Wno-sign-promo
4043 Warn when overload resolution chooses a promotion from unsigned or
4044 enumerated type to a signed type, over a conversion to an unsigned type of
4045 the same size. Previous versions of G++ tried to preserve
4046 unsignedness, but the standard mandates the current behavior.
4047
4048 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4049 @opindex Wtemplates
4050 @opindex Wno-templates
4051 Warn when a primary template declaration is encountered. Some coding
4052 rules disallow templates, and this may be used to enforce that rule.
4053 The warning is inactive inside a system header file, such as the STL, so
4054 one can still use the STL. One may also instantiate or specialize
4055 templates.
4056
4057 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4058 @opindex Wmismatched-new-delete
4059 @opindex Wno-mismatched-new-delete
4060 Warn for mismatches between calls to @code{operator new} or @code{operator
4061 delete} and the corresponding call to the allocation or deallocation function.
4062 This includes invocations of C++ @code{operator delete} with pointers
4063 returned from either mismatched forms of @code{operator new}, or from other
4064 functions that allocate objects for which the @code{operator delete} isn't
4065 a suitable deallocator, as well as calls to other deallocation functions
4066 with pointers returned from @code{operator new} for which the deallocation
4067 function isn't suitable.
4068
4069 For example, the @code{delete} expression in the function below is diagnosed
4070 because it doesn't match the array form of the @code{new} expression
4071 the pointer argument was returned from. Similarly, the call to @code{free}
4072 is also diagnosed.
4073
4074 @smallexample
4075 void f ()
4076 @{
4077 int *a = new int[n];
4078 delete a; // warning: mismatch in array forms of expressions
4079
4080 char *p = new char[n];
4081 free (p); // warning: mismatch between new and free
4082 @}
4083 @end smallexample
4084
4085 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4086 involving allocation and deallocation functions other than @code{operator
4087 new} and @code{operator delete}.
4088
4089 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4090
4091 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4092 @opindex Wmismatched-tags
4093 @opindex Wno-mismatched-tags
4094 Warn for declarations of structs, classes, and class templates and their
4095 specializations with a class-key that does not match either the definition
4096 or the first declaration if no definition is provided.
4097
4098 For example, the declaration of @code{struct Object} in the argument list
4099 of @code{draw} triggers the warning. To avoid it, either remove the redundant
4100 class-key @code{struct} or replace it with @code{class} to match its definition.
4101 @smallexample
4102 class Object @{
4103 public:
4104 virtual ~Object () = 0;
4105 @};
4106 void draw (struct Object*);
4107 @end smallexample
4108
4109 It is not wrong to declare a class with the class-key @code{struct} as
4110 the example above shows. The @option{-Wmismatched-tags} option is intended
4111 to help achieve a consistent style of class declarations. In code that is
4112 intended to be portable to Windows-based compilers the warning helps prevent
4113 unresolved references due to the difference in the mangling of symbols
4114 declared with different class-keys. The option can be used either on its
4115 own or in conjunction with @option{-Wredundant-tags}.
4116
4117 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4118 @opindex Wmultiple-inheritance
4119 @opindex Wno-multiple-inheritance
4120 Warn when a class is defined with multiple direct base classes. Some
4121 coding rules disallow multiple inheritance, and this may be used to
4122 enforce that rule. The warning is inactive inside a system header file,
4123 such as the STL, so one can still use the STL. One may also define
4124 classes that indirectly use multiple inheritance.
4125
4126 @item -Wvirtual-inheritance
4127 @opindex Wvirtual-inheritance
4128 @opindex Wno-virtual-inheritance
4129 Warn when a class is defined with a virtual direct base class. Some
4130 coding rules disallow multiple inheritance, and this may be used to
4131 enforce that rule. The warning is inactive inside a system header file,
4132 such as the STL, so one can still use the STL. One may also define
4133 classes that indirectly use virtual inheritance.
4134
4135 @item -Wno-virtual-move-assign
4136 @opindex Wvirtual-move-assign
4137 @opindex Wno-virtual-move-assign
4138 Suppress warnings about inheriting from a virtual base with a
4139 non-trivial C++11 move assignment operator. This is dangerous because
4140 if the virtual base is reachable along more than one path, it is
4141 moved multiple times, which can mean both objects end up in the
4142 moved-from state. If the move assignment operator is written to avoid
4143 moving from a moved-from object, this warning can be disabled.
4144
4145 @item -Wnamespaces
4146 @opindex Wnamespaces
4147 @opindex Wno-namespaces
4148 Warn when a namespace definition is opened. Some coding rules disallow
4149 namespaces, and this may be used to enforce that rule. The warning is
4150 inactive inside a system header file, such as the STL, so one can still
4151 use the STL. One may also use using directives and qualified names.
4152
4153 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4154 @opindex Wterminate
4155 @opindex Wno-terminate
4156 Disable the warning about a throw-expression that will immediately
4157 result in a call to @code{terminate}.
4158
4159 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4160 @opindex Wvexing-parse
4161 @opindex Wno-vexing-parse
4162 Warn about the most vexing parse syntactic ambiguity. This warns about
4163 the cases when a declaration looks like a variable definition, but the
4164 C++ language requires it to be interpreted as a function declaration.
4165 For instance:
4166
4167 @smallexample
4168 void f(double a) @{
4169 int i(); // extern int i (void);
4170 int n(int(a)); // extern int n (int);
4171 @}
4172 @end smallexample
4173
4174 Another example:
4175
4176 @smallexample
4177 struct S @{ S(int); @};
4178 void f(double a) @{
4179 S x(int(a)); // extern struct S x (int);
4180 S y(int()); // extern struct S y (int (*) (void));
4181 S z(); // extern struct S z (void);
4182 @}
4183 @end smallexample
4184
4185 The warning will suggest options how to deal with such an ambiguity; e.g.,
4186 it can suggest removing the parentheses or using braces instead.
4187
4188 This warning is enabled by default.
4189
4190 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4191 @opindex Wno-class-conversion
4192 @opindex Wclass-conversion
4193 Do not warn when a conversion function converts an
4194 object to the same type, to a base class of that type, or to void; such
4195 a conversion function will never be called.
4196
4197 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4198 @opindex Wvolatile
4199 @opindex Wno-volatile
4200 Warn about deprecated uses of the @code{volatile} qualifier. This includes
4201 postfix and prefix @code{++} and @code{--} expressions of
4202 @code{volatile}-qualified types, using simple assignments where the left
4203 operand is a @code{volatile}-qualified non-class type for their value,
4204 compound assignments where the left operand is a @code{volatile}-qualified
4205 non-class type, @code{volatile}-qualified function return type,
4206 @code{volatile}-qualified parameter type, and structured bindings of a
4207 @code{volatile}-qualified type. This usage was deprecated in C++20.
4208
4209 Enabled by default with @option{-std=c++20}.
4210
4211 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4212 @opindex Wzero-as-null-pointer-constant
4213 @opindex Wno-zero-as-null-pointer-constant
4214 Warn when a literal @samp{0} is used as null pointer constant. This can
4215 be useful to facilitate the conversion to @code{nullptr} in C++11.
4216
4217 @item -Waligned-new
4218 @opindex Waligned-new
4219 @opindex Wno-aligned-new
4220 Warn about a new-expression of a type that requires greater alignment
4221 than the @code{alignof(std::max_align_t)} but uses an allocation
4222 function without an explicit alignment parameter. This option is
4223 enabled by @option{-Wall}.
4224
4225 Normally this only warns about global allocation functions, but
4226 @option{-Waligned-new=all} also warns about class member allocation
4227 functions.
4228
4229 @item -Wno-placement-new
4230 @itemx -Wplacement-new=@var{n}
4231 @opindex Wplacement-new
4232 @opindex Wno-placement-new
4233 Warn about placement new expressions with undefined behavior, such as
4234 constructing an object in a buffer that is smaller than the type of
4235 the object. For example, the placement new expression below is diagnosed
4236 because it attempts to construct an array of 64 integers in a buffer only
4237 64 bytes large.
4238 @smallexample
4239 char buf [64];
4240 new (buf) int[64];
4241 @end smallexample
4242 This warning is enabled by default.
4243
4244 @table @gcctabopt
4245 @item -Wplacement-new=1
4246 This is the default warning level of @option{-Wplacement-new}. At this
4247 level the warning is not issued for some strictly undefined constructs that
4248 GCC allows as extensions for compatibility with legacy code. For example,
4249 the following @code{new} expression is not diagnosed at this level even
4250 though it has undefined behavior according to the C++ standard because
4251 it writes past the end of the one-element array.
4252 @smallexample
4253 struct S @{ int n, a[1]; @};
4254 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4255 new (s->a)int [32]();
4256 @end smallexample
4257
4258 @item -Wplacement-new=2
4259 At this level, in addition to diagnosing all the same constructs as at level
4260 1, a diagnostic is also issued for placement new expressions that construct
4261 an object in the last member of structure whose type is an array of a single
4262 element and whose size is less than the size of the object being constructed.
4263 While the previous example would be diagnosed, the following construct makes
4264 use of the flexible member array extension to avoid the warning at level 2.
4265 @smallexample
4266 struct S @{ int n, a[]; @};
4267 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4268 new (s->a)int [32]();
4269 @end smallexample
4270
4271 @end table
4272
4273 @item -Wcatch-value
4274 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4275 @opindex Wcatch-value
4276 @opindex Wno-catch-value
4277 Warn about catch handlers that do not catch via reference.
4278 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4279 warn about polymorphic class types that are caught by value.
4280 With @option{-Wcatch-value=2} warn about all class types that are caught
4281 by value. With @option{-Wcatch-value=3} warn about all types that are
4282 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4283
4284 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4285 @opindex Wconditionally-supported
4286 @opindex Wno-conditionally-supported
4287 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4288
4289 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4290 @opindex Wdelete-incomplete
4291 @opindex Wno-delete-incomplete
4292 Do not warn when deleting a pointer to incomplete type, which may cause
4293 undefined behavior at runtime. This warning is enabled by default.
4294
4295 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4296 @opindex Wextra-semi
4297 @opindex Wno-extra-semi
4298 Warn about redundant semicolons after in-class function definitions.
4299
4300 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4301 @opindex Winaccessible-base
4302 @opindex Wno-inaccessible-base
4303 This option controls warnings
4304 when a base class is inaccessible in a class derived from it due to
4305 ambiguity. The warning is enabled by default.
4306 Note that the warning for ambiguous virtual
4307 bases is enabled by the @option{-Wextra} option.
4308 @smallexample
4309 @group
4310 struct A @{ int a; @};
4311
4312 struct B : A @{ @};
4313
4314 struct C : B, A @{ @};
4315 @end group
4316 @end smallexample
4317
4318 @item -Wno-inherited-variadic-ctor
4319 @opindex Winherited-variadic-ctor
4320 @opindex Wno-inherited-variadic-ctor
4321 Suppress warnings about use of C++11 inheriting constructors when the
4322 base class inherited from has a C variadic constructor; the warning is
4323 on by default because the ellipsis is not inherited.
4324
4325 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4326 @opindex Wno-invalid-offsetof
4327 @opindex Winvalid-offsetof
4328 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4329 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
4330 to a non-standard-layout type is undefined. In existing C++ implementations,
4331 however, @code{offsetof} typically gives meaningful results.
4332 This flag is for users who are aware that they are
4333 writing nonportable code and who have deliberately chosen to ignore the
4334 warning about it.
4335
4336 The restrictions on @code{offsetof} may be relaxed in a future version
4337 of the C++ standard.
4338
4339 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4340 @opindex Wsized-deallocation
4341 @opindex Wno-sized-deallocation
4342 Warn about a definition of an unsized deallocation function
4343 @smallexample
4344 void operator delete (void *) noexcept;
4345 void operator delete[] (void *) noexcept;
4346 @end smallexample
4347 without a definition of the corresponding sized deallocation function
4348 @smallexample
4349 void operator delete (void *, std::size_t) noexcept;
4350 void operator delete[] (void *, std::size_t) noexcept;
4351 @end smallexample
4352 or vice versa. Enabled by @option{-Wextra} along with
4353 @option{-fsized-deallocation}.
4354
4355 @item -Wsuggest-final-types
4356 @opindex Wno-suggest-final-types
4357 @opindex Wsuggest-final-types
4358 Warn about types with virtual methods where code quality would be improved
4359 if the type were declared with the C++11 @code{final} specifier,
4360 or, if possible,
4361 declared in an anonymous namespace. This allows GCC to more aggressively
4362 devirtualize the polymorphic calls. This warning is more effective with
4363 link-time optimization,
4364 where the information about the class hierarchy graph is
4365 more complete.
4366
4367 @item -Wsuggest-final-methods
4368 @opindex Wno-suggest-final-methods
4369 @opindex Wsuggest-final-methods
4370 Warn about virtual methods where code quality would be improved if the method
4371 were declared with the C++11 @code{final} specifier,
4372 or, if possible, its type were
4373 declared in an anonymous namespace or with the @code{final} specifier.
4374 This warning is
4375 more effective with link-time optimization, where the information about the
4376 class hierarchy graph is more complete. It is recommended to first consider
4377 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4378 annotations.
4379
4380 @item -Wsuggest-override
4381 @opindex Wsuggest-override
4382 @opindex Wno-suggest-override
4383 Warn about overriding virtual functions that are not marked with the
4384 @code{override} keyword.
4385
4386 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4387 @opindex Wuseless-cast
4388 @opindex Wno-useless-cast
4389 Warn when an expression is casted to its own type.
4390
4391 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4392 @opindex Wconversion-null
4393 @opindex Wno-conversion-null
4394 Do not warn for conversions between @code{NULL} and non-pointer
4395 types. @option{-Wconversion-null} is enabled by default.
4396
4397 @end table
4398
4399 @node Objective-C and Objective-C++ Dialect Options
4400 @section Options Controlling Objective-C and Objective-C++ Dialects
4401
4402 @cindex compiler options, Objective-C and Objective-C++
4403 @cindex Objective-C and Objective-C++ options, command-line
4404 @cindex options, Objective-C and Objective-C++
4405 (NOTE: This manual does not describe the Objective-C and Objective-C++
4406 languages themselves. @xref{Standards,,Language Standards
4407 Supported by GCC}, for references.)
4408
4409 This section describes the command-line options that are only meaningful
4410 for Objective-C and Objective-C++ programs. You can also use most of
4411 the language-independent GNU compiler options.
4412 For example, you might compile a file @file{some_class.m} like this:
4413
4414 @smallexample
4415 gcc -g -fgnu-runtime -O -c some_class.m
4416 @end smallexample
4417
4418 @noindent
4419 In this example, @option{-fgnu-runtime} is an option meant only for
4420 Objective-C and Objective-C++ programs; you can use the other options with
4421 any language supported by GCC@.
4422
4423 Note that since Objective-C is an extension of the C language, Objective-C
4424 compilations may also use options specific to the C front-end (e.g.,
4425 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4426 C++-specific options (e.g., @option{-Wabi}).
4427
4428 Here is a list of options that are @emph{only} for compiling Objective-C
4429 and Objective-C++ programs:
4430
4431 @table @gcctabopt
4432 @item -fconstant-string-class=@var{class-name}
4433 @opindex fconstant-string-class
4434 Use @var{class-name} as the name of the class to instantiate for each
4435 literal string specified with the syntax @code{@@"@dots{}"}. The default
4436 class name is @code{NXConstantString} if the GNU runtime is being used, and
4437 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4438 @option{-fconstant-cfstrings} option, if also present, overrides the
4439 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4440 to be laid out as constant CoreFoundation strings.
4441
4442 @item -fgnu-runtime
4443 @opindex fgnu-runtime
4444 Generate object code compatible with the standard GNU Objective-C
4445 runtime. This is the default for most types of systems.
4446
4447 @item -fnext-runtime
4448 @opindex fnext-runtime
4449 Generate output compatible with the NeXT runtime. This is the default
4450 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4451 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4452 used.
4453
4454 @item -fno-nil-receivers
4455 @opindex fno-nil-receivers
4456 @opindex fnil-receivers
4457 Assume that all Objective-C message dispatches (@code{[receiver
4458 message:arg]}) in this translation unit ensure that the receiver is
4459 not @code{nil}. This allows for more efficient entry points in the
4460 runtime to be used. This option is only available in conjunction with
4461 the NeXT runtime and ABI version 0 or 1.
4462
4463 @item -fobjc-abi-version=@var{n}
4464 @opindex fobjc-abi-version
4465 Use version @var{n} of the Objective-C ABI for the selected runtime.
4466 This option is currently supported only for the NeXT runtime. In that
4467 case, Version 0 is the traditional (32-bit) ABI without support for
4468 properties and other Objective-C 2.0 additions. Version 1 is the
4469 traditional (32-bit) ABI with support for properties and other
4470 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4471 nothing is specified, the default is Version 0 on 32-bit target
4472 machines, and Version 2 on 64-bit target machines.
4473
4474 @item -fobjc-call-cxx-cdtors
4475 @opindex fobjc-call-cxx-cdtors
4476 For each Objective-C class, check if any of its instance variables is a
4477 C++ object with a non-trivial default constructor. If so, synthesize a
4478 special @code{- (id) .cxx_construct} instance method which runs
4479 non-trivial default constructors on any such instance variables, in order,
4480 and then return @code{self}. Similarly, check if any instance variable
4481 is a C++ object with a non-trivial destructor, and if so, synthesize a
4482 special @code{- (void) .cxx_destruct} method which runs
4483 all such default destructors, in reverse order.
4484
4485 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4486 methods thusly generated only operate on instance variables
4487 declared in the current Objective-C class, and not those inherited
4488 from superclasses. It is the responsibility of the Objective-C
4489 runtime to invoke all such methods in an object's inheritance
4490 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4491 by the runtime immediately after a new object instance is allocated;
4492 the @code{- (void) .cxx_destruct} methods are invoked immediately
4493 before the runtime deallocates an object instance.
4494
4495 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4496 support for invoking the @code{- (id) .cxx_construct} and
4497 @code{- (void) .cxx_destruct} methods.
4498
4499 @item -fobjc-direct-dispatch
4500 @opindex fobjc-direct-dispatch
4501 Allow fast jumps to the message dispatcher. On Darwin this is
4502 accomplished via the comm page.
4503
4504 @item -fobjc-exceptions
4505 @opindex fobjc-exceptions
4506 Enable syntactic support for structured exception handling in
4507 Objective-C, similar to what is offered by C++. This option
4508 is required to use the Objective-C keywords @code{@@try},
4509 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4510 @code{@@synchronized}. This option is available with both the GNU
4511 runtime and the NeXT runtime (but not available in conjunction with
4512 the NeXT runtime on Mac OS X 10.2 and earlier).
4513
4514 @item -fobjc-gc
4515 @opindex fobjc-gc
4516 Enable garbage collection (GC) in Objective-C and Objective-C++
4517 programs. This option is only available with the NeXT runtime; the
4518 GNU runtime has a different garbage collection implementation that
4519 does not require special compiler flags.
4520
4521 @item -fobjc-nilcheck
4522 @opindex fobjc-nilcheck
4523 For the NeXT runtime with version 2 of the ABI, check for a nil
4524 receiver in method invocations before doing the actual method call.
4525 This is the default and can be disabled using
4526 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4527 checked for nil in this way no matter what this flag is set to.
4528 Currently this flag does nothing when the GNU runtime, or an older
4529 version of the NeXT runtime ABI, is used.
4530
4531 @item -fobjc-std=objc1
4532 @opindex fobjc-std
4533 Conform to the language syntax of Objective-C 1.0, the language
4534 recognized by GCC 4.0. This only affects the Objective-C additions to
4535 the C/C++ language; it does not affect conformance to C/C++ standards,
4536 which is controlled by the separate C/C++ dialect option flags. When
4537 this option is used with the Objective-C or Objective-C++ compiler,
4538 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4539 This is useful if you need to make sure that your Objective-C code can
4540 be compiled with older versions of GCC@.
4541
4542 @item -freplace-objc-classes
4543 @opindex freplace-objc-classes
4544 Emit a special marker instructing @command{ld(1)} not to statically link in
4545 the resulting object file, and allow @command{dyld(1)} to load it in at
4546 run time instead. This is used in conjunction with the Fix-and-Continue
4547 debugging mode, where the object file in question may be recompiled and
4548 dynamically reloaded in the course of program execution, without the need
4549 to restart the program itself. Currently, Fix-and-Continue functionality
4550 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4551 and later.
4552
4553 @item -fzero-link
4554 @opindex fzero-link
4555 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4556 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4557 compile time) with static class references that get initialized at load time,
4558 which improves run-time performance. Specifying the @option{-fzero-link} flag
4559 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4560 to be retained. This is useful in Zero-Link debugging mode, since it allows
4561 for individual class implementations to be modified during program execution.
4562 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4563 regardless of command-line options.
4564
4565 @item -fno-local-ivars
4566 @opindex fno-local-ivars
4567 @opindex flocal-ivars
4568 By default instance variables in Objective-C can be accessed as if
4569 they were local variables from within the methods of the class they're
4570 declared in. This can lead to shadowing between instance variables
4571 and other variables declared either locally inside a class method or
4572 globally with the same name. Specifying the @option{-fno-local-ivars}
4573 flag disables this behavior thus avoiding variable shadowing issues.
4574
4575 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4576 @opindex fivar-visibility
4577 Set the default instance variable visibility to the specified option
4578 so that instance variables declared outside the scope of any access
4579 modifier directives default to the specified visibility.
4580
4581 @item -gen-decls
4582 @opindex gen-decls
4583 Dump interface declarations for all classes seen in the source file to a
4584 file named @file{@var{sourcename}.decl}.
4585
4586 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4587 @opindex Wassign-intercept
4588 @opindex Wno-assign-intercept
4589 Warn whenever an Objective-C assignment is being intercepted by the
4590 garbage collector.
4591
4592 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4593 @opindex Wproperty-assign-default
4594 @opindex Wno-property-assign-default
4595 Do not warn if a property for an Objective-C object has no assign
4596 semantics specified.
4597
4598 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4599 @opindex Wno-protocol
4600 @opindex Wprotocol
4601 If a class is declared to implement a protocol, a warning is issued for
4602 every method in the protocol that is not implemented by the class. The
4603 default behavior is to issue a warning for every method not explicitly
4604 implemented in the class, even if a method implementation is inherited
4605 from the superclass. If you use the @option{-Wno-protocol} option, then
4606 methods inherited from the superclass are considered to be implemented,
4607 and no warning is issued for them.
4608
4609 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4610 @opindex Wobjc-root-class
4611 Warn if a class interface lacks a superclass. Most classes will inherit
4612 from @code{NSObject} (or @code{Object}) for example. When declaring
4613 classes intended to be root classes, the warning can be suppressed by
4614 marking their interfaces with @code{__attribute__((objc_root_class))}.
4615
4616 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4617 @opindex Wselector
4618 @opindex Wno-selector
4619 Warn if multiple methods of different types for the same selector are
4620 found during compilation. The check is performed on the list of methods
4621 in the final stage of compilation. Additionally, a check is performed
4622 for each selector appearing in a @code{@@selector(@dots{})}
4623 expression, and a corresponding method for that selector has been found
4624 during compilation. Because these checks scan the method table only at
4625 the end of compilation, these warnings are not produced if the final
4626 stage of compilation is not reached, for example because an error is
4627 found during compilation, or because the @option{-fsyntax-only} option is
4628 being used.
4629
4630 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4631 @opindex Wstrict-selector-match
4632 @opindex Wno-strict-selector-match
4633 Warn if multiple methods with differing argument and/or return types are
4634 found for a given selector when attempting to send a message using this
4635 selector to a receiver of type @code{id} or @code{Class}. When this flag
4636 is off (which is the default behavior), the compiler omits such warnings
4637 if any differences found are confined to types that share the same size
4638 and alignment.
4639
4640 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4641 @opindex Wundeclared-selector
4642 @opindex Wno-undeclared-selector
4643 Warn if a @code{@@selector(@dots{})} expression referring to an
4644 undeclared selector is found. A selector is considered undeclared if no
4645 method with that name has been declared before the
4646 @code{@@selector(@dots{})} expression, either explicitly in an
4647 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4648 an @code{@@implementation} section. This option always performs its
4649 checks as soon as a @code{@@selector(@dots{})} expression is found,
4650 while @option{-Wselector} only performs its checks in the final stage of
4651 compilation. This also enforces the coding style convention
4652 that methods and selectors must be declared before being used.
4653
4654 @item -print-objc-runtime-info
4655 @opindex print-objc-runtime-info
4656 Generate C header describing the largest structure that is passed by
4657 value, if any.
4658
4659 @end table
4660
4661 @node Diagnostic Message Formatting Options
4662 @section Options to Control Diagnostic Messages Formatting
4663 @cindex options to control diagnostics formatting
4664 @cindex diagnostic messages
4665 @cindex message formatting
4666
4667 Traditionally, diagnostic messages have been formatted irrespective of
4668 the output device's aspect (e.g.@: its width, @dots{}). You can use the
4669 options described below
4670 to control the formatting algorithm for diagnostic messages,
4671 e.g.@: how many characters per line, how often source location
4672 information should be reported. Note that some language front ends may not
4673 honor these options.
4674
4675 @table @gcctabopt
4676 @item -fmessage-length=@var{n}
4677 @opindex fmessage-length
4678 Try to format error messages so that they fit on lines of about
4679 @var{n} characters. If @var{n} is zero, then no line-wrapping is
4680 done; each error message appears on a single line. This is the
4681 default for all front ends.
4682
4683 Note - this option also affects the display of the @samp{#error} and
4684 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4685 function/type/variable attribute. It does not however affect the
4686 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4687
4688 @item -fdiagnostics-plain-output
4689 This option requests that diagnostic output look as plain as possible, which
4690 may be useful when running @command{dejagnu} or other utilities that need to
4691 parse diagnostics output and prefer that it remain more stable over time.
4692 @option{-fdiagnostics-plain-output} is currently equivalent to the following
4693 options:
4694 @gccoptlist{-fno-diagnostics-show-caret @gol
4695 -fno-diagnostics-show-line-numbers @gol
4696 -fdiagnostics-color=never @gol
4697 -fdiagnostics-urls=never @gol
4698 -fdiagnostics-path-format=separate-events}
4699 In the future, if GCC changes the default appearance of its diagnostics, the
4700 corresponding option to disable the new behavior will be added to this list.
4701
4702 @item -fdiagnostics-show-location=once
4703 @opindex fdiagnostics-show-location
4704 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
4705 reporter to emit source location information @emph{once}; that is, in
4706 case the message is too long to fit on a single physical line and has to
4707 be wrapped, the source location won't be emitted (as prefix) again,
4708 over and over, in subsequent continuation lines. This is the default
4709 behavior.
4710
4711 @item -fdiagnostics-show-location=every-line
4712 Only meaningful in line-wrapping mode. Instructs the diagnostic
4713 messages reporter to emit the same source location information (as
4714 prefix) for physical lines that result from the process of breaking
4715 a message which is too long to fit on a single line.
4716
4717 @item -fdiagnostics-color[=@var{WHEN}]
4718 @itemx -fno-diagnostics-color
4719 @opindex fdiagnostics-color
4720 @cindex highlight, color
4721 @vindex GCC_COLORS @r{environment variable}
4722 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
4723 or @samp{auto}. The default depends on how the compiler has been configured,
4724 it can be any of the above @var{WHEN} options or also @samp{never}
4725 if @env{GCC_COLORS} environment variable isn't present in the environment,
4726 and @samp{auto} otherwise.
4727 @samp{auto} makes GCC use color only when the standard error is a terminal,
4728 and when not executing in an emacs shell.
4729 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4730 aliases for @option{-fdiagnostics-color=always} and
4731 @option{-fdiagnostics-color=never}, respectively.
4732
4733 The colors are defined by the environment variable @env{GCC_COLORS}.
4734 Its value is a colon-separated list of capabilities and Select Graphic
4735 Rendition (SGR) substrings. SGR commands are interpreted by the
4736 terminal or terminal emulator. (See the section in the documentation
4737 of your text terminal for permitted values and their meanings as
4738 character attributes.) These substring values are integers in decimal
4739 representation and can be concatenated with semicolons.
4740 Common values to concatenate include
4741 @samp{1} for bold,
4742 @samp{4} for underline,
4743 @samp{5} for blink,
4744 @samp{7} for inverse,
4745 @samp{39} for default foreground color,
4746 @samp{30} to @samp{37} for foreground colors,
4747 @samp{90} to @samp{97} for 16-color mode foreground colors,
4748 @samp{38;5;0} to @samp{38;5;255}
4749 for 88-color and 256-color modes foreground colors,
4750 @samp{49} for default background color,
4751 @samp{40} to @samp{47} for background colors,
4752 @samp{100} to @samp{107} for 16-color mode background colors,
4753 and @samp{48;5;0} to @samp{48;5;255}
4754 for 88-color and 256-color modes background colors.
4755
4756 The default @env{GCC_COLORS} is
4757 @smallexample
4758 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4759 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4760 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4761 type-diff=01;32
4762 @end smallexample
4763 @noindent
4764 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4765 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4766 @samp{01} is bold, and @samp{31} is red.
4767 Setting @env{GCC_COLORS} to the empty string disables colors.
4768 Supported capabilities are as follows.
4769
4770 @table @code
4771 @item error=
4772 @vindex error GCC_COLORS @r{capability}
4773 SGR substring for error: markers.
4774
4775 @item warning=
4776 @vindex warning GCC_COLORS @r{capability}
4777 SGR substring for warning: markers.
4778
4779 @item note=
4780 @vindex note GCC_COLORS @r{capability}
4781 SGR substring for note: markers.
4782
4783 @item path=
4784 @vindex path GCC_COLORS @r{capability}
4785 SGR substring for colorizing paths of control-flow events as printed
4786 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4787 individual events and lines indicating interprocedural calls and returns.
4788
4789 @item range1=
4790 @vindex range1 GCC_COLORS @r{capability}
4791 SGR substring for first additional range.
4792
4793 @item range2=
4794 @vindex range2 GCC_COLORS @r{capability}
4795 SGR substring for second additional range.
4796
4797 @item locus=
4798 @vindex locus GCC_COLORS @r{capability}
4799 SGR substring for location information, @samp{file:line} or
4800 @samp{file:line:column} etc.
4801
4802 @item quote=
4803 @vindex quote GCC_COLORS @r{capability}
4804 SGR substring for information printed within quotes.
4805
4806 @item fixit-insert=
4807 @vindex fixit-insert GCC_COLORS @r{capability}
4808 SGR substring for fix-it hints suggesting text to
4809 be inserted or replaced.
4810
4811 @item fixit-delete=
4812 @vindex fixit-delete GCC_COLORS @r{capability}
4813 SGR substring for fix-it hints suggesting text to
4814 be deleted.
4815
4816 @item diff-filename=
4817 @vindex diff-filename GCC_COLORS @r{capability}
4818 SGR substring for filename headers within generated patches.
4819
4820 @item diff-hunk=
4821 @vindex diff-hunk GCC_COLORS @r{capability}
4822 SGR substring for the starts of hunks within generated patches.
4823
4824 @item diff-delete=
4825 @vindex diff-delete GCC_COLORS @r{capability}
4826 SGR substring for deleted lines within generated patches.
4827
4828 @item diff-insert=
4829 @vindex diff-insert GCC_COLORS @r{capability}
4830 SGR substring for inserted lines within generated patches.
4831
4832 @item type-diff=
4833 @vindex type-diff GCC_COLORS @r{capability}
4834 SGR substring for highlighting mismatching types within template
4835 arguments in the C++ frontend.
4836 @end table
4837
4838 @item -fdiagnostics-urls[=@var{WHEN}]
4839 @opindex fdiagnostics-urls
4840 @cindex urls
4841 @vindex GCC_URLS @r{environment variable}
4842 @vindex TERM_URLS @r{environment variable}
4843 Use escape sequences to embed URLs in diagnostics. For example, when
4844 @option{-fdiagnostics-show-option} emits text showing the command-line
4845 option controlling a diagnostic, embed a URL for documentation of that
4846 option.
4847
4848 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4849 @samp{auto} makes GCC use URL escape sequences only when the standard error
4850 is a terminal, and when not executing in an emacs shell or any graphical
4851 terminal which is known to be incompatible with this feature, see below.
4852
4853 The default depends on how the compiler has been configured.
4854 It can be any of the above @var{WHEN} options.
4855
4856 GCC can also be configured (via the
4857 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4858 so that the default is affected by environment variables.
4859 Under such a configuration, GCC defaults to using @samp{auto}
4860 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4861 present and non-empty in the environment of the compiler, or @samp{never}
4862 if neither are.
4863
4864 However, even with @option{-fdiagnostics-urls=always} the behavior is
4865 dependent on those environment variables:
4866 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4867 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4868 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4869 Any other non-empty value enables the feature.
4870 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4871 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4872 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4873
4874 At this time GCC tries to detect also a few terminals that are known to
4875 not implement the URL feature, and have bugs or at least had bugs in
4876 some versions that are still in use, where the URL escapes are likely
4877 to misbehave, i.e. print garbage on the screen.
4878 That list is currently xfce4-terminal, certain known to be buggy
4879 gnome-terminal versions, the linux console, and mingw.
4880 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4881
4882 @item -fno-diagnostics-show-option
4883 @opindex fno-diagnostics-show-option
4884 @opindex fdiagnostics-show-option
4885 By default, each diagnostic emitted includes text indicating the
4886 command-line option that directly controls the diagnostic (if such an
4887 option is known to the diagnostic machinery). Specifying the
4888 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4889
4890 @item -fno-diagnostics-show-caret
4891 @opindex fno-diagnostics-show-caret
4892 @opindex fdiagnostics-show-caret
4893 By default, each diagnostic emitted includes the original source line
4894 and a caret @samp{^} indicating the column. This option suppresses this
4895 information. The source line is truncated to @var{n} characters, if
4896 the @option{-fmessage-length=n} option is given. When the output is done
4897 to the terminal, the width is limited to the width given by the
4898 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4899
4900 @item -fno-diagnostics-show-labels
4901 @opindex fno-diagnostics-show-labels
4902 @opindex fdiagnostics-show-labels
4903 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4904 diagnostics can label ranges of source code with pertinent information, such
4905 as the types of expressions:
4906
4907 @smallexample
4908 printf ("foo %s bar", long_i + long_j);
4909 ~^ ~~~~~~~~~~~~~~~
4910 | |
4911 char * long int
4912 @end smallexample
4913
4914 This option suppresses the printing of these labels (in the example above,
4915 the vertical bars and the ``char *'' and ``long int'' text).
4916
4917 @item -fno-diagnostics-show-cwe
4918 @opindex fno-diagnostics-show-cwe
4919 @opindex fdiagnostics-show-cwe
4920 Diagnostic messages can optionally have an associated
4921 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4922 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4923 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4924 By default, if this information is present, it will be printed with
4925 the diagnostic. This option suppresses the printing of this metadata.
4926
4927 @item -fno-diagnostics-show-line-numbers
4928 @opindex fno-diagnostics-show-line-numbers
4929 @opindex fdiagnostics-show-line-numbers
4930 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4931 a left margin is printed, showing line numbers. This option suppresses this
4932 left margin.
4933
4934 @item -fdiagnostics-minimum-margin-width=@var{width}
4935 @opindex fdiagnostics-minimum-margin-width
4936 This option controls the minimum width of the left margin printed by
4937 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4938
4939 @item -fdiagnostics-parseable-fixits
4940 @opindex fdiagnostics-parseable-fixits
4941 Emit fix-it hints in a machine-parseable format, suitable for consumption
4942 by IDEs. For each fix-it, a line will be printed after the relevant
4943 diagnostic, starting with the string ``fix-it:''. For example:
4944
4945 @smallexample
4946 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4947 @end smallexample
4948
4949 The location is expressed as a half-open range, expressed as a count of
4950 bytes, starting at byte 1 for the initial column. In the above example,
4951 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4952 given string:
4953
4954 @smallexample
4955 00000000011111111112222222222
4956 12345678901234567890123456789
4957 gtk_widget_showall (dlg);
4958 ^^^^^^^^^^^^^^^^^^
4959 gtk_widget_show_all
4960 @end smallexample
4961
4962 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4963 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4964 (e.g. vertical tab as ``\013'').
4965
4966 An empty replacement string indicates that the given range is to be removed.
4967 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4968 be inserted at the given position.
4969
4970 @item -fdiagnostics-generate-patch
4971 @opindex fdiagnostics-generate-patch
4972 Print fix-it hints to stderr in unified diff format, after any diagnostics
4973 are printed. For example:
4974
4975 @smallexample
4976 --- test.c
4977 +++ test.c
4978 @@ -42,5 +42,5 @@
4979
4980 void show_cb(GtkDialog *dlg)
4981 @{
4982 - gtk_widget_showall(dlg);
4983 + gtk_widget_show_all(dlg);
4984 @}
4985
4986 @end smallexample
4987
4988 The diff may or may not be colorized, following the same rules
4989 as for diagnostics (see @option{-fdiagnostics-color}).
4990
4991 @item -fdiagnostics-show-template-tree
4992 @opindex fdiagnostics-show-template-tree
4993
4994 In the C++ frontend, when printing diagnostics showing mismatching
4995 template types, such as:
4996
4997 @smallexample
4998 could not convert 'std::map<int, std::vector<double> >()'
4999 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5000 @end smallexample
5001
5002 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5003 tree-like structure showing the common and differing parts of the types,
5004 such as:
5005
5006 @smallexample
5007 map<
5008 [...],
5009 vector<
5010 [double != float]>>
5011 @end smallexample
5012
5013 The parts that differ are highlighted with color (``double'' and
5014 ``float'' in this case).
5015
5016 @item -fno-elide-type
5017 @opindex fno-elide-type
5018 @opindex felide-type
5019 By default when the C++ frontend prints diagnostics showing mismatching
5020 template types, common parts of the types are printed as ``[...]'' to
5021 simplify the error message. For example:
5022
5023 @smallexample
5024 could not convert 'std::map<int, std::vector<double> >()'
5025 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5026 @end smallexample
5027
5028 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5029 This flag also affects the output of the
5030 @option{-fdiagnostics-show-template-tree} flag.
5031
5032 @item -fdiagnostics-path-format=@var{KIND}
5033 @opindex fdiagnostics-path-format
5034 Specify how to print paths of control-flow events for diagnostics that
5035 have such a path associated with them.
5036
5037 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5038 the default.
5039
5040 @samp{none} means to not print diagnostic paths.
5041
5042 @samp{separate-events} means to print a separate ``note'' diagnostic for
5043 each event within the diagnostic. For example:
5044
5045 @smallexample
5046 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5047 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5048 test.c:27:3: note: (2) when 'i < count'
5049 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5050 @end smallexample
5051
5052 @samp{inline-events} means to print the events ``inline'' within the source
5053 code. This view attempts to consolidate the events into runs of
5054 sufficiently-close events, printing them as labelled ranges within the source.
5055
5056 For example, the same events as above might be printed as:
5057
5058 @smallexample
5059 'test': events 1-3
5060 |
5061 | 25 | list = PyList_New(0);
5062 | | ^~~~~~~~~~~~~
5063 | | |
5064 | | (1) when 'PyList_New' fails, returning NULL
5065 | 26 |
5066 | 27 | for (i = 0; i < count; i++) @{
5067 | | ~~~
5068 | | |
5069 | | (2) when 'i < count'
5070 | 28 | item = PyLong_FromLong(random());
5071 | 29 | PyList_Append(list, item);
5072 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
5073 | | |
5074 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5075 |
5076 @end smallexample
5077
5078 Interprocedural control flow is shown by grouping the events by stack frame,
5079 and using indentation to show how stack frames are nested, pushed, and popped.
5080
5081 For example:
5082
5083 @smallexample
5084 'test': events 1-2
5085 |
5086 | 133 | @{
5087 | | ^
5088 | | |
5089 | | (1) entering 'test'
5090 | 134 | boxed_int *obj = make_boxed_int (i);
5091 | | ~~~~~~~~~~~~~~~~~~
5092 | | |
5093 | | (2) calling 'make_boxed_int'
5094 |
5095 +--> 'make_boxed_int': events 3-4
5096 |
5097 | 120 | @{
5098 | | ^
5099 | | |
5100 | | (3) entering 'make_boxed_int'
5101 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5102 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5103 | | |
5104 | | (4) calling 'wrapped_malloc'
5105 |
5106 +--> 'wrapped_malloc': events 5-6
5107 |
5108 | 7 | @{
5109 | | ^
5110 | | |
5111 | | (5) entering 'wrapped_malloc'
5112 | 8 | return malloc (size);
5113 | | ~~~~~~~~~~~~~
5114 | | |
5115 | | (6) calling 'malloc'
5116 |
5117 <-------------+
5118 |
5119 'test': event 7
5120 |
5121 | 138 | free_boxed_int (obj);
5122 | | ^~~~~~~~~~~~~~~~~~~~
5123 | | |
5124 | | (7) calling 'free_boxed_int'
5125 |
5126 (etc)
5127 @end smallexample
5128
5129 @item -fdiagnostics-show-path-depths
5130 @opindex fdiagnostics-show-path-depths
5131 This option provides additional information when printing control-flow paths
5132 associated with a diagnostic.
5133
5134 If this is option is provided then the stack depth will be printed for
5135 each run of events within @option{-fdiagnostics-path-format=separate-events}.
5136
5137 This is intended for use by GCC developers and plugin developers when
5138 debugging diagnostics that report interprocedural control flow.
5139
5140 @item -fno-show-column
5141 @opindex fno-show-column
5142 @opindex fshow-column
5143 Do not print column numbers in diagnostics. This may be necessary if
5144 diagnostics are being scanned by a program that does not understand the
5145 column numbers, such as @command{dejagnu}.
5146
5147 @item -fdiagnostics-column-unit=@var{UNIT}
5148 @opindex fdiagnostics-column-unit
5149 Select the units for the column number. This affects traditional diagnostics
5150 (in the absence of @option{-fno-show-column}), as well as JSON format
5151 diagnostics if requested.
5152
5153 The default @var{UNIT}, @samp{display}, considers the number of display
5154 columns occupied by each character. This may be larger than the number
5155 of bytes required to encode the character, in the case of tab
5156 characters, or it may be smaller, in the case of multibyte characters.
5157 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5158 display column, and its UTF-8 encoding requires two bytes; the character
5159 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5160 its UTF-8 encoding requires four bytes.
5161
5162 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5163 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5164
5165 @item -fdiagnostics-column-origin=@var{ORIGIN}
5166 @opindex fdiagnostics-column-origin
5167 Select the origin for column numbers, i.e. the column number assigned to the
5168 first column. The default value of 1 corresponds to traditional GCC
5169 behavior and to the GNU style guide. Some utilities may perform better with an
5170 origin of 0; any non-negative value may be specified.
5171
5172 @item -fdiagnostics-escape-format=@var{FORMAT}
5173 @opindex fdiagnostics-escape-format
5174 When GCC prints pertinent source lines for a diagnostic it normally attempts
5175 to print the source bytes directly. However, some diagnostics relate to encoding
5176 issues in the source file, such as malformed UTF-8, or issues with Unicode
5177 normalization. These diagnostics are flagged so that GCC will escape bytes
5178 that are not printable ASCII when printing their pertinent source lines.
5179
5180 This option controls how such bytes should be escaped.
5181
5182 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5183 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5184 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5185 displayed as hexadecimal in the form @samp{<XX>}.
5186
5187 For example, a source line containing the string @samp{before} followed by the
5188 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5189 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5190 the string @samp{after} will be printed for such a diagnostic as:
5191
5192 @smallexample
5193 before<U+03C0><BF>after
5194 @end smallexample
5195
5196 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5197 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5198 Unicode characters. For the example above, the following will be printed:
5199
5200 @smallexample
5201 before<CF><80><BF>after
5202 @end smallexample
5203
5204 @item -fdiagnostics-format=@var{FORMAT}
5205 @opindex fdiagnostics-format
5206 Select a different format for printing diagnostics.
5207 @var{FORMAT} is @samp{text} or @samp{json}.
5208 The default is @samp{text}.
5209
5210 The @samp{json} format consists of a top-level JSON array containing JSON
5211 objects representing the diagnostics.
5212
5213 The JSON is emitted as one line, without formatting; the examples below
5214 have been formatted for clarity.
5215
5216 Diagnostics can have child diagnostics. For example, this error and note:
5217
5218 @smallexample
5219 misleading-indentation.c:15:3: warning: this 'if' clause does not
5220 guard... [-Wmisleading-indentation]
5221 15 | if (flag)
5222 | ^~
5223 misleading-indentation.c:17:5: note: ...this statement, but the latter
5224 is misleadingly indented as if it were guarded by the 'if'
5225 17 | y = 2;
5226 | ^
5227 @end smallexample
5228
5229 @noindent
5230 might be printed in JSON form (after formatting) like this:
5231
5232 @smallexample
5233 [
5234 @{
5235 "kind": "warning",
5236 "locations": [
5237 @{
5238 "caret": @{
5239 "display-column": 3,
5240 "byte-column": 3,
5241 "column": 3,
5242 "file": "misleading-indentation.c",
5243 "line": 15
5244 @},
5245 "finish": @{
5246 "display-column": 4,
5247 "byte-column": 4,
5248 "column": 4,
5249 "file": "misleading-indentation.c",
5250 "line": 15
5251 @}
5252 @}
5253 ],
5254 "message": "this \u2018if\u2019 clause does not guard...",
5255 "option": "-Wmisleading-indentation",
5256 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5257 "children": [
5258 @{
5259 "kind": "note",
5260 "locations": [
5261 @{
5262 "caret": @{
5263 "display-column": 5,
5264 "byte-column": 5,
5265 "column": 5,
5266 "file": "misleading-indentation.c",
5267 "line": 17
5268 @}
5269 @}
5270 ],
5271 "escape-source": false,
5272 "message": "...this statement, but the latter is @dots{}"
5273 @}
5274 ]
5275 "escape-source": false,
5276 "column-origin": 1,
5277 @}
5278 ]
5279 @end smallexample
5280
5281 @noindent
5282 where the @code{note} is a child of the @code{warning}.
5283
5284 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
5285 an @code{option} key describing the command-line option controlling the
5286 warning.
5287
5288 A diagnostic can contain zero or more locations. Each location has an
5289 optional @code{label} string and up to three positions within it: a
5290 @code{caret} position and optional @code{start} and @code{finish} positions.
5291 A position is described by a @code{file} name, a @code{line} number, and
5292 three numbers indicating a column position:
5293 @itemize @bullet
5294
5295 @item
5296 @code{display-column} counts display columns, accounting for tabs and
5297 multibyte characters.
5298
5299 @item
5300 @code{byte-column} counts raw bytes.
5301
5302 @item
5303 @code{column} is equal to one of
5304 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5305 option.
5306
5307 @end itemize
5308 All three columns are relative to the origin specified by
5309 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5310 be set, for instance, to 0 for compatibility with other utilities that
5311 number columns from 0. The column origin is recorded in the JSON output in
5312 the @code{column-origin} tag. In the remaining examples below, the extra
5313 column number outputs have been omitted for brevity.
5314
5315 For example, this error:
5316
5317 @smallexample
5318 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5319 'struct s'@} and 'T' @{aka 'struct t'@})
5320 64 | return callee_4a () + callee_4b ();
5321 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5322 | | |
5323 | | T @{aka struct t@}
5324 | S @{aka struct s@}
5325 @end smallexample
5326
5327 @noindent
5328 has three locations. Its primary location is at the ``+'' token at column
5329 23. It has two secondary locations, describing the left and right-hand sides
5330 of the expression, which have labels. It might be printed in JSON form as:
5331
5332 @smallexample
5333 @{
5334 "children": [],
5335 "kind": "error",
5336 "locations": [
5337 @{
5338 "caret": @{
5339 "column": 23, "file": "bad-binary-ops.c", "line": 64
5340 @}
5341 @},
5342 @{
5343 "caret": @{
5344 "column": 10, "file": "bad-binary-ops.c", "line": 64
5345 @},
5346 "finish": @{
5347 "column": 21, "file": "bad-binary-ops.c", "line": 64
5348 @},
5349 "label": "S @{aka struct s@}"
5350 @},
5351 @{
5352 "caret": @{
5353 "column": 25, "file": "bad-binary-ops.c", "line": 64
5354 @},
5355 "finish": @{
5356 "column": 36, "file": "bad-binary-ops.c", "line": 64
5357 @},
5358 "label": "T @{aka struct t@}"
5359 @}
5360 ],
5361 "escape-source": false,
5362 "message": "invalid operands to binary + @dots{}"
5363 @}
5364 @end smallexample
5365
5366 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5367 consisting of half-open intervals, similar to the output of
5368 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
5369 with a replacement fix-it hint:
5370
5371 @smallexample
5372 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5373 mean 'color'?
5374 8 | return ptr->colour;
5375 | ^~~~~~
5376 | color
5377 @end smallexample
5378
5379 @noindent
5380 might be printed in JSON form as:
5381
5382 @smallexample
5383 @{
5384 "children": [],
5385 "fixits": [
5386 @{
5387 "next": @{
5388 "column": 21,
5389 "file": "demo.c",
5390 "line": 8
5391 @},
5392 "start": @{
5393 "column": 15,
5394 "file": "demo.c",
5395 "line": 8
5396 @},
5397 "string": "color"
5398 @}
5399 ],
5400 "kind": "error",
5401 "locations": [
5402 @{
5403 "caret": @{
5404 "column": 15,
5405 "file": "demo.c",
5406 "line": 8
5407 @},
5408 "finish": @{
5409 "column": 20,
5410 "file": "demo.c",
5411 "line": 8
5412 @}
5413 @}
5414 ],
5415 "escape-source": false,
5416 "message": "\u2018struct s\u2019 has no member named @dots{}"
5417 @}
5418 @end smallexample
5419
5420 @noindent
5421 where the fix-it hint suggests replacing the text from @code{start} up
5422 to but not including @code{next} with @code{string}'s value. Deletions
5423 are expressed via an empty value for @code{string}, insertions by
5424 having @code{start} equal @code{next}.
5425
5426 If the diagnostic has a path of control-flow events associated with it,
5427 it has a @code{path} array of objects representing the events. Each
5428 event object has a @code{description} string, a @code{location} object,
5429 along with a @code{function} string and a @code{depth} number for
5430 representing interprocedural paths. The @code{function} represents the
5431 current function at that event, and the @code{depth} represents the
5432 stack depth relative to some baseline: the higher, the more frames are
5433 within the stack.
5434
5435 For example, the intraprocedural example shown for
5436 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5437
5438 @smallexample
5439 "path": [
5440 @{
5441 "depth": 0,
5442 "description": "when 'PyList_New' fails, returning NULL",
5443 "function": "test",
5444 "location": @{
5445 "column": 10,
5446 "file": "test.c",
5447 "line": 25
5448 @}
5449 @},
5450 @{
5451 "depth": 0,
5452 "description": "when 'i < count'",
5453 "function": "test",
5454 "location": @{
5455 "column": 3,
5456 "file": "test.c",
5457 "line": 27
5458 @}
5459 @},
5460 @{
5461 "depth": 0,
5462 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5463 "function": "test",
5464 "location": @{
5465 "column": 5,
5466 "file": "test.c",
5467 "line": 29
5468 @}
5469 @}
5470 ]
5471 @end smallexample
5472
5473 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5474 non-ASCII bytes should be escaped when printing the pertinent lines of
5475 source code (@code{true} for diagnostics involving source encoding issues).
5476
5477 @end table
5478
5479 @node Warning Options
5480 @section Options to Request or Suppress Warnings
5481 @cindex options to control warnings
5482 @cindex warning messages
5483 @cindex messages, warning
5484 @cindex suppressing warnings
5485
5486 Warnings are diagnostic messages that report constructions that
5487 are not inherently erroneous but that are risky or suggest there
5488 may have been an error.
5489
5490 The following language-independent options do not enable specific
5491 warnings but control the kinds of diagnostics produced by GCC@.
5492
5493 @table @gcctabopt
5494 @cindex syntax checking
5495 @item -fsyntax-only
5496 @opindex fsyntax-only
5497 Check the code for syntax errors, but don't do anything beyond that.
5498
5499 @item -fmax-errors=@var{n}
5500 @opindex fmax-errors
5501 Limits the maximum number of error messages to @var{n}, at which point
5502 GCC bails out rather than attempting to continue processing the source
5503 code. If @var{n} is 0 (the default), there is no limit on the number
5504 of error messages produced. If @option{-Wfatal-errors} is also
5505 specified, then @option{-Wfatal-errors} takes precedence over this
5506 option.
5507
5508 @item -w
5509 @opindex w
5510 Inhibit all warning messages.
5511
5512 @item -Werror
5513 @opindex Werror
5514 @opindex Wno-error
5515 Make all warnings into errors.
5516
5517 @item -Werror=
5518 @opindex Werror=
5519 @opindex Wno-error=
5520 Make the specified warning into an error. The specifier for a warning
5521 is appended; for example @option{-Werror=switch} turns the warnings
5522 controlled by @option{-Wswitch} into errors. This switch takes a
5523 negative form, to be used to negate @option{-Werror} for specific
5524 warnings; for example @option{-Wno-error=switch} makes
5525 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5526 is in effect.
5527
5528 The warning message for each controllable warning includes the
5529 option that controls the warning. That option can then be used with
5530 @option{-Werror=} and @option{-Wno-error=} as described above.
5531 (Printing of the option in the warning message can be disabled using the
5532 @option{-fno-diagnostics-show-option} flag.)
5533
5534 Note that specifying @option{-Werror=}@var{foo} automatically implies
5535 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5536 imply anything.
5537
5538 @item -Wfatal-errors
5539 @opindex Wfatal-errors
5540 @opindex Wno-fatal-errors
5541 This option causes the compiler to abort compilation on the first error
5542 occurred rather than trying to keep going and printing further error
5543 messages.
5544
5545 @end table
5546
5547 You can request many specific warnings with options beginning with
5548 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5549 implicit declarations. Each of these specific warning options also
5550 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5551 example, @option{-Wno-implicit}. This manual lists only one of the
5552 two forms, whichever is not the default. For further
5553 language-specific options also refer to @ref{C++ Dialect Options} and
5554 @ref{Objective-C and Objective-C++ Dialect Options}.
5555 Additional warnings can be produced by enabling the static analyzer;
5556 @xref{Static Analyzer Options}.
5557
5558 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5559 options, such as @option{-Wunused}, which may turn on further options,
5560 such as @option{-Wunused-value}. The combined effect of positive and
5561 negative forms is that more specific options have priority over less
5562 specific ones, independently of their position in the command-line. For
5563 options of the same specificity, the last one takes effect. Options
5564 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5565 as if they appeared at the end of the command-line.
5566
5567 When an unrecognized warning option is requested (e.g.,
5568 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5569 that the option is not recognized. However, if the @option{-Wno-} form
5570 is used, the behavior is slightly different: no diagnostic is
5571 produced for @option{-Wno-unknown-warning} unless other diagnostics
5572 are being produced. This allows the use of new @option{-Wno-} options
5573 with old compilers, but if something goes wrong, the compiler
5574 warns that an unrecognized option is present.
5575
5576 The effectiveness of some warnings depends on optimizations also being
5577 enabled. For example @option{-Wsuggest-final-types} is more effective
5578 with link-time optimization and @option{-Wmaybe-uninitialized} does not
5579 warn at all unless optimization is enabled.
5580
5581 @table @gcctabopt
5582 @item -Wpedantic
5583 @itemx -pedantic
5584 @opindex pedantic
5585 @opindex Wpedantic
5586 @opindex Wno-pedantic
5587 Issue all the warnings demanded by strict ISO C and ISO C++;
5588 reject all programs that use forbidden extensions, and some other
5589 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5590 version of the ISO C standard specified by any @option{-std} option used.
5591
5592 Valid ISO C and ISO C++ programs should compile properly with or without
5593 this option (though a rare few require @option{-ansi} or a
5594 @option{-std} option specifying the required version of ISO C)@. However,
5595 without this option, certain GNU extensions and traditional C and C++
5596 features are supported as well. With this option, they are rejected.
5597
5598 @option{-Wpedantic} does not cause warning messages for use of the
5599 alternate keywords whose names begin and end with @samp{__}. This alternate
5600 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5601 i.e. @samp{__intN__}.
5602 Pedantic warnings are also disabled in the expression that follows
5603 @code{__extension__}. However, only system header files should use
5604 these escape routes; application programs should avoid them.
5605 @xref{Alternate Keywords}.
5606
5607 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5608 C conformance. They soon find that it does not do quite what they want:
5609 it finds some non-ISO practices, but not all---only those for which
5610 ISO C @emph{requires} a diagnostic, and some others for which
5611 diagnostics have been added.
5612
5613 A feature to report any failure to conform to ISO C might be useful in
5614 some instances, but would require considerable additional work and would
5615 be quite different from @option{-Wpedantic}. We don't have plans to
5616 support such a feature in the near future.
5617
5618 Where the standard specified with @option{-std} represents a GNU
5619 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5620 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5621 extended dialect is based. Warnings from @option{-Wpedantic} are given
5622 where they are required by the base standard. (It does not make sense
5623 for such warnings to be given only for features not in the specified GNU
5624 C dialect, since by definition the GNU dialects of C include all
5625 features the compiler supports with the given option, and there would be
5626 nothing to warn about.)
5627
5628 @item -pedantic-errors
5629 @opindex pedantic-errors
5630 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5631 requires a diagnostic, in some cases where there is undefined behavior
5632 at compile-time and in some other cases that do not prevent compilation
5633 of programs that are valid according to the standard. This is not
5634 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5635 by this option and not enabled by the latter and vice versa.
5636
5637 @item -Wall
5638 @opindex Wall
5639 @opindex Wno-all
5640 This enables all the warnings about constructions that some users
5641 consider questionable, and that are easy to avoid (or modify to
5642 prevent the warning), even in conjunction with macros. This also
5643 enables some language-specific warnings described in @ref{C++ Dialect
5644 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5645
5646 @option{-Wall} turns on the following warning flags:
5647
5648 @gccoptlist{-Waddress @gol
5649 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
5650 -Warray-compare @gol
5651 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
5652 -Wbool-compare @gol
5653 -Wbool-operation @gol
5654 -Wc++11-compat -Wc++14-compat @gol
5655 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
5656 -Wchar-subscripts @gol
5657 -Wcomment @gol
5658 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5659 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5660 -Wformat @gol
5661 -Wformat-overflow @gol
5662 -Wformat-truncation @gol
5663 -Wint-in-bool-context @gol
5664 -Wimplicit @r{(C and Objective-C only)} @gol
5665 -Wimplicit-int @r{(C and Objective-C only)} @gol
5666 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5667 -Winit-self @r{(only for C++)} @gol
5668 -Wlogical-not-parentheses @gol
5669 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
5670 -Wmaybe-uninitialized @gol
5671 -Wmemset-elt-size @gol
5672 -Wmemset-transposed-args @gol
5673 -Wmisleading-indentation @r{(only for C/C++)} @gol
5674 -Wmismatched-dealloc @gol
5675 -Wmismatched-new-delete @r{(only for C/C++)} @gol
5676 -Wmissing-attributes @gol
5677 -Wmissing-braces @r{(only for C/ObjC)} @gol
5678 -Wmultistatement-macros @gol
5679 -Wnarrowing @r{(only for C++)} @gol
5680 -Wnonnull @gol
5681 -Wnonnull-compare @gol
5682 -Wopenmp-simd @gol
5683 -Wparentheses @gol
5684 -Wpessimizing-move @r{(only for C++)} @gol
5685 -Wpointer-sign @gol
5686 -Wrange-loop-construct @r{(only for C++)} @gol
5687 -Wreorder @gol
5688 -Wrestrict @gol
5689 -Wreturn-type @gol
5690 -Wsequence-point @gol
5691 -Wsign-compare @r{(only in C++)} @gol
5692 -Wsizeof-array-div @gol
5693 -Wsizeof-pointer-div @gol
5694 -Wsizeof-pointer-memaccess @gol
5695 -Wstrict-aliasing @gol
5696 -Wstrict-overflow=1 @gol
5697 -Wswitch @gol
5698 -Wtautological-compare @gol
5699 -Wtrigraphs @gol
5700 -Wuninitialized @gol
5701 -Wunknown-pragmas @gol
5702 -Wunused-function @gol
5703 -Wunused-label @gol
5704 -Wunused-value @gol
5705 -Wunused-variable @gol
5706 -Wvla-parameter @r{(C and Objective-C only)} @gol
5707 -Wvolatile-register-var @gol
5708 -Wzero-length-bounds}
5709
5710 Note that some warning flags are not implied by @option{-Wall}. Some of
5711 them warn about constructions that users generally do not consider
5712 questionable, but which occasionally you might wish to check for;
5713 others warn about constructions that are necessary or hard to avoid in
5714 some cases, and there is no simple way to modify the code to suppress
5715 the warning. Some of them are enabled by @option{-Wextra} but many of
5716 them must be enabled individually.
5717
5718 @item -Wextra
5719 @opindex W
5720 @opindex Wextra
5721 @opindex Wno-extra
5722 This enables some extra warning flags that are not enabled by
5723 @option{-Wall}. (This option used to be called @option{-W}. The older
5724 name is still supported, but the newer name is more descriptive.)
5725
5726 @gccoptlist{-Wclobbered @gol
5727 -Wcast-function-type @gol
5728 -Wdeprecated-copy @r{(C++ only)} @gol
5729 -Wempty-body @gol
5730 -Wenum-conversion @r{(C only)} @gol
5731 -Wignored-qualifiers @gol
5732 -Wimplicit-fallthrough=3 @gol
5733 -Wmissing-field-initializers @gol
5734 -Wmissing-parameter-type @r{(C only)} @gol
5735 -Wold-style-declaration @r{(C only)} @gol
5736 -Woverride-init @gol
5737 -Wsign-compare @r{(C only)} @gol
5738 -Wstring-compare @gol
5739 -Wredundant-move @r{(only for C++)} @gol
5740 -Wtype-limits @gol
5741 -Wuninitialized @gol
5742 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
5743 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5744 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5745
5746
5747 The option @option{-Wextra} also prints warning messages for the
5748 following cases:
5749
5750 @itemize @bullet
5751
5752 @item
5753 A pointer is compared against integer zero with @code{<}, @code{<=},
5754 @code{>}, or @code{>=}.
5755
5756 @item
5757 (C++ only) An enumerator and a non-enumerator both appear in a
5758 conditional expression.
5759
5760 @item
5761 (C++ only) Ambiguous virtual bases.
5762
5763 @item
5764 (C++ only) Subscripting an array that has been declared @code{register}.
5765
5766 @item
5767 (C++ only) Taking the address of a variable that has been declared
5768 @code{register}.
5769
5770 @item
5771 (C++ only) A base class is not initialized in the copy constructor
5772 of a derived class.
5773
5774 @end itemize
5775
5776 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5777 @opindex Wabi
5778 @opindex Wno-abi
5779
5780 Warn about code affected by ABI changes. This includes code that may
5781 not be compatible with the vendor-neutral C++ ABI as well as the psABI
5782 for the particular target.
5783
5784 Since G++ now defaults to updating the ABI with each major release,
5785 normally @option{-Wabi} warns only about C++ ABI compatibility
5786 problems if there is a check added later in a release series for an
5787 ABI issue discovered since the initial release. @option{-Wabi} warns
5788 about more things if an older ABI version is selected (with
5789 @option{-fabi-version=@var{n}}).
5790
5791 @option{-Wabi} can also be used with an explicit version number to
5792 warn about C++ ABI compatibility with a particular @option{-fabi-version}
5793 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5794 @option{-fabi-version=2}.
5795
5796 If an explicit version number is provided and
5797 @option{-fabi-compat-version} is not specified, the version number
5798 from this option is used for compatibility aliases. If no explicit
5799 version number is provided with this option, but
5800 @option{-fabi-compat-version} is specified, that version number is
5801 used for C++ ABI warnings.
5802
5803 Although an effort has been made to warn about
5804 all such cases, there are probably some cases that are not warned about,
5805 even though G++ is generating incompatible code. There may also be
5806 cases where warnings are emitted even though the code that is generated
5807 is compatible.
5808
5809 You should rewrite your code to avoid these warnings if you are
5810 concerned about the fact that code generated by G++ may not be binary
5811 compatible with code generated by other compilers.
5812
5813 Known incompatibilities in @option{-fabi-version=2} (which was the
5814 default from GCC 3.4 to 4.9) include:
5815
5816 @itemize @bullet
5817
5818 @item
5819 A template with a non-type template parameter of reference type was
5820 mangled incorrectly:
5821 @smallexample
5822 extern int N;
5823 template <int &> struct S @{@};
5824 void n (S<N>) @{2@}
5825 @end smallexample
5826
5827 This was fixed in @option{-fabi-version=3}.
5828
5829 @item
5830 SIMD vector types declared using @code{__attribute ((vector_size))} were
5831 mangled in a non-standard way that does not allow for overloading of
5832 functions taking vectors of different sizes.
5833
5834 The mangling was changed in @option{-fabi-version=4}.
5835
5836 @item
5837 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5838 qualifiers, and @code{decltype} of a plain declaration was folded away.
5839
5840 These mangling issues were fixed in @option{-fabi-version=5}.
5841
5842 @item
5843 Scoped enumerators passed as arguments to a variadic function are
5844 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5845 On most targets this does not actually affect the parameter passing
5846 ABI, as there is no way to pass an argument smaller than @code{int}.
5847
5848 Also, the ABI changed the mangling of template argument packs,
5849 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5850 a class scope function used as a template argument.
5851
5852 These issues were corrected in @option{-fabi-version=6}.
5853
5854 @item
5855 Lambdas in default argument scope were mangled incorrectly, and the
5856 ABI changed the mangling of @code{nullptr_t}.
5857
5858 These issues were corrected in @option{-fabi-version=7}.
5859
5860 @item
5861 When mangling a function type with function-cv-qualifiers, the
5862 un-qualified function type was incorrectly treated as a substitution
5863 candidate.
5864
5865 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5866
5867 @item
5868 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5869 unaligned accesses. Note that this did not affect the ABI of a
5870 function with a @code{nullptr_t} parameter, as parameters have a
5871 minimum alignment.
5872
5873 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5874
5875 @item
5876 Target-specific attributes that affect the identity of a type, such as
5877 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5878 did not affect the mangled name, leading to name collisions when
5879 function pointers were used as template arguments.
5880
5881 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5882
5883 @end itemize
5884
5885 This option also enables warnings about psABI-related changes.
5886 The known psABI changes at this point include:
5887
5888 @itemize @bullet
5889
5890 @item
5891 For SysV/x86-64, unions with @code{long double} members are
5892 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5893 the case. For example:
5894
5895 @smallexample
5896 union U @{
5897 long double ld;
5898 int i;
5899 @};
5900 @end smallexample
5901
5902 @noindent
5903 @code{union U} is now always passed in memory.
5904
5905 @end itemize
5906
5907 @item -Wchar-subscripts
5908 @opindex Wchar-subscripts
5909 @opindex Wno-char-subscripts
5910 Warn if an array subscript has type @code{char}. This is a common cause
5911 of error, as programmers often forget that this type is signed on some
5912 machines.
5913 This warning is enabled by @option{-Wall}.
5914
5915 @item -Wno-coverage-mismatch
5916 @opindex Wno-coverage-mismatch
5917 @opindex Wcoverage-mismatch
5918 Warn if feedback profiles do not match when using the
5919 @option{-fprofile-use} option.
5920 If a source file is changed between compiling with @option{-fprofile-generate}
5921 and with @option{-fprofile-use}, the files with the profile feedback can fail
5922 to match the source file and GCC cannot use the profile feedback
5923 information. By default, this warning is enabled and is treated as an
5924 error. @option{-Wno-coverage-mismatch} can be used to disable the
5925 warning or @option{-Wno-error=coverage-mismatch} can be used to
5926 disable the error. Disabling the error for this warning can result in
5927 poorly optimized code and is useful only in the
5928 case of very minor changes such as bug fixes to an existing code-base.
5929 Completely disabling the warning is not recommended.
5930
5931 @item -Wno-coverage-invalid-line-number
5932 @opindex Wno-coverage-invalid-line-number
5933 @opindex Wcoverage-invalid-line-number
5934 Warn in case a function ends earlier than it begins due
5935 to an invalid linenum macros. The warning is emitted only
5936 with @option{--coverage} enabled.
5937
5938 By default, this warning is enabled and is treated as an
5939 error. @option{-Wno-coverage-invalid-line-number} can be used to disable the
5940 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
5941 disable the error.
5942
5943 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5944 @opindex Wno-cpp
5945 @opindex Wcpp
5946 Suppress warning messages emitted by @code{#warning} directives.
5947
5948 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5949 @opindex Wdouble-promotion
5950 @opindex Wno-double-promotion
5951 Give a warning when a value of type @code{float} is implicitly
5952 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5953 floating-point unit implement @code{float} in hardware, but emulate
5954 @code{double} in software. On such a machine, doing computations
5955 using @code{double} values is much more expensive because of the
5956 overhead required for software emulation.
5957
5958 It is easy to accidentally do computations with @code{double} because
5959 floating-point literals are implicitly of type @code{double}. For
5960 example, in:
5961 @smallexample
5962 @group
5963 float area(float radius)
5964 @{
5965 return 3.14159 * radius * radius;
5966 @}
5967 @end group
5968 @end smallexample
5969 the compiler performs the entire computation with @code{double}
5970 because the floating-point literal is a @code{double}.
5971
5972 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5973 @opindex Wduplicate-decl-specifier
5974 @opindex Wno-duplicate-decl-specifier
5975 Warn if a declaration has duplicate @code{const}, @code{volatile},
5976 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5977 @option{-Wall}.
5978
5979 @item -Wformat
5980 @itemx -Wformat=@var{n}
5981 @opindex Wformat
5982 @opindex Wno-format
5983 @opindex ffreestanding
5984 @opindex fno-builtin
5985 @opindex Wformat=
5986 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5987 the arguments supplied have types appropriate to the format string
5988 specified, and that the conversions specified in the format string make
5989 sense. This includes standard functions, and others specified by format
5990 attributes (@pxref{Function Attributes}), in the @code{printf},
5991 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5992 not in the C standard) families (or other target-specific families).
5993 Which functions are checked without format attributes having been
5994 specified depends on the standard version selected, and such checks of
5995 functions without the attribute specified are disabled by
5996 @option{-ffreestanding} or @option{-fno-builtin}.
5997
5998 The formats are checked against the format features supported by GNU
5999 libc version 2.2. These include all ISO C90 and C99 features, as well
6000 as features from the Single Unix Specification and some BSD and GNU
6001 extensions. Other library implementations may not support all these
6002 features; GCC does not support warning about features that go beyond a
6003 particular library's limitations. However, if @option{-Wpedantic} is used
6004 with @option{-Wformat}, warnings are given about format features not
6005 in the selected standard version (but not for @code{strfmon} formats,
6006 since those are not in any version of the C standard). @xref{C Dialect
6007 Options,,Options Controlling C Dialect}.
6008
6009 @table @gcctabopt
6010 @item -Wformat=1
6011 @itemx -Wformat
6012 @opindex Wformat
6013 @opindex Wformat=1
6014 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6015 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
6016 @option{-Wformat} also checks for null format arguments for several
6017 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
6018 aspects of this level of format checking can be disabled by the
6019 options: @option{-Wno-format-contains-nul},
6020 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6021 @option{-Wformat} is enabled by @option{-Wall}.
6022
6023 @item -Wformat=2
6024 @opindex Wformat=2
6025 Enable @option{-Wformat} plus additional format checks. Currently
6026 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6027 -Wformat-y2k}.
6028 @end table
6029
6030 @item -Wno-format-contains-nul
6031 @opindex Wno-format-contains-nul
6032 @opindex Wformat-contains-nul
6033 If @option{-Wformat} is specified, do not warn about format strings that
6034 contain NUL bytes.
6035
6036 @item -Wno-format-extra-args
6037 @opindex Wno-format-extra-args
6038 @opindex Wformat-extra-args
6039 If @option{-Wformat} is specified, do not warn about excess arguments to a
6040 @code{printf} or @code{scanf} format function. The C standard specifies
6041 that such arguments are ignored.
6042
6043 Where the unused arguments lie between used arguments that are
6044 specified with @samp{$} operand number specifications, normally
6045 warnings are still given, since the implementation could not know what
6046 type to pass to @code{va_arg} to skip the unused arguments. However,
6047 in the case of @code{scanf} formats, this option suppresses the
6048 warning if the unused arguments are all pointers, since the Single
6049 Unix Specification says that such unused arguments are allowed.
6050
6051 @item -Wformat-overflow
6052 @itemx -Wformat-overflow=@var{level}
6053 @opindex Wformat-overflow
6054 @opindex Wno-format-overflow
6055 Warn about calls to formatted input/output functions such as @code{sprintf}
6056 and @code{vsprintf} that might overflow the destination buffer. When the
6057 exact number of bytes written by a format directive cannot be determined
6058 at compile-time it is estimated based on heuristics that depend on the
6059 @var{level} argument and on optimization. While enabling optimization
6060 will in most cases improve the accuracy of the warning, it may also
6061 result in false positives.
6062
6063 @table @gcctabopt
6064 @item -Wformat-overflow
6065 @itemx -Wformat-overflow=1
6066 @opindex Wformat-overflow
6067 @opindex Wno-format-overflow
6068 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6069 employs a conservative approach that warns only about calls that most
6070 likely overflow the buffer. At this level, numeric arguments to format
6071 directives with unknown values are assumed to have the value of one, and
6072 strings of unknown length to be empty. Numeric arguments that are known
6073 to be bounded to a subrange of their type, or string arguments whose output
6074 is bounded either by their directive's precision or by a finite set of
6075 string literals, are assumed to take on the value within the range that
6076 results in the most bytes on output. For example, the call to @code{sprintf}
6077 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6078 the terminating NUL character (@code{'\0'}) appended by the function
6079 to the destination buffer will be written past its end. Increasing
6080 the size of the buffer by a single byte is sufficient to avoid the
6081 warning, though it may not be sufficient to avoid the overflow.
6082
6083 @smallexample
6084 void f (int a, int b)
6085 @{
6086 char buf [13];
6087 sprintf (buf, "a = %i, b = %i\n", a, b);
6088 @}
6089 @end smallexample
6090
6091 @item -Wformat-overflow=2
6092 Level @var{2} warns also about calls that might overflow the destination
6093 buffer given an argument of sufficient length or magnitude. At level
6094 @var{2}, unknown numeric arguments are assumed to have the minimum
6095 representable value for signed types with a precision greater than 1, and
6096 the maximum representable value otherwise. Unknown string arguments whose
6097 length cannot be assumed to be bounded either by the directive's precision,
6098 or by a finite set of string literals they may evaluate to, or the character
6099 array they may point to, are assumed to be 1 character long.
6100
6101 At level @var{2}, the call in the example above is again diagnosed, but
6102 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6103 @code{%i} directive will write some of its digits beyond the end of
6104 the destination buffer. To make the call safe regardless of the values
6105 of the two variables, the size of the destination buffer must be increased
6106 to at least 34 bytes. GCC includes the minimum size of the buffer in
6107 an informational note following the warning.
6108
6109 An alternative to increasing the size of the destination buffer is to
6110 constrain the range of formatted values. The maximum length of string
6111 arguments can be bounded by specifying the precision in the format
6112 directive. When numeric arguments of format directives can be assumed
6113 to be bounded by less than the precision of their type, choosing
6114 an appropriate length modifier to the format specifier will reduce
6115 the required buffer size. For example, if @var{a} and @var{b} in the
6116 example above can be assumed to be within the precision of
6117 the @code{short int} type then using either the @code{%hi} format
6118 directive or casting the argument to @code{short} reduces the maximum
6119 required size of the buffer to 24 bytes.
6120
6121 @smallexample
6122 void f (int a, int b)
6123 @{
6124 char buf [23];
6125 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6126 @}
6127 @end smallexample
6128 @end table
6129
6130 @item -Wno-format-zero-length
6131 @opindex Wno-format-zero-length
6132 @opindex Wformat-zero-length
6133 If @option{-Wformat} is specified, do not warn about zero-length formats.
6134 The C standard specifies that zero-length formats are allowed.
6135
6136 @item -Wformat-nonliteral
6137 @opindex Wformat-nonliteral
6138 @opindex Wno-format-nonliteral
6139 If @option{-Wformat} is specified, also warn if the format string is not a
6140 string literal and so cannot be checked, unless the format function
6141 takes its format arguments as a @code{va_list}.
6142
6143 @item -Wformat-security
6144 @opindex Wformat-security
6145 @opindex Wno-format-security
6146 If @option{-Wformat} is specified, also warn about uses of format
6147 functions that represent possible security problems. At present, this
6148 warns about calls to @code{printf} and @code{scanf} functions where the
6149 format string is not a string literal and there are no format arguments,
6150 as in @code{printf (foo);}. This may be a security hole if the format
6151 string came from untrusted input and contains @samp{%n}. (This is
6152 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6153 in future warnings may be added to @option{-Wformat-security} that are not
6154 included in @option{-Wformat-nonliteral}.)
6155
6156 @item -Wformat-signedness
6157 @opindex Wformat-signedness
6158 @opindex Wno-format-signedness
6159 If @option{-Wformat} is specified, also warn if the format string
6160 requires an unsigned argument and the argument is signed and vice versa.
6161
6162 @item -Wformat-truncation
6163 @itemx -Wformat-truncation=@var{level}
6164 @opindex Wformat-truncation
6165 @opindex Wno-format-truncation
6166 Warn about calls to formatted input/output functions such as @code{snprintf}
6167 and @code{vsnprintf} that might result in output truncation. When the exact
6168 number of bytes written by a format directive cannot be determined at
6169 compile-time it is estimated based on heuristics that depend on
6170 the @var{level} argument and on optimization. While enabling optimization
6171 will in most cases improve the accuracy of the warning, it may also result
6172 in false positives. Except as noted otherwise, the option uses the same
6173 logic @option{-Wformat-overflow}.
6174
6175 @table @gcctabopt
6176 @item -Wformat-truncation
6177 @itemx -Wformat-truncation=1
6178 @opindex Wformat-truncation
6179 @opindex Wno-format-truncation
6180 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6181 employs a conservative approach that warns only about calls to bounded
6182 functions whose return value is unused and that will most likely result
6183 in output truncation.
6184
6185 @item -Wformat-truncation=2
6186 Level @var{2} warns also about calls to bounded functions whose return
6187 value is used and that might result in truncation given an argument of
6188 sufficient length or magnitude.
6189 @end table
6190
6191 @item -Wformat-y2k
6192 @opindex Wformat-y2k
6193 @opindex Wno-format-y2k
6194 If @option{-Wformat} is specified, also warn about @code{strftime}
6195 formats that may yield only a two-digit year.
6196
6197 @item -Wnonnull
6198 @opindex Wnonnull
6199 @opindex Wno-nonnull
6200 Warn about passing a null pointer for arguments marked as
6201 requiring a non-null value by the @code{nonnull} function attribute.
6202
6203 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
6204 can be disabled with the @option{-Wno-nonnull} option.
6205
6206 @item -Wnonnull-compare
6207 @opindex Wnonnull-compare
6208 @opindex Wno-nonnull-compare
6209 Warn when comparing an argument marked with the @code{nonnull}
6210 function attribute against null inside the function.
6211
6212 @option{-Wnonnull-compare} is included in @option{-Wall}. It
6213 can be disabled with the @option{-Wno-nonnull-compare} option.
6214
6215 @item -Wnull-dereference
6216 @opindex Wnull-dereference
6217 @opindex Wno-null-dereference
6218 Warn if the compiler detects paths that trigger erroneous or
6219 undefined behavior due to dereferencing a null pointer. This option
6220 is only active when @option{-fdelete-null-pointer-checks} is active,
6221 which is enabled by optimizations in most targets. The precision of
6222 the warnings depends on the optimization options used.
6223
6224 @item -Winfinite-recursion
6225 @opindex Winfinite-recursion
6226 @opindex Wno-infinite-recursion
6227 Warn about infinitely recursive calls. The warning is effective at all
6228 optimization levels but requires optimization in order to detect infinite
6229 recursion in calls between two or more functions.
6230 @option{-Winfinite-recursion} is included in @option{-Wall}.
6231
6232 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6233 @opindex Winit-self
6234 @opindex Wno-init-self
6235 Warn about uninitialized variables that are initialized with themselves.
6236 Note this option can only be used with the @option{-Wuninitialized} option.
6237
6238 For example, GCC warns about @code{i} being uninitialized in the
6239 following snippet only when @option{-Winit-self} has been specified:
6240 @smallexample
6241 @group
6242 int f()
6243 @{
6244 int i = i;
6245 return i;
6246 @}
6247 @end group
6248 @end smallexample
6249
6250 This warning is enabled by @option{-Wall} in C++.
6251
6252 @item -Wno-implicit-int @r{(C and Objective-C only)}
6253 @opindex Wimplicit-int
6254 @opindex Wno-implicit-int
6255 This option controls warnings when a declaration does not specify a type.
6256 This warning is enabled by default in C99 and later dialects of C,
6257 and also by @option{-Wall}.
6258
6259 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6260 @opindex Wimplicit-function-declaration
6261 @opindex Wno-implicit-function-declaration
6262 This option controls warnings when a function is used before being declared.
6263 This warning is enabled by default in C99 and later dialects of C,
6264 and also by @option{-Wall}.
6265 The warning is made into an error by @option{-pedantic-errors}.
6266
6267 @item -Wimplicit @r{(C and Objective-C only)}
6268 @opindex Wimplicit
6269 @opindex Wno-implicit
6270 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6271 This warning is enabled by @option{-Wall}.
6272
6273 @item -Wimplicit-fallthrough
6274 @opindex Wimplicit-fallthrough
6275 @opindex Wno-implicit-fallthrough
6276 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6277 and @option{-Wno-implicit-fallthrough} is the same as
6278 @option{-Wimplicit-fallthrough=0}.
6279
6280 @item -Wimplicit-fallthrough=@var{n}
6281 @opindex Wimplicit-fallthrough=
6282 Warn when a switch case falls through. For example:
6283
6284 @smallexample
6285 @group
6286 switch (cond)
6287 @{
6288 case 1:
6289 a = 1;
6290 break;
6291 case 2:
6292 a = 2;
6293 case 3:
6294 a = 3;
6295 break;
6296 @}
6297 @end group
6298 @end smallexample
6299
6300 This warning does not warn when the last statement of a case cannot
6301 fall through, e.g. when there is a return statement or a call to function
6302 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
6303 also takes into account control flow statements, such as ifs, and only
6304 warns when appropriate. E.g.@:
6305
6306 @smallexample
6307 @group
6308 switch (cond)
6309 @{
6310 case 1:
6311 if (i > 3) @{
6312 bar (5);
6313 break;
6314 @} else if (i < 1) @{
6315 bar (0);
6316 @} else
6317 return;
6318 default:
6319 @dots{}
6320 @}
6321 @end group
6322 @end smallexample
6323
6324 Since there are occasions where a switch case fall through is desirable,
6325 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6326 to be used along with a null statement to suppress this warning that
6327 would normally occur:
6328
6329 @smallexample
6330 @group
6331 switch (cond)
6332 @{
6333 case 1:
6334 bar (0);
6335 __attribute__ ((fallthrough));
6336 default:
6337 @dots{}
6338 @}
6339 @end group
6340 @end smallexample
6341
6342 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6343 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
6344 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6345 Instead of these attributes, it is also possible to add a fallthrough comment
6346 to silence the warning. The whole body of the C or C++ style comment should
6347 match the given regular expressions listed below. The option argument @var{n}
6348 specifies what kind of comments are accepted:
6349
6350 @itemize @bullet
6351
6352 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6353
6354 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6355 expression, any comment is used as fallthrough comment.
6356
6357 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6358 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6359
6360 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6361 following regular expressions:
6362
6363 @itemize @bullet
6364
6365 @item @code{-fallthrough}
6366
6367 @item @code{@@fallthrough@@}
6368
6369 @item @code{lint -fallthrough[ \t]*}
6370
6371 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6372
6373 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6374
6375 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6376
6377 @end itemize
6378
6379 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6380 following regular expressions:
6381
6382 @itemize @bullet
6383
6384 @item @code{-fallthrough}
6385
6386 @item @code{@@fallthrough@@}
6387
6388 @item @code{lint -fallthrough[ \t]*}
6389
6390 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6391
6392 @end itemize
6393
6394 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6395 fallthrough comments, only attributes disable the warning.
6396
6397 @end itemize
6398
6399 The comment needs to be followed after optional whitespace and other comments
6400 by @code{case} or @code{default} keywords or by a user label that precedes some
6401 @code{case} or @code{default} label.
6402
6403 @smallexample
6404 @group
6405 switch (cond)
6406 @{
6407 case 1:
6408 bar (0);
6409 /* FALLTHRU */
6410 default:
6411 @dots{}
6412 @}
6413 @end group
6414 @end smallexample
6415
6416 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6417
6418 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6419 @opindex Wif-not-aligned
6420 @opindex Wno-if-not-aligned
6421 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6422 should be issued. These warnings are enabled by default.
6423
6424 @item -Wignored-qualifiers @r{(C and C++ only)}
6425 @opindex Wignored-qualifiers
6426 @opindex Wno-ignored-qualifiers
6427 Warn if the return type of a function has a type qualifier
6428 such as @code{const}. For ISO C such a type qualifier has no effect,
6429 since the value returned by a function is not an lvalue.
6430 For C++, the warning is only emitted for scalar types or @code{void}.
6431 ISO C prohibits qualified @code{void} return types on function
6432 definitions, so such return types always receive a warning
6433 even without this option.
6434
6435 This warning is also enabled by @option{-Wextra}.
6436
6437 @item -Wno-ignored-attributes @r{(C and C++ only)}
6438 @opindex Wignored-attributes
6439 @opindex Wno-ignored-attributes
6440 This option controls warnings when an attribute is ignored.
6441 This is different from the
6442 @option{-Wattributes} option in that it warns whenever the compiler decides
6443 to drop an attribute, not that the attribute is either unknown, used in a
6444 wrong place, etc. This warning is enabled by default.
6445
6446 @item -Wmain
6447 @opindex Wmain
6448 @opindex Wno-main
6449 Warn if the type of @code{main} is suspicious. @code{main} should be
6450 a function with external linkage, returning int, taking either zero
6451 arguments, two, or three arguments of appropriate types. This warning
6452 is enabled by default in C++ and is enabled by either @option{-Wall}
6453 or @option{-Wpedantic}.
6454
6455 @item -Wmisleading-indentation @r{(C and C++ only)}
6456 @opindex Wmisleading-indentation
6457 @opindex Wno-misleading-indentation
6458 Warn when the indentation of the code does not reflect the block structure.
6459 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6460 @code{for} clauses with a guarded statement that does not use braces,
6461 followed by an unguarded statement with the same indentation.
6462
6463 In the following example, the call to ``bar'' is misleadingly indented as
6464 if it were guarded by the ``if'' conditional.
6465
6466 @smallexample
6467 if (some_condition ())
6468 foo ();
6469 bar (); /* Gotcha: this is not guarded by the "if". */
6470 @end smallexample
6471
6472 In the case of mixed tabs and spaces, the warning uses the
6473 @option{-ftabstop=} option to determine if the statements line up
6474 (defaulting to 8).
6475
6476 The warning is not issued for code involving multiline preprocessor logic
6477 such as the following example.
6478
6479 @smallexample
6480 if (flagA)
6481 foo (0);
6482 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6483 if (flagB)
6484 #endif
6485 foo (1);
6486 @end smallexample
6487
6488 The warning is not issued after a @code{#line} directive, since this
6489 typically indicates autogenerated code, and no assumptions can be made
6490 about the layout of the file that the directive references.
6491
6492 This warning is enabled by @option{-Wall} in C and C++.
6493
6494 @item -Wmissing-attributes
6495 @opindex Wmissing-attributes
6496 @opindex Wno-missing-attributes
6497 Warn when a declaration of a function is missing one or more attributes
6498 that a related function is declared with and whose absence may adversely
6499 affect the correctness or efficiency of generated code. For example,
6500 the warning is issued for declarations of aliases that use attributes
6501 to specify less restrictive requirements than those of their targets.
6502 This typically represents a potential optimization opportunity.
6503 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6504 issued when the alias is more restrictive than the target, which could
6505 lead to incorrect code generation.
6506 Attributes considered include @code{alloc_align}, @code{alloc_size},
6507 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6508 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6509 @code{returns_nonnull}, and @code{returns_twice}.
6510
6511 In C++, the warning is issued when an explicit specialization of a primary
6512 template declared with attribute @code{alloc_align}, @code{alloc_size},
6513 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6514 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6515 @code{error}, and @code{warning} suppress the warning.
6516 (@pxref{Function Attributes}).
6517
6518 You can use the @code{copy} attribute to apply the same
6519 set of attributes to a declaration as that on another declaration without
6520 explicitly enumerating the attributes. This attribute can be applied
6521 to declarations of functions (@pxref{Common Function Attributes}),
6522 variables (@pxref{Common Variable Attributes}), or types
6523 (@pxref{Common Type Attributes}).
6524
6525 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6526
6527 For example, since the declaration of the primary function template
6528 below makes use of both attribute @code{malloc} and @code{alloc_size}
6529 the declaration of the explicit specialization of the template is
6530 diagnosed because it is missing one of the attributes.
6531
6532 @smallexample
6533 template <class T>
6534 T* __attribute__ ((malloc, alloc_size (1)))
6535 allocate (size_t);
6536
6537 template <>
6538 void* __attribute__ ((malloc)) // missing alloc_size
6539 allocate<void> (size_t);
6540 @end smallexample
6541
6542 @item -Wmissing-braces
6543 @opindex Wmissing-braces
6544 @opindex Wno-missing-braces
6545 Warn if an aggregate or union initializer is not fully bracketed. In
6546 the following example, the initializer for @code{a} is not fully
6547 bracketed, but that for @code{b} is fully bracketed.
6548
6549 @smallexample
6550 int a[2][2] = @{ 0, 1, 2, 3 @};
6551 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6552 @end smallexample
6553
6554 This warning is enabled by @option{-Wall}.
6555
6556 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6557 @opindex Wmissing-include-dirs
6558 @opindex Wno-missing-include-dirs
6559 Warn if a user-supplied include directory does not exist. This opions is disabled
6560 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6561 enabled by default by warning for -I and -J, only.
6562
6563 @item -Wno-missing-profile
6564 @opindex Wmissing-profile
6565 @opindex Wno-missing-profile
6566 This option controls warnings if feedback profiles are missing when using the
6567 @option{-fprofile-use} option.
6568 This option diagnoses those cases where a new function or a new file is added
6569 between compiling with @option{-fprofile-generate} and with
6570 @option{-fprofile-use}, without regenerating the profiles.
6571 In these cases, the profile feedback data files do not contain any
6572 profile feedback information for
6573 the newly added function or file respectively. Also, in the case when profile
6574 count data (.gcda) files are removed, GCC cannot use any profile feedback
6575 information. In all these cases, warnings are issued to inform you that a
6576 profile generation step is due.
6577 Ignoring the warning can result in poorly optimized code.
6578 @option{-Wno-missing-profile} can be used to
6579 disable the warning, but this is not recommended and should be done only
6580 when non-existent profile data is justified.
6581
6582 @item -Wmismatched-dealloc
6583 @opindex Wmismatched-dealloc
6584 @opindex Wno-mismatched-dealloc
6585
6586 Warn for calls to deallocation functions with pointer arguments returned
6587 from from allocations functions for which the former isn't a suitable
6588 deallocator. A pair of functions can be associated as matching allocators
6589 and deallocators by use of attribute @code{malloc}. Unless disabled by
6590 the @option{-fno-builtin} option the standard functions @code{calloc},
6591 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6592 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6593 associated as matching allocators and deallocators. In the following
6594 example @code{mydealloc} is the deallocator for pointers returned from
6595 @code{myalloc}.
6596
6597 @smallexample
6598 void mydealloc (void*);
6599
6600 __attribute__ ((malloc (mydealloc, 1))) void*
6601 myalloc (size_t);
6602
6603 void f (void)
6604 @{
6605 void *p = myalloc (32);
6606 // @dots{}use p@dots{}
6607 free (p); // warning: not a matching deallocator for myalloc
6608 mydealloc (p); // ok
6609 @}
6610 @end smallexample
6611
6612 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6613 mismatches involving either @code{operator new} or @code{operator delete}.
6614
6615 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
6616
6617 @item -Wmultistatement-macros
6618 @opindex Wmultistatement-macros
6619 @opindex Wno-multistatement-macros
6620 Warn about unsafe multiple statement macros that appear to be guarded
6621 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6622 @code{while}, in which only the first statement is actually guarded after
6623 the macro is expanded.
6624
6625 For example:
6626
6627 @smallexample
6628 #define DOIT x++; y++
6629 if (c)
6630 DOIT;
6631 @end smallexample
6632
6633 will increment @code{y} unconditionally, not just when @code{c} holds.
6634 The can usually be fixed by wrapping the macro in a do-while loop:
6635 @smallexample
6636 #define DOIT do @{ x++; y++; @} while (0)
6637 if (c)
6638 DOIT;
6639 @end smallexample
6640
6641 This warning is enabled by @option{-Wall} in C and C++.
6642
6643 @item -Wparentheses
6644 @opindex Wparentheses
6645 @opindex Wno-parentheses
6646 Warn if parentheses are omitted in certain contexts, such
6647 as when there is an assignment in a context where a truth value
6648 is expected, or when operators are nested whose precedence people
6649 often get confused about.
6650
6651 Also warn if a comparison like @code{x<=y<=z} appears; this is
6652 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6653 interpretation from that of ordinary mathematical notation.
6654
6655 Also warn for dangerous uses of the GNU extension to
6656 @code{?:} with omitted middle operand. When the condition
6657 in the @code{?}: operator is a boolean expression, the omitted value is
6658 always 1. Often programmers expect it to be a value computed
6659 inside the conditional expression instead.
6660
6661 For C++ this also warns for some cases of unnecessary parentheses in
6662 declarations, which can indicate an attempt at a function call instead
6663 of a declaration:
6664 @smallexample
6665 @{
6666 // Declares a local variable called mymutex.
6667 std::unique_lock<std::mutex> (mymutex);
6668 // User meant std::unique_lock<std::mutex> lock (mymutex);
6669 @}
6670 @end smallexample
6671
6672 This warning is enabled by @option{-Wall}.
6673
6674 @item -Wsequence-point
6675 @opindex Wsequence-point
6676 @opindex Wno-sequence-point
6677 Warn about code that may have undefined semantics because of violations
6678 of sequence point rules in the C and C++ standards.
6679
6680 The C and C++ standards define the order in which expressions in a C/C++
6681 program are evaluated in terms of @dfn{sequence points}, which represent
6682 a partial ordering between the execution of parts of the program: those
6683 executed before the sequence point, and those executed after it. These
6684 occur after the evaluation of a full expression (one which is not part
6685 of a larger expression), after the evaluation of the first operand of a
6686 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6687 function is called (but after the evaluation of its arguments and the
6688 expression denoting the called function), and in certain other places.
6689 Other than as expressed by the sequence point rules, the order of
6690 evaluation of subexpressions of an expression is not specified. All
6691 these rules describe only a partial order rather than a total order,
6692 since, for example, if two functions are called within one expression
6693 with no sequence point between them, the order in which the functions
6694 are called is not specified. However, the standards committee have
6695 ruled that function calls do not overlap.
6696
6697 It is not specified when between sequence points modifications to the
6698 values of objects take effect. Programs whose behavior depends on this
6699 have undefined behavior; the C and C++ standards specify that ``Between
6700 the previous and next sequence point an object shall have its stored
6701 value modified at most once by the evaluation of an expression.
6702 Furthermore, the prior value shall be read only to determine the value
6703 to be stored.''. If a program breaks these rules, the results on any
6704 particular implementation are entirely unpredictable.
6705
6706 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6707 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
6708 diagnosed by this option, and it may give an occasional false positive
6709 result, but in general it has been found fairly effective at detecting
6710 this sort of problem in programs.
6711
6712 The C++17 standard will define the order of evaluation of operands in
6713 more cases: in particular it requires that the right-hand side of an
6714 assignment be evaluated before the left-hand side, so the above
6715 examples are no longer undefined. But this option will still warn
6716 about them, to help people avoid writing code that is undefined in C
6717 and earlier revisions of C++.
6718
6719 The standard is worded confusingly, therefore there is some debate
6720 over the precise meaning of the sequence point rules in subtle cases.
6721 Links to discussions of the problem, including proposed formal
6722 definitions, may be found on the GCC readings page, at
6723 @uref{http://gcc.gnu.org/@/readings.html}.
6724
6725 This warning is enabled by @option{-Wall} for C and C++.
6726
6727 @item -Wno-return-local-addr
6728 @opindex Wno-return-local-addr
6729 @opindex Wreturn-local-addr
6730 Do not warn about returning a pointer (or in C++, a reference) to a
6731 variable that goes out of scope after the function returns.
6732
6733 @item -Wreturn-type
6734 @opindex Wreturn-type
6735 @opindex Wno-return-type
6736 Warn whenever a function is defined with a return type that defaults
6737 to @code{int}. Also warn about any @code{return} statement with no
6738 return value in a function whose return type is not @code{void}
6739 (falling off the end of the function body is considered returning
6740 without a value).
6741
6742 For C only, warn about a @code{return} statement with an expression in a
6743 function whose return type is @code{void}, unless the expression type is
6744 also @code{void}. As a GNU extension, the latter case is accepted
6745 without a warning unless @option{-Wpedantic} is used. Attempting
6746 to use the return value of a non-@code{void} function other than @code{main}
6747 that flows off the end by reaching the closing curly brace that terminates
6748 the function is undefined.
6749
6750 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6751 than @code{main} results in undefined behavior even when the value of
6752 the function is not used.
6753
6754 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6755
6756 @item -Wno-shift-count-negative
6757 @opindex Wshift-count-negative
6758 @opindex Wno-shift-count-negative
6759 Controls warnings if a shift count is negative.
6760 This warning is enabled by default.
6761
6762 @item -Wno-shift-count-overflow
6763 @opindex Wshift-count-overflow
6764 @opindex Wno-shift-count-overflow
6765 Controls warnings if a shift count is greater than or equal to the bit width
6766 of the type. This warning is enabled by default.
6767
6768 @item -Wshift-negative-value
6769 @opindex Wshift-negative-value
6770 @opindex Wno-shift-negative-value
6771 Warn if left shifting a negative value. This warning is enabled by
6772 @option{-Wextra} in C99 and C++11 modes (and newer).
6773
6774 @item -Wno-shift-overflow
6775 @itemx -Wshift-overflow=@var{n}
6776 @opindex Wshift-overflow
6777 @opindex Wno-shift-overflow
6778 These options control warnings about left shift overflows.
6779
6780 @table @gcctabopt
6781 @item -Wshift-overflow=1
6782 This is the warning level of @option{-Wshift-overflow} and is enabled
6783 by default in C99 and C++11 modes (and newer). This warning level does
6784 not warn about left-shifting 1 into the sign bit. (However, in C, such
6785 an overflow is still rejected in contexts where an integer constant expression
6786 is required.) No warning is emitted in C++20 mode (and newer), as signed left
6787 shifts always wrap.
6788
6789 @item -Wshift-overflow=2
6790 This warning level also warns about left-shifting 1 into the sign bit,
6791 unless C++14 mode (or newer) is active.
6792 @end table
6793
6794 @item -Wswitch
6795 @opindex Wswitch
6796 @opindex Wno-switch
6797 Warn whenever a @code{switch} statement has an index of enumerated type
6798 and lacks a @code{case} for one or more of the named codes of that
6799 enumeration. (The presence of a @code{default} label prevents this
6800 warning.) @code{case} labels outside the enumeration range also
6801 provoke warnings when this option is used (even if there is a
6802 @code{default} label).
6803 This warning is enabled by @option{-Wall}.
6804
6805 @item -Wswitch-default
6806 @opindex Wswitch-default
6807 @opindex Wno-switch-default
6808 Warn whenever a @code{switch} statement does not have a @code{default}
6809 case.
6810
6811 @item -Wswitch-enum
6812 @opindex Wswitch-enum
6813 @opindex Wno-switch-enum
6814 Warn whenever a @code{switch} statement has an index of enumerated type
6815 and lacks a @code{case} for one or more of the named codes of that
6816 enumeration. @code{case} labels outside the enumeration range also
6817 provoke warnings when this option is used. The only difference
6818 between @option{-Wswitch} and this option is that this option gives a
6819 warning about an omitted enumeration code even if there is a
6820 @code{default} label.
6821
6822 @item -Wno-switch-bool
6823 @opindex Wswitch-bool
6824 @opindex Wno-switch-bool
6825 Do not warn when a @code{switch} statement has an index of boolean type
6826 and the case values are outside the range of a boolean type.
6827 It is possible to suppress this warning by casting the controlling
6828 expression to a type other than @code{bool}. For example:
6829 @smallexample
6830 @group
6831 switch ((int) (a == 4))
6832 @{
6833 @dots{}
6834 @}
6835 @end group
6836 @end smallexample
6837 This warning is enabled by default for C and C++ programs.
6838
6839 @item -Wno-switch-outside-range
6840 @opindex Wswitch-outside-range
6841 @opindex Wno-switch-outside-range
6842 This option controls warnings when a @code{switch} case has a value
6843 that is outside of its
6844 respective type range. This warning is enabled by default for
6845 C and C++ programs.
6846
6847 @item -Wno-switch-unreachable
6848 @opindex Wswitch-unreachable
6849 @opindex Wno-switch-unreachable
6850 Do not warn when a @code{switch} statement contains statements between the
6851 controlling expression and the first case label, which will never be
6852 executed. For example:
6853 @smallexample
6854 @group
6855 switch (cond)
6856 @{
6857 i = 15;
6858 @dots{}
6859 case 5:
6860 @dots{}
6861 @}
6862 @end group
6863 @end smallexample
6864 @option{-Wswitch-unreachable} does not warn if the statement between the
6865 controlling expression and the first case label is just a declaration:
6866 @smallexample
6867 @group
6868 switch (cond)
6869 @{
6870 int i;
6871 @dots{}
6872 case 5:
6873 i = 5;
6874 @dots{}
6875 @}
6876 @end group
6877 @end smallexample
6878 This warning is enabled by default for C and C++ programs.
6879
6880 @item -Wsync-nand @r{(C and C++ only)}
6881 @opindex Wsync-nand
6882 @opindex Wno-sync-nand
6883 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6884 built-in functions are used. These functions changed semantics in GCC 4.4.
6885
6886 @item -Wunused-but-set-parameter
6887 @opindex Wunused-but-set-parameter
6888 @opindex Wno-unused-but-set-parameter
6889 Warn whenever a function parameter is assigned to, but otherwise unused
6890 (aside from its declaration).
6891
6892 To suppress this warning use the @code{unused} attribute
6893 (@pxref{Variable Attributes}).
6894
6895 This warning is also enabled by @option{-Wunused} together with
6896 @option{-Wextra}.
6897
6898 @item -Wunused-but-set-variable
6899 @opindex Wunused-but-set-variable
6900 @opindex Wno-unused-but-set-variable
6901 Warn whenever a local variable is assigned to, but otherwise unused
6902 (aside from its declaration).
6903 This warning is enabled by @option{-Wall}.
6904
6905 To suppress this warning use the @code{unused} attribute
6906 (@pxref{Variable Attributes}).
6907
6908 This warning is also enabled by @option{-Wunused}, which is enabled
6909 by @option{-Wall}.
6910
6911 @item -Wunused-function
6912 @opindex Wunused-function
6913 @opindex Wno-unused-function
6914 Warn whenever a static function is declared but not defined or a
6915 non-inline static function is unused.
6916 This warning is enabled by @option{-Wall}.
6917
6918 @item -Wunused-label
6919 @opindex Wunused-label
6920 @opindex Wno-unused-label
6921 Warn whenever a label is declared but not used.
6922 This warning is enabled by @option{-Wall}.
6923
6924 To suppress this warning use the @code{unused} attribute
6925 (@pxref{Variable Attributes}).
6926
6927 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6928 @opindex Wunused-local-typedefs
6929 @opindex Wno-unused-local-typedefs
6930 Warn when a typedef locally defined in a function is not used.
6931 This warning is enabled by @option{-Wall}.
6932
6933 @item -Wunused-parameter
6934 @opindex Wunused-parameter
6935 @opindex Wno-unused-parameter
6936 Warn whenever a function parameter is unused aside from its declaration.
6937
6938 To suppress this warning use the @code{unused} attribute
6939 (@pxref{Variable Attributes}).
6940
6941 @item -Wno-unused-result
6942 @opindex Wunused-result
6943 @opindex Wno-unused-result
6944 Do not warn if a caller of a function marked with attribute
6945 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6946 its return value. The default is @option{-Wunused-result}.
6947
6948 @item -Wunused-variable
6949 @opindex Wunused-variable
6950 @opindex Wno-unused-variable
6951 Warn whenever a local or static variable is unused aside from its
6952 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6953 but not for C++. This warning is enabled by @option{-Wall}.
6954
6955 To suppress this warning use the @code{unused} attribute
6956 (@pxref{Variable Attributes}).
6957
6958 @item -Wunused-const-variable
6959 @itemx -Wunused-const-variable=@var{n}
6960 @opindex Wunused-const-variable
6961 @opindex Wno-unused-const-variable
6962 Warn whenever a constant static variable is unused aside from its declaration.
6963 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6964 for C, but not for C++. In C this declares variable storage, but in C++ this
6965 is not an error since const variables take the place of @code{#define}s.
6966
6967 To suppress this warning use the @code{unused} attribute
6968 (@pxref{Variable Attributes}).
6969
6970 @table @gcctabopt
6971 @item -Wunused-const-variable=1
6972 This is the warning level that is enabled by @option{-Wunused-variable} for
6973 C. It warns only about unused static const variables defined in the main
6974 compilation unit, but not about static const variables declared in any
6975 header included.
6976
6977 @item -Wunused-const-variable=2
6978 This warning level also warns for unused constant static variables in
6979 headers (excluding system headers). This is the warning level of
6980 @option{-Wunused-const-variable} and must be explicitly requested since
6981 in C++ this isn't an error and in C it might be harder to clean up all
6982 headers included.
6983 @end table
6984
6985 @item -Wunused-value
6986 @opindex Wunused-value
6987 @opindex Wno-unused-value
6988 Warn whenever a statement computes a result that is explicitly not
6989 used. To suppress this warning cast the unused expression to
6990 @code{void}. This includes an expression-statement or the left-hand
6991 side of a comma expression that contains no side effects. For example,
6992 an expression such as @code{x[i,j]} causes a warning, while
6993 @code{x[(void)i,j]} does not.
6994
6995 This warning is enabled by @option{-Wall}.
6996
6997 @item -Wunused
6998 @opindex Wunused
6999 @opindex Wno-unused
7000 All the above @option{-Wunused} options combined.
7001
7002 In order to get a warning about an unused function parameter, you must
7003 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7004 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7005
7006 @item -Wuninitialized
7007 @opindex Wuninitialized
7008 @opindex Wno-uninitialized
7009 Warn if an object with automatic or allocated storage duration is used
7010 without having been initialized. In C++, also warn if a non-static
7011 reference or non-static @code{const} member appears in a class without
7012 constructors.
7013
7014 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7015 object to a @code{const}-qualified argument of a built-in function known to
7016 read the object is also diagnosed by this warning.
7017 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7018
7019 If you want to warn about code that uses the uninitialized value of the
7020 variable in its own initializer, use the @option{-Winit-self} option.
7021
7022 These warnings occur for individual uninitialized elements of
7023 structure, union or array variables as well as for variables that are
7024 uninitialized as a whole. They do not occur for variables or elements
7025 declared @code{volatile}. Because these warnings depend on
7026 optimization, the exact variables or elements for which there are
7027 warnings depend on the precise optimization options and version of GCC
7028 used.
7029
7030 Note that there may be no warning about a variable that is used only
7031 to compute a value that itself is never used, because such
7032 computations may be deleted by data flow analysis before the warnings
7033 are printed.
7034
7035 In C++, this warning also warns about using uninitialized objects in
7036 member-initializer-lists. For example, GCC warns about @code{b} being
7037 uninitialized in the following snippet:
7038
7039 @smallexample
7040 struct A @{
7041 int a;
7042 int b;
7043 A() : a(b) @{ @}
7044 @};
7045 @end smallexample
7046
7047 @item -Wno-invalid-memory-model
7048 @opindex Winvalid-memory-model
7049 @opindex Wno-invalid-memory-model
7050 This option controls warnings
7051 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7052 and the C11 atomic generic functions with a memory consistency argument
7053 that is either invalid for the operation or outside the range of values
7054 of the @code{memory_order} enumeration. For example, since the
7055 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7056 defined for the relaxed, release, and sequentially consistent memory
7057 orders the following code is diagnosed:
7058
7059 @smallexample
7060 void store (int *i)
7061 @{
7062 __atomic_store_n (i, 0, memory_order_consume);
7063 @}
7064 @end smallexample
7065
7066 @option{-Winvalid-memory-model} is enabled by default.
7067
7068 @item -Wmaybe-uninitialized
7069 @opindex Wmaybe-uninitialized
7070 @opindex Wno-maybe-uninitialized
7071 For an object with automatic or allocated storage duration, if there exists
7072 a path from the function entry to a use of the object that is initialized,
7073 but there exist some other paths for which the object is not initialized,
7074 the compiler emits a warning if it cannot prove the uninitialized paths
7075 are not executed at run time.
7076
7077 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7078 object to a @code{const}-qualified function argument is also diagnosed by
7079 this warning. (@option{-Wuninitialized} is issued for built-in functions
7080 known to read the object.) Annotating the function with attribute
7081 @code{access (none)} indicates that the argument isn't used to access
7082 the object and avoids the warning (@pxref{Common Function Attributes}).
7083
7084 These warnings are only possible in optimizing compilation, because otherwise
7085 GCC does not keep track of the state of variables.
7086
7087 These warnings are made optional because GCC may not be able to determine when
7088 the code is correct in spite of appearing to have an error. Here is one
7089 example of how this can happen:
7090
7091 @smallexample
7092 @group
7093 @{
7094 int x;
7095 switch (y)
7096 @{
7097 case 1: x = 1;
7098 break;
7099 case 2: x = 4;
7100 break;
7101 case 3: x = 5;
7102 @}
7103 foo (x);
7104 @}
7105 @end group
7106 @end smallexample
7107
7108 @noindent
7109 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7110 always initialized, but GCC doesn't know this. To suppress the
7111 warning, you need to provide a default case with assert(0) or
7112 similar code.
7113
7114 @cindex @code{longjmp} warnings
7115 This option also warns when a non-volatile automatic variable might be
7116 changed by a call to @code{longjmp}.
7117 The compiler sees only the calls to @code{setjmp}. It cannot know
7118 where @code{longjmp} will be called; in fact, a signal handler could
7119 call it at any point in the code. As a result, you may get a warning
7120 even when there is in fact no problem because @code{longjmp} cannot
7121 in fact be called at the place that would cause a problem.
7122
7123 Some spurious warnings can be avoided if you declare all the functions
7124 you use that never return as @code{noreturn}. @xref{Function
7125 Attributes}.
7126
7127 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7128
7129 @item -Wunknown-pragmas
7130 @opindex Wunknown-pragmas
7131 @opindex Wno-unknown-pragmas
7132 @cindex warning for unknown pragmas
7133 @cindex unknown pragmas, warning
7134 @cindex pragmas, warning of unknown
7135 Warn when a @code{#pragma} directive is encountered that is not understood by
7136 GCC@. If this command-line option is used, warnings are even issued
7137 for unknown pragmas in system header files. This is not the case if
7138 the warnings are only enabled by the @option{-Wall} command-line option.
7139
7140 @item -Wno-pragmas
7141 @opindex Wno-pragmas
7142 @opindex Wpragmas
7143 Do not warn about misuses of pragmas, such as incorrect parameters,
7144 invalid syntax, or conflicts between pragmas. See also
7145 @option{-Wunknown-pragmas}.
7146
7147 @item -Wno-prio-ctor-dtor
7148 @opindex Wno-prio-ctor-dtor
7149 @opindex Wprio-ctor-dtor
7150 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7151 The use of constructor and destructor attributes allow you to assign a
7152 priority to the constructor/destructor to control its order of execution
7153 before @code{main} is called or after it returns. The priority values must be
7154 greater than 100 as the compiler reserves priority values between 0--100 for
7155 the implementation.
7156
7157 @item -Wstrict-aliasing
7158 @opindex Wstrict-aliasing
7159 @opindex Wno-strict-aliasing
7160 This option is only active when @option{-fstrict-aliasing} is active.
7161 It warns about code that might break the strict aliasing rules that the
7162 compiler is using for optimization. The warning does not catch all
7163 cases, but does attempt to catch the more common pitfalls. It is
7164 included in @option{-Wall}.
7165 It is equivalent to @option{-Wstrict-aliasing=3}
7166
7167 @item -Wstrict-aliasing=n
7168 @opindex Wstrict-aliasing=n
7169 This option is only active when @option{-fstrict-aliasing} is active.
7170 It warns about code that might break the strict aliasing rules that the
7171 compiler is using for optimization.
7172 Higher levels correspond to higher accuracy (fewer false positives).
7173 Higher levels also correspond to more effort, similar to the way @option{-O}
7174 works.
7175 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7176
7177 Level 1: Most aggressive, quick, least accurate.
7178 Possibly useful when higher levels
7179 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7180 false negatives. However, it has many false positives.
7181 Warns for all pointer conversions between possibly incompatible types,
7182 even if never dereferenced. Runs in the front end only.
7183
7184 Level 2: Aggressive, quick, not too precise.
7185 May still have many false positives (not as many as level 1 though),
7186 and few false negatives (but possibly more than level 1).
7187 Unlike level 1, it only warns when an address is taken. Warns about
7188 incomplete types. Runs in the front end only.
7189
7190 Level 3 (default for @option{-Wstrict-aliasing}):
7191 Should have very few false positives and few false
7192 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
7193 Takes care of the common pun+dereference pattern in the front end:
7194 @code{*(int*)&some_float}.
7195 If optimization is enabled, it also runs in the back end, where it deals
7196 with multiple statement cases using flow-sensitive points-to information.
7197 Only warns when the converted pointer is dereferenced.
7198 Does not warn about incomplete types.
7199
7200 @item -Wstrict-overflow
7201 @itemx -Wstrict-overflow=@var{n}
7202 @opindex Wstrict-overflow
7203 @opindex Wno-strict-overflow
7204 This option is only active when signed overflow is undefined.
7205 It warns about cases where the compiler optimizes based on the
7206 assumption that signed overflow does not occur. Note that it does not
7207 warn about all cases where the code might overflow: it only warns
7208 about cases where the compiler implements some optimization. Thus
7209 this warning depends on the optimization level.
7210
7211 An optimization that assumes that signed overflow does not occur is
7212 perfectly safe if the values of the variables involved are such that
7213 overflow never does, in fact, occur. Therefore this warning can
7214 easily give a false positive: a warning about code that is not
7215 actually a problem. To help focus on important issues, several
7216 warning levels are defined. No warnings are issued for the use of
7217 undefined signed overflow when estimating how many iterations a loop
7218 requires, in particular when determining whether a loop will be
7219 executed at all.
7220
7221 @table @gcctabopt
7222 @item -Wstrict-overflow=1
7223 Warn about cases that are both questionable and easy to avoid. For
7224 example the compiler simplifies
7225 @code{x + 1 > x} to @code{1}. This level of
7226 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7227 are not, and must be explicitly requested.
7228
7229 @item -Wstrict-overflow=2
7230 Also warn about other cases where a comparison is simplified to a
7231 constant. For example: @code{abs (x) >= 0}. This can only be
7232 simplified when signed integer overflow is undefined, because
7233 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7234 zero. @option{-Wstrict-overflow} (with no level) is the same as
7235 @option{-Wstrict-overflow=2}.
7236
7237 @item -Wstrict-overflow=3
7238 Also warn about other cases where a comparison is simplified. For
7239 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7240
7241 @item -Wstrict-overflow=4
7242 Also warn about other simplifications not covered by the above cases.
7243 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7244
7245 @item -Wstrict-overflow=5
7246 Also warn about cases where the compiler reduces the magnitude of a
7247 constant involved in a comparison. For example: @code{x + 2 > y} is
7248 simplified to @code{x + 1 >= y}. This is reported only at the
7249 highest warning level because this simplification applies to many
7250 comparisons, so this warning level gives a very large number of
7251 false positives.
7252 @end table
7253
7254 @item -Wstring-compare
7255 @opindex Wstring-compare
7256 @opindex Wno-string-compare
7257 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7258 determined to be either zero or non-zero in tests for such equality
7259 owing to the length of one argument being greater than the size of
7260 the array the other argument is stored in (or the bound in the case
7261 of @code{strncmp}). Such calls could be mistakes. For example,
7262 the call to @code{strcmp} below is diagnosed because its result is
7263 necessarily non-zero irrespective of the contents of the array @code{a}.
7264
7265 @smallexample
7266 extern char a[4];
7267 void f (char *d)
7268 @{
7269 strcpy (d, "string");
7270 @dots{}
7271 if (0 == strcmp (a, d)) // cannot be true
7272 puts ("a and d are the same");
7273 @}
7274 @end smallexample
7275
7276 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7277
7278 @item -Wno-stringop-overflow
7279 @item -Wstringop-overflow
7280 @itemx -Wstringop-overflow=@var{type}
7281 @opindex Wstringop-overflow
7282 @opindex Wno-stringop-overflow
7283 Warn for calls to string manipulation functions such as @code{memcpy} and
7284 @code{strcpy} that are determined to overflow the destination buffer. The
7285 optional argument is one greater than the type of Object Size Checking to
7286 perform to determine the size of the destination. @xref{Object Size Checking}.
7287 The argument is meaningful only for functions that operate on character arrays
7288 but not for raw memory functions like @code{memcpy} which always make use
7289 of Object Size type-0. The option also warns for calls that specify a size
7290 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7291 The option produces the best results with optimization enabled but can detect
7292 a small subset of simple buffer overflows even without optimization in
7293 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7294 correspond to the standard functions. In any case, the option warns about
7295 just a subset of buffer overflows detected by the corresponding overflow
7296 checking built-ins. For example, the option issues a warning for
7297 the @code{strcpy} call below because it copies at least 5 characters
7298 (the string @code{"blue"} including the terminating NUL) into the buffer
7299 of size 4.
7300
7301 @smallexample
7302 enum Color @{ blue, purple, yellow @};
7303 const char* f (enum Color clr)
7304 @{
7305 static char buf [4];
7306 const char *str;
7307 switch (clr)
7308 @{
7309 case blue: str = "blue"; break;
7310 case purple: str = "purple"; break;
7311 case yellow: str = "yellow"; break;
7312 @}
7313
7314 return strcpy (buf, str); // warning here
7315 @}
7316 @end smallexample
7317
7318 Option @option{-Wstringop-overflow=2} is enabled by default.
7319
7320 @table @gcctabopt
7321 @item -Wstringop-overflow
7322 @itemx -Wstringop-overflow=1
7323 @opindex Wstringop-overflow
7324 @opindex Wno-stringop-overflow
7325 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7326 to determine the sizes of destination objects. At this setting the option
7327 does not warn for writes past the end of subobjects of larger objects accessed
7328 by pointers unless the size of the largest surrounding object is known. When
7329 the destination may be one of several objects it is assumed to be the largest
7330 one of them. On Linux systems, when optimization is enabled at this setting
7331 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7332 is defined to a non-zero value.
7333
7334 @item -Wstringop-overflow=2
7335 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7336 to determine the sizes of destination objects. At this setting the option
7337 warns about overflows when writing to members of the largest complete
7338 objects whose exact size is known. However, it does not warn for excessive
7339 writes to the same members of unknown objects referenced by pointers since
7340 they may point to arrays containing unknown numbers of elements. This is
7341 the default setting of the option.
7342
7343 @item -Wstringop-overflow=3
7344 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7345 to determine the sizes of destination objects. At this setting the option
7346 warns about overflowing the smallest object or data member. This is the
7347 most restrictive setting of the option that may result in warnings for safe
7348 code.
7349
7350 @item -Wstringop-overflow=4
7351 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7352 to determine the sizes of destination objects. At this setting the option
7353 warns about overflowing any data members, and when the destination is
7354 one of several objects it uses the size of the largest of them to decide
7355 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
7356 setting of the option may result in warnings for benign code.
7357 @end table
7358
7359 @item -Wno-stringop-overread
7360 @opindex Wstringop-overread
7361 @opindex Wno-stringop-overread
7362 Warn for calls to string manipulation functions such as @code{memchr}, or
7363 @code{strcpy} that are determined to read past the end of the source
7364 sequence.
7365
7366 Option @option{-Wstringop-overread} is enabled by default.
7367
7368 @item -Wno-stringop-truncation
7369 @opindex Wstringop-truncation
7370 @opindex Wno-stringop-truncation
7371 Do not warn for calls to bounded string manipulation functions
7372 such as @code{strncat},
7373 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7374 or leave the destination unchanged.
7375
7376 In the following example, the call to @code{strncat} specifies a bound that
7377 is less than the length of the source string. As a result, the copy of
7378 the source will be truncated and so the call is diagnosed. To avoid the
7379 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7380
7381 @smallexample
7382 void append (char *buf, size_t bufsize)
7383 @{
7384 strncat (buf, ".txt", 3);
7385 @}
7386 @end smallexample
7387
7388 As another example, the following call to @code{strncpy} results in copying
7389 to @code{d} just the characters preceding the terminating NUL, without
7390 appending the NUL to the end. Assuming the result of @code{strncpy} is
7391 necessarily a NUL-terminated string is a common mistake, and so the call
7392 is diagnosed. To avoid the warning when the result is not expected to be
7393 NUL-terminated, call @code{memcpy} instead.
7394
7395 @smallexample
7396 void copy (char *d, const char *s)
7397 @{
7398 strncpy (d, s, strlen (s));
7399 @}
7400 @end smallexample
7401
7402 In the following example, the call to @code{strncpy} specifies the size
7403 of the destination buffer as the bound. If the length of the source
7404 string is equal to or greater than this size the result of the copy will
7405 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
7406 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7407 element of the buffer to @code{NUL}.
7408
7409 @smallexample
7410 void copy (const char *s)
7411 @{
7412 char buf[80];
7413 strncpy (buf, s, sizeof buf);
7414 @dots{}
7415 @}
7416 @end smallexample
7417
7418 In situations where a character array is intended to store a sequence
7419 of bytes with no terminating @code{NUL} such an array may be annotated
7420 with attribute @code{nonstring} to avoid this warning. Such arrays,
7421 however, are not suitable arguments to functions that expect
7422 @code{NUL}-terminated strings. To help detect accidental misuses of
7423 such arrays GCC issues warnings unless it can prove that the use is
7424 safe. @xref{Common Variable Attributes}.
7425
7426 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7427 @opindex Wsuggest-attribute=
7428 @opindex Wno-suggest-attribute=
7429 Warn for cases where adding an attribute may be beneficial. The
7430 attributes currently supported are listed below.
7431
7432 @table @gcctabopt
7433 @item -Wsuggest-attribute=pure
7434 @itemx -Wsuggest-attribute=const
7435 @itemx -Wsuggest-attribute=noreturn
7436 @itemx -Wmissing-noreturn
7437 @itemx -Wsuggest-attribute=malloc
7438 @opindex Wsuggest-attribute=pure
7439 @opindex Wno-suggest-attribute=pure
7440 @opindex Wsuggest-attribute=const
7441 @opindex Wno-suggest-attribute=const
7442 @opindex Wsuggest-attribute=noreturn
7443 @opindex Wno-suggest-attribute=noreturn
7444 @opindex Wmissing-noreturn
7445 @opindex Wno-missing-noreturn
7446 @opindex Wsuggest-attribute=malloc
7447 @opindex Wno-suggest-attribute=malloc
7448
7449 Warn about functions that might be candidates for attributes
7450 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7451 only warns for functions visible in other compilation units or (in the case of
7452 @code{pure} and @code{const}) if it cannot prove that the function returns
7453 normally. A function returns normally if it doesn't contain an infinite loop or
7454 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7455 requires option @option{-fipa-pure-const}, which is enabled by default at
7456 @option{-O} and higher. Higher optimization levels improve the accuracy
7457 of the analysis.
7458
7459 @item -Wsuggest-attribute=format
7460 @itemx -Wmissing-format-attribute
7461 @opindex Wsuggest-attribute=format
7462 @opindex Wmissing-format-attribute
7463 @opindex Wno-suggest-attribute=format
7464 @opindex Wno-missing-format-attribute
7465 @opindex Wformat
7466 @opindex Wno-format
7467
7468 Warn about function pointers that might be candidates for @code{format}
7469 attributes. Note these are only possible candidates, not absolute ones.
7470 GCC guesses that function pointers with @code{format} attributes that
7471 are used in assignment, initialization, parameter passing or return
7472 statements should have a corresponding @code{format} attribute in the
7473 resulting type. I.e.@: the left-hand side of the assignment or
7474 initialization, the type of the parameter variable, or the return type
7475 of the containing function respectively should also have a @code{format}
7476 attribute to avoid the warning.
7477
7478 GCC also warns about function definitions that might be
7479 candidates for @code{format} attributes. Again, these are only
7480 possible candidates. GCC guesses that @code{format} attributes
7481 might be appropriate for any function that calls a function like
7482 @code{vprintf} or @code{vscanf}, but this might not always be the
7483 case, and some functions for which @code{format} attributes are
7484 appropriate may not be detected.
7485
7486 @item -Wsuggest-attribute=cold
7487 @opindex Wsuggest-attribute=cold
7488 @opindex Wno-suggest-attribute=cold
7489
7490 Warn about functions that might be candidates for @code{cold} attribute. This
7491 is based on static detection and generally only warns about functions which
7492 always leads to a call to another @code{cold} function such as wrappers of
7493 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7494 @end table
7495
7496 @item -Walloc-zero
7497 @opindex Wno-alloc-zero
7498 @opindex Walloc-zero
7499 Warn about calls to allocation functions decorated with attribute
7500 @code{alloc_size} that specify zero bytes, including those to the built-in
7501 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7502 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7503 when called with a zero size differs among implementations (and in the case
7504 of @code{realloc} has been deprecated) relying on it may result in subtle
7505 portability bugs and should be avoided.
7506
7507 @item -Walloc-size-larger-than=@var{byte-size}
7508 @opindex Walloc-size-larger-than=
7509 @opindex Wno-alloc-size-larger-than
7510 Warn about calls to functions decorated with attribute @code{alloc_size}
7511 that attempt to allocate objects larger than the specified number of bytes,
7512 or where the result of the size computation in an integer type with infinite
7513 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7514 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7515 Warnings controlled by the option can be disabled either by specifying
7516 @var{byte-size} of @samp{SIZE_MAX} or more or by
7517 @option{-Wno-alloc-size-larger-than}.
7518 @xref{Function Attributes}.
7519
7520 @item -Wno-alloc-size-larger-than
7521 @opindex Wno-alloc-size-larger-than
7522 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7523 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7524 larger.
7525
7526 @item -Walloca
7527 @opindex Wno-alloca
7528 @opindex Walloca
7529 This option warns on all uses of @code{alloca} in the source.
7530
7531 @item -Walloca-larger-than=@var{byte-size}
7532 @opindex Walloca-larger-than=
7533 @opindex Wno-alloca-larger-than
7534 This option warns on calls to @code{alloca} with an integer argument whose
7535 value is either zero, or that is not bounded by a controlling predicate
7536 that limits its value to at most @var{byte-size}. It also warns for calls
7537 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7538 types are considered unbounded even if they appear to be constrained to
7539 the expected range.
7540
7541 For example, a bounded case of @code{alloca} could be:
7542
7543 @smallexample
7544 void func (size_t n)
7545 @{
7546 void *p;
7547 if (n <= 1000)
7548 p = alloca (n);
7549 else
7550 p = malloc (n);
7551 f (p);
7552 @}
7553 @end smallexample
7554
7555 In the above example, passing @code{-Walloca-larger-than=1000} would not
7556 issue a warning because the call to @code{alloca} is known to be at most
7557 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7558 the compiler would emit a warning.
7559
7560 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7561 controlling predicate constraining its integer argument. For example:
7562
7563 @smallexample
7564 void func ()
7565 @{
7566 void *p = alloca (n);
7567 f (p);
7568 @}
7569 @end smallexample
7570
7571 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7572 a warning, but this time because of the lack of bounds checking.
7573
7574 Note, that even seemingly correct code involving signed integers could
7575 cause a warning:
7576
7577 @smallexample
7578 void func (signed int n)
7579 @{
7580 if (n < 500)
7581 @{
7582 p = alloca (n);
7583 f (p);
7584 @}
7585 @}
7586 @end smallexample
7587
7588 In the above example, @var{n} could be negative, causing a larger than
7589 expected argument to be implicitly cast into the @code{alloca} call.
7590
7591 This option also warns when @code{alloca} is used in a loop.
7592
7593 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7594 but is usually only effective when @option{-ftree-vrp} is active (default
7595 for @option{-O2} and above).
7596
7597 See also @option{-Wvla-larger-than=}@samp{byte-size}.
7598
7599 @item -Wno-alloca-larger-than
7600 @opindex Wno-alloca-larger-than
7601 Disable @option{-Walloca-larger-than=} warnings. The option is
7602 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7603
7604 @item -Warith-conversion
7605 @opindex Warith-conversion
7606 @opindex Wno-arith-conversion
7607 Do warn about implicit conversions from arithmetic operations even
7608 when conversion of the operands to the same type cannot change their
7609 values. This affects warnings from @option{-Wconversion},
7610 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7611
7612 @smallexample
7613 @group
7614 void f (char c, int i)
7615 @{
7616 c = c + i; // warns with @option{-Wconversion}
7617 c = c + 1; // only warns with @option{-Warith-conversion}
7618 @}
7619 @end group
7620 @end smallexample
7621
7622 @item -Warray-bounds
7623 @itemx -Warray-bounds=@var{n}
7624 @opindex Wno-array-bounds
7625 @opindex Warray-bounds
7626 This option is only active when @option{-ftree-vrp} is active
7627 (default for @option{-O2} and above). It warns about subscripts to arrays
7628 that are always out of bounds. This warning is enabled by @option{-Wall}.
7629
7630 @table @gcctabopt
7631 @item -Warray-bounds=1
7632 This is the warning level of @option{-Warray-bounds} and is enabled
7633 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7634
7635 @item -Warray-bounds=2
7636 This warning level also warns about out of bounds access for
7637 arrays at the end of a struct and for arrays accessed through
7638 pointers. This warning level may give a larger number of
7639 false positives and is deactivated by default.
7640 @end table
7641
7642 @item -Warray-compare
7643 @opindex Warray-compare
7644 @opindex Wno-array-compare
7645 Warn about equality and relational comparisons between two operands of array
7646 type. This comparison was deprecated in C++20. For example:
7647
7648 @smallexample
7649 int arr1[5];
7650 int arr2[5];
7651 bool same = arr1 == arr2;
7652 @end smallexample
7653
7654 @option{-Warray-compare} is enabled by @option{-Wall}.
7655
7656 @item -Warray-parameter
7657 @itemx -Warray-parameter=@var{n}
7658 @opindex Wno-array-parameter
7659 Warn about redeclarations of functions involving arguments of array or
7660 pointer types of inconsistent kinds or forms, and enable the detection
7661 of out-of-bounds accesses to such parameters by warnings such as
7662 @option{-Warray-bounds}.
7663
7664 If the first function declaration uses the array form the bound specified
7665 in the array is assumed to be the minimum number of elements expected to
7666 be provided in calls to the function and the maximum number of elements
7667 accessed by it. Failing to provide arguments of sufficient size or accessing
7668 more than the maximum number of elements may be diagnosed by warnings such
7669 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
7670 involving array parameters declared using the @code{T[static N]} form.
7671
7672 For example, the warning triggers for the following redeclarations because
7673 the first one allows an array of any size to be passed to @code{f} while
7674 the second one with the keyword @code{static} specifies that the array
7675 argument must have at least four elements.
7676
7677 @smallexample
7678 void f (int[static 4]);
7679 void f (int[]); // warning (inconsistent array form)
7680
7681 void g (void)
7682 @{
7683 int *p = (int *)malloc (4);
7684 f (p); // warning (array too small)
7685 @dots{}
7686 @}
7687 @end smallexample
7688
7689 At level 2 the warning also triggers for redeclarations involving any other
7690 inconsistency in array or pointer argument forms denoting array sizes.
7691 Pointers and arrays of unspecified bound are considered equivalent and do
7692 not trigger a warning.
7693
7694 @smallexample
7695 void g (int*);
7696 void g (int[]); // no warning
7697 void g (int[8]); // warning (inconsistent array bound)
7698 @end smallexample
7699
7700 @option{-Warray-parameter=2} is included in @option{-Wall}. The
7701 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
7702 involving Variable Length Array arguments.
7703
7704 @item -Wattribute-alias=@var{n}
7705 @itemx -Wno-attribute-alias
7706 @opindex Wattribute-alias
7707 @opindex Wno-attribute-alias
7708 Warn about declarations using the @code{alias} and similar attributes whose
7709 target is incompatible with the type of the alias.
7710 @xref{Function Attributes,,Declaring Attributes of Functions}.
7711
7712 @table @gcctabopt
7713 @item -Wattribute-alias=1
7714 The default warning level of the @option{-Wattribute-alias} option diagnoses
7715 incompatibilities between the type of the alias declaration and that of its
7716 target. Such incompatibilities are typically indicative of bugs.
7717
7718 @item -Wattribute-alias=2
7719
7720 At this level @option{-Wattribute-alias} also diagnoses cases where
7721 the attributes of the alias declaration are more restrictive than the
7722 attributes applied to its target. These mismatches can potentially
7723 result in incorrect code generation. In other cases they may be
7724 benign and could be resolved simply by adding the missing attribute to
7725 the target. For comparison, see the @option{-Wmissing-attributes}
7726 option, which controls diagnostics when the alias declaration is less
7727 restrictive than the target, rather than more restrictive.
7728
7729 Attributes considered include @code{alloc_align}, @code{alloc_size},
7730 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7731 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7732 @code{returns_nonnull}, and @code{returns_twice}.
7733 @end table
7734
7735 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7736 This is the default. You can disable these warnings with either
7737 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7738
7739 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]}
7740 @opindex Wbidi-chars=
7741 @opindex Wbidi-chars
7742 @opindex Wno-bidi-chars
7743 Warn about possibly misleading UTF-8 bidirectional control characters in
7744 comments, string literals, character constants, and identifiers. Such
7745 characters can change left-to-right writing direction into right-to-left
7746 (and vice versa), which can cause confusion between the logical order and
7747 visual order. This may be dangerous; for instance, it may seem that a piece
7748 of code is not commented out, whereas it in fact is.
7749
7750 There are three levels of warning supported by GCC@. The default is
7751 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
7752 bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
7753 @option{-Wbidi-chars=any} warns about any use of bidirectional control
7754 characters.
7755
7756 @item -Wbool-compare
7757 @opindex Wno-bool-compare
7758 @opindex Wbool-compare
7759 Warn about boolean expression compared with an integer value different from
7760 @code{true}/@code{false}. For instance, the following comparison is
7761 always false:
7762 @smallexample
7763 int n = 5;
7764 @dots{}
7765 if ((n > 1) == 2) @{ @dots{} @}
7766 @end smallexample
7767 This warning is enabled by @option{-Wall}.
7768
7769 @item -Wbool-operation
7770 @opindex Wno-bool-operation
7771 @opindex Wbool-operation
7772 Warn about suspicious operations on expressions of a boolean type. For
7773 instance, bitwise negation of a boolean is very likely a bug in the program.
7774 For C, this warning also warns about incrementing or decrementing a boolean,
7775 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
7776 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7777
7778 This warning is enabled by @option{-Wall}.
7779
7780 @item -Wduplicated-branches
7781 @opindex Wno-duplicated-branches
7782 @opindex Wduplicated-branches
7783 Warn when an if-else has identical branches. This warning detects cases like
7784 @smallexample
7785 if (p != NULL)
7786 return 0;
7787 else
7788 return 0;
7789 @end smallexample
7790 It doesn't warn when both branches contain just a null statement. This warning
7791 also warn for conditional operators:
7792 @smallexample
7793 int i = x ? *p : *p;
7794 @end smallexample
7795
7796 @item -Wduplicated-cond
7797 @opindex Wno-duplicated-cond
7798 @opindex Wduplicated-cond
7799 Warn about duplicated conditions in an if-else-if chain. For instance,
7800 warn for the following code:
7801 @smallexample
7802 if (p->q != NULL) @{ @dots{} @}
7803 else if (p->q != NULL) @{ @dots{} @}
7804 @end smallexample
7805
7806 @item -Wframe-address
7807 @opindex Wno-frame-address
7808 @opindex Wframe-address
7809 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7810 is called with an argument greater than 0. Such calls may return indeterminate
7811 values or crash the program. The warning is included in @option{-Wall}.
7812
7813 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7814 @opindex Wno-discarded-qualifiers
7815 @opindex Wdiscarded-qualifiers
7816 Do not warn if type qualifiers on pointers are being discarded.
7817 Typically, the compiler warns if a @code{const char *} variable is
7818 passed to a function that takes a @code{char *} parameter. This option
7819 can be used to suppress such a warning.
7820
7821 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7822 @opindex Wno-discarded-array-qualifiers
7823 @opindex Wdiscarded-array-qualifiers
7824 Do not warn if type qualifiers on arrays which are pointer targets
7825 are being discarded. Typically, the compiler warns if a
7826 @code{const int (*)[]} variable is passed to a function that
7827 takes a @code{int (*)[]} parameter. This option can be used to
7828 suppress such a warning.
7829
7830 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7831 @opindex Wno-incompatible-pointer-types
7832 @opindex Wincompatible-pointer-types
7833 Do not warn when there is a conversion between pointers that have incompatible
7834 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
7835 which warns for pointer argument passing or assignment with different
7836 signedness.
7837
7838 @item -Wno-int-conversion @r{(C and Objective-C only)}
7839 @opindex Wno-int-conversion
7840 @opindex Wint-conversion
7841 Do not warn about incompatible integer to pointer and pointer to integer
7842 conversions. This warning is about implicit conversions; for explicit
7843 conversions the warnings @option{-Wno-int-to-pointer-cast} and
7844 @option{-Wno-pointer-to-int-cast} may be used.
7845
7846 @item -Wzero-length-bounds
7847 @opindex Wzero-length-bounds
7848 @opindex Wzero-length-bounds
7849 Warn about accesses to elements of zero-length array members that might
7850 overlap other members of the same object. Declaring interior zero-length
7851 arrays is discouraged because accesses to them are undefined. See
7852 @xref{Zero Length}.
7853
7854 For example, the first two stores in function @code{bad} are diagnosed
7855 because the array elements overlap the subsequent members @code{b} and
7856 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
7857 because it is beyond the bounds of the enclosing object.
7858
7859 @smallexample
7860 struct X @{ int a[0]; int b, c; @};
7861 struct X x;
7862
7863 void bad (void)
7864 @{
7865 x.a[0] = 0; // -Wzero-length-bounds
7866 x.a[1] = 1; // -Wzero-length-bounds
7867 x.a[2] = 2; // -Warray-bounds
7868 @}
7869 @end smallexample
7870
7871 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7872
7873 @item -Wno-div-by-zero
7874 @opindex Wno-div-by-zero
7875 @opindex Wdiv-by-zero
7876 Do not warn about compile-time integer division by zero. Floating-point
7877 division by zero is not warned about, as it can be a legitimate way of
7878 obtaining infinities and NaNs.
7879
7880 @item -Wsystem-headers
7881 @opindex Wsystem-headers
7882 @opindex Wno-system-headers
7883 @cindex warnings from system headers
7884 @cindex system headers, warnings from
7885 Print warning messages for constructs found in system header files.
7886 Warnings from system headers are normally suppressed, on the assumption
7887 that they usually do not indicate real problems and would only make the
7888 compiler output harder to read. Using this command-line option tells
7889 GCC to emit warnings from system headers as if they occurred in user
7890 code. However, note that using @option{-Wall} in conjunction with this
7891 option does @emph{not} warn about unknown pragmas in system
7892 headers---for that, @option{-Wunknown-pragmas} must also be used.
7893
7894 @item -Wtautological-compare
7895 @opindex Wtautological-compare
7896 @opindex Wno-tautological-compare
7897 Warn if a self-comparison always evaluates to true or false. This
7898 warning detects various mistakes such as:
7899 @smallexample
7900 int i = 1;
7901 @dots{}
7902 if (i > i) @{ @dots{} @}
7903 @end smallexample
7904
7905 This warning also warns about bitwise comparisons that always evaluate
7906 to true or false, for instance:
7907 @smallexample
7908 if ((a & 16) == 10) @{ @dots{} @}
7909 @end smallexample
7910 will always be false.
7911
7912 This warning is enabled by @option{-Wall}.
7913
7914 @item -Wtrampolines
7915 @opindex Wtrampolines
7916 @opindex Wno-trampolines
7917 Warn about trampolines generated for pointers to nested functions.
7918 A trampoline is a small piece of data or code that is created at run
7919 time on the stack when the address of a nested function is taken, and is
7920 used to call the nested function indirectly. For some targets, it is
7921 made up of data only and thus requires no special treatment. But, for
7922 most targets, it is made up of code and thus requires the stack to be
7923 made executable in order for the program to work properly.
7924
7925 @item -Wfloat-equal
7926 @opindex Wfloat-equal
7927 @opindex Wno-float-equal
7928 Warn if floating-point values are used in equality comparisons.
7929
7930 The idea behind this is that sometimes it is convenient (for the
7931 programmer) to consider floating-point values as approximations to
7932 infinitely precise real numbers. If you are doing this, then you need
7933 to compute (by analyzing the code, or in some other way) the maximum or
7934 likely maximum error that the computation introduces, and allow for it
7935 when performing comparisons (and when producing output, but that's a
7936 different problem). In particular, instead of testing for equality, you
7937 should check to see whether the two values have ranges that overlap; and
7938 this is done with the relational operators, so equality comparisons are
7939 probably mistaken.
7940
7941 @item -Wtraditional @r{(C and Objective-C only)}
7942 @opindex Wtraditional
7943 @opindex Wno-traditional
7944 Warn about certain constructs that behave differently in traditional and
7945 ISO C@. Also warn about ISO C constructs that have no traditional C
7946 equivalent, and/or problematic constructs that should be avoided.
7947
7948 @itemize @bullet
7949 @item
7950 Macro parameters that appear within string literals in the macro body.
7951 In traditional C macro replacement takes place within string literals,
7952 but in ISO C it does not.
7953
7954 @item
7955 In traditional C, some preprocessor directives did not exist.
7956 Traditional preprocessors only considered a line to be a directive
7957 if the @samp{#} appeared in column 1 on the line. Therefore
7958 @option{-Wtraditional} warns about directives that traditional C
7959 understands but ignores because the @samp{#} does not appear as the
7960 first character on the line. It also suggests you hide directives like
7961 @code{#pragma} not understood by traditional C by indenting them. Some
7962 traditional implementations do not recognize @code{#elif}, so this option
7963 suggests avoiding it altogether.
7964
7965 @item
7966 A function-like macro that appears without arguments.
7967
7968 @item
7969 The unary plus operator.
7970
7971 @item
7972 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7973 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
7974 constants.) Note, these suffixes appear in macros defined in the system
7975 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7976 Use of these macros in user code might normally lead to spurious
7977 warnings, however GCC's integrated preprocessor has enough context to
7978 avoid warning in these cases.
7979
7980 @item
7981 A function declared external in one block and then used after the end of
7982 the block.
7983
7984 @item
7985 A @code{switch} statement has an operand of type @code{long}.
7986
7987 @item
7988 A non-@code{static} function declaration follows a @code{static} one.
7989 This construct is not accepted by some traditional C compilers.
7990
7991 @item
7992 The ISO type of an integer constant has a different width or
7993 signedness from its traditional type. This warning is only issued if
7994 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
7995 typically represent bit patterns, are not warned about.
7996
7997 @item
7998 Usage of ISO string concatenation is detected.
7999
8000 @item
8001 Initialization of automatic aggregates.
8002
8003 @item
8004 Identifier conflicts with labels. Traditional C lacks a separate
8005 namespace for labels.
8006
8007 @item
8008 Initialization of unions. If the initializer is zero, the warning is
8009 omitted. This is done under the assumption that the zero initializer in
8010 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8011 initializer warnings and relies on default initialization to zero in the
8012 traditional C case.
8013
8014 @item
8015 Conversions by prototypes between fixed/floating-point values and vice
8016 versa. The absence of these prototypes when compiling with traditional
8017 C causes serious problems. This is a subset of the possible
8018 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8019
8020 @item
8021 Use of ISO C style function definitions. This warning intentionally is
8022 @emph{not} issued for prototype declarations or variadic functions
8023 because these ISO C features appear in your code when using
8024 libiberty's traditional C compatibility macros, @code{PARAMS} and
8025 @code{VPARAMS}. This warning is also bypassed for nested functions
8026 because that feature is already a GCC extension and thus not relevant to
8027 traditional C compatibility.
8028 @end itemize
8029
8030 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8031 @opindex Wtraditional-conversion
8032 @opindex Wno-traditional-conversion
8033 Warn if a prototype causes a type conversion that is different from what
8034 would happen to the same argument in the absence of a prototype. This
8035 includes conversions of fixed point to floating and vice versa, and
8036 conversions changing the width or signedness of a fixed-point argument
8037 except when the same as the default promotion.
8038
8039 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8040 @opindex Wdeclaration-after-statement
8041 @opindex Wno-declaration-after-statement
8042 Warn when a declaration is found after a statement in a block. This
8043 construct, known from C++, was introduced with ISO C99 and is by default
8044 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
8045
8046 @item -Wshadow
8047 @opindex Wshadow
8048 @opindex Wno-shadow
8049 Warn whenever a local variable or type declaration shadows another
8050 variable, parameter, type, class member (in C++), or instance variable
8051 (in Objective-C) or whenever a built-in function is shadowed. Note
8052 that in C++, the compiler warns if a local variable shadows an
8053 explicit typedef, but not if it shadows a struct/class/enum.
8054 If this warning is enabled, it includes also all instances of
8055 local shadowing. This means that @option{-Wno-shadow=local}
8056 and @option{-Wno-shadow=compatible-local} are ignored when
8057 @option{-Wshadow} is used.
8058 Same as @option{-Wshadow=global}.
8059
8060 @item -Wno-shadow-ivar @r{(Objective-C only)}
8061 @opindex Wno-shadow-ivar
8062 @opindex Wshadow-ivar
8063 Do not warn whenever a local variable shadows an instance variable in an
8064 Objective-C method.
8065
8066 @item -Wshadow=global
8067 @opindex Wshadow=global
8068 Warn for any shadowing.
8069 Same as @option{-Wshadow}.
8070
8071 @item -Wshadow=local
8072 @opindex Wshadow=local
8073 Warn when a local variable shadows another local variable or parameter.
8074
8075 @item -Wshadow=compatible-local
8076 @opindex Wshadow=compatible-local
8077 Warn when a local variable shadows another local variable or parameter
8078 whose type is compatible with that of the shadowing variable. In C++,
8079 type compatibility here means the type of the shadowing variable can be
8080 converted to that of the shadowed variable. The creation of this flag
8081 (in addition to @option{-Wshadow=local}) is based on the idea that when
8082 a local variable shadows another one of incompatible type, it is most
8083 likely intentional, not a bug or typo, as shown in the following example:
8084
8085 @smallexample
8086 @group
8087 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8088 @{
8089 for (int i = 0; i < N; ++i)
8090 @{
8091 ...
8092 @}
8093 ...
8094 @}
8095 @end group
8096 @end smallexample
8097
8098 Since the two variable @code{i} in the example above have incompatible types,
8099 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8100 Because their types are incompatible, if a programmer accidentally uses one
8101 in place of the other, type checking is expected to catch that and emit an
8102 error or warning. Use of this flag instead of @option{-Wshadow=local} can
8103 possibly reduce the number of warnings triggered by intentional shadowing.
8104 Note that this also means that shadowing @code{const char *i} by
8105 @code{char *i} does not emit a warning.
8106
8107 This warning is also enabled by @option{-Wshadow=local}.
8108
8109 @item -Wlarger-than=@var{byte-size}
8110 @opindex Wlarger-than=
8111 @opindex Wlarger-than-@var{byte-size}
8112 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8113 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8114 Warnings controlled by the option can be disabled either by specifying
8115 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8116
8117 Also warn for calls to bounded functions such as @code{memchr} or
8118 @code{strnlen} that specify a bound greater than the largest possible
8119 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
8120 can only be disabled by @option{-Wno-larger-than}.
8121
8122 @item -Wno-larger-than
8123 @opindex Wno-larger-than
8124 Disable @option{-Wlarger-than=} warnings. The option is equivalent
8125 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8126
8127 @item -Wframe-larger-than=@var{byte-size}
8128 @opindex Wframe-larger-than=
8129 @opindex Wno-frame-larger-than
8130 Warn if the size of a function frame exceeds @var{byte-size}.
8131 The computation done to determine the stack frame size is approximate
8132 and not conservative.
8133 The actual requirements may be somewhat greater than @var{byte-size}
8134 even if you do not get a warning. In addition, any space allocated
8135 via @code{alloca}, variable-length arrays, or related constructs
8136 is not included by the compiler when determining
8137 whether or not to issue a warning.
8138 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8139 Warnings controlled by the option can be disabled either by specifying
8140 @var{byte-size} of @samp{SIZE_MAX} or more or by
8141 @option{-Wno-frame-larger-than}.
8142
8143 @item -Wno-frame-larger-than
8144 @opindex Wno-frame-larger-than
8145 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8146 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8147
8148 @item -Wfree-nonheap-object
8149 @opindex Wfree-nonheap-object
8150 @opindex Wno-free-nonheap-object
8151 Warn when attempting to deallocate an object that was either not allocated
8152 on the heap, or by using a pointer that was not returned from a prior call
8153 to the corresponding allocation function. For example, because the call
8154 to @code{stpcpy} returns a pointer to the terminating nul character and
8155 not to the begginning of the object, the call to @code{free} below is
8156 diagnosed.
8157
8158 @smallexample
8159 void f (char *p)
8160 @{
8161 p = stpcpy (p, "abc");
8162 // ...
8163 free (p); // warning
8164 @}
8165 @end smallexample
8166
8167 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8168
8169 @item -Wstack-usage=@var{byte-size}
8170 @opindex Wstack-usage
8171 @opindex Wno-stack-usage
8172 Warn if the stack usage of a function might exceed @var{byte-size}.
8173 The computation done to determine the stack usage is conservative.
8174 Any space allocated via @code{alloca}, variable-length arrays, or related
8175 constructs is included by the compiler when determining whether or not to
8176 issue a warning.
8177
8178 The message is in keeping with the output of @option{-fstack-usage}.
8179
8180 @itemize
8181 @item
8182 If the stack usage is fully static but exceeds the specified amount, it's:
8183
8184 @smallexample
8185 warning: stack usage is 1120 bytes
8186 @end smallexample
8187 @item
8188 If the stack usage is (partly) dynamic but bounded, it's:
8189
8190 @smallexample
8191 warning: stack usage might be 1648 bytes
8192 @end smallexample
8193 @item
8194 If the stack usage is (partly) dynamic and not bounded, it's:
8195
8196 @smallexample
8197 warning: stack usage might be unbounded
8198 @end smallexample
8199 @end itemize
8200
8201 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8202 Warnings controlled by the option can be disabled either by specifying
8203 @var{byte-size} of @samp{SIZE_MAX} or more or by
8204 @option{-Wno-stack-usage}.
8205
8206 @item -Wno-stack-usage
8207 @opindex Wno-stack-usage
8208 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8209 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8210
8211 @item -Wunsafe-loop-optimizations
8212 @opindex Wunsafe-loop-optimizations
8213 @opindex Wno-unsafe-loop-optimizations
8214 Warn if the loop cannot be optimized because the compiler cannot
8215 assume anything on the bounds of the loop indices. With
8216 @option{-funsafe-loop-optimizations} warn if the compiler makes
8217 such assumptions.
8218
8219 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8220 @opindex Wno-pedantic-ms-format
8221 @opindex Wpedantic-ms-format
8222 When used in combination with @option{-Wformat}
8223 and @option{-pedantic} without GNU extensions, this option
8224 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8225 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8226 which depend on the MS runtime.
8227
8228 @item -Wpointer-arith
8229 @opindex Wpointer-arith
8230 @opindex Wno-pointer-arith
8231 Warn about anything that depends on the ``size of'' a function type or
8232 of @code{void}. GNU C assigns these types a size of 1, for
8233 convenience in calculations with @code{void *} pointers and pointers
8234 to functions. In C++, warn also when an arithmetic operation involves
8235 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8236
8237 @item -Wno-pointer-compare
8238 @opindex Wpointer-compare
8239 @opindex Wno-pointer-compare
8240 Do not warn if a pointer is compared with a zero character constant.
8241 This usually
8242 means that the pointer was meant to be dereferenced. For example:
8243
8244 @smallexample
8245 const char *p = foo ();
8246 if (p == '\0')
8247 return 42;
8248 @end smallexample
8249
8250 Note that the code above is invalid in C++11.
8251
8252 This warning is enabled by default.
8253
8254 @item -Wtsan
8255 @opindex Wtsan
8256 @opindex Wno-tsan
8257 Warn about unsupported features in ThreadSanitizer.
8258
8259 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8260 can report false positives.
8261
8262 This warning is enabled by default.
8263
8264 @item -Wtype-limits
8265 @opindex Wtype-limits
8266 @opindex Wno-type-limits
8267 Warn if a comparison is always true or always false due to the limited
8268 range of the data type, but do not warn for constant expressions. For
8269 example, warn if an unsigned variable is compared against zero with
8270 @code{<} or @code{>=}. This warning is also enabled by
8271 @option{-Wextra}.
8272
8273 @item -Wabsolute-value @r{(C and Objective-C only)}
8274 @opindex Wabsolute-value
8275 @opindex Wno-absolute-value
8276 Warn for calls to standard functions that compute the absolute value
8277 of an argument when a more appropriate standard function is available.
8278 For example, calling @code{abs(3.14)} triggers the warning because the
8279 appropriate function to call to compute the absolute value of a double
8280 argument is @code{fabs}. The option also triggers warnings when the
8281 argument in a call to such a function has an unsigned type. This
8282 warning can be suppressed with an explicit type cast and it is also
8283 enabled by @option{-Wextra}.
8284
8285 @include cppwarnopts.texi
8286
8287 @item -Wbad-function-cast @r{(C and Objective-C only)}
8288 @opindex Wbad-function-cast
8289 @opindex Wno-bad-function-cast
8290 Warn when a function call is cast to a non-matching type.
8291 For example, warn if a call to a function returning an integer type
8292 is cast to a pointer type.
8293
8294 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8295 @opindex Wc90-c99-compat
8296 @opindex Wno-c90-c99-compat
8297 Warn about features not present in ISO C90, but present in ISO C99.
8298 For instance, warn about use of variable length arrays, @code{long long}
8299 type, @code{bool} type, compound literals, designated initializers, and so
8300 on. This option is independent of the standards mode. Warnings are disabled
8301 in the expression that follows @code{__extension__}.
8302
8303 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8304 @opindex Wc99-c11-compat
8305 @opindex Wno-c99-c11-compat
8306 Warn about features not present in ISO C99, but present in ISO C11.
8307 For instance, warn about use of anonymous structures and unions,
8308 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8309 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8310 and so on. This option is independent of the standards mode. Warnings are
8311 disabled in the expression that follows @code{__extension__}.
8312
8313 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8314 @opindex Wc11-c2x-compat
8315 @opindex Wno-c11-c2x-compat
8316 Warn about features not present in ISO C11, but present in ISO C2X.
8317 For instance, warn about omitting the string in @code{_Static_assert},
8318 use of @samp{[[]]} syntax for attributes, use of decimal
8319 floating-point types, and so on. This option is independent of the
8320 standards mode. Warnings are disabled in the expression that follows
8321 @code{__extension__}.
8322
8323 @item -Wc++-compat @r{(C and Objective-C only)}
8324 @opindex Wc++-compat
8325 @opindex Wno-c++-compat
8326 Warn about ISO C constructs that are outside of the common subset of
8327 ISO C and ISO C++, e.g.@: request for implicit conversion from
8328 @code{void *} to a pointer to non-@code{void} type.
8329
8330 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8331 @opindex Wc++11-compat
8332 @opindex Wno-c++11-compat
8333 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8334 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8335 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8336 enabled by @option{-Wall}.
8337
8338 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8339 @opindex Wc++14-compat
8340 @opindex Wno-c++14-compat
8341 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8342 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8343
8344 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8345 @opindex Wc++17-compat
8346 @opindex Wno-c++17-compat
8347 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8348 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8349
8350 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8351 @opindex Wc++20-compat
8352 @opindex Wno-c++20-compat
8353 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8354 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8355
8356 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8357 @opindex Wc++11-extensions
8358 @opindex Wno-c++11-extensions
8359 Do not warn about C++11 constructs in code being compiled using
8360 an older C++ standard. Even without this option, some C++11 constructs
8361 will only be diagnosed if @option{-Wpedantic} is used.
8362
8363 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8364 @opindex Wc++14-extensions
8365 @opindex Wno-c++14-extensions
8366 Do not warn about C++14 constructs in code being compiled using
8367 an older C++ standard. Even without this option, some C++14 constructs
8368 will only be diagnosed if @option{-Wpedantic} is used.
8369
8370 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8371 @opindex Wc++17-extensions
8372 @opindex Wno-c++17-extensions
8373 Do not warn about C++17 constructs in code being compiled using
8374 an older C++ standard. Even without this option, some C++17 constructs
8375 will only be diagnosed if @option{-Wpedantic} is used.
8376
8377 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8378 @opindex Wc++20-extensions
8379 @opindex Wno-c++20-extensions
8380 Do not warn about C++20 constructs in code being compiled using
8381 an older C++ standard. Even without this option, some C++20 constructs
8382 will only be diagnosed if @option{-Wpedantic} is used.
8383
8384 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8385 @opindex Wc++23-extensions
8386 @opindex Wno-c++23-extensions
8387 Do not warn about C++23 constructs in code being compiled using
8388 an older C++ standard. Even without this option, some C++23 constructs
8389 will only be diagnosed if @option{-Wpedantic} is used.
8390
8391 @item -Wcast-qual
8392 @opindex Wcast-qual
8393 @opindex Wno-cast-qual
8394 Warn whenever a pointer is cast so as to remove a type qualifier from
8395 the target type. For example, warn if a @code{const char *} is cast
8396 to an ordinary @code{char *}.
8397
8398 Also warn when making a cast that introduces a type qualifier in an
8399 unsafe way. For example, casting @code{char **} to @code{const char **}
8400 is unsafe, as in this example:
8401
8402 @smallexample
8403 /* p is char ** value. */
8404 const char **q = (const char **) p;
8405 /* Assignment of readonly string to const char * is OK. */
8406 *q = "string";
8407 /* Now char** pointer points to read-only memory. */
8408 **p = 'b';
8409 @end smallexample
8410
8411 @item -Wcast-align
8412 @opindex Wcast-align
8413 @opindex Wno-cast-align
8414 Warn whenever a pointer is cast such that the required alignment of the
8415 target is increased. For example, warn if a @code{char *} is cast to
8416 an @code{int *} on machines where integers can only be accessed at
8417 two- or four-byte boundaries.
8418
8419 @item -Wcast-align=strict
8420 @opindex Wcast-align=strict
8421 Warn whenever a pointer is cast such that the required alignment of the
8422 target is increased. For example, warn if a @code{char *} is cast to
8423 an @code{int *} regardless of the target machine.
8424
8425 @item -Wcast-function-type
8426 @opindex Wcast-function-type
8427 @opindex Wno-cast-function-type
8428 Warn when a function pointer is cast to an incompatible function pointer.
8429 In a cast involving function types with a variable argument list only
8430 the types of initial arguments that are provided are considered.
8431 Any parameter of pointer-type matches any other pointer-type. Any benign
8432 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8433 on ILP32 targets. Likewise type qualifiers are ignored. The function
8434 type @code{void (*) (void)} is special and matches everything, which can
8435 be used to suppress this warning.
8436 In a cast involving pointer to member types this warning warns whenever
8437 the type cast is changing the pointer to member type.
8438 This warning is enabled by @option{-Wextra}.
8439
8440 @item -Wwrite-strings
8441 @opindex Wwrite-strings
8442 @opindex Wno-write-strings
8443 When compiling C, give string constants the type @code{const
8444 char[@var{length}]} so that copying the address of one into a
8445 non-@code{const} @code{char *} pointer produces a warning. These
8446 warnings help you find at compile time code that can try to write
8447 into a string constant, but only if you have been very careful about
8448 using @code{const} in declarations and prototypes. Otherwise, it is
8449 just a nuisance. This is why we did not make @option{-Wall} request
8450 these warnings.
8451
8452 When compiling C++, warn about the deprecated conversion from string
8453 literals to @code{char *}. This warning is enabled by default for C++
8454 programs.
8455
8456 @item -Wclobbered
8457 @opindex Wclobbered
8458 @opindex Wno-clobbered
8459 Warn for variables that might be changed by @code{longjmp} or
8460 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8461
8462 @item -Wconversion
8463 @opindex Wconversion
8464 @opindex Wno-conversion
8465 Warn for implicit conversions that may alter a value. This includes
8466 conversions between real and integer, like @code{abs (x)} when
8467 @code{x} is @code{double}; conversions between signed and unsigned,
8468 like @code{unsigned ui = -1}; and conversions to smaller types, like
8469 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8470 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8471 changed by the conversion like in @code{abs (2.0)}. Warnings about
8472 conversions between signed and unsigned integers can be disabled by
8473 using @option{-Wno-sign-conversion}.
8474
8475 For C++, also warn for confusing overload resolution for user-defined
8476 conversions; and conversions that never use a type conversion
8477 operator: conversions to @code{void}, the same type, a base class or a
8478 reference to them. Warnings about conversions between signed and
8479 unsigned integers are disabled by default in C++ unless
8480 @option{-Wsign-conversion} is explicitly enabled.
8481
8482 Warnings about conversion from arithmetic on a small type back to that
8483 type are only given with @option{-Warith-conversion}.
8484
8485 @item -Wdangling-else
8486 @opindex Wdangling-else
8487 @opindex Wno-dangling-else
8488 Warn about constructions where there may be confusion to which
8489 @code{if} statement an @code{else} branch belongs. Here is an example of
8490 such a case:
8491
8492 @smallexample
8493 @group
8494 @{
8495 if (a)
8496 if (b)
8497 foo ();
8498 else
8499 bar ();
8500 @}
8501 @end group
8502 @end smallexample
8503
8504 In C/C++, every @code{else} branch belongs to the innermost possible
8505 @code{if} statement, which in this example is @code{if (b)}. This is
8506 often not what the programmer expected, as illustrated in the above
8507 example by indentation the programmer chose. When there is the
8508 potential for this confusion, GCC issues a warning when this flag
8509 is specified. To eliminate the warning, add explicit braces around
8510 the innermost @code{if} statement so there is no way the @code{else}
8511 can belong to the enclosing @code{if}. The resulting code
8512 looks like this:
8513
8514 @smallexample
8515 @group
8516 @{
8517 if (a)
8518 @{
8519 if (b)
8520 foo ();
8521 else
8522 bar ();
8523 @}
8524 @}
8525 @end group
8526 @end smallexample
8527
8528 This warning is enabled by @option{-Wparentheses}.
8529
8530 @item -Wdate-time
8531 @opindex Wdate-time
8532 @opindex Wno-date-time
8533 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
8534 are encountered as they might prevent bit-wise-identical reproducible
8535 compilations.
8536
8537 @item -Wempty-body
8538 @opindex Wempty-body
8539 @opindex Wno-empty-body
8540 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
8541 while} statement. This warning is also enabled by @option{-Wextra}.
8542
8543 @item -Wno-endif-labels
8544 @opindex Wendif-labels
8545 @opindex Wno-endif-labels
8546 Do not warn about stray tokens after @code{#else} and @code{#endif}.
8547
8548 @item -Wenum-compare
8549 @opindex Wenum-compare
8550 @opindex Wno-enum-compare
8551 Warn about a comparison between values of different enumerated types.
8552 In C++ enumerated type mismatches in conditional expressions are also
8553 diagnosed and the warning is enabled by default. In C this warning is
8554 enabled by @option{-Wall}.
8555
8556 @item -Wenum-conversion
8557 @opindex Wenum-conversion
8558 @opindex Wno-enum-conversion
8559 Warn when a value of enumerated type is implicitly converted to a
8560 different enumerated type. This warning is enabled by @option{-Wextra}
8561 in C@.
8562
8563 @item -Wjump-misses-init @r{(C, Objective-C only)}
8564 @opindex Wjump-misses-init
8565 @opindex Wno-jump-misses-init
8566 Warn if a @code{goto} statement or a @code{switch} statement jumps
8567 forward across the initialization of a variable, or jumps backward to a
8568 label after the variable has been initialized. This only warns about
8569 variables that are initialized when they are declared. This warning is
8570 only supported for C and Objective-C; in C++ this sort of branch is an
8571 error in any case.
8572
8573 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
8574 can be disabled with the @option{-Wno-jump-misses-init} option.
8575
8576 @item -Wsign-compare
8577 @opindex Wsign-compare
8578 @opindex Wno-sign-compare
8579 @cindex warning for comparison of signed and unsigned values
8580 @cindex comparison of signed and unsigned values, warning
8581 @cindex signed and unsigned values, comparison warning
8582 Warn when a comparison between signed and unsigned values could produce
8583 an incorrect result when the signed value is converted to unsigned.
8584 In C++, this warning is also enabled by @option{-Wall}. In C, it is
8585 also enabled by @option{-Wextra}.
8586
8587 @item -Wsign-conversion
8588 @opindex Wsign-conversion
8589 @opindex Wno-sign-conversion
8590 Warn for implicit conversions that may change the sign of an integer
8591 value, like assigning a signed integer expression to an unsigned
8592 integer variable. An explicit cast silences the warning. In C, this
8593 option is enabled also by @option{-Wconversion}.
8594
8595 @item -Wfloat-conversion
8596 @opindex Wfloat-conversion
8597 @opindex Wno-float-conversion
8598 Warn for implicit conversions that reduce the precision of a real value.
8599 This includes conversions from real to integer, and from higher precision
8600 real to lower precision real values. This option is also enabled by
8601 @option{-Wconversion}.
8602
8603 @item -Wno-scalar-storage-order
8604 @opindex Wno-scalar-storage-order
8605 @opindex Wscalar-storage-order
8606 Do not warn on suspicious constructs involving reverse scalar storage order.
8607
8608 @item -Wsizeof-array-div
8609 @opindex Wsizeof-array-div
8610 @opindex Wno-sizeof-array-div
8611 Warn about divisions of two sizeof operators when the first one is applied
8612 to an array and the divisor does not equal the size of the array element.
8613 In such a case, the computation will not yield the number of elements in the
8614 array, which is likely what the user intended. This warning warns e.g. about
8615 @smallexample
8616 int fn ()
8617 @{
8618 int arr[10];
8619 return sizeof (arr) / sizeof (short);
8620 @}
8621 @end smallexample
8622
8623 This warning is enabled by @option{-Wall}.
8624
8625 @item -Wsizeof-pointer-div
8626 @opindex Wsizeof-pointer-div
8627 @opindex Wno-sizeof-pointer-div
8628 Warn for suspicious divisions of two sizeof expressions that divide
8629 the pointer size by the element size, which is the usual way to compute
8630 the array size but won't work out correctly with pointers. This warning
8631 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
8632 not an array, but a pointer. This warning is enabled by @option{-Wall}.
8633
8634 @item -Wsizeof-pointer-memaccess
8635 @opindex Wsizeof-pointer-memaccess
8636 @opindex Wno-sizeof-pointer-memaccess
8637 Warn for suspicious length parameters to certain string and memory built-in
8638 functions if the argument uses @code{sizeof}. This warning triggers for
8639 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
8640 an array, but a pointer, and suggests a possible fix, or about
8641 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
8642 also warns about calls to bounded string copy functions like @code{strncat}
8643 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
8644 the source array. For example, in the following function the call to
8645 @code{strncat} specifies the size of the source string as the bound. That
8646 is almost certainly a mistake and so the call is diagnosed.
8647 @smallexample
8648 void make_file (const char *name)
8649 @{
8650 char path[PATH_MAX];
8651 strncpy (path, name, sizeof path - 1);
8652 strncat (path, ".text", sizeof ".text");
8653 @dots{}
8654 @}
8655 @end smallexample
8656
8657 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
8658
8659 @item -Wno-sizeof-array-argument
8660 @opindex Wsizeof-array-argument
8661 @opindex Wno-sizeof-array-argument
8662 Do not warn when the @code{sizeof} operator is applied to a parameter that is
8663 declared as an array in a function definition. This warning is enabled by
8664 default for C and C++ programs.
8665
8666 @item -Wmemset-elt-size
8667 @opindex Wmemset-elt-size
8668 @opindex Wno-memset-elt-size
8669 Warn for suspicious calls to the @code{memset} built-in function, if the
8670 first argument references an array, and the third argument is a number
8671 equal to the number of elements, but not equal to the size of the array
8672 in memory. This indicates that the user has omitted a multiplication by
8673 the element size. This warning is enabled by @option{-Wall}.
8674
8675 @item -Wmemset-transposed-args
8676 @opindex Wmemset-transposed-args
8677 @opindex Wno-memset-transposed-args
8678 Warn for suspicious calls to the @code{memset} built-in function where
8679 the second argument is not zero and the third argument is zero. For
8680 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
8681 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
8682 is only emitted if the third argument is a literal zero. Otherwise, if
8683 it is an expression that is folded to zero, or a cast of zero to some
8684 type, it is far less likely that the arguments have been mistakenly
8685 transposed and no warning is emitted. This warning is enabled
8686 by @option{-Wall}.
8687
8688 @item -Waddress
8689 @opindex Waddress
8690 @opindex Wno-address
8691 Warn about suspicious uses of address expressions. These include comparing
8692 the address of a function or a declared object to the null pointer constant
8693 such as in
8694 @smallexample
8695 void f (void);
8696 void g (void)
8697 @{
8698 if (!func) // warning: expression evaluates to false
8699 abort ();
8700 @}
8701 @end smallexample
8702 comparisons of a pointer to a string literal, such as in
8703 @smallexample
8704 void f (const char *x)
8705 @{
8706 if (x == "abc") // warning: expression evaluates to false
8707 puts ("equal");
8708 @}
8709 @end smallexample
8710 and tests of the results of pointer addition or subtraction for equality
8711 to null, such as in
8712 @smallexample
8713 void f (const int *p, int i)
8714 @{
8715 return p + i == NULL;
8716 @}
8717 @end smallexample
8718 Such uses typically indicate a programmer error: the address of most
8719 functions and objects necessarily evaluates to true (the exception are
8720 weak symbols), so their use in a conditional might indicate missing
8721 parentheses in a function call or a missing dereference in an array
8722 expression. The subset of the warning for object pointers can be
8723 suppressed by casting the pointer operand to an integer type such
8724 as @code{inptr_t} or @code{uinptr_t}.
8725 Comparisons against string literals result in unspecified behavior
8726 and are not portable, and suggest the intent was to call @code{strcmp}.
8727 The warning is suppressed if the suspicious expression is the result
8728 of macro expansion.
8729 @option{-Waddress} warning is enabled by @option{-Wall}.
8730
8731 @item -Wno-address-of-packed-member
8732 @opindex Waddress-of-packed-member
8733 @opindex Wno-address-of-packed-member
8734 Do not warn when the address of packed member of struct or union is taken,
8735 which usually results in an unaligned pointer value. This is
8736 enabled by default.
8737
8738 @item -Wlogical-op
8739 @opindex Wlogical-op
8740 @opindex Wno-logical-op
8741 Warn about suspicious uses of logical operators in expressions.
8742 This includes using logical operators in contexts where a
8743 bit-wise operator is likely to be expected. Also warns when
8744 the operands of a logical operator are the same:
8745 @smallexample
8746 extern int a;
8747 if (a < 0 && a < 0) @{ @dots{} @}
8748 @end smallexample
8749
8750 @item -Wlogical-not-parentheses
8751 @opindex Wlogical-not-parentheses
8752 @opindex Wno-logical-not-parentheses
8753 Warn about logical not used on the left hand side operand of a comparison.
8754 This option does not warn if the right operand is considered to be a boolean
8755 expression. Its purpose is to detect suspicious code like the following:
8756 @smallexample
8757 int a;
8758 @dots{}
8759 if (!a > 1) @{ @dots{} @}
8760 @end smallexample
8761
8762 It is possible to suppress the warning by wrapping the LHS into
8763 parentheses:
8764 @smallexample
8765 if ((!a) > 1) @{ @dots{} @}
8766 @end smallexample
8767
8768 This warning is enabled by @option{-Wall}.
8769
8770 @item -Waggregate-return
8771 @opindex Waggregate-return
8772 @opindex Wno-aggregate-return
8773 Warn if any functions that return structures or unions are defined or
8774 called. (In languages where you can return an array, this also elicits
8775 a warning.)
8776
8777 @item -Wno-aggressive-loop-optimizations
8778 @opindex Wno-aggressive-loop-optimizations
8779 @opindex Waggressive-loop-optimizations
8780 Warn if in a loop with constant number of iterations the compiler detects
8781 undefined behavior in some statement during one or more of the iterations.
8782
8783 @item -Wno-attributes
8784 @opindex Wno-attributes
8785 @opindex Wattributes
8786 Do not warn if an unexpected @code{__attribute__} is used, such as
8787 unrecognized attributes, function attributes applied to variables,
8788 etc. This does not stop errors for incorrect use of supported
8789 attributes.
8790
8791 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
8792 warnings about unknown scoped attributes (in C++11 and C2X). For example,
8793 @option{-Wno-attributes=vendor::attr} disables warning about the following
8794 declaration:
8795
8796 @smallexample
8797 [[vendor::attr]] void f();
8798 @end smallexample
8799
8800 It is also possible to disable warning about all attributes in a namespace
8801 using @option{-Wno-attributes=vendor::} which prevents warning about both
8802 of these declarations:
8803
8804 @smallexample
8805 [[vendor::safe]] void f();
8806 [[vendor::unsafe]] void f2();
8807 @end smallexample
8808
8809 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
8810
8811 @item -Wno-builtin-declaration-mismatch
8812 @opindex Wno-builtin-declaration-mismatch
8813 @opindex Wbuiltin-declaration-mismatch
8814 Warn if a built-in function is declared with an incompatible signature
8815 or as a non-function, or when a built-in function declared with a type
8816 that does not include a prototype is called with arguments whose promoted
8817 types do not match those expected by the function. When @option{-Wextra}
8818 is specified, also warn when a built-in function that takes arguments is
8819 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
8820 warning is enabled by default. To avoid the warning include the appropriate
8821 header to bring the prototypes of built-in functions into scope.
8822
8823 For example, the call to @code{memset} below is diagnosed by the warning
8824 because the function expects a value of type @code{size_t} as its argument
8825 but the type of @code{32} is @code{int}. With @option{-Wextra},
8826 the declaration of the function is diagnosed as well.
8827 @smallexample
8828 extern void* memset ();
8829 void f (void *d)
8830 @{
8831 memset (d, '\0', 32);
8832 @}
8833 @end smallexample
8834
8835 @item -Wno-builtin-macro-redefined
8836 @opindex Wno-builtin-macro-redefined
8837 @opindex Wbuiltin-macro-redefined
8838 Do not warn if certain built-in macros are redefined. This suppresses
8839 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8840 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8841
8842 @item -Wstrict-prototypes @r{(C and Objective-C only)}
8843 @opindex Wstrict-prototypes
8844 @opindex Wno-strict-prototypes
8845 Warn if a function is declared or defined without specifying the
8846 argument types. (An old-style function definition is permitted without
8847 a warning if preceded by a declaration that specifies the argument
8848 types.)
8849
8850 @item -Wold-style-declaration @r{(C and Objective-C only)}
8851 @opindex Wold-style-declaration
8852 @opindex Wno-old-style-declaration
8853 Warn for obsolescent usages, according to the C Standard, in a
8854 declaration. For example, warn if storage-class specifiers like
8855 @code{static} are not the first things in a declaration. This warning
8856 is also enabled by @option{-Wextra}.
8857
8858 @item -Wold-style-definition @r{(C and Objective-C only)}
8859 @opindex Wold-style-definition
8860 @opindex Wno-old-style-definition
8861 Warn if an old-style function definition is used. A warning is given
8862 even if there is a previous prototype. A definition using @samp{()}
8863 is not considered an old-style definition in C2X mode, because it is
8864 equivalent to @samp{(void)} in that case, but is considered an
8865 old-style definition for older standards.
8866
8867 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
8868 @opindex Wmissing-parameter-type
8869 @opindex Wno-missing-parameter-type
8870 A function parameter is declared without a type specifier in K&R-style
8871 functions:
8872
8873 @smallexample
8874 void foo(bar) @{ @}
8875 @end smallexample
8876
8877 This warning is also enabled by @option{-Wextra}.
8878
8879 @item -Wmissing-prototypes @r{(C and Objective-C only)}
8880 @opindex Wmissing-prototypes
8881 @opindex Wno-missing-prototypes
8882 Warn if a global function is defined without a previous prototype
8883 declaration. This warning is issued even if the definition itself
8884 provides a prototype. Use this option to detect global functions
8885 that do not have a matching prototype declaration in a header file.
8886 This option is not valid for C++ because all function declarations
8887 provide prototypes and a non-matching declaration declares an
8888 overload rather than conflict with an earlier declaration.
8889 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8890
8891 @item -Wmissing-declarations
8892 @opindex Wmissing-declarations
8893 @opindex Wno-missing-declarations
8894 Warn if a global function is defined without a previous declaration.
8895 Do so even if the definition itself provides a prototype.
8896 Use this option to detect global functions that are not declared in
8897 header files. In C, no warnings are issued for functions with previous
8898 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8899 missing prototypes. In C++, no warnings are issued for function templates,
8900 or for inline functions, or for functions in anonymous namespaces.
8901
8902 @item -Wmissing-field-initializers
8903 @opindex Wmissing-field-initializers
8904 @opindex Wno-missing-field-initializers
8905 @opindex W
8906 @opindex Wextra
8907 @opindex Wno-extra
8908 Warn if a structure's initializer has some fields missing. For
8909 example, the following code causes such a warning, because
8910 @code{x.h} is implicitly zero:
8911
8912 @smallexample
8913 struct s @{ int f, g, h; @};
8914 struct s x = @{ 3, 4 @};
8915 @end smallexample
8916
8917 This option does not warn about designated initializers, so the following
8918 modification does not trigger a warning:
8919
8920 @smallexample
8921 struct s @{ int f, g, h; @};
8922 struct s x = @{ .f = 3, .g = 4 @};
8923 @end smallexample
8924
8925 In C this option does not warn about the universal zero initializer
8926 @samp{@{ 0 @}}:
8927
8928 @smallexample
8929 struct s @{ int f, g, h; @};
8930 struct s x = @{ 0 @};
8931 @end smallexample
8932
8933 Likewise, in C++ this option does not warn about the empty @{ @}
8934 initializer, for example:
8935
8936 @smallexample
8937 struct s @{ int f, g, h; @};
8938 s x = @{ @};
8939 @end smallexample
8940
8941 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
8942 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8943
8944 @item -Wno-missing-requires
8945 @opindex Wmissing-requires
8946 @opindex Wno-missing-requires
8947
8948 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
8949
8950 @smallexample
8951 bool satisfied = requires @{ C<T> @};
8952 @end smallexample
8953
8954 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
8955 expression, which it is for all T. Presumably the user meant to write
8956
8957 @smallexample
8958 bool satisfied = requires @{ requires C<T> @};
8959 @end smallexample
8960
8961 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
8962 type @samp{T}.
8963
8964 This warning can be disabled with @option{-Wno-missing-requires}.
8965
8966 @item -Wno-multichar
8967 @opindex Wno-multichar
8968 @opindex Wmultichar
8969 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8970 Usually they indicate a typo in the user's code, as they have
8971 implementation-defined values, and should not be used in portable code.
8972
8973 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8974 @opindex Wnormalized=
8975 @opindex Wnormalized
8976 @opindex Wno-normalized
8977 @cindex NFC
8978 @cindex NFKC
8979 @cindex character set, input normalization
8980 In ISO C and ISO C++, two identifiers are different if they are
8981 different sequences of characters. However, sometimes when characters
8982 outside the basic ASCII character set are used, you can have two
8983 different character sequences that look the same. To avoid confusion,
8984 the ISO 10646 standard sets out some @dfn{normalization rules} which
8985 when applied ensure that two sequences that look the same are turned into
8986 the same sequence. GCC can warn you if you are using identifiers that
8987 have not been normalized; this option controls that warning.
8988
8989 There are four levels of warning supported by GCC@. The default is
8990 @option{-Wnormalized=nfc}, which warns about any identifier that is
8991 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
8992 recommended form for most uses. It is equivalent to
8993 @option{-Wnormalized}.
8994
8995 Unfortunately, there are some characters allowed in identifiers by
8996 ISO C and ISO C++ that, when turned into NFC, are not allowed in
8997 identifiers. That is, there's no way to use these symbols in portable
8998 ISO C or C++ and have all your identifiers in NFC@.
8999 @option{-Wnormalized=id} suppresses the warning for these characters.
9000 It is hoped that future versions of the standards involved will correct
9001 this, which is why this option is not the default.
9002
9003 You can switch the warning off for all characters by writing
9004 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
9005 only do this if you are using some other normalization scheme (like
9006 ``D''), because otherwise you can easily create bugs that are
9007 literally impossible to see.
9008
9009 Some characters in ISO 10646 have distinct meanings but look identical
9010 in some fonts or display methodologies, especially once formatting has
9011 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9012 LETTER N'', displays just like a regular @code{n} that has been
9013 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
9014 normalization scheme to convert all these into a standard form as
9015 well, and GCC warns if your code is not in NFKC if you use
9016 @option{-Wnormalized=nfkc}. This warning is comparable to warning
9017 about every identifier that contains the letter O because it might be
9018 confused with the digit 0, and so is not the default, but may be
9019 useful as a local coding convention if the programming environment
9020 cannot be fixed to display these characters distinctly.
9021
9022 @item -Wno-attribute-warning
9023 @opindex Wno-attribute-warning
9024 @opindex Wattribute-warning
9025 Do not warn about usage of functions (@pxref{Function Attributes})
9026 declared with @code{warning} attribute. By default, this warning is
9027 enabled. @option{-Wno-attribute-warning} can be used to disable the
9028 warning or @option{-Wno-error=attribute-warning} can be used to
9029 disable the error when compiled with @option{-Werror} flag.
9030
9031 @item -Wno-deprecated
9032 @opindex Wno-deprecated
9033 @opindex Wdeprecated
9034 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
9035
9036 @item -Wno-deprecated-declarations
9037 @opindex Wno-deprecated-declarations
9038 @opindex Wdeprecated-declarations
9039 Do not warn about uses of functions (@pxref{Function Attributes}),
9040 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9041 Attributes}) marked as deprecated by using the @code{deprecated}
9042 attribute.
9043
9044 @item -Wno-overflow
9045 @opindex Wno-overflow
9046 @opindex Woverflow
9047 Do not warn about compile-time overflow in constant expressions.
9048
9049 @item -Wno-odr
9050 @opindex Wno-odr
9051 @opindex Wodr
9052 Warn about One Definition Rule violations during link-time optimization.
9053 Enabled by default.
9054
9055 @item -Wopenacc-parallelism
9056 @opindex Wopenacc-parallelism
9057 @opindex Wno-openacc-parallelism
9058 @cindex OpenACC accelerator programming
9059 Warn about potentially suboptimal choices related to OpenACC parallelism.
9060
9061 @item -Wopenmp-simd
9062 @opindex Wopenmp-simd
9063 @opindex Wno-openmp-simd
9064 Warn if the vectorizer cost model overrides the OpenMP
9065 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
9066 option can be used to relax the cost model.
9067
9068 @item -Woverride-init @r{(C and Objective-C only)}
9069 @opindex Woverride-init
9070 @opindex Wno-override-init
9071 @opindex W
9072 @opindex Wextra
9073 @opindex Wno-extra
9074 Warn if an initialized field without side effects is overridden when
9075 using designated initializers (@pxref{Designated Inits, , Designated
9076 Initializers}).
9077
9078 This warning is included in @option{-Wextra}. To get other
9079 @option{-Wextra} warnings without this one, use @option{-Wextra
9080 -Wno-override-init}.
9081
9082 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9083 @opindex Woverride-init-side-effects
9084 @opindex Wno-override-init-side-effects
9085 Do not warn if an initialized field with side effects is overridden when
9086 using designated initializers (@pxref{Designated Inits, , Designated
9087 Initializers}). This warning is enabled by default.
9088
9089 @item -Wpacked
9090 @opindex Wpacked
9091 @opindex Wno-packed
9092 Warn if a structure is given the packed attribute, but the packed
9093 attribute has no effect on the layout or size of the structure.
9094 Such structures may be mis-aligned for little benefit. For
9095 instance, in this code, the variable @code{f.x} in @code{struct bar}
9096 is misaligned even though @code{struct bar} does not itself
9097 have the packed attribute:
9098
9099 @smallexample
9100 @group
9101 struct foo @{
9102 int x;
9103 char a, b, c, d;
9104 @} __attribute__((packed));
9105 struct bar @{
9106 char z;
9107 struct foo f;
9108 @};
9109 @end group
9110 @end smallexample
9111
9112 @item -Wnopacked-bitfield-compat
9113 @opindex Wpacked-bitfield-compat
9114 @opindex Wno-packed-bitfield-compat
9115 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9116 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
9117 the change can lead to differences in the structure layout. GCC
9118 informs you when the offset of such a field has changed in GCC 4.4.
9119 For example there is no longer a 4-bit padding between field @code{a}
9120 and @code{b} in this structure:
9121
9122 @smallexample
9123 struct foo
9124 @{
9125 char a:4;
9126 char b:8;
9127 @} __attribute__ ((packed));
9128 @end smallexample
9129
9130 This warning is enabled by default. Use
9131 @option{-Wno-packed-bitfield-compat} to disable this warning.
9132
9133 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9134 @opindex Wpacked-not-aligned
9135 @opindex Wno-packed-not-aligned
9136 Warn if a structure field with explicitly specified alignment in a
9137 packed struct or union is misaligned. For example, a warning will
9138 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9139 'struct S' is less than 8}, in this code:
9140
9141 @smallexample
9142 @group
9143 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9144 struct __attribute__ ((packed)) S @{
9145 struct S8 s8;
9146 @};
9147 @end group
9148 @end smallexample
9149
9150 This warning is enabled by @option{-Wall}.
9151
9152 @item -Wpadded
9153 @opindex Wpadded
9154 @opindex Wno-padded
9155 Warn if padding is included in a structure, either to align an element
9156 of the structure or to align the whole structure. Sometimes when this
9157 happens it is possible to rearrange the fields of the structure to
9158 reduce the padding and so make the structure smaller.
9159
9160 @item -Wredundant-decls
9161 @opindex Wredundant-decls
9162 @opindex Wno-redundant-decls
9163 Warn if anything is declared more than once in the same scope, even in
9164 cases where multiple declaration is valid and changes nothing.
9165
9166 @item -Wrestrict
9167 @opindex Wrestrict
9168 @opindex Wno-restrict
9169 Warn when an object referenced by a @code{restrict}-qualified parameter
9170 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9171 argument, or when copies between such objects overlap. For example,
9172 the call to the @code{strcpy} function below attempts to truncate the string
9173 by replacing its initial characters with the last four. However, because
9174 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9175 the call is diagnosed.
9176
9177 @smallexample
9178 void foo (void)
9179 @{
9180 char a[] = "abcd1234";
9181 strcpy (a, a + 4);
9182 @dots{}
9183 @}
9184 @end smallexample
9185 The @option{-Wrestrict} option detects some instances of simple overlap
9186 even without optimization but works best at @option{-O2} and above. It
9187 is included in @option{-Wall}.
9188
9189 @item -Wnested-externs @r{(C and Objective-C only)}
9190 @opindex Wnested-externs
9191 @opindex Wno-nested-externs
9192 Warn if an @code{extern} declaration is encountered within a function.
9193
9194 @item -Winline
9195 @opindex Winline
9196 @opindex Wno-inline
9197 Warn if a function that is declared as inline cannot be inlined.
9198 Even with this option, the compiler does not warn about failures to
9199 inline functions declared in system headers.
9200
9201 The compiler uses a variety of heuristics to determine whether or not
9202 to inline a function. For example, the compiler takes into account
9203 the size of the function being inlined and the amount of inlining
9204 that has already been done in the current function. Therefore,
9205 seemingly insignificant changes in the source program can cause the
9206 warnings produced by @option{-Winline} to appear or disappear.
9207
9208 @item -Winterference-size
9209 @opindex Winterference-size
9210 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9211 without specifying its value with @option{--param destructive-interference-size}.
9212 Also warn about questionable values for that option.
9213
9214 This variable is intended to be used for controlling class layout, to
9215 avoid false sharing in concurrent code:
9216
9217 @smallexample
9218 struct independent_fields @{
9219 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9220 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9221 @};
9222 @end smallexample
9223
9224 Here @samp{one} and @samp{two} are intended to be far enough apart
9225 that stores to one won't require accesses to the other to reload the
9226 cache line.
9227
9228 By default, @option{--param destructive-interference-size} and
9229 @option{--param constructive-interference-size} are set based on the
9230 current @option{-mtune} option, typically to the L1 cache line size
9231 for the particular target CPU, sometimes to a range if tuning for a
9232 generic target. So all translation units that depend on ABI
9233 compatibility for the use of these variables must be compiled with
9234 the same @option{-mtune} (or @option{-mcpu}).
9235
9236 If ABI stability is important, such as if the use is in a header for a
9237 library, you should probably not use the hardware interference size
9238 variables at all. Alternatively, you can force a particular value
9239 with @option{--param}.
9240
9241 If you are confident that your use of the variable does not affect ABI
9242 outside a single build of your project, you can turn off the warning
9243 with @option{-Wno-interference-size}.
9244
9245 @item -Wint-in-bool-context
9246 @opindex Wint-in-bool-context
9247 @opindex Wno-int-in-bool-context
9248 Warn for suspicious use of integer values where boolean values are expected,
9249 such as conditional expressions (?:) using non-boolean integer constants in
9250 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9251 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9252 for all kinds of multiplications regardless of the data type.
9253 This warning is enabled by @option{-Wall}.
9254
9255 @item -Wno-int-to-pointer-cast
9256 @opindex Wno-int-to-pointer-cast
9257 @opindex Wint-to-pointer-cast
9258 Suppress warnings from casts to pointer type of an integer of a
9259 different size. In C++, casting to a pointer type of smaller size is
9260 an error. @option{Wint-to-pointer-cast} is enabled by default.
9261
9262
9263 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9264 @opindex Wno-pointer-to-int-cast
9265 @opindex Wpointer-to-int-cast
9266 Suppress warnings from casts from a pointer to an integer type of a
9267 different size.
9268
9269 @item -Winvalid-pch
9270 @opindex Winvalid-pch
9271 @opindex Wno-invalid-pch
9272 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9273 the search path but cannot be used.
9274
9275 @item -Wlong-long
9276 @opindex Wlong-long
9277 @opindex Wno-long-long
9278 Warn if @code{long long} type is used. This is enabled by either
9279 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9280 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9281
9282 @item -Wvariadic-macros
9283 @opindex Wvariadic-macros
9284 @opindex Wno-variadic-macros
9285 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9286 alternate syntax is used in ISO C99 mode. This is enabled by either
9287 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9288 messages, use @option{-Wno-variadic-macros}.
9289
9290 @item -Wno-varargs
9291 @opindex Wvarargs
9292 @opindex Wno-varargs
9293 Do not warn upon questionable usage of the macros used to handle variable
9294 arguments like @code{va_start}. These warnings are enabled by default.
9295
9296 @item -Wvector-operation-performance
9297 @opindex Wvector-operation-performance
9298 @opindex Wno-vector-operation-performance
9299 Warn if vector operation is not implemented via SIMD capabilities of the
9300 architecture. Mainly useful for the performance tuning.
9301 Vector operation can be implemented @code{piecewise}, which means that the
9302 scalar operation is performed on every vector element;
9303 @code{in parallel}, which means that the vector operation is implemented
9304 using scalars of wider type, which normally is more performance efficient;
9305 and @code{as a single scalar}, which means that vector fits into a
9306 scalar type.
9307
9308 @item -Wvla
9309 @opindex Wvla
9310 @opindex Wno-vla
9311 Warn if a variable-length array is used in the code.
9312 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9313 the variable-length array.
9314
9315 @item -Wvla-larger-than=@var{byte-size}
9316 @opindex Wvla-larger-than=
9317 @opindex Wno-vla-larger-than
9318 If this option is used, the compiler warns for declarations of
9319 variable-length arrays whose size is either unbounded, or bounded
9320 by an argument that allows the array size to exceed @var{byte-size}
9321 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9322 works, but with variable-length arrays.
9323
9324 Note that GCC may optimize small variable-length arrays of a known
9325 value into plain arrays, so this warning may not get triggered for
9326 such arrays.
9327
9328 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9329 is typically only effective when @option{-ftree-vrp} is active (default
9330 for @option{-O2} and above).
9331
9332 See also @option{-Walloca-larger-than=@var{byte-size}}.
9333
9334 @item -Wno-vla-larger-than
9335 @opindex Wno-vla-larger-than
9336 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9337 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9338
9339 @item -Wvla-parameter
9340 @opindex Wno-vla-parameter
9341 Warn about redeclarations of functions involving arguments of Variable
9342 Length Array types of inconsistent kinds or forms, and enable the detection
9343 of out-of-bounds accesses to such parameters by warnings such as
9344 @option{-Warray-bounds}.
9345
9346 If the first function declaration uses the VLA form the bound specified
9347 in the array is assumed to be the minimum number of elements expected to
9348 be provided in calls to the function and the maximum number of elements
9349 accessed by it. Failing to provide arguments of sufficient size or
9350 accessing more than the maximum number of elements may be diagnosed.
9351
9352 For example, the warning triggers for the following redeclarations because
9353 the first one allows an array of any size to be passed to @code{f} while
9354 the second one specifies that the array argument must have at least @code{n}
9355 elements. In addition, calling @code{f} with the assotiated VLA bound
9356 parameter in excess of the actual VLA bound triggers a warning as well.
9357
9358 @smallexample
9359 void f (int n, int[n]);
9360 void f (int, int[]); // warning: argument 2 previously declared as a VLA
9361
9362 void g (int n)
9363 @{
9364 if (n > 4)
9365 return;
9366 int a[n];
9367 f (sizeof a, a); // warning: access to a by f may be out of bounds
9368 @dots{}
9369 @}
9370
9371 @end smallexample
9372
9373 @option{-Wvla-parameter} is included in @option{-Wall}. The
9374 @option{-Warray-parameter} option triggers warnings for similar problems
9375 involving ordinary array arguments.
9376
9377 @item -Wvolatile-register-var
9378 @opindex Wvolatile-register-var
9379 @opindex Wno-volatile-register-var
9380 Warn if a register variable is declared volatile. The volatile
9381 modifier does not inhibit all optimizations that may eliminate reads
9382 and/or writes to register variables. This warning is enabled by
9383 @option{-Wall}.
9384
9385 @item -Wdisabled-optimization
9386 @opindex Wdisabled-optimization
9387 @opindex Wno-disabled-optimization
9388 Warn if a requested optimization pass is disabled. This warning does
9389 not generally indicate that there is anything wrong with your code; it
9390 merely indicates that GCC's optimizers are unable to handle the code
9391 effectively. Often, the problem is that your code is too big or too
9392 complex; GCC refuses to optimize programs when the optimization
9393 itself is likely to take inordinate amounts of time.
9394
9395 @item -Wpointer-sign @r{(C and Objective-C only)}
9396 @opindex Wpointer-sign
9397 @opindex Wno-pointer-sign
9398 Warn for pointer argument passing or assignment with different signedness.
9399 This option is only supported for C and Objective-C@. It is implied by
9400 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9401 @option{-Wno-pointer-sign}.
9402
9403 @item -Wstack-protector
9404 @opindex Wstack-protector
9405 @opindex Wno-stack-protector
9406 This option is only active when @option{-fstack-protector} is active. It
9407 warns about functions that are not protected against stack smashing.
9408
9409 @item -Woverlength-strings
9410 @opindex Woverlength-strings
9411 @opindex Wno-overlength-strings
9412 Warn about string constants that are longer than the ``minimum
9413 maximum'' length specified in the C standard. Modern compilers
9414 generally allow string constants that are much longer than the
9415 standard's minimum limit, but very portable programs should avoid
9416 using longer strings.
9417
9418 The limit applies @emph{after} string constant concatenation, and does
9419 not count the trailing NUL@. In C90, the limit was 509 characters; in
9420 C99, it was raised to 4095. C++98 does not specify a normative
9421 minimum maximum, so we do not diagnose overlength strings in C++@.
9422
9423 This option is implied by @option{-Wpedantic}, and can be disabled with
9424 @option{-Wno-overlength-strings}.
9425
9426 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9427 @opindex Wunsuffixed-float-constants
9428 @opindex Wno-unsuffixed-float-constants
9429
9430 Issue a warning for any floating constant that does not have
9431 a suffix. When used together with @option{-Wsystem-headers} it
9432 warns about such constants in system header files. This can be useful
9433 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9434 from the decimal floating-point extension to C99.
9435
9436 @item -Wno-lto-type-mismatch
9437 @opindex Wlto-type-mismatch
9438 @opindex Wno-lto-type-mismatch
9439
9440 During the link-time optimization, do not warn about type mismatches in
9441 global declarations from different compilation units.
9442 Requires @option{-flto} to be enabled. Enabled by default.
9443
9444 @item -Wno-designated-init @r{(C and Objective-C only)}
9445 @opindex Wdesignated-init
9446 @opindex Wno-designated-init
9447 Suppress warnings when a positional initializer is used to initialize
9448 a structure that has been marked with the @code{designated_init}
9449 attribute.
9450
9451 @end table
9452
9453 @node Static Analyzer Options
9454 @section Options That Control Static Analysis
9455
9456 @table @gcctabopt
9457 @item -fanalyzer
9458 @opindex analyzer
9459 @opindex fanalyzer
9460 @opindex fno-analyzer
9461 This option enables an static analysis of program flow which looks
9462 for ``interesting'' interprocedural paths through the
9463 code, and issues warnings for problems found on them.
9464
9465 This analysis is much more expensive than other GCC warnings.
9466
9467 Enabling this option effectively enables the following warnings:
9468
9469 @gccoptlist{ @gol
9470 -Wanalyzer-double-fclose @gol
9471 -Wanalyzer-double-free @gol
9472 -Wanalyzer-exposure-through-output-file @gol
9473 -Wanalyzer-file-leak @gol
9474 -Wanalyzer-free-of-non-heap @gol
9475 -Wanalyzer-malloc-leak @gol
9476 -Wanalyzer-mismatching-deallocation @gol
9477 -Wanalyzer-possible-null-argument @gol
9478 -Wanalyzer-possible-null-dereference @gol
9479 -Wanalyzer-null-argument @gol
9480 -Wanalyzer-null-dereference @gol
9481 -Wanalyzer-shift-count-negative @gol
9482 -Wanalyzer-shift-count-overflow @gol
9483 -Wanalyzer-stale-setjmp-buffer @gol
9484 -Wanalyzer-tainted-allocation-size @gol
9485 -Wanalyzer-tainted-array-index @gol
9486 -Wanalyzer-tainted-divisor @gol
9487 -Wanalyzer-tainted-offset @gol
9488 -Wanalyzer-tainted-size @gol
9489 -Wanalyzer-unsafe-call-within-signal-handler @gol
9490 -Wanalyzer-use-after-free @gol
9491 -Wanalyzer-use-of-uninitialized-value @gol
9492 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
9493 -Wanalyzer-write-to-const @gol
9494 -Wanalyzer-write-to-string-literal @gol
9495 }
9496
9497 This option is only available if GCC was configured with analyzer
9498 support enabled.
9499
9500 @item -Wanalyzer-too-complex
9501 @opindex Wanalyzer-too-complex
9502 @opindex Wno-analyzer-too-complex
9503 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
9504 to attempt to explore the control flow and data flow in the program,
9505 but these can be defeated by sufficiently complicated code.
9506
9507 By default, the analysis silently stops if the code is too
9508 complicated for the analyzer to fully explore and it reaches an internal
9509 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
9510
9511 @item -Wno-analyzer-double-fclose
9512 @opindex Wanalyzer-double-fclose
9513 @opindex Wno-analyzer-double-fclose
9514 This warning requires @option{-fanalyzer}, which enables it; use
9515 @option{-Wno-analyzer-double-fclose} to disable it.
9516
9517 This diagnostic warns for paths through the code in which a @code{FILE *}
9518 can have @code{fclose} called on it more than once.
9519
9520 @item -Wno-analyzer-double-free
9521 @opindex Wanalyzer-double-free
9522 @opindex Wno-analyzer-double-free
9523 This warning requires @option{-fanalyzer}, which enables it; use
9524 @option{-Wno-analyzer-double-free} to disable it.
9525
9526 This diagnostic warns for paths through the code in which a pointer
9527 can have a deallocator called on it more than once, either @code{free},
9528 or a deallocator referenced by attribute @code{malloc}.
9529
9530 @item -Wno-analyzer-exposure-through-output-file
9531 @opindex Wanalyzer-exposure-through-output-file
9532 @opindex Wno-analyzer-exposure-through-output-file
9533 This warning requires @option{-fanalyzer}, which enables it; use
9534 @option{-Wno-analyzer-exposure-through-output-file}
9535 to disable it.
9536
9537 This diagnostic warns for paths through the code in which a
9538 security-sensitive value is written to an output file
9539 (such as writing a password to a log file).
9540
9541 @item -Wno-analyzer-file-leak
9542 @opindex Wanalyzer-file-leak
9543 @opindex Wno-analyzer-file-leak
9544 This warning requires @option{-fanalyzer}, which enables it; use
9545 @option{-Wno-analyzer-file-leak}
9546 to disable it.
9547
9548 This diagnostic warns for paths through the code in which a
9549 @code{<stdio.h>} @code{FILE *} stream object is leaked.
9550
9551 @item -Wno-analyzer-free-of-non-heap
9552 @opindex Wanalyzer-free-of-non-heap
9553 @opindex Wno-analyzer-free-of-non-heap
9554 This warning requires @option{-fanalyzer}, which enables it; use
9555 @option{-Wno-analyzer-free-of-non-heap}
9556 to disable it.
9557
9558 This diagnostic warns for paths through the code in which @code{free}
9559 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
9560
9561 @item -Wno-analyzer-malloc-leak
9562 @opindex Wanalyzer-malloc-leak
9563 @opindex Wno-analyzer-malloc-leak
9564 This warning requires @option{-fanalyzer}, which enables it; use
9565 @option{-Wno-analyzer-malloc-leak}
9566 to disable it.
9567
9568 This diagnostic warns for paths through the code in which a
9569 pointer allocated via an allocator is leaked: either @code{malloc},
9570 or a function marked with attribute @code{malloc}.
9571
9572 @item -Wno-analyzer-mismatching-deallocation
9573 @opindex Wanalyzer-mismatching-deallocation
9574 @opindex Wno-analyzer-mismatching-deallocation
9575 This warning requires @option{-fanalyzer}, which enables it; use
9576 @option{-Wno-analyzer-mismatching-deallocation}
9577 to disable it.
9578
9579 This diagnostic warns for paths through the code in which the
9580 wrong deallocation function is called on a pointer value, based on
9581 which function was used to allocate the pointer value. The diagnostic
9582 will warn about mismatches between @code{free}, scalar @code{delete}
9583 and vector @code{delete[]}, and those marked as allocator/deallocator
9584 pairs using attribute @code{malloc}.
9585
9586 @item -Wno-analyzer-possible-null-argument
9587 @opindex Wanalyzer-possible-null-argument
9588 @opindex Wno-analyzer-possible-null-argument
9589 This warning requires @option{-fanalyzer}, which enables it; use
9590 @option{-Wno-analyzer-possible-null-argument} to disable it.
9591
9592 This diagnostic warns for paths through the code in which a
9593 possibly-NULL value is passed to a function argument marked
9594 with @code{__attribute__((nonnull))} as requiring a non-NULL
9595 value.
9596
9597 @item -Wno-analyzer-possible-null-dereference
9598 @opindex Wanalyzer-possible-null-dereference
9599 @opindex Wno-analyzer-possible-null-dereference
9600 This warning requires @option{-fanalyzer}, which enables it; use
9601 @option{-Wno-analyzer-possible-null-dereference} to disable it.
9602
9603 This diagnostic warns for paths through the code in which a
9604 possibly-NULL value is dereferenced.
9605
9606 @item -Wno-analyzer-null-argument
9607 @opindex Wanalyzer-null-argument
9608 @opindex Wno-analyzer-null-argument
9609 This warning requires @option{-fanalyzer}, which enables it; use
9610 @option{-Wno-analyzer-null-argument} to disable it.
9611
9612 This diagnostic warns for paths through the code in which a
9613 value known to be NULL is passed to a function argument marked
9614 with @code{__attribute__((nonnull))} as requiring a non-NULL
9615 value.
9616
9617 @item -Wno-analyzer-null-dereference
9618 @opindex Wanalyzer-null-dereference
9619 @opindex Wno-analyzer-null-dereference
9620 This warning requires @option{-fanalyzer}, which enables it; use
9621 @option{-Wno-analyzer-null-dereference} to disable it.
9622
9623 This diagnostic warns for paths through the code in which a
9624 value known to be NULL is dereferenced.
9625
9626 @item -Wno-analyzer-shift-count-negative
9627 @opindex Wanalyzer-shift-count-negative
9628 @opindex Wno-analyzer-shift-count-negative
9629 This warning requires @option{-fanalyzer}, which enables it; use
9630 @option{-Wno-analyzer-shift-count-negative} to disable it.
9631
9632 This diagnostic warns for paths through the code in which a
9633 shift is attempted with a negative count. It is analogous to
9634 the @option{-Wshift-count-negative} diagnostic implemented in
9635 the C/C++ front ends, but is implemented based on analyzing
9636 interprocedural paths, rather than merely parsing the syntax tree.
9637 However, the analyzer does not prioritize detection of such paths, so
9638 false negatives are more likely relative to other warnings.
9639
9640 @item -Wno-analyzer-shift-count-overflow
9641 @opindex Wanalyzer-shift-count-overflow
9642 @opindex Wno-analyzer-shift-count-overflow
9643 This warning requires @option{-fanalyzer}, which enables it; use
9644 @option{-Wno-analyzer-shift-count-overflow} to disable it.
9645
9646 This diagnostic warns for paths through the code in which a
9647 shift is attempted with a count greater than or equal to the
9648 precision of the operand's type. It is analogous to
9649 the @option{-Wshift-count-overflow} diagnostic implemented in
9650 the C/C++ front ends, but is implemented based on analyzing
9651 interprocedural paths, rather than merely parsing the syntax tree.
9652 However, the analyzer does not prioritize detection of such paths, so
9653 false negatives are more likely relative to other warnings.
9654
9655 @item -Wno-analyzer-stale-setjmp-buffer
9656 @opindex Wanalyzer-stale-setjmp-buffer
9657 @opindex Wno-analyzer-stale-setjmp-buffer
9658 This warning requires @option{-fanalyzer}, which enables it; use
9659 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
9660
9661 This diagnostic warns for paths through the code in which
9662 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
9663 to a @code{setjmp} call in a function that has returned.
9664
9665 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
9666 location, it records the stack frame. The stack frame becomes invalid
9667 when the function containing the @code{setjmp} call returns. Attempting
9668 to rewind to it via @code{longjmp} would reference a stack frame that
9669 no longer exists, and likely lead to a crash (or worse).
9670
9671 @item -Wno-analyzer-tainted-allocation-size
9672 @opindex Wanalyzer-tainted-allocation-size
9673 @opindex Wno-analyzer-tainted-allocation-size
9674 This warning requires both @option{-fanalyzer} and
9675 @option{-fanalyzer-checker=taint} to enable it;
9676 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
9677
9678 This diagnostic warns for paths through the code in which a value
9679 that could be under an attacker's control is used as the size
9680 of an allocation without being sanitized, so that an attacker could
9681 inject an excessively large allocation and potentially cause a denial
9682 of service attack.
9683
9684 See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
9685
9686 @item -Wno-analyzer-tainted-array-index
9687 @opindex Wanalyzer-tainted-array-index
9688 @opindex Wno-analyzer-tainted-array-index
9689 This warning requires both @option{-fanalyzer} and
9690 @option{-fanalyzer-checker=taint} to enable it;
9691 use @option{-Wno-analyzer-tainted-array-index} to disable it.
9692
9693 This diagnostic warns for paths through the code in which a value
9694 that could be under an attacker's control is used as the index
9695 of an array access without being sanitized, so that an attacker
9696 could inject an out-of-bounds access.
9697
9698 See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
9699
9700 @item -Wno-analyzer-tainted-divisor
9701 @opindex Wanalyzer-tainted-divisor
9702 @opindex Wno-analyzer-tainted-divisor
9703 This warning requires both @option{-fanalyzer} and
9704 @option{-fanalyzer-checker=taint} to enable it;
9705 use @option{-Wno-analyzer-tainted-divisor} to disable it.
9706
9707 This diagnostic warns for paths through the code in which a value
9708 that could be under an attacker's control is used as the divisor
9709 in a division or modulus operation without being sanitized, so that
9710 an attacker could inject a division-by-zero.
9711
9712 @item -Wno-analyzer-tainted-offset
9713 @opindex Wanalyzer-tainted-offset
9714 @opindex Wno-analyzer-tainted-offset
9715 This warning requires both @option{-fanalyzer} and
9716 @option{-fanalyzer-checker=taint} to enable it;
9717 use @option{-Wno-analyzer-tainted-offset} to disable it.
9718
9719 This diagnostic warns for paths through the code in which a value
9720 that could be under an attacker's control is used as a pointer offset
9721 without being sanitized, so that an attacker could inject an out-of-bounds
9722 access.
9723
9724 See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
9725
9726 @item -Wno-analyzer-tainted-size
9727 @opindex Wanalyzer-tainted-size
9728 @opindex Wno-analyzer-tainted-size
9729 This warning requires both @option{-fanalyzer} and
9730 @option{-fanalyzer-checker=taint} to enable it;
9731 use @option{-Wno-analyzer-tainted-size} to disable it.
9732
9733 This diagnostic warns for paths through the code in which a value
9734 that could be under an attacker's control is used as the size of
9735 an operation such as @code{memset} without being sanitized, so that an
9736 attacker could inject an out-of-bounds access.
9737
9738 @item -Wno-analyzer-unsafe-call-within-signal-handler
9739 @opindex Wanalyzer-unsafe-call-within-signal-handler
9740 @opindex Wno-analyzer-unsafe-call-within-signal-handler
9741 This warning requires @option{-fanalyzer}, which enables it; use
9742 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
9743
9744 This diagnostic warns for paths through the code in which a
9745 function known to be async-signal-unsafe (such as @code{fprintf}) is
9746 called from a signal handler.
9747
9748 @item -Wno-analyzer-use-after-free
9749 @opindex Wanalyzer-use-after-free
9750 @opindex Wno-analyzer-use-after-free
9751 This warning requires @option{-fanalyzer}, which enables it; use
9752 @option{-Wno-analyzer-use-after-free} to disable it.
9753
9754 This diagnostic warns for paths through the code in which a
9755 pointer is used after a deallocator is called on it: either @code{free},
9756 or a deallocator referenced by attribute @code{malloc}.
9757
9758 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
9759 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
9760 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
9761 This warning requires @option{-fanalyzer}, which enables it; use
9762 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
9763 to disable it.
9764
9765 This diagnostic warns for paths through the code in which a pointer
9766 is dereferenced that points to a variable in a stale stack frame.
9767
9768 @item -Wno-analyzer-write-to-const
9769 @opindex Wanalyzer-write-to-const
9770 @opindex Wno-analyzer-write-to-const
9771 This warning requires @option{-fanalyzer}, which enables it; use
9772 @option{-Wno-analyzer-write-to-const}
9773 to disable it.
9774
9775 This diagnostic warns for paths through the code in which the analyzer
9776 detects an attempt to write through a pointer to a @code{const} object.
9777 However, the analyzer does not prioritize detection of such paths, so
9778 false negatives are more likely relative to other warnings.
9779
9780 @item -Wno-analyzer-write-to-string-literal
9781 @opindex Wanalyzer-write-to-string-literal
9782 @opindex Wno-analyzer-write-to-string-literal
9783 This warning requires @option{-fanalyzer}, which enables it; use
9784 @option{-Wno-analyzer-write-to-string-literal}
9785 to disable it.
9786
9787 This diagnostic warns for paths through the code in which the analyzer
9788 detects an attempt to write through a pointer to a string literal.
9789 However, the analyzer does not prioritize detection of such paths, so
9790 false negatives are more likely relative to other warnings.
9791
9792 @item -Wno-analyzer-use-of-uninitialized-value
9793 @opindex Wanalyzer-use-of-uninitialized-value
9794 @opindex Wno-analyzer-use-of-uninitialized-value
9795 This warning requires @option{-fanalyzer}, which enables it; use
9796 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
9797
9798 This diagnostic warns for paths through the code in which an uninitialized
9799 value is used.
9800
9801 @end table
9802
9803 Pertinent parameters for controlling the exploration are:
9804 @option{--param analyzer-bb-explosion-factor=@var{value}},
9805 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
9806 @option{--param analyzer-max-recursion-depth=@var{value}}, and
9807 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
9808
9809 The following options control the analyzer.
9810
9811 @table @gcctabopt
9812
9813 @item -fanalyzer-call-summaries
9814 @opindex fanalyzer-call-summaries
9815 @opindex fno-analyzer-call-summaries
9816 Simplify interprocedural analysis by computing the effect of certain calls,
9817 rather than exploring all paths through the function from callsite to each
9818 possible return.
9819
9820 If enabled, call summaries are only used for functions with more than one
9821 call site, and that are sufficiently complicated (as per
9822 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
9823
9824 @item -fanalyzer-checker=@var{name}
9825 @opindex fanalyzer-checker
9826 Restrict the analyzer to run just the named checker, and enable it.
9827
9828 Some checkers are disabled by default (even with @option{-fanalyzer}),
9829 such as the @code{taint} checker that implements
9830 @option{-Wanalyzer-tainted-array-index}, and this option is required
9831 to enable them.
9832
9833 @item -fno-analyzer-feasibility
9834 @opindex fanalyzer-feasibility
9835 @opindex fno-analyzer-feasibility
9836 This option is intended for analyzer developers.
9837
9838 By default the analyzer verifies that there is a feasible control flow path
9839 for each diagnostic it emits: that the conditions that hold are not mutually
9840 exclusive. Diagnostics for which no feasible path can be found are rejected.
9841 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
9842 debugging issues in this code.
9843
9844 @item -fanalyzer-fine-grained
9845 @opindex fanalyzer-fine-grained
9846 @opindex fno-analyzer-fine-grained
9847 This option is intended for analyzer developers.
9848
9849 Internally the analyzer builds an ``exploded graph'' that combines
9850 control flow graphs with data flow information.
9851
9852 By default, an edge in this graph can contain the effects of a run
9853 of multiple statements within a basic block. With
9854 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
9855
9856 @item -fanalyzer-show-duplicate-count
9857 @opindex fanalyzer-show-duplicate-count
9858 @opindex fno-analyzer-show-duplicate-count
9859 This option is intended for analyzer developers: if multiple diagnostics
9860 have been detected as being duplicates of each other, it emits a note when
9861 reporting the best diagnostic, giving the number of additional diagnostics
9862 that were suppressed by the deduplication logic.
9863
9864 @item -fno-analyzer-state-merge
9865 @opindex fanalyzer-state-merge
9866 @opindex fno-analyzer-state-merge
9867 This option is intended for analyzer developers.
9868
9869 By default the analyzer attempts to simplify analysis by merging
9870 sufficiently similar states at each program point as it builds its
9871 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
9872 merging can be suppressed, for debugging state-handling issues.
9873
9874 @item -fno-analyzer-state-purge
9875 @opindex fanalyzer-state-purge
9876 @opindex fno-analyzer-state-purge
9877 This option is intended for analyzer developers.
9878
9879 By default the analyzer attempts to simplify analysis by purging
9880 aspects of state at a program point that appear to no longer be relevant
9881 e.g. the values of locals that aren't accessed later in the function
9882 and which aren't relevant to leak analysis.
9883
9884 With @option{-fno-analyzer-state-purge} this purging of state can
9885 be suppressed, for debugging state-handling issues.
9886
9887 @item -fanalyzer-transitivity
9888 @opindex fanalyzer-transitivity
9889 @opindex fno-analyzer-transitivity
9890 This option enables transitivity of constraints within the analyzer.
9891
9892 @item -fanalyzer-verbose-edges
9893 This option is intended for analyzer developers. It enables more
9894 verbose, lower-level detail in the descriptions of control flow
9895 within diagnostic paths.
9896
9897 @item -fanalyzer-verbose-state-changes
9898 This option is intended for analyzer developers. It enables more
9899 verbose, lower-level detail in the descriptions of events relating
9900 to state machines within diagnostic paths.
9901
9902 @item -fanalyzer-verbosity=@var{level}
9903 This option controls the complexity of the control flow paths that are
9904 emitted for analyzer diagnostics.
9905
9906 The @var{level} can be one of:
9907
9908 @table @samp
9909 @item 0
9910 At this level, interprocedural call and return events are displayed,
9911 along with the most pertinent state-change events relating to
9912 a diagnostic. For example, for a double-@code{free} diagnostic,
9913 both calls to @code{free} will be shown.
9914
9915 @item 1
9916 As per the previous level, but also show events for the entry
9917 to each function.
9918
9919 @item 2
9920 As per the previous level, but also show events relating to
9921 control flow that are significant to triggering the issue
9922 (e.g. ``true path taken'' at a conditional).
9923
9924 This level is the default.
9925
9926 @item 3
9927 As per the previous level, but show all control flow events, not
9928 just significant ones.
9929
9930 @item 4
9931 This level is intended for analyzer developers; it adds various
9932 other events intended for debugging the analyzer.
9933
9934 @end table
9935
9936 @item -fdump-analyzer
9937 @opindex fdump-analyzer
9938 Dump internal details about what the analyzer is doing to
9939 @file{@var{file}.analyzer.txt}.
9940 This option is overridden by @option{-fdump-analyzer-stderr}.
9941
9942 @item -fdump-analyzer-stderr
9943 @opindex fdump-analyzer-stderr
9944 Dump internal details about what the analyzer is doing to stderr.
9945 This option overrides @option{-fdump-analyzer}.
9946
9947 @item -fdump-analyzer-callgraph
9948 @opindex fdump-analyzer-callgraph
9949 Dump a representation of the call graph suitable for viewing with
9950 GraphViz to @file{@var{file}.callgraph.dot}.
9951
9952 @item -fdump-analyzer-exploded-graph
9953 @opindex fdump-analyzer-exploded-graph
9954 Dump a representation of the ``exploded graph'' suitable for viewing with
9955 GraphViz to @file{@var{file}.eg.dot}.
9956 Nodes are color-coded based on state-machine states to emphasize
9957 state changes.
9958
9959 @item -fdump-analyzer-exploded-nodes
9960 @opindex dump-analyzer-exploded-nodes
9961 Emit diagnostics showing where nodes in the ``exploded graph'' are
9962 in relation to the program source.
9963
9964 @item -fdump-analyzer-exploded-nodes-2
9965 @opindex dump-analyzer-exploded-nodes-2
9966 Dump a textual representation of the ``exploded graph'' to
9967 @file{@var{file}.eg.txt}.
9968
9969 @item -fdump-analyzer-exploded-nodes-3
9970 @opindex dump-analyzer-exploded-nodes-3
9971 Dump a textual representation of the ``exploded graph'' to
9972 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
9973 This is typically a large number of dump files.
9974
9975 @item -fdump-analyzer-exploded-paths
9976 @opindex fdump-analyzer-exploded-paths
9977 Dump a textual representation of the ``exploded path'' for each
9978 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
9979
9980 @item -fdump-analyzer-feasibility
9981 @opindex dump-analyzer-feasibility
9982 Dump internal details about the analyzer's search for feasible paths.
9983 The details are written in a form suitable for viewing with GraphViz
9984 to filenames of the form @file{@var{file}.*.fg.dot} and
9985 @file{@var{file}.*.tg.dot}.
9986
9987 @item -fdump-analyzer-json
9988 @opindex fdump-analyzer-json
9989 Dump a compressed JSON representation of analyzer internals to
9990 @file{@var{file}.analyzer.json.gz}. The precise format is subject
9991 to change.
9992
9993 @item -fdump-analyzer-state-purge
9994 @opindex fdump-analyzer-state-purge
9995 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
9996 ``supergraph'' suitable for viewing with GraphViz, but annotate the
9997 graph with information on what state will be purged at each node.
9998 The graph is written to @file{@var{file}.state-purge.dot}.
9999
10000 @item -fdump-analyzer-supergraph
10001 @opindex fdump-analyzer-supergraph
10002 Dump representations of the ``supergraph'' suitable for viewing with
10003 GraphViz to @file{@var{file}.supergraph.dot} and to
10004 @file{@var{file}.supergraph-eg.dot}. These show all of the
10005 control flow graphs in the program, with interprocedural edges for
10006 calls and returns. The second dump contains annotations showing nodes
10007 in the ``exploded graph'' and diagnostics associated with them.
10008
10009 @end table
10010
10011 @node Debugging Options
10012 @section Options for Debugging Your Program
10013 @cindex options, debugging
10014 @cindex debugging information options
10015
10016 To tell GCC to emit extra information for use by a debugger, in almost
10017 all cases you need only to add @option{-g} to your other options. Some debug
10018 formats can co-exist (like DWARF with CTF) when each of them is enabled
10019 explicitly by adding the respective command line option to your other options.
10020
10021 GCC allows you to use @option{-g} with
10022 @option{-O}. The shortcuts taken by optimized code may occasionally
10023 be surprising: some variables you declared may not exist
10024 at all; flow of control may briefly move where you did not expect it;
10025 some statements may not be executed because they compute constant
10026 results or their values are already at hand; some statements may
10027 execute in different places because they have been moved out of loops.
10028 Nevertheless it is possible to debug optimized output. This makes
10029 it reasonable to use the optimizer for programs that might have bugs.
10030
10031 If you are not using some other optimization option, consider
10032 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
10033 With no @option{-O} option at all, some compiler passes that collect
10034 information useful for debugging do not run at all, so that
10035 @option{-Og} may result in a better debugging experience.
10036
10037 @table @gcctabopt
10038 @item -g
10039 @opindex g
10040 Produce debugging information in the operating system's native format
10041 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
10042 information.
10043
10044 On most systems that use stabs format, @option{-g} enables use of extra
10045 debugging information that only GDB can use; this extra information
10046 makes debugging work better in GDB but probably makes other debuggers
10047 crash or
10048 refuse to read the program. If you want to control for certain whether
10049 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
10050 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
10051
10052 @item -ggdb
10053 @opindex ggdb
10054 Produce debugging information for use by GDB@. This means to use the
10055 most expressive format available (DWARF, stabs, or the native format
10056 if neither of those are supported), including GDB extensions if at all
10057 possible.
10058
10059 @item -gdwarf
10060 @itemx -gdwarf-@var{version}
10061 @opindex gdwarf
10062 Produce debugging information in DWARF format (if that is supported).
10063 The value of @var{version} may be either 2, 3, 4 or 5; the default
10064 version for most targets is 5 (with the exception of VxWorks, TPF and
10065 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
10066 to version 4).
10067
10068 Note that with DWARF Version 2, some ports require and always
10069 use some non-conflicting DWARF 3 extensions in the unwind tables.
10070
10071 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
10072 for maximum benefit. Version 5 requires GDB 8.0 or higher.
10073
10074 GCC no longer supports DWARF Version 1, which is substantially
10075 different than Version 2 and later. For historical reasons, some
10076 other DWARF-related options such as
10077 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
10078 in their names, but apply to all currently-supported versions of DWARF.
10079
10080 @item -gbtf
10081 @opindex gbtf
10082 Request BTF debug information. BTF is the default debugging format for the
10083 eBPF target. On other targets, like x86, BTF debug information can be
10084 generated along with DWARF debug information when both of the debug formats are
10085 enabled explicitly via their respective command line options.
10086
10087 @item -gctf
10088 @itemx -gctf@var{level}
10089 @opindex gctf
10090 Request CTF debug information and use level to specify how much CTF debug
10091 information should be produced. If @option{-gctf} is specified
10092 without a value for level, the default level of CTF debug information is 2.
10093
10094 CTF debug information can be generated along with DWARF debug information when
10095 both of the debug formats are enabled explicitly via their respective command
10096 line options.
10097
10098 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
10099 negates @option{-gctf}.
10100
10101 Level 1 produces CTF information for tracebacks only. This includes callsite
10102 information, but does not include type information.
10103
10104 Level 2 produces type information for entities (functions, data objects etc.)
10105 at file-scope or global-scope only.
10106
10107 @item -gstabs
10108 @opindex gstabs
10109 Produce debugging information in stabs format (if that is supported),
10110 without GDB extensions. This is the format used by DBX on most BSD
10111 systems. On MIPS, Alpha and System V Release 4 systems this option
10112 produces stabs debugging output that is not understood by DBX@.
10113 On System V Release 4 systems this option requires the GNU assembler.
10114
10115 @item -gstabs+
10116 @opindex gstabs+
10117 Produce debugging information in stabs format (if that is supported),
10118 using GNU extensions understood only by the GNU debugger (GDB)@. The
10119 use of these extensions is likely to make other debuggers crash or
10120 refuse to read the program.
10121
10122 @item -gxcoff
10123 @opindex gxcoff
10124 Produce debugging information in XCOFF format (if that is supported).
10125 This is the format used by the DBX debugger on IBM RS/6000 systems.
10126
10127 @item -gxcoff+
10128 @opindex gxcoff+
10129 Produce debugging information in XCOFF format (if that is supported),
10130 using GNU extensions understood only by the GNU debugger (GDB)@. The
10131 use of these extensions is likely to make other debuggers crash or
10132 refuse to read the program, and may cause assemblers other than the GNU
10133 assembler (GAS) to fail with an error.
10134
10135 @item -gvms
10136 @opindex gvms
10137 Produce debugging information in Alpha/VMS debug format (if that is
10138 supported). This is the format used by DEBUG on Alpha/VMS systems.
10139
10140 @item -g@var{level}
10141 @itemx -ggdb@var{level}
10142 @itemx -gstabs@var{level}
10143 @itemx -gxcoff@var{level}
10144 @itemx -gvms@var{level}
10145 Request debugging information and also use @var{level} to specify how
10146 much information. The default level is 2.
10147
10148 Level 0 produces no debug information at all. Thus, @option{-g0} negates
10149 @option{-g}.
10150
10151 Level 1 produces minimal information, enough for making backtraces in
10152 parts of the program that you don't plan to debug. This includes
10153 descriptions of functions and external variables, and line number
10154 tables, but no information about local variables.
10155
10156 Level 3 includes extra information, such as all the macro definitions
10157 present in the program. Some debuggers support macro expansion when
10158 you use @option{-g3}.
10159
10160 If you use multiple @option{-g} options, with or without level numbers,
10161 the last such option is the one that is effective.
10162
10163 @option{-gdwarf} does not accept a concatenated debug level, to avoid
10164 confusion with @option{-gdwarf-@var{level}}.
10165 Instead use an additional @option{-g@var{level}} option to change the
10166 debug level for DWARF.
10167
10168 @item -fno-eliminate-unused-debug-symbols
10169 @opindex feliminate-unused-debug-symbols
10170 @opindex fno-eliminate-unused-debug-symbols
10171 By default, no debug information is produced for symbols that are not actually
10172 used. Use this option if you want debug information for all symbols.
10173
10174 @item -femit-class-debug-always
10175 @opindex femit-class-debug-always
10176 Instead of emitting debugging information for a C++ class in only one
10177 object file, emit it in all object files using the class. This option
10178 should be used only with debuggers that are unable to handle the way GCC
10179 normally emits debugging information for classes because using this
10180 option increases the size of debugging information by as much as a
10181 factor of two.
10182
10183 @item -fno-merge-debug-strings
10184 @opindex fmerge-debug-strings
10185 @opindex fno-merge-debug-strings
10186 Direct the linker to not merge together strings in the debugging
10187 information that are identical in different object files. Merging is
10188 not supported by all assemblers or linkers. Merging decreases the size
10189 of the debug information in the output file at the cost of increasing
10190 link processing time. Merging is enabled by default.
10191
10192 @item -fdebug-prefix-map=@var{old}=@var{new}
10193 @opindex fdebug-prefix-map
10194 When compiling files residing in directory @file{@var{old}}, record
10195 debugging information describing them as if the files resided in
10196 directory @file{@var{new}} instead. This can be used to replace a
10197 build-time path with an install-time path in the debug info. It can
10198 also be used to change an absolute path to a relative path by using
10199 @file{.} for @var{new}. This can give more reproducible builds, which
10200 are location independent, but may require an extra command to tell GDB
10201 where to find the source files. See also @option{-ffile-prefix-map}.
10202
10203 @item -fvar-tracking
10204 @opindex fvar-tracking
10205 Run variable tracking pass. It computes where variables are stored at each
10206 position in code. Better debugging information is then generated
10207 (if the debugging information format supports this information).
10208
10209 It is enabled by default when compiling with optimization (@option{-Os},
10210 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
10211 the debug info format supports it.
10212
10213 @item -fvar-tracking-assignments
10214 @opindex fvar-tracking-assignments
10215 @opindex fno-var-tracking-assignments
10216 Annotate assignments to user variables early in the compilation and
10217 attempt to carry the annotations over throughout the compilation all the
10218 way to the end, in an attempt to improve debug information while
10219 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
10220
10221 It can be enabled even if var-tracking is disabled, in which case
10222 annotations are created and maintained, but discarded at the end.
10223 By default, this flag is enabled together with @option{-fvar-tracking},
10224 except when selective scheduling is enabled.
10225
10226 @item -gsplit-dwarf
10227 @opindex gsplit-dwarf
10228 If DWARF debugging information is enabled, separate as much debugging
10229 information as possible into a separate output file with the extension
10230 @file{.dwo}. This option allows the build system to avoid linking files with
10231 debug information. To be useful, this option requires a debugger capable of
10232 reading @file{.dwo} files.
10233
10234 @item -gdwarf32
10235 @itemx -gdwarf64
10236 @opindex gdwarf32
10237 @opindex gdwarf64
10238 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
10239 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
10240 DWARF format. The default is target specific, on most targets it is
10241 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
10242 can't support more than 2GiB of debug information in any of the DWARF
10243 debug information sections. The 64-bit DWARF format allows larger debug
10244 information and might not be well supported by all consumers yet.
10245
10246 @item -gdescribe-dies
10247 @opindex gdescribe-dies
10248 Add description attributes to some DWARF DIEs that have no name attribute,
10249 such as artificial variables, external references and call site
10250 parameter DIEs.
10251
10252 @item -gpubnames
10253 @opindex gpubnames
10254 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
10255
10256 @item -ggnu-pubnames
10257 @opindex ggnu-pubnames
10258 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
10259 suitable for conversion into a GDB@ index. This option is only useful
10260 with a linker that can produce GDB@ index version 7.
10261
10262 @item -fdebug-types-section
10263 @opindex fdebug-types-section
10264 @opindex fno-debug-types-section
10265 When using DWARF Version 4 or higher, type DIEs can be put into
10266 their own @code{.debug_types} section instead of making them part of the
10267 @code{.debug_info} section. It is more efficient to put them in a separate
10268 comdat section since the linker can then remove duplicates.
10269 But not all DWARF consumers support @code{.debug_types} sections yet
10270 and on some objects @code{.debug_types} produces larger instead of smaller
10271 debugging information.
10272
10273 @item -grecord-gcc-switches
10274 @itemx -gno-record-gcc-switches
10275 @opindex grecord-gcc-switches
10276 @opindex gno-record-gcc-switches
10277 This switch causes the command-line options used to invoke the
10278 compiler that may affect code generation to be appended to the
10279 DW_AT_producer attribute in DWARF debugging information. The options
10280 are concatenated with spaces separating them from each other and from
10281 the compiler version.
10282 It is enabled by default.
10283 See also @option{-frecord-gcc-switches} for another
10284 way of storing compiler options into the object file.
10285
10286 @item -gstrict-dwarf
10287 @opindex gstrict-dwarf
10288 Disallow using extensions of later DWARF standard version than selected
10289 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
10290 DWARF extensions from later standard versions is allowed.
10291
10292 @item -gno-strict-dwarf
10293 @opindex gno-strict-dwarf
10294 Allow using extensions of later DWARF standard version than selected with
10295 @option{-gdwarf-@var{version}}.
10296
10297 @item -gas-loc-support
10298 @opindex gas-loc-support
10299 Inform the compiler that the assembler supports @code{.loc} directives.
10300 It may then use them for the assembler to generate DWARF2+ line number
10301 tables.
10302
10303 This is generally desirable, because assembler-generated line-number
10304 tables are a lot more compact than those the compiler can generate
10305 itself.
10306
10307 This option will be enabled by default if, at GCC configure time, the
10308 assembler was found to support such directives.
10309
10310 @item -gno-as-loc-support
10311 @opindex gno-as-loc-support
10312 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
10313 line number tables are to be generated.
10314
10315 @item -gas-locview-support
10316 @opindex gas-locview-support
10317 Inform the compiler that the assembler supports @code{view} assignment
10318 and reset assertion checking in @code{.loc} directives.
10319
10320 This option will be enabled by default if, at GCC configure time, the
10321 assembler was found to support them.
10322
10323 @item -gno-as-locview-support
10324 Force GCC to assign view numbers internally, if
10325 @option{-gvariable-location-views} are explicitly requested.
10326
10327 @item -gcolumn-info
10328 @itemx -gno-column-info
10329 @opindex gcolumn-info
10330 @opindex gno-column-info
10331 Emit location column information into DWARF debugging information, rather
10332 than just file and line.
10333 This option is enabled by default.
10334
10335 @item -gstatement-frontiers
10336 @itemx -gno-statement-frontiers
10337 @opindex gstatement-frontiers
10338 @opindex gno-statement-frontiers
10339 This option causes GCC to create markers in the internal representation
10340 at the beginning of statements, and to keep them roughly in place
10341 throughout compilation, using them to guide the output of @code{is_stmt}
10342 markers in the line number table. This is enabled by default when
10343 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
10344 @dots{}), and outputting DWARF 2 debug information at the normal level.
10345
10346 @item -gvariable-location-views
10347 @itemx -gvariable-location-views=incompat5
10348 @itemx -gno-variable-location-views
10349 @opindex gvariable-location-views
10350 @opindex gvariable-location-views=incompat5
10351 @opindex gno-variable-location-views
10352 Augment variable location lists with progressive view numbers implied
10353 from the line number table. This enables debug information consumers to
10354 inspect state at certain points of the program, even if no instructions
10355 associated with the corresponding source locations are present at that
10356 point. If the assembler lacks support for view numbers in line number
10357 tables, this will cause the compiler to emit the line number table,
10358 which generally makes them somewhat less compact. The augmented line
10359 number tables and location lists are fully backward-compatible, so they
10360 can be consumed by debug information consumers that are not aware of
10361 these augmentations, but they won't derive any benefit from them either.
10362
10363 This is enabled by default when outputting DWARF 2 debug information at
10364 the normal level, as long as there is assembler support,
10365 @option{-fvar-tracking-assignments} is enabled and
10366 @option{-gstrict-dwarf} is not. When assembler support is not
10367 available, this may still be enabled, but it will force GCC to output
10368 internal line number tables, and if
10369 @option{-ginternal-reset-location-views} is not enabled, that will most
10370 certainly lead to silently mismatching location views.
10371
10372 There is a proposed representation for view numbers that is not backward
10373 compatible with the location list format introduced in DWARF 5, that can
10374 be enabled with @option{-gvariable-location-views=incompat5}. This
10375 option may be removed in the future, is only provided as a reference
10376 implementation of the proposed representation. Debug information
10377 consumers are not expected to support this extended format, and they
10378 would be rendered unable to decode location lists using it.
10379
10380 @item -ginternal-reset-location-views
10381 @itemx -gno-internal-reset-location-views
10382 @opindex ginternal-reset-location-views
10383 @opindex gno-internal-reset-location-views
10384 Attempt to determine location views that can be omitted from location
10385 view lists. This requires the compiler to have very accurate insn
10386 length estimates, which isn't always the case, and it may cause
10387 incorrect view lists to be generated silently when using an assembler
10388 that does not support location view lists. The GNU assembler will flag
10389 any such error as a @code{view number mismatch}. This is only enabled
10390 on ports that define a reliable estimation function.
10391
10392 @item -ginline-points
10393 @itemx -gno-inline-points
10394 @opindex ginline-points
10395 @opindex gno-inline-points
10396 Generate extended debug information for inlined functions. Location
10397 view tracking markers are inserted at inlined entry points, so that
10398 address and view numbers can be computed and output in debug
10399 information. This can be enabled independently of location views, in
10400 which case the view numbers won't be output, but it can only be enabled
10401 along with statement frontiers, and it is only enabled by default if
10402 location views are enabled.
10403
10404 @item -gz@r{[}=@var{type}@r{]}
10405 @opindex gz
10406 Produce compressed debug sections in DWARF format, if that is supported.
10407 If @var{type} is not given, the default type depends on the capabilities
10408 of the assembler and linker used. @var{type} may be one of
10409 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
10410 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
10411 compression in traditional GNU format). If the linker doesn't support
10412 writing compressed debug sections, the option is rejected. Otherwise,
10413 if the assembler does not support them, @option{-gz} is silently ignored
10414 when producing object files.
10415
10416 @item -femit-struct-debug-baseonly
10417 @opindex femit-struct-debug-baseonly
10418 Emit debug information for struct-like types
10419 only when the base name of the compilation source file
10420 matches the base name of file in which the struct is defined.
10421
10422 This option substantially reduces the size of debugging information,
10423 but at significant potential loss in type information to the debugger.
10424 See @option{-femit-struct-debug-reduced} for a less aggressive option.
10425 See @option{-femit-struct-debug-detailed} for more detailed control.
10426
10427 This option works only with DWARF debug output.
10428
10429 @item -femit-struct-debug-reduced
10430 @opindex femit-struct-debug-reduced
10431 Emit debug information for struct-like types
10432 only when the base name of the compilation source file
10433 matches the base name of file in which the type is defined,
10434 unless the struct is a template or defined in a system header.
10435
10436 This option significantly reduces the size of debugging information,
10437 with some potential loss in type information to the debugger.
10438 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
10439 See @option{-femit-struct-debug-detailed} for more detailed control.
10440
10441 This option works only with DWARF debug output.
10442
10443 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
10444 @opindex femit-struct-debug-detailed
10445 Specify the struct-like types
10446 for which the compiler generates debug information.
10447 The intent is to reduce duplicate struct debug information
10448 between different object files within the same program.
10449
10450 This option is a detailed version of
10451 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
10452 which serves for most needs.
10453
10454 A specification has the syntax@*
10455 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
10456
10457 The optional first word limits the specification to
10458 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
10459 A struct type is used directly when it is the type of a variable, member.
10460 Indirect uses arise through pointers to structs.
10461 That is, when use of an incomplete struct is valid, the use is indirect.
10462 An example is
10463 @samp{struct one direct; struct two * indirect;}.
10464
10465 The optional second word limits the specification to
10466 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
10467 Generic structs are a bit complicated to explain.
10468 For C++, these are non-explicit specializations of template classes,
10469 or non-template classes within the above.
10470 Other programming languages have generics,
10471 but @option{-femit-struct-debug-detailed} does not yet implement them.
10472
10473 The third word specifies the source files for those
10474 structs for which the compiler should emit debug information.
10475 The values @samp{none} and @samp{any} have the normal meaning.
10476 The value @samp{base} means that
10477 the base of name of the file in which the type declaration appears
10478 must match the base of the name of the main compilation file.
10479 In practice, this means that when compiling @file{foo.c}, debug information
10480 is generated for types declared in that file and @file{foo.h},
10481 but not other header files.
10482 The value @samp{sys} means those types satisfying @samp{base}
10483 or declared in system or compiler headers.
10484
10485 You may need to experiment to determine the best settings for your application.
10486
10487 The default is @option{-femit-struct-debug-detailed=all}.
10488
10489 This option works only with DWARF debug output.
10490
10491 @item -fno-dwarf2-cfi-asm
10492 @opindex fdwarf2-cfi-asm
10493 @opindex fno-dwarf2-cfi-asm
10494 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
10495 instead of using GAS @code{.cfi_*} directives.
10496
10497 @item -fno-eliminate-unused-debug-types
10498 @opindex feliminate-unused-debug-types
10499 @opindex fno-eliminate-unused-debug-types
10500 Normally, when producing DWARF output, GCC avoids producing debug symbol
10501 output for types that are nowhere used in the source file being compiled.
10502 Sometimes it is useful to have GCC emit debugging
10503 information for all types declared in a compilation
10504 unit, regardless of whether or not they are actually used
10505 in that compilation unit, for example
10506 if, in the debugger, you want to cast a value to a type that is
10507 not actually used in your program (but is declared). More often,
10508 however, this results in a significant amount of wasted space.
10509 @end table
10510
10511 @node Optimize Options
10512 @section Options That Control Optimization
10513 @cindex optimize options
10514 @cindex options, optimization
10515
10516 These options control various sorts of optimizations.
10517
10518 Without any optimization option, the compiler's goal is to reduce the
10519 cost of compilation and to make debugging produce the expected
10520 results. Statements are independent: if you stop the program with a
10521 breakpoint between statements, you can then assign a new value to any
10522 variable or change the program counter to any other statement in the
10523 function and get exactly the results you expect from the source
10524 code.
10525
10526 Turning on optimization flags makes the compiler attempt to improve
10527 the performance and/or code size at the expense of compilation time
10528 and possibly the ability to debug the program.
10529
10530 The compiler performs optimization based on the knowledge it has of the
10531 program. Compiling multiple files at once to a single output file mode allows
10532 the compiler to use information gained from all of the files when compiling
10533 each of them.
10534
10535 Not all optimizations are controlled directly by a flag. Only
10536 optimizations that have a flag are listed in this section.
10537
10538 Most optimizations are completely disabled at @option{-O0} or if an
10539 @option{-O} level is not set on the command line, even if individual
10540 optimization flags are specified. Similarly, @option{-Og} suppresses
10541 many optimization passes.
10542
10543 Depending on the target and how GCC was configured, a slightly different
10544 set of optimizations may be enabled at each @option{-O} level than
10545 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
10546 to find out the exact set of optimizations that are enabled at each level.
10547 @xref{Overall Options}, for examples.
10548
10549 @table @gcctabopt
10550 @item -O
10551 @itemx -O1
10552 @opindex O
10553 @opindex O1
10554 Optimize. Optimizing compilation takes somewhat more time, and a lot
10555 more memory for a large function.
10556
10557 With @option{-O}, the compiler tries to reduce code size and execution
10558 time, without performing any optimizations that take a great deal of
10559 compilation time.
10560
10561 @c Note that in addition to the default_options_table list in opts.c,
10562 @c several optimization flags default to true but control optimization
10563 @c passes that are explicitly disabled at -O0.
10564
10565 @option{-O} turns on the following optimization flags:
10566
10567 @c Please keep the following list alphabetized.
10568 @gccoptlist{-fauto-inc-dec @gol
10569 -fbranch-count-reg @gol
10570 -fcombine-stack-adjustments @gol
10571 -fcompare-elim @gol
10572 -fcprop-registers @gol
10573 -fdce @gol
10574 -fdefer-pop @gol
10575 -fdelayed-branch @gol
10576 -fdse @gol
10577 -fforward-propagate @gol
10578 -fguess-branch-probability @gol
10579 -fif-conversion @gol
10580 -fif-conversion2 @gol
10581 -finline-functions-called-once @gol
10582 -fipa-modref @gol
10583 -fipa-profile @gol
10584 -fipa-pure-const @gol
10585 -fipa-reference @gol
10586 -fipa-reference-addressable @gol
10587 -fmerge-constants @gol
10588 -fmove-loop-invariants @gol
10589 -fmove-loop-stores@gol
10590 -fomit-frame-pointer @gol
10591 -freorder-blocks @gol
10592 -fshrink-wrap @gol
10593 -fshrink-wrap-separate @gol
10594 -fsplit-wide-types @gol
10595 -fssa-backprop @gol
10596 -fssa-phiopt @gol
10597 -ftree-bit-ccp @gol
10598 -ftree-ccp @gol
10599 -ftree-ch @gol
10600 -ftree-coalesce-vars @gol
10601 -ftree-copy-prop @gol
10602 -ftree-dce @gol
10603 -ftree-dominator-opts @gol
10604 -ftree-dse @gol
10605 -ftree-forwprop @gol
10606 -ftree-fre @gol
10607 -ftree-phiprop @gol
10608 -ftree-pta @gol
10609 -ftree-scev-cprop @gol
10610 -ftree-sink @gol
10611 -ftree-slsr @gol
10612 -ftree-sra @gol
10613 -ftree-ter @gol
10614 -funit-at-a-time}
10615
10616 @item -O2
10617 @opindex O2
10618 Optimize even more. GCC performs nearly all supported optimizations
10619 that do not involve a space-speed tradeoff.
10620 As compared to @option{-O}, this option increases both compilation time
10621 and the performance of the generated code.
10622
10623 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
10624 also turns on the following optimization flags:
10625
10626 @c Please keep the following list alphabetized!
10627 @gccoptlist{-falign-functions -falign-jumps @gol
10628 -falign-labels -falign-loops @gol
10629 -fcaller-saves @gol
10630 -fcode-hoisting @gol
10631 -fcrossjumping @gol
10632 -fcse-follow-jumps -fcse-skip-blocks @gol
10633 -fdelete-null-pointer-checks @gol
10634 -fdevirtualize -fdevirtualize-speculatively @gol
10635 -fexpensive-optimizations @gol
10636 -ffinite-loops @gol
10637 -fgcse -fgcse-lm @gol
10638 -fhoist-adjacent-loads @gol
10639 -finline-functions @gol
10640 -finline-small-functions @gol
10641 -findirect-inlining @gol
10642 -fipa-bit-cp -fipa-cp -fipa-icf @gol
10643 -fipa-ra -fipa-sra -fipa-vrp @gol
10644 -fisolate-erroneous-paths-dereference @gol
10645 -flra-remat @gol
10646 -foptimize-sibling-calls @gol
10647 -foptimize-strlen @gol
10648 -fpartial-inlining @gol
10649 -fpeephole2 @gol
10650 -freorder-blocks-algorithm=stc @gol
10651 -freorder-blocks-and-partition -freorder-functions @gol
10652 -frerun-cse-after-loop @gol
10653 -fschedule-insns -fschedule-insns2 @gol
10654 -fsched-interblock -fsched-spec @gol
10655 -fstore-merging @gol
10656 -fstrict-aliasing @gol
10657 -fthread-jumps @gol
10658 -ftree-builtin-call-dce @gol
10659 -ftree-loop-vectorize @gol
10660 -ftree-pre @gol
10661 -ftree-slp-vectorize @gol
10662 -ftree-switch-conversion -ftree-tail-merge @gol
10663 -ftree-vrp @gol
10664 -fvect-cost-model=very-cheap}
10665
10666 Please note the warning under @option{-fgcse} about
10667 invoking @option{-O2} on programs that use computed gotos.
10668
10669 @item -O3
10670 @opindex O3
10671 Optimize yet more. @option{-O3} turns on all optimizations specified
10672 by @option{-O2} and also turns on the following optimization flags:
10673
10674 @c Please keep the following list alphabetized!
10675 @gccoptlist{-fgcse-after-reload @gol
10676 -fipa-cp-clone
10677 -floop-interchange @gol
10678 -floop-unroll-and-jam @gol
10679 -fpeel-loops @gol
10680 -fpredictive-commoning @gol
10681 -fsplit-loops @gol
10682 -fsplit-paths @gol
10683 -ftree-loop-distribution @gol
10684 -ftree-partial-pre @gol
10685 -funswitch-loops @gol
10686 -fvect-cost-model=dynamic @gol
10687 -fversion-loops-for-strides}
10688
10689 @item -O0
10690 @opindex O0
10691 Reduce compilation time and make debugging produce the expected
10692 results. This is the default.
10693
10694 @item -Os
10695 @opindex Os
10696 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
10697 except those that often increase code size:
10698
10699 @gccoptlist{-falign-functions -falign-jumps @gol
10700 -falign-labels -falign-loops @gol
10701 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
10702
10703 It also enables @option{-finline-functions}, causes the compiler to tune for
10704 code size rather than execution speed, and performs further optimizations
10705 designed to reduce code size.
10706
10707 @item -Ofast
10708 @opindex Ofast
10709 Disregard strict standards compliance. @option{-Ofast} enables all
10710 @option{-O3} optimizations. It also enables optimizations that are not
10711 valid for all standard-compliant programs.
10712 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
10713 and the Fortran-specific @option{-fstack-arrays}, unless
10714 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
10715 It turns off @option{-fsemantic-interposition}.
10716
10717 @item -Og
10718 @opindex Og
10719 Optimize debugging experience. @option{-Og} should be the optimization
10720 level of choice for the standard edit-compile-debug cycle, offering
10721 a reasonable level of optimization while maintaining fast compilation
10722 and a good debugging experience. It is a better choice than @option{-O0}
10723 for producing debuggable code because some compiler passes
10724 that collect debug information are disabled at @option{-O0}.
10725
10726 Like @option{-O0}, @option{-Og} completely disables a number of
10727 optimization passes so that individual options controlling them have
10728 no effect. Otherwise @option{-Og} enables all @option{-O1}
10729 optimization flags except for those that may interfere with debugging:
10730
10731 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
10732 -fdse -fif-conversion -fif-conversion2 @gol
10733 -finline-functions-called-once @gol
10734 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol
10735 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
10736
10737 @end table
10738
10739 If you use multiple @option{-O} options, with or without level numbers,
10740 the last such option is the one that is effective.
10741
10742 Options of the form @option{-f@var{flag}} specify machine-independent
10743 flags. Most flags have both positive and negative forms; the negative
10744 form of @option{-ffoo} is @option{-fno-foo}. In the table
10745 below, only one of the forms is listed---the one you typically
10746 use. You can figure out the other form by either removing @samp{no-}
10747 or adding it.
10748
10749 The following options control specific optimizations. They are either
10750 activated by @option{-O} options or are related to ones that are. You
10751 can use the following flags in the rare cases when ``fine-tuning'' of
10752 optimizations to be performed is desired.
10753
10754 @table @gcctabopt
10755 @item -fno-defer-pop
10756 @opindex fno-defer-pop
10757 @opindex fdefer-pop
10758 For machines that must pop arguments after a function call, always pop
10759 the arguments as soon as each function returns.
10760 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
10761 this allows the compiler to let arguments accumulate on the stack for several
10762 function calls and pop them all at once.
10763
10764 @item -fforward-propagate
10765 @opindex fforward-propagate
10766 Perform a forward propagation pass on RTL@. The pass tries to combine two
10767 instructions and checks if the result can be simplified. If loop unrolling
10768 is active, two passes are performed and the second is scheduled after
10769 loop unrolling.
10770
10771 This option is enabled by default at optimization levels @option{-O1},
10772 @option{-O2}, @option{-O3}, @option{-Os}.
10773
10774 @item -ffp-contract=@var{style}
10775 @opindex ffp-contract
10776 @option{-ffp-contract=off} disables floating-point expression contraction.
10777 @option{-ffp-contract=fast} enables floating-point expression contraction
10778 such as forming of fused multiply-add operations if the target has
10779 native support for them.
10780 @option{-ffp-contract=on} enables floating-point expression contraction
10781 if allowed by the language standard. This is currently not implemented
10782 and treated equal to @option{-ffp-contract=off}.
10783
10784 The default is @option{-ffp-contract=fast}.
10785
10786 @item -fomit-frame-pointer
10787 @opindex fomit-frame-pointer
10788 Omit the frame pointer in functions that don't need one. This avoids the
10789 instructions to save, set up and restore the frame pointer; on many targets
10790 it also makes an extra register available.
10791
10792 On some targets this flag has no effect because the standard calling sequence
10793 always uses a frame pointer, so it cannot be omitted.
10794
10795 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
10796 is used in all functions. Several targets always omit the frame pointer in
10797 leaf functions.
10798
10799 Enabled by default at @option{-O1} and higher.
10800
10801 @item -foptimize-sibling-calls
10802 @opindex foptimize-sibling-calls
10803 Optimize sibling and tail recursive calls.
10804
10805 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10806
10807 @item -foptimize-strlen
10808 @opindex foptimize-strlen
10809 Optimize various standard C string functions (e.g.@: @code{strlen},
10810 @code{strchr} or @code{strcpy}) and
10811 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
10812
10813 Enabled at levels @option{-O2}, @option{-O3}.
10814
10815 @item -fno-inline
10816 @opindex fno-inline
10817 @opindex finline
10818 Do not expand any functions inline apart from those marked with
10819 the @code{always_inline} attribute. This is the default when not
10820 optimizing.
10821
10822 Single functions can be exempted from inlining by marking them
10823 with the @code{noinline} attribute.
10824
10825 @item -finline-small-functions
10826 @opindex finline-small-functions
10827 Integrate functions into their callers when their body is smaller than expected
10828 function call code (so overall size of program gets smaller). The compiler
10829 heuristically decides which functions are simple enough to be worth integrating
10830 in this way. This inlining applies to all functions, even those not declared
10831 inline.
10832
10833 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10834
10835 @item -findirect-inlining
10836 @opindex findirect-inlining
10837 Inline also indirect calls that are discovered to be known at compile
10838 time thanks to previous inlining. This option has any effect only
10839 when inlining itself is turned on by the @option{-finline-functions}
10840 or @option{-finline-small-functions} options.
10841
10842 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10843
10844 @item -finline-functions
10845 @opindex finline-functions
10846 Consider all functions for inlining, even if they are not declared inline.
10847 The compiler heuristically decides which functions are worth integrating
10848 in this way.
10849
10850 If all calls to a given function are integrated, and the function is
10851 declared @code{static}, then the function is normally not output as
10852 assembler code in its own right.
10853
10854 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
10855 by @option{-fprofile-use} and @option{-fauto-profile}.
10856
10857 @item -finline-functions-called-once
10858 @opindex finline-functions-called-once
10859 Consider all @code{static} functions called once for inlining into their
10860 caller even if they are not marked @code{inline}. If a call to a given
10861 function is integrated, then the function is not output as assembler code
10862 in its own right.
10863
10864 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
10865 but not @option{-Og}.
10866
10867 @item -fearly-inlining
10868 @opindex fearly-inlining
10869 Inline functions marked by @code{always_inline} and functions whose body seems
10870 smaller than the function call overhead early before doing
10871 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
10872 makes profiling significantly cheaper and usually inlining faster on programs
10873 having large chains of nested wrapper functions.
10874
10875 Enabled by default.
10876
10877 @item -fipa-sra
10878 @opindex fipa-sra
10879 Perform interprocedural scalar replacement of aggregates, removal of
10880 unused parameters and replacement of parameters passed by reference
10881 by parameters passed by value.
10882
10883 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
10884
10885 @item -finline-limit=@var{n}
10886 @opindex finline-limit
10887 By default, GCC limits the size of functions that can be inlined. This flag
10888 allows coarse control of this limit. @var{n} is the size of functions that
10889 can be inlined in number of pseudo instructions.
10890
10891 Inlining is actually controlled by a number of parameters, which may be
10892 specified individually by using @option{--param @var{name}=@var{value}}.
10893 The @option{-finline-limit=@var{n}} option sets some of these parameters
10894 as follows:
10895
10896 @table @gcctabopt
10897 @item max-inline-insns-single
10898 is set to @var{n}/2.
10899 @item max-inline-insns-auto
10900 is set to @var{n}/2.
10901 @end table
10902
10903 See below for a documentation of the individual
10904 parameters controlling inlining and for the defaults of these parameters.
10905
10906 @emph{Note:} there may be no value to @option{-finline-limit} that results
10907 in default behavior.
10908
10909 @emph{Note:} pseudo instruction represents, in this particular context, an
10910 abstract measurement of function's size. In no way does it represent a count
10911 of assembly instructions and as such its exact meaning might change from one
10912 release to an another.
10913
10914 @item -fno-keep-inline-dllexport
10915 @opindex fno-keep-inline-dllexport
10916 @opindex fkeep-inline-dllexport
10917 This is a more fine-grained version of @option{-fkeep-inline-functions},
10918 which applies only to functions that are declared using the @code{dllexport}
10919 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
10920 Functions}.
10921
10922 @item -fkeep-inline-functions
10923 @opindex fkeep-inline-functions
10924 In C, emit @code{static} functions that are declared @code{inline}
10925 into the object file, even if the function has been inlined into all
10926 of its callers. This switch does not affect functions using the
10927 @code{extern inline} extension in GNU C90@. In C++, emit any and all
10928 inline functions into the object file.
10929
10930 @item -fkeep-static-functions
10931 @opindex fkeep-static-functions
10932 Emit @code{static} functions into the object file, even if the function
10933 is never used.
10934
10935 @item -fkeep-static-consts
10936 @opindex fkeep-static-consts
10937 Emit variables declared @code{static const} when optimization isn't turned
10938 on, even if the variables aren't referenced.
10939
10940 GCC enables this option by default. If you want to force the compiler to
10941 check if a variable is referenced, regardless of whether or not
10942 optimization is turned on, use the @option{-fno-keep-static-consts} option.
10943
10944 @item -fmerge-constants
10945 @opindex fmerge-constants
10946 Attempt to merge identical constants (string constants and floating-point
10947 constants) across compilation units.
10948
10949 This option is the default for optimized compilation if the assembler and
10950 linker support it. Use @option{-fno-merge-constants} to inhibit this
10951 behavior.
10952
10953 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10954
10955 @item -fmerge-all-constants
10956 @opindex fmerge-all-constants
10957 Attempt to merge identical constants and identical variables.
10958
10959 This option implies @option{-fmerge-constants}. In addition to
10960 @option{-fmerge-constants} this considers e.g.@: even constant initialized
10961 arrays or initialized constant variables with integral or floating-point
10962 types. Languages like C or C++ require each variable, including multiple
10963 instances of the same variable in recursive calls, to have distinct locations,
10964 so using this option results in non-conforming
10965 behavior.
10966
10967 @item -fmodulo-sched
10968 @opindex fmodulo-sched
10969 Perform swing modulo scheduling immediately before the first scheduling
10970 pass. This pass looks at innermost loops and reorders their
10971 instructions by overlapping different iterations.
10972
10973 @item -fmodulo-sched-allow-regmoves
10974 @opindex fmodulo-sched-allow-regmoves
10975 Perform more aggressive SMS-based modulo scheduling with register moves
10976 allowed. By setting this flag certain anti-dependences edges are
10977 deleted, which triggers the generation of reg-moves based on the
10978 life-range analysis. This option is effective only with
10979 @option{-fmodulo-sched} enabled.
10980
10981 @item -fno-branch-count-reg
10982 @opindex fno-branch-count-reg
10983 @opindex fbranch-count-reg
10984 Disable the optimization pass that scans for opportunities to use
10985 ``decrement and branch'' instructions on a count register instead of
10986 instruction sequences that decrement a register, compare it against zero, and
10987 then branch based upon the result. This option is only meaningful on
10988 architectures that support such instructions, which include x86, PowerPC,
10989 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
10990 doesn't remove the decrement and branch instructions from the generated
10991 instruction stream introduced by other optimization passes.
10992
10993 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
10994 except for @option{-Og}.
10995
10996 @item -fno-function-cse
10997 @opindex fno-function-cse
10998 @opindex ffunction-cse
10999 Do not put function addresses in registers; make each instruction that
11000 calls a constant function contain the function's address explicitly.
11001
11002 This option results in less efficient code, but some strange hacks
11003 that alter the assembler output may be confused by the optimizations
11004 performed when this option is not used.
11005
11006 The default is @option{-ffunction-cse}
11007
11008 @item -fno-zero-initialized-in-bss
11009 @opindex fno-zero-initialized-in-bss
11010 @opindex fzero-initialized-in-bss
11011 If the target supports a BSS section, GCC by default puts variables that
11012 are initialized to zero into BSS@. This can save space in the resulting
11013 code.
11014
11015 This option turns off this behavior because some programs explicitly
11016 rely on variables going to the data section---e.g., so that the
11017 resulting executable can find the beginning of that section and/or make
11018 assumptions based on that.
11019
11020 The default is @option{-fzero-initialized-in-bss}.
11021
11022 @item -fthread-jumps
11023 @opindex fthread-jumps
11024 Perform optimizations that check to see if a jump branches to a
11025 location where another comparison subsumed by the first is found. If
11026 so, the first branch is redirected to either the destination of the
11027 second branch or a point immediately following it, depending on whether
11028 the condition is known to be true or false.
11029
11030 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
11031
11032 @item -fsplit-wide-types
11033 @opindex fsplit-wide-types
11034 When using a type that occupies multiple registers, such as @code{long
11035 long} on a 32-bit system, split the registers apart and allocate them
11036 independently. This normally generates better code for those types,
11037 but may make debugging more difficult.
11038
11039 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
11040 @option{-Os}.
11041
11042 @item -fsplit-wide-types-early
11043 @opindex fsplit-wide-types-early
11044 Fully split wide types early, instead of very late.
11045 This option has no effect unless @option{-fsplit-wide-types} is turned on.
11046
11047 This is the default on some targets.
11048
11049 @item -fcse-follow-jumps
11050 @opindex fcse-follow-jumps
11051 In common subexpression elimination (CSE), scan through jump instructions
11052 when the target of the jump is not reached by any other path. For
11053 example, when CSE encounters an @code{if} statement with an
11054 @code{else} clause, CSE follows the jump when the condition
11055 tested is false.
11056
11057 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11058
11059 @item -fcse-skip-blocks
11060 @opindex fcse-skip-blocks
11061 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
11062 follow jumps that conditionally skip over blocks. When CSE
11063 encounters a simple @code{if} statement with no else clause,
11064 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
11065 body of the @code{if}.
11066
11067 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11068
11069 @item -frerun-cse-after-loop
11070 @opindex frerun-cse-after-loop
11071 Re-run common subexpression elimination after loop optimizations are
11072 performed.
11073
11074 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11075
11076 @item -fgcse
11077 @opindex fgcse
11078 Perform a global common subexpression elimination pass.
11079 This pass also performs global constant and copy propagation.
11080
11081 @emph{Note:} When compiling a program using computed gotos, a GCC
11082 extension, you may get better run-time performance if you disable
11083 the global common subexpression elimination pass by adding
11084 @option{-fno-gcse} to the command line.
11085
11086 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11087
11088 @item -fgcse-lm
11089 @opindex fgcse-lm
11090 When @option{-fgcse-lm} is enabled, global common subexpression elimination
11091 attempts to move loads that are only killed by stores into themselves. This
11092 allows a loop containing a load/store sequence to be changed to a load outside
11093 the loop, and a copy/store within the loop.
11094
11095 Enabled by default when @option{-fgcse} is enabled.
11096
11097 @item -fgcse-sm
11098 @opindex fgcse-sm
11099 When @option{-fgcse-sm} is enabled, a store motion pass is run after
11100 global common subexpression elimination. This pass attempts to move
11101 stores out of loops. When used in conjunction with @option{-fgcse-lm},
11102 loops containing a load/store sequence can be changed to a load before
11103 the loop and a store after the loop.
11104
11105 Not enabled at any optimization level.
11106
11107 @item -fgcse-las
11108 @opindex fgcse-las
11109 When @option{-fgcse-las} is enabled, the global common subexpression
11110 elimination pass eliminates redundant loads that come after stores to the
11111 same memory location (both partial and full redundancies).
11112
11113 Not enabled at any optimization level.
11114
11115 @item -fgcse-after-reload
11116 @opindex fgcse-after-reload
11117 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
11118 pass is performed after reload. The purpose of this pass is to clean up
11119 redundant spilling.
11120
11121 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
11122
11123 @item -faggressive-loop-optimizations
11124 @opindex faggressive-loop-optimizations
11125 This option tells the loop optimizer to use language constraints to
11126 derive bounds for the number of iterations of a loop. This assumes that
11127 loop code does not invoke undefined behavior by for example causing signed
11128 integer overflows or out-of-bound array accesses. The bounds for the
11129 number of iterations of a loop are used to guide loop unrolling and peeling
11130 and loop exit test optimizations.
11131 This option is enabled by default.
11132
11133 @item -funconstrained-commons
11134 @opindex funconstrained-commons
11135 This option tells the compiler that variables declared in common blocks
11136 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
11137 prevents certain optimizations that depend on knowing the array bounds.
11138
11139 @item -fcrossjumping
11140 @opindex fcrossjumping
11141 Perform cross-jumping transformation.
11142 This transformation unifies equivalent code and saves code size. The
11143 resulting code may or may not perform better than without cross-jumping.
11144
11145 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11146
11147 @item -fauto-inc-dec
11148 @opindex fauto-inc-dec
11149 Combine increments or decrements of addresses with memory accesses.
11150 This pass is always skipped on architectures that do not have
11151 instructions to support this. Enabled by default at @option{-O1} and
11152 higher on architectures that support this.
11153
11154 @item -fdce
11155 @opindex fdce
11156 Perform dead code elimination (DCE) on RTL@.
11157 Enabled by default at @option{-O1} and higher.
11158
11159 @item -fdse
11160 @opindex fdse
11161 Perform dead store elimination (DSE) on RTL@.
11162 Enabled by default at @option{-O1} and higher.
11163
11164 @item -fif-conversion
11165 @opindex fif-conversion
11166 Attempt to transform conditional jumps into branch-less equivalents. This
11167 includes use of conditional moves, min, max, set flags and abs instructions, and
11168 some tricks doable by standard arithmetics. The use of conditional execution
11169 on chips where it is available is controlled by @option{-fif-conversion2}.
11170
11171 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11172 not with @option{-Og}.
11173
11174 @item -fif-conversion2
11175 @opindex fif-conversion2
11176 Use conditional execution (where available) to transform conditional jumps into
11177 branch-less equivalents.
11178
11179 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11180 not with @option{-Og}.
11181
11182 @item -fdeclone-ctor-dtor
11183 @opindex fdeclone-ctor-dtor
11184 The C++ ABI requires multiple entry points for constructors and
11185 destructors: one for a base subobject, one for a complete object, and
11186 one for a virtual destructor that calls operator delete afterwards.
11187 For a hierarchy with virtual bases, the base and complete variants are
11188 clones, which means two copies of the function. With this option, the
11189 base and complete variants are changed to be thunks that call a common
11190 implementation.
11191
11192 Enabled by @option{-Os}.
11193
11194 @item -fdelete-null-pointer-checks
11195 @opindex fdelete-null-pointer-checks
11196 Assume that programs cannot safely dereference null pointers, and that
11197 no code or data element resides at address zero.
11198 This option enables simple constant
11199 folding optimizations at all optimization levels. In addition, other
11200 optimization passes in GCC use this flag to control global dataflow
11201 analyses that eliminate useless checks for null pointers; these assume
11202 that a memory access to address zero always results in a trap, so
11203 that if a pointer is checked after it has already been dereferenced,
11204 it cannot be null.
11205
11206 Note however that in some environments this assumption is not true.
11207 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
11208 for programs that depend on that behavior.
11209
11210 This option is enabled by default on most targets. On Nios II ELF, it
11211 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
11212
11213 Passes that use the dataflow information
11214 are enabled independently at different optimization levels.
11215
11216 @item -fdevirtualize
11217 @opindex fdevirtualize
11218 Attempt to convert calls to virtual functions to direct calls. This
11219 is done both within a procedure and interprocedurally as part of
11220 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
11221 propagation (@option{-fipa-cp}).
11222 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11223
11224 @item -fdevirtualize-speculatively
11225 @opindex fdevirtualize-speculatively
11226 Attempt to convert calls to virtual functions to speculative direct calls.
11227 Based on the analysis of the type inheritance graph, determine for a given call
11228 the set of likely targets. If the set is small, preferably of size 1, change
11229 the call into a conditional deciding between direct and indirect calls. The
11230 speculative calls enable more optimizations, such as inlining. When they seem
11231 useless after further optimization, they are converted back into original form.
11232
11233 @item -fdevirtualize-at-ltrans
11234 @opindex fdevirtualize-at-ltrans
11235 Stream extra information needed for aggressive devirtualization when running
11236 the link-time optimizer in local transformation mode.
11237 This option enables more devirtualization but
11238 significantly increases the size of streamed data. For this reason it is
11239 disabled by default.
11240
11241 @item -fexpensive-optimizations
11242 @opindex fexpensive-optimizations
11243 Perform a number of minor optimizations that are relatively expensive.
11244
11245 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11246
11247 @item -free
11248 @opindex free
11249 Attempt to remove redundant extension instructions. This is especially
11250 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
11251 registers after writing to their lower 32-bit half.
11252
11253 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
11254 @option{-O3}, @option{-Os}.
11255
11256 @item -fno-lifetime-dse
11257 @opindex fno-lifetime-dse
11258 @opindex flifetime-dse
11259 In C++ the value of an object is only affected by changes within its
11260 lifetime: when the constructor begins, the object has an indeterminate
11261 value, and any changes during the lifetime of the object are dead when
11262 the object is destroyed. Normally dead store elimination will take
11263 advantage of this; if your code relies on the value of the object
11264 storage persisting beyond the lifetime of the object, you can use this
11265 flag to disable this optimization. To preserve stores before the
11266 constructor starts (e.g.@: because your operator new clears the object
11267 storage) but still treat the object as dead after the destructor, you
11268 can use @option{-flifetime-dse=1}. The default behavior can be
11269 explicitly selected with @option{-flifetime-dse=2}.
11270 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
11271
11272 @item -flive-range-shrinkage
11273 @opindex flive-range-shrinkage
11274 Attempt to decrease register pressure through register live range
11275 shrinkage. This is helpful for fast processors with small or moderate
11276 size register sets.
11277
11278 @item -fira-algorithm=@var{algorithm}
11279 @opindex fira-algorithm
11280 Use the specified coloring algorithm for the integrated register
11281 allocator. The @var{algorithm} argument can be @samp{priority}, which
11282 specifies Chow's priority coloring, or @samp{CB}, which specifies
11283 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
11284 for all architectures, but for those targets that do support it, it is
11285 the default because it generates better code.
11286
11287 @item -fira-region=@var{region}
11288 @opindex fira-region
11289 Use specified regions for the integrated register allocator. The
11290 @var{region} argument should be one of the following:
11291
11292 @table @samp
11293
11294 @item all
11295 Use all loops as register allocation regions.
11296 This can give the best results for machines with a small and/or
11297 irregular register set.
11298
11299 @item mixed
11300 Use all loops except for loops with small register pressure
11301 as the regions. This value usually gives
11302 the best results in most cases and for most architectures,
11303 and is enabled by default when compiling with optimization for speed
11304 (@option{-O}, @option{-O2}, @dots{}).
11305
11306 @item one
11307 Use all functions as a single region.
11308 This typically results in the smallest code size, and is enabled by default for
11309 @option{-Os} or @option{-O0}.
11310
11311 @end table
11312
11313 @item -fira-hoist-pressure
11314 @opindex fira-hoist-pressure
11315 Use IRA to evaluate register pressure in the code hoisting pass for
11316 decisions to hoist expressions. This option usually results in smaller
11317 code, but it can slow the compiler down.
11318
11319 This option is enabled at level @option{-Os} for all targets.
11320
11321 @item -fira-loop-pressure
11322 @opindex fira-loop-pressure
11323 Use IRA to evaluate register pressure in loops for decisions to move
11324 loop invariants. This option usually results in generation
11325 of faster and smaller code on machines with large register files (>= 32
11326 registers), but it can slow the compiler down.
11327
11328 This option is enabled at level @option{-O3} for some targets.
11329
11330 @item -fno-ira-share-save-slots
11331 @opindex fno-ira-share-save-slots
11332 @opindex fira-share-save-slots
11333 Disable sharing of stack slots used for saving call-used hard
11334 registers living through a call. Each hard register gets a
11335 separate stack slot, and as a result function stack frames are
11336 larger.
11337
11338 @item -fno-ira-share-spill-slots
11339 @opindex fno-ira-share-spill-slots
11340 @opindex fira-share-spill-slots
11341 Disable sharing of stack slots allocated for pseudo-registers. Each
11342 pseudo-register that does not get a hard register gets a separate
11343 stack slot, and as a result function stack frames are larger.
11344
11345 @item -flra-remat
11346 @opindex flra-remat
11347 Enable CFG-sensitive rematerialization in LRA. Instead of loading
11348 values of spilled pseudos, LRA tries to rematerialize (recalculate)
11349 values if it is profitable.
11350
11351 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11352
11353 @item -fdelayed-branch
11354 @opindex fdelayed-branch
11355 If supported for the target machine, attempt to reorder instructions
11356 to exploit instruction slots available after delayed branch
11357 instructions.
11358
11359 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
11360 but not at @option{-Og}.
11361
11362 @item -fschedule-insns
11363 @opindex fschedule-insns
11364 If supported for the target machine, attempt to reorder instructions to
11365 eliminate execution stalls due to required data being unavailable. This
11366 helps machines that have slow floating point or memory load instructions
11367 by allowing other instructions to be issued until the result of the load
11368 or floating-point instruction is required.
11369
11370 Enabled at levels @option{-O2}, @option{-O3}.
11371
11372 @item -fschedule-insns2
11373 @opindex fschedule-insns2
11374 Similar to @option{-fschedule-insns}, but requests an additional pass of
11375 instruction scheduling after register allocation has been done. This is
11376 especially useful on machines with a relatively small number of
11377 registers and where memory load instructions take more than one cycle.
11378
11379 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11380
11381 @item -fno-sched-interblock
11382 @opindex fno-sched-interblock
11383 @opindex fsched-interblock
11384 Disable instruction scheduling across basic blocks, which
11385 is normally enabled when scheduling before register allocation, i.e.@:
11386 with @option{-fschedule-insns} or at @option{-O2} or higher.
11387
11388 @item -fno-sched-spec
11389 @opindex fno-sched-spec
11390 @opindex fsched-spec
11391 Disable speculative motion of non-load instructions, which
11392 is normally enabled when scheduling before register allocation, i.e.@:
11393 with @option{-fschedule-insns} or at @option{-O2} or higher.
11394
11395 @item -fsched-pressure
11396 @opindex fsched-pressure
11397 Enable register pressure sensitive insn scheduling before register
11398 allocation. This only makes sense when scheduling before register
11399 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
11400 @option{-O2} or higher. Usage of this option can improve the
11401 generated code and decrease its size by preventing register pressure
11402 increase above the number of available hard registers and subsequent
11403 spills in register allocation.
11404
11405 @item -fsched-spec-load
11406 @opindex fsched-spec-load
11407 Allow speculative motion of some load instructions. This only makes
11408 sense when scheduling before register allocation, i.e.@: with
11409 @option{-fschedule-insns} or at @option{-O2} or higher.
11410
11411 @item -fsched-spec-load-dangerous
11412 @opindex fsched-spec-load-dangerous
11413 Allow speculative motion of more load instructions. This only makes
11414 sense when scheduling before register allocation, i.e.@: with
11415 @option{-fschedule-insns} or at @option{-O2} or higher.
11416
11417 @item -fsched-stalled-insns
11418 @itemx -fsched-stalled-insns=@var{n}
11419 @opindex fsched-stalled-insns
11420 Define how many insns (if any) can be moved prematurely from the queue
11421 of stalled insns into the ready list during the second scheduling pass.
11422 @option{-fno-sched-stalled-insns} means that no insns are moved
11423 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
11424 on how many queued insns can be moved prematurely.
11425 @option{-fsched-stalled-insns} without a value is equivalent to
11426 @option{-fsched-stalled-insns=1}.
11427
11428 @item -fsched-stalled-insns-dep
11429 @itemx -fsched-stalled-insns-dep=@var{n}
11430 @opindex fsched-stalled-insns-dep
11431 Define how many insn groups (cycles) are examined for a dependency
11432 on a stalled insn that is a candidate for premature removal from the queue
11433 of stalled insns. This has an effect only during the second scheduling pass,
11434 and only if @option{-fsched-stalled-insns} is used.
11435 @option{-fno-sched-stalled-insns-dep} is equivalent to
11436 @option{-fsched-stalled-insns-dep=0}.
11437 @option{-fsched-stalled-insns-dep} without a value is equivalent to
11438 @option{-fsched-stalled-insns-dep=1}.
11439
11440 @item -fsched2-use-superblocks
11441 @opindex fsched2-use-superblocks
11442 When scheduling after register allocation, use superblock scheduling.
11443 This allows motion across basic block boundaries,
11444 resulting in faster schedules. This option is experimental, as not all machine
11445 descriptions used by GCC model the CPU closely enough to avoid unreliable
11446 results from the algorithm.
11447
11448 This only makes sense when scheduling after register allocation, i.e.@: with
11449 @option{-fschedule-insns2} or at @option{-O2} or higher.
11450
11451 @item -fsched-group-heuristic
11452 @opindex fsched-group-heuristic
11453 Enable the group heuristic in the scheduler. This heuristic favors
11454 the instruction that belongs to a schedule group. This is enabled
11455 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11456 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11457
11458 @item -fsched-critical-path-heuristic
11459 @opindex fsched-critical-path-heuristic
11460 Enable the critical-path heuristic in the scheduler. This heuristic favors
11461 instructions on the critical path. This is enabled by default when
11462 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11463 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11464
11465 @item -fsched-spec-insn-heuristic
11466 @opindex fsched-spec-insn-heuristic
11467 Enable the speculative instruction heuristic in the scheduler. This
11468 heuristic favors speculative instructions with greater dependency weakness.
11469 This is enabled by default when scheduling is enabled, i.e.@:
11470 with @option{-fschedule-insns} or @option{-fschedule-insns2}
11471 or at @option{-O2} or higher.
11472
11473 @item -fsched-rank-heuristic
11474 @opindex fsched-rank-heuristic
11475 Enable the rank heuristic in the scheduler. This heuristic favors
11476 the instruction belonging to a basic block with greater size or frequency.
11477 This is enabled by default when scheduling is enabled, i.e.@:
11478 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11479 at @option{-O2} or higher.
11480
11481 @item -fsched-last-insn-heuristic
11482 @opindex fsched-last-insn-heuristic
11483 Enable the last-instruction heuristic in the scheduler. This heuristic
11484 favors the instruction that is less dependent on the last instruction
11485 scheduled. This is enabled by default when scheduling is enabled,
11486 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11487 at @option{-O2} or higher.
11488
11489 @item -fsched-dep-count-heuristic
11490 @opindex fsched-dep-count-heuristic
11491 Enable the dependent-count heuristic in the scheduler. This heuristic
11492 favors the instruction that has more instructions depending on it.
11493 This is enabled by default when scheduling is enabled, i.e.@:
11494 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11495 at @option{-O2} or higher.
11496
11497 @item -freschedule-modulo-scheduled-loops
11498 @opindex freschedule-modulo-scheduled-loops
11499 Modulo scheduling is performed before traditional scheduling. If a loop
11500 is modulo scheduled, later scheduling passes may change its schedule.
11501 Use this option to control that behavior.
11502
11503 @item -fselective-scheduling
11504 @opindex fselective-scheduling
11505 Schedule instructions using selective scheduling algorithm. Selective
11506 scheduling runs instead of the first scheduler pass.
11507
11508 @item -fselective-scheduling2
11509 @opindex fselective-scheduling2
11510 Schedule instructions using selective scheduling algorithm. Selective
11511 scheduling runs instead of the second scheduler pass.
11512
11513 @item -fsel-sched-pipelining
11514 @opindex fsel-sched-pipelining
11515 Enable software pipelining of innermost loops during selective scheduling.
11516 This option has no effect unless one of @option{-fselective-scheduling} or
11517 @option{-fselective-scheduling2} is turned on.
11518
11519 @item -fsel-sched-pipelining-outer-loops
11520 @opindex fsel-sched-pipelining-outer-loops
11521 When pipelining loops during selective scheduling, also pipeline outer loops.
11522 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
11523
11524 @item -fsemantic-interposition
11525 @opindex fsemantic-interposition
11526 Some object formats, like ELF, allow interposing of symbols by the
11527 dynamic linker.
11528 This means that for symbols exported from the DSO, the compiler cannot perform
11529 interprocedural propagation, inlining and other optimizations in anticipation
11530 that the function or variable in question may change. While this feature is
11531 useful, for example, to rewrite memory allocation functions by a debugging
11532 implementation, it is expensive in the terms of code quality.
11533 With @option{-fno-semantic-interposition} the compiler assumes that
11534 if interposition happens for functions the overwriting function will have
11535 precisely the same semantics (and side effects).
11536 Similarly if interposition happens
11537 for variables, the constructor of the variable will be the same. The flag
11538 has no effect for functions explicitly declared inline
11539 (where it is never allowed for interposition to change semantics)
11540 and for symbols explicitly declared weak.
11541
11542 @item -fshrink-wrap
11543 @opindex fshrink-wrap
11544 Emit function prologues only before parts of the function that need it,
11545 rather than at the top of the function. This flag is enabled by default at
11546 @option{-O} and higher.
11547
11548 @item -fshrink-wrap-separate
11549 @opindex fshrink-wrap-separate
11550 Shrink-wrap separate parts of the prologue and epilogue separately, so that
11551 those parts are only executed when needed.
11552 This option is on by default, but has no effect unless @option{-fshrink-wrap}
11553 is also turned on and the target supports this.
11554
11555 @item -fcaller-saves
11556 @opindex fcaller-saves
11557 Enable allocation of values to registers that are clobbered by
11558 function calls, by emitting extra instructions to save and restore the
11559 registers around such calls. Such allocation is done only when it
11560 seems to result in better code.
11561
11562 This option is always enabled by default on certain machines, usually
11563 those which have no call-preserved registers to use instead.
11564
11565 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11566
11567 @item -fcombine-stack-adjustments
11568 @opindex fcombine-stack-adjustments
11569 Tracks stack adjustments (pushes and pops) and stack memory references
11570 and then tries to find ways to combine them.
11571
11572 Enabled by default at @option{-O1} and higher.
11573
11574 @item -fipa-ra
11575 @opindex fipa-ra
11576 Use caller save registers for allocation if those registers are not used by
11577 any called function. In that case it is not necessary to save and restore
11578 them around calls. This is only possible if called functions are part of
11579 same compilation unit as current function and they are compiled before it.
11580
11581 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
11582 is disabled if generated code will be instrumented for profiling
11583 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
11584 exactly (this happens on targets that do not expose prologues
11585 and epilogues in RTL).
11586
11587 @item -fconserve-stack
11588 @opindex fconserve-stack
11589 Attempt to minimize stack usage. The compiler attempts to use less
11590 stack space, even if that makes the program slower. This option
11591 implies setting the @option{large-stack-frame} parameter to 100
11592 and the @option{large-stack-frame-growth} parameter to 400.
11593
11594 @item -ftree-reassoc
11595 @opindex ftree-reassoc
11596 Perform reassociation on trees. This flag is enabled by default
11597 at @option{-O1} and higher.
11598
11599 @item -fcode-hoisting
11600 @opindex fcode-hoisting
11601 Perform code hoisting. Code hoisting tries to move the
11602 evaluation of expressions executed on all paths to the function exit
11603 as early as possible. This is especially useful as a code size
11604 optimization, but it often helps for code speed as well.
11605 This flag is enabled by default at @option{-O2} and higher.
11606
11607 @item -ftree-pre
11608 @opindex ftree-pre
11609 Perform partial redundancy elimination (PRE) on trees. This flag is
11610 enabled by default at @option{-O2} and @option{-O3}.
11611
11612 @item -ftree-partial-pre
11613 @opindex ftree-partial-pre
11614 Make partial redundancy elimination (PRE) more aggressive. This flag is
11615 enabled by default at @option{-O3}.
11616
11617 @item -ftree-forwprop
11618 @opindex ftree-forwprop
11619 Perform forward propagation on trees. This flag is enabled by default
11620 at @option{-O1} and higher.
11621
11622 @item -ftree-fre
11623 @opindex ftree-fre
11624 Perform full redundancy elimination (FRE) on trees. The difference
11625 between FRE and PRE is that FRE only considers expressions
11626 that are computed on all paths leading to the redundant computation.
11627 This analysis is faster than PRE, though it exposes fewer redundancies.
11628 This flag is enabled by default at @option{-O1} and higher.
11629
11630 @item -ftree-phiprop
11631 @opindex ftree-phiprop
11632 Perform hoisting of loads from conditional pointers on trees. This
11633 pass is enabled by default at @option{-O1} and higher.
11634
11635 @item -fhoist-adjacent-loads
11636 @opindex fhoist-adjacent-loads
11637 Speculatively hoist loads from both branches of an if-then-else if the
11638 loads are from adjacent locations in the same structure and the target
11639 architecture has a conditional move instruction. This flag is enabled
11640 by default at @option{-O2} and higher.
11641
11642 @item -ftree-copy-prop
11643 @opindex ftree-copy-prop
11644 Perform copy propagation on trees. This pass eliminates unnecessary
11645 copy operations. This flag is enabled by default at @option{-O1} and
11646 higher.
11647
11648 @item -fipa-pure-const
11649 @opindex fipa-pure-const
11650 Discover which functions are pure or constant.
11651 Enabled by default at @option{-O1} and higher.
11652
11653 @item -fipa-reference
11654 @opindex fipa-reference
11655 Discover which static variables do not escape the
11656 compilation unit.
11657 Enabled by default at @option{-O1} and higher.
11658
11659 @item -fipa-reference-addressable
11660 @opindex fipa-reference-addressable
11661 Discover read-only, write-only and non-addressable static variables.
11662 Enabled by default at @option{-O1} and higher.
11663
11664 @item -fipa-stack-alignment
11665 @opindex fipa-stack-alignment
11666 Reduce stack alignment on call sites if possible.
11667 Enabled by default.
11668
11669 @item -fipa-pta
11670 @opindex fipa-pta
11671 Perform interprocedural pointer analysis and interprocedural modification
11672 and reference analysis. This option can cause excessive memory and
11673 compile-time usage on large compilation units. It is not enabled by
11674 default at any optimization level.
11675
11676 @item -fipa-profile
11677 @opindex fipa-profile
11678 Perform interprocedural profile propagation. The functions called only from
11679 cold functions are marked as cold. Also functions executed once (such as
11680 @code{cold}, @code{noreturn}, static constructors or destructors) are
11681 identified. Cold functions and loop less parts of functions executed once are
11682 then optimized for size.
11683 Enabled by default at @option{-O1} and higher.
11684
11685 @item -fipa-modref
11686 @opindex fipa-modref
11687 Perform interprocedural mod/ref analysis. This optimization analyzes the side
11688 effects of functions (memory locations that are modified or referenced) and
11689 enables better optimization across the function call boundary. This flag is
11690 enabled by default at @option{-O1} and higher.
11691
11692 @item -fipa-cp
11693 @opindex fipa-cp
11694 Perform interprocedural constant propagation.
11695 This optimization analyzes the program to determine when values passed
11696 to functions are constants and then optimizes accordingly.
11697 This optimization can substantially increase performance
11698 if the application has constants passed to functions.
11699 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
11700 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11701
11702 @item -fipa-cp-clone
11703 @opindex fipa-cp-clone
11704 Perform function cloning to make interprocedural constant propagation stronger.
11705 When enabled, interprocedural constant propagation performs function cloning
11706 when externally visible function can be called with constant arguments.
11707 Because this optimization can create multiple copies of functions,
11708 it may significantly increase code size
11709 (see @option{--param ipa-cp-unit-growth=@var{value}}).
11710 This flag is enabled by default at @option{-O3}.
11711 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11712
11713 @item -fipa-bit-cp
11714 @opindex fipa-bit-cp
11715 When enabled, perform interprocedural bitwise constant
11716 propagation. This flag is enabled by default at @option{-O2} and
11717 by @option{-fprofile-use} and @option{-fauto-profile}.
11718 It requires that @option{-fipa-cp} is enabled.
11719
11720 @item -fipa-vrp
11721 @opindex fipa-vrp
11722 When enabled, perform interprocedural propagation of value
11723 ranges. This flag is enabled by default at @option{-O2}. It requires
11724 that @option{-fipa-cp} is enabled.
11725
11726 @item -fipa-icf
11727 @opindex fipa-icf
11728 Perform Identical Code Folding for functions and read-only variables.
11729 The optimization reduces code size and may disturb unwind stacks by replacing
11730 a function by equivalent one with a different name. The optimization works
11731 more effectively with link-time optimization enabled.
11732
11733 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
11734 works on different levels and thus the optimizations are not same - there are
11735 equivalences that are found only by GCC and equivalences found only by Gold.
11736
11737 This flag is enabled by default at @option{-O2} and @option{-Os}.
11738
11739 @item -flive-patching=@var{level}
11740 @opindex flive-patching
11741 Control GCC's optimizations to produce output suitable for live-patching.
11742
11743 If the compiler's optimization uses a function's body or information extracted
11744 from its body to optimize/change another function, the latter is called an
11745 impacted function of the former. If a function is patched, its impacted
11746 functions should be patched too.
11747
11748 The impacted functions are determined by the compiler's interprocedural
11749 optimizations. For example, a caller is impacted when inlining a function
11750 into its caller,
11751 cloning a function and changing its caller to call this new clone,
11752 or extracting a function's pureness/constness information to optimize
11753 its direct or indirect callers, etc.
11754
11755 Usually, the more IPA optimizations enabled, the larger the number of
11756 impacted functions for each function. In order to control the number of
11757 impacted functions and more easily compute the list of impacted function,
11758 IPA optimizations can be partially enabled at two different levels.
11759
11760 The @var{level} argument should be one of the following:
11761
11762 @table @samp
11763
11764 @item inline-clone
11765
11766 Only enable inlining and cloning optimizations, which includes inlining,
11767 cloning, interprocedural scalar replacement of aggregates and partial inlining.
11768 As a result, when patching a function, all its callers and its clones'
11769 callers are impacted, therefore need to be patched as well.
11770
11771 @option{-flive-patching=inline-clone} disables the following optimization flags:
11772 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
11773 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
11774 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
11775 -fipa-stack-alignment -fipa-modref}
11776
11777 @item inline-only-static
11778
11779 Only enable inlining of static functions.
11780 As a result, when patching a static function, all its callers are impacted
11781 and so need to be patched as well.
11782
11783 In addition to all the flags that @option{-flive-patching=inline-clone}
11784 disables,
11785 @option{-flive-patching=inline-only-static} disables the following additional
11786 optimization flags:
11787 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
11788
11789 @end table
11790
11791 When @option{-flive-patching} is specified without any value, the default value
11792 is @var{inline-clone}.
11793
11794 This flag is disabled by default.
11795
11796 Note that @option{-flive-patching} is not supported with link-time optimization
11797 (@option{-flto}).
11798
11799 @item -fisolate-erroneous-paths-dereference
11800 @opindex fisolate-erroneous-paths-dereference
11801 Detect paths that trigger erroneous or undefined behavior due to
11802 dereferencing a null pointer. Isolate those paths from the main control
11803 flow and turn the statement with erroneous or undefined behavior into a trap.
11804 This flag is enabled by default at @option{-O2} and higher and depends on
11805 @option{-fdelete-null-pointer-checks} also being enabled.
11806
11807 @item -fisolate-erroneous-paths-attribute
11808 @opindex fisolate-erroneous-paths-attribute
11809 Detect paths that trigger erroneous or undefined behavior due to a null value
11810 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
11811 attribute. Isolate those paths from the main control flow and turn the
11812 statement with erroneous or undefined behavior into a trap. This is not
11813 currently enabled, but may be enabled by @option{-O2} in the future.
11814
11815 @item -ftree-sink
11816 @opindex ftree-sink
11817 Perform forward store motion on trees. This flag is
11818 enabled by default at @option{-O1} and higher.
11819
11820 @item -ftree-bit-ccp
11821 @opindex ftree-bit-ccp
11822 Perform sparse conditional bit constant propagation on trees and propagate
11823 pointer alignment information.
11824 This pass only operates on local scalar variables and is enabled by default
11825 at @option{-O1} and higher, except for @option{-Og}.
11826 It requires that @option{-ftree-ccp} is enabled.
11827
11828 @item -ftree-ccp
11829 @opindex ftree-ccp
11830 Perform sparse conditional constant propagation (CCP) on trees. This
11831 pass only operates on local scalar variables and is enabled by default
11832 at @option{-O1} and higher.
11833
11834 @item -fssa-backprop
11835 @opindex fssa-backprop
11836 Propagate information about uses of a value up the definition chain
11837 in order to simplify the definitions. For example, this pass strips
11838 sign operations if the sign of a value never matters. The flag is
11839 enabled by default at @option{-O1} and higher.
11840
11841 @item -fssa-phiopt
11842 @opindex fssa-phiopt
11843 Perform pattern matching on SSA PHI nodes to optimize conditional
11844 code. This pass is enabled by default at @option{-O1} and higher,
11845 except for @option{-Og}.
11846
11847 @item -ftree-switch-conversion
11848 @opindex ftree-switch-conversion
11849 Perform conversion of simple initializations in a switch to
11850 initializations from a scalar array. This flag is enabled by default
11851 at @option{-O2} and higher.
11852
11853 @item -ftree-tail-merge
11854 @opindex ftree-tail-merge
11855 Look for identical code sequences. When found, replace one with a jump to the
11856 other. This optimization is known as tail merging or cross jumping. This flag
11857 is enabled by default at @option{-O2} and higher. The compilation time
11858 in this pass can
11859 be limited using @option{max-tail-merge-comparisons} parameter and
11860 @option{max-tail-merge-iterations} parameter.
11861
11862 @item -ftree-dce
11863 @opindex ftree-dce
11864 Perform dead code elimination (DCE) on trees. This flag is enabled by
11865 default at @option{-O1} and higher.
11866
11867 @item -ftree-builtin-call-dce
11868 @opindex ftree-builtin-call-dce
11869 Perform conditional dead code elimination (DCE) for calls to built-in functions
11870 that may set @code{errno} but are otherwise free of side effects. This flag is
11871 enabled by default at @option{-O2} and higher if @option{-Os} is not also
11872 specified.
11873
11874 @item -ffinite-loops
11875 @opindex ffinite-loops
11876 @opindex fno-finite-loops
11877 Assume that a loop with an exit will eventually take the exit and not loop
11878 indefinitely. This allows the compiler to remove loops that otherwise have
11879 no side-effects, not considering eventual endless looping as such.
11880
11881 This option is enabled by default at @option{-O2} for C++ with -std=c++11
11882 or higher.
11883
11884 @item -ftree-dominator-opts
11885 @opindex ftree-dominator-opts
11886 Perform a variety of simple scalar cleanups (constant/copy
11887 propagation, redundancy elimination, range propagation and expression
11888 simplification) based on a dominator tree traversal. This also
11889 performs jump threading (to reduce jumps to jumps). This flag is
11890 enabled by default at @option{-O1} and higher.
11891
11892 @item -ftree-dse
11893 @opindex ftree-dse
11894 Perform dead store elimination (DSE) on trees. A dead store is a store into
11895 a memory location that is later overwritten by another store without
11896 any intervening loads. In this case the earlier store can be deleted. This
11897 flag is enabled by default at @option{-O1} and higher.
11898
11899 @item -ftree-ch
11900 @opindex ftree-ch
11901 Perform loop header copying on trees. This is beneficial since it increases
11902 effectiveness of code motion optimizations. It also saves one jump. This flag
11903 is enabled by default at @option{-O1} and higher. It is not enabled
11904 for @option{-Os}, since it usually increases code size.
11905
11906 @item -ftree-loop-optimize
11907 @opindex ftree-loop-optimize
11908 Perform loop optimizations on trees. This flag is enabled by default
11909 at @option{-O1} and higher.
11910
11911 @item -ftree-loop-linear
11912 @itemx -floop-strip-mine
11913 @itemx -floop-block
11914 @opindex ftree-loop-linear
11915 @opindex floop-strip-mine
11916 @opindex floop-block
11917 Perform loop nest optimizations. Same as
11918 @option{-floop-nest-optimize}. To use this code transformation, GCC has
11919 to be configured with @option{--with-isl} to enable the Graphite loop
11920 transformation infrastructure.
11921
11922 @item -fgraphite-identity
11923 @opindex fgraphite-identity
11924 Enable the identity transformation for graphite. For every SCoP we generate
11925 the polyhedral representation and transform it back to gimple. Using
11926 @option{-fgraphite-identity} we can check the costs or benefits of the
11927 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
11928 are also performed by the code generator isl, like index splitting and
11929 dead code elimination in loops.
11930
11931 @item -floop-nest-optimize
11932 @opindex floop-nest-optimize
11933 Enable the isl based loop nest optimizer. This is a generic loop nest
11934 optimizer based on the Pluto optimization algorithms. It calculates a loop
11935 structure optimized for data-locality and parallelism. This option
11936 is experimental.
11937
11938 @item -floop-parallelize-all
11939 @opindex floop-parallelize-all
11940 Use the Graphite data dependence analysis to identify loops that can
11941 be parallelized. Parallelize all the loops that can be analyzed to
11942 not contain loop carried dependences without checking that it is
11943 profitable to parallelize the loops.
11944
11945 @item -ftree-coalesce-vars
11946 @opindex ftree-coalesce-vars
11947 While transforming the program out of the SSA representation, attempt to
11948 reduce copying by coalescing versions of different user-defined
11949 variables, instead of just compiler temporaries. This may severely
11950 limit the ability to debug an optimized program compiled with
11951 @option{-fno-var-tracking-assignments}. In the negated form, this flag
11952 prevents SSA coalescing of user variables. This option is enabled by
11953 default if optimization is enabled, and it does very little otherwise.
11954
11955 @item -ftree-loop-if-convert
11956 @opindex ftree-loop-if-convert
11957 Attempt to transform conditional jumps in the innermost loops to
11958 branch-less equivalents. The intent is to remove control-flow from
11959 the innermost loops in order to improve the ability of the
11960 vectorization pass to handle these loops. This is enabled by default
11961 if vectorization is enabled.
11962
11963 @item -ftree-loop-distribution
11964 @opindex ftree-loop-distribution
11965 Perform loop distribution. This flag can improve cache performance on
11966 big loop bodies and allow further loop optimizations, like
11967 parallelization or vectorization, to take place. For example, the loop
11968 @smallexample
11969 DO I = 1, N
11970 A(I) = B(I) + C
11971 D(I) = E(I) * F
11972 ENDDO
11973 @end smallexample
11974 is transformed to
11975 @smallexample
11976 DO I = 1, N
11977 A(I) = B(I) + C
11978 ENDDO
11979 DO I = 1, N
11980 D(I) = E(I) * F
11981 ENDDO
11982 @end smallexample
11983 This flag is enabled by default at @option{-O3}.
11984 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11985
11986 @item -ftree-loop-distribute-patterns
11987 @opindex ftree-loop-distribute-patterns
11988 Perform loop distribution of patterns that can be code generated with
11989 calls to a library. This flag is enabled by default at @option{-O2} and
11990 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
11991
11992 This pass distributes the initialization loops and generates a call to
11993 memset zero. For example, the loop
11994 @smallexample
11995 DO I = 1, N
11996 A(I) = 0
11997 B(I) = A(I) + I
11998 ENDDO
11999 @end smallexample
12000 is transformed to
12001 @smallexample
12002 DO I = 1, N
12003 A(I) = 0
12004 ENDDO
12005 DO I = 1, N
12006 B(I) = A(I) + I
12007 ENDDO
12008 @end smallexample
12009 and the initialization loop is transformed into a call to memset zero.
12010 This flag is enabled by default at @option{-O3}.
12011 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12012
12013 @item -floop-interchange
12014 @opindex floop-interchange
12015 Perform loop interchange outside of graphite. This flag can improve cache
12016 performance on loop nest and allow further loop optimizations, like
12017 vectorization, to take place. For example, the loop
12018 @smallexample
12019 for (int i = 0; i < N; i++)
12020 for (int j = 0; j < N; j++)
12021 for (int k = 0; k < N; k++)
12022 c[i][j] = c[i][j] + a[i][k]*b[k][j];
12023 @end smallexample
12024 is transformed to
12025 @smallexample
12026 for (int i = 0; i < N; i++)
12027 for (int k = 0; k < N; k++)
12028 for (int j = 0; j < N; j++)
12029 c[i][j] = c[i][j] + a[i][k]*b[k][j];
12030 @end smallexample
12031 This flag is enabled by default at @option{-O3}.
12032 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12033
12034 @item -floop-unroll-and-jam
12035 @opindex floop-unroll-and-jam
12036 Apply unroll and jam transformations on feasible loops. In a loop
12037 nest this unrolls the outer loop by some factor and fuses the resulting
12038 multiple inner loops. This flag is enabled by default at @option{-O3}.
12039 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12040
12041 @item -ftree-loop-im
12042 @opindex ftree-loop-im
12043 Perform loop invariant motion on trees. This pass moves only invariants that
12044 are hard to handle at RTL level (function calls, operations that expand to
12045 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
12046 operands of conditions that are invariant out of the loop, so that we can use
12047 just trivial invariantness analysis in loop unswitching. The pass also includes
12048 store motion.
12049
12050 @item -ftree-loop-ivcanon
12051 @opindex ftree-loop-ivcanon
12052 Create a canonical counter for number of iterations in loops for which
12053 determining number of iterations requires complicated analysis. Later
12054 optimizations then may determine the number easily. Useful especially
12055 in connection with unrolling.
12056
12057 @item -ftree-scev-cprop
12058 @opindex ftree-scev-cprop
12059 Perform final value replacement. If a variable is modified in a loop
12060 in such a way that its value when exiting the loop can be determined using
12061 only its initial value and the number of loop iterations, replace uses of
12062 the final value by such a computation, provided it is sufficiently cheap.
12063 This reduces data dependencies and may allow further simplifications.
12064 Enabled by default at @option{-O1} and higher.
12065
12066 @item -fivopts
12067 @opindex fivopts
12068 Perform induction variable optimizations (strength reduction, induction
12069 variable merging and induction variable elimination) on trees.
12070
12071 @item -ftree-parallelize-loops=n
12072 @opindex ftree-parallelize-loops
12073 Parallelize loops, i.e., split their iteration space to run in n threads.
12074 This is only possible for loops whose iterations are independent
12075 and can be arbitrarily reordered. The optimization is only
12076 profitable on multiprocessor machines, for loops that are CPU-intensive,
12077 rather than constrained e.g.@: by memory bandwidth. This option
12078 implies @option{-pthread}, and thus is only supported on targets
12079 that have support for @option{-pthread}.
12080
12081 @item -ftree-pta
12082 @opindex ftree-pta
12083 Perform function-local points-to analysis on trees. This flag is
12084 enabled by default at @option{-O1} and higher, except for @option{-Og}.
12085
12086 @item -ftree-sra
12087 @opindex ftree-sra
12088 Perform scalar replacement of aggregates. This pass replaces structure
12089 references with scalars to prevent committing structures to memory too
12090 early. This flag is enabled by default at @option{-O1} and higher,
12091 except for @option{-Og}.
12092
12093 @item -fstore-merging
12094 @opindex fstore-merging
12095 Perform merging of narrow stores to consecutive memory addresses. This pass
12096 merges contiguous stores of immediate values narrower than a word into fewer
12097 wider stores to reduce the number of instructions. This is enabled by default
12098 at @option{-O2} and higher as well as @option{-Os}.
12099
12100 @item -ftree-ter
12101 @opindex ftree-ter
12102 Perform temporary expression replacement during the SSA->normal phase. Single
12103 use/single def temporaries are replaced at their use location with their
12104 defining expression. This results in non-GIMPLE code, but gives the expanders
12105 much more complex trees to work on resulting in better RTL generation. This is
12106 enabled by default at @option{-O1} and higher.
12107
12108 @item -ftree-slsr
12109 @opindex ftree-slsr
12110 Perform straight-line strength reduction on trees. This recognizes related
12111 expressions involving multiplications and replaces them by less expensive
12112 calculations when possible. This is enabled by default at @option{-O1} and
12113 higher.
12114
12115 @item -ftree-vectorize
12116 @opindex ftree-vectorize
12117 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
12118 and @option{-ftree-slp-vectorize} if not explicitly specified.
12119
12120 @item -ftree-loop-vectorize
12121 @opindex ftree-loop-vectorize
12122 Perform loop vectorization on trees. This flag is enabled by default at
12123 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
12124 and @option{-fauto-profile}.
12125
12126 @item -ftree-slp-vectorize
12127 @opindex ftree-slp-vectorize
12128 Perform basic block vectorization on trees. This flag is enabled by default at
12129 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
12130 and @option{-fauto-profile}.
12131
12132 @item -ftrivial-auto-var-init=@var{choice}
12133 @opindex ftrivial-auto-var-init
12134 Initialize automatic variables with either a pattern or with zeroes to increase
12135 the security and predictability of a program by preventing uninitialized memory
12136 disclosure and use.
12137 GCC still considers an automatic variable that doesn't have an explicit
12138 initializer as uninitialized, @option{-Wuninitialized} will still report
12139 warning messages on such automatic variables.
12140 With this option, GCC will also initialize any padding of automatic variables
12141 that have structure or union types to zeroes.
12142
12143 The three values of @var{choice} are:
12144
12145 @itemize @bullet
12146 @item
12147 @samp{uninitialized} doesn't initialize any automatic variables.
12148 This is C and C++'s default.
12149
12150 @item
12151 @samp{pattern} Initialize automatic variables with values which will likely
12152 transform logic bugs into crashes down the line, are easily recognized in a
12153 crash dump and without being values that programmers can rely on for useful
12154 program semantics.
12155 The current value is byte-repeatable pattern with byte "0xFE".
12156 The values used for pattern initialization might be changed in the future.
12157
12158 @item
12159 @samp{zero} Initialize automatic variables with zeroes.
12160 @end itemize
12161
12162 The default is @samp{uninitialized}.
12163
12164 You can control this behavior for a specific variable by using the variable
12165 attribute @code{uninitialized} (@pxref{Variable Attributes}).
12166
12167 @item -fvect-cost-model=@var{model}
12168 @opindex fvect-cost-model
12169 Alter the cost model used for vectorization. The @var{model} argument
12170 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
12171 @samp{very-cheap}.
12172 With the @samp{unlimited} model the vectorized code-path is assumed
12173 to be profitable while with the @samp{dynamic} model a runtime check
12174 guards the vectorized code-path to enable it only for iteration
12175 counts that will likely execute faster than when executing the original
12176 scalar loop. The @samp{cheap} model disables vectorization of
12177 loops where doing so would be cost prohibitive for example due to
12178 required runtime checks for data dependence or alignment but otherwise
12179 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
12180 allows vectorization if the vector code would entirely replace the
12181 scalar code that is being vectorized. For example, if each iteration
12182 of a vectorized loop would only be able to handle exactly four iterations
12183 of the scalar loop, the @samp{very-cheap} model would only allow
12184 vectorization if the scalar iteration count is known to be a multiple
12185 of four.
12186
12187 The default cost model depends on other optimization flags and is
12188 either @samp{dynamic} or @samp{cheap}.
12189
12190 @item -fsimd-cost-model=@var{model}
12191 @opindex fsimd-cost-model
12192 Alter the cost model used for vectorization of loops marked with the OpenMP
12193 simd directive. The @var{model} argument should be one of
12194 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
12195 have the same meaning as described in @option{-fvect-cost-model} and by
12196 default a cost model defined with @option{-fvect-cost-model} is used.
12197
12198 @item -ftree-vrp
12199 @opindex ftree-vrp
12200 Perform Value Range Propagation on trees. This is similar to the
12201 constant propagation pass, but instead of values, ranges of values are
12202 propagated. This allows the optimizers to remove unnecessary range
12203 checks like array bound checks and null pointer checks. This is
12204 enabled by default at @option{-O2} and higher. Null pointer check
12205 elimination is only done if @option{-fdelete-null-pointer-checks} is
12206 enabled.
12207
12208 @item -fsplit-paths
12209 @opindex fsplit-paths
12210 Split paths leading to loop backedges. This can improve dead code
12211 elimination and common subexpression elimination. This is enabled by
12212 default at @option{-O3} and above.
12213
12214 @item -fsplit-ivs-in-unroller
12215 @opindex fsplit-ivs-in-unroller
12216 Enables expression of values of induction variables in later iterations
12217 of the unrolled loop using the value in the first iteration. This breaks
12218 long dependency chains, thus improving efficiency of the scheduling passes.
12219
12220 A combination of @option{-fweb} and CSE is often sufficient to obtain the
12221 same effect. However, that is not reliable in cases where the loop body
12222 is more complicated than a single basic block. It also does not work at all
12223 on some architectures due to restrictions in the CSE pass.
12224
12225 This optimization is enabled by default.
12226
12227 @item -fvariable-expansion-in-unroller
12228 @opindex fvariable-expansion-in-unroller
12229 With this option, the compiler creates multiple copies of some
12230 local variables when unrolling a loop, which can result in superior code.
12231
12232 This optimization is enabled by default for PowerPC targets, but disabled
12233 by default otherwise.
12234
12235 @item -fpartial-inlining
12236 @opindex fpartial-inlining
12237 Inline parts of functions. This option has any effect only
12238 when inlining itself is turned on by the @option{-finline-functions}
12239 or @option{-finline-small-functions} options.
12240
12241 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12242
12243 @item -fpredictive-commoning
12244 @opindex fpredictive-commoning
12245 Perform predictive commoning optimization, i.e., reusing computations
12246 (especially memory loads and stores) performed in previous
12247 iterations of loops.
12248
12249 This option is enabled at level @option{-O3}.
12250 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12251
12252 @item -fprefetch-loop-arrays
12253 @opindex fprefetch-loop-arrays
12254 If supported by the target machine, generate instructions to prefetch
12255 memory to improve the performance of loops that access large arrays.
12256
12257 This option may generate better or worse code; results are highly
12258 dependent on the structure of loops within the source code.
12259
12260 Disabled at level @option{-Os}.
12261
12262 @item -fno-printf-return-value
12263 @opindex fno-printf-return-value
12264 @opindex fprintf-return-value
12265 Do not substitute constants for known return value of formatted output
12266 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
12267 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
12268 transformation allows GCC to optimize or even eliminate branches based
12269 on the known return value of these functions called with arguments that
12270 are either constant, or whose values are known to be in a range that
12271 makes determining the exact return value possible. For example, when
12272 @option{-fprintf-return-value} is in effect, both the branch and the
12273 body of the @code{if} statement (but not the call to @code{snprint})
12274 can be optimized away when @code{i} is a 32-bit or smaller integer
12275 because the return value is guaranteed to be at most 8.
12276
12277 @smallexample
12278 char buf[9];
12279 if (snprintf (buf, "%08x", i) >= sizeof buf)
12280 @dots{}
12281 @end smallexample
12282
12283 The @option{-fprintf-return-value} option relies on other optimizations
12284 and yields best results with @option{-O2} and above. It works in tandem
12285 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
12286 options. The @option{-fprintf-return-value} option is enabled by default.
12287
12288 @item -fno-peephole
12289 @itemx -fno-peephole2
12290 @opindex fno-peephole
12291 @opindex fpeephole
12292 @opindex fno-peephole2
12293 @opindex fpeephole2
12294 Disable any machine-specific peephole optimizations. The difference
12295 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
12296 are implemented in the compiler; some targets use one, some use the
12297 other, a few use both.
12298
12299 @option{-fpeephole} is enabled by default.
12300 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12301
12302 @item -fno-guess-branch-probability
12303 @opindex fno-guess-branch-probability
12304 @opindex fguess-branch-probability
12305 Do not guess branch probabilities using heuristics.
12306
12307 GCC uses heuristics to guess branch probabilities if they are
12308 not provided by profiling feedback (@option{-fprofile-arcs}). These
12309 heuristics are based on the control flow graph. If some branch probabilities
12310 are specified by @code{__builtin_expect}, then the heuristics are
12311 used to guess branch probabilities for the rest of the control flow graph,
12312 taking the @code{__builtin_expect} info into account. The interactions
12313 between the heuristics and @code{__builtin_expect} can be complex, and in
12314 some cases, it may be useful to disable the heuristics so that the effects
12315 of @code{__builtin_expect} are easier to understand.
12316
12317 It is also possible to specify expected probability of the expression
12318 with @code{__builtin_expect_with_probability} built-in function.
12319
12320 The default is @option{-fguess-branch-probability} at levels
12321 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12322
12323 @item -freorder-blocks
12324 @opindex freorder-blocks
12325 Reorder basic blocks in the compiled function in order to reduce number of
12326 taken branches and improve code locality.
12327
12328 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12329
12330 @item -freorder-blocks-algorithm=@var{algorithm}
12331 @opindex freorder-blocks-algorithm
12332 Use the specified algorithm for basic block reordering. The
12333 @var{algorithm} argument can be @samp{simple}, which does not increase
12334 code size (except sometimes due to secondary effects like alignment),
12335 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
12336 put all often executed code together, minimizing the number of branches
12337 executed by making extra copies of code.
12338
12339 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
12340 @samp{stc} at levels @option{-O2}, @option{-O3}.
12341
12342 @item -freorder-blocks-and-partition
12343 @opindex freorder-blocks-and-partition
12344 In addition to reordering basic blocks in the compiled function, in order
12345 to reduce number of taken branches, partitions hot and cold basic blocks
12346 into separate sections of the assembly and @file{.o} files, to improve
12347 paging and cache locality performance.
12348
12349 This optimization is automatically turned off in the presence of
12350 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
12351 section attribute and on any architecture that does not support named
12352 sections. When @option{-fsplit-stack} is used this option is not
12353 enabled by default (to avoid linker errors), but may be enabled
12354 explicitly (if using a working linker).
12355
12356 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
12357
12358 @item -freorder-functions
12359 @opindex freorder-functions
12360 Reorder functions in the object file in order to
12361 improve code locality. This is implemented by using special
12362 subsections @code{.text.hot} for most frequently executed functions and
12363 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
12364 the linker so object file format must support named sections and linker must
12365 place them in a reasonable way.
12366
12367 This option isn't effective unless you either provide profile feedback
12368 (see @option{-fprofile-arcs} for details) or manually annotate functions with
12369 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
12370
12371 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12372
12373 @item -fstrict-aliasing
12374 @opindex fstrict-aliasing
12375 Allow the compiler to assume the strictest aliasing rules applicable to
12376 the language being compiled. For C (and C++), this activates
12377 optimizations based on the type of expressions. In particular, an
12378 object of one type is assumed never to reside at the same address as an
12379 object of a different type, unless the types are almost the same. For
12380 example, an @code{unsigned int} can alias an @code{int}, but not a
12381 @code{void*} or a @code{double}. A character type may alias any other
12382 type.
12383
12384 @anchor{Type-punning}Pay special attention to code like this:
12385 @smallexample
12386 union a_union @{
12387 int i;
12388 double d;
12389 @};
12390
12391 int f() @{
12392 union a_union t;
12393 t.d = 3.0;
12394 return t.i;
12395 @}
12396 @end smallexample
12397 The practice of reading from a different union member than the one most
12398 recently written to (called ``type-punning'') is common. Even with
12399 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
12400 is accessed through the union type. So, the code above works as
12401 expected. @xref{Structures unions enumerations and bit-fields
12402 implementation}. However, this code might not:
12403 @smallexample
12404 int f() @{
12405 union a_union t;
12406 int* ip;
12407 t.d = 3.0;
12408 ip = &t.i;
12409 return *ip;
12410 @}
12411 @end smallexample
12412
12413 Similarly, access by taking the address, casting the resulting pointer
12414 and dereferencing the result has undefined behavior, even if the cast
12415 uses a union type, e.g.:
12416 @smallexample
12417 int f() @{
12418 double d = 3.0;
12419 return ((union a_union *) &d)->i;
12420 @}
12421 @end smallexample
12422
12423 The @option{-fstrict-aliasing} option is enabled at levels
12424 @option{-O2}, @option{-O3}, @option{-Os}.
12425
12426 @item -falign-functions
12427 @itemx -falign-functions=@var{n}
12428 @itemx -falign-functions=@var{n}:@var{m}
12429 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
12430 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
12431 @opindex falign-functions
12432 Align the start of functions to the next power-of-two greater than or
12433 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
12434 least the first @var{m} bytes of the function can be fetched by the CPU
12435 without crossing an @var{n}-byte alignment boundary.
12436
12437 If @var{m} is not specified, it defaults to @var{n}.
12438
12439 Examples: @option{-falign-functions=32} aligns functions to the next
12440 32-byte boundary, @option{-falign-functions=24} aligns to the next
12441 32-byte boundary only if this can be done by skipping 23 bytes or less,
12442 @option{-falign-functions=32:7} aligns to the next
12443 32-byte boundary only if this can be done by skipping 6 bytes or less.
12444
12445 The second pair of @var{n2}:@var{m2} values allows you to specify
12446 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
12447 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
12448 otherwise aligns to the next 32-byte boundary if this can be done
12449 by skipping 2 bytes or less.
12450 If @var{m2} is not specified, it defaults to @var{n2}.
12451
12452 Some assemblers only support this flag when @var{n} is a power of two;
12453 in that case, it is rounded up.
12454
12455 @option{-fno-align-functions} and @option{-falign-functions=1} are
12456 equivalent and mean that functions are not aligned.
12457
12458 If @var{n} is not specified or is zero, use a machine-dependent default.
12459 The maximum allowed @var{n} option value is 65536.
12460
12461 Enabled at levels @option{-O2}, @option{-O3}.
12462
12463 @item -flimit-function-alignment
12464 If this option is enabled, the compiler tries to avoid unnecessarily
12465 overaligning functions. It attempts to instruct the assembler to align
12466 by the amount specified by @option{-falign-functions}, but not to
12467 skip more bytes than the size of the function.
12468
12469 @item -falign-labels
12470 @itemx -falign-labels=@var{n}
12471 @itemx -falign-labels=@var{n}:@var{m}
12472 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
12473 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
12474 @opindex falign-labels
12475 Align all branch targets to a power-of-two boundary.
12476
12477 Parameters of this option are analogous to the @option{-falign-functions} option.
12478 @option{-fno-align-labels} and @option{-falign-labels=1} are
12479 equivalent and mean that labels are not aligned.
12480
12481 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
12482 are greater than this value, then their values are used instead.
12483
12484 If @var{n} is not specified or is zero, use a machine-dependent default
12485 which is very likely to be @samp{1}, meaning no alignment.
12486 The maximum allowed @var{n} option value is 65536.
12487
12488 Enabled at levels @option{-O2}, @option{-O3}.
12489
12490 @item -falign-loops
12491 @itemx -falign-loops=@var{n}
12492 @itemx -falign-loops=@var{n}:@var{m}
12493 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
12494 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
12495 @opindex falign-loops
12496 Align loops to a power-of-two boundary. If the loops are executed
12497 many times, this makes up for any execution of the dummy padding
12498 instructions.
12499
12500 If @option{-falign-labels} is greater than this value, then its value
12501 is used instead.
12502
12503 Parameters of this option are analogous to the @option{-falign-functions} option.
12504 @option{-fno-align-loops} and @option{-falign-loops=1} are
12505 equivalent and mean that loops are not aligned.
12506 The maximum allowed @var{n} option value is 65536.
12507
12508 If @var{n} is not specified or is zero, use a machine-dependent default.
12509
12510 Enabled at levels @option{-O2}, @option{-O3}.
12511
12512 @item -falign-jumps
12513 @itemx -falign-jumps=@var{n}
12514 @itemx -falign-jumps=@var{n}:@var{m}
12515 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
12516 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
12517 @opindex falign-jumps
12518 Align branch targets to a power-of-two boundary, for branch targets
12519 where the targets can only be reached by jumping. In this case,
12520 no dummy operations need be executed.
12521
12522 If @option{-falign-labels} is greater than this value, then its value
12523 is used instead.
12524
12525 Parameters of this option are analogous to the @option{-falign-functions} option.
12526 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
12527 equivalent and mean that loops are not aligned.
12528
12529 If @var{n} is not specified or is zero, use a machine-dependent default.
12530 The maximum allowed @var{n} option value is 65536.
12531
12532 Enabled at levels @option{-O2}, @option{-O3}.
12533
12534 @item -fno-allocation-dce
12535 @opindex fno-allocation-dce
12536 Do not remove unused C++ allocations in dead code elimination.
12537
12538 @item -fallow-store-data-races
12539 @opindex fallow-store-data-races
12540 Allow the compiler to perform optimizations that may introduce new data races
12541 on stores, without proving that the variable cannot be concurrently accessed
12542 by other threads. Does not affect optimization of local data. It is safe to
12543 use this option if it is known that global data will not be accessed by
12544 multiple threads.
12545
12546 Examples of optimizations enabled by @option{-fallow-store-data-races} include
12547 hoisting or if-conversions that may cause a value that was already in memory
12548 to be re-written with that same value. Such re-writing is safe in a single
12549 threaded context but may be unsafe in a multi-threaded context. Note that on
12550 some processors, if-conversions may be required in order to enable
12551 vectorization.
12552
12553 Enabled at level @option{-Ofast}.
12554
12555 @item -funit-at-a-time
12556 @opindex funit-at-a-time
12557 This option is left for compatibility reasons. @option{-funit-at-a-time}
12558 has no effect, while @option{-fno-unit-at-a-time} implies
12559 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
12560
12561 Enabled by default.
12562
12563 @item -fno-toplevel-reorder
12564 @opindex fno-toplevel-reorder
12565 @opindex ftoplevel-reorder
12566 Do not reorder top-level functions, variables, and @code{asm}
12567 statements. Output them in the same order that they appear in the
12568 input file. When this option is used, unreferenced static variables
12569 are not removed. This option is intended to support existing code
12570 that relies on a particular ordering. For new code, it is better to
12571 use attributes when possible.
12572
12573 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
12574 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
12575 Additionally @option{-fno-toplevel-reorder} implies
12576 @option{-fno-section-anchors}.
12577
12578 @item -fweb
12579 @opindex fweb
12580 Constructs webs as commonly used for register allocation purposes and assign
12581 each web individual pseudo register. This allows the register allocation pass
12582 to operate on pseudos directly, but also strengthens several other optimization
12583 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
12584 however, make debugging impossible, since variables no longer stay in a
12585 ``home register''.
12586
12587 Enabled by default with @option{-funroll-loops}.
12588
12589 @item -fwhole-program
12590 @opindex fwhole-program
12591 Assume that the current compilation unit represents the whole program being
12592 compiled. All public functions and variables with the exception of @code{main}
12593 and those merged by attribute @code{externally_visible} become static functions
12594 and in effect are optimized more aggressively by interprocedural optimizers.
12595
12596 This option should not be used in combination with @option{-flto}.
12597 Instead relying on a linker plugin should provide safer and more precise
12598 information.
12599
12600 @item -flto[=@var{n}]
12601 @opindex flto
12602 This option runs the standard link-time optimizer. When invoked
12603 with source code, it generates GIMPLE (one of GCC's internal
12604 representations) and writes it to special ELF sections in the object
12605 file. When the object files are linked together, all the function
12606 bodies are read from these ELF sections and instantiated as if they
12607 had been part of the same translation unit.
12608
12609 To use the link-time optimizer, @option{-flto} and optimization
12610 options should be specified at compile time and during the final link.
12611 It is recommended that you compile all the files participating in the
12612 same link with the same options and also specify those options at
12613 link time.
12614 For example:
12615
12616 @smallexample
12617 gcc -c -O2 -flto foo.c
12618 gcc -c -O2 -flto bar.c
12619 gcc -o myprog -flto -O2 foo.o bar.o
12620 @end smallexample
12621
12622 The first two invocations to GCC save a bytecode representation
12623 of GIMPLE into special ELF sections inside @file{foo.o} and
12624 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
12625 @file{foo.o} and @file{bar.o}, merges the two files into a single
12626 internal image, and compiles the result as usual. Since both
12627 @file{foo.o} and @file{bar.o} are merged into a single image, this
12628 causes all the interprocedural analyses and optimizations in GCC to
12629 work across the two files as if they were a single one. This means,
12630 for example, that the inliner is able to inline functions in
12631 @file{bar.o} into functions in @file{foo.o} and vice-versa.
12632
12633 Another (simpler) way to enable link-time optimization is:
12634
12635 @smallexample
12636 gcc -o myprog -flto -O2 foo.c bar.c
12637 @end smallexample
12638
12639 The above generates bytecode for @file{foo.c} and @file{bar.c},
12640 merges them together into a single GIMPLE representation and optimizes
12641 them as usual to produce @file{myprog}.
12642
12643 The important thing to keep in mind is that to enable link-time
12644 optimizations you need to use the GCC driver to perform the link step.
12645 GCC automatically performs link-time optimization if any of the
12646 objects involved were compiled with the @option{-flto} command-line option.
12647 You can always override
12648 the automatic decision to do link-time optimization
12649 by passing @option{-fno-lto} to the link command.
12650
12651 To make whole program optimization effective, it is necessary to make
12652 certain whole program assumptions. The compiler needs to know
12653 what functions and variables can be accessed by libraries and runtime
12654 outside of the link-time optimized unit. When supported by the linker,
12655 the linker plugin (see @option{-fuse-linker-plugin}) passes information
12656 to the compiler about used and externally visible symbols. When
12657 the linker plugin is not available, @option{-fwhole-program} should be
12658 used to allow the compiler to make these assumptions, which leads
12659 to more aggressive optimization decisions.
12660
12661 When a file is compiled with @option{-flto} without
12662 @option{-fuse-linker-plugin}, the generated object file is larger than
12663 a regular object file because it contains GIMPLE bytecodes and the usual
12664 final code (see @option{-ffat-lto-objects}). This means that
12665 object files with LTO information can be linked as normal object
12666 files; if @option{-fno-lto} is passed to the linker, no
12667 interprocedural optimizations are applied. Note that when
12668 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
12669 but you cannot perform a regular, non-LTO link on them.
12670
12671 When producing the final binary, GCC only
12672 applies link-time optimizations to those files that contain bytecode.
12673 Therefore, you can mix and match object files and libraries with
12674 GIMPLE bytecodes and final object code. GCC automatically selects
12675 which files to optimize in LTO mode and which files to link without
12676 further processing.
12677
12678 Generally, options specified at link time override those
12679 specified at compile time, although in some cases GCC attempts to infer
12680 link-time options from the settings used to compile the input files.
12681
12682 If you do not specify an optimization level option @option{-O} at
12683 link time, then GCC uses the highest optimization level
12684 used when compiling the object files. Note that it is generally
12685 ineffective to specify an optimization level option only at link time and
12686 not at compile time, for two reasons. First, compiling without
12687 optimization suppresses compiler passes that gather information
12688 needed for effective optimization at link time. Second, some early
12689 optimization passes can be performed only at compile time and
12690 not at link time.
12691
12692 There are some code generation flags preserved by GCC when
12693 generating bytecodes, as they need to be used during the final link.
12694 Currently, the following options and their settings are taken from
12695 the first object file that explicitly specifies them:
12696 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
12697 @option{-fgnu-tm} and all the @option{-m} target flags.
12698
12699 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
12700 @option{-fPIE} are combined based on the following scheme:
12701
12702 @smallexample
12703 @option{-fPIC} + @option{-fpic} = @option{-fpic}
12704 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
12705 @option{-fpic/-fPIC} + (no option) = (no option)
12706 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
12707 @option{-fpic} + @option{-fPIE} = @option{-fpie}
12708 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
12709 @end smallexample
12710
12711 Certain ABI-changing flags are required to match in all compilation units,
12712 and trying to override this at link time with a conflicting value
12713 is ignored. This includes options such as @option{-freg-struct-return}
12714 and @option{-fpcc-struct-return}.
12715
12716 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
12717 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
12718 are passed through to the link stage and merged conservatively for
12719 conflicting translation units. Specifically
12720 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
12721 precedence; and for example @option{-ffp-contract=off} takes precedence
12722 over @option{-ffp-contract=fast}. You can override them at link time.
12723
12724 Diagnostic options such as @option{-Wstringop-overflow} are passed
12725 through to the link stage and their setting matches that of the
12726 compile-step at function granularity. Note that this matters only
12727 for diagnostics emitted during optimization. Note that code
12728 transforms such as inlining can lead to warnings being enabled
12729 or disabled for regions if code not consistent with the setting
12730 at compile time.
12731
12732 When you need to pass options to the assembler via @option{-Wa} or
12733 @option{-Xassembler} make sure to either compile such translation
12734 units with @option{-fno-lto} or consistently use the same assembler
12735 options on all translation units. You can alternatively also
12736 specify assembler options at LTO link time.
12737
12738 To enable debug info generation you need to supply @option{-g} at
12739 compile time. If any of the input files at link time were built
12740 with debug info generation enabled the link will enable debug info
12741 generation as well. Any elaborate debug info settings
12742 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
12743 at the linker command line and mixing different settings in different
12744 translation units is discouraged.
12745
12746 If LTO encounters objects with C linkage declared with incompatible
12747 types in separate translation units to be linked together (undefined
12748 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
12749 issued. The behavior is still undefined at run time. Similar
12750 diagnostics may be raised for other languages.
12751
12752 Another feature of LTO is that it is possible to apply interprocedural
12753 optimizations on files written in different languages:
12754
12755 @smallexample
12756 gcc -c -flto foo.c
12757 g++ -c -flto bar.cc
12758 gfortran -c -flto baz.f90
12759 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
12760 @end smallexample
12761
12762 Notice that the final link is done with @command{g++} to get the C++
12763 runtime libraries and @option{-lgfortran} is added to get the Fortran
12764 runtime libraries. In general, when mixing languages in LTO mode, you
12765 should use the same link command options as when mixing languages in a
12766 regular (non-LTO) compilation.
12767
12768 If object files containing GIMPLE bytecode are stored in a library archive, say
12769 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
12770 are using a linker with plugin support. To create static libraries suitable
12771 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
12772 and @command{ranlib};
12773 to show the symbols of object files with GIMPLE bytecode, use
12774 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
12775 and @command{nm} have been compiled with plugin support. At link time, use the
12776 flag @option{-fuse-linker-plugin} to ensure that the library participates in
12777 the LTO optimization process:
12778
12779 @smallexample
12780 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
12781 @end smallexample
12782
12783 With the linker plugin enabled, the linker extracts the needed
12784 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
12785 to make them part of the aggregated GIMPLE image to be optimized.
12786
12787 If you are not using a linker with plugin support and/or do not
12788 enable the linker plugin, then the objects inside @file{libfoo.a}
12789 are extracted and linked as usual, but they do not participate
12790 in the LTO optimization process. In order to make a static library suitable
12791 for both LTO optimization and usual linkage, compile its object files with
12792 @option{-flto} @option{-ffat-lto-objects}.
12793
12794 Link-time optimizations do not require the presence of the whole program to
12795 operate. If the program does not require any symbols to be exported, it is
12796 possible to combine @option{-flto} and @option{-fwhole-program} to allow
12797 the interprocedural optimizers to use more aggressive assumptions which may
12798 lead to improved optimization opportunities.
12799 Use of @option{-fwhole-program} is not needed when linker plugin is
12800 active (see @option{-fuse-linker-plugin}).
12801
12802 The current implementation of LTO makes no
12803 attempt to generate bytecode that is portable between different
12804 types of hosts. The bytecode files are versioned and there is a
12805 strict version check, so bytecode files generated in one version of
12806 GCC do not work with an older or newer version of GCC.
12807
12808 Link-time optimization does not work well with generation of debugging
12809 information on systems other than those using a combination of ELF and
12810 DWARF.
12811
12812 If you specify the optional @var{n}, the optimization and code
12813 generation done at link time is executed in parallel using @var{n}
12814 parallel jobs by utilizing an installed @command{make} program. The
12815 environment variable @env{MAKE} may be used to override the program
12816 used.
12817
12818 You can also specify @option{-flto=jobserver} to use GNU make's
12819 job server mode to determine the number of parallel jobs. This
12820 is useful when the Makefile calling GCC is already executing in parallel.
12821 You must prepend a @samp{+} to the command recipe in the parent Makefile
12822 for this to work. This option likely only works if @env{MAKE} is
12823 GNU make. Even without the option value, GCC tries to automatically
12824 detect a running GNU make's job server.
12825
12826 Use @option{-flto=auto} to use GNU make's job server, if available,
12827 or otherwise fall back to autodetection of the number of CPU threads
12828 present in your system.
12829
12830 @item -flto-partition=@var{alg}
12831 @opindex flto-partition
12832 Specify the partitioning algorithm used by the link-time optimizer.
12833 The value is either @samp{1to1} to specify a partitioning mirroring
12834 the original source files or @samp{balanced} to specify partitioning
12835 into equally sized chunks (whenever possible) or @samp{max} to create
12836 new partition for every symbol where possible. Specifying @samp{none}
12837 as an algorithm disables partitioning and streaming completely.
12838 The default value is @samp{balanced}. While @samp{1to1} can be used
12839 as an workaround for various code ordering issues, the @samp{max}
12840 partitioning is intended for internal testing only.
12841 The value @samp{one} specifies that exactly one partition should be
12842 used while the value @samp{none} bypasses partitioning and executes
12843 the link-time optimization step directly from the WPA phase.
12844
12845 @item -flto-compression-level=@var{n}
12846 @opindex flto-compression-level
12847 This option specifies the level of compression used for intermediate
12848 language written to LTO object files, and is only meaningful in
12849 conjunction with LTO mode (@option{-flto}). GCC currently supports two
12850 LTO compression algorithms. For zstd, valid values are 0 (no compression)
12851 to 19 (maximum compression), while zlib supports values from 0 to 9.
12852 Values outside this range are clamped to either minimum or maximum
12853 of the supported values. If the option is not given,
12854 a default balanced compression setting is used.
12855
12856 @item -fuse-linker-plugin
12857 @opindex fuse-linker-plugin
12858 Enables the use of a linker plugin during link-time optimization. This
12859 option relies on plugin support in the linker, which is available in gold
12860 or in GNU ld 2.21 or newer.
12861
12862 This option enables the extraction of object files with GIMPLE bytecode out
12863 of library archives. This improves the quality of optimization by exposing
12864 more code to the link-time optimizer. This information specifies what
12865 symbols can be accessed externally (by non-LTO object or during dynamic
12866 linking). Resulting code quality improvements on binaries (and shared
12867 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
12868 See @option{-flto} for a description of the effect of this flag and how to
12869 use it.
12870
12871 This option is enabled by default when LTO support in GCC is enabled
12872 and GCC was configured for use with
12873 a linker supporting plugins (GNU ld 2.21 or newer or gold).
12874
12875 @item -ffat-lto-objects
12876 @opindex ffat-lto-objects
12877 Fat LTO objects are object files that contain both the intermediate language
12878 and the object code. This makes them usable for both LTO linking and normal
12879 linking. This option is effective only when compiling with @option{-flto}
12880 and is ignored at link time.
12881
12882 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
12883 requires the complete toolchain to be aware of LTO. It requires a linker with
12884 linker plugin support for basic functionality. Additionally,
12885 @command{nm}, @command{ar} and @command{ranlib}
12886 need to support linker plugins to allow a full-featured build environment
12887 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
12888 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
12889 to these tools. With non fat LTO makefiles need to be modified to use them.
12890
12891 Note that modern binutils provide plugin auto-load mechanism.
12892 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
12893 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
12894 @command{gcc-ranlib}).
12895
12896 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
12897 support.
12898
12899 @item -fcompare-elim
12900 @opindex fcompare-elim
12901 After register allocation and post-register allocation instruction splitting,
12902 identify arithmetic instructions that compute processor flags similar to a
12903 comparison operation based on that arithmetic. If possible, eliminate the
12904 explicit comparison operation.
12905
12906 This pass only applies to certain targets that cannot explicitly represent
12907 the comparison operation before register allocation is complete.
12908
12909 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12910
12911 @item -fcprop-registers
12912 @opindex fcprop-registers
12913 After register allocation and post-register allocation instruction splitting,
12914 perform a copy-propagation pass to try to reduce scheduling dependencies
12915 and occasionally eliminate the copy.
12916
12917 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12918
12919 @item -fprofile-correction
12920 @opindex fprofile-correction
12921 Profiles collected using an instrumented binary for multi-threaded programs may
12922 be inconsistent due to missed counter updates. When this option is specified,
12923 GCC uses heuristics to correct or smooth out such inconsistencies. By
12924 default, GCC emits an error message when an inconsistent profile is detected.
12925
12926 This option is enabled by @option{-fauto-profile}.
12927
12928 @item -fprofile-partial-training
12929 @opindex fprofile-partial-training
12930 With @code{-fprofile-use} all portions of programs not executed during train
12931 run are optimized agressively for size rather than speed. In some cases it is
12932 not practical to train all possible hot paths in the program. (For
12933 example, program may contain functions specific for a given hardware and
12934 trianing may not cover all hardware configurations program is run on.) With
12935 @code{-fprofile-partial-training} profile feedback will be ignored for all
12936 functions not executed during the train run leading them to be optimized as if
12937 they were compiled without profile feedback. This leads to better performance
12938 when train run is not representative but also leads to significantly bigger
12939 code.
12940
12941 @item -fprofile-use
12942 @itemx -fprofile-use=@var{path}
12943 @opindex fprofile-use
12944 Enable profile feedback-directed optimizations,
12945 and the following optimizations, many of which
12946 are generally profitable only with profile feedback available:
12947
12948 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12949 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12950 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12951 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12952 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12953 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12954 -fprofile-reorder-functions}
12955
12956 Before you can use this option, you must first generate profiling information.
12957 @xref{Instrumentation Options}, for information about the
12958 @option{-fprofile-generate} option.
12959
12960 By default, GCC emits an error message if the feedback profiles do not
12961 match the source code. This error can be turned into a warning by using
12962 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
12963 optimized code. Additionally, by default, GCC also emits a warning message if
12964 the feedback profiles do not exist (see @option{-Wmissing-profile}).
12965
12966 If @var{path} is specified, GCC looks at the @var{path} to find
12967 the profile feedback data files. See @option{-fprofile-dir}.
12968
12969 @item -fauto-profile
12970 @itemx -fauto-profile=@var{path}
12971 @opindex fauto-profile
12972 Enable sampling-based feedback-directed optimizations,
12973 and the following optimizations,
12974 many of which are generally profitable only with profile feedback available:
12975
12976 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12977 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12978 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12979 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12980 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12981 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12982 -fprofile-correction}
12983
12984 @var{path} is the name of a file containing AutoFDO profile information.
12985 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
12986
12987 Producing an AutoFDO profile data file requires running your program
12988 with the @command{perf} utility on a supported GNU/Linux target system.
12989 For more information, see @uref{https://perf.wiki.kernel.org/}.
12990
12991 E.g.
12992 @smallexample
12993 perf record -e br_inst_retired:near_taken -b -o perf.data \
12994 -- your_program
12995 @end smallexample
12996
12997 Then use the @command{create_gcov} tool to convert the raw profile data
12998 to a format that can be used by GCC.@ You must also supply the
12999 unstripped binary for your program to this tool.
13000 See @uref{https://github.com/google/autofdo}.
13001
13002 E.g.
13003 @smallexample
13004 create_gcov --binary=your_program.unstripped --profile=perf.data \
13005 --gcov=profile.afdo
13006 @end smallexample
13007 @end table
13008
13009 The following options control compiler behavior regarding floating-point
13010 arithmetic. These options trade off between speed and
13011 correctness. All must be specifically enabled.
13012
13013 @table @gcctabopt
13014 @item -ffloat-store
13015 @opindex ffloat-store
13016 Do not store floating-point variables in registers, and inhibit other
13017 options that might change whether a floating-point value is taken from a
13018 register or memory.
13019
13020 @cindex floating-point precision
13021 This option prevents undesirable excess precision on machines such as
13022 the 68000 where the floating registers (of the 68881) keep more
13023 precision than a @code{double} is supposed to have. Similarly for the
13024 x86 architecture. For most programs, the excess precision does only
13025 good, but a few programs rely on the precise definition of IEEE floating
13026 point. Use @option{-ffloat-store} for such programs, after modifying
13027 them to store all pertinent intermediate computations into variables.
13028
13029 @item -fexcess-precision=@var{style}
13030 @opindex fexcess-precision
13031 This option allows further control over excess precision on machines
13032 where floating-point operations occur in a format with more precision or
13033 range than the IEEE standard and interchange floating-point types. By
13034 default, @option{-fexcess-precision=fast} is in effect; this means that
13035 operations may be carried out in a wider precision than the types specified
13036 in the source if that would result in faster code, and it is unpredictable
13037 when rounding to the types specified in the source code takes place.
13038 When compiling C, if @option{-fexcess-precision=standard} is specified then
13039 excess precision follows the rules specified in ISO C99; in particular,
13040 both casts and assignments cause values to be rounded to their
13041 semantic types (whereas @option{-ffloat-store} only affects
13042 assignments). This option is enabled by default for C if a strict
13043 conformance option such as @option{-std=c99} is used.
13044 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
13045 regardless of whether a strict conformance option is used.
13046
13047 @opindex mfpmath
13048 @option{-fexcess-precision=standard} is not implemented for languages
13049 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
13050 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
13051 semantics apply without excess precision, and in the latter, rounding
13052 is unpredictable.
13053
13054 @item -ffast-math
13055 @opindex ffast-math
13056 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
13057 @option{-ffinite-math-only}, @option{-fno-rounding-math},
13058 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
13059 @option{-fexcess-precision=fast}.
13060
13061 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
13062
13063 This option is not turned on by any @option{-O} option besides
13064 @option{-Ofast} since it can result in incorrect output for programs
13065 that depend on an exact implementation of IEEE or ISO rules/specifications
13066 for math functions. It may, however, yield faster code for programs
13067 that do not require the guarantees of these specifications.
13068
13069 @item -fno-math-errno
13070 @opindex fno-math-errno
13071 @opindex fmath-errno
13072 Do not set @code{errno} after calling math functions that are executed
13073 with a single instruction, e.g., @code{sqrt}. A program that relies on
13074 IEEE exceptions for math error handling may want to use this flag
13075 for speed while maintaining IEEE arithmetic compatibility.
13076
13077 This option is not turned on by any @option{-O} option since
13078 it can result in incorrect output for programs that depend on
13079 an exact implementation of IEEE or ISO rules/specifications for
13080 math functions. It may, however, yield faster code for programs
13081 that do not require the guarantees of these specifications.
13082
13083 The default is @option{-fmath-errno}.
13084
13085 On Darwin systems, the math library never sets @code{errno}. There is
13086 therefore no reason for the compiler to consider the possibility that
13087 it might, and @option{-fno-math-errno} is the default.
13088
13089 @item -funsafe-math-optimizations
13090 @opindex funsafe-math-optimizations
13091
13092 Allow optimizations for floating-point arithmetic that (a) assume
13093 that arguments and results are valid and (b) may violate IEEE or
13094 ANSI standards. When used at link time, it may include libraries
13095 or startup files that change the default FPU control word or other
13096 similar optimizations.
13097
13098 This option is not turned on by any @option{-O} option since
13099 it can result in incorrect output for programs that depend on
13100 an exact implementation of IEEE or ISO rules/specifications for
13101 math functions. It may, however, yield faster code for programs
13102 that do not require the guarantees of these specifications.
13103 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
13104 @option{-fassociative-math} and @option{-freciprocal-math}.
13105
13106 The default is @option{-fno-unsafe-math-optimizations}.
13107
13108 @item -fassociative-math
13109 @opindex fassociative-math
13110
13111 Allow re-association of operands in series of floating-point operations.
13112 This violates the ISO C and C++ language standard by possibly changing
13113 computation result. NOTE: re-ordering may change the sign of zero as
13114 well as ignore NaNs and inhibit or create underflow or overflow (and
13115 thus cannot be used on code that relies on rounding behavior like
13116 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
13117 and thus may not be used when ordered comparisons are required.
13118 This option requires that both @option{-fno-signed-zeros} and
13119 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
13120 much sense with @option{-frounding-math}. For Fortran the option
13121 is automatically enabled when both @option{-fno-signed-zeros} and
13122 @option{-fno-trapping-math} are in effect.
13123
13124 The default is @option{-fno-associative-math}.
13125
13126 @item -freciprocal-math
13127 @opindex freciprocal-math
13128
13129 Allow the reciprocal of a value to be used instead of dividing by
13130 the value if this enables optimizations. For example @code{x / y}
13131 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
13132 is subject to common subexpression elimination. Note that this loses
13133 precision and increases the number of flops operating on the value.
13134
13135 The default is @option{-fno-reciprocal-math}.
13136
13137 @item -ffinite-math-only
13138 @opindex ffinite-math-only
13139 Allow optimizations for floating-point arithmetic that assume
13140 that arguments and results are not NaNs or +-Infs.
13141
13142 This option is not turned on by any @option{-O} option since
13143 it can result in incorrect output for programs that depend on
13144 an exact implementation of IEEE or ISO rules/specifications for
13145 math functions. It may, however, yield faster code for programs
13146 that do not require the guarantees of these specifications.
13147
13148 The default is @option{-fno-finite-math-only}.
13149
13150 @item -fno-signed-zeros
13151 @opindex fno-signed-zeros
13152 @opindex fsigned-zeros
13153 Allow optimizations for floating-point arithmetic that ignore the
13154 signedness of zero. IEEE arithmetic specifies the behavior of
13155 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
13156 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
13157 This option implies that the sign of a zero result isn't significant.
13158
13159 The default is @option{-fsigned-zeros}.
13160
13161 @item -fno-trapping-math
13162 @opindex fno-trapping-math
13163 @opindex ftrapping-math
13164 Compile code assuming that floating-point operations cannot generate
13165 user-visible traps. These traps include division by zero, overflow,
13166 underflow, inexact result and invalid operation. This option requires
13167 that @option{-fno-signaling-nans} be in effect. Setting this option may
13168 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
13169
13170 This option should never be turned on by any @option{-O} option since
13171 it can result in incorrect output for programs that depend on
13172 an exact implementation of IEEE or ISO rules/specifications for
13173 math functions.
13174
13175 The default is @option{-ftrapping-math}.
13176
13177 @item -frounding-math
13178 @opindex frounding-math
13179 Disable transformations and optimizations that assume default floating-point
13180 rounding behavior. This is round-to-zero for all floating point
13181 to integer conversions, and round-to-nearest for all other arithmetic
13182 truncations. This option should be specified for programs that change
13183 the FP rounding mode dynamically, or that may be executed with a
13184 non-default rounding mode. This option disables constant folding of
13185 floating-point expressions at compile time (which may be affected by
13186 rounding mode) and arithmetic transformations that are unsafe in the
13187 presence of sign-dependent rounding modes.
13188
13189 The default is @option{-fno-rounding-math}.
13190
13191 This option is experimental and does not currently guarantee to
13192 disable all GCC optimizations that are affected by rounding mode.
13193 Future versions of GCC may provide finer control of this setting
13194 using C99's @code{FENV_ACCESS} pragma. This command-line option
13195 will be used to specify the default state for @code{FENV_ACCESS}.
13196
13197 @item -fsignaling-nans
13198 @opindex fsignaling-nans
13199 Compile code assuming that IEEE signaling NaNs may generate user-visible
13200 traps during floating-point operations. Setting this option disables
13201 optimizations that may change the number of exceptions visible with
13202 signaling NaNs. This option implies @option{-ftrapping-math}.
13203
13204 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
13205 be defined.
13206
13207 The default is @option{-fno-signaling-nans}.
13208
13209 This option is experimental and does not currently guarantee to
13210 disable all GCC optimizations that affect signaling NaN behavior.
13211
13212 @item -fno-fp-int-builtin-inexact
13213 @opindex fno-fp-int-builtin-inexact
13214 @opindex ffp-int-builtin-inexact
13215 Do not allow the built-in functions @code{ceil}, @code{floor},
13216 @code{round} and @code{trunc}, and their @code{float} and @code{long
13217 double} variants, to generate code that raises the ``inexact''
13218 floating-point exception for noninteger arguments. ISO C99 and C11
13219 allow these functions to raise the ``inexact'' exception, but ISO/IEC
13220 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
13221 ISO C2X, does not allow these functions to do so.
13222
13223 The default is @option{-ffp-int-builtin-inexact}, allowing the
13224 exception to be raised, unless C2X or a later C standard is selected.
13225 This option does nothing unless @option{-ftrapping-math} is in effect.
13226
13227 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
13228 generate a call to a library function then the ``inexact'' exception
13229 may be raised if the library implementation does not follow TS 18661.
13230
13231 @item -fsingle-precision-constant
13232 @opindex fsingle-precision-constant
13233 Treat floating-point constants as single precision instead of
13234 implicitly converting them to double-precision constants.
13235
13236 @item -fcx-limited-range
13237 @opindex fcx-limited-range
13238 When enabled, this option states that a range reduction step is not
13239 needed when performing complex division. Also, there is no checking
13240 whether the result of a complex multiplication or division is @code{NaN
13241 + I*NaN}, with an attempt to rescue the situation in that case. The
13242 default is @option{-fno-cx-limited-range}, but is enabled by
13243 @option{-ffast-math}.
13244
13245 This option controls the default setting of the ISO C99
13246 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
13247 all languages.
13248
13249 @item -fcx-fortran-rules
13250 @opindex fcx-fortran-rules
13251 Complex multiplication and division follow Fortran rules. Range
13252 reduction is done as part of complex division, but there is no checking
13253 whether the result of a complex multiplication or division is @code{NaN
13254 + I*NaN}, with an attempt to rescue the situation in that case.
13255
13256 The default is @option{-fno-cx-fortran-rules}.
13257
13258 @end table
13259
13260 The following options control optimizations that may improve
13261 performance, but are not enabled by any @option{-O} options. This
13262 section includes experimental options that may produce broken code.
13263
13264 @table @gcctabopt
13265 @item -fbranch-probabilities
13266 @opindex fbranch-probabilities
13267 After running a program compiled with @option{-fprofile-arcs}
13268 (@pxref{Instrumentation Options}),
13269 you can compile it a second time using
13270 @option{-fbranch-probabilities}, to improve optimizations based on
13271 the number of times each branch was taken. When a program
13272 compiled with @option{-fprofile-arcs} exits, it saves arc execution
13273 counts to a file called @file{@var{sourcename}.gcda} for each source
13274 file. The information in this data file is very dependent on the
13275 structure of the generated code, so you must use the same source code
13276 and the same optimization options for both compilations.
13277
13278 With @option{-fbranch-probabilities}, GCC puts a
13279 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
13280 These can be used to improve optimization. Currently, they are only
13281 used in one place: in @file{reorg.c}, instead of guessing which path a
13282 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
13283 exactly determine which path is taken more often.
13284
13285 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13286
13287 @item -fprofile-values
13288 @opindex fprofile-values
13289 If combined with @option{-fprofile-arcs}, it adds code so that some
13290 data about values of expressions in the program is gathered.
13291
13292 With @option{-fbranch-probabilities}, it reads back the data gathered
13293 from profiling values of expressions for usage in optimizations.
13294
13295 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
13296 @option{-fauto-profile}.
13297
13298 @item -fprofile-reorder-functions
13299 @opindex fprofile-reorder-functions
13300 Function reordering based on profile instrumentation collects
13301 first time of execution of a function and orders these functions
13302 in ascending order.
13303
13304 Enabled with @option{-fprofile-use}.
13305
13306 @item -fvpt
13307 @opindex fvpt
13308 If combined with @option{-fprofile-arcs}, this option instructs the compiler
13309 to add code to gather information about values of expressions.
13310
13311 With @option{-fbranch-probabilities}, it reads back the data gathered
13312 and actually performs the optimizations based on them.
13313 Currently the optimizations include specialization of division operations
13314 using the knowledge about the value of the denominator.
13315
13316 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
13317
13318 @item -frename-registers
13319 @opindex frename-registers
13320 Attempt to avoid false dependencies in scheduled code by making use
13321 of registers left over after register allocation. This optimization
13322 most benefits processors with lots of registers. Depending on the
13323 debug information format adopted by the target, however, it can
13324 make debugging impossible, since variables no longer stay in
13325 a ``home register''.
13326
13327 Enabled by default with @option{-funroll-loops}.
13328
13329 @item -fschedule-fusion
13330 @opindex fschedule-fusion
13331 Performs a target dependent pass over the instruction stream to schedule
13332 instructions of same type together because target machine can execute them
13333 more efficiently if they are adjacent to each other in the instruction flow.
13334
13335 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13336
13337 @item -ftracer
13338 @opindex ftracer
13339 Perform tail duplication to enlarge superblock size. This transformation
13340 simplifies the control flow of the function allowing other optimizations to do
13341 a better job.
13342
13343 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13344
13345 @item -funroll-loops
13346 @opindex funroll-loops
13347 Unroll loops whose number of iterations can be determined at compile time or
13348 upon entry to the loop. @option{-funroll-loops} implies
13349 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
13350 It also turns on complete loop peeling (i.e.@: complete removal of loops with
13351 a small constant number of iterations). This option makes code larger, and may
13352 or may not make it run faster.
13353
13354 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13355
13356 @item -funroll-all-loops
13357 @opindex funroll-all-loops
13358 Unroll all loops, even if their number of iterations is uncertain when
13359 the loop is entered. This usually makes programs run more slowly.
13360 @option{-funroll-all-loops} implies the same options as
13361 @option{-funroll-loops}.
13362
13363 @item -fpeel-loops
13364 @opindex fpeel-loops
13365 Peels loops for which there is enough information that they do not
13366 roll much (from profile feedback or static analysis). It also turns on
13367 complete loop peeling (i.e.@: complete removal of loops with small constant
13368 number of iterations).
13369
13370 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
13371
13372 @item -fmove-loop-invariants
13373 @opindex fmove-loop-invariants
13374 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
13375 at level @option{-O1} and higher, except for @option{-Og}.
13376
13377 @item -fmove-loop-stores
13378 @opindex fmove-loop-stores
13379 Enables the loop store motion pass in the GIMPLE loop optimizer. This
13380 moves invariant stores to after the end of the loop in exchange for
13381 carrying the stored value in a register across the iteration.
13382 Note for this option to have an effect @option{-ftree-loop-im} has to
13383 be enabled as well. Enabled at level @option{-O1} and higher, except
13384 for @option{-Og}.
13385
13386 @item -fsplit-loops
13387 @opindex fsplit-loops
13388 Split a loop into two if it contains a condition that's always true
13389 for one side of the iteration space and false for the other.
13390
13391 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13392
13393 @item -funswitch-loops
13394 @opindex funswitch-loops
13395 Move branches with loop invariant conditions out of the loop, with duplicates
13396 of the loop on both branches (modified according to result of the condition).
13397
13398 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13399
13400 @item -fversion-loops-for-strides
13401 @opindex fversion-loops-for-strides
13402 If a loop iterates over an array with a variable stride, create another
13403 version of the loop that assumes the stride is always one. For example:
13404
13405 @smallexample
13406 for (int i = 0; i < n; ++i)
13407 x[i * stride] = @dots{};
13408 @end smallexample
13409
13410 becomes:
13411
13412 @smallexample
13413 if (stride == 1)
13414 for (int i = 0; i < n; ++i)
13415 x[i] = @dots{};
13416 else
13417 for (int i = 0; i < n; ++i)
13418 x[i * stride] = @dots{};
13419 @end smallexample
13420
13421 This is particularly useful for assumed-shape arrays in Fortran where
13422 (for example) it allows better vectorization assuming contiguous accesses.
13423 This flag is enabled by default at @option{-O3}.
13424 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13425
13426 @item -ffunction-sections
13427 @itemx -fdata-sections
13428 @opindex ffunction-sections
13429 @opindex fdata-sections
13430 Place each function or data item into its own section in the output
13431 file if the target supports arbitrary sections. The name of the
13432 function or the name of the data item determines the section's name
13433 in the output file.
13434
13435 Use these options on systems where the linker can perform optimizations to
13436 improve locality of reference in the instruction space. Most systems using the
13437 ELF object format have linkers with such optimizations. On AIX, the linker
13438 rearranges sections (CSECTs) based on the call graph. The performance impact
13439 varies.
13440
13441 Together with a linker garbage collection (linker @option{--gc-sections}
13442 option) these options may lead to smaller statically-linked executables (after
13443 stripping).
13444
13445 On ELF/DWARF systems these options do not degenerate the quality of the debug
13446 information. There could be issues with other object files/debug info formats.
13447
13448 Only use these options when there are significant benefits from doing so. When
13449 you specify these options, the assembler and linker create larger object and
13450 executable files and are also slower. These options affect code generation.
13451 They prevent optimizations by the compiler and assembler using relative
13452 locations inside a translation unit since the locations are unknown until
13453 link time. An example of such an optimization is relaxing calls to short call
13454 instructions.
13455
13456 @item -fstdarg-opt
13457 @opindex fstdarg-opt
13458 Optimize the prologue of variadic argument functions with respect to usage of
13459 those arguments.
13460
13461 @item -fsection-anchors
13462 @opindex fsection-anchors
13463 Try to reduce the number of symbolic address calculations by using
13464 shared ``anchor'' symbols to address nearby objects. This transformation
13465 can help to reduce the number of GOT entries and GOT accesses on some
13466 targets.
13467
13468 For example, the implementation of the following function @code{foo}:
13469
13470 @smallexample
13471 static int a, b, c;
13472 int foo (void) @{ return a + b + c; @}
13473 @end smallexample
13474
13475 @noindent
13476 usually calculates the addresses of all three variables, but if you
13477 compile it with @option{-fsection-anchors}, it accesses the variables
13478 from a common anchor point instead. The effect is similar to the
13479 following pseudocode (which isn't valid C):
13480
13481 @smallexample
13482 int foo (void)
13483 @{
13484 register int *xr = &x;
13485 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
13486 @}
13487 @end smallexample
13488
13489 Not all targets support this option.
13490
13491 @item -fzero-call-used-regs=@var{choice}
13492 @opindex fzero-call-used-regs
13493 Zero call-used registers at function return to increase program
13494 security by either mitigating Return-Oriented Programming (ROP)
13495 attacks or preventing information leakage through registers.
13496
13497 The possible values of @var{choice} are the same as for the
13498 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
13499 The default is @samp{skip}.
13500
13501 You can control this behavior for a specific function by using the function
13502 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
13503
13504 @item --param @var{name}=@var{value}
13505 @opindex param
13506 In some places, GCC uses various constants to control the amount of
13507 optimization that is done. For example, GCC does not inline functions
13508 that contain more than a certain number of instructions. You can
13509 control some of these constants on the command line using the
13510 @option{--param} option.
13511
13512 The names of specific parameters, and the meaning of the values, are
13513 tied to the internals of the compiler, and are subject to change
13514 without notice in future releases.
13515
13516 In order to get minimal, maximal and default value of a parameter,
13517 one can use @option{--help=param -Q} options.
13518
13519 In each case, the @var{value} is an integer. The following choices
13520 of @var{name} are recognized for all targets:
13521
13522 @table @gcctabopt
13523 @item predictable-branch-outcome
13524 When branch is predicted to be taken with probability lower than this threshold
13525 (in percent), then it is considered well predictable.
13526
13527 @item max-rtl-if-conversion-insns
13528 RTL if-conversion tries to remove conditional branches around a block and
13529 replace them with conditionally executed instructions. This parameter
13530 gives the maximum number of instructions in a block which should be
13531 considered for if-conversion. The compiler will
13532 also use other heuristics to decide whether if-conversion is likely to be
13533 profitable.
13534
13535 @item max-rtl-if-conversion-predictable-cost
13536 RTL if-conversion will try to remove conditional branches around a block
13537 and replace them with conditionally executed instructions. These parameters
13538 give the maximum permissible cost for the sequence that would be generated
13539 by if-conversion depending on whether the branch is statically determined
13540 to be predictable or not. The units for this parameter are the same as
13541 those for the GCC internal seq_cost metric. The compiler will try to
13542 provide a reasonable default for this parameter using the BRANCH_COST
13543 target macro.
13544
13545 @item max-crossjump-edges
13546 The maximum number of incoming edges to consider for cross-jumping.
13547 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
13548 the number of edges incoming to each block. Increasing values mean
13549 more aggressive optimization, making the compilation time increase with
13550 probably small improvement in executable size.
13551
13552 @item min-crossjump-insns
13553 The minimum number of instructions that must be matched at the end
13554 of two blocks before cross-jumping is performed on them. This
13555 value is ignored in the case where all instructions in the block being
13556 cross-jumped from are matched.
13557
13558 @item max-grow-copy-bb-insns
13559 The maximum code size expansion factor when copying basic blocks
13560 instead of jumping. The expansion is relative to a jump instruction.
13561
13562 @item max-goto-duplication-insns
13563 The maximum number of instructions to duplicate to a block that jumps
13564 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
13565 passes, GCC factors computed gotos early in the compilation process,
13566 and unfactors them as late as possible. Only computed jumps at the
13567 end of a basic blocks with no more than max-goto-duplication-insns are
13568 unfactored.
13569
13570 @item max-delay-slot-insn-search
13571 The maximum number of instructions to consider when looking for an
13572 instruction to fill a delay slot. If more than this arbitrary number of
13573 instructions are searched, the time savings from filling the delay slot
13574 are minimal, so stop searching. Increasing values mean more
13575 aggressive optimization, making the compilation time increase with probably
13576 small improvement in execution time.
13577
13578 @item max-delay-slot-live-search
13579 When trying to fill delay slots, the maximum number of instructions to
13580 consider when searching for a block with valid live register
13581 information. Increasing this arbitrarily chosen value means more
13582 aggressive optimization, increasing the compilation time. This parameter
13583 should be removed when the delay slot code is rewritten to maintain the
13584 control-flow graph.
13585
13586 @item max-gcse-memory
13587 The approximate maximum amount of memory in @code{kB} that can be allocated in
13588 order to perform the global common subexpression elimination
13589 optimization. If more memory than specified is required, the
13590 optimization is not done.
13591
13592 @item max-gcse-insertion-ratio
13593 If the ratio of expression insertions to deletions is larger than this value
13594 for any expression, then RTL PRE inserts or removes the expression and thus
13595 leaves partially redundant computations in the instruction stream.
13596
13597 @item max-pending-list-length
13598 The maximum number of pending dependencies scheduling allows
13599 before flushing the current state and starting over. Large functions
13600 with few branches or calls can create excessively large lists which
13601 needlessly consume memory and resources.
13602
13603 @item max-modulo-backtrack-attempts
13604 The maximum number of backtrack attempts the scheduler should make
13605 when modulo scheduling a loop. Larger values can exponentially increase
13606 compilation time.
13607
13608 @item max-inline-insns-single
13609 Several parameters control the tree inliner used in GCC@. This number sets the
13610 maximum number of instructions (counted in GCC's internal representation) in a
13611 single function that the tree inliner considers for inlining. This only
13612 affects functions declared inline and methods implemented in a class
13613 declaration (C++).
13614
13615
13616 @item max-inline-insns-auto
13617 When you use @option{-finline-functions} (included in @option{-O3}),
13618 a lot of functions that would otherwise not be considered for inlining
13619 by the compiler are investigated. To those functions, a different
13620 (more restrictive) limit compared to functions declared inline can
13621 be applied (@option{--param max-inline-insns-auto}).
13622
13623 @item max-inline-insns-small
13624 This is bound applied to calls which are considered relevant with
13625 @option{-finline-small-functions}.
13626
13627 @item max-inline-insns-size
13628 This is bound applied to calls which are optimized for size. Small growth
13629 may be desirable to anticipate optimization oppurtunities exposed by inlining.
13630
13631 @item uninlined-function-insns
13632 Number of instructions accounted by inliner for function overhead such as
13633 function prologue and epilogue.
13634
13635 @item uninlined-function-time
13636 Extra time accounted by inliner for function overhead such as time needed to
13637 execute function prologue and epilogue.
13638
13639 @item inline-heuristics-hint-percent
13640 The scale (in percents) applied to @option{inline-insns-single},
13641 @option{inline-insns-single-O2}, @option{inline-insns-auto}
13642 when inline heuristics hints that inlining is
13643 very profitable (will enable later optimizations).
13644
13645 @item uninlined-thunk-insns
13646 @item uninlined-thunk-time
13647 Same as @option{--param uninlined-function-insns} and
13648 @option{--param uninlined-function-time} but applied to function thunks.
13649
13650 @item inline-min-speedup
13651 When estimated performance improvement of caller + callee runtime exceeds this
13652 threshold (in percent), the function can be inlined regardless of the limit on
13653 @option{--param max-inline-insns-single} and @option{--param
13654 max-inline-insns-auto}.
13655
13656 @item large-function-insns
13657 The limit specifying really large functions. For functions larger than this
13658 limit after inlining, inlining is constrained by
13659 @option{--param large-function-growth}. This parameter is useful primarily
13660 to avoid extreme compilation time caused by non-linear algorithms used by the
13661 back end.
13662
13663 @item large-function-growth
13664 Specifies maximal growth of large function caused by inlining in percents.
13665 For example, parameter value 100 limits large function growth to 2.0 times
13666 the original size.
13667
13668 @item large-unit-insns
13669 The limit specifying large translation unit. Growth caused by inlining of
13670 units larger than this limit is limited by @option{--param inline-unit-growth}.
13671 For small units this might be too tight.
13672 For example, consider a unit consisting of function A
13673 that is inline and B that just calls A three times. If B is small relative to
13674 A, the growth of unit is 300\% and yet such inlining is very sane. For very
13675 large units consisting of small inlineable functions, however, the overall unit
13676 growth limit is needed to avoid exponential explosion of code size. Thus for
13677 smaller units, the size is increased to @option{--param large-unit-insns}
13678 before applying @option{--param inline-unit-growth}.
13679
13680 @item lazy-modules
13681 Maximum number of concurrently open C++ module files when lazy loading.
13682
13683 @item inline-unit-growth
13684 Specifies maximal overall growth of the compilation unit caused by inlining.
13685 For example, parameter value 20 limits unit growth to 1.2 times the original
13686 size. Cold functions (either marked cold via an attribute or by profile
13687 feedback) are not accounted into the unit size.
13688
13689 @item ipa-cp-unit-growth
13690 Specifies maximal overall growth of the compilation unit caused by
13691 interprocedural constant propagation. For example, parameter value 10 limits
13692 unit growth to 1.1 times the original size.
13693
13694 @item ipa-cp-large-unit-insns
13695 The size of translation unit that IPA-CP pass considers large.
13696
13697 @item large-stack-frame
13698 The limit specifying large stack frames. While inlining the algorithm is trying
13699 to not grow past this limit too much.
13700
13701 @item large-stack-frame-growth
13702 Specifies maximal growth of large stack frames caused by inlining in percents.
13703 For example, parameter value 1000 limits large stack frame growth to 11 times
13704 the original size.
13705
13706 @item max-inline-insns-recursive
13707 @itemx max-inline-insns-recursive-auto
13708 Specifies the maximum number of instructions an out-of-line copy of a
13709 self-recursive inline
13710 function can grow into by performing recursive inlining.
13711
13712 @option{--param max-inline-insns-recursive} applies to functions
13713 declared inline.
13714 For functions not declared inline, recursive inlining
13715 happens only when @option{-finline-functions} (included in @option{-O3}) is
13716 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
13717
13718 @item max-inline-recursive-depth
13719 @itemx max-inline-recursive-depth-auto
13720 Specifies the maximum recursion depth used for recursive inlining.
13721
13722 @option{--param max-inline-recursive-depth} applies to functions
13723 declared inline. For functions not declared inline, recursive inlining
13724 happens only when @option{-finline-functions} (included in @option{-O3}) is
13725 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
13726
13727 @item min-inline-recursive-probability
13728 Recursive inlining is profitable only for function having deep recursion
13729 in average and can hurt for function having little recursion depth by
13730 increasing the prologue size or complexity of function body to other
13731 optimizers.
13732
13733 When profile feedback is available (see @option{-fprofile-generate}) the actual
13734 recursion depth can be guessed from the probability that function recurses
13735 via a given call expression. This parameter limits inlining only to call
13736 expressions whose probability exceeds the given threshold (in percents).
13737
13738 @item early-inlining-insns
13739 Specify growth that the early inliner can make. In effect it increases
13740 the amount of inlining for code having a large abstraction penalty.
13741
13742 @item max-early-inliner-iterations
13743 Limit of iterations of the early inliner. This basically bounds
13744 the number of nested indirect calls the early inliner can resolve.
13745 Deeper chains are still handled by late inlining.
13746
13747 @item comdat-sharing-probability
13748 Probability (in percent) that C++ inline function with comdat visibility
13749 are shared across multiple compilation units.
13750
13751 @item modref-max-bases
13752 @item modref-max-refs
13753 @item modref-max-accesses
13754 Specifies the maximal number of base pointers, references and accesses stored
13755 for a single function by mod/ref analysis.
13756
13757 @item modref-max-tests
13758 Specifies the maxmal number of tests alias oracle can perform to disambiguate
13759 memory locations using the mod/ref information. This parameter ought to be
13760 bigger than @option{--param modref-max-bases} and @option{--param
13761 modref-max-refs}.
13762
13763 @item modref-max-depth
13764 Specifies the maximum depth of DFS walk used by modref escape analysis.
13765 Setting to 0 disables the analysis completely.
13766
13767 @item modref-max-escape-points
13768 Specifies the maximum number of escape points tracked by modref per SSA-name.
13769
13770 @item modref-max-adjustments
13771 Specifies the maximum number the access range is enlarged during modref dataflow
13772 analysis.
13773
13774 @item profile-func-internal-id
13775 A parameter to control whether to use function internal id in profile
13776 database lookup. If the value is 0, the compiler uses an id that
13777 is based on function assembler name and filename, which makes old profile
13778 data more tolerant to source changes such as function reordering etc.
13779
13780 @item min-vect-loop-bound
13781 The minimum number of iterations under which loops are not vectorized
13782 when @option{-ftree-vectorize} is used. The number of iterations after
13783 vectorization needs to be greater than the value specified by this option
13784 to allow vectorization.
13785
13786 @item gcse-cost-distance-ratio
13787 Scaling factor in calculation of maximum distance an expression
13788 can be moved by GCSE optimizations. This is currently supported only in the
13789 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
13790 is with simple expressions, i.e., the expressions that have cost
13791 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
13792 hoisting of simple expressions.
13793
13794 @item gcse-unrestricted-cost
13795 Cost, roughly measured as the cost of a single typical machine
13796 instruction, at which GCSE optimizations do not constrain
13797 the distance an expression can travel. This is currently
13798 supported only in the code hoisting pass. The lesser the cost,
13799 the more aggressive code hoisting is. Specifying 0
13800 allows all expressions to travel unrestricted distances.
13801
13802 @item max-hoist-depth
13803 The depth of search in the dominator tree for expressions to hoist.
13804 This is used to avoid quadratic behavior in hoisting algorithm.
13805 The value of 0 does not limit on the search, but may slow down compilation
13806 of huge functions.
13807
13808 @item max-tail-merge-comparisons
13809 The maximum amount of similar bbs to compare a bb with. This is used to
13810 avoid quadratic behavior in tree tail merging.
13811
13812 @item max-tail-merge-iterations
13813 The maximum amount of iterations of the pass over the function. This is used to
13814 limit compilation time in tree tail merging.
13815
13816 @item store-merging-allow-unaligned
13817 Allow the store merging pass to introduce unaligned stores if it is legal to
13818 do so.
13819
13820 @item max-stores-to-merge
13821 The maximum number of stores to attempt to merge into wider stores in the store
13822 merging pass.
13823
13824 @item max-store-chains-to-track
13825 The maximum number of store chains to track at the same time in the attempt
13826 to merge them into wider stores in the store merging pass.
13827
13828 @item max-stores-to-track
13829 The maximum number of stores to track at the same time in the attemt to
13830 to merge them into wider stores in the store merging pass.
13831
13832 @item max-unrolled-insns
13833 The maximum number of instructions that a loop may have to be unrolled.
13834 If a loop is unrolled, this parameter also determines how many times
13835 the loop code is unrolled.
13836
13837 @item max-average-unrolled-insns
13838 The maximum number of instructions biased by probabilities of their execution
13839 that a loop may have to be unrolled. If a loop is unrolled,
13840 this parameter also determines how many times the loop code is unrolled.
13841
13842 @item max-unroll-times
13843 The maximum number of unrollings of a single loop.
13844
13845 @item max-peeled-insns
13846 The maximum number of instructions that a loop may have to be peeled.
13847 If a loop is peeled, this parameter also determines how many times
13848 the loop code is peeled.
13849
13850 @item max-peel-times
13851 The maximum number of peelings of a single loop.
13852
13853 @item max-peel-branches
13854 The maximum number of branches on the hot path through the peeled sequence.
13855
13856 @item max-completely-peeled-insns
13857 The maximum number of insns of a completely peeled loop.
13858
13859 @item max-completely-peel-times
13860 The maximum number of iterations of a loop to be suitable for complete peeling.
13861
13862 @item max-completely-peel-loop-nest-depth
13863 The maximum depth of a loop nest suitable for complete peeling.
13864
13865 @item max-unswitch-insns
13866 The maximum number of insns of an unswitched loop.
13867
13868 @item max-unswitch-level
13869 The maximum number of branches unswitched in a single loop.
13870
13871 @item lim-expensive
13872 The minimum cost of an expensive expression in the loop invariant motion.
13873
13874 @item min-loop-cond-split-prob
13875 When FDO profile information is available, @option{min-loop-cond-split-prob}
13876 specifies minimum threshold for probability of semi-invariant condition
13877 statement to trigger loop split.
13878
13879 @item iv-consider-all-candidates-bound
13880 Bound on number of candidates for induction variables, below which
13881 all candidates are considered for each use in induction variable
13882 optimizations. If there are more candidates than this,
13883 only the most relevant ones are considered to avoid quadratic time complexity.
13884
13885 @item iv-max-considered-uses
13886 The induction variable optimizations give up on loops that contain more
13887 induction variable uses.
13888
13889 @item iv-always-prune-cand-set-bound
13890 If the number of candidates in the set is smaller than this value,
13891 always try to remove unnecessary ivs from the set
13892 when adding a new one.
13893
13894 @item avg-loop-niter
13895 Average number of iterations of a loop.
13896
13897 @item dse-max-object-size
13898 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
13899 Larger values may result in larger compilation times.
13900
13901 @item dse-max-alias-queries-per-store
13902 Maximum number of queries into the alias oracle per store.
13903 Larger values result in larger compilation times and may result in more
13904 removed dead stores.
13905
13906 @item scev-max-expr-size
13907 Bound on size of expressions used in the scalar evolutions analyzer.
13908 Large expressions slow the analyzer.
13909
13910 @item scev-max-expr-complexity
13911 Bound on the complexity of the expressions in the scalar evolutions analyzer.
13912 Complex expressions slow the analyzer.
13913
13914 @item max-tree-if-conversion-phi-args
13915 Maximum number of arguments in a PHI supported by TREE if conversion
13916 unless the loop is marked with simd pragma.
13917
13918 @item vect-max-version-for-alignment-checks
13919 The maximum number of run-time checks that can be performed when
13920 doing loop versioning for alignment in the vectorizer.
13921
13922 @item vect-max-version-for-alias-checks
13923 The maximum number of run-time checks that can be performed when
13924 doing loop versioning for alias in the vectorizer.
13925
13926 @item vect-max-peeling-for-alignment
13927 The maximum number of loop peels to enhance access alignment
13928 for vectorizer. Value -1 means no limit.
13929
13930 @item max-iterations-to-track
13931 The maximum number of iterations of a loop the brute-force algorithm
13932 for analysis of the number of iterations of the loop tries to evaluate.
13933
13934 @item hot-bb-count-fraction
13935 The denominator n of fraction 1/n of the maximal execution count of a
13936 basic block in the entire program that a basic block needs to at least
13937 have in order to be considered hot. The default is 10000, which means
13938 that a basic block is considered hot if its execution count is greater
13939 than 1/10000 of the maximal execution count. 0 means that it is never
13940 considered hot. Used in non-LTO mode.
13941
13942 @item hot-bb-count-ws-permille
13943 The number of most executed permilles, ranging from 0 to 1000, of the
13944 profiled execution of the entire program to which the execution count
13945 of a basic block must be part of in order to be considered hot. The
13946 default is 990, which means that a basic block is considered hot if
13947 its execution count contributes to the upper 990 permilles, or 99.0%,
13948 of the profiled execution of the entire program. 0 means that it is
13949 never considered hot. Used in LTO mode.
13950
13951 @item hot-bb-frequency-fraction
13952 The denominator n of fraction 1/n of the execution frequency of the
13953 entry block of a function that a basic block of this function needs
13954 to at least have in order to be considered hot. The default is 1000,
13955 which means that a basic block is considered hot in a function if it
13956 is executed more frequently than 1/1000 of the frequency of the entry
13957 block of the function. 0 means that it is never considered hot.
13958
13959 @item unlikely-bb-count-fraction
13960 The denominator n of fraction 1/n of the number of profiled runs of
13961 the entire program below which the execution count of a basic block
13962 must be in order for the basic block to be considered unlikely executed.
13963 The default is 20, which means that a basic block is considered unlikely
13964 executed if it is executed in fewer than 1/20, or 5%, of the runs of
13965 the program. 0 means that it is always considered unlikely executed.
13966
13967 @item max-predicted-iterations
13968 The maximum number of loop iterations we predict statically. This is useful
13969 in cases where a function contains a single loop with known bound and
13970 another loop with unknown bound.
13971 The known number of iterations is predicted correctly, while
13972 the unknown number of iterations average to roughly 10. This means that the
13973 loop without bounds appears artificially cold relative to the other one.
13974
13975 @item builtin-expect-probability
13976 Control the probability of the expression having the specified value. This
13977 parameter takes a percentage (i.e.@: 0 ... 100) as input.
13978
13979 @item builtin-string-cmp-inline-length
13980 The maximum length of a constant string for a builtin string cmp call
13981 eligible for inlining.
13982
13983 @item align-threshold
13984
13985 Select fraction of the maximal frequency of executions of a basic block in
13986 a function to align the basic block.
13987
13988 @item align-loop-iterations
13989
13990 A loop expected to iterate at least the selected number of iterations is
13991 aligned.
13992
13993 @item tracer-dynamic-coverage
13994 @itemx tracer-dynamic-coverage-feedback
13995
13996 This value is used to limit superblock formation once the given percentage of
13997 executed instructions is covered. This limits unnecessary code size
13998 expansion.
13999
14000 The @option{tracer-dynamic-coverage-feedback} parameter
14001 is used only when profile
14002 feedback is available. The real profiles (as opposed to statically estimated
14003 ones) are much less balanced allowing the threshold to be larger value.
14004
14005 @item tracer-max-code-growth
14006 Stop tail duplication once code growth has reached given percentage. This is
14007 a rather artificial limit, as most of the duplicates are eliminated later in
14008 cross jumping, so it may be set to much higher values than is the desired code
14009 growth.
14010
14011 @item tracer-min-branch-ratio
14012
14013 Stop reverse growth when the reverse probability of best edge is less than this
14014 threshold (in percent).
14015
14016 @item tracer-min-branch-probability
14017 @itemx tracer-min-branch-probability-feedback
14018
14019 Stop forward growth if the best edge has probability lower than this
14020 threshold.
14021
14022 Similarly to @option{tracer-dynamic-coverage} two parameters are
14023 provided. @option{tracer-min-branch-probability-feedback} is used for
14024 compilation with profile feedback and @option{tracer-min-branch-probability}
14025 compilation without. The value for compilation with profile feedback
14026 needs to be more conservative (higher) in order to make tracer
14027 effective.
14028
14029 @item stack-clash-protection-guard-size
14030 Specify the size of the operating system provided stack guard as
14031 2 raised to @var{num} bytes. Higher values may reduce the
14032 number of explicit probes, but a value larger than the operating system
14033 provided guard will leave code vulnerable to stack clash style attacks.
14034
14035 @item stack-clash-protection-probe-interval
14036 Stack clash protection involves probing stack space as it is allocated. This
14037 param controls the maximum distance between probes into the stack as 2 raised
14038 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
14039 larger than the operating system provided guard will leave code vulnerable to
14040 stack clash style attacks.
14041
14042 @item max-cse-path-length
14043
14044 The maximum number of basic blocks on path that CSE considers.
14045
14046 @item max-cse-insns
14047 The maximum number of instructions CSE processes before flushing.
14048
14049 @item ggc-min-expand
14050
14051 GCC uses a garbage collector to manage its own memory allocation. This
14052 parameter specifies the minimum percentage by which the garbage
14053 collector's heap should be allowed to expand between collections.
14054 Tuning this may improve compilation speed; it has no effect on code
14055 generation.
14056
14057 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
14058 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
14059 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
14060 GCC is not able to calculate RAM on a particular platform, the lower
14061 bound of 30% is used. Setting this parameter and
14062 @option{ggc-min-heapsize} to zero causes a full collection to occur at
14063 every opportunity. This is extremely slow, but can be useful for
14064 debugging.
14065
14066 @item ggc-min-heapsize
14067
14068 Minimum size of the garbage collector's heap before it begins bothering
14069 to collect garbage. The first collection occurs after the heap expands
14070 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
14071 tuning this may improve compilation speed, and has no effect on code
14072 generation.
14073
14074 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
14075 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
14076 with a lower bound of 4096 (four megabytes) and an upper bound of
14077 131072 (128 megabytes). If GCC is not able to calculate RAM on a
14078 particular platform, the lower bound is used. Setting this parameter
14079 very large effectively disables garbage collection. Setting this
14080 parameter and @option{ggc-min-expand} to zero causes a full collection
14081 to occur at every opportunity.
14082
14083 @item max-reload-search-insns
14084 The maximum number of instruction reload should look backward for equivalent
14085 register. Increasing values mean more aggressive optimization, making the
14086 compilation time increase with probably slightly better performance.
14087
14088 @item max-cselib-memory-locations
14089 The maximum number of memory locations cselib should take into account.
14090 Increasing values mean more aggressive optimization, making the compilation time
14091 increase with probably slightly better performance.
14092
14093 @item max-sched-ready-insns
14094 The maximum number of instructions ready to be issued the scheduler should
14095 consider at any given time during the first scheduling pass. Increasing
14096 values mean more thorough searches, making the compilation time increase
14097 with probably little benefit.
14098
14099 @item max-sched-region-blocks
14100 The maximum number of blocks in a region to be considered for
14101 interblock scheduling.
14102
14103 @item max-pipeline-region-blocks
14104 The maximum number of blocks in a region to be considered for
14105 pipelining in the selective scheduler.
14106
14107 @item max-sched-region-insns
14108 The maximum number of insns in a region to be considered for
14109 interblock scheduling.
14110
14111 @item max-pipeline-region-insns
14112 The maximum number of insns in a region to be considered for
14113 pipelining in the selective scheduler.
14114
14115 @item min-spec-prob
14116 The minimum probability (in percents) of reaching a source block
14117 for interblock speculative scheduling.
14118
14119 @item max-sched-extend-regions-iters
14120 The maximum number of iterations through CFG to extend regions.
14121 A value of 0 disables region extensions.
14122
14123 @item max-sched-insn-conflict-delay
14124 The maximum conflict delay for an insn to be considered for speculative motion.
14125
14126 @item sched-spec-prob-cutoff
14127 The minimal probability of speculation success (in percents), so that
14128 speculative insns are scheduled.
14129
14130 @item sched-state-edge-prob-cutoff
14131 The minimum probability an edge must have for the scheduler to save its
14132 state across it.
14133
14134 @item sched-mem-true-dep-cost
14135 Minimal distance (in CPU cycles) between store and load targeting same
14136 memory locations.
14137
14138 @item selsched-max-lookahead
14139 The maximum size of the lookahead window of selective scheduling. It is a
14140 depth of search for available instructions.
14141
14142 @item selsched-max-sched-times
14143 The maximum number of times that an instruction is scheduled during
14144 selective scheduling. This is the limit on the number of iterations
14145 through which the instruction may be pipelined.
14146
14147 @item selsched-insns-to-rename
14148 The maximum number of best instructions in the ready list that are considered
14149 for renaming in the selective scheduler.
14150
14151 @item sms-min-sc
14152 The minimum value of stage count that swing modulo scheduler
14153 generates.
14154
14155 @item max-last-value-rtl
14156 The maximum size measured as number of RTLs that can be recorded in an expression
14157 in combiner for a pseudo register as last known value of that register.
14158
14159 @item max-combine-insns
14160 The maximum number of instructions the RTL combiner tries to combine.
14161
14162 @item integer-share-limit
14163 Small integer constants can use a shared data structure, reducing the
14164 compiler's memory usage and increasing its speed. This sets the maximum
14165 value of a shared integer constant.
14166
14167 @item ssp-buffer-size
14168 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
14169 protection when @option{-fstack-protection} is used.
14170
14171 @item min-size-for-stack-sharing
14172 The minimum size of variables taking part in stack slot sharing when not
14173 optimizing.
14174
14175 @item max-jump-thread-duplication-stmts
14176 Maximum number of statements allowed in a block that needs to be
14177 duplicated when threading jumps.
14178
14179 @item max-fields-for-field-sensitive
14180 Maximum number of fields in a structure treated in
14181 a field sensitive manner during pointer analysis.
14182
14183 @item prefetch-latency
14184 Estimate on average number of instructions that are executed before
14185 prefetch finishes. The distance prefetched ahead is proportional
14186 to this constant. Increasing this number may also lead to less
14187 streams being prefetched (see @option{simultaneous-prefetches}).
14188
14189 @item simultaneous-prefetches
14190 Maximum number of prefetches that can run at the same time.
14191
14192 @item l1-cache-line-size
14193 The size of cache line in L1 data cache, in bytes.
14194
14195 @item l1-cache-size
14196 The size of L1 data cache, in kilobytes.
14197
14198 @item l2-cache-size
14199 The size of L2 data cache, in kilobytes.
14200
14201 @item prefetch-dynamic-strides
14202 Whether the loop array prefetch pass should issue software prefetch hints
14203 for strides that are non-constant. In some cases this may be
14204 beneficial, though the fact the stride is non-constant may make it
14205 hard to predict when there is clear benefit to issuing these hints.
14206
14207 Set to 1 if the prefetch hints should be issued for non-constant
14208 strides. Set to 0 if prefetch hints should be issued only for strides that
14209 are known to be constant and below @option{prefetch-minimum-stride}.
14210
14211 @item prefetch-minimum-stride
14212 Minimum constant stride, in bytes, to start using prefetch hints for. If
14213 the stride is less than this threshold, prefetch hints will not be issued.
14214
14215 This setting is useful for processors that have hardware prefetchers, in
14216 which case there may be conflicts between the hardware prefetchers and
14217 the software prefetchers. If the hardware prefetchers have a maximum
14218 stride they can handle, it should be used here to improve the use of
14219 software prefetchers.
14220
14221 A value of -1 means we don't have a threshold and therefore
14222 prefetch hints can be issued for any constant stride.
14223
14224 This setting is only useful for strides that are known and constant.
14225
14226 @item destructive-interference-size
14227 @item constructive-interference-size
14228 The values for the C++17 variables
14229 @code{std::hardware_destructive_interference_size} and
14230 @code{std::hardware_constructive_interference_size}. The destructive
14231 interference size is the minimum recommended offset between two
14232 independent concurrently-accessed objects; the constructive
14233 interference size is the maximum recommended size of contiguous memory
14234 accessed together. Typically both will be the size of an L1 cache
14235 line for the target, in bytes. For a generic target covering a range of L1
14236 cache line sizes, typically the constructive interference size will be
14237 the small end of the range and the destructive size will be the large
14238 end.
14239
14240 The destructive interference size is intended to be used for layout,
14241 and thus has ABI impact. The default value is not expected to be
14242 stable, and on some targets varies with @option{-mtune}, so use of
14243 this variable in a context where ABI stability is important, such as
14244 the public interface of a library, is strongly discouraged; if it is
14245 used in that context, users can stabilize the value using this
14246 option.
14247
14248 The constructive interference size is less sensitive, as it is
14249 typically only used in a @samp{static_assert} to make sure that a type
14250 fits within a cache line.
14251
14252 See also @option{-Winterference-size}.
14253
14254 @item loop-interchange-max-num-stmts
14255 The maximum number of stmts in a loop to be interchanged.
14256
14257 @item loop-interchange-stride-ratio
14258 The minimum ratio between stride of two loops for interchange to be profitable.
14259
14260 @item min-insn-to-prefetch-ratio
14261 The minimum ratio between the number of instructions and the
14262 number of prefetches to enable prefetching in a loop.
14263
14264 @item prefetch-min-insn-to-mem-ratio
14265 The minimum ratio between the number of instructions and the
14266 number of memory references to enable prefetching in a loop.
14267
14268 @item use-canonical-types
14269 Whether the compiler should use the ``canonical'' type system.
14270 Should always be 1, which uses a more efficient internal
14271 mechanism for comparing types in C++ and Objective-C++. However, if
14272 bugs in the canonical type system are causing compilation failures,
14273 set this value to 0 to disable canonical types.
14274
14275 @item switch-conversion-max-branch-ratio
14276 Switch initialization conversion refuses to create arrays that are
14277 bigger than @option{switch-conversion-max-branch-ratio} times the number of
14278 branches in the switch.
14279
14280 @item max-partial-antic-length
14281 Maximum length of the partial antic set computed during the tree
14282 partial redundancy elimination optimization (@option{-ftree-pre}) when
14283 optimizing at @option{-O3} and above. For some sorts of source code
14284 the enhanced partial redundancy elimination optimization can run away,
14285 consuming all of the memory available on the host machine. This
14286 parameter sets a limit on the length of the sets that are computed,
14287 which prevents the runaway behavior. Setting a value of 0 for
14288 this parameter allows an unlimited set length.
14289
14290 @item rpo-vn-max-loop-depth
14291 Maximum loop depth that is value-numbered optimistically.
14292 When the limit hits the innermost
14293 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
14294 loop nest are value-numbered optimistically and the remaining ones not.
14295
14296 @item sccvn-max-alias-queries-per-access
14297 Maximum number of alias-oracle queries we perform when looking for
14298 redundancies for loads and stores. If this limit is hit the search
14299 is aborted and the load or store is not considered redundant. The
14300 number of queries is algorithmically limited to the number of
14301 stores on all paths from the load to the function entry.
14302
14303 @item ira-max-loops-num
14304 IRA uses regional register allocation by default. If a function
14305 contains more loops than the number given by this parameter, only at most
14306 the given number of the most frequently-executed loops form regions
14307 for regional register allocation.
14308
14309 @item ira-max-conflict-table-size
14310 Although IRA uses a sophisticated algorithm to compress the conflict
14311 table, the table can still require excessive amounts of memory for
14312 huge functions. If the conflict table for a function could be more
14313 than the size in MB given by this parameter, the register allocator
14314 instead uses a faster, simpler, and lower-quality
14315 algorithm that does not require building a pseudo-register conflict table.
14316
14317 @item ira-loop-reserved-regs
14318 IRA can be used to evaluate more accurate register pressure in loops
14319 for decisions to move loop invariants (see @option{-O3}). The number
14320 of available registers reserved for some other purposes is given
14321 by this parameter. Default of the parameter
14322 is the best found from numerous experiments.
14323
14324 @item ira-consider-dup-in-all-alts
14325 Make IRA to consider matching constraint (duplicated operand number)
14326 heavily in all available alternatives for preferred register class.
14327 If it is set as zero, it means IRA only respects the matching
14328 constraint when it's in the only available alternative with an
14329 appropriate register class. Otherwise, it means IRA will check all
14330 available alternatives for preferred register class even if it has
14331 found some choice with an appropriate register class and respect the
14332 found qualified matching constraint.
14333
14334 @item lra-inheritance-ebb-probability-cutoff
14335 LRA tries to reuse values reloaded in registers in subsequent insns.
14336 This optimization is called inheritance. EBB is used as a region to
14337 do this optimization. The parameter defines a minimal fall-through
14338 edge probability in percentage used to add BB to inheritance EBB in
14339 LRA. The default value was chosen
14340 from numerous runs of SPEC2000 on x86-64.
14341
14342 @item loop-invariant-max-bbs-in-loop
14343 Loop invariant motion can be very expensive, both in compilation time and
14344 in amount of needed compile-time memory, with very large loops. Loops
14345 with more basic blocks than this parameter won't have loop invariant
14346 motion optimization performed on them.
14347
14348 @item loop-max-datarefs-for-datadeps
14349 Building data dependencies is expensive for very large loops. This
14350 parameter limits the number of data references in loops that are
14351 considered for data dependence analysis. These large loops are no
14352 handled by the optimizations using loop data dependencies.
14353
14354 @item max-vartrack-size
14355 Sets a maximum number of hash table slots to use during variable
14356 tracking dataflow analysis of any function. If this limit is exceeded
14357 with variable tracking at assignments enabled, analysis for that
14358 function is retried without it, after removing all debug insns from
14359 the function. If the limit is exceeded even without debug insns, var
14360 tracking analysis is completely disabled for the function. Setting
14361 the parameter to zero makes it unlimited.
14362
14363 @item max-vartrack-expr-depth
14364 Sets a maximum number of recursion levels when attempting to map
14365 variable names or debug temporaries to value expressions. This trades
14366 compilation time for more complete debug information. If this is set too
14367 low, value expressions that are available and could be represented in
14368 debug information may end up not being used; setting this higher may
14369 enable the compiler to find more complex debug expressions, but compile
14370 time and memory use may grow.
14371
14372 @item max-debug-marker-count
14373 Sets a threshold on the number of debug markers (e.g.@: begin stmt
14374 markers) to avoid complexity explosion at inlining or expanding to RTL.
14375 If a function has more such gimple stmts than the set limit, such stmts
14376 will be dropped from the inlined copy of a function, and from its RTL
14377 expansion.
14378
14379 @item min-nondebug-insn-uid
14380 Use uids starting at this parameter for nondebug insns. The range below
14381 the parameter is reserved exclusively for debug insns created by
14382 @option{-fvar-tracking-assignments}, but debug insns may get
14383 (non-overlapping) uids above it if the reserved range is exhausted.
14384
14385 @item ipa-sra-ptr-growth-factor
14386 IPA-SRA replaces a pointer to an aggregate with one or more new
14387 parameters only when their cumulative size is less or equal to
14388 @option{ipa-sra-ptr-growth-factor} times the size of the original
14389 pointer parameter.
14390
14391 @item ipa-sra-max-replacements
14392 Maximum pieces of an aggregate that IPA-SRA tracks. As a
14393 consequence, it is also the maximum number of replacements of a formal
14394 parameter.
14395
14396 @item sra-max-scalarization-size-Ospeed
14397 @itemx sra-max-scalarization-size-Osize
14398 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
14399 replace scalar parts of aggregates with uses of independent scalar
14400 variables. These parameters control the maximum size, in storage units,
14401 of aggregate which is considered for replacement when compiling for
14402 speed
14403 (@option{sra-max-scalarization-size-Ospeed}) or size
14404 (@option{sra-max-scalarization-size-Osize}) respectively.
14405
14406 @item sra-max-propagations
14407 The maximum number of artificial accesses that Scalar Replacement of
14408 Aggregates (SRA) will track, per one local variable, in order to
14409 facilitate copy propagation.
14410
14411 @item tm-max-aggregate-size
14412 When making copies of thread-local variables in a transaction, this
14413 parameter specifies the size in bytes after which variables are
14414 saved with the logging functions as opposed to save/restore code
14415 sequence pairs. This option only applies when using
14416 @option{-fgnu-tm}.
14417
14418 @item graphite-max-nb-scop-params
14419 To avoid exponential effects in the Graphite loop transforms, the
14420 number of parameters in a Static Control Part (SCoP) is bounded.
14421 A value of zero can be used to lift
14422 the bound. A variable whose value is unknown at compilation time and
14423 defined outside a SCoP is a parameter of the SCoP.
14424
14425 @item loop-block-tile-size
14426 Loop blocking or strip mining transforms, enabled with
14427 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
14428 loop in the loop nest by a given number of iterations. The strip
14429 length can be changed using the @option{loop-block-tile-size}
14430 parameter.
14431
14432 @item ipa-jump-function-lookups
14433 Specifies number of statements visited during jump function offset discovery.
14434
14435 @item ipa-cp-value-list-size
14436 IPA-CP attempts to track all possible values and types passed to a function's
14437 parameter in order to propagate them and perform devirtualization.
14438 @option{ipa-cp-value-list-size} is the maximum number of values and types it
14439 stores per one formal parameter of a function.
14440
14441 @item ipa-cp-eval-threshold
14442 IPA-CP calculates its own score of cloning profitability heuristics
14443 and performs those cloning opportunities with scores that exceed
14444 @option{ipa-cp-eval-threshold}.
14445
14446 @item ipa-cp-max-recursive-depth
14447 Maximum depth of recursive cloning for self-recursive function.
14448
14449 @item ipa-cp-min-recursive-probability
14450 Recursive cloning only when the probability of call being executed exceeds
14451 the parameter.
14452
14453 @item ipa-cp-profile-count-base
14454 When using @option{-fprofile-use} option, IPA-CP will consider the measured
14455 execution count of a call graph edge at this percentage position in their
14456 histogram as the basis for its heuristics calculation.
14457
14458 @item ipa-cp-recursive-freq-factor
14459 The number of times interprocedural copy propagation expects recursive
14460 functions to call themselves.
14461
14462 @item ipa-cp-recursion-penalty
14463 Percentage penalty the recursive functions will receive when they
14464 are evaluated for cloning.
14465
14466 @item ipa-cp-single-call-penalty
14467 Percentage penalty functions containing a single call to another
14468 function will receive when they are evaluated for cloning.
14469
14470 @item ipa-max-agg-items
14471 IPA-CP is also capable to propagate a number of scalar values passed
14472 in an aggregate. @option{ipa-max-agg-items} controls the maximum
14473 number of such values per one parameter.
14474
14475 @item ipa-cp-loop-hint-bonus
14476 When IPA-CP determines that a cloning candidate would make the number
14477 of iterations of a loop known, it adds a bonus of
14478 @option{ipa-cp-loop-hint-bonus} to the profitability score of
14479 the candidate.
14480
14481 @item ipa-max-loop-predicates
14482 The maximum number of different predicates IPA will use to describe when
14483 loops in a function have known properties.
14484
14485 @item ipa-max-aa-steps
14486 During its analysis of function bodies, IPA-CP employs alias analysis
14487 in order to track values pointed to by function parameters. In order
14488 not spend too much time analyzing huge functions, it gives up and
14489 consider all memory clobbered after examining
14490 @option{ipa-max-aa-steps} statements modifying memory.
14491
14492 @item ipa-max-switch-predicate-bounds
14493 Maximal number of boundary endpoints of case ranges of switch statement.
14494 For switch exceeding this limit, IPA-CP will not construct cloning cost
14495 predicate, which is used to estimate cloning benefit, for default case
14496 of the switch statement.
14497
14498 @item ipa-max-param-expr-ops
14499 IPA-CP will analyze conditional statement that references some function
14500 parameter to estimate benefit for cloning upon certain constant value.
14501 But if number of operations in a parameter expression exceeds
14502 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
14503 one, and is not handled by IPA analysis.
14504
14505 @item lto-partitions
14506 Specify desired number of partitions produced during WHOPR compilation.
14507 The number of partitions should exceed the number of CPUs used for compilation.
14508
14509 @item lto-min-partition
14510 Size of minimal partition for WHOPR (in estimated instructions).
14511 This prevents expenses of splitting very small programs into too many
14512 partitions.
14513
14514 @item lto-max-partition
14515 Size of max partition for WHOPR (in estimated instructions).
14516 to provide an upper bound for individual size of partition.
14517 Meant to be used only with balanced partitioning.
14518
14519 @item lto-max-streaming-parallelism
14520 Maximal number of parallel processes used for LTO streaming.
14521
14522 @item cxx-max-namespaces-for-diagnostic-help
14523 The maximum number of namespaces to consult for suggestions when C++
14524 name lookup fails for an identifier.
14525
14526 @item sink-frequency-threshold
14527 The maximum relative execution frequency (in percents) of the target block
14528 relative to a statement's original block to allow statement sinking of a
14529 statement. Larger numbers result in more aggressive statement sinking.
14530 A small positive adjustment is applied for
14531 statements with memory operands as those are even more profitable so sink.
14532
14533 @item max-stores-to-sink
14534 The maximum number of conditional store pairs that can be sunk. Set to 0
14535 if either vectorization (@option{-ftree-vectorize}) or if-conversion
14536 (@option{-ftree-loop-if-convert}) is disabled.
14537
14538 @item case-values-threshold
14539 The smallest number of different values for which it is best to use a
14540 jump-table instead of a tree of conditional branches. If the value is
14541 0, use the default for the machine.
14542
14543 @item jump-table-max-growth-ratio-for-size
14544 The maximum code size growth ratio when expanding
14545 into a jump table (in percent). The parameter is used when
14546 optimizing for size.
14547
14548 @item jump-table-max-growth-ratio-for-speed
14549 The maximum code size growth ratio when expanding
14550 into a jump table (in percent). The parameter is used when
14551 optimizing for speed.
14552
14553 @item tree-reassoc-width
14554 Set the maximum number of instructions executed in parallel in
14555 reassociated tree. This parameter overrides target dependent
14556 heuristics used by default if has non zero value.
14557
14558 @item sched-pressure-algorithm
14559 Choose between the two available implementations of
14560 @option{-fsched-pressure}. Algorithm 1 is the original implementation
14561 and is the more likely to prevent instructions from being reordered.
14562 Algorithm 2 was designed to be a compromise between the relatively
14563 conservative approach taken by algorithm 1 and the rather aggressive
14564 approach taken by the default scheduler. It relies more heavily on
14565 having a regular register file and accurate register pressure classes.
14566 See @file{haifa-sched.c} in the GCC sources for more details.
14567
14568 The default choice depends on the target.
14569
14570 @item max-slsr-cand-scan
14571 Set the maximum number of existing candidates that are considered when
14572 seeking a basis for a new straight-line strength reduction candidate.
14573
14574 @item asan-globals
14575 Enable buffer overflow detection for global objects. This kind
14576 of protection is enabled by default if you are using
14577 @option{-fsanitize=address} option.
14578 To disable global objects protection use @option{--param asan-globals=0}.
14579
14580 @item asan-stack
14581 Enable buffer overflow detection for stack objects. This kind of
14582 protection is enabled by default when using @option{-fsanitize=address}.
14583 To disable stack protection use @option{--param asan-stack=0} option.
14584
14585 @item asan-instrument-reads
14586 Enable buffer overflow detection for memory reads. This kind of
14587 protection is enabled by default when using @option{-fsanitize=address}.
14588 To disable memory reads protection use
14589 @option{--param asan-instrument-reads=0}.
14590
14591 @item asan-instrument-writes
14592 Enable buffer overflow detection for memory writes. This kind of
14593 protection is enabled by default when using @option{-fsanitize=address}.
14594 To disable memory writes protection use
14595 @option{--param asan-instrument-writes=0} option.
14596
14597 @item asan-memintrin
14598 Enable detection for built-in functions. This kind of protection
14599 is enabled by default when using @option{-fsanitize=address}.
14600 To disable built-in functions protection use
14601 @option{--param asan-memintrin=0}.
14602
14603 @item asan-use-after-return
14604 Enable detection of use-after-return. This kind of protection
14605 is enabled by default when using the @option{-fsanitize=address} option.
14606 To disable it use @option{--param asan-use-after-return=0}.
14607
14608 Note: By default the check is disabled at run time. To enable it,
14609 add @code{detect_stack_use_after_return=1} to the environment variable
14610 @env{ASAN_OPTIONS}.
14611
14612 @item asan-instrumentation-with-call-threshold
14613 If number of memory accesses in function being instrumented
14614 is greater or equal to this number, use callbacks instead of inline checks.
14615 E.g. to disable inline code use
14616 @option{--param asan-instrumentation-with-call-threshold=0}.
14617
14618 @item hwasan-instrument-stack
14619 Enable hwasan instrumentation of statically sized stack-allocated variables.
14620 This kind of instrumentation is enabled by default when using
14621 @option{-fsanitize=hwaddress} and disabled by default when using
14622 @option{-fsanitize=kernel-hwaddress}.
14623 To disable stack instrumentation use
14624 @option{--param hwasan-instrument-stack=0}, and to enable it use
14625 @option{--param hwasan-instrument-stack=1}.
14626
14627 @item hwasan-random-frame-tag
14628 When using stack instrumentation, decide tags for stack variables using a
14629 deterministic sequence beginning at a random tag for each frame. With this
14630 parameter unset tags are chosen using the same sequence but beginning from 1.
14631 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
14632 for @option{-fsanitize=kernel-hwaddress}.
14633 To disable it use @option{--param hwasan-random-frame-tag=0}.
14634
14635 @item hwasan-instrument-allocas
14636 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
14637 This kind of instrumentation is enabled by default when using
14638 @option{-fsanitize=hwaddress} and disabled by default when using
14639 @option{-fsanitize=kernel-hwaddress}.
14640 To disable instrumentation of such variables use
14641 @option{--param hwasan-instrument-allocas=0}, and to enable it use
14642 @option{--param hwasan-instrument-allocas=1}.
14643
14644 @item hwasan-instrument-reads
14645 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
14646 default for both @option{-fsanitize=hwaddress} and
14647 @option{-fsanitize=kernel-hwaddress}.
14648 To disable checking memory reads use
14649 @option{--param hwasan-instrument-reads=0}.
14650
14651 @item hwasan-instrument-writes
14652 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
14653 default for both @option{-fsanitize=hwaddress} and
14654 @option{-fsanitize=kernel-hwaddress}.
14655 To disable checking memory writes use
14656 @option{--param hwasan-instrument-writes=0}.
14657
14658 @item hwasan-instrument-mem-intrinsics
14659 Enable hwasan instrumentation of builtin functions. Instrumentation of these
14660 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
14661 and @option{-fsanitize=kernel-hwaddress}.
14662 To disable instrumentation of builtin functions use
14663 @option{--param hwasan-instrument-mem-intrinsics=0}.
14664
14665 @item use-after-scope-direct-emission-threshold
14666 If the size of a local variable in bytes is smaller or equal to this
14667 number, directly poison (or unpoison) shadow memory instead of using
14668 run-time callbacks.
14669
14670 @item tsan-distinguish-volatile
14671 Emit special instrumentation for accesses to volatiles.
14672
14673 @item tsan-instrument-func-entry-exit
14674 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
14675
14676 @item max-fsm-thread-path-insns
14677 Maximum number of instructions to copy when duplicating blocks on a
14678 finite state automaton jump thread path.
14679
14680 @item max-fsm-thread-length
14681 Maximum number of basic blocks on a jump thread path.
14682
14683 @item threader-debug
14684 threader-debug=[none|all] Enables verbose dumping of the threader solver.
14685
14686 @item parloops-chunk-size
14687 Chunk size of omp schedule for loops parallelized by parloops.
14688
14689 @item parloops-schedule
14690 Schedule type of omp schedule for loops parallelized by parloops (static,
14691 dynamic, guided, auto, runtime).
14692
14693 @item parloops-min-per-thread
14694 The minimum number of iterations per thread of an innermost parallelized
14695 loop for which the parallelized variant is preferred over the single threaded
14696 one. Note that for a parallelized loop nest the
14697 minimum number of iterations of the outermost loop per thread is two.
14698
14699 @item max-ssa-name-query-depth
14700 Maximum depth of recursion when querying properties of SSA names in things
14701 like fold routines. One level of recursion corresponds to following a
14702 use-def chain.
14703
14704 @item max-speculative-devirt-maydefs
14705 The maximum number of may-defs we analyze when looking for a must-def
14706 specifying the dynamic type of an object that invokes a virtual call
14707 we may be able to devirtualize speculatively.
14708
14709 @item max-vrp-switch-assertions
14710 The maximum number of assertions to add along the default edge of a switch
14711 statement during VRP.
14712
14713 @item evrp-sparse-threshold
14714 Maximum number of basic blocks before EVRP uses a sparse cache.
14715
14716 @item evrp-mode
14717 Specifies the mode Early VRP should operate in.
14718
14719 @item vrp1-mode
14720 Specifies the mode VRP pass 1 should operate in.
14721
14722 @item vrp2-mode
14723 Specifies the mode VRP pass 2 should operate in.
14724
14725 @item ranger-debug
14726 Specifies the type of debug output to be issued for ranges.
14727
14728 @item evrp-switch-limit
14729 Specifies the maximum number of switch cases before EVRP ignores a switch.
14730
14731 @item unroll-jam-min-percent
14732 The minimum percentage of memory references that must be optimized
14733 away for the unroll-and-jam transformation to be considered profitable.
14734
14735 @item unroll-jam-max-unroll
14736 The maximum number of times the outer loop should be unrolled by
14737 the unroll-and-jam transformation.
14738
14739 @item max-rtl-if-conversion-unpredictable-cost
14740 Maximum permissible cost for the sequence that would be generated
14741 by the RTL if-conversion pass for a branch that is considered unpredictable.
14742
14743 @item max-variable-expansions-in-unroller
14744 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
14745 of times that an individual variable will be expanded during loop unrolling.
14746
14747 @item partial-inlining-entry-probability
14748 Maximum probability of the entry BB of split region
14749 (in percent relative to entry BB of the function)
14750 to make partial inlining happen.
14751
14752 @item max-tracked-strlens
14753 Maximum number of strings for which strlen optimization pass will
14754 track string lengths.
14755
14756 @item gcse-after-reload-partial-fraction
14757 The threshold ratio for performing partial redundancy
14758 elimination after reload.
14759
14760 @item gcse-after-reload-critical-fraction
14761 The threshold ratio of critical edges execution count that
14762 permit performing redundancy elimination after reload.
14763
14764 @item max-loop-header-insns
14765 The maximum number of insns in loop header duplicated
14766 by the copy loop headers pass.
14767
14768 @item vect-epilogues-nomask
14769 Enable loop epilogue vectorization using smaller vector size.
14770
14771 @item vect-partial-vector-usage
14772 Controls when the loop vectorizer considers using partial vector loads
14773 and stores as an alternative to falling back to scalar code. 0 stops
14774 the vectorizer from ever using partial vector loads and stores. 1 allows
14775 partial vector loads and stores if vectorization removes the need for the
14776 code to iterate. 2 allows partial vector loads and stores in all loops.
14777 The parameter only has an effect on targets that support partial
14778 vector loads and stores.
14779
14780 @item vect-inner-loop-cost-factor
14781 The maximum factor which the loop vectorizer applies to the cost of statements
14782 in an inner loop relative to the loop being vectorized. The factor applied
14783 is the maximum of the estimated number of iterations of the inner loop and
14784 this parameter. The default value of this parameter is 50.
14785
14786 @item avoid-fma-max-bits
14787 Maximum number of bits for which we avoid creating FMAs.
14788
14789 @item sms-loop-average-count-threshold
14790 A threshold on the average loop count considered by the swing modulo scheduler.
14791
14792 @item sms-dfa-history
14793 The number of cycles the swing modulo scheduler considers when checking
14794 conflicts using DFA.
14795
14796 @item graphite-allow-codegen-errors
14797 Whether codegen errors should be ICEs when @option{-fchecking}.
14798
14799 @item sms-max-ii-factor
14800 A factor for tuning the upper bound that swing modulo scheduler
14801 uses for scheduling a loop.
14802
14803 @item lra-max-considered-reload-pseudos
14804 The max number of reload pseudos which are considered during
14805 spilling a non-reload pseudo.
14806
14807 @item max-pow-sqrt-depth
14808 Maximum depth of sqrt chains to use when synthesizing exponentiation
14809 by a real constant.
14810
14811 @item max-dse-active-local-stores
14812 Maximum number of active local stores in RTL dead store elimination.
14813
14814 @item asan-instrument-allocas
14815 Enable asan allocas/VLAs protection.
14816
14817 @item max-iterations-computation-cost
14818 Bound on the cost of an expression to compute the number of iterations.
14819
14820 @item max-isl-operations
14821 Maximum number of isl operations, 0 means unlimited.
14822
14823 @item graphite-max-arrays-per-scop
14824 Maximum number of arrays per scop.
14825
14826 @item max-vartrack-reverse-op-size
14827 Max. size of loc list for which reverse ops should be added.
14828
14829 @item fsm-scale-path-stmts
14830 Scale factor to apply to the number of statements in a threading path
14831 when comparing to the number of (scaled) blocks.
14832
14833 @item uninit-control-dep-attempts
14834 Maximum number of nested calls to search for control dependencies
14835 during uninitialized variable analysis.
14836
14837 @item fsm-scale-path-blocks
14838 Scale factor to apply to the number of blocks in a threading path
14839 when comparing to the number of (scaled) statements.
14840
14841 @item sched-autopref-queue-depth
14842 Hardware autoprefetcher scheduler model control flag.
14843 Number of lookahead cycles the model looks into; at '
14844 ' only enable instruction sorting heuristic.
14845
14846 @item loop-versioning-max-inner-insns
14847 The maximum number of instructions that an inner loop can have
14848 before the loop versioning pass considers it too big to copy.
14849
14850 @item loop-versioning-max-outer-insns
14851 The maximum number of instructions that an outer loop can have
14852 before the loop versioning pass considers it too big to copy,
14853 discounting any instructions in inner loops that directly benefit
14854 from versioning.
14855
14856 @item ssa-name-def-chain-limit
14857 The maximum number of SSA_NAME assignments to follow in determining
14858 a property of a variable such as its value. This limits the number
14859 of iterations or recursive calls GCC performs when optimizing certain
14860 statements or when determining their validity prior to issuing
14861 diagnostics.
14862
14863 @item store-merging-max-size
14864 Maximum size of a single store merging region in bytes.
14865
14866 @item hash-table-verification-limit
14867 The number of elements for which hash table verification is done
14868 for each searched element.
14869
14870 @item max-find-base-term-values
14871 Maximum number of VALUEs handled during a single find_base_term call.
14872
14873 @item analyzer-max-enodes-per-program-point
14874 The maximum number of exploded nodes per program point within
14875 the analyzer, before terminating analysis of that point.
14876
14877 @item analyzer-max-constraints
14878 The maximum number of constraints per state.
14879
14880 @item analyzer-min-snodes-for-call-summary
14881 The minimum number of supernodes within a function for the
14882 analyzer to consider summarizing its effects at call sites.
14883
14884 @item analyzer-max-enodes-for-full-dump
14885 The maximum depth of exploded nodes that should appear in a dot dump
14886 before switching to a less verbose format.
14887
14888 @item analyzer-max-recursion-depth
14889 The maximum number of times a callsite can appear in a call stack
14890 within the analyzer, before terminating analysis of a call that would
14891 recurse deeper.
14892
14893 @item analyzer-max-svalue-depth
14894 The maximum depth of a symbolic value, before approximating
14895 the value as unknown.
14896
14897 @item analyzer-max-infeasible-edges
14898 The maximum number of infeasible edges to reject before declaring
14899 a diagnostic as infeasible.
14900
14901 @item gimple-fe-computed-hot-bb-threshold
14902 The number of executions of a basic block which is considered hot.
14903 The parameter is used only in GIMPLE FE.
14904
14905 @item analyzer-bb-explosion-factor
14906 The maximum number of 'after supernode' exploded nodes within the analyzer
14907 per supernode, before terminating analysis.
14908
14909 @item ranger-logical-depth
14910 Maximum depth of logical expression evaluation ranger will look through
14911 when evaluating outgoing edge ranges.
14912
14913 @item openacc-kernels
14914 Specify mode of OpenACC `kernels' constructs handling.
14915 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
14916 constructs are decomposed into parts, a sequence of compute
14917 constructs, each then handled individually.
14918 This is work in progress.
14919 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
14920 constructs are handled by the @samp{parloops} pass, en bloc.
14921 This is the current default.
14922
14923 @item openacc-privatization
14924 Specify mode of OpenACC privatization diagnostics for
14925 @option{-fopt-info-omp-note} and applicable
14926 @option{-fdump-tree-*-details}.
14927 With @option{--param=openacc-privatization=quiet}, don't diagnose.
14928 This is the current default.
14929 With @option{--param=openacc-privatization=noisy}, do diagnose.
14930
14931 @end table
14932
14933 The following choices of @var{name} are available on AArch64 targets:
14934
14935 @table @gcctabopt
14936 @item aarch64-sve-compare-costs
14937 When vectorizing for SVE, consider using ``unpacked'' vectors for
14938 smaller elements and use the cost model to pick the cheapest approach.
14939 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
14940
14941 Using unpacked vectors includes storing smaller elements in larger
14942 containers and accessing elements with extending loads and truncating
14943 stores.
14944
14945 @item aarch64-float-recp-precision
14946 The number of Newton iterations for calculating the reciprocal for float type.
14947 The precision of division is proportional to this param when division
14948 approximation is enabled. The default value is 1.
14949
14950 @item aarch64-double-recp-precision
14951 The number of Newton iterations for calculating the reciprocal for double type.
14952 The precision of division is propotional to this param when division
14953 approximation is enabled. The default value is 2.
14954
14955 @item aarch64-autovec-preference
14956 Force an ISA selection strategy for auto-vectorization. Accepts values from
14957 0 to 4, inclusive.
14958 @table @samp
14959 @item 0
14960 Use the default heuristics.
14961 @item 1
14962 Use only Advanced SIMD for auto-vectorization.
14963 @item 2
14964 Use only SVE for auto-vectorization.
14965 @item 3
14966 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
14967 deemed equal.
14968 @item 4
14969 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
14970 @end table
14971 The default value is 0.
14972
14973 @item aarch64-loop-vect-issue-rate-niters
14974 The tuning for some AArch64 CPUs tries to take both latencies and issue
14975 rates into account when deciding whether a loop should be vectorized
14976 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
14977 If this parameter is set to @var{n}, GCC will not use this heuristic
14978 for loops that are known to execute in fewer than @var{n} Advanced
14979 SIMD iterations.
14980
14981 @end table
14982
14983 @end table
14984
14985 @node Instrumentation Options
14986 @section Program Instrumentation Options
14987 @cindex instrumentation options
14988 @cindex program instrumentation options
14989 @cindex run-time error checking options
14990 @cindex profiling options
14991 @cindex options, program instrumentation
14992 @cindex options, run-time error checking
14993 @cindex options, profiling
14994
14995 GCC supports a number of command-line options that control adding
14996 run-time instrumentation to the code it normally generates.
14997 For example, one purpose of instrumentation is collect profiling
14998 statistics for use in finding program hot spots, code coverage
14999 analysis, or profile-guided optimizations.
15000 Another class of program instrumentation is adding run-time checking
15001 to detect programming errors like invalid pointer
15002 dereferences or out-of-bounds array accesses, as well as deliberately
15003 hostile attacks such as stack smashing or C++ vtable hijacking.
15004 There is also a general hook which can be used to implement other
15005 forms of tracing or function-level instrumentation for debug or
15006 program analysis purposes.
15007
15008 @table @gcctabopt
15009 @cindex @command{prof}
15010 @cindex @command{gprof}
15011 @item -p
15012 @itemx -pg
15013 @opindex p
15014 @opindex pg
15015 Generate extra code to write profile information suitable for the
15016 analysis program @command{prof} (for @option{-p}) or @command{gprof}
15017 (for @option{-pg}). You must use this option when compiling
15018 the source files you want data about, and you must also use it when
15019 linking.
15020
15021 You can use the function attribute @code{no_instrument_function} to
15022 suppress profiling of individual functions when compiling with these options.
15023 @xref{Common Function Attributes}.
15024
15025 @item -fprofile-arcs
15026 @opindex fprofile-arcs
15027 Add code so that program flow @dfn{arcs} are instrumented. During
15028 execution the program records how many times each branch and call is
15029 executed and how many times it is taken or returns. On targets that support
15030 constructors with priority support, profiling properly handles constructors,
15031 destructors and C++ constructors (and destructors) of classes which are used
15032 as a type of a global variable.
15033
15034 When the compiled
15035 program exits it saves this data to a file called
15036 @file{@var{auxname}.gcda} for each source file. The data may be used for
15037 profile-directed optimizations (@option{-fbranch-probabilities}), or for
15038 test coverage analysis (@option{-ftest-coverage}). Each object file's
15039 @var{auxname} is generated from the name of the output file, if
15040 explicitly specified and it is not the final executable, otherwise it is
15041 the basename of the source file. In both cases any suffix is removed
15042 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
15043 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
15044 @xref{Cross-profiling}.
15045
15046 @cindex @command{gcov}
15047 @item --coverage
15048 @opindex coverage
15049
15050 This option is used to compile and link code instrumented for coverage
15051 analysis. The option is a synonym for @option{-fprofile-arcs}
15052 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
15053 linking). See the documentation for those options for more details.
15054
15055 @itemize
15056
15057 @item
15058 Compile the source files with @option{-fprofile-arcs} plus optimization
15059 and code generation options. For test coverage analysis, use the
15060 additional @option{-ftest-coverage} option. You do not need to profile
15061 every source file in a program.
15062
15063 @item
15064 Compile the source files additionally with @option{-fprofile-abs-path}
15065 to create absolute path names in the @file{.gcno} files. This allows
15066 @command{gcov} to find the correct sources in projects where compilations
15067 occur with different working directories.
15068
15069 @item
15070 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
15071 (the latter implies the former).
15072
15073 @item
15074 Run the program on a representative workload to generate the arc profile
15075 information. This may be repeated any number of times. You can run
15076 concurrent instances of your program, and provided that the file system
15077 supports locking, the data files will be correctly updated. Unless
15078 a strict ISO C dialect option is in effect, @code{fork} calls are
15079 detected and correctly handled without double counting.
15080
15081 Moreover, an object file can be recompiled multiple times
15082 and the corresponding @file{.gcda} file merges as long as
15083 the source file and the compiler options are unchanged.
15084
15085 @item
15086 For profile-directed optimizations, compile the source files again with
15087 the same optimization and code generation options plus
15088 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
15089 Control Optimization}).
15090
15091 @item
15092 For test coverage analysis, use @command{gcov} to produce human readable
15093 information from the @file{.gcno} and @file{.gcda} files. Refer to the
15094 @command{gcov} documentation for further information.
15095
15096 @end itemize
15097
15098 With @option{-fprofile-arcs}, for each function of your program GCC
15099 creates a program flow graph, then finds a spanning tree for the graph.
15100 Only arcs that are not on the spanning tree have to be instrumented: the
15101 compiler adds code to count the number of times that these arcs are
15102 executed. When an arc is the only exit or only entrance to a block, the
15103 instrumentation code can be added to the block; otherwise, a new basic
15104 block must be created to hold the instrumentation code.
15105
15106 @need 2000
15107 @item -ftest-coverage
15108 @opindex ftest-coverage
15109 Produce a notes file that the @command{gcov} code-coverage utility
15110 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
15111 show program coverage. Each source file's note file is called
15112 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
15113 above for a description of @var{auxname} and instructions on how to
15114 generate test coverage data. Coverage data matches the source files
15115 more closely if you do not optimize.
15116
15117 @item -fprofile-abs-path
15118 @opindex fprofile-abs-path
15119 Automatically convert relative source file names to absolute path names
15120 in the @file{.gcno} files. This allows @command{gcov} to find the correct
15121 sources in projects where compilations occur with different working
15122 directories.
15123
15124 @item -fprofile-dir=@var{path}
15125 @opindex fprofile-dir
15126
15127 Set the directory to search for the profile data files in to @var{path}.
15128 This option affects only the profile data generated by
15129 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
15130 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
15131 and its related options. Both absolute and relative paths can be used.
15132 By default, GCC uses the current directory as @var{path}, thus the
15133 profile data file appears in the same directory as the object file.
15134 In order to prevent the file name clashing, if the object file name is
15135 not an absolute path, we mangle the absolute path of the
15136 @file{@var{sourcename}.gcda} file and use it as the file name of a
15137 @file{.gcda} file. See similar option @option{-fprofile-note}.
15138
15139 When an executable is run in a massive parallel environment, it is recommended
15140 to save profile to different folders. That can be done with variables
15141 in @var{path} that are exported during run-time:
15142
15143 @table @gcctabopt
15144
15145 @item %p
15146 process ID.
15147
15148 @item %q@{VAR@}
15149 value of environment variable @var{VAR}
15150
15151 @end table
15152
15153 @item -fprofile-generate
15154 @itemx -fprofile-generate=@var{path}
15155 @opindex fprofile-generate
15156
15157 Enable options usually used for instrumenting application to produce
15158 profile useful for later recompilation with profile feedback based
15159 optimization. You must use @option{-fprofile-generate} both when
15160 compiling and when linking your program.
15161
15162 The following options are enabled:
15163 @option{-fprofile-arcs}, @option{-fprofile-values},
15164 @option{-finline-functions}, and @option{-fipa-bit-cp}.
15165
15166 If @var{path} is specified, GCC looks at the @var{path} to find
15167 the profile feedback data files. See @option{-fprofile-dir}.
15168
15169 To optimize the program based on the collected profile information, use
15170 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
15171
15172 @item -fprofile-info-section
15173 @itemx -fprofile-info-section=@var{name}
15174 @opindex fprofile-info-section
15175
15176 Register the profile information in the specified section instead of using a
15177 constructor/destructor. The section name is @var{name} if it is specified,
15178 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
15179 profile information generated by @option{-fprofile-arcs} is placed in the
15180 specified section for each translation unit. This option disables the profile
15181 information registration through a constructor and it disables the profile
15182 information processing through a destructor. This option is not intended to be
15183 used in hosted environments such as GNU/Linux. It targets free-standing
15184 environments (for example embedded systems) with limited resources which do not
15185 support constructors/destructors or the C library file I/O.
15186
15187 The linker could collect the input sections in a continuous memory block and
15188 define start and end symbols. A GNU linker script example which defines a
15189 linker output section follows:
15190
15191 @smallexample
15192 .gcov_info :
15193 @{
15194 PROVIDE (__gcov_info_start = .);
15195 KEEP (*(.gcov_info))
15196 PROVIDE (__gcov_info_end = .);
15197 @}
15198 @end smallexample
15199
15200 The program could dump the profiling information registered in this linker set
15201 for example like this:
15202
15203 @smallexample
15204 #include <gcov.h>
15205 #include <stdio.h>
15206 #include <stdlib.h>
15207
15208 extern const struct gcov_info *__gcov_info_start[];
15209 extern const struct gcov_info *__gcov_info_end[];
15210
15211 static void
15212 filename (const char *f, void *arg)
15213 @{
15214 puts (f);
15215 @}
15216
15217 static void
15218 dump (const void *d, unsigned n, void *arg)
15219 @{
15220 const unsigned char *c = d;
15221
15222 for (unsigned i = 0; i < n; ++i)
15223 printf ("%02x", c[i]);
15224 @}
15225
15226 static void *
15227 allocate (unsigned length, void *arg)
15228 @{
15229 return malloc (length);
15230 @}
15231
15232 static void
15233 dump_gcov_info (void)
15234 @{
15235 const struct gcov_info **info = __gcov_info_start;
15236 const struct gcov_info **end = __gcov_info_end;
15237
15238 /* Obfuscate variable to prevent compiler optimizations. */
15239 __asm__ ("" : "+r" (info));
15240
15241 while (info != end)
15242 @{
15243 void *arg = NULL;
15244 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
15245 putchar ('\n');
15246 ++info;
15247 @}
15248 @}
15249
15250 int
15251 main()
15252 @{
15253 dump_gcov_info();
15254 return 0;
15255 @}
15256 @end smallexample
15257
15258 @item -fprofile-note=@var{path}
15259 @opindex fprofile-note
15260
15261 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
15262 location. If you combine the option with multiple source files,
15263 the @file{.gcno} file will be overwritten.
15264
15265 @item -fprofile-prefix-path=@var{path}
15266 @opindex fprofile-prefix-path
15267
15268 This option can be used in combination with
15269 @option{profile-generate=}@var{profile_dir} and
15270 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
15271 directory of built source tree. By default @var{profile_dir} will contain
15272 files with mangled absolute paths of all object files in the built project.
15273 This is not desirable when directory used to build the instrumented binary
15274 differs from the directory used to build the binary optimized with profile
15275 feedback because the profile data will not be found during the optimized build.
15276 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
15277 pointing to the base directory of the build can be used to strip the irrelevant
15278 part of the path and keep all file names relative to the main build directory.
15279
15280 @item -fprofile-prefix-map=@var{old}=@var{new}
15281 @opindex fprofile-prefix-map
15282 When compiling files residing in directory @file{@var{old}}, record
15283 profiling information (with @option{--coverage})
15284 describing them as if the files resided in
15285 directory @file{@var{new}} instead.
15286 See also @option{-ffile-prefix-map}.
15287
15288 @item -fprofile-update=@var{method}
15289 @opindex fprofile-update
15290
15291 Alter the update method for an application instrumented for profile
15292 feedback based optimization. The @var{method} argument should be one of
15293 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
15294 The first one is useful for single-threaded applications,
15295 while the second one prevents profile corruption by emitting thread-safe code.
15296
15297 @strong{Warning:} When an application does not properly join all threads
15298 (or creates an detached thread), a profile file can be still corrupted.
15299
15300 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
15301 when supported by a target, or to @samp{single} otherwise. The GCC driver
15302 automatically selects @samp{prefer-atomic} when @option{-pthread}
15303 is present in the command line.
15304
15305 @item -fprofile-filter-files=@var{regex}
15306 @opindex fprofile-filter-files
15307
15308 Instrument only functions from files whose name matches
15309 any of the regular expressions (separated by semi-colons).
15310
15311 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
15312 only @file{main.c} and all C files starting with 'module'.
15313
15314 @item -fprofile-exclude-files=@var{regex}
15315 @opindex fprofile-exclude-files
15316
15317 Instrument only functions from files whose name does not match
15318 any of the regular expressions (separated by semi-colons).
15319
15320 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
15321 of all files that are located in the @file{/usr/} folder.
15322
15323 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
15324 @opindex fprofile-reproducible
15325 Control level of reproducibility of profile gathered by
15326 @code{-fprofile-generate}. This makes it possible to rebuild program
15327 with same outcome which is useful, for example, for distribution
15328 packages.
15329
15330 With @option{-fprofile-reproducible=serial} the profile gathered by
15331 @option{-fprofile-generate} is reproducible provided the trained program
15332 behaves the same at each invocation of the train run, it is not
15333 multi-threaded and profile data streaming is always done in the same
15334 order. Note that profile streaming happens at the end of program run but
15335 also before @code{fork} function is invoked.
15336
15337 Note that it is quite common that execution counts of some part of
15338 programs depends, for example, on length of temporary file names or
15339 memory space randomization (that may affect hash-table collision rate).
15340 Such non-reproducible part of programs may be annotated by
15341 @code{no_instrument_function} function attribute. @command{gcov-dump} with
15342 @option{-l} can be used to dump gathered data and verify that they are
15343 indeed reproducible.
15344
15345 With @option{-fprofile-reproducible=parallel-runs} collected profile
15346 stays reproducible regardless the order of streaming of the data into
15347 gcda files. This setting makes it possible to run multiple instances of
15348 instrumented program in parallel (such as with @code{make -j}). This
15349 reduces quality of gathered data, in particular of indirect call
15350 profiling.
15351
15352 @item -fsanitize=address
15353 @opindex fsanitize=address
15354 Enable AddressSanitizer, a fast memory error detector.
15355 Memory access instructions are instrumented to detect
15356 out-of-bounds and use-after-free bugs.
15357 The option enables @option{-fsanitize-address-use-after-scope}.
15358 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
15359 more details. The run-time behavior can be influenced using the
15360 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
15361 the available options are shown at startup of the instrumented program. See
15362 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
15363 for a list of supported options.
15364 The option cannot be combined with @option{-fsanitize=thread} or
15365 @option{-fsanitize=hwaddress}. Note that the only target
15366 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
15367
15368 @item -fsanitize=kernel-address
15369 @opindex fsanitize=kernel-address
15370 Enable AddressSanitizer for Linux kernel.
15371 See @uref{https://github.com/google/kasan} for more details.
15372
15373 @item -fsanitize=hwaddress
15374 @opindex fsanitize=hwaddress
15375 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
15376 ignore the top byte of a pointer to allow the detection of memory errors with
15377 a low memory overhead.
15378 Memory access instructions are instrumented to detect out-of-bounds and
15379 use-after-free bugs.
15380 The option enables @option{-fsanitize-address-use-after-scope}.
15381 See
15382 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
15383 for more details. The run-time behavior can be influenced using the
15384 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
15385 the available options are shown at startup of the instrumented program.
15386 The option cannot be combined with @option{-fsanitize=thread} or
15387 @option{-fsanitize=address}, and is currently only available on AArch64.
15388
15389 @item -fsanitize=kernel-hwaddress
15390 @opindex fsanitize=kernel-hwaddress
15391 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
15392 Similar to @option{-fsanitize=kernel-address} but using an alternate
15393 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
15394 instrumentation differences necessary for compiling the Linux kernel.
15395 These differences are to avoid hwasan library initialization calls and to
15396 account for the stack pointer having a different value in its top byte.
15397
15398 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
15399 Instrumenting the stack and alloca calls are not on by default but are still
15400 possible by specifying the command-line options
15401 @option{--param hwasan-instrument-stack=1} and
15402 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
15403 tag is not implemented for kernel instrumentation.
15404
15405 @item -fsanitize=pointer-compare
15406 @opindex fsanitize=pointer-compare
15407 Instrument comparison operation (<, <=, >, >=) with pointer operands.
15408 The option must be combined with either @option{-fsanitize=kernel-address} or
15409 @option{-fsanitize=address}
15410 The option cannot be combined with @option{-fsanitize=thread}.
15411 Note: By default the check is disabled at run time. To enable it,
15412 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15413 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15414 invalid operation only when both pointers are non-null.
15415
15416 @item -fsanitize=pointer-subtract
15417 @opindex fsanitize=pointer-subtract
15418 Instrument subtraction with pointer operands.
15419 The option must be combined with either @option{-fsanitize=kernel-address} or
15420 @option{-fsanitize=address}
15421 The option cannot be combined with @option{-fsanitize=thread}.
15422 Note: By default the check is disabled at run time. To enable it,
15423 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15424 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15425 invalid operation only when both pointers are non-null.
15426
15427 @item -fsanitize=thread
15428 @opindex fsanitize=thread
15429 Enable ThreadSanitizer, a fast data race detector.
15430 Memory access instructions are instrumented to detect
15431 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
15432 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
15433 environment variable; see
15434 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
15435 supported options.
15436 The option cannot be combined with @option{-fsanitize=address},
15437 @option{-fsanitize=leak}.
15438
15439 Note that sanitized atomic builtins cannot throw exceptions when
15440 operating on invalid memory addresses with non-call exceptions
15441 (@option{-fnon-call-exceptions}).
15442
15443 @item -fsanitize=leak
15444 @opindex fsanitize=leak
15445 Enable LeakSanitizer, a memory leak detector.
15446 This option only matters for linking of executables and
15447 the executable is linked against a library that overrides @code{malloc}
15448 and other allocator functions. See
15449 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
15450 details. The run-time behavior can be influenced using the
15451 @env{LSAN_OPTIONS} environment variable.
15452 The option cannot be combined with @option{-fsanitize=thread}.
15453
15454 @item -fsanitize=undefined
15455 @opindex fsanitize=undefined
15456 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
15457 Various computations are instrumented to detect undefined behavior
15458 at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the
15459 @env{UBSAN_OPTIONS} environment variable. Current suboptions are:
15460
15461 @table @gcctabopt
15462
15463 @item -fsanitize=shift
15464 @opindex fsanitize=shift
15465 This option enables checking that the result of a shift operation is
15466 not undefined. Note that what exactly is considered undefined differs
15467 slightly between C and C++, as well as between ISO C90 and C99, etc.
15468 This option has two suboptions, @option{-fsanitize=shift-base} and
15469 @option{-fsanitize=shift-exponent}.
15470
15471 @item -fsanitize=shift-exponent
15472 @opindex fsanitize=shift-exponent
15473 This option enables checking that the second argument of a shift operation
15474 is not negative and is smaller than the precision of the promoted first
15475 argument.
15476
15477 @item -fsanitize=shift-base
15478 @opindex fsanitize=shift-base
15479 If the second argument of a shift operation is within range, check that the
15480 result of a shift operation is not undefined. Note that what exactly is
15481 considered undefined differs slightly between C and C++, as well as between
15482 ISO C90 and C99, etc.
15483
15484 @item -fsanitize=integer-divide-by-zero
15485 @opindex fsanitize=integer-divide-by-zero
15486 Detect integer division by zero.
15487
15488 @item -fsanitize=unreachable
15489 @opindex fsanitize=unreachable
15490 With this option, the compiler turns the @code{__builtin_unreachable}
15491 call into a diagnostics message call instead. When reaching the
15492 @code{__builtin_unreachable} call, the behavior is undefined.
15493
15494 @item -fsanitize=vla-bound
15495 @opindex fsanitize=vla-bound
15496 This option instructs the compiler to check that the size of a variable
15497 length array is positive.
15498
15499 @item -fsanitize=null
15500 @opindex fsanitize=null
15501 This option enables pointer checking. Particularly, the application
15502 built with this option turned on will issue an error message when it
15503 tries to dereference a NULL pointer, or if a reference (possibly an
15504 rvalue reference) is bound to a NULL pointer, or if a method is invoked
15505 on an object pointed by a NULL pointer.
15506
15507 @item -fsanitize=return
15508 @opindex fsanitize=return
15509 This option enables return statement checking. Programs
15510 built with this option turned on will issue an error message
15511 when the end of a non-void function is reached without actually
15512 returning a value. This option works in C++ only.
15513
15514 @item -fsanitize=signed-integer-overflow
15515 @opindex fsanitize=signed-integer-overflow
15516 This option enables signed integer overflow checking. We check that
15517 the result of @code{+}, @code{*}, and both unary and binary @code{-}
15518 does not overflow in the signed arithmetics. This also detects
15519 @code{INT_MIN / -1} signed division. Note, integer promotion
15520 rules must be taken into account. That is, the following is not an
15521 overflow:
15522 @smallexample
15523 signed char a = SCHAR_MAX;
15524 a++;
15525 @end smallexample
15526
15527 @item -fsanitize=bounds
15528 @opindex fsanitize=bounds
15529 This option enables instrumentation of array bounds. Various out of bounds
15530 accesses are detected. Flexible array members, flexible array member-like
15531 arrays, and initializers of variables with static storage are not instrumented.
15532
15533 @item -fsanitize=bounds-strict
15534 @opindex fsanitize=bounds-strict
15535 This option enables strict instrumentation of array bounds. Most out of bounds
15536 accesses are detected, including flexible array members and flexible array
15537 member-like arrays. Initializers of variables with static storage are not
15538 instrumented.
15539
15540 @item -fsanitize=alignment
15541 @opindex fsanitize=alignment
15542
15543 This option enables checking of alignment of pointers when they are
15544 dereferenced, or when a reference is bound to insufficiently aligned target,
15545 or when a method or constructor is invoked on insufficiently aligned object.
15546
15547 @item -fsanitize=object-size
15548 @opindex fsanitize=object-size
15549 This option enables instrumentation of memory references using the
15550 @code{__builtin_object_size} function. Various out of bounds pointer
15551 accesses are detected.
15552
15553 @item -fsanitize=float-divide-by-zero
15554 @opindex fsanitize=float-divide-by-zero
15555 Detect floating-point division by zero. Unlike other similar options,
15556 @option{-fsanitize=float-divide-by-zero} is not enabled by
15557 @option{-fsanitize=undefined}, since floating-point division by zero can
15558 be a legitimate way of obtaining infinities and NaNs.
15559
15560 @item -fsanitize=float-cast-overflow
15561 @opindex fsanitize=float-cast-overflow
15562 This option enables floating-point type to integer conversion checking.
15563 We check that the result of the conversion does not overflow.
15564 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
15565 not enabled by @option{-fsanitize=undefined}.
15566 This option does not work well with @code{FE_INVALID} exceptions enabled.
15567
15568 @item -fsanitize=nonnull-attribute
15569 @opindex fsanitize=nonnull-attribute
15570
15571 This option enables instrumentation of calls, checking whether null values
15572 are not passed to arguments marked as requiring a non-null value by the
15573 @code{nonnull} function attribute.
15574
15575 @item -fsanitize=returns-nonnull-attribute
15576 @opindex fsanitize=returns-nonnull-attribute
15577
15578 This option enables instrumentation of return statements in functions
15579 marked with @code{returns_nonnull} function attribute, to detect returning
15580 of null values from such functions.
15581
15582 @item -fsanitize=bool
15583 @opindex fsanitize=bool
15584
15585 This option enables instrumentation of loads from bool. If a value other
15586 than 0/1 is loaded, a run-time error is issued.
15587
15588 @item -fsanitize=enum
15589 @opindex fsanitize=enum
15590
15591 This option enables instrumentation of loads from an enum type. If
15592 a value outside the range of values for the enum type is loaded,
15593 a run-time error is issued.
15594
15595 @item -fsanitize=vptr
15596 @opindex fsanitize=vptr
15597
15598 This option enables instrumentation of C++ member function calls, member
15599 accesses and some conversions between pointers to base and derived classes,
15600 to verify the referenced object has the correct dynamic type.
15601
15602 @item -fsanitize=pointer-overflow
15603 @opindex fsanitize=pointer-overflow
15604
15605 This option enables instrumentation of pointer arithmetics. If the pointer
15606 arithmetics overflows, a run-time error is issued.
15607
15608 @item -fsanitize=builtin
15609 @opindex fsanitize=builtin
15610
15611 This option enables instrumentation of arguments to selected builtin
15612 functions. If an invalid value is passed to such arguments, a run-time
15613 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
15614 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
15615 by this option.
15616
15617 @end table
15618
15619 While @option{-ftrapv} causes traps for signed overflows to be emitted,
15620 @option{-fsanitize=undefined} gives a diagnostic message.
15621 This currently works only for the C family of languages.
15622
15623 @item -fno-sanitize=all
15624 @opindex fno-sanitize=all
15625
15626 This option disables all previously enabled sanitizers.
15627 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
15628 together.
15629
15630 @item -fasan-shadow-offset=@var{number}
15631 @opindex fasan-shadow-offset
15632 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
15633 It is useful for experimenting with different shadow memory layouts in
15634 Kernel AddressSanitizer.
15635
15636 @item -fsanitize-sections=@var{s1},@var{s2},...
15637 @opindex fsanitize-sections
15638 Sanitize global variables in selected user-defined sections. @var{si} may
15639 contain wildcards.
15640
15641 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
15642 @opindex fsanitize-recover
15643 @opindex fno-sanitize-recover
15644 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
15645 mentioned in comma-separated list of @var{opts}. Enabling this option
15646 for a sanitizer component causes it to attempt to continue
15647 running the program as if no error happened. This means multiple
15648 runtime errors can be reported in a single program run, and the exit
15649 code of the program may indicate success even when errors
15650 have been reported. The @option{-fno-sanitize-recover=} option
15651 can be used to alter
15652 this behavior: only the first detected error is reported
15653 and program then exits with a non-zero exit code.
15654
15655 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
15656 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
15657 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
15658 @option{-fsanitize=bounds-strict},
15659 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
15660 For these sanitizers error recovery is turned on by default,
15661 except @option{-fsanitize=address}, for which this feature is experimental.
15662 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
15663 accepted, the former enables recovery for all sanitizers that support it,
15664 the latter disables recovery for all sanitizers that support it.
15665
15666 Even if a recovery mode is turned on the compiler side, it needs to be also
15667 enabled on the runtime library side, otherwise the failures are still fatal.
15668 The runtime library defaults to @code{halt_on_error=0} for
15669 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
15670 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
15671 setting the @code{halt_on_error} flag in the corresponding environment variable.
15672
15673 Syntax without an explicit @var{opts} parameter is deprecated. It is
15674 equivalent to specifying an @var{opts} list of:
15675
15676 @smallexample
15677 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
15678 @end smallexample
15679
15680 @item -fsanitize-address-use-after-scope
15681 @opindex fsanitize-address-use-after-scope
15682 Enable sanitization of local variables to detect use-after-scope bugs.
15683 The option sets @option{-fstack-reuse} to @samp{none}.
15684
15685 @item -fsanitize-undefined-trap-on-error
15686 @opindex fsanitize-undefined-trap-on-error
15687 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
15688 report undefined behavior using @code{__builtin_trap} rather than
15689 a @code{libubsan} library routine. The advantage of this is that the
15690 @code{libubsan} library is not needed and is not linked in, so this
15691 is usable even in freestanding environments.
15692
15693 @item -fsanitize-coverage=trace-pc
15694 @opindex fsanitize-coverage=trace-pc
15695 Enable coverage-guided fuzzing code instrumentation.
15696 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
15697
15698 @item -fsanitize-coverage=trace-cmp
15699 @opindex fsanitize-coverage=trace-cmp
15700 Enable dataflow guided fuzzing code instrumentation.
15701 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
15702 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
15703 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
15704 variable or @code{__sanitizer_cov_trace_const_cmp1},
15705 @code{__sanitizer_cov_trace_const_cmp2},
15706 @code{__sanitizer_cov_trace_const_cmp4} or
15707 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
15708 operand constant, @code{__sanitizer_cov_trace_cmpf} or
15709 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
15710 @code{__sanitizer_cov_trace_switch} for switch statements.
15711
15712 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
15713 @opindex fcf-protection
15714 Enable code instrumentation of control-flow transfers to increase
15715 program security by checking that target addresses of control-flow
15716 transfer instructions (such as indirect function call, function return,
15717 indirect jump) are valid. This prevents diverting the flow of control
15718 to an unexpected target. This is intended to protect against such
15719 threats as Return-oriented Programming (ROP), and similarly
15720 call/jmp-oriented programming (COP/JOP).
15721
15722 The value @code{branch} tells the compiler to implement checking of
15723 validity of control-flow transfer at the point of indirect branch
15724 instructions, i.e.@: call/jmp instructions. The value @code{return}
15725 implements checking of validity at the point of returning from a
15726 function. The value @code{full} is an alias for specifying both
15727 @code{branch} and @code{return}. The value @code{none} turns off
15728 instrumentation.
15729
15730 The value @code{check} is used for the final link with link-time
15731 optimization (LTO). An error is issued if LTO object files are
15732 compiled with different @option{-fcf-protection} values. The
15733 value @code{check} is ignored at the compile time.
15734
15735 The macro @code{__CET__} is defined when @option{-fcf-protection} is
15736 used. The first bit of @code{__CET__} is set to 1 for the value
15737 @code{branch} and the second bit of @code{__CET__} is set to 1 for
15738 the @code{return}.
15739
15740 You can also use the @code{nocf_check} attribute to identify
15741 which functions and calls should be skipped from instrumentation
15742 (@pxref{Function Attributes}).
15743
15744 Currently the x86 GNU/Linux target provides an implementation based
15745 on Intel Control-flow Enforcement Technology (CET) which works for
15746 i686 processor or newer.
15747
15748 @item -fharden-compares
15749 @opindex fharden-compares
15750 For every logical test that survives gimple optimizations and is
15751 @emph{not} the condition in a conditional branch (for example,
15752 conditions tested for conditional moves, or to store in boolean
15753 variables), emit extra code to compute and verify the reversed
15754 condition, and to call @code{__builtin_trap} if the results do not
15755 match. Use with @samp{-fharden-conditional-branches} to cover all
15756 conditionals.
15757
15758 @item -fharden-conditional-branches
15759 @opindex fharden-conditional-branches
15760 For every non-vectorized conditional branch that survives gimple
15761 optimizations, emit extra code to compute and verify the reversed
15762 condition, and to call @code{__builtin_trap} if the result is
15763 unexpected. Use with @samp{-fharden-compares} to cover all
15764 conditionals.
15765
15766 @item -fstack-protector
15767 @opindex fstack-protector
15768 Emit extra code to check for buffer overflows, such as stack smashing
15769 attacks. This is done by adding a guard variable to functions with
15770 vulnerable objects. This includes functions that call @code{alloca}, and
15771 functions with buffers larger than or equal to 8 bytes. The guards are
15772 initialized when a function is entered and then checked when the function
15773 exits. If a guard check fails, an error message is printed and the program
15774 exits. Only variables that are actually allocated on the stack are
15775 considered, optimized away variables or variables allocated in registers
15776 don't count.
15777
15778 @item -fstack-protector-all
15779 @opindex fstack-protector-all
15780 Like @option{-fstack-protector} except that all functions are protected.
15781
15782 @item -fstack-protector-strong
15783 @opindex fstack-protector-strong
15784 Like @option{-fstack-protector} but includes additional functions to
15785 be protected --- those that have local array definitions, or have
15786 references to local frame addresses. Only variables that are actually
15787 allocated on the stack are considered, optimized away variables or variables
15788 allocated in registers don't count.
15789
15790 @item -fstack-protector-explicit
15791 @opindex fstack-protector-explicit
15792 Like @option{-fstack-protector} but only protects those functions which
15793 have the @code{stack_protect} attribute.
15794
15795 @item -fstack-check
15796 @opindex fstack-check
15797 Generate code to verify that you do not go beyond the boundary of the
15798 stack. You should specify this flag if you are running in an
15799 environment with multiple threads, but you only rarely need to specify it in
15800 a single-threaded environment since stack overflow is automatically
15801 detected on nearly all systems if there is only one stack.
15802
15803 Note that this switch does not actually cause checking to be done; the
15804 operating system or the language runtime must do that. The switch causes
15805 generation of code to ensure that they see the stack being extended.
15806
15807 You can additionally specify a string parameter: @samp{no} means no
15808 checking, @samp{generic} means force the use of old-style checking,
15809 @samp{specific} means use the best checking method and is equivalent
15810 to bare @option{-fstack-check}.
15811
15812 Old-style checking is a generic mechanism that requires no specific
15813 target support in the compiler but comes with the following drawbacks:
15814
15815 @enumerate
15816 @item
15817 Modified allocation strategy for large objects: they are always
15818 allocated dynamically if their size exceeds a fixed threshold. Note this
15819 may change the semantics of some code.
15820
15821 @item
15822 Fixed limit on the size of the static frame of functions: when it is
15823 topped by a particular function, stack checking is not reliable and
15824 a warning is issued by the compiler.
15825
15826 @item
15827 Inefficiency: because of both the modified allocation strategy and the
15828 generic implementation, code performance is hampered.
15829 @end enumerate
15830
15831 Note that old-style stack checking is also the fallback method for
15832 @samp{specific} if no target support has been added in the compiler.
15833
15834 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
15835 and stack overflows. @samp{specific} is an excellent choice when compiling
15836 Ada code. It is not generally sufficient to protect against stack-clash
15837 attacks. To protect against those you want @samp{-fstack-clash-protection}.
15838
15839 @item -fstack-clash-protection
15840 @opindex fstack-clash-protection
15841 Generate code to prevent stack clash style attacks. When this option is
15842 enabled, the compiler will only allocate one page of stack space at a time
15843 and each page is accessed immediately after allocation. Thus, it prevents
15844 allocations from jumping over any stack guard page provided by the
15845 operating system.
15846
15847 Most targets do not fully support stack clash protection. However, on
15848 those targets @option{-fstack-clash-protection} will protect dynamic stack
15849 allocations. @option{-fstack-clash-protection} may also provide limited
15850 protection for static stack allocations if the target supports
15851 @option{-fstack-check=specific}.
15852
15853 @item -fstack-limit-register=@var{reg}
15854 @itemx -fstack-limit-symbol=@var{sym}
15855 @itemx -fno-stack-limit
15856 @opindex fstack-limit-register
15857 @opindex fstack-limit-symbol
15858 @opindex fno-stack-limit
15859 Generate code to ensure that the stack does not grow beyond a certain value,
15860 either the value of a register or the address of a symbol. If a larger
15861 stack is required, a signal is raised at run time. For most targets,
15862 the signal is raised before the stack overruns the boundary, so
15863 it is possible to catch the signal without taking special precautions.
15864
15865 For instance, if the stack starts at absolute address @samp{0x80000000}
15866 and grows downwards, you can use the flags
15867 @option{-fstack-limit-symbol=__stack_limit} and
15868 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
15869 of 128KB@. Note that this may only work with the GNU linker.
15870
15871 You can locally override stack limit checking by using the
15872 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
15873
15874 @item -fsplit-stack
15875 @opindex fsplit-stack
15876 Generate code to automatically split the stack before it overflows.
15877 The resulting program has a discontiguous stack which can only
15878 overflow if the program is unable to allocate any more memory. This
15879 is most useful when running threaded programs, as it is no longer
15880 necessary to calculate a good stack size to use for each thread. This
15881 is currently only implemented for the x86 targets running
15882 GNU/Linux.
15883
15884 When code compiled with @option{-fsplit-stack} calls code compiled
15885 without @option{-fsplit-stack}, there may not be much stack space
15886 available for the latter code to run. If compiling all code,
15887 including library code, with @option{-fsplit-stack} is not an option,
15888 then the linker can fix up these calls so that the code compiled
15889 without @option{-fsplit-stack} always has a large stack. Support for
15890 this is implemented in the gold linker in GNU binutils release 2.21
15891 and later.
15892
15893 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
15894 @opindex fvtable-verify
15895 This option is only available when compiling C++ code.
15896 It turns on (or off, if using @option{-fvtable-verify=none}) the security
15897 feature that verifies at run time, for every virtual call, that
15898 the vtable pointer through which the call is made is valid for the type of
15899 the object, and has not been corrupted or overwritten. If an invalid vtable
15900 pointer is detected at run time, an error is reported and execution of the
15901 program is immediately halted.
15902
15903 This option causes run-time data structures to be built at program startup,
15904 which are used for verifying the vtable pointers.
15905 The options @samp{std} and @samp{preinit}
15906 control the timing of when these data structures are built. In both cases the
15907 data structures are built before execution reaches @code{main}. Using
15908 @option{-fvtable-verify=std} causes the data structures to be built after
15909 shared libraries have been loaded and initialized.
15910 @option{-fvtable-verify=preinit} causes them to be built before shared
15911 libraries have been loaded and initialized.
15912
15913 If this option appears multiple times in the command line with different
15914 values specified, @samp{none} takes highest priority over both @samp{std} and
15915 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
15916
15917 @item -fvtv-debug
15918 @opindex fvtv-debug
15919 When used in conjunction with @option{-fvtable-verify=std} or
15920 @option{-fvtable-verify=preinit}, causes debug versions of the
15921 runtime functions for the vtable verification feature to be called.
15922 This flag also causes the compiler to log information about which
15923 vtable pointers it finds for each class.
15924 This information is written to a file named @file{vtv_set_ptr_data.log}
15925 in the directory named by the environment variable @env{VTV_LOGS_DIR}
15926 if that is defined or the current working directory otherwise.
15927
15928 Note: This feature @emph{appends} data to the log file. If you want a fresh log
15929 file, be sure to delete any existing one.
15930
15931 @item -fvtv-counts
15932 @opindex fvtv-counts
15933 This is a debugging flag. When used in conjunction with
15934 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
15935 causes the compiler to keep track of the total number of virtual calls
15936 it encounters and the number of verifications it inserts. It also
15937 counts the number of calls to certain run-time library functions
15938 that it inserts and logs this information for each compilation unit.
15939 The compiler writes this information to a file named
15940 @file{vtv_count_data.log} in the directory named by the environment
15941 variable @env{VTV_LOGS_DIR} if that is defined or the current working
15942 directory otherwise. It also counts the size of the vtable pointer sets
15943 for each class, and writes this information to @file{vtv_class_set_sizes.log}
15944 in the same directory.
15945
15946 Note: This feature @emph{appends} data to the log files. To get fresh log
15947 files, be sure to delete any existing ones.
15948
15949 @item -finstrument-functions
15950 @opindex finstrument-functions
15951 Generate instrumentation calls for entry and exit to functions. Just
15952 after function entry and just before function exit, the following
15953 profiling functions are called with the address of the current
15954 function and its call site. (On some platforms,
15955 @code{__builtin_return_address} does not work beyond the current
15956 function, so the call site information may not be available to the
15957 profiling functions otherwise.)
15958
15959 @smallexample
15960 void __cyg_profile_func_enter (void *this_fn,
15961 void *call_site);
15962 void __cyg_profile_func_exit (void *this_fn,
15963 void *call_site);
15964 @end smallexample
15965
15966 The first argument is the address of the start of the current function,
15967 which may be looked up exactly in the symbol table.
15968
15969 This instrumentation is also done for functions expanded inline in other
15970 functions. The profiling calls indicate where, conceptually, the
15971 inline function is entered and exited. This means that addressable
15972 versions of such functions must be available. If all your uses of a
15973 function are expanded inline, this may mean an additional expansion of
15974 code size. If you use @code{extern inline} in your C code, an
15975 addressable version of such functions must be provided. (This is
15976 normally the case anyway, but if you get lucky and the optimizer always
15977 expands the functions inline, you might have gotten away without
15978 providing static copies.)
15979
15980 A function may be given the attribute @code{no_instrument_function}, in
15981 which case this instrumentation is not done. This can be used, for
15982 example, for the profiling functions listed above, high-priority
15983 interrupt routines, and any functions from which the profiling functions
15984 cannot safely be called (perhaps signal handlers, if the profiling
15985 routines generate output or allocate memory).
15986 @xref{Common Function Attributes}.
15987
15988 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
15989 @opindex finstrument-functions-exclude-file-list
15990
15991 Set the list of functions that are excluded from instrumentation (see
15992 the description of @option{-finstrument-functions}). If the file that
15993 contains a function definition matches with one of @var{file}, then
15994 that function is not instrumented. The match is done on substrings:
15995 if the @var{file} parameter is a substring of the file name, it is
15996 considered to be a match.
15997
15998 For example:
15999
16000 @smallexample
16001 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
16002 @end smallexample
16003
16004 @noindent
16005 excludes any inline function defined in files whose pathnames
16006 contain @file{/bits/stl} or @file{include/sys}.
16007
16008 If, for some reason, you want to include letter @samp{,} in one of
16009 @var{sym}, write @samp{\,}. For example,
16010 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
16011 (note the single quote surrounding the option).
16012
16013 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
16014 @opindex finstrument-functions-exclude-function-list
16015
16016 This is similar to @option{-finstrument-functions-exclude-file-list},
16017 but this option sets the list of function names to be excluded from
16018 instrumentation. The function name to be matched is its user-visible
16019 name, such as @code{vector<int> blah(const vector<int> &)}, not the
16020 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
16021 match is done on substrings: if the @var{sym} parameter is a substring
16022 of the function name, it is considered to be a match. For C99 and C++
16023 extended identifiers, the function name must be given in UTF-8, not
16024 using universal character names.
16025
16026 @item -fpatchable-function-entry=@var{N}[,@var{M}]
16027 @opindex fpatchable-function-entry
16028 Generate @var{N} NOPs right at the beginning
16029 of each function, with the function entry point before the @var{M}th NOP.
16030 If @var{M} is omitted, it defaults to @code{0} so the
16031 function entry points to the address just at the first NOP.
16032 The NOP instructions reserve extra space which can be used to patch in
16033 any desired instrumentation at run time, provided that the code segment
16034 is writable. The amount of space is controllable indirectly via
16035 the number of NOPs; the NOP instruction used corresponds to the instruction
16036 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
16037 is target-specific and may also depend on the architecture variant and/or
16038 other compilation options.
16039
16040 For run-time identification, the starting addresses of these areas,
16041 which correspond to their respective function entries minus @var{M},
16042 are additionally collected in the @code{__patchable_function_entries}
16043 section of the resulting binary.
16044
16045 Note that the value of @code{__attribute__ ((patchable_function_entry
16046 (N,M)))} takes precedence over command-line option
16047 @option{-fpatchable-function-entry=N,M}. This can be used to increase
16048 the area size or to remove it completely on a single function.
16049 If @code{N=0}, no pad location is recorded.
16050
16051 The NOP instructions are inserted at---and maybe before, depending on
16052 @var{M}---the function entry address, even before the prologue.
16053
16054 The maximum value of @var{N} and @var{M} is 65535.
16055 @end table
16056
16057
16058 @node Preprocessor Options
16059 @section Options Controlling the Preprocessor
16060 @cindex preprocessor options
16061 @cindex options, preprocessor
16062
16063 These options control the C preprocessor, which is run on each C source
16064 file before actual compilation.
16065
16066 If you use the @option{-E} option, nothing is done except preprocessing.
16067 Some of these options make sense only together with @option{-E} because
16068 they cause the preprocessor output to be unsuitable for actual
16069 compilation.
16070
16071 In addition to the options listed here, there are a number of options
16072 to control search paths for include files documented in
16073 @ref{Directory Options}.
16074 Options to control preprocessor diagnostics are listed in
16075 @ref{Warning Options}.
16076
16077 @table @gcctabopt
16078 @include cppopts.texi
16079
16080 @item -Wp,@var{option}
16081 @opindex Wp
16082 You can use @option{-Wp,@var{option}} to bypass the compiler driver
16083 and pass @var{option} directly through to the preprocessor. If
16084 @var{option} contains commas, it is split into multiple options at the
16085 commas. However, many options are modified, translated or interpreted
16086 by the compiler driver before being passed to the preprocessor, and
16087 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
16088 interface is undocumented and subject to change, so whenever possible
16089 you should avoid using @option{-Wp} and let the driver handle the
16090 options instead.
16091
16092 @item -Xpreprocessor @var{option}
16093 @opindex Xpreprocessor
16094 Pass @var{option} as an option to the preprocessor. You can use this to
16095 supply system-specific preprocessor options that GCC does not
16096 recognize.
16097
16098 If you want to pass an option that takes an argument, you must use
16099 @option{-Xpreprocessor} twice, once for the option and once for the argument.
16100
16101 @item -no-integrated-cpp
16102 @opindex no-integrated-cpp
16103 Perform preprocessing as a separate pass before compilation.
16104 By default, GCC performs preprocessing as an integrated part of
16105 input tokenization and parsing.
16106 If this option is provided, the appropriate language front end
16107 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
16108 and Objective-C, respectively) is instead invoked twice,
16109 once for preprocessing only and once for actual compilation
16110 of the preprocessed input.
16111 This option may be useful in conjunction with the @option{-B} or
16112 @option{-wrapper} options to specify an alternate preprocessor or
16113 perform additional processing of the program source between
16114 normal preprocessing and compilation.
16115
16116 @item -flarge-source-files
16117 @opindex flarge-source-files
16118 Adjust GCC to expect large source files, at the expense of slower
16119 compilation and higher memory usage.
16120
16121 Specifically, GCC normally tracks both column numbers and line numbers
16122 within source files and it normally prints both of these numbers in
16123 diagnostics. However, once it has processed a certain number of source
16124 lines, it stops tracking column numbers and only tracks line numbers.
16125 This means that diagnostics for later lines do not include column numbers.
16126 It also means that options like @option{-Wmisleading-indentation} cease to work
16127 at that point, although the compiler prints a note if this happens.
16128 Passing @option{-flarge-source-files} significantly increases the number
16129 of source lines that GCC can process before it stops tracking columns.
16130
16131 @end table
16132
16133 @node Assembler Options
16134 @section Passing Options to the Assembler
16135
16136 @c prevent bad page break with this line
16137 You can pass options to the assembler.
16138
16139 @table @gcctabopt
16140 @item -Wa,@var{option}
16141 @opindex Wa
16142 Pass @var{option} as an option to the assembler. If @var{option}
16143 contains commas, it is split into multiple options at the commas.
16144
16145 @item -Xassembler @var{option}
16146 @opindex Xassembler
16147 Pass @var{option} as an option to the assembler. You can use this to
16148 supply system-specific assembler options that GCC does not
16149 recognize.
16150
16151 If you want to pass an option that takes an argument, you must use
16152 @option{-Xassembler} twice, once for the option and once for the argument.
16153
16154 @end table
16155
16156 @node Link Options
16157 @section Options for Linking
16158 @cindex link options
16159 @cindex options, linking
16160
16161 These options come into play when the compiler links object files into
16162 an executable output file. They are meaningless if the compiler is
16163 not doing a link step.
16164
16165 @table @gcctabopt
16166 @cindex file names
16167 @item @var{object-file-name}
16168 A file name that does not end in a special recognized suffix is
16169 considered to name an object file or library. (Object files are
16170 distinguished from libraries by the linker according to the file
16171 contents.) If linking is done, these object files are used as input
16172 to the linker.
16173
16174 @item -c
16175 @itemx -S
16176 @itemx -E
16177 @opindex c
16178 @opindex S
16179 @opindex E
16180 If any of these options is used, then the linker is not run, and
16181 object file names should not be used as arguments. @xref{Overall
16182 Options}.
16183
16184 @item -flinker-output=@var{type}
16185 @opindex flinker-output
16186 This option controls code generation of the link-time optimizer. By
16187 default the linker output is automatically determined by the linker
16188 plugin. For debugging the compiler and if incremental linking with a
16189 non-LTO object file is desired, it may be useful to control the type
16190 manually.
16191
16192 If @var{type} is @samp{exec}, code generation produces a static
16193 binary. In this case @option{-fpic} and @option{-fpie} are both
16194 disabled.
16195
16196 If @var{type} is @samp{dyn}, code generation produces a shared
16197 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
16198 but not enabled automatically. This allows to build shared libraries
16199 without position-independent code on architectures where this is
16200 possible, i.e.@: on x86.
16201
16202 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
16203 executable. This results in similar optimizations as @samp{exec}
16204 except that @option{-fpie} is not disabled if specified at compilation
16205 time.
16206
16207 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
16208 done. The sections containing intermediate code for link-time optimization are
16209 merged, pre-optimized, and output to the resulting object file. In addition, if
16210 @option{-ffat-lto-objects} is specified, binary code is produced for future
16211 non-LTO linking. The object file produced by incremental linking is smaller
16212 than a static library produced from the same object files. At link time the
16213 result of incremental linking also loads faster than a static
16214 library assuming that the majority of objects in the library are used.
16215
16216 Finally @samp{nolto-rel} configures the compiler for incremental linking where
16217 code generation is forced, a final binary is produced, and the intermediate
16218 code for later link-time optimization is stripped. When multiple object files
16219 are linked together the resulting code is better optimized than with
16220 link-time optimizations disabled (for example, cross-module inlining
16221 happens), but most of benefits of whole program optimizations are lost.
16222
16223 During the incremental link (by @option{-r}) the linker plugin defaults to
16224 @option{rel}. With current interfaces to GNU Binutils it is however not
16225 possible to incrementally link LTO objects and non-LTO objects into a single
16226 mixed object file. If any of object files in incremental link cannot
16227 be used for link-time optimization, the linker plugin issues a warning and
16228 uses @samp{nolto-rel}. To maintain whole program optimization, it is
16229 recommended to link such objects into static library instead. Alternatively it
16230 is possible to use H.J. Lu's binutils with support for mixed objects.
16231
16232 @item -fuse-ld=bfd
16233 @opindex fuse-ld=bfd
16234 Use the @command{bfd} linker instead of the default linker.
16235
16236 @item -fuse-ld=gold
16237 @opindex fuse-ld=gold
16238 Use the @command{gold} linker instead of the default linker.
16239
16240 @item -fuse-ld=lld
16241 @opindex fuse-ld=lld
16242 Use the LLVM @command{lld} linker instead of the default linker.
16243
16244 @cindex Libraries
16245 @item -l@var{library}
16246 @itemx -l @var{library}
16247 @opindex l
16248 Search the library named @var{library} when linking. (The second
16249 alternative with the library as a separate argument is only for
16250 POSIX compliance and is not recommended.)
16251
16252 The @option{-l} option is passed directly to the linker by GCC. Refer
16253 to your linker documentation for exact details. The general
16254 description below applies to the GNU linker.
16255
16256 The linker searches a standard list of directories for the library.
16257 The directories searched include several standard system directories
16258 plus any that you specify with @option{-L}.
16259
16260 Static libraries are archives of object files, and have file names
16261 like @file{lib@var{library}.a}. Some targets also support shared
16262 libraries, which typically have names like @file{lib@var{library}.so}.
16263 If both static and shared libraries are found, the linker gives
16264 preference to linking with the shared library unless the
16265 @option{-static} option is used.
16266
16267 It makes a difference where in the command you write this option; the
16268 linker searches and processes libraries and object files in the order they
16269 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
16270 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
16271 to functions in @samp{z}, those functions may not be loaded.
16272
16273 @item -lobjc
16274 @opindex lobjc
16275 You need this special case of the @option{-l} option in order to
16276 link an Objective-C or Objective-C++ program.
16277
16278 @item -nostartfiles
16279 @opindex nostartfiles
16280 Do not use the standard system startup files when linking.
16281 The standard system libraries are used normally, unless @option{-nostdlib},
16282 @option{-nolibc}, or @option{-nodefaultlibs} is used.
16283
16284 @item -nodefaultlibs
16285 @opindex nodefaultlibs
16286 Do not use the standard system libraries when linking.
16287 Only the libraries you specify are passed to the linker, and options
16288 specifying linkage of the system libraries, such as @option{-static-libgcc}
16289 or @option{-shared-libgcc}, are ignored.
16290 The standard startup files are used normally, unless @option{-nostartfiles}
16291 is used.
16292
16293 The compiler may generate calls to @code{memcmp},
16294 @code{memset}, @code{memcpy} and @code{memmove}.
16295 These entries are usually resolved by entries in
16296 libc. These entry points should be supplied through some other
16297 mechanism when this option is specified.
16298
16299 @item -nolibc
16300 @opindex nolibc
16301 Do not use the C library or system libraries tightly coupled with it when
16302 linking. Still link with the startup files, @file{libgcc} or toolchain
16303 provided language support libraries such as @file{libgnat}, @file{libgfortran}
16304 or @file{libstdc++} unless options preventing their inclusion are used as
16305 well. This typically removes @option{-lc} from the link command line, as well
16306 as system libraries that normally go with it and become meaningless when
16307 absence of a C library is assumed, for example @option{-lpthread} or
16308 @option{-lm} in some configurations. This is intended for bare-board
16309 targets when there is indeed no C library available.
16310
16311 @item -nostdlib
16312 @opindex nostdlib
16313 Do not use the standard system startup files or libraries when linking.
16314 No startup files and only the libraries you specify are passed to
16315 the linker, and options specifying linkage of the system libraries, such as
16316 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
16317
16318 The compiler may generate calls to @code{memcmp}, @code{memset},
16319 @code{memcpy} and @code{memmove}.
16320 These entries are usually resolved by entries in
16321 libc. These entry points should be supplied through some other
16322 mechanism when this option is specified.
16323
16324 @cindex @option{-lgcc}, use with @option{-nostdlib}
16325 @cindex @option{-nostdlib} and unresolved references
16326 @cindex unresolved references and @option{-nostdlib}
16327 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
16328 @cindex @option{-nodefaultlibs} and unresolved references
16329 @cindex unresolved references and @option{-nodefaultlibs}
16330 One of the standard libraries bypassed by @option{-nostdlib} and
16331 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
16332 which GCC uses to overcome shortcomings of particular machines, or special
16333 needs for some languages.
16334 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
16335 Collection (GCC) Internals},
16336 for more discussion of @file{libgcc.a}.)
16337 In most cases, you need @file{libgcc.a} even when you want to avoid
16338 other standard libraries. In other words, when you specify @option{-nostdlib}
16339 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
16340 This ensures that you have no unresolved references to internal GCC
16341 library subroutines.
16342 (An example of such an internal subroutine is @code{__main}, used to ensure C++
16343 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
16344 GNU Compiler Collection (GCC) Internals}.)
16345
16346 @item -e @var{entry}
16347 @itemx --entry=@var{entry}
16348 @opindex e
16349 @opindex entry
16350
16351 Specify that the program entry point is @var{entry}. The argument is
16352 interpreted by the linker; the GNU linker accepts either a symbol name
16353 or an address.
16354
16355 @item -pie
16356 @opindex pie
16357 Produce a dynamically linked position independent executable on targets
16358 that support it. For predictable results, you must also specify the same
16359 set of options used for compilation (@option{-fpie}, @option{-fPIE},
16360 or model suboptions) when you specify this linker option.
16361
16362 @item -no-pie
16363 @opindex no-pie
16364 Don't produce a dynamically linked position independent executable.
16365
16366 @item -static-pie
16367 @opindex static-pie
16368 Produce a static position independent executable on targets that support
16369 it. A static position independent executable is similar to a static
16370 executable, but can be loaded at any address without a dynamic linker.
16371 For predictable results, you must also specify the same set of options
16372 used for compilation (@option{-fpie}, @option{-fPIE}, or model
16373 suboptions) when you specify this linker option.
16374
16375 @item -pthread
16376 @opindex pthread
16377 Link with the POSIX threads library. This option is supported on
16378 GNU/Linux targets, most other Unix derivatives, and also on
16379 x86 Cygwin and MinGW targets. On some targets this option also sets
16380 flags for the preprocessor, so it should be used consistently for both
16381 compilation and linking.
16382
16383 @item -r
16384 @opindex r
16385 Produce a relocatable object as output. This is also known as partial
16386 linking.
16387
16388 @item -rdynamic
16389 @opindex rdynamic
16390 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
16391 that support it. This instructs the linker to add all symbols, not
16392 only used ones, to the dynamic symbol table. This option is needed
16393 for some uses of @code{dlopen} or to allow obtaining backtraces
16394 from within a program.
16395
16396 @item -s
16397 @opindex s
16398 Remove all symbol table and relocation information from the executable.
16399
16400 @item -static
16401 @opindex static
16402 On systems that support dynamic linking, this overrides @option{-pie}
16403 and prevents linking with the shared libraries. On other systems, this
16404 option has no effect.
16405
16406 @item -shared
16407 @opindex shared
16408 Produce a shared object which can then be linked with other objects to
16409 form an executable. Not all systems support this option. For predictable
16410 results, you must also specify the same set of options used for compilation
16411 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
16412 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
16413 needs to build supplementary stub code for constructors to work. On
16414 multi-libbed systems, @samp{gcc -shared} must select the correct support
16415 libraries to link against. Failing to supply the correct flags may lead
16416 to subtle defects. Supplying them in cases where they are not necessary
16417 is innocuous.}
16418
16419 @item -shared-libgcc
16420 @itemx -static-libgcc
16421 @opindex shared-libgcc
16422 @opindex static-libgcc
16423 On systems that provide @file{libgcc} as a shared library, these options
16424 force the use of either the shared or static version, respectively.
16425 If no shared version of @file{libgcc} was built when the compiler was
16426 configured, these options have no effect.
16427
16428 There are several situations in which an application should use the
16429 shared @file{libgcc} instead of the static version. The most common
16430 of these is when the application wishes to throw and catch exceptions
16431 across different shared libraries. In that case, each of the libraries
16432 as well as the application itself should use the shared @file{libgcc}.
16433
16434 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
16435 whenever you build a shared library or a main executable, because C++
16436 programs typically use exceptions, so this is the right thing to do.
16437
16438 If, instead, you use the GCC driver to create shared libraries, you may
16439 find that they are not always linked with the shared @file{libgcc}.
16440 If GCC finds, at its configuration time, that you have a non-GNU linker
16441 or a GNU linker that does not support option @option{--eh-frame-hdr},
16442 it links the shared version of @file{libgcc} into shared libraries
16443 by default. Otherwise, it takes advantage of the linker and optimizes
16444 away the linking with the shared version of @file{libgcc}, linking with
16445 the static version of libgcc by default. This allows exceptions to
16446 propagate through such shared libraries, without incurring relocation
16447 costs at library load time.
16448
16449 However, if a library or main executable is supposed to throw or catch
16450 exceptions, you must link it using the G++ driver, or using the option
16451 @option{-shared-libgcc}, such that it is linked with the shared
16452 @file{libgcc}.
16453
16454 @item -static-libasan
16455 @opindex static-libasan
16456 When the @option{-fsanitize=address} option is used to link a program,
16457 the GCC driver automatically links against @option{libasan}. If
16458 @file{libasan} is available as a shared library, and the @option{-static}
16459 option is not used, then this links against the shared version of
16460 @file{libasan}. The @option{-static-libasan} option directs the GCC
16461 driver to link @file{libasan} statically, without necessarily linking
16462 other libraries statically.
16463
16464 @item -static-libtsan
16465 @opindex static-libtsan
16466 When the @option{-fsanitize=thread} option is used to link a program,
16467 the GCC driver automatically links against @option{libtsan}. If
16468 @file{libtsan} is available as a shared library, and the @option{-static}
16469 option is not used, then this links against the shared version of
16470 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
16471 driver to link @file{libtsan} statically, without necessarily linking
16472 other libraries statically.
16473
16474 @item -static-liblsan
16475 @opindex static-liblsan
16476 When the @option{-fsanitize=leak} option is used to link a program,
16477 the GCC driver automatically links against @option{liblsan}. If
16478 @file{liblsan} is available as a shared library, and the @option{-static}
16479 option is not used, then this links against the shared version of
16480 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
16481 driver to link @file{liblsan} statically, without necessarily linking
16482 other libraries statically.
16483
16484 @item -static-libubsan
16485 @opindex static-libubsan
16486 When the @option{-fsanitize=undefined} option is used to link a program,
16487 the GCC driver automatically links against @option{libubsan}. If
16488 @file{libubsan} is available as a shared library, and the @option{-static}
16489 option is not used, then this links against the shared version of
16490 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
16491 driver to link @file{libubsan} statically, without necessarily linking
16492 other libraries statically.
16493
16494 @item -static-libstdc++
16495 @opindex static-libstdc++
16496 When the @command{g++} program is used to link a C++ program, it
16497 normally automatically links against @option{libstdc++}. If
16498 @file{libstdc++} is available as a shared library, and the
16499 @option{-static} option is not used, then this links against the
16500 shared version of @file{libstdc++}. That is normally fine. However, it
16501 is sometimes useful to freeze the version of @file{libstdc++} used by
16502 the program without going all the way to a fully static link. The
16503 @option{-static-libstdc++} option directs the @command{g++} driver to
16504 link @file{libstdc++} statically, without necessarily linking other
16505 libraries statically.
16506
16507 @item -symbolic
16508 @opindex symbolic
16509 Bind references to global symbols when building a shared object. Warn
16510 about any unresolved references (unless overridden by the link editor
16511 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
16512 this option.
16513
16514 @item -T @var{script}
16515 @opindex T
16516 @cindex linker script
16517 Use @var{script} as the linker script. This option is supported by most
16518 systems using the GNU linker. On some targets, such as bare-board
16519 targets without an operating system, the @option{-T} option may be required
16520 when linking to avoid references to undefined symbols.
16521
16522 @item -Xlinker @var{option}
16523 @opindex Xlinker
16524 Pass @var{option} as an option to the linker. You can use this to
16525 supply system-specific linker options that GCC does not recognize.
16526
16527 If you want to pass an option that takes a separate argument, you must use
16528 @option{-Xlinker} twice, once for the option and once for the argument.
16529 For example, to pass @option{-assert definitions}, you must write
16530 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
16531 @option{-Xlinker "-assert definitions"}, because this passes the entire
16532 string as a single argument, which is not what the linker expects.
16533
16534 When using the GNU linker, it is usually more convenient to pass
16535 arguments to linker options using the @option{@var{option}=@var{value}}
16536 syntax than as separate arguments. For example, you can specify
16537 @option{-Xlinker -Map=output.map} rather than
16538 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
16539 this syntax for command-line options.
16540
16541 @item -Wl,@var{option}
16542 @opindex Wl
16543 Pass @var{option} as an option to the linker. If @var{option} contains
16544 commas, it is split into multiple options at the commas. You can use this
16545 syntax to pass an argument to the option.
16546 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
16547 linker. When using the GNU linker, you can also get the same effect with
16548 @option{-Wl,-Map=output.map}.
16549
16550 @item -u @var{symbol}
16551 @opindex u
16552 Pretend the symbol @var{symbol} is undefined, to force linking of
16553 library modules to define it. You can use @option{-u} multiple times with
16554 different symbols to force loading of additional library modules.
16555
16556 @item -z @var{keyword}
16557 @opindex z
16558 @option{-z} is passed directly on to the linker along with the keyword
16559 @var{keyword}. See the section in the documentation of your linker for
16560 permitted values and their meanings.
16561 @end table
16562
16563 @node Directory Options
16564 @section Options for Directory Search
16565 @cindex directory options
16566 @cindex options, directory search
16567 @cindex search path
16568
16569 These options specify directories to search for header files, for
16570 libraries and for parts of the compiler:
16571
16572 @table @gcctabopt
16573 @include cppdiropts.texi
16574
16575 @item -iplugindir=@var{dir}
16576 @opindex iplugindir=
16577 Set the directory to search for plugins that are passed
16578 by @option{-fplugin=@var{name}} instead of
16579 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
16580 to be used by the user, but only passed by the driver.
16581
16582 @item -L@var{dir}
16583 @opindex L
16584 Add directory @var{dir} to the list of directories to be searched
16585 for @option{-l}.
16586
16587 @item -B@var{prefix}
16588 @opindex B
16589 This option specifies where to find the executables, libraries,
16590 include files, and data files of the compiler itself.
16591
16592 The compiler driver program runs one or more of the subprograms
16593 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
16594 @var{prefix} as a prefix for each program it tries to run, both with and
16595 without @samp{@var{machine}/@var{version}/} for the corresponding target
16596 machine and compiler version.
16597
16598 For each subprogram to be run, the compiler driver first tries the
16599 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
16600 is not specified, the driver tries two standard prefixes,
16601 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
16602 those results in a file name that is found, the unmodified program
16603 name is searched for using the directories specified in your
16604 @env{PATH} environment variable.
16605
16606 The compiler checks to see if the path provided by @option{-B}
16607 refers to a directory, and if necessary it adds a directory
16608 separator character at the end of the path.
16609
16610 @option{-B} prefixes that effectively specify directory names also apply
16611 to libraries in the linker, because the compiler translates these
16612 options into @option{-L} options for the linker. They also apply to
16613 include files in the preprocessor, because the compiler translates these
16614 options into @option{-isystem} options for the preprocessor. In this case,
16615 the compiler appends @samp{include} to the prefix.
16616
16617 The runtime support file @file{libgcc.a} can also be searched for using
16618 the @option{-B} prefix, if needed. If it is not found there, the two
16619 standard prefixes above are tried, and that is all. The file is left
16620 out of the link if it is not found by those means.
16621
16622 Another way to specify a prefix much like the @option{-B} prefix is to use
16623 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
16624 Variables}.
16625
16626 As a special kludge, if the path provided by @option{-B} is
16627 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
16628 9, then it is replaced by @file{[dir/]include}. This is to help
16629 with boot-strapping the compiler.
16630
16631 @item -no-canonical-prefixes
16632 @opindex no-canonical-prefixes
16633 Do not expand any symbolic links, resolve references to @samp{/../}
16634 or @samp{/./}, or make the path absolute when generating a relative
16635 prefix.
16636
16637 @item --sysroot=@var{dir}
16638 @opindex sysroot
16639 Use @var{dir} as the logical root directory for headers and libraries.
16640 For example, if the compiler normally searches for headers in
16641 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
16642 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
16643
16644 If you use both this option and the @option{-isysroot} option, then
16645 the @option{--sysroot} option applies to libraries, but the
16646 @option{-isysroot} option applies to header files.
16647
16648 The GNU linker (beginning with version 2.16) has the necessary support
16649 for this option. If your linker does not support this option, the
16650 header file aspect of @option{--sysroot} still works, but the
16651 library aspect does not.
16652
16653 @item --no-sysroot-suffix
16654 @opindex no-sysroot-suffix
16655 For some targets, a suffix is added to the root directory specified
16656 with @option{--sysroot}, depending on the other options used, so that
16657 headers may for example be found in
16658 @file{@var{dir}/@var{suffix}/usr/include} instead of
16659 @file{@var{dir}/usr/include}. This option disables the addition of
16660 such a suffix.
16661
16662 @end table
16663
16664 @node Code Gen Options
16665 @section Options for Code Generation Conventions
16666 @cindex code generation conventions
16667 @cindex options, code generation
16668 @cindex run-time options
16669
16670 These machine-independent options control the interface conventions
16671 used in code generation.
16672
16673 Most of them have both positive and negative forms; the negative form
16674 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
16675 one of the forms is listed---the one that is not the default. You
16676 can figure out the other form by either removing @samp{no-} or adding
16677 it.
16678
16679 @table @gcctabopt
16680 @item -fstack-reuse=@var{reuse-level}
16681 @opindex fstack_reuse
16682 This option controls stack space reuse for user declared local/auto variables
16683 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
16684 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
16685 local variables and temporaries, @samp{named_vars} enables the reuse only for
16686 user defined local variables with names, and @samp{none} disables stack reuse
16687 completely. The default value is @samp{all}. The option is needed when the
16688 program extends the lifetime of a scoped local variable or a compiler generated
16689 temporary beyond the end point defined by the language. When a lifetime of
16690 a variable ends, and if the variable lives in memory, the optimizing compiler
16691 has the freedom to reuse its stack space with other temporaries or scoped
16692 local variables whose live range does not overlap with it. Legacy code extending
16693 local lifetime is likely to break with the stack reuse optimization.
16694
16695 For example,
16696
16697 @smallexample
16698 int *p;
16699 @{
16700 int local1;
16701
16702 p = &local1;
16703 local1 = 10;
16704 ....
16705 @}
16706 @{
16707 int local2;
16708 local2 = 20;
16709 ...
16710 @}
16711
16712 if (*p == 10) // out of scope use of local1
16713 @{
16714
16715 @}
16716 @end smallexample
16717
16718 Another example:
16719 @smallexample
16720
16721 struct A
16722 @{
16723 A(int k) : i(k), j(k) @{ @}
16724 int i;
16725 int j;
16726 @};
16727
16728 A *ap;
16729
16730 void foo(const A& ar)
16731 @{
16732 ap = &ar;
16733 @}
16734
16735 void bar()
16736 @{
16737 foo(A(10)); // temp object's lifetime ends when foo returns
16738
16739 @{
16740 A a(20);
16741 ....
16742 @}
16743 ap->i+= 10; // ap references out of scope temp whose space
16744 // is reused with a. What is the value of ap->i?
16745 @}
16746
16747 @end smallexample
16748
16749 The lifetime of a compiler generated temporary is well defined by the C++
16750 standard. When a lifetime of a temporary ends, and if the temporary lives
16751 in memory, the optimizing compiler has the freedom to reuse its stack
16752 space with other temporaries or scoped local variables whose live range
16753 does not overlap with it. However some of the legacy code relies on
16754 the behavior of older compilers in which temporaries' stack space is
16755 not reused, the aggressive stack reuse can lead to runtime errors. This
16756 option is used to control the temporary stack reuse optimization.
16757
16758 @item -ftrapv
16759 @opindex ftrapv
16760 This option generates traps for signed overflow on addition, subtraction,
16761 multiplication operations.
16762 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16763 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16764 @option{-fwrapv} being effective. Note that only active options override, so
16765 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16766 results in @option{-ftrapv} being effective.
16767
16768 @item -fwrapv
16769 @opindex fwrapv
16770 This option instructs the compiler to assume that signed arithmetic
16771 overflow of addition, subtraction and multiplication wraps around
16772 using twos-complement representation. This flag enables some optimizations
16773 and disables others.
16774 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16775 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16776 @option{-fwrapv} being effective. Note that only active options override, so
16777 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16778 results in @option{-ftrapv} being effective.
16779
16780 @item -fwrapv-pointer
16781 @opindex fwrapv-pointer
16782 This option instructs the compiler to assume that pointer arithmetic
16783 overflow on addition and subtraction wraps around using twos-complement
16784 representation. This flag disables some optimizations which assume
16785 pointer overflow is invalid.
16786
16787 @item -fstrict-overflow
16788 @opindex fstrict-overflow
16789 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
16790 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
16791
16792 @item -fexceptions
16793 @opindex fexceptions
16794 Enable exception handling. Generates extra code needed to propagate
16795 exceptions. For some targets, this implies GCC generates frame
16796 unwind information for all functions, which can produce significant data
16797 size overhead, although it does not affect execution. If you do not
16798 specify this option, GCC enables it by default for languages like
16799 C++ that normally require exception handling, and disables it for
16800 languages like C that do not normally require it. However, you may need
16801 to enable this option when compiling C code that needs to interoperate
16802 properly with exception handlers written in C++. You may also wish to
16803 disable this option if you are compiling older C++ programs that don't
16804 use exception handling.
16805
16806 @item -fnon-call-exceptions
16807 @opindex fnon-call-exceptions
16808 Generate code that allows trapping instructions to throw exceptions.
16809 Note that this requires platform-specific runtime support that does
16810 not exist everywhere. Moreover, it only allows @emph{trapping}
16811 instructions to throw exceptions, i.e.@: memory references or floating-point
16812 instructions. It does not allow exceptions to be thrown from
16813 arbitrary signal handlers such as @code{SIGALRM}. This enables
16814 @option{-fexceptions}.
16815
16816 @item -fdelete-dead-exceptions
16817 @opindex fdelete-dead-exceptions
16818 Consider that instructions that may throw exceptions but don't otherwise
16819 contribute to the execution of the program can be optimized away.
16820 This does not affect calls to functions except those with the
16821 @code{pure} or @code{const} attributes.
16822 This option is enabled by default for the Ada and C++ compilers, as permitted by
16823 the language specifications.
16824 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
16825
16826 @item -funwind-tables
16827 @opindex funwind-tables
16828 Similar to @option{-fexceptions}, except that it just generates any needed
16829 static data, but does not affect the generated code in any other way.
16830 You normally do not need to enable this option; instead, a language processor
16831 that needs this handling enables it on your behalf.
16832
16833 @item -fasynchronous-unwind-tables
16834 @opindex fasynchronous-unwind-tables
16835 Generate unwind table in DWARF format, if supported by target machine. The
16836 table is exact at each instruction boundary, so it can be used for stack
16837 unwinding from asynchronous events (such as debugger or garbage collector).
16838
16839 @item -fno-gnu-unique
16840 @opindex fno-gnu-unique
16841 @opindex fgnu-unique
16842 On systems with recent GNU assembler and C library, the C++ compiler
16843 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
16844 of template static data members and static local variables in inline
16845 functions are unique even in the presence of @code{RTLD_LOCAL}; this
16846 is necessary to avoid problems with a library used by two different
16847 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
16848 therefore disagreeing with the other one about the binding of the
16849 symbol. But this causes @code{dlclose} to be ignored for affected
16850 DSOs; if your program relies on reinitialization of a DSO via
16851 @code{dlclose} and @code{dlopen}, you can use
16852 @option{-fno-gnu-unique}.
16853
16854 @item -fpcc-struct-return
16855 @opindex fpcc-struct-return
16856 Return ``short'' @code{struct} and @code{union} values in memory like
16857 longer ones, rather than in registers. This convention is less
16858 efficient, but it has the advantage of allowing intercallability between
16859 GCC-compiled files and files compiled with other compilers, particularly
16860 the Portable C Compiler (pcc).
16861
16862 The precise convention for returning structures in memory depends
16863 on the target configuration macros.
16864
16865 Short structures and unions are those whose size and alignment match
16866 that of some integer type.
16867
16868 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
16869 switch is not binary compatible with code compiled with the
16870 @option{-freg-struct-return} switch.
16871 Use it to conform to a non-default application binary interface.
16872
16873 @item -freg-struct-return
16874 @opindex freg-struct-return
16875 Return @code{struct} and @code{union} values in registers when possible.
16876 This is more efficient for small structures than
16877 @option{-fpcc-struct-return}.
16878
16879 If you specify neither @option{-fpcc-struct-return} nor
16880 @option{-freg-struct-return}, GCC defaults to whichever convention is
16881 standard for the target. If there is no standard convention, GCC
16882 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
16883 the principal compiler. In those cases, we can choose the standard, and
16884 we chose the more efficient register return alternative.
16885
16886 @strong{Warning:} code compiled with the @option{-freg-struct-return}
16887 switch is not binary compatible with code compiled with the
16888 @option{-fpcc-struct-return} switch.
16889 Use it to conform to a non-default application binary interface.
16890
16891 @item -fshort-enums
16892 @opindex fshort-enums
16893 Allocate to an @code{enum} type only as many bytes as it needs for the
16894 declared range of possible values. Specifically, the @code{enum} type
16895 is equivalent to the smallest integer type that has enough room.
16896
16897 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
16898 code that is not binary compatible with code generated without that switch.
16899 Use it to conform to a non-default application binary interface.
16900
16901 @item -fshort-wchar
16902 @opindex fshort-wchar
16903 Override the underlying type for @code{wchar_t} to be @code{short
16904 unsigned int} instead of the default for the target. This option is
16905 useful for building programs to run under WINE@.
16906
16907 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
16908 code that is not binary compatible with code generated without that switch.
16909 Use it to conform to a non-default application binary interface.
16910
16911 @item -fcommon
16912 @opindex fcommon
16913 @opindex fno-common
16914 @cindex tentative definitions
16915 In C code, this option controls the placement of global variables
16916 defined without an initializer, known as @dfn{tentative definitions}
16917 in the C standard. Tentative definitions are distinct from declarations
16918 of a variable with the @code{extern} keyword, which do not allocate storage.
16919
16920 The default is @option{-fno-common}, which specifies that the compiler places
16921 uninitialized global variables in the BSS section of the object file.
16922 This inhibits the merging of tentative definitions by the linker so you get a
16923 multiple-definition error if the same variable is accidentally defined in more
16924 than one compilation unit.
16925
16926 The @option{-fcommon} places uninitialized global variables in a common block.
16927 This allows the linker to resolve all tentative definitions of the same variable
16928 in different compilation units to the same object, or to a non-tentative
16929 definition. This behavior is inconsistent with C++, and on many targets implies
16930 a speed and code size penalty on global variable references. It is mainly
16931 useful to enable legacy code to link without errors.
16932
16933 @item -fno-ident
16934 @opindex fno-ident
16935 @opindex fident
16936 Ignore the @code{#ident} directive.
16937
16938 @item -finhibit-size-directive
16939 @opindex finhibit-size-directive
16940 Don't output a @code{.size} assembler directive, or anything else that
16941 would cause trouble if the function is split in the middle, and the
16942 two halves are placed at locations far apart in memory. This option is
16943 used when compiling @file{crtstuff.c}; you should not need to use it
16944 for anything else.
16945
16946 @item -fverbose-asm
16947 @opindex fverbose-asm
16948 Put extra commentary information in the generated assembly code to
16949 make it more readable. This option is generally only of use to those
16950 who actually need to read the generated assembly code (perhaps while
16951 debugging the compiler itself).
16952
16953 @option{-fno-verbose-asm}, the default, causes the
16954 extra information to be omitted and is useful when comparing two assembler
16955 files.
16956
16957 The added comments include:
16958
16959 @itemize @bullet
16960
16961 @item
16962 information on the compiler version and command-line options,
16963
16964 @item
16965 the source code lines associated with the assembly instructions,
16966 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16967
16968 @item
16969 hints on which high-level expressions correspond to
16970 the various assembly instruction operands.
16971
16972 @end itemize
16973
16974 For example, given this C source file:
16975
16976 @smallexample
16977 int test (int n)
16978 @{
16979 int i;
16980 int total = 0;
16981
16982 for (i = 0; i < n; i++)
16983 total += i * i;
16984
16985 return total;
16986 @}
16987 @end smallexample
16988
16989 compiling to (x86_64) assembly via @option{-S} and emitting the result
16990 direct to stdout via @option{-o} @option{-}
16991
16992 @smallexample
16993 gcc -S test.c -fverbose-asm -Os -o -
16994 @end smallexample
16995
16996 gives output similar to this:
16997
16998 @smallexample
16999 .file "test.c"
17000 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
17001 [...snip...]
17002 # options passed:
17003 [...snip...]
17004
17005 .text
17006 .globl test
17007 .type test, @@function
17008 test:
17009 .LFB0:
17010 .cfi_startproc
17011 # test.c:4: int total = 0;
17012 xorl %eax, %eax # <retval>
17013 # test.c:6: for (i = 0; i < n; i++)
17014 xorl %edx, %edx # i
17015 .L2:
17016 # test.c:6: for (i = 0; i < n; i++)
17017 cmpl %edi, %edx # n, i
17018 jge .L5 #,
17019 # test.c:7: total += i * i;
17020 movl %edx, %ecx # i, tmp92
17021 imull %edx, %ecx # i, tmp92
17022 # test.c:6: for (i = 0; i < n; i++)
17023 incl %edx # i
17024 # test.c:7: total += i * i;
17025 addl %ecx, %eax # tmp92, <retval>
17026 jmp .L2 #
17027 .L5:
17028 # test.c:10: @}
17029 ret
17030 .cfi_endproc
17031 .LFE0:
17032 .size test, .-test
17033 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
17034 .section .note.GNU-stack,"",@@progbits
17035 @end smallexample
17036
17037 The comments are intended for humans rather than machines and hence the
17038 precise format of the comments is subject to change.
17039
17040 @item -frecord-gcc-switches
17041 @opindex frecord-gcc-switches
17042 This switch causes the command line used to invoke the
17043 compiler to be recorded into the object file that is being created.
17044 This switch is only implemented on some targets and the exact format
17045 of the recording is target and binary file format dependent, but it
17046 usually takes the form of a section containing ASCII text. This
17047 switch is related to the @option{-fverbose-asm} switch, but that
17048 switch only records information in the assembler output file as
17049 comments, so it never reaches the object file.
17050 See also @option{-grecord-gcc-switches} for another
17051 way of storing compiler options into the object file.
17052
17053 @item -fpic
17054 @opindex fpic
17055 @cindex global offset table
17056 @cindex PIC
17057 Generate position-independent code (PIC) suitable for use in a shared
17058 library, if supported for the target machine. Such code accesses all
17059 constant addresses through a global offset table (GOT)@. The dynamic
17060 loader resolves the GOT entries when the program starts (the dynamic
17061 loader is not part of GCC; it is part of the operating system). If
17062 the GOT size for the linked executable exceeds a machine-specific
17063 maximum size, you get an error message from the linker indicating that
17064 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
17065 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
17066 on the m68k and RS/6000. The x86 has no such limit.)
17067
17068 Position-independent code requires special support, and therefore works
17069 only on certain machines. For the x86, GCC supports PIC for System V
17070 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
17071 position-independent.
17072
17073 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17074 are defined to 1.
17075
17076 @item -fPIC
17077 @opindex fPIC
17078 If supported for the target machine, emit position-independent code,
17079 suitable for dynamic linking and avoiding any limit on the size of the
17080 global offset table. This option makes a difference on AArch64, m68k,
17081 PowerPC and SPARC@.
17082
17083 Position-independent code requires special support, and therefore works
17084 only on certain machines.
17085
17086 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17087 are defined to 2.
17088
17089 @item -fpie
17090 @itemx -fPIE
17091 @opindex fpie
17092 @opindex fPIE
17093 These options are similar to @option{-fpic} and @option{-fPIC}, but the
17094 generated position-independent code can be only linked into executables.
17095 Usually these options are used to compile code that will be linked using
17096 the @option{-pie} GCC option.
17097
17098 @option{-fpie} and @option{-fPIE} both define the macros
17099 @code{__pie__} and @code{__PIE__}. The macros have the value 1
17100 for @option{-fpie} and 2 for @option{-fPIE}.
17101
17102 @item -fno-plt
17103 @opindex fno-plt
17104 @opindex fplt
17105 Do not use the PLT for external function calls in position-independent code.
17106 Instead, load the callee address at call sites from the GOT and branch to it.
17107 This leads to more efficient code by eliminating PLT stubs and exposing
17108 GOT loads to optimizations. On architectures such as 32-bit x86 where
17109 PLT stubs expect the GOT pointer in a specific register, this gives more
17110 register allocation freedom to the compiler.
17111 Lazy binding requires use of the PLT;
17112 with @option{-fno-plt} all external symbols are resolved at load time.
17113
17114 Alternatively, the function attribute @code{noplt} can be used to avoid calls
17115 through the PLT for specific external functions.
17116
17117 In position-dependent code, a few targets also convert calls to
17118 functions that are marked to not use the PLT to use the GOT instead.
17119
17120 @item -fno-jump-tables
17121 @opindex fno-jump-tables
17122 @opindex fjump-tables
17123 Do not use jump tables for switch statements even where it would be
17124 more efficient than other code generation strategies. This option is
17125 of use in conjunction with @option{-fpic} or @option{-fPIC} for
17126 building code that forms part of a dynamic linker and cannot
17127 reference the address of a jump table. On some targets, jump tables
17128 do not require a GOT and this option is not needed.
17129
17130 @item -fno-bit-tests
17131 @opindex fno-bit-tests
17132 @opindex fbit-tests
17133 Do not use bit tests for switch statements even where it would be
17134 more efficient than other code generation strategies.
17135
17136 @item -ffixed-@var{reg}
17137 @opindex ffixed
17138 Treat the register named @var{reg} as a fixed register; generated code
17139 should never refer to it (except perhaps as a stack pointer, frame
17140 pointer or in some other fixed role).
17141
17142 @var{reg} must be the name of a register. The register names accepted
17143 are machine-specific and are defined in the @code{REGISTER_NAMES}
17144 macro in the machine description macro file.
17145
17146 This flag does not have a negative form, because it specifies a
17147 three-way choice.
17148
17149 @item -fcall-used-@var{reg}
17150 @opindex fcall-used
17151 Treat the register named @var{reg} as an allocable register that is
17152 clobbered by function calls. It may be allocated for temporaries or
17153 variables that do not live across a call. Functions compiled this way
17154 do not save and restore the register @var{reg}.
17155
17156 It is an error to use this flag with the frame pointer or stack pointer.
17157 Use of this flag for other registers that have fixed pervasive roles in
17158 the machine's execution model produces disastrous results.
17159
17160 This flag does not have a negative form, because it specifies a
17161 three-way choice.
17162
17163 @item -fcall-saved-@var{reg}
17164 @opindex fcall-saved
17165 Treat the register named @var{reg} as an allocable register saved by
17166 functions. It may be allocated even for temporaries or variables that
17167 live across a call. Functions compiled this way save and restore
17168 the register @var{reg} if they use it.
17169
17170 It is an error to use this flag with the frame pointer or stack pointer.
17171 Use of this flag for other registers that have fixed pervasive roles in
17172 the machine's execution model produces disastrous results.
17173
17174 A different sort of disaster results from the use of this flag for
17175 a register in which function values may be returned.
17176
17177 This flag does not have a negative form, because it specifies a
17178 three-way choice.
17179
17180 @item -fpack-struct[=@var{n}]
17181 @opindex fpack-struct
17182 Without a value specified, pack all structure members together without
17183 holes. When a value is specified (which must be a small power of two), pack
17184 structure members according to this value, representing the maximum
17185 alignment (that is, objects with default alignment requirements larger than
17186 this are output potentially unaligned at the next fitting location.
17187
17188 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
17189 code that is not binary compatible with code generated without that switch.
17190 Additionally, it makes the code suboptimal.
17191 Use it to conform to a non-default application binary interface.
17192
17193 @item -fleading-underscore
17194 @opindex fleading-underscore
17195 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
17196 change the way C symbols are represented in the object file. One use
17197 is to help link with legacy assembly code.
17198
17199 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
17200 generate code that is not binary compatible with code generated without that
17201 switch. Use it to conform to a non-default application binary interface.
17202 Not all targets provide complete support for this switch.
17203
17204 @item -ftls-model=@var{model}
17205 @opindex ftls-model
17206 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
17207 The @var{model} argument should be one of @samp{global-dynamic},
17208 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
17209 Note that the choice is subject to optimization: the compiler may use
17210 a more efficient model for symbols not visible outside of the translation
17211 unit, or if @option{-fpic} is not given on the command line.
17212
17213 The default without @option{-fpic} is @samp{initial-exec}; with
17214 @option{-fpic} the default is @samp{global-dynamic}.
17215
17216 @item -ftrampolines
17217 @opindex ftrampolines
17218 For targets that normally need trampolines for nested functions, always
17219 generate them instead of using descriptors. Otherwise, for targets that
17220 do not need them, like for example HP-PA or IA-64, do nothing.
17221
17222 A trampoline is a small piece of code that is created at run time on the
17223 stack when the address of a nested function is taken, and is used to call
17224 the nested function indirectly. Therefore, it requires the stack to be
17225 made executable in order for the program to work properly.
17226
17227 @option{-fno-trampolines} is enabled by default on a language by language
17228 basis to let the compiler avoid generating them, if it computes that this
17229 is safe, and replace them with descriptors. Descriptors are made up of data
17230 only, but the generated code must be prepared to deal with them. As of this
17231 writing, @option{-fno-trampolines} is enabled by default only for Ada.
17232
17233 Moreover, code compiled with @option{-ftrampolines} and code compiled with
17234 @option{-fno-trampolines} are not binary compatible if nested functions are
17235 present. This option must therefore be used on a program-wide basis and be
17236 manipulated with extreme care.
17237
17238 For languages other than Ada, the @code{-ftrampolines} and
17239 @code{-fno-trampolines} options currently have no effect, and
17240 trampolines are always generated on platforms that need them
17241 for nested functions.
17242
17243 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
17244 @opindex fvisibility
17245 Set the default ELF image symbol visibility to the specified option---all
17246 symbols are marked with this unless overridden within the code.
17247 Using this feature can very substantially improve linking and
17248 load times of shared object libraries, produce more optimized
17249 code, provide near-perfect API export and prevent symbol clashes.
17250 It is @strong{strongly} recommended that you use this in any shared objects
17251 you distribute.
17252
17253 Despite the nomenclature, @samp{default} always means public; i.e.,
17254 available to be linked against from outside the shared object.
17255 @samp{protected} and @samp{internal} are pretty useless in real-world
17256 usage so the only other commonly used option is @samp{hidden}.
17257 The default if @option{-fvisibility} isn't specified is
17258 @samp{default}, i.e., make every symbol public.
17259
17260 A good explanation of the benefits offered by ensuring ELF
17261 symbols have the correct visibility is given by ``How To Write
17262 Shared Libraries'' by Ulrich Drepper (which can be found at
17263 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
17264 solution made possible by this option to marking things hidden when
17265 the default is public is to make the default hidden and mark things
17266 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
17267 and @code{__attribute__ ((visibility("default")))} instead of
17268 @code{__declspec(dllexport)} you get almost identical semantics with
17269 identical syntax. This is a great boon to those working with
17270 cross-platform projects.
17271
17272 For those adding visibility support to existing code, you may find
17273 @code{#pragma GCC visibility} of use. This works by you enclosing
17274 the declarations you wish to set visibility for with (for example)
17275 @code{#pragma GCC visibility push(hidden)} and
17276 @code{#pragma GCC visibility pop}.
17277 Bear in mind that symbol visibility should be viewed @strong{as
17278 part of the API interface contract} and thus all new code should
17279 always specify visibility when it is not the default; i.e., declarations
17280 only for use within the local DSO should @strong{always} be marked explicitly
17281 as hidden as so to avoid PLT indirection overheads---making this
17282 abundantly clear also aids readability and self-documentation of the code.
17283 Note that due to ISO C++ specification requirements, @code{operator new} and
17284 @code{operator delete} must always be of default visibility.
17285
17286 Be aware that headers from outside your project, in particular system
17287 headers and headers from any other library you use, may not be
17288 expecting to be compiled with visibility other than the default. You
17289 may need to explicitly say @code{#pragma GCC visibility push(default)}
17290 before including any such headers.
17291
17292 @code{extern} declarations are not affected by @option{-fvisibility}, so
17293 a lot of code can be recompiled with @option{-fvisibility=hidden} with
17294 no modifications. However, this means that calls to @code{extern}
17295 functions with no explicit visibility use the PLT, so it is more
17296 effective to use @code{__attribute ((visibility))} and/or
17297 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
17298 declarations should be treated as hidden.
17299
17300 Note that @option{-fvisibility} does affect C++ vague linkage
17301 entities. This means that, for instance, an exception class that is
17302 be thrown between DSOs must be explicitly marked with default
17303 visibility so that the @samp{type_info} nodes are unified between
17304 the DSOs.
17305
17306 An overview of these techniques, their benefits and how to use them
17307 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
17308
17309 @item -fstrict-volatile-bitfields
17310 @opindex fstrict-volatile-bitfields
17311 This option should be used if accesses to volatile bit-fields (or other
17312 structure fields, although the compiler usually honors those types
17313 anyway) should use a single access of the width of the
17314 field's type, aligned to a natural alignment if possible. For
17315 example, targets with memory-mapped peripheral registers might require
17316 all such accesses to be 16 bits wide; with this flag you can
17317 declare all peripheral bit-fields as @code{unsigned short} (assuming short
17318 is 16 bits on these targets) to force GCC to use 16-bit accesses
17319 instead of, perhaps, a more efficient 32-bit access.
17320
17321 If this option is disabled, the compiler uses the most efficient
17322 instruction. In the previous example, that might be a 32-bit load
17323 instruction, even though that accesses bytes that do not contain
17324 any portion of the bit-field, or memory-mapped registers unrelated to
17325 the one being updated.
17326
17327 In some cases, such as when the @code{packed} attribute is applied to a
17328 structure field, it may not be possible to access the field with a single
17329 read or write that is correctly aligned for the target machine. In this
17330 case GCC falls back to generating multiple accesses rather than code that
17331 will fault or truncate the result at run time.
17332
17333 Note: Due to restrictions of the C/C++11 memory model, write accesses are
17334 not allowed to touch non bit-field members. It is therefore recommended
17335 to define all bits of the field's type as bit-field members.
17336
17337 The default value of this option is determined by the application binary
17338 interface for the target processor.
17339
17340 @item -fsync-libcalls
17341 @opindex fsync-libcalls
17342 This option controls whether any out-of-line instance of the @code{__sync}
17343 family of functions may be used to implement the C++11 @code{__atomic}
17344 family of functions.
17345
17346 The default value of this option is enabled, thus the only useful form
17347 of the option is @option{-fno-sync-libcalls}. This option is used in
17348 the implementation of the @file{libatomic} runtime library.
17349
17350 @end table
17351
17352 @node Developer Options
17353 @section GCC Developer Options
17354 @cindex developer options
17355 @cindex debugging GCC
17356 @cindex debug dump options
17357 @cindex dump options
17358 @cindex compilation statistics
17359
17360 This section describes command-line options that are primarily of
17361 interest to GCC developers, including options to support compiler
17362 testing and investigation of compiler bugs and compile-time
17363 performance problems. This includes options that produce debug dumps
17364 at various points in the compilation; that print statistics such as
17365 memory use and execution time; and that print information about GCC's
17366 configuration, such as where it searches for libraries. You should
17367 rarely need to use any of these options for ordinary compilation and
17368 linking tasks.
17369
17370 Many developer options that cause GCC to dump output to a file take an
17371 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
17372 or @samp{-} to dump to standard output, and @samp{stderr} for standard
17373 error.
17374
17375 If @samp{=@var{filename}} is omitted, a default dump file name is
17376 constructed by concatenating the base dump file name, a pass number,
17377 phase letter, and pass name. The base dump file name is the name of
17378 output file produced by the compiler if explicitly specified and not
17379 an executable; otherwise it is the source file name.
17380 The pass number is determined by the order passes are registered with
17381 the compiler's pass manager.
17382 This is generally the same as the order of execution, but passes
17383 registered by plugins, target-specific passes, or passes that are
17384 otherwise registered late are numbered higher than the pass named
17385 @samp{final}, even if they are executed earlier. The phase letter is
17386 one of @samp{i} (inter-procedural analysis), @samp{l}
17387 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
17388 The files are created in the directory of the output file.
17389
17390 @table @gcctabopt
17391
17392 @item -fcallgraph-info
17393 @itemx -fcallgraph-info=@var{MARKERS}
17394 @opindex fcallgraph-info
17395 Makes the compiler output callgraph information for the program, on a
17396 per-object-file basis. The information is generated in the common VCG
17397 format. It can be decorated with additional, per-node and/or per-edge
17398 information, if a list of comma-separated markers is additionally
17399 specified. When the @code{su} marker is specified, the callgraph is
17400 decorated with stack usage information; it is equivalent to
17401 @option{-fstack-usage}. When the @code{da} marker is specified, the
17402 callgraph is decorated with information about dynamically allocated
17403 objects.
17404
17405 When compiling with @option{-flto}, no callgraph information is output
17406 along with the object file. At LTO link time, @option{-fcallgraph-info}
17407 may generate multiple callgraph information files next to intermediate
17408 LTO output files.
17409
17410 @item -d@var{letters}
17411 @itemx -fdump-rtl-@var{pass}
17412 @itemx -fdump-rtl-@var{pass}=@var{filename}
17413 @opindex d
17414 @opindex fdump-rtl-@var{pass}
17415 Says to make debugging dumps during compilation at times specified by
17416 @var{letters}. This is used for debugging the RTL-based passes of the
17417 compiler.
17418
17419 Some @option{-d@var{letters}} switches have different meaning when
17420 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
17421 for information about preprocessor-specific dump options.
17422
17423 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
17424 @option{-d} option @var{letters}. Here are the possible
17425 letters for use in @var{pass} and @var{letters}, and their meanings:
17426
17427 @table @gcctabopt
17428
17429 @item -fdump-rtl-alignments
17430 @opindex fdump-rtl-alignments
17431 Dump after branch alignments have been computed.
17432
17433 @item -fdump-rtl-asmcons
17434 @opindex fdump-rtl-asmcons
17435 Dump after fixing rtl statements that have unsatisfied in/out constraints.
17436
17437 @item -fdump-rtl-auto_inc_dec
17438 @opindex fdump-rtl-auto_inc_dec
17439 Dump after auto-inc-dec discovery. This pass is only run on
17440 architectures that have auto inc or auto dec instructions.
17441
17442 @item -fdump-rtl-barriers
17443 @opindex fdump-rtl-barriers
17444 Dump after cleaning up the barrier instructions.
17445
17446 @item -fdump-rtl-bbpart
17447 @opindex fdump-rtl-bbpart
17448 Dump after partitioning hot and cold basic blocks.
17449
17450 @item -fdump-rtl-bbro
17451 @opindex fdump-rtl-bbro
17452 Dump after block reordering.
17453
17454 @item -fdump-rtl-btl1
17455 @itemx -fdump-rtl-btl2
17456 @opindex fdump-rtl-btl2
17457 @opindex fdump-rtl-btl2
17458 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
17459 after the two branch
17460 target load optimization passes.
17461
17462 @item -fdump-rtl-bypass
17463 @opindex fdump-rtl-bypass
17464 Dump after jump bypassing and control flow optimizations.
17465
17466 @item -fdump-rtl-combine
17467 @opindex fdump-rtl-combine
17468 Dump after the RTL instruction combination pass.
17469
17470 @item -fdump-rtl-compgotos
17471 @opindex fdump-rtl-compgotos
17472 Dump after duplicating the computed gotos.
17473
17474 @item -fdump-rtl-ce1
17475 @itemx -fdump-rtl-ce2
17476 @itemx -fdump-rtl-ce3
17477 @opindex fdump-rtl-ce1
17478 @opindex fdump-rtl-ce2
17479 @opindex fdump-rtl-ce3
17480 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
17481 @option{-fdump-rtl-ce3} enable dumping after the three
17482 if conversion passes.
17483
17484 @item -fdump-rtl-cprop_hardreg
17485 @opindex fdump-rtl-cprop_hardreg
17486 Dump after hard register copy propagation.
17487
17488 @item -fdump-rtl-csa
17489 @opindex fdump-rtl-csa
17490 Dump after combining stack adjustments.
17491
17492 @item -fdump-rtl-cse1
17493 @itemx -fdump-rtl-cse2
17494 @opindex fdump-rtl-cse1
17495 @opindex fdump-rtl-cse2
17496 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
17497 the two common subexpression elimination passes.
17498
17499 @item -fdump-rtl-dce
17500 @opindex fdump-rtl-dce
17501 Dump after the standalone dead code elimination passes.
17502
17503 @item -fdump-rtl-dbr
17504 @opindex fdump-rtl-dbr
17505 Dump after delayed branch scheduling.
17506
17507 @item -fdump-rtl-dce1
17508 @itemx -fdump-rtl-dce2
17509 @opindex fdump-rtl-dce1
17510 @opindex fdump-rtl-dce2
17511 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
17512 the two dead store elimination passes.
17513
17514 @item -fdump-rtl-eh
17515 @opindex fdump-rtl-eh
17516 Dump after finalization of EH handling code.
17517
17518 @item -fdump-rtl-eh_ranges
17519 @opindex fdump-rtl-eh_ranges
17520 Dump after conversion of EH handling range regions.
17521
17522 @item -fdump-rtl-expand
17523 @opindex fdump-rtl-expand
17524 Dump after RTL generation.
17525
17526 @item -fdump-rtl-fwprop1
17527 @itemx -fdump-rtl-fwprop2
17528 @opindex fdump-rtl-fwprop1
17529 @opindex fdump-rtl-fwprop2
17530 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
17531 dumping after the two forward propagation passes.
17532
17533 @item -fdump-rtl-gcse1
17534 @itemx -fdump-rtl-gcse2
17535 @opindex fdump-rtl-gcse1
17536 @opindex fdump-rtl-gcse2
17537 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
17538 after global common subexpression elimination.
17539
17540 @item -fdump-rtl-init-regs
17541 @opindex fdump-rtl-init-regs
17542 Dump after the initialization of the registers.
17543
17544 @item -fdump-rtl-initvals
17545 @opindex fdump-rtl-initvals
17546 Dump after the computation of the initial value sets.
17547
17548 @item -fdump-rtl-into_cfglayout
17549 @opindex fdump-rtl-into_cfglayout
17550 Dump after converting to cfglayout mode.
17551
17552 @item -fdump-rtl-ira
17553 @opindex fdump-rtl-ira
17554 Dump after iterated register allocation.
17555
17556 @item -fdump-rtl-jump
17557 @opindex fdump-rtl-jump
17558 Dump after the second jump optimization.
17559
17560 @item -fdump-rtl-loop2
17561 @opindex fdump-rtl-loop2
17562 @option{-fdump-rtl-loop2} enables dumping after the rtl
17563 loop optimization passes.
17564
17565 @item -fdump-rtl-mach
17566 @opindex fdump-rtl-mach
17567 Dump after performing the machine dependent reorganization pass, if that
17568 pass exists.
17569
17570 @item -fdump-rtl-mode_sw
17571 @opindex fdump-rtl-mode_sw
17572 Dump after removing redundant mode switches.
17573
17574 @item -fdump-rtl-rnreg
17575 @opindex fdump-rtl-rnreg
17576 Dump after register renumbering.
17577
17578 @item -fdump-rtl-outof_cfglayout
17579 @opindex fdump-rtl-outof_cfglayout
17580 Dump after converting from cfglayout mode.
17581
17582 @item -fdump-rtl-peephole2
17583 @opindex fdump-rtl-peephole2
17584 Dump after the peephole pass.
17585
17586 @item -fdump-rtl-postreload
17587 @opindex fdump-rtl-postreload
17588 Dump after post-reload optimizations.
17589
17590 @item -fdump-rtl-pro_and_epilogue
17591 @opindex fdump-rtl-pro_and_epilogue
17592 Dump after generating the function prologues and epilogues.
17593
17594 @item -fdump-rtl-sched1
17595 @itemx -fdump-rtl-sched2
17596 @opindex fdump-rtl-sched1
17597 @opindex fdump-rtl-sched2
17598 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
17599 after the basic block scheduling passes.
17600
17601 @item -fdump-rtl-ree
17602 @opindex fdump-rtl-ree
17603 Dump after sign/zero extension elimination.
17604
17605 @item -fdump-rtl-seqabstr
17606 @opindex fdump-rtl-seqabstr
17607 Dump after common sequence discovery.
17608
17609 @item -fdump-rtl-shorten
17610 @opindex fdump-rtl-shorten
17611 Dump after shortening branches.
17612
17613 @item -fdump-rtl-sibling
17614 @opindex fdump-rtl-sibling
17615 Dump after sibling call optimizations.
17616
17617 @item -fdump-rtl-split1
17618 @itemx -fdump-rtl-split2
17619 @itemx -fdump-rtl-split3
17620 @itemx -fdump-rtl-split4
17621 @itemx -fdump-rtl-split5
17622 @opindex fdump-rtl-split1
17623 @opindex fdump-rtl-split2
17624 @opindex fdump-rtl-split3
17625 @opindex fdump-rtl-split4
17626 @opindex fdump-rtl-split5
17627 These options enable dumping after five rounds of
17628 instruction splitting.
17629
17630 @item -fdump-rtl-sms
17631 @opindex fdump-rtl-sms
17632 Dump after modulo scheduling. This pass is only run on some
17633 architectures.
17634
17635 @item -fdump-rtl-stack
17636 @opindex fdump-rtl-stack
17637 Dump after conversion from GCC's ``flat register file'' registers to the
17638 x87's stack-like registers. This pass is only run on x86 variants.
17639
17640 @item -fdump-rtl-subreg1
17641 @itemx -fdump-rtl-subreg2
17642 @opindex fdump-rtl-subreg1
17643 @opindex fdump-rtl-subreg2
17644 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
17645 the two subreg expansion passes.
17646
17647 @item -fdump-rtl-unshare
17648 @opindex fdump-rtl-unshare
17649 Dump after all rtl has been unshared.
17650
17651 @item -fdump-rtl-vartrack
17652 @opindex fdump-rtl-vartrack
17653 Dump after variable tracking.
17654
17655 @item -fdump-rtl-vregs
17656 @opindex fdump-rtl-vregs
17657 Dump after converting virtual registers to hard registers.
17658
17659 @item -fdump-rtl-web
17660 @opindex fdump-rtl-web
17661 Dump after live range splitting.
17662
17663 @item -fdump-rtl-regclass
17664 @itemx -fdump-rtl-subregs_of_mode_init
17665 @itemx -fdump-rtl-subregs_of_mode_finish
17666 @itemx -fdump-rtl-dfinit
17667 @itemx -fdump-rtl-dfinish
17668 @opindex fdump-rtl-regclass
17669 @opindex fdump-rtl-subregs_of_mode_init
17670 @opindex fdump-rtl-subregs_of_mode_finish
17671 @opindex fdump-rtl-dfinit
17672 @opindex fdump-rtl-dfinish
17673 These dumps are defined but always produce empty files.
17674
17675 @item -da
17676 @itemx -fdump-rtl-all
17677 @opindex da
17678 @opindex fdump-rtl-all
17679 Produce all the dumps listed above.
17680
17681 @item -dA
17682 @opindex dA
17683 Annotate the assembler output with miscellaneous debugging information.
17684
17685 @item -dD
17686 @opindex dD
17687 Dump all macro definitions, at the end of preprocessing, in addition to
17688 normal output.
17689
17690 @item -dH
17691 @opindex dH
17692 Produce a core dump whenever an error occurs.
17693
17694 @item -dp
17695 @opindex dp
17696 Annotate the assembler output with a comment indicating which
17697 pattern and alternative is used. The length and cost of each instruction are
17698 also printed.
17699
17700 @item -dP
17701 @opindex dP
17702 Dump the RTL in the assembler output as a comment before each instruction.
17703 Also turns on @option{-dp} annotation.
17704
17705 @item -dx
17706 @opindex dx
17707 Just generate RTL for a function instead of compiling it. Usually used
17708 with @option{-fdump-rtl-expand}.
17709 @end table
17710
17711 @item -fdump-debug
17712 @opindex fdump-debug
17713 Dump debugging information generated during the debug
17714 generation phase.
17715
17716 @item -fdump-earlydebug
17717 @opindex fdump-earlydebug
17718 Dump debugging information generated during the early debug
17719 generation phase.
17720
17721 @item -fdump-noaddr
17722 @opindex fdump-noaddr
17723 When doing debugging dumps, suppress address output. This makes it more
17724 feasible to use diff on debugging dumps for compiler invocations with
17725 different compiler binaries and/or different
17726 text / bss / data / heap / stack / dso start locations.
17727
17728 @item -freport-bug
17729 @opindex freport-bug
17730 Collect and dump debug information into a temporary file if an
17731 internal compiler error (ICE) occurs.
17732
17733 @item -fdump-unnumbered
17734 @opindex fdump-unnumbered
17735 When doing debugging dumps, suppress instruction numbers and address output.
17736 This makes it more feasible to use diff on debugging dumps for compiler
17737 invocations with different options, in particular with and without
17738 @option{-g}.
17739
17740 @item -fdump-unnumbered-links
17741 @opindex fdump-unnumbered-links
17742 When doing debugging dumps (see @option{-d} option above), suppress
17743 instruction numbers for the links to the previous and next instructions
17744 in a sequence.
17745
17746 @item -fdump-ipa-@var{switch}
17747 @itemx -fdump-ipa-@var{switch}-@var{options}
17748 @opindex fdump-ipa
17749 Control the dumping at various stages of inter-procedural analysis
17750 language tree to a file. The file name is generated by appending a
17751 switch specific suffix to the source file name, and the file is created
17752 in the same directory as the output file. The following dumps are
17753 possible:
17754
17755 @table @samp
17756 @item all
17757 Enables all inter-procedural analysis dumps.
17758
17759 @item cgraph
17760 Dumps information about call-graph optimization, unused function removal,
17761 and inlining decisions.
17762
17763 @item inline
17764 Dump after function inlining.
17765
17766 @end table
17767
17768 Additionally, the options @option{-optimized}, @option{-missed},
17769 @option{-note}, and @option{-all} can be provided, with the same meaning
17770 as for @option{-fopt-info}, defaulting to @option{-optimized}.
17771
17772 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
17773 information on callsites that were inlined, along with callsites
17774 that were not inlined.
17775
17776 By default, the dump will contain messages about successful
17777 optimizations (equivalent to @option{-optimized}) together with
17778 low-level details about the analysis.
17779
17780 @item -fdump-lang
17781 @opindex fdump-lang
17782 Dump language-specific information. The file name is made by appending
17783 @file{.lang} to the source file name.
17784
17785 @item -fdump-lang-all
17786 @itemx -fdump-lang-@var{switch}
17787 @itemx -fdump-lang-@var{switch}-@var{options}
17788 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
17789 @opindex fdump-lang-all
17790 @opindex fdump-lang
17791 Control the dumping of language-specific information. The @var{options}
17792 and @var{filename} portions behave as described in the
17793 @option{-fdump-tree} option. The following @var{switch} values are
17794 accepted:
17795
17796 @table @samp
17797 @item all
17798
17799 Enable all language-specific dumps.
17800
17801 @item class
17802 Dump class hierarchy information. Virtual table information is emitted
17803 unless '@option{slim}' is specified. This option is applicable to C++ only.
17804
17805 @item module
17806 Dump module information. Options @option{lineno} (locations),
17807 @option{graph} (reachability), @option{blocks} (clusters),
17808 @option{uid} (serialization), @option{alias} (mergeable),
17809 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
17810 (macros) may provide additional information. This option is
17811 applicable to C++ only.
17812
17813 @item raw
17814 Dump the raw internal tree data. This option is applicable to C++ only.
17815
17816 @end table
17817
17818 @item -fdump-passes
17819 @opindex fdump-passes
17820 Print on @file{stderr} the list of optimization passes that are turned
17821 on and off by the current command-line options.
17822
17823 @item -fdump-statistics-@var{option}
17824 @opindex fdump-statistics
17825 Enable and control dumping of pass statistics in a separate file. The
17826 file name is generated by appending a suffix ending in
17827 @samp{.statistics} to the source file name, and the file is created in
17828 the same directory as the output file. If the @samp{-@var{option}}
17829 form is used, @samp{-stats} causes counters to be summed over the
17830 whole compilation unit while @samp{-details} dumps every event as
17831 the passes generate them. The default with no option is to sum
17832 counters for each function compiled.
17833
17834 @item -fdump-tree-all
17835 @itemx -fdump-tree-@var{switch}
17836 @itemx -fdump-tree-@var{switch}-@var{options}
17837 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
17838 @opindex fdump-tree-all
17839 @opindex fdump-tree
17840 Control the dumping at various stages of processing the intermediate
17841 language tree to a file. If the @samp{-@var{options}}
17842 form is used, @var{options} is a list of @samp{-} separated options
17843 which control the details of the dump. Not all options are applicable
17844 to all dumps; those that are not meaningful are ignored. The
17845 following options are available
17846
17847 @table @samp
17848 @item address
17849 Print the address of each node. Usually this is not meaningful as it
17850 changes according to the environment and source file. Its primary use
17851 is for tying up a dump file with a debug environment.
17852 @item asmname
17853 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
17854 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
17855 use working backward from mangled names in the assembly file.
17856 @item slim
17857 When dumping front-end intermediate representations, inhibit dumping
17858 of members of a scope or body of a function merely because that scope
17859 has been reached. Only dump such items when they are directly reachable
17860 by some other path.
17861
17862 When dumping pretty-printed trees, this option inhibits dumping the
17863 bodies of control structures.
17864
17865 When dumping RTL, print the RTL in slim (condensed) form instead of
17866 the default LISP-like representation.
17867 @item raw
17868 Print a raw representation of the tree. By default, trees are
17869 pretty-printed into a C-like representation.
17870 @item details
17871 Enable more detailed dumps (not honored by every dump option). Also
17872 include information from the optimization passes.
17873 @item stats
17874 Enable dumping various statistics about the pass (not honored by every dump
17875 option).
17876 @item blocks
17877 Enable showing basic block boundaries (disabled in raw dumps).
17878 @item graph
17879 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
17880 dump a representation of the control flow graph suitable for viewing with
17881 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
17882 the file is pretty-printed as a subgraph, so that GraphViz can render them
17883 all in a single plot.
17884
17885 This option currently only works for RTL dumps, and the RTL is always
17886 dumped in slim form.
17887 @item vops
17888 Enable showing virtual operands for every statement.
17889 @item lineno
17890 Enable showing line numbers for statements.
17891 @item uid
17892 Enable showing the unique ID (@code{DECL_UID}) for each variable.
17893 @item verbose
17894 Enable showing the tree dump for each statement.
17895 @item eh
17896 Enable showing the EH region number holding each statement.
17897 @item scev
17898 Enable showing scalar evolution analysis details.
17899 @item optimized
17900 Enable showing optimization information (only available in certain
17901 passes).
17902 @item missed
17903 Enable showing missed optimization information (only available in certain
17904 passes).
17905 @item note
17906 Enable other detailed optimization information (only available in
17907 certain passes).
17908 @item all
17909 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
17910 and @option{lineno}.
17911 @item optall
17912 Turn on all optimization options, i.e., @option{optimized},
17913 @option{missed}, and @option{note}.
17914 @end table
17915
17916 To determine what tree dumps are available or find the dump for a pass
17917 of interest follow the steps below.
17918
17919 @enumerate
17920 @item
17921 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
17922 look for a code that corresponds to the pass you are interested in.
17923 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
17924 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
17925 The number at the end distinguishes distinct invocations of the same pass.
17926 @item
17927 To enable the creation of the dump file, append the pass code to
17928 the @option{-fdump-} option prefix and invoke GCC with it. For example,
17929 to enable the dump from the Early Value Range Propagation pass, invoke
17930 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
17931 specify the name of the dump file. If you don't specify one, GCC
17932 creates as described below.
17933 @item
17934 Find the pass dump in a file whose name is composed of three components
17935 separated by a period: the name of the source file GCC was invoked to
17936 compile, a numeric suffix indicating the pass number followed by the
17937 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
17938 and finally the pass code. For example, the Early VRP pass dump might
17939 be in a file named @file{myfile.c.038t.evrp} in the current working
17940 directory. Note that the numeric codes are not stable and may change
17941 from one version of GCC to another.
17942 @end enumerate
17943
17944 @item -fopt-info
17945 @itemx -fopt-info-@var{options}
17946 @itemx -fopt-info-@var{options}=@var{filename}
17947 @opindex fopt-info
17948 Controls optimization dumps from various optimization passes. If the
17949 @samp{-@var{options}} form is used, @var{options} is a list of
17950 @samp{-} separated option keywords to select the dump details and
17951 optimizations.
17952
17953 The @var{options} can be divided into three groups:
17954 @enumerate
17955 @item
17956 options describing what kinds of messages should be emitted,
17957 @item
17958 options describing the verbosity of the dump, and
17959 @item
17960 options describing which optimizations should be included.
17961 @end enumerate
17962 The options from each group can be freely mixed as they are
17963 non-overlapping. However, in case of any conflicts,
17964 the later options override the earlier options on the command
17965 line.
17966
17967 The following options control which kinds of messages should be emitted:
17968
17969 @table @samp
17970 @item optimized
17971 Print information when an optimization is successfully applied. It is
17972 up to a pass to decide which information is relevant. For example, the
17973 vectorizer passes print the source location of loops which are
17974 successfully vectorized.
17975 @item missed
17976 Print information about missed optimizations. Individual passes
17977 control which information to include in the output.
17978 @item note
17979 Print verbose information about optimizations, such as certain
17980 transformations, more detailed messages about decisions etc.
17981 @item all
17982 Print detailed optimization information. This includes
17983 @samp{optimized}, @samp{missed}, and @samp{note}.
17984 @end table
17985
17986 The following option controls the dump verbosity:
17987
17988 @table @samp
17989 @item internals
17990 By default, only ``high-level'' messages are emitted. This option enables
17991 additional, more detailed, messages, which are likely to only be of interest
17992 to GCC developers.
17993 @end table
17994
17995 One or more of the following option keywords can be used to describe a
17996 group of optimizations:
17997
17998 @table @samp
17999 @item ipa
18000 Enable dumps from all interprocedural optimizations.
18001 @item loop
18002 Enable dumps from all loop optimizations.
18003 @item inline
18004 Enable dumps from all inlining optimizations.
18005 @item omp
18006 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
18007 @item vec
18008 Enable dumps from all vectorization optimizations.
18009 @item optall
18010 Enable dumps from all optimizations. This is a superset of
18011 the optimization groups listed above.
18012 @end table
18013
18014 If @var{options} is
18015 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
18016 about successful optimizations from all the passes, omitting messages
18017 that are treated as ``internals''.
18018
18019 If the @var{filename} is provided, then the dumps from all the
18020 applicable optimizations are concatenated into the @var{filename}.
18021 Otherwise the dump is output onto @file{stderr}. Though multiple
18022 @option{-fopt-info} options are accepted, only one of them can include
18023 a @var{filename}. If other filenames are provided then all but the
18024 first such option are ignored.
18025
18026 Note that the output @var{filename} is overwritten
18027 in case of multiple translation units. If a combined output from
18028 multiple translation units is desired, @file{stderr} should be used
18029 instead.
18030
18031 In the following example, the optimization info is output to
18032 @file{stderr}:
18033
18034 @smallexample
18035 gcc -O3 -fopt-info
18036 @end smallexample
18037
18038 This example:
18039 @smallexample
18040 gcc -O3 -fopt-info-missed=missed.all
18041 @end smallexample
18042
18043 @noindent
18044 outputs missed optimization report from all the passes into
18045 @file{missed.all}, and this one:
18046
18047 @smallexample
18048 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
18049 @end smallexample
18050
18051 @noindent
18052 prints information about missed optimization opportunities from
18053 vectorization passes on @file{stderr}.
18054 Note that @option{-fopt-info-vec-missed} is equivalent to
18055 @option{-fopt-info-missed-vec}. The order of the optimization group
18056 names and message types listed after @option{-fopt-info} does not matter.
18057
18058 As another example,
18059 @smallexample
18060 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
18061 @end smallexample
18062
18063 @noindent
18064 outputs information about missed optimizations as well as
18065 optimized locations from all the inlining passes into
18066 @file{inline.txt}.
18067
18068 Finally, consider:
18069
18070 @smallexample
18071 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
18072 @end smallexample
18073
18074 @noindent
18075 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
18076 in conflict since only one output file is allowed. In this case, only
18077 the first option takes effect and the subsequent options are
18078 ignored. Thus only @file{vec.miss} is produced which contains
18079 dumps from the vectorizer about missed opportunities.
18080
18081 @item -fsave-optimization-record
18082 @opindex fsave-optimization-record
18083 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
18084 were performed, for those optimizations that support @option{-fopt-info}.
18085
18086 This option is experimental and the format of the data within the
18087 compressed JSON file is subject to change.
18088
18089 It is roughly equivalent to a machine-readable version of
18090 @option{-fopt-info-all}, as a collection of messages with source file,
18091 line number and column number, with the following additional data for
18092 each message:
18093
18094 @itemize @bullet
18095
18096 @item
18097 the execution count of the code being optimized, along with metadata about
18098 whether this was from actual profile data, or just an estimate, allowing
18099 consumers to prioritize messages by code hotness,
18100
18101 @item
18102 the function name of the code being optimized, where applicable,
18103
18104 @item
18105 the ``inlining chain'' for the code being optimized, so that when
18106 a function is inlined into several different places (which might
18107 themselves be inlined), the reader can distinguish between the copies,
18108
18109 @item
18110 objects identifying those parts of the message that refer to expressions,
18111 statements or symbol-table nodes, which of these categories they are, and,
18112 when available, their source code location,
18113
18114 @item
18115 the GCC pass that emitted the message, and
18116
18117 @item
18118 the location in GCC's own code from which the message was emitted
18119
18120 @end itemize
18121
18122 Additionally, some messages are logically nested within other
18123 messages, reflecting implementation details of the optimization
18124 passes.
18125
18126 @item -fsched-verbose=@var{n}
18127 @opindex fsched-verbose
18128 On targets that use instruction scheduling, this option controls the
18129 amount of debugging output the scheduler prints to the dump files.
18130
18131 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
18132 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
18133 For @var{n} greater than one, it also output basic block probabilities,
18134 detailed ready list information and unit/insn info. For @var{n} greater
18135 than two, it includes RTL at abort point, control-flow and regions info.
18136 And for @var{n} over four, @option{-fsched-verbose} also includes
18137 dependence info.
18138
18139
18140
18141 @item -fenable-@var{kind}-@var{pass}
18142 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
18143 @opindex fdisable-
18144 @opindex fenable-
18145
18146 This is a set of options that are used to explicitly disable/enable
18147 optimization passes. These options are intended for use for debugging GCC.
18148 Compiler users should use regular options for enabling/disabling
18149 passes instead.
18150
18151 @table @gcctabopt
18152
18153 @item -fdisable-ipa-@var{pass}
18154 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
18155 statically invoked in the compiler multiple times, the pass name should be
18156 appended with a sequential number starting from 1.
18157
18158 @item -fdisable-rtl-@var{pass}
18159 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
18160 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
18161 statically invoked in the compiler multiple times, the pass name should be
18162 appended with a sequential number starting from 1. @var{range-list} is a
18163 comma-separated list of function ranges or assembler names. Each range is a number
18164 pair separated by a colon. The range is inclusive in both ends. If the range
18165 is trivial, the number pair can be simplified as a single number. If the
18166 function's call graph node's @var{uid} falls within one of the specified ranges,
18167 the @var{pass} is disabled for that function. The @var{uid} is shown in the
18168 function header of a dump file, and the pass names can be dumped by using
18169 option @option{-fdump-passes}.
18170
18171 @item -fdisable-tree-@var{pass}
18172 @itemx -fdisable-tree-@var{pass}=@var{range-list}
18173 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
18174 option arguments.
18175
18176 @item -fenable-ipa-@var{pass}
18177 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
18178 statically invoked in the compiler multiple times, the pass name should be
18179 appended with a sequential number starting from 1.
18180
18181 @item -fenable-rtl-@var{pass}
18182 @itemx -fenable-rtl-@var{pass}=@var{range-list}
18183 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
18184 description and examples.
18185
18186 @item -fenable-tree-@var{pass}
18187 @itemx -fenable-tree-@var{pass}=@var{range-list}
18188 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
18189 of option arguments.
18190
18191 @end table
18192
18193 Here are some examples showing uses of these options.
18194
18195 @smallexample
18196
18197 # disable ccp1 for all functions
18198 -fdisable-tree-ccp1
18199 # disable complete unroll for function whose cgraph node uid is 1
18200 -fenable-tree-cunroll=1
18201 # disable gcse2 for functions at the following ranges [1,1],
18202 # [300,400], and [400,1000]
18203 # disable gcse2 for functions foo and foo2
18204 -fdisable-rtl-gcse2=foo,foo2
18205 # disable early inlining
18206 -fdisable-tree-einline
18207 # disable ipa inlining
18208 -fdisable-ipa-inline
18209 # enable tree full unroll
18210 -fenable-tree-unroll
18211
18212 @end smallexample
18213
18214 @item -fchecking
18215 @itemx -fchecking=@var{n}
18216 @opindex fchecking
18217 @opindex fno-checking
18218 Enable internal consistency checking. The default depends on
18219 the compiler configuration. @option{-fchecking=2} enables further
18220 internal consistency checking that might affect code generation.
18221
18222 @item -frandom-seed=@var{string}
18223 @opindex frandom-seed
18224 This option provides a seed that GCC uses in place of
18225 random numbers in generating certain symbol names
18226 that have to be different in every compiled file. It is also used to
18227 place unique stamps in coverage data files and the object files that
18228 produce them. You can use the @option{-frandom-seed} option to produce
18229 reproducibly identical object files.
18230
18231 The @var{string} can either be a number (decimal, octal or hex) or an
18232 arbitrary string (in which case it's converted to a number by
18233 computing CRC32).
18234
18235 The @var{string} should be different for every file you compile.
18236
18237 @item -save-temps
18238 @opindex save-temps
18239 Store the usual ``temporary'' intermediate files permanently; name them
18240 as auxiliary output files, as specified described under
18241 @option{-dumpbase} and @option{-dumpdir}.
18242
18243 When used in combination with the @option{-x} command-line option,
18244 @option{-save-temps} is sensible enough to avoid overwriting an
18245 input source file with the same extension as an intermediate file.
18246 The corresponding intermediate file may be obtained by renaming the
18247 source file before using @option{-save-temps}.
18248
18249 @item -save-temps=cwd
18250 @opindex save-temps=cwd
18251 Equivalent to @option{-save-temps -dumpdir ./}.
18252
18253 @item -save-temps=obj
18254 @opindex save-temps=obj
18255 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
18256 @file{outdir/} is the directory of the output file specified after the
18257 @option{-o} option, including any directory separators. If the
18258 @option{-o} option is not used, the @option{-save-temps=obj} switch
18259 behaves like @option{-save-temps=cwd}.
18260
18261 @item -time@r{[}=@var{file}@r{]}
18262 @opindex time
18263 Report the CPU time taken by each subprocess in the compilation
18264 sequence. For C source files, this is the compiler proper and assembler
18265 (plus the linker if linking is done).
18266
18267 Without the specification of an output file, the output looks like this:
18268
18269 @smallexample
18270 # cc1 0.12 0.01
18271 # as 0.00 0.01
18272 @end smallexample
18273
18274 The first number on each line is the ``user time'', that is time spent
18275 executing the program itself. The second number is ``system time'',
18276 time spent executing operating system routines on behalf of the program.
18277 Both numbers are in seconds.
18278
18279 With the specification of an output file, the output is appended to the
18280 named file, and it looks like this:
18281
18282 @smallexample
18283 0.12 0.01 cc1 @var{options}
18284 0.00 0.01 as @var{options}
18285 @end smallexample
18286
18287 The ``user time'' and the ``system time'' are moved before the program
18288 name, and the options passed to the program are displayed, so that one
18289 can later tell what file was being compiled, and with which options.
18290
18291 @item -fdump-final-insns@r{[}=@var{file}@r{]}
18292 @opindex fdump-final-insns
18293 Dump the final internal representation (RTL) to @var{file}. If the
18294 optional argument is omitted (or if @var{file} is @code{.}), the name
18295 of the dump file is determined by appending @code{.gkd} to the
18296 dump base name, see @option{-dumpbase}.
18297
18298 @item -fcompare-debug@r{[}=@var{opts}@r{]}
18299 @opindex fcompare-debug
18300 @opindex fno-compare-debug
18301 If no error occurs during compilation, run the compiler a second time,
18302 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
18303 passed to the second compilation. Dump the final internal
18304 representation in both compilations, and print an error if they differ.
18305
18306 If the equal sign is omitted, the default @option{-gtoggle} is used.
18307
18308 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
18309 and nonzero, implicitly enables @option{-fcompare-debug}. If
18310 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
18311 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
18312 is used.
18313
18314 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
18315 is equivalent to @option{-fno-compare-debug}, which disables the dumping
18316 of the final representation and the second compilation, preventing even
18317 @env{GCC_COMPARE_DEBUG} from taking effect.
18318
18319 To verify full coverage during @option{-fcompare-debug} testing, set
18320 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
18321 which GCC rejects as an invalid option in any actual compilation
18322 (rather than preprocessing, assembly or linking). To get just a
18323 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
18324 not overridden} will do.
18325
18326 @item -fcompare-debug-second
18327 @opindex fcompare-debug-second
18328 This option is implicitly passed to the compiler for the second
18329 compilation requested by @option{-fcompare-debug}, along with options to
18330 silence warnings, and omitting other options that would cause the compiler
18331 to produce output to files or to standard output as a side effect. Dump
18332 files and preserved temporary files are renamed so as to contain the
18333 @code{.gk} additional extension during the second compilation, to avoid
18334 overwriting those generated by the first.
18335
18336 When this option is passed to the compiler driver, it causes the
18337 @emph{first} compilation to be skipped, which makes it useful for little
18338 other than debugging the compiler proper.
18339
18340 @item -gtoggle
18341 @opindex gtoggle
18342 Turn off generation of debug info, if leaving out this option
18343 generates it, or turn it on at level 2 otherwise. The position of this
18344 argument in the command line does not matter; it takes effect after all
18345 other options are processed, and it does so only once, no matter how
18346 many times it is given. This is mainly intended to be used with
18347 @option{-fcompare-debug}.
18348
18349 @item -fvar-tracking-assignments-toggle
18350 @opindex fvar-tracking-assignments-toggle
18351 @opindex fno-var-tracking-assignments-toggle
18352 Toggle @option{-fvar-tracking-assignments}, in the same way that
18353 @option{-gtoggle} toggles @option{-g}.
18354
18355 @item -Q
18356 @opindex Q
18357 Makes the compiler print out each function name as it is compiled, and
18358 print some statistics about each pass when it finishes.
18359
18360 @item -ftime-report
18361 @opindex ftime-report
18362 Makes the compiler print some statistics about the time consumed by each
18363 pass when it finishes.
18364
18365 @item -ftime-report-details
18366 @opindex ftime-report-details
18367 Record the time consumed by infrastructure parts separately for each pass.
18368
18369 @item -fira-verbose=@var{n}
18370 @opindex fira-verbose
18371 Control the verbosity of the dump file for the integrated register allocator.
18372 The default value is 5. If the value @var{n} is greater or equal to 10,
18373 the dump output is sent to stderr using the same format as @var{n} minus 10.
18374
18375 @item -flto-report
18376 @opindex flto-report
18377 Prints a report with internal details on the workings of the link-time
18378 optimizer. The contents of this report vary from version to version.
18379 It is meant to be useful to GCC developers when processing object
18380 files in LTO mode (via @option{-flto}).
18381
18382 Disabled by default.
18383
18384 @item -flto-report-wpa
18385 @opindex flto-report-wpa
18386 Like @option{-flto-report}, but only print for the WPA phase of link-time
18387 optimization.
18388
18389 @item -fmem-report
18390 @opindex fmem-report
18391 Makes the compiler print some statistics about permanent memory
18392 allocation when it finishes.
18393
18394 @item -fmem-report-wpa
18395 @opindex fmem-report-wpa
18396 Makes the compiler print some statistics about permanent memory
18397 allocation for the WPA phase only.
18398
18399 @item -fpre-ipa-mem-report
18400 @opindex fpre-ipa-mem-report
18401 @item -fpost-ipa-mem-report
18402 @opindex fpost-ipa-mem-report
18403 Makes the compiler print some statistics about permanent memory
18404 allocation before or after interprocedural optimization.
18405
18406 @item -fprofile-report
18407 @opindex fprofile-report
18408 Makes the compiler print some statistics about consistency of the
18409 (estimated) profile and effect of individual passes.
18410
18411 @item -fstack-usage
18412 @opindex fstack-usage
18413 Makes the compiler output stack usage information for the program, on a
18414 per-function basis. The filename for the dump is made by appending
18415 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
18416 the output file, if explicitly specified and it is not an executable,
18417 otherwise it is the basename of the source file. An entry is made up
18418 of three fields:
18419
18420 @itemize
18421 @item
18422 The name of the function.
18423 @item
18424 A number of bytes.
18425 @item
18426 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
18427 @end itemize
18428
18429 The qualifier @code{static} means that the function manipulates the stack
18430 statically: a fixed number of bytes are allocated for the frame on function
18431 entry and released on function exit; no stack adjustments are otherwise made
18432 in the function. The second field is this fixed number of bytes.
18433
18434 The qualifier @code{dynamic} means that the function manipulates the stack
18435 dynamically: in addition to the static allocation described above, stack
18436 adjustments are made in the body of the function, for example to push/pop
18437 arguments around function calls. If the qualifier @code{bounded} is also
18438 present, the amount of these adjustments is bounded at compile time and
18439 the second field is an upper bound of the total amount of stack used by
18440 the function. If it is not present, the amount of these adjustments is
18441 not bounded at compile time and the second field only represents the
18442 bounded part.
18443
18444 @item -fstats
18445 @opindex fstats
18446 Emit statistics about front-end processing at the end of the compilation.
18447 This option is supported only by the C++ front end, and
18448 the information is generally only useful to the G++ development team.
18449
18450 @item -fdbg-cnt-list
18451 @opindex fdbg-cnt-list
18452 Print the name and the counter upper bound for all debug counters.
18453
18454
18455 @item -fdbg-cnt=@var{counter-value-list}
18456 @opindex fdbg-cnt
18457 Set the internal debug counter lower and upper bound. @var{counter-value-list}
18458 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
18459 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
18460 the name of the counter and list of closed intervals.
18461 The @var{lower_bound} is optional and is zero
18462 initialized if not set.
18463 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
18464 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
18465 eleventh invocation.
18466 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
18467
18468 @item -print-file-name=@var{library}
18469 @opindex print-file-name
18470 Print the full absolute name of the library file @var{library} that
18471 would be used when linking---and don't do anything else. With this
18472 option, GCC does not compile or link anything; it just prints the
18473 file name.
18474
18475 @item -print-multi-directory
18476 @opindex print-multi-directory
18477 Print the directory name corresponding to the multilib selected by any
18478 other switches present in the command line. This directory is supposed
18479 to exist in @env{GCC_EXEC_PREFIX}.
18480
18481 @item -print-multi-lib
18482 @opindex print-multi-lib
18483 Print the mapping from multilib directory names to compiler switches
18484 that enable them. The directory name is separated from the switches by
18485 @samp{;}, and each switch starts with an @samp{@@} instead of the
18486 @samp{-}, without spaces between multiple switches. This is supposed to
18487 ease shell processing.
18488
18489 @item -print-multi-os-directory
18490 @opindex print-multi-os-directory
18491 Print the path to OS libraries for the selected
18492 multilib, relative to some @file{lib} subdirectory. If OS libraries are
18493 present in the @file{lib} subdirectory and no multilibs are used, this is
18494 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
18495 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
18496 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
18497 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
18498
18499 @item -print-multiarch
18500 @opindex print-multiarch
18501 Print the path to OS libraries for the selected multiarch,
18502 relative to some @file{lib} subdirectory.
18503
18504 @item -print-prog-name=@var{program}
18505 @opindex print-prog-name
18506 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
18507
18508 @item -print-libgcc-file-name
18509 @opindex print-libgcc-file-name
18510 Same as @option{-print-file-name=libgcc.a}.
18511
18512 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
18513 but you do want to link with @file{libgcc.a}. You can do:
18514
18515 @smallexample
18516 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
18517 @end smallexample
18518
18519 @item -print-search-dirs
18520 @opindex print-search-dirs
18521 Print the name of the configured installation directory and a list of
18522 program and library directories @command{gcc} searches---and don't do anything else.
18523
18524 This is useful when @command{gcc} prints the error message
18525 @samp{installation problem, cannot exec cpp0: No such file or directory}.
18526 To resolve this you either need to put @file{cpp0} and the other compiler
18527 components where @command{gcc} expects to find them, or you can set the environment
18528 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
18529 Don't forget the trailing @samp{/}.
18530 @xref{Environment Variables}.
18531
18532 @item -print-sysroot
18533 @opindex print-sysroot
18534 Print the target sysroot directory that is used during
18535 compilation. This is the target sysroot specified either at configure
18536 time or using the @option{--sysroot} option, possibly with an extra
18537 suffix that depends on compilation options. If no target sysroot is
18538 specified, the option prints nothing.
18539
18540 @item -print-sysroot-headers-suffix
18541 @opindex print-sysroot-headers-suffix
18542 Print the suffix added to the target sysroot when searching for
18543 headers, or give an error if the compiler is not configured with such
18544 a suffix---and don't do anything else.
18545
18546 @item -dumpmachine
18547 @opindex dumpmachine
18548 Print the compiler's target machine (for example,
18549 @samp{i686-pc-linux-gnu})---and don't do anything else.
18550
18551 @item -dumpversion
18552 @opindex dumpversion
18553 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
18554 anything else. This is the compiler version used in filesystem paths and
18555 specs. Depending on how the compiler has been configured it can be just
18556 a single number (major version), two numbers separated by a dot (major and
18557 minor version) or three numbers separated by dots (major, minor and patchlevel
18558 version).
18559
18560 @item -dumpfullversion
18561 @opindex dumpfullversion
18562 Print the full compiler version---and don't do anything else. The output is
18563 always three numbers separated by dots, major, minor and patchlevel version.
18564
18565 @item -dumpspecs
18566 @opindex dumpspecs
18567 Print the compiler's built-in specs---and don't do anything else. (This
18568 is used when GCC itself is being built.) @xref{Spec Files}.
18569 @end table
18570
18571 @node Submodel Options
18572 @section Machine-Dependent Options
18573 @cindex submodel options
18574 @cindex specifying hardware config
18575 @cindex hardware models and configurations, specifying
18576 @cindex target-dependent options
18577 @cindex machine-dependent options
18578
18579 Each target machine supported by GCC can have its own options---for
18580 example, to allow you to compile for a particular processor variant or
18581 ABI, or to control optimizations specific to that machine. By
18582 convention, the names of machine-specific options start with
18583 @samp{-m}.
18584
18585 Some configurations of the compiler also support additional target-specific
18586 options, usually for compatibility with other compilers on the same
18587 platform.
18588
18589 @c This list is ordered alphanumerically by subsection name.
18590 @c It should be the same order and spelling as these options are listed
18591 @c in Machine Dependent Options
18592
18593 @menu
18594 * AArch64 Options::
18595 * Adapteva Epiphany Options::
18596 * AMD GCN Options::
18597 * ARC Options::
18598 * ARM Options::
18599 * AVR Options::
18600 * Blackfin Options::
18601 * C6X Options::
18602 * CRIS Options::
18603 * CR16 Options::
18604 * C-SKY Options::
18605 * Darwin Options::
18606 * DEC Alpha Options::
18607 * eBPF Options::
18608 * FR30 Options::
18609 * FT32 Options::
18610 * FRV Options::
18611 * GNU/Linux Options::
18612 * H8/300 Options::
18613 * HPPA Options::
18614 * IA-64 Options::
18615 * LM32 Options::
18616 * M32C Options::
18617 * M32R/D Options::
18618 * M680x0 Options::
18619 * MCore Options::
18620 * MeP Options::
18621 * MicroBlaze Options::
18622 * MIPS Options::
18623 * MMIX Options::
18624 * MN10300 Options::
18625 * Moxie Options::
18626 * MSP430 Options::
18627 * NDS32 Options::
18628 * Nios II Options::
18629 * Nvidia PTX Options::
18630 * OpenRISC Options::
18631 * PDP-11 Options::
18632 * picoChip Options::
18633 * PowerPC Options::
18634 * PRU Options::
18635 * RISC-V Options::
18636 * RL78 Options::
18637 * RS/6000 and PowerPC Options::
18638 * RX Options::
18639 * S/390 and zSeries Options::
18640 * Score Options::
18641 * SH Options::
18642 * Solaris 2 Options::
18643 * SPARC Options::
18644 * System V Options::
18645 * TILE-Gx Options::
18646 * TILEPro Options::
18647 * V850 Options::
18648 * VAX Options::
18649 * Visium Options::
18650 * VMS Options::
18651 * VxWorks Options::
18652 * x86 Options::
18653 * x86 Windows Options::
18654 * Xstormy16 Options::
18655 * Xtensa Options::
18656 * zSeries Options::
18657 @end menu
18658
18659 @node AArch64 Options
18660 @subsection AArch64 Options
18661 @cindex AArch64 Options
18662
18663 These options are defined for AArch64 implementations:
18664
18665 @table @gcctabopt
18666
18667 @item -mabi=@var{name}
18668 @opindex mabi
18669 Generate code for the specified data model. Permissible values
18670 are @samp{ilp32} for SysV-like data model where int, long int and pointers
18671 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
18672 but long int and pointers are 64 bits.
18673
18674 The default depends on the specific target configuration. Note that
18675 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
18676 entire program with the same ABI, and link with a compatible set of libraries.
18677
18678 @item -mbig-endian
18679 @opindex mbig-endian
18680 Generate big-endian code. This is the default when GCC is configured for an
18681 @samp{aarch64_be-*-*} target.
18682
18683 @item -mgeneral-regs-only
18684 @opindex mgeneral-regs-only
18685 Generate code which uses only the general-purpose registers. This will prevent
18686 the compiler from using floating-point and Advanced SIMD registers but will not
18687 impose any restrictions on the assembler.
18688
18689 @item -mlittle-endian
18690 @opindex mlittle-endian
18691 Generate little-endian code. This is the default when GCC is configured for an
18692 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
18693
18694 @item -mcmodel=tiny
18695 @opindex mcmodel=tiny
18696 Generate code for the tiny code model. The program and its statically defined
18697 symbols must be within 1MB of each other. Programs can be statically or
18698 dynamically linked.
18699
18700 @item -mcmodel=small
18701 @opindex mcmodel=small
18702 Generate code for the small code model. The program and its statically defined
18703 symbols must be within 4GB of each other. Programs can be statically or
18704 dynamically linked. This is the default code model.
18705
18706 @item -mcmodel=large
18707 @opindex mcmodel=large
18708 Generate code for the large code model. This makes no assumptions about
18709 addresses and sizes of sections. Programs can be statically linked only. The
18710 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
18711 @option{-fpic} and @option{-fPIC}.
18712
18713 @item -mstrict-align
18714 @itemx -mno-strict-align
18715 @opindex mstrict-align
18716 @opindex mno-strict-align
18717 Avoid or allow generating memory accesses that may not be aligned on a natural
18718 object boundary as described in the architecture specification.
18719
18720 @item -momit-leaf-frame-pointer
18721 @itemx -mno-omit-leaf-frame-pointer
18722 @opindex momit-leaf-frame-pointer
18723 @opindex mno-omit-leaf-frame-pointer
18724 Omit or keep the frame pointer in leaf functions. The former behavior is the
18725 default.
18726
18727 @item -mstack-protector-guard=@var{guard}
18728 @itemx -mstack-protector-guard-reg=@var{reg}
18729 @itemx -mstack-protector-guard-offset=@var{offset}
18730 @opindex mstack-protector-guard
18731 @opindex mstack-protector-guard-reg
18732 @opindex mstack-protector-guard-offset
18733 Generate stack protection code using canary at @var{guard}. Supported
18734 locations are @samp{global} for a global canary or @samp{sysreg} for a
18735 canary in an appropriate system register.
18736
18737 With the latter choice the options
18738 @option{-mstack-protector-guard-reg=@var{reg}} and
18739 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
18740 which system register to use as base register for reading the canary,
18741 and from what offset from that base register. There is no default
18742 register or offset as this is entirely for use within the Linux
18743 kernel.
18744
18745 @item -mtls-dialect=desc
18746 @opindex mtls-dialect=desc
18747 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
18748 of TLS variables. This is the default.
18749
18750 @item -mtls-dialect=traditional
18751 @opindex mtls-dialect=traditional
18752 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
18753 of TLS variables.
18754
18755 @item -mtls-size=@var{size}
18756 @opindex mtls-size
18757 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
18758 This option requires binutils 2.26 or newer.
18759
18760 @item -mfix-cortex-a53-835769
18761 @itemx -mno-fix-cortex-a53-835769
18762 @opindex mfix-cortex-a53-835769
18763 @opindex mno-fix-cortex-a53-835769
18764 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
18765 This involves inserting a NOP instruction between memory instructions and
18766 64-bit integer multiply-accumulate instructions.
18767
18768 @item -mfix-cortex-a53-843419
18769 @itemx -mno-fix-cortex-a53-843419
18770 @opindex mfix-cortex-a53-843419
18771 @opindex mno-fix-cortex-a53-843419
18772 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
18773 This erratum workaround is made at link time and this will only pass the
18774 corresponding flag to the linker.
18775
18776 @item -mlow-precision-recip-sqrt
18777 @itemx -mno-low-precision-recip-sqrt
18778 @opindex mlow-precision-recip-sqrt
18779 @opindex mno-low-precision-recip-sqrt
18780 Enable or disable the reciprocal square root approximation.
18781 This option only has an effect if @option{-ffast-math} or
18782 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18783 precision of reciprocal square root results to about 16 bits for
18784 single precision and to 32 bits for double precision.
18785
18786 @item -mlow-precision-sqrt
18787 @itemx -mno-low-precision-sqrt
18788 @opindex mlow-precision-sqrt
18789 @opindex mno-low-precision-sqrt
18790 Enable or disable the square root approximation.
18791 This option only has an effect if @option{-ffast-math} or
18792 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18793 precision of square root results to about 16 bits for
18794 single precision and to 32 bits for double precision.
18795 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
18796
18797 @item -mlow-precision-div
18798 @itemx -mno-low-precision-div
18799 @opindex mlow-precision-div
18800 @opindex mno-low-precision-div
18801 Enable or disable the division approximation.
18802 This option only has an effect if @option{-ffast-math} or
18803 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18804 precision of division results to about 16 bits for
18805 single precision and to 32 bits for double precision.
18806
18807 @item -mtrack-speculation
18808 @itemx -mno-track-speculation
18809 Enable or disable generation of additional code to track speculative
18810 execution through conditional branches. The tracking state can then
18811 be used by the compiler when expanding calls to
18812 @code{__builtin_speculation_safe_copy} to permit a more efficient code
18813 sequence to be generated.
18814
18815 @item -moutline-atomics
18816 @itemx -mno-outline-atomics
18817 Enable or disable calls to out-of-line helpers to implement atomic operations.
18818 These helpers will, at runtime, determine if the LSE instructions from
18819 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
18820 instructions that are present in the base ARMv8.0 ISA.
18821
18822 This option is only applicable when compiling for the base ARMv8.0
18823 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
18824 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
18825 used directly. The same applies when using @option{-mcpu=} when the
18826 selected cpu supports the @samp{lse} feature.
18827 This option is on by default.
18828
18829 @item -march=@var{name}
18830 @opindex march
18831 Specify the name of the target architecture and, optionally, one or
18832 more feature modifiers. This option has the form
18833 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
18834
18835 The table below summarizes the permissible values for @var{arch}
18836 and the features that they enable by default:
18837
18838 @multitable @columnfractions 0.20 0.20 0.60
18839 @headitem @var{arch} value @tab Architecture @tab Includes by default
18840 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
18841 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
18842 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
18843 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
18844 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
18845 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
18846 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
18847 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
18848 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
18849 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
18850 @end multitable
18851
18852 The value @samp{native} is available on native AArch64 GNU/Linux and
18853 causes the compiler to pick the architecture of the host system. This
18854 option has no effect if the compiler is unable to recognize the
18855 architecture of the host system,
18856
18857 The permissible values for @var{feature} are listed in the sub-section
18858 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18859 Feature Modifiers}. Where conflicting feature modifiers are
18860 specified, the right-most feature is used.
18861
18862 GCC uses @var{name} to determine what kind of instructions it can emit
18863 when generating assembly code. If @option{-march} is specified
18864 without either of @option{-mtune} or @option{-mcpu} also being
18865 specified, the code is tuned to perform well across a range of target
18866 processors implementing the target architecture.
18867
18868 @item -mtune=@var{name}
18869 @opindex mtune
18870 Specify the name of the target processor for which GCC should tune the
18871 performance of the code. Permissible values for this option are:
18872 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18873 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18874 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18875 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
18876 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
18877 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
18878 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
18879 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{qdf24xx},
18880 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
18881 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
18882 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
18883 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
18884 @samp{octeontx2f95mm},
18885 @samp{a64fx},
18886 @samp{thunderx}, @samp{thunderxt88},
18887 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
18888 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
18889 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18890 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18891 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
18892 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x2},
18893 @samp{cortex-a510}, @samp{cortex-a710}, @samp{ampere1}, @samp{native}.
18894
18895 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18896 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18897 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
18898 should tune for a big.LITTLE system.
18899
18900 The value @samp{neoverse-512tvb} specifies that GCC should tune
18901 for Neoverse cores that (a) implement SVE and (b) have a total vector
18902 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
18903 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
18904 instructions a cycle and that can execute an equivalent number of SVE
18905 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
18906 This is more general than tuning for a specific core like Neoverse V1
18907 but is more specific than the default tuning described below.
18908
18909 Additionally on native AArch64 GNU/Linux systems the value
18910 @samp{native} tunes performance to the host system. This option has no effect
18911 if the compiler is unable to recognize the processor of the host system.
18912
18913 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
18914 are specified, the code is tuned to perform well across a range
18915 of target processors.
18916
18917 This option cannot be suffixed by feature modifiers.
18918
18919 @item -mcpu=@var{name}
18920 @opindex mcpu
18921 Specify the name of the target processor, optionally suffixed by one
18922 or more feature modifiers. This option has the form
18923 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
18924 the permissible values for @var{cpu} are the same as those available
18925 for @option{-mtune}. The permissible values for @var{feature} are
18926 documented in the sub-section on
18927 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18928 Feature Modifiers}. Where conflicting feature modifiers are
18929 specified, the right-most feature is used.
18930
18931 GCC uses @var{name} to determine what kind of instructions it can emit when
18932 generating assembly code (as if by @option{-march}) and to determine
18933 the target processor for which to tune for performance (as if
18934 by @option{-mtune}). Where this option is used in conjunction
18935 with @option{-march} or @option{-mtune}, those options take precedence
18936 over the appropriate part of this option.
18937
18938 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
18939 to a specific core, but instead refers to all Neoverse cores that
18940 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
18941 a cycle. Unless overridden by @option{-march},
18942 @option{-mcpu=neoverse-512tvb} generates code that can run on a
18943 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
18944 these properties. Unless overridden by @option{-mtune},
18945 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
18946 @option{-mtune=neoverse-512tvb}.
18947
18948 @item -moverride=@var{string}
18949 @opindex moverride
18950 Override tuning decisions made by the back-end in response to a
18951 @option{-mtune=} switch. The syntax, semantics, and accepted values
18952 for @var{string} in this option are not guaranteed to be consistent
18953 across releases.
18954
18955 This option is only intended to be useful when developing GCC.
18956
18957 @item -mverbose-cost-dump
18958 @opindex mverbose-cost-dump
18959 Enable verbose cost model dumping in the debug dump files. This option is
18960 provided for use in debugging the compiler.
18961
18962 @item -mpc-relative-literal-loads
18963 @itemx -mno-pc-relative-literal-loads
18964 @opindex mpc-relative-literal-loads
18965 @opindex mno-pc-relative-literal-loads
18966 Enable or disable PC-relative literal loads. With this option literal pools are
18967 accessed using a single instruction and emitted after each function. This
18968 limits the maximum size of functions to 1MB. This is enabled by default for
18969 @option{-mcmodel=tiny}.
18970
18971 @item -msign-return-address=@var{scope}
18972 @opindex msign-return-address
18973 Select the function scope on which return address signing will be applied.
18974 Permissible values are @samp{none}, which disables return address signing,
18975 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
18976 functions, and @samp{all}, which enables pointer signing for all functions. The
18977 default value is @samp{none}. This option has been deprecated by
18978 -mbranch-protection.
18979
18980 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
18981 @opindex mbranch-protection
18982 Select the branch protection features to use.
18983 @samp{none} is the default and turns off all types of branch protection.
18984 @samp{standard} turns on all types of branch protection features. If a feature
18985 has additional tuning options, then @samp{standard} sets it to its standard
18986 level.
18987 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
18988 level: signing functions that save the return address to memory (non-leaf
18989 functions will practically always do this) using the a-key. The optional
18990 argument @samp{leaf} can be used to extend the signing to include leaf
18991 functions. The optional argument @samp{b-key} can be used to sign the functions
18992 with the B-key instead of the A-key.
18993 @samp{bti} turns on branch target identification mechanism.
18994
18995 @item -mharden-sls=@var{opts}
18996 @opindex mharden-sls
18997 Enable compiler hardening against straight line speculation (SLS).
18998 @var{opts} is a comma-separated list of the following options:
18999 @table @samp
19000 @item retbr
19001 @item blr
19002 @end table
19003 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
19004 @samp{-mharden-sls=none} disables all SLS hardening.
19005
19006 @item -msve-vector-bits=@var{bits}
19007 @opindex msve-vector-bits
19008 Specify the number of bits in an SVE vector register. This option only has
19009 an effect when SVE is enabled.
19010
19011 GCC supports two forms of SVE code generation: ``vector-length
19012 agnostic'' output that works with any size of vector register and
19013 ``vector-length specific'' output that allows GCC to make assumptions
19014 about the vector length when it is useful for optimization reasons.
19015 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
19016 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
19017 Specifying @samp{scalable} selects vector-length agnostic
19018 output. At present @samp{-msve-vector-bits=128} also generates vector-length
19019 agnostic output for big-endian targets. All other values generate
19020 vector-length specific code. The behavior of these values may change
19021 in future releases and no value except @samp{scalable} should be
19022 relied on for producing code that is portable across different
19023 hardware SVE vector lengths.
19024
19025 The default is @samp{-msve-vector-bits=scalable}, which produces
19026 vector-length agnostic code.
19027 @end table
19028
19029 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
19030 @anchor{aarch64-feature-modifiers}
19031 @cindex @option{-march} feature modifiers
19032 @cindex @option{-mcpu} feature modifiers
19033 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
19034 the following and their inverses @option{no@var{feature}}:
19035
19036 @table @samp
19037 @item crc
19038 Enable CRC extension. This is on by default for
19039 @option{-march=armv8.1-a}.
19040 @item crypto
19041 Enable Crypto extension. This also enables Advanced SIMD and floating-point
19042 instructions.
19043 @item fp
19044 Enable floating-point instructions. This is on by default for all possible
19045 values for options @option{-march} and @option{-mcpu}.
19046 @item simd
19047 Enable Advanced SIMD instructions. This also enables floating-point
19048 instructions. This is on by default for all possible values for options
19049 @option{-march} and @option{-mcpu}.
19050 @item sve
19051 Enable Scalable Vector Extension instructions. This also enables Advanced
19052 SIMD and floating-point instructions.
19053 @item lse
19054 Enable Large System Extension instructions. This is on by default for
19055 @option{-march=armv8.1-a}.
19056 @item rdma
19057 Enable Round Double Multiply Accumulate instructions. This is on by default
19058 for @option{-march=armv8.1-a}.
19059 @item fp16
19060 Enable FP16 extension. This also enables floating-point instructions.
19061 @item fp16fml
19062 Enable FP16 fmla extension. This also enables FP16 extensions and
19063 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.
19064
19065 @item rcpc
19066 Enable the RcPc extension. This does not change code generation from GCC,
19067 but is passed on to the assembler, enabling inline asm statements to use
19068 instructions from the RcPc extension.
19069 @item dotprod
19070 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
19071 @item aes
19072 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
19073 SIMD instructions.
19074 @item sha2
19075 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
19076 @item sha3
19077 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
19078 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
19079 @item sm4
19080 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
19081 Use of this option with architectures prior to Armv8.2-A is not supported.
19082 @item profile
19083 Enable the Statistical Profiling extension. This option is only to enable the
19084 extension at the assembler level and does not affect code generation.
19085 @item rng
19086 Enable the Armv8.5-a Random Number instructions. This option is only to
19087 enable the extension at the assembler level and does not affect code
19088 generation.
19089 @item memtag
19090 Enable the Armv8.5-a Memory Tagging Extensions.
19091 Use of this option with architectures prior to Armv8.5-A is not supported.
19092 @item sb
19093 Enable the Armv8-a Speculation Barrier instruction. This option is only to
19094 enable the extension at the assembler level and does not affect code
19095 generation. This option is enabled by default for @option{-march=armv8.5-a}.
19096 @item ssbs
19097 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
19098 is only to enable the extension at the assembler level and does not affect code
19099 generation. This option is enabled by default for @option{-march=armv8.5-a}.
19100 @item predres
19101 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
19102 This option is only to enable the extension at the assembler level and does
19103 not affect code generation. This option is enabled by default for
19104 @option{-march=armv8.5-a}.
19105 @item sve2
19106 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
19107 instructions.
19108 @item sve2-bitperm
19109 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
19110 @item sve2-sm4
19111 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
19112 @item sve2-aes
19113 Enable SVE2 aes instructions. This also enables SVE2 instructions.
19114 @item sve2-sha3
19115 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
19116 @item tme
19117 Enable the Transactional Memory Extension.
19118 @item i8mm
19119 Enable 8-bit Integer Matrix Multiply instructions. This also enables
19120 Advanced SIMD and floating-point instructions. This option is enabled by
19121 default for @option{-march=armv8.6-a}. Use of this option with architectures
19122 prior to Armv8.2-A is not supported.
19123 @item f32mm
19124 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
19125 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
19126 not supported.
19127 @item f64mm
19128 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
19129 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
19130 not supported.
19131 @item bf16
19132 Enable brain half-precision floating-point instructions. This also enables
19133 Advanced SIMD and floating-point instructions. This option is enabled by
19134 default for @option{-march=armv8.6-a}. Use of this option with architectures
19135 prior to Armv8.2-A is not supported.
19136 @item ls64
19137 Enable the 64-byte atomic load and store instructions for accelerators.
19138 This option is enabled by default for @option{-march=armv8.7-a}.
19139 @item flagm
19140 Enable the Flag Manipulation instructions Extension.
19141 @item pauth
19142 Enable the Pointer Authentication Extension.
19143
19144 @end table
19145
19146 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
19147 which implies @option{fp}.
19148 Conversely, @option{nofp} implies @option{nosimd}, which implies
19149 @option{nocrypto}, @option{noaes} and @option{nosha2}.
19150
19151 @node Adapteva Epiphany Options
19152 @subsection Adapteva Epiphany Options
19153
19154 These @samp{-m} options are defined for Adapteva Epiphany:
19155
19156 @table @gcctabopt
19157 @item -mhalf-reg-file
19158 @opindex mhalf-reg-file
19159 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
19160 That allows code to run on hardware variants that lack these registers.
19161
19162 @item -mprefer-short-insn-regs
19163 @opindex mprefer-short-insn-regs
19164 Preferentially allocate registers that allow short instruction generation.
19165 This can result in increased instruction count, so this may either reduce or
19166 increase overall code size.
19167
19168 @item -mbranch-cost=@var{num}
19169 @opindex mbranch-cost
19170 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19171 This cost is only a heuristic and is not guaranteed to produce
19172 consistent results across releases.
19173
19174 @item -mcmove
19175 @opindex mcmove
19176 Enable the generation of conditional moves.
19177
19178 @item -mnops=@var{num}
19179 @opindex mnops
19180 Emit @var{num} NOPs before every other generated instruction.
19181
19182 @item -mno-soft-cmpsf
19183 @opindex mno-soft-cmpsf
19184 @opindex msoft-cmpsf
19185 For single-precision floating-point comparisons, emit an @code{fsub} instruction
19186 and test the flags. This is faster than a software comparison, but can
19187 get incorrect results in the presence of NaNs, or when two different small
19188 numbers are compared such that their difference is calculated as zero.
19189 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
19190 software comparisons.
19191
19192 @item -mstack-offset=@var{num}
19193 @opindex mstack-offset
19194 Set the offset between the top of the stack and the stack pointer.
19195 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
19196 can be used by leaf functions without stack allocation.
19197 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
19198 Note also that this option changes the ABI; compiling a program with a
19199 different stack offset than the libraries have been compiled with
19200 generally does not work.
19201 This option can be useful if you want to evaluate if a different stack
19202 offset would give you better code, but to actually use a different stack
19203 offset to build working programs, it is recommended to configure the
19204 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
19205
19206 @item -mno-round-nearest
19207 @opindex mno-round-nearest
19208 @opindex mround-nearest
19209 Make the scheduler assume that the rounding mode has been set to
19210 truncating. The default is @option{-mround-nearest}.
19211
19212 @item -mlong-calls
19213 @opindex mlong-calls
19214 If not otherwise specified by an attribute, assume all calls might be beyond
19215 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
19216 function address into a register before performing a (otherwise direct) call.
19217 This is the default.
19218
19219 @item -mshort-calls
19220 @opindex short-calls
19221 If not otherwise specified by an attribute, assume all direct calls are
19222 in the range of the @code{b} / @code{bl} instructions, so use these instructions
19223 for direct calls. The default is @option{-mlong-calls}.
19224
19225 @item -msmall16
19226 @opindex msmall16
19227 Assume addresses can be loaded as 16-bit unsigned values. This does not
19228 apply to function addresses for which @option{-mlong-calls} semantics
19229 are in effect.
19230
19231 @item -mfp-mode=@var{mode}
19232 @opindex mfp-mode
19233 Set the prevailing mode of the floating-point unit.
19234 This determines the floating-point mode that is provided and expected
19235 at function call and return time. Making this mode match the mode you
19236 predominantly need at function start can make your programs smaller and
19237 faster by avoiding unnecessary mode switches.
19238
19239 @var{mode} can be set to one the following values:
19240
19241 @table @samp
19242 @item caller
19243 Any mode at function entry is valid, and retained or restored when
19244 the function returns, and when it calls other functions.
19245 This mode is useful for compiling libraries or other compilation units
19246 you might want to incorporate into different programs with different
19247 prevailing FPU modes, and the convenience of being able to use a single
19248 object file outweighs the size and speed overhead for any extra
19249 mode switching that might be needed, compared with what would be needed
19250 with a more specific choice of prevailing FPU mode.
19251
19252 @item truncate
19253 This is the mode used for floating-point calculations with
19254 truncating (i.e.@: round towards zero) rounding mode. That includes
19255 conversion from floating point to integer.
19256
19257 @item round-nearest
19258 This is the mode used for floating-point calculations with
19259 round-to-nearest-or-even rounding mode.
19260
19261 @item int
19262 This is the mode used to perform integer calculations in the FPU, e.g.@:
19263 integer multiply, or integer multiply-and-accumulate.
19264 @end table
19265
19266 The default is @option{-mfp-mode=caller}
19267
19268 @item -mno-split-lohi
19269 @itemx -mno-postinc
19270 @itemx -mno-postmodify
19271 @opindex mno-split-lohi
19272 @opindex msplit-lohi
19273 @opindex mno-postinc
19274 @opindex mpostinc
19275 @opindex mno-postmodify
19276 @opindex mpostmodify
19277 Code generation tweaks that disable, respectively, splitting of 32-bit
19278 loads, generation of post-increment addresses, and generation of
19279 post-modify addresses. The defaults are @option{msplit-lohi},
19280 @option{-mpost-inc}, and @option{-mpost-modify}.
19281
19282 @item -mnovect-double
19283 @opindex mno-vect-double
19284 @opindex mvect-double
19285 Change the preferred SIMD mode to SImode. The default is
19286 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
19287
19288 @item -max-vect-align=@var{num}
19289 @opindex max-vect-align
19290 The maximum alignment for SIMD vector mode types.
19291 @var{num} may be 4 or 8. The default is 8.
19292 Note that this is an ABI change, even though many library function
19293 interfaces are unaffected if they don't use SIMD vector modes
19294 in places that affect size and/or alignment of relevant types.
19295
19296 @item -msplit-vecmove-early
19297 @opindex msplit-vecmove-early
19298 Split vector moves into single word moves before reload. In theory this
19299 can give better register allocation, but so far the reverse seems to be
19300 generally the case.
19301
19302 @item -m1reg-@var{reg}
19303 @opindex m1reg-
19304 Specify a register to hold the constant @minus{}1, which makes loading small negative
19305 constants and certain bitmasks faster.
19306 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
19307 which specify use of that register as a fixed register,
19308 and @samp{none}, which means that no register is used for this
19309 purpose. The default is @option{-m1reg-none}.
19310
19311 @end table
19312
19313 @node AMD GCN Options
19314 @subsection AMD GCN Options
19315 @cindex AMD GCN Options
19316
19317 These options are defined specifically for the AMD GCN port.
19318
19319 @table @gcctabopt
19320
19321 @item -march=@var{gpu}
19322 @opindex march
19323 @itemx -mtune=@var{gpu}
19324 @opindex mtune
19325 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
19326 are
19327
19328 @table @samp
19329 @opindex fiji
19330 @item fiji
19331 Compile for GCN3 Fiji devices (gfx803).
19332
19333 @item gfx900
19334 Compile for GCN5 Vega 10 devices (gfx900).
19335
19336 @item gfx906
19337 Compile for GCN5 Vega 20 devices (gfx906).
19338
19339 @end table
19340
19341 @item -msram-ecc=on
19342 @itemx -msram-ecc=off
19343 @itemx -msram-ecc=any
19344 @opindex msram-ecc
19345 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
19346 disabled, or either mode. This feature can be enabled per-process on some
19347 devices. The compiled code must match the device mode. The default is
19348 @samp{any}, for devices that support it.
19349
19350 @item -mstack-size=@var{bytes}
19351 @opindex mstack-size
19352 Specify how many @var{bytes} of stack space will be requested for each GPU
19353 thread (wave-front). Beware that there may be many threads and limited memory
19354 available. The size of the stack allocation may also have an impact on
19355 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
19356 1MB otherwise.
19357
19358 @item -mxnack
19359 @opindex mxnack
19360 Compile binaries suitable for devices with the XNACK feature enabled. Some
19361 devices always require XNACK and some allow the user to configure XNACK. The
19362 compiled code must match the device mode. The default is @samp{-mno-xnack}.
19363 At present this option is a placeholder for support that is not yet
19364 implemented.
19365
19366 @end table
19367
19368 @node ARC Options
19369 @subsection ARC Options
19370 @cindex ARC options
19371
19372 The following options control the architecture variant for which code
19373 is being compiled:
19374
19375 @c architecture variants
19376 @table @gcctabopt
19377
19378 @item -mbarrel-shifter
19379 @opindex mbarrel-shifter
19380 Generate instructions supported by barrel shifter. This is the default
19381 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
19382
19383 @item -mjli-always
19384 @opindex mjli-alawys
19385 Force to call a function using jli_s instruction. This option is
19386 valid only for ARCv2 architecture.
19387
19388 @item -mcpu=@var{cpu}
19389 @opindex mcpu
19390 Set architecture type, register usage, and instruction scheduling
19391 parameters for @var{cpu}. There are also shortcut alias options
19392 available for backward compatibility and convenience. Supported
19393 values for @var{cpu} are
19394
19395 @table @samp
19396 @opindex mA6
19397 @opindex mARC600
19398 @item arc600
19399 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
19400
19401 @item arc601
19402 @opindex mARC601
19403 Compile for ARC601. Alias: @option{-mARC601}.
19404
19405 @item arc700
19406 @opindex mA7
19407 @opindex mARC700
19408 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
19409 This is the default when configured with @option{--with-cpu=arc700}@.
19410
19411 @item arcem
19412 Compile for ARC EM.
19413
19414 @item archs
19415 Compile for ARC HS.
19416
19417 @item em
19418 Compile for ARC EM CPU with no hardware extensions.
19419
19420 @item em4
19421 Compile for ARC EM4 CPU.
19422
19423 @item em4_dmips
19424 Compile for ARC EM4 DMIPS CPU.
19425
19426 @item em4_fpus
19427 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
19428 extension.
19429
19430 @item em4_fpuda
19431 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
19432 double assist instructions.
19433
19434 @item hs
19435 Compile for ARC HS CPU with no hardware extensions except the atomic
19436 instructions.
19437
19438 @item hs34
19439 Compile for ARC HS34 CPU.
19440
19441 @item hs38
19442 Compile for ARC HS38 CPU.
19443
19444 @item hs38_linux
19445 Compile for ARC HS38 CPU with all hardware extensions on.
19446
19447 @item arc600_norm
19448 Compile for ARC 600 CPU with @code{norm} instructions enabled.
19449
19450 @item arc600_mul32x16
19451 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
19452 instructions enabled.
19453
19454 @item arc600_mul64
19455 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
19456 instructions enabled.
19457
19458 @item arc601_norm
19459 Compile for ARC 601 CPU with @code{norm} instructions enabled.
19460
19461 @item arc601_mul32x16
19462 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
19463 instructions enabled.
19464
19465 @item arc601_mul64
19466 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
19467 instructions enabled.
19468
19469 @item nps400
19470 Compile for ARC 700 on NPS400 chip.
19471
19472 @item em_mini
19473 Compile for ARC EM minimalist configuration featuring reduced register
19474 set.
19475
19476 @end table
19477
19478 @item -mdpfp
19479 @opindex mdpfp
19480 @itemx -mdpfp-compact
19481 @opindex mdpfp-compact
19482 Generate double-precision FPX instructions, tuned for the compact
19483 implementation.
19484
19485 @item -mdpfp-fast
19486 @opindex mdpfp-fast
19487 Generate double-precision FPX instructions, tuned for the fast
19488 implementation.
19489
19490 @item -mno-dpfp-lrsr
19491 @opindex mno-dpfp-lrsr
19492 Disable @code{lr} and @code{sr} instructions from using FPX extension
19493 aux registers.
19494
19495 @item -mea
19496 @opindex mea
19497 Generate extended arithmetic instructions. Currently only
19498 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
19499 supported. Only valid for @option{-mcpu=ARC700}.
19500
19501 @item -mno-mpy
19502 @opindex mno-mpy
19503 @opindex mmpy
19504 Do not generate @code{mpy}-family instructions for ARC700. This option is
19505 deprecated.
19506
19507 @item -mmul32x16
19508 @opindex mmul32x16
19509 Generate 32x16-bit multiply and multiply-accumulate instructions.
19510
19511 @item -mmul64
19512 @opindex mmul64
19513 Generate @code{mul64} and @code{mulu64} instructions.
19514 Only valid for @option{-mcpu=ARC600}.
19515
19516 @item -mnorm
19517 @opindex mnorm
19518 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
19519 is in effect.
19520
19521 @item -mspfp
19522 @opindex mspfp
19523 @itemx -mspfp-compact
19524 @opindex mspfp-compact
19525 Generate single-precision FPX instructions, tuned for the compact
19526 implementation.
19527
19528 @item -mspfp-fast
19529 @opindex mspfp-fast
19530 Generate single-precision FPX instructions, tuned for the fast
19531 implementation.
19532
19533 @item -msimd
19534 @opindex msimd
19535 Enable generation of ARC SIMD instructions via target-specific
19536 builtins. Only valid for @option{-mcpu=ARC700}.
19537
19538 @item -msoft-float
19539 @opindex msoft-float
19540 This option ignored; it is provided for compatibility purposes only.
19541 Software floating-point code is emitted by default, and this default
19542 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
19543 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
19544 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
19545
19546 @item -mswap
19547 @opindex mswap
19548 Generate @code{swap} instructions.
19549
19550 @item -matomic
19551 @opindex matomic
19552 This enables use of the locked load/store conditional extension to implement
19553 atomic memory built-in functions. Not available for ARC 6xx or ARC
19554 EM cores.
19555
19556 @item -mdiv-rem
19557 @opindex mdiv-rem
19558 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
19559
19560 @item -mcode-density
19561 @opindex mcode-density
19562 Enable code density instructions for ARC EM.
19563 This option is on by default for ARC HS.
19564
19565 @item -mll64
19566 @opindex mll64
19567 Enable double load/store operations for ARC HS cores.
19568
19569 @item -mtp-regno=@var{regno}
19570 @opindex mtp-regno
19571 Specify thread pointer register number.
19572
19573 @item -mmpy-option=@var{multo}
19574 @opindex mmpy-option
19575 Compile ARCv2 code with a multiplier design option. You can specify
19576 the option using either a string or numeric value for @var{multo}.
19577 @samp{wlh1} is the default value. The recognized values are:
19578
19579 @table @samp
19580 @item 0
19581 @itemx none
19582 No multiplier available.
19583
19584 @item 1
19585 @itemx w
19586 16x16 multiplier, fully pipelined.
19587 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
19588
19589 @item 2
19590 @itemx wlh1
19591 32x32 multiplier, fully
19592 pipelined (1 stage). The following instructions are additionally
19593 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19594
19595 @item 3
19596 @itemx wlh2
19597 32x32 multiplier, fully pipelined
19598 (2 stages). The following instructions are additionally enabled: @code{mpy},
19599 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19600
19601 @item 4
19602 @itemx wlh3
19603 Two 16x16 multipliers, blocking,
19604 sequential. The following instructions are additionally enabled: @code{mpy},
19605 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19606
19607 @item 5
19608 @itemx wlh4
19609 One 16x16 multiplier, blocking,
19610 sequential. The following instructions are additionally enabled: @code{mpy},
19611 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19612
19613 @item 6
19614 @itemx wlh5
19615 One 32x4 multiplier, blocking,
19616 sequential. The following instructions are additionally enabled: @code{mpy},
19617 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19618
19619 @item 7
19620 @itemx plus_dmpy
19621 ARC HS SIMD support.
19622
19623 @item 8
19624 @itemx plus_macd
19625 ARC HS SIMD support.
19626
19627 @item 9
19628 @itemx plus_qmacw
19629 ARC HS SIMD support.
19630
19631 @end table
19632
19633 This option is only available for ARCv2 cores@.
19634
19635 @item -mfpu=@var{fpu}
19636 @opindex mfpu
19637 Enables support for specific floating-point hardware extensions for ARCv2
19638 cores. Supported values for @var{fpu} are:
19639
19640 @table @samp
19641
19642 @item fpus
19643 Enables support for single-precision floating-point hardware
19644 extensions@.
19645
19646 @item fpud
19647 Enables support for double-precision floating-point hardware
19648 extensions. The single-precision floating-point extension is also
19649 enabled. Not available for ARC EM@.
19650
19651 @item fpuda
19652 Enables support for double-precision floating-point hardware
19653 extensions using double-precision assist instructions. The single-precision
19654 floating-point extension is also enabled. This option is
19655 only available for ARC EM@.
19656
19657 @item fpuda_div
19658 Enables support for double-precision floating-point hardware
19659 extensions using double-precision assist instructions.
19660 The single-precision floating-point, square-root, and divide
19661 extensions are also enabled. This option is
19662 only available for ARC EM@.
19663
19664 @item fpuda_fma
19665 Enables support for double-precision floating-point hardware
19666 extensions using double-precision assist instructions.
19667 The single-precision floating-point and fused multiply and add
19668 hardware extensions are also enabled. This option is
19669 only available for ARC EM@.
19670
19671 @item fpuda_all
19672 Enables support for double-precision floating-point hardware
19673 extensions using double-precision assist instructions.
19674 All single-precision floating-point hardware extensions are also
19675 enabled. This option is only available for ARC EM@.
19676
19677 @item fpus_div
19678 Enables support for single-precision floating-point, square-root and divide
19679 hardware extensions@.
19680
19681 @item fpud_div
19682 Enables support for double-precision floating-point, square-root and divide
19683 hardware extensions. This option
19684 includes option @samp{fpus_div}. Not available for ARC EM@.
19685
19686 @item fpus_fma
19687 Enables support for single-precision floating-point and
19688 fused multiply and add hardware extensions@.
19689
19690 @item fpud_fma
19691 Enables support for double-precision floating-point and
19692 fused multiply and add hardware extensions. This option
19693 includes option @samp{fpus_fma}. Not available for ARC EM@.
19694
19695 @item fpus_all
19696 Enables support for all single-precision floating-point hardware
19697 extensions@.
19698
19699 @item fpud_all
19700 Enables support for all single- and double-precision floating-point
19701 hardware extensions. Not available for ARC EM@.
19702
19703 @end table
19704
19705 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
19706 @opindex mirq-ctrl-saved
19707 Specifies general-purposes registers that the processor automatically
19708 saves/restores on interrupt entry and exit. @var{register-range} is
19709 specified as two registers separated by a dash. The register range
19710 always starts with @code{r0}, the upper limit is @code{fp} register.
19711 @var{blink} and @var{lp_count} are optional. This option is only
19712 valid for ARC EM and ARC HS cores.
19713
19714 @item -mrgf-banked-regs=@var{number}
19715 @opindex mrgf-banked-regs
19716 Specifies the number of registers replicated in second register bank
19717 on entry to fast interrupt. Fast interrupts are interrupts with the
19718 highest priority level P0. These interrupts save only PC and STATUS32
19719 registers to avoid memory transactions during interrupt entry and exit
19720 sequences. Use this option when you are using fast interrupts in an
19721 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
19722
19723 @item -mlpc-width=@var{width}
19724 @opindex mlpc-width
19725 Specify the width of the @code{lp_count} register. Valid values for
19726 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
19727 fixed to 32 bits. If the width is less than 32, the compiler does not
19728 attempt to transform loops in your program to use the zero-delay loop
19729 mechanism unless it is known that the @code{lp_count} register can
19730 hold the required loop-counter value. Depending on the width
19731 specified, the compiler and run-time library might continue to use the
19732 loop mechanism for various needs. This option defines macro
19733 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
19734
19735 @item -mrf16
19736 @opindex mrf16
19737 This option instructs the compiler to generate code for a 16-entry
19738 register file. This option defines the @code{__ARC_RF16__}
19739 preprocessor macro.
19740
19741 @item -mbranch-index
19742 @opindex mbranch-index
19743 Enable use of @code{bi} or @code{bih} instructions to implement jump
19744 tables.
19745
19746 @end table
19747
19748 The following options are passed through to the assembler, and also
19749 define preprocessor macro symbols.
19750
19751 @c Flags used by the assembler, but for which we define preprocessor
19752 @c macro symbols as well.
19753 @table @gcctabopt
19754 @item -mdsp-packa
19755 @opindex mdsp-packa
19756 Passed down to the assembler to enable the DSP Pack A extensions.
19757 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
19758 deprecated.
19759
19760 @item -mdvbf
19761 @opindex mdvbf
19762 Passed down to the assembler to enable the dual Viterbi butterfly
19763 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
19764 option is deprecated.
19765
19766 @c ARC700 4.10 extension instruction
19767 @item -mlock
19768 @opindex mlock
19769 Passed down to the assembler to enable the locked load/store
19770 conditional extension. Also sets the preprocessor symbol
19771 @code{__Xlock}.
19772
19773 @item -mmac-d16
19774 @opindex mmac-d16
19775 Passed down to the assembler. Also sets the preprocessor symbol
19776 @code{__Xxmac_d16}. This option is deprecated.
19777
19778 @item -mmac-24
19779 @opindex mmac-24
19780 Passed down to the assembler. Also sets the preprocessor symbol
19781 @code{__Xxmac_24}. This option is deprecated.
19782
19783 @c ARC700 4.10 extension instruction
19784 @item -mrtsc
19785 @opindex mrtsc
19786 Passed down to the assembler to enable the 64-bit time-stamp counter
19787 extension instruction. Also sets the preprocessor symbol
19788 @code{__Xrtsc}. This option is deprecated.
19789
19790 @c ARC700 4.10 extension instruction
19791 @item -mswape
19792 @opindex mswape
19793 Passed down to the assembler to enable the swap byte ordering
19794 extension instruction. Also sets the preprocessor symbol
19795 @code{__Xswape}.
19796
19797 @item -mtelephony
19798 @opindex mtelephony
19799 Passed down to the assembler to enable dual- and single-operand
19800 instructions for telephony. Also sets the preprocessor symbol
19801 @code{__Xtelephony}. This option is deprecated.
19802
19803 @item -mxy
19804 @opindex mxy
19805 Passed down to the assembler to enable the XY memory extension. Also
19806 sets the preprocessor symbol @code{__Xxy}.
19807
19808 @end table
19809
19810 The following options control how the assembly code is annotated:
19811
19812 @c Assembly annotation options
19813 @table @gcctabopt
19814 @item -misize
19815 @opindex misize
19816 Annotate assembler instructions with estimated addresses.
19817
19818 @item -mannotate-align
19819 @opindex mannotate-align
19820 Explain what alignment considerations lead to the decision to make an
19821 instruction short or long.
19822
19823 @end table
19824
19825 The following options are passed through to the linker:
19826
19827 @c options passed through to the linker
19828 @table @gcctabopt
19829 @item -marclinux
19830 @opindex marclinux
19831 Passed through to the linker, to specify use of the @code{arclinux} emulation.
19832 This option is enabled by default in tool chains built for
19833 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
19834 when profiling is not requested.
19835
19836 @item -marclinux_prof
19837 @opindex marclinux_prof
19838 Passed through to the linker, to specify use of the
19839 @code{arclinux_prof} emulation. This option is enabled by default in
19840 tool chains built for @w{@code{arc-linux-uclibc}} and
19841 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
19842
19843 @end table
19844
19845 The following options control the semantics of generated code:
19846
19847 @c semantically relevant code generation options
19848 @table @gcctabopt
19849 @item -mlong-calls
19850 @opindex mlong-calls
19851 Generate calls as register indirect calls, thus providing access
19852 to the full 32-bit address range.
19853
19854 @item -mmedium-calls
19855 @opindex mmedium-calls
19856 Don't use less than 25-bit addressing range for calls, which is the
19857 offset available for an unconditional branch-and-link
19858 instruction. Conditional execution of function calls is suppressed, to
19859 allow use of the 25-bit range, rather than the 21-bit range with
19860 conditional branch-and-link. This is the default for tool chains built
19861 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
19862
19863 @item -G @var{num}
19864 @opindex G
19865 Put definitions of externally-visible data in a small data section if
19866 that data is no bigger than @var{num} bytes. The default value of
19867 @var{num} is 4 for any ARC configuration, or 8 when we have double
19868 load/store operations.
19869
19870 @item -mno-sdata
19871 @opindex mno-sdata
19872 @opindex msdata
19873 Do not generate sdata references. This is the default for tool chains
19874 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
19875 targets.
19876
19877 @item -mvolatile-cache
19878 @opindex mvolatile-cache
19879 Use ordinarily cached memory accesses for volatile references. This is the
19880 default.
19881
19882 @item -mno-volatile-cache
19883 @opindex mno-volatile-cache
19884 @opindex mvolatile-cache
19885 Enable cache bypass for volatile references.
19886
19887 @end table
19888
19889 The following options fine tune code generation:
19890 @c code generation tuning options
19891 @table @gcctabopt
19892 @item -malign-call
19893 @opindex malign-call
19894 Does nothing. Preserved for backward compatibility.
19895
19896 @item -mauto-modify-reg
19897 @opindex mauto-modify-reg
19898 Enable the use of pre/post modify with register displacement.
19899
19900 @item -mbbit-peephole
19901 @opindex mbbit-peephole
19902 Enable bbit peephole2.
19903
19904 @item -mno-brcc
19905 @opindex mno-brcc
19906 This option disables a target-specific pass in @file{arc_reorg} to
19907 generate compare-and-branch (@code{br@var{cc}}) instructions.
19908 It has no effect on
19909 generation of these instructions driven by the combiner pass.
19910
19911 @item -mcase-vector-pcrel
19912 @opindex mcase-vector-pcrel
19913 Use PC-relative switch case tables to enable case table shortening.
19914 This is the default for @option{-Os}.
19915
19916 @item -mcompact-casesi
19917 @opindex mcompact-casesi
19918 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
19919 and only available for ARCv1 cores. This option is deprecated.
19920
19921 @item -mno-cond-exec
19922 @opindex mno-cond-exec
19923 Disable the ARCompact-specific pass to generate conditional
19924 execution instructions.
19925
19926 Due to delay slot scheduling and interactions between operand numbers,
19927 literal sizes, instruction lengths, and the support for conditional execution,
19928 the target-independent pass to generate conditional execution is often lacking,
19929 so the ARC port has kept a special pass around that tries to find more
19930 conditional execution generation opportunities after register allocation,
19931 branch shortening, and delay slot scheduling have been done. This pass
19932 generally, but not always, improves performance and code size, at the cost of
19933 extra compilation time, which is why there is an option to switch it off.
19934 If you have a problem with call instructions exceeding their allowable
19935 offset range because they are conditionalized, you should consider using
19936 @option{-mmedium-calls} instead.
19937
19938 @item -mearly-cbranchsi
19939 @opindex mearly-cbranchsi
19940 Enable pre-reload use of the @code{cbranchsi} pattern.
19941
19942 @item -mexpand-adddi
19943 @opindex mexpand-adddi
19944 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
19945 @code{add.f}, @code{adc} etc. This option is deprecated.
19946
19947 @item -mindexed-loads
19948 @opindex mindexed-loads
19949 Enable the use of indexed loads. This can be problematic because some
19950 optimizers then assume that indexed stores exist, which is not
19951 the case.
19952
19953 @item -mlra
19954 @opindex mlra
19955 Enable Local Register Allocation. This is still experimental for ARC,
19956 so by default the compiler uses standard reload
19957 (i.e.@: @option{-mno-lra}).
19958
19959 @item -mlra-priority-none
19960 @opindex mlra-priority-none
19961 Don't indicate any priority for target registers.
19962
19963 @item -mlra-priority-compact
19964 @opindex mlra-priority-compact
19965 Indicate target register priority for r0..r3 / r12..r15.
19966
19967 @item -mlra-priority-noncompact
19968 @opindex mlra-priority-noncompact
19969 Reduce target register priority for r0..r3 / r12..r15.
19970
19971 @item -mmillicode
19972 @opindex mmillicode
19973 When optimizing for size (using @option{-Os}), prologues and epilogues
19974 that have to save or restore a large number of registers are often
19975 shortened by using call to a special function in libgcc; this is
19976 referred to as a @emph{millicode} call. As these calls can pose
19977 performance issues, and/or cause linking issues when linking in a
19978 nonstandard way, this option is provided to turn on or off millicode
19979 call generation.
19980
19981 @item -mcode-density-frame
19982 @opindex mcode-density-frame
19983 This option enable the compiler to emit @code{enter} and @code{leave}
19984 instructions. These instructions are only valid for CPUs with
19985 code-density feature.
19986
19987 @item -mmixed-code
19988 @opindex mmixed-code
19989 Does nothing. Preserved for backward compatibility.
19990
19991 @item -mq-class
19992 @opindex mq-class
19993 Ths option is deprecated. Enable @samp{q} instruction alternatives.
19994 This is the default for @option{-Os}.
19995
19996 @item -mRcq
19997 @opindex mRcq
19998 Enable @samp{Rcq} constraint handling.
19999 Most short code generation depends on this.
20000 This is the default.
20001
20002 @item -mRcw
20003 @opindex mRcw
20004 Enable @samp{Rcw} constraint handling.
20005 Most ccfsm condexec mostly depends on this.
20006 This is the default.
20007
20008 @item -msize-level=@var{level}
20009 @opindex msize-level
20010 Fine-tune size optimization with regards to instruction lengths and alignment.
20011 The recognized values for @var{level} are:
20012 @table @samp
20013 @item 0
20014 No size optimization. This level is deprecated and treated like @samp{1}.
20015
20016 @item 1
20017 Short instructions are used opportunistically.
20018
20019 @item 2
20020 In addition, alignment of loops and of code after barriers are dropped.
20021
20022 @item 3
20023 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
20024
20025 @end table
20026
20027 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
20028 the behavior when this is not set is equivalent to level @samp{1}.
20029
20030 @item -mtune=@var{cpu}
20031 @opindex mtune
20032 Set instruction scheduling parameters for @var{cpu}, overriding any implied
20033 by @option{-mcpu=}.
20034
20035 Supported values for @var{cpu} are
20036
20037 @table @samp
20038 @item ARC600
20039 Tune for ARC600 CPU.
20040
20041 @item ARC601
20042 Tune for ARC601 CPU.
20043
20044 @item ARC700
20045 Tune for ARC700 CPU with standard multiplier block.
20046
20047 @item ARC700-xmac
20048 Tune for ARC700 CPU with XMAC block.
20049
20050 @item ARC725D
20051 Tune for ARC725D CPU.
20052
20053 @item ARC750D
20054 Tune for ARC750D CPU.
20055
20056 @end table
20057
20058 @item -mmultcost=@var{num}
20059 @opindex mmultcost
20060 Cost to assume for a multiply instruction, with @samp{4} being equal to a
20061 normal instruction.
20062
20063 @item -munalign-prob-threshold=@var{probability}
20064 @opindex munalign-prob-threshold
20065 Does nothing. Preserved for backward compatibility.
20066
20067 @end table
20068
20069 The following options are maintained for backward compatibility, but
20070 are now deprecated and will be removed in a future release:
20071
20072 @c Deprecated options
20073 @table @gcctabopt
20074
20075 @item -margonaut
20076 @opindex margonaut
20077 Obsolete FPX.
20078
20079 @item -mbig-endian
20080 @opindex mbig-endian
20081 @itemx -EB
20082 @opindex EB
20083 Compile code for big-endian targets. Use of these options is now
20084 deprecated. Big-endian code is supported by configuring GCC to build
20085 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
20086 for which big endian is the default.
20087
20088 @item -mlittle-endian
20089 @opindex mlittle-endian
20090 @itemx -EL
20091 @opindex EL
20092 Compile code for little-endian targets. Use of these options is now
20093 deprecated. Little-endian code is supported by configuring GCC to build
20094 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
20095 for which little endian is the default.
20096
20097 @item -mbarrel_shifter
20098 @opindex mbarrel_shifter
20099 Replaced by @option{-mbarrel-shifter}.
20100
20101 @item -mdpfp_compact
20102 @opindex mdpfp_compact
20103 Replaced by @option{-mdpfp-compact}.
20104
20105 @item -mdpfp_fast
20106 @opindex mdpfp_fast
20107 Replaced by @option{-mdpfp-fast}.
20108
20109 @item -mdsp_packa
20110 @opindex mdsp_packa
20111 Replaced by @option{-mdsp-packa}.
20112
20113 @item -mEA
20114 @opindex mEA
20115 Replaced by @option{-mea}.
20116
20117 @item -mmac_24
20118 @opindex mmac_24
20119 Replaced by @option{-mmac-24}.
20120
20121 @item -mmac_d16
20122 @opindex mmac_d16
20123 Replaced by @option{-mmac-d16}.
20124
20125 @item -mspfp_compact
20126 @opindex mspfp_compact
20127 Replaced by @option{-mspfp-compact}.
20128
20129 @item -mspfp_fast
20130 @opindex mspfp_fast
20131 Replaced by @option{-mspfp-fast}.
20132
20133 @item -mtune=@var{cpu}
20134 @opindex mtune
20135 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
20136 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
20137 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
20138
20139 @item -multcost=@var{num}
20140 @opindex multcost
20141 Replaced by @option{-mmultcost}.
20142
20143 @end table
20144
20145 @node ARM Options
20146 @subsection ARM Options
20147 @cindex ARM options
20148
20149 These @samp{-m} options are defined for the ARM port:
20150
20151 @table @gcctabopt
20152 @item -mabi=@var{name}
20153 @opindex mabi
20154 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
20155 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
20156
20157 @item -mapcs-frame
20158 @opindex mapcs-frame
20159 Generate a stack frame that is compliant with the ARM Procedure Call
20160 Standard for all functions, even if this is not strictly necessary for
20161 correct execution of the code. Specifying @option{-fomit-frame-pointer}
20162 with this option causes the stack frames not to be generated for
20163 leaf functions. The default is @option{-mno-apcs-frame}.
20164 This option is deprecated.
20165
20166 @item -mapcs
20167 @opindex mapcs
20168 This is a synonym for @option{-mapcs-frame} and is deprecated.
20169
20170 @ignore
20171 @c not currently implemented
20172 @item -mapcs-stack-check
20173 @opindex mapcs-stack-check
20174 Generate code to check the amount of stack space available upon entry to
20175 every function (that actually uses some stack space). If there is
20176 insufficient space available then either the function
20177 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
20178 called, depending upon the amount of stack space required. The runtime
20179 system is required to provide these functions. The default is
20180 @option{-mno-apcs-stack-check}, since this produces smaller code.
20181
20182 @c not currently implemented
20183 @item -mapcs-reentrant
20184 @opindex mapcs-reentrant
20185 Generate reentrant, position-independent code. The default is
20186 @option{-mno-apcs-reentrant}.
20187 @end ignore
20188
20189 @item -mthumb-interwork
20190 @opindex mthumb-interwork
20191 Generate code that supports calling between the ARM and Thumb
20192 instruction sets. Without this option, on pre-v5 architectures, the
20193 two instruction sets cannot be reliably used inside one program. The
20194 default is @option{-mno-thumb-interwork}, since slightly larger code
20195 is generated when @option{-mthumb-interwork} is specified. In AAPCS
20196 configurations this option is meaningless.
20197
20198 @item -mno-sched-prolog
20199 @opindex mno-sched-prolog
20200 @opindex msched-prolog
20201 Prevent the reordering of instructions in the function prologue, or the
20202 merging of those instruction with the instructions in the function's
20203 body. This means that all functions start with a recognizable set
20204 of instructions (or in fact one of a choice from a small set of
20205 different function prologues), and this information can be used to
20206 locate the start of functions inside an executable piece of code. The
20207 default is @option{-msched-prolog}.
20208
20209 @item -mfloat-abi=@var{name}
20210 @opindex mfloat-abi
20211 Specifies which floating-point ABI to use. Permissible values
20212 are: @samp{soft}, @samp{softfp} and @samp{hard}.
20213
20214 Specifying @samp{soft} causes GCC to generate output containing
20215 library calls for floating-point operations.
20216 @samp{softfp} allows the generation of code using hardware floating-point
20217 instructions, but still uses the soft-float calling conventions.
20218 @samp{hard} allows generation of floating-point instructions
20219 and uses FPU-specific calling conventions.
20220
20221 The default depends on the specific target configuration. Note that
20222 the hard-float and soft-float ABIs are not link-compatible; you must
20223 compile your entire program with the same ABI, and link with a
20224 compatible set of libraries.
20225
20226 @item -mgeneral-regs-only
20227 @opindex mgeneral-regs-only
20228 Generate code which uses only the general-purpose registers. This will prevent
20229 the compiler from using floating-point and Advanced SIMD registers but will not
20230 impose any restrictions on the assembler.
20231
20232 @item -mlittle-endian
20233 @opindex mlittle-endian
20234 Generate code for a processor running in little-endian mode. This is
20235 the default for all standard configurations.
20236
20237 @item -mbig-endian
20238 @opindex mbig-endian
20239 Generate code for a processor running in big-endian mode; the default is
20240 to compile code for a little-endian processor.
20241
20242 @item -mbe8
20243 @itemx -mbe32
20244 @opindex mbe8
20245 When linking a big-endian image select between BE8 and BE32 formats.
20246 The option has no effect for little-endian images and is ignored. The
20247 default is dependent on the selected target architecture. For ARMv6
20248 and later architectures the default is BE8, for older architectures
20249 the default is BE32. BE32 format has been deprecated by ARM.
20250
20251 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
20252 @opindex march
20253 This specifies the name of the target ARM architecture. GCC uses this
20254 name to determine what kind of instructions it can emit when generating
20255 assembly code. This option can be used in conjunction with or instead
20256 of the @option{-mcpu=} option.
20257
20258 Permissible names are:
20259 @samp{armv4t},
20260 @samp{armv5t}, @samp{armv5te},
20261 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
20262 @samp{armv6z}, @samp{armv6zk},
20263 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
20264 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
20265 @samp{armv8.4-a},
20266 @samp{armv8.5-a},
20267 @samp{armv8.6-a},
20268 @samp{armv9-a},
20269 @samp{armv7-r},
20270 @samp{armv8-r},
20271 @samp{armv6-m}, @samp{armv6s-m},
20272 @samp{armv7-m}, @samp{armv7e-m},
20273 @samp{armv8-m.base}, @samp{armv8-m.main},
20274 @samp{armv8.1-m.main},
20275 @samp{armv9-a},
20276 @samp{iwmmxt} and @samp{iwmmxt2}.
20277
20278 Additionally, the following architectures, which lack support for the
20279 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
20280
20281 Many of the architectures support extensions. These can be added by
20282 appending @samp{+@var{extension}} to the architecture name. Extension
20283 options are processed in order and capabilities accumulate. An extension
20284 will also enable any necessary base extensions
20285 upon which it depends. For example, the @samp{+crypto} extension
20286 will always enable the @samp{+simd} extension. The exception to the
20287 additive construction is for extensions that are prefixed with
20288 @samp{+no@dots{}}: these extensions disable the specified option and
20289 any other extensions that may depend on the presence of that
20290 extension.
20291
20292 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
20293 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
20294 entirely disabled by the @samp{+nofp} option that follows it.
20295
20296 Most extension names are generically named, but have an effect that is
20297 dependent upon the architecture to which it is applied. For example,
20298 the @samp{+simd} option can be applied to both @samp{armv7-a} and
20299 @samp{armv8-a} architectures, but will enable the original ARMv7-A
20300 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
20301 variant for @samp{armv8-a}.
20302
20303 The table below lists the supported extensions for each architecture.
20304 Architectures not mentioned do not support any extensions.
20305
20306 @table @samp
20307 @item armv5te
20308 @itemx armv6
20309 @itemx armv6j
20310 @itemx armv6k
20311 @itemx armv6kz
20312 @itemx armv6t2
20313 @itemx armv6z
20314 @itemx armv6zk
20315 @table @samp
20316 @item +fp
20317 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
20318 used as an alias for this extension.
20319
20320 @item +nofp
20321 Disable the floating-point instructions.
20322 @end table
20323
20324 @item armv7
20325 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
20326 @table @samp
20327 @item +fp
20328 The VFPv3 floating-point instructions, with 16 double-precision
20329 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20330 for this extension. Note that floating-point is not supported by the
20331 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
20332 ARMv7-R architectures.
20333
20334 @item +nofp
20335 Disable the floating-point instructions.
20336 @end table
20337
20338 @item armv7-a
20339 @table @samp
20340 @item +mp
20341 The multiprocessing extension.
20342
20343 @item +sec
20344 The security extension.
20345
20346 @item +fp
20347 The VFPv3 floating-point instructions, with 16 double-precision
20348 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20349 for this extension.
20350
20351 @item +simd
20352 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20353 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
20354 for this extension.
20355
20356 @item +vfpv3
20357 The VFPv3 floating-point instructions, with 32 double-precision
20358 registers.
20359
20360 @item +vfpv3-d16-fp16
20361 The VFPv3 floating-point instructions, with 16 double-precision
20362 registers and the half-precision floating-point conversion operations.
20363
20364 @item +vfpv3-fp16
20365 The VFPv3 floating-point instructions, with 32 double-precision
20366 registers and the half-precision floating-point conversion operations.
20367
20368 @item +vfpv4-d16
20369 The VFPv4 floating-point instructions, with 16 double-precision
20370 registers.
20371
20372 @item +vfpv4
20373 The VFPv4 floating-point instructions, with 32 double-precision
20374 registers.
20375
20376 @item +neon-fp16
20377 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20378 the half-precision floating-point conversion operations.
20379
20380 @item +neon-vfpv4
20381 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
20382
20383 @item +nosimd
20384 Disable the Advanced SIMD instructions (does not disable floating point).
20385
20386 @item +nofp
20387 Disable the floating-point and Advanced SIMD instructions.
20388 @end table
20389
20390 @item armv7ve
20391 The extended version of the ARMv7-A architecture with support for
20392 virtualization.
20393 @table @samp
20394 @item +fp
20395 The VFPv4 floating-point instructions, with 16 double-precision registers.
20396 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
20397
20398 @item +simd
20399 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
20400 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
20401
20402 @item +vfpv3-d16
20403 The VFPv3 floating-point instructions, with 16 double-precision
20404 registers.
20405
20406 @item +vfpv3
20407 The VFPv3 floating-point instructions, with 32 double-precision
20408 registers.
20409
20410 @item +vfpv3-d16-fp16
20411 The VFPv3 floating-point instructions, with 16 double-precision
20412 registers and the half-precision floating-point conversion operations.
20413
20414 @item +vfpv3-fp16
20415 The VFPv3 floating-point instructions, with 32 double-precision
20416 registers and the half-precision floating-point conversion operations.
20417
20418 @item +vfpv4-d16
20419 The VFPv4 floating-point instructions, with 16 double-precision
20420 registers.
20421
20422 @item +vfpv4
20423 The VFPv4 floating-point instructions, with 32 double-precision
20424 registers.
20425
20426 @item +neon
20427 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20428 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
20429
20430 @item +neon-fp16
20431 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20432 the half-precision floating-point conversion operations.
20433
20434 @item +nosimd
20435 Disable the Advanced SIMD instructions (does not disable floating point).
20436
20437 @item +nofp
20438 Disable the floating-point and Advanced SIMD instructions.
20439 @end table
20440
20441 @item armv8-a
20442 @table @samp
20443 @item +crc
20444 The Cyclic Redundancy Check (CRC) instructions.
20445 @item +simd
20446 The ARMv8-A Advanced SIMD and floating-point instructions.
20447 @item +crypto
20448 The cryptographic instructions.
20449 @item +nocrypto
20450 Disable the cryptographic instructions.
20451 @item +nofp
20452 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20453 @item +sb
20454 Speculation Barrier Instruction.
20455 @item +predres
20456 Execution and Data Prediction Restriction Instructions.
20457 @end table
20458
20459 @item armv8.1-a
20460 @table @samp
20461 @item +simd
20462 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20463
20464 @item +crypto
20465 The cryptographic instructions. This also enables the Advanced SIMD and
20466 floating-point instructions.
20467
20468 @item +nocrypto
20469 Disable the cryptographic instructions.
20470
20471 @item +nofp
20472 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20473
20474 @item +sb
20475 Speculation Barrier Instruction.
20476
20477 @item +predres
20478 Execution and Data Prediction Restriction Instructions.
20479 @end table
20480
20481 @item armv8.2-a
20482 @itemx armv8.3-a
20483 @table @samp
20484 @item +fp16
20485 The half-precision floating-point data processing instructions.
20486 This also enables the Advanced SIMD and floating-point instructions.
20487
20488 @item +fp16fml
20489 The half-precision floating-point fmla extension. This also enables
20490 the half-precision floating-point extension and Advanced SIMD and
20491 floating-point instructions.
20492
20493 @item +simd
20494 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20495
20496 @item +crypto
20497 The cryptographic instructions. This also enables the Advanced SIMD and
20498 floating-point instructions.
20499
20500 @item +dotprod
20501 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20502
20503 @item +nocrypto
20504 Disable the cryptographic extension.
20505
20506 @item +nofp
20507 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20508
20509 @item +sb
20510 Speculation Barrier Instruction.
20511
20512 @item +predres
20513 Execution and Data Prediction Restriction Instructions.
20514
20515 @item +i8mm
20516 8-bit Integer Matrix Multiply instructions.
20517 This also enables Advanced SIMD and floating-point instructions.
20518
20519 @item +bf16
20520 Brain half-precision floating-point instructions.
20521 This also enables Advanced SIMD and floating-point instructions.
20522 @end table
20523
20524 @item armv8.4-a
20525 @table @samp
20526 @item +fp16
20527 The half-precision floating-point data processing instructions.
20528 This also enables the Advanced SIMD and floating-point instructions as well
20529 as the Dot Product extension and the half-precision floating-point fmla
20530 extension.
20531
20532 @item +simd
20533 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20534 Dot Product extension.
20535
20536 @item +crypto
20537 The cryptographic instructions. This also enables the Advanced SIMD and
20538 floating-point instructions as well as the Dot Product extension.
20539
20540 @item +nocrypto
20541 Disable the cryptographic extension.
20542
20543 @item +nofp
20544 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20545
20546 @item +sb
20547 Speculation Barrier Instruction.
20548
20549 @item +predres
20550 Execution and Data Prediction Restriction Instructions.
20551
20552 @item +i8mm
20553 8-bit Integer Matrix Multiply instructions.
20554 This also enables Advanced SIMD and floating-point instructions.
20555
20556 @item +bf16
20557 Brain half-precision floating-point instructions.
20558 This also enables Advanced SIMD and floating-point instructions.
20559 @end table
20560
20561 @item armv8.5-a
20562 @table @samp
20563 @item +fp16
20564 The half-precision floating-point data processing instructions.
20565 This also enables the Advanced SIMD and floating-point instructions as well
20566 as the Dot Product extension and the half-precision floating-point fmla
20567 extension.
20568
20569 @item +simd
20570 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20571 Dot Product extension.
20572
20573 @item +crypto
20574 The cryptographic instructions. This also enables the Advanced SIMD and
20575 floating-point instructions as well as the Dot Product extension.
20576
20577 @item +nocrypto
20578 Disable the cryptographic extension.
20579
20580 @item +nofp
20581 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20582
20583 @item +i8mm
20584 8-bit Integer Matrix Multiply instructions.
20585 This also enables Advanced SIMD and floating-point instructions.
20586
20587 @item +bf16
20588 Brain half-precision floating-point instructions.
20589 This also enables Advanced SIMD and floating-point instructions.
20590 @end table
20591
20592 @item armv8.6-a
20593 @table @samp
20594 @item +fp16
20595 The half-precision floating-point data processing instructions.
20596 This also enables the Advanced SIMD and floating-point instructions as well
20597 as the Dot Product extension and the half-precision floating-point fmla
20598 extension.
20599
20600 @item +simd
20601 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20602 Dot Product extension.
20603
20604 @item +crypto
20605 The cryptographic instructions. This also enables the Advanced SIMD and
20606 floating-point instructions as well as the Dot Product extension.
20607
20608 @item +nocrypto
20609 Disable the cryptographic extension.
20610
20611 @item +nofp
20612 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20613
20614 @item +i8mm
20615 8-bit Integer Matrix Multiply instructions.
20616 This also enables Advanced SIMD and floating-point instructions.
20617
20618 @item +bf16
20619 Brain half-precision floating-point instructions.
20620 This also enables Advanced SIMD and floating-point instructions.
20621 @end table
20622
20623 @item armv7-r
20624 @table @samp
20625 @item +fp.sp
20626 The single-precision VFPv3 floating-point instructions. The extension
20627 @samp{+vfpv3xd} can be used as an alias for this extension.
20628
20629 @item +fp
20630 The VFPv3 floating-point instructions with 16 double-precision registers.
20631 The extension +vfpv3-d16 can be used as an alias for this extension.
20632
20633 @item +vfpv3xd-d16-fp16
20634 The single-precision VFPv3 floating-point instructions with 16 double-precision
20635 registers and the half-precision floating-point conversion operations.
20636
20637 @item +vfpv3-d16-fp16
20638 The VFPv3 floating-point instructions with 16 double-precision
20639 registers and the half-precision floating-point conversion operations.
20640
20641 @item +nofp
20642 Disable the floating-point extension.
20643
20644 @item +idiv
20645 The ARM-state integer division instructions.
20646
20647 @item +noidiv
20648 Disable the ARM-state integer division extension.
20649 @end table
20650
20651 @item armv7e-m
20652 @table @samp
20653 @item +fp
20654 The single-precision VFPv4 floating-point instructions.
20655
20656 @item +fpv5
20657 The single-precision FPv5 floating-point instructions.
20658
20659 @item +fp.dp
20660 The single- and double-precision FPv5 floating-point instructions.
20661
20662 @item +nofp
20663 Disable the floating-point extensions.
20664 @end table
20665
20666 @item armv8.1-m.main
20667 @table @samp
20668
20669 @item +dsp
20670 The DSP instructions.
20671
20672 @item +mve
20673 The M-Profile Vector Extension (MVE) integer instructions.
20674
20675 @item +mve.fp
20676 The M-Profile Vector Extension (MVE) integer and single precision
20677 floating-point instructions.
20678
20679 @item +fp
20680 The single-precision floating-point instructions.
20681
20682 @item +fp.dp
20683 The single- and double-precision floating-point instructions.
20684
20685 @item +nofp
20686 Disable the floating-point extension.
20687
20688 @item +cdecp0, +cdecp1, ... , +cdecp7
20689 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20690 to the numbers given in the options in the range 0 to 7.
20691 @end table
20692
20693 @item armv8-m.main
20694 @table @samp
20695 @item +dsp
20696 The DSP instructions.
20697
20698 @item +nodsp
20699 Disable the DSP extension.
20700
20701 @item +fp
20702 The single-precision floating-point instructions.
20703
20704 @item +fp.dp
20705 The single- and double-precision floating-point instructions.
20706
20707 @item +nofp
20708 Disable the floating-point extension.
20709
20710 @item +cdecp0, +cdecp1, ... , +cdecp7
20711 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20712 to the numbers given in the options in the range 0 to 7.
20713 @end table
20714
20715 @item armv8-r
20716 @table @samp
20717 @item +crc
20718 The Cyclic Redundancy Check (CRC) instructions.
20719 @item +fp.sp
20720 The single-precision FPv5 floating-point instructions.
20721 @item +simd
20722 The ARMv8-A Advanced SIMD and floating-point instructions.
20723 @item +crypto
20724 The cryptographic instructions.
20725 @item +nocrypto
20726 Disable the cryptographic instructions.
20727 @item +nofp
20728 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20729 @end table
20730
20731 @end table
20732
20733 @option{-march=native} causes the compiler to auto-detect the architecture
20734 of the build computer. At present, this feature is only supported on
20735 GNU/Linux, and not all architectures are recognized. If the auto-detect
20736 is unsuccessful the option has no effect.
20737
20738 @item -mtune=@var{name}
20739 @opindex mtune
20740 This option specifies the name of the target ARM processor for
20741 which GCC should tune the performance of the code.
20742 For some ARM implementations better performance can be obtained by using
20743 this option.
20744 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
20745 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
20746 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
20747 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
20748 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
20749 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
20750 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
20751 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
20752 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
20753 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
20754 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
20755 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20756 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20757 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20758 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
20759 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
20760 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
20761 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
20762 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
20763 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
20764 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
20765 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
20766 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
20767 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
20768 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
20769
20770 Additionally, this option can specify that GCC should tune the performance
20771 of the code for a big.LITTLE system. Permissible names are:
20772 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
20773 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20774 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
20775 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
20776
20777 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
20778 performance for a blend of processors within architecture @var{arch}.
20779 The aim is to generate code that run well on the current most popular
20780 processors, balancing between optimizations that benefit some CPUs in the
20781 range, and avoiding performance pitfalls of other CPUs. The effects of
20782 this option may change in future GCC versions as CPU models come and go.
20783
20784 @option{-mtune} permits the same extension options as @option{-mcpu}, but
20785 the extension options do not affect the tuning of the generated code.
20786
20787 @option{-mtune=native} causes the compiler to auto-detect the CPU
20788 of the build computer. At present, this feature is only supported on
20789 GNU/Linux, and not all architectures are recognized. If the auto-detect is
20790 unsuccessful the option has no effect.
20791
20792 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
20793 @opindex mcpu
20794 This specifies the name of the target ARM processor. GCC uses this name
20795 to derive the name of the target ARM architecture (as if specified
20796 by @option{-march}) and the ARM processor type for which to tune for
20797 performance (as if specified by @option{-mtune}). Where this option
20798 is used in conjunction with @option{-march} or @option{-mtune},
20799 those options take precedence over the appropriate part of this option.
20800
20801 Many of the supported CPUs implement optional architectural
20802 extensions. Where this is so the architectural extensions are
20803 normally enabled by default. If implementations that lack the
20804 extension exist, then the extension syntax can be used to disable
20805 those extensions that have been omitted. For floating-point and
20806 Advanced SIMD (Neon) instructions, the settings of the options
20807 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
20808 floating-point and Advanced SIMD instructions will only be used if
20809 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
20810 @option{-mfpu} other than @samp{auto} will override the available
20811 floating-point and SIMD extension instructions.
20812
20813 For example, @samp{cortex-a9} can be found in three major
20814 configurations: integer only, with just a floating-point unit or with
20815 floating-point and Advanced SIMD. The default is to enable all the
20816 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
20817 be used to disable just the SIMD or both the SIMD and floating-point
20818 instructions respectively.
20819
20820 Permissible names for this option are the same as those for
20821 @option{-mtune}.
20822
20823 The following extension options are common to the listed CPUs:
20824
20825 @table @samp
20826 @item +nodsp
20827 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
20828
20829 @item +nofp
20830 Disables the floating-point instructions on @samp{arm9e},
20831 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
20832 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
20833 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
20834 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
20835 Disables the floating-point and SIMD instructions on
20836 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
20837 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
20838 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
20839 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
20840 @samp{cortex-a53} and @samp{cortex-a55}.
20841
20842 @item +nofp.dp
20843 Disables the double-precision component of the floating-point instructions
20844 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
20845 @samp{cortex-r52plus} and @samp{cortex-m7}.
20846
20847 @item +nosimd
20848 Disables the SIMD (but not floating-point) instructions on
20849 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
20850 and @samp{cortex-a9}.
20851
20852 @item +crypto
20853 Enables the cryptographic instructions on @samp{cortex-a32},
20854 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
20855 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
20856 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20857 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
20858 @samp{cortex-a75.cortex-a55}.
20859 @end table
20860
20861 Additionally the @samp{generic-armv7-a} pseudo target defaults to
20862 VFPv3 with 16 double-precision registers. It supports the following
20863 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
20864 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
20865 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
20866 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
20867 the extensions to @option{-march=armv7-a}.
20868
20869 @option{-mcpu=generic-@var{arch}} is also permissible, and is
20870 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
20871 See @option{-mtune} for more information.
20872
20873 @option{-mcpu=native} causes the compiler to auto-detect the CPU
20874 of the build computer. At present, this feature is only supported on
20875 GNU/Linux, and not all architectures are recognized. If the auto-detect
20876 is unsuccessful the option has no effect.
20877
20878 @item -mfpu=@var{name}
20879 @opindex mfpu
20880 This specifies what floating-point hardware (or hardware emulation) is
20881 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
20882 @samp{vfpv3},
20883 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
20884 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
20885 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
20886 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
20887 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
20888 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
20889 is an alias for @samp{vfpv2}.
20890
20891 The setting @samp{auto} is the default and is special. It causes the
20892 compiler to select the floating-point and Advanced SIMD instructions
20893 based on the settings of @option{-mcpu} and @option{-march}.
20894
20895 If the selected floating-point hardware includes the NEON extension
20896 (e.g.@: @option{-mfpu=neon}), note that floating-point
20897 operations are not generated by GCC's auto-vectorization pass unless
20898 @option{-funsafe-math-optimizations} is also specified. This is
20899 because NEON hardware does not fully implement the IEEE 754 standard for
20900 floating-point arithmetic (in particular denormal values are treated as
20901 zero), so the use of NEON instructions may lead to a loss of precision.
20902
20903 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}).
20904
20905 @item -mfp16-format=@var{name}
20906 @opindex mfp16-format
20907 Specify the format of the @code{__fp16} half-precision floating-point type.
20908 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
20909 the default is @samp{none}, in which case the @code{__fp16} type is not
20910 defined. @xref{Half-Precision}, for more information.
20911
20912 @item -mstructure-size-boundary=@var{n}
20913 @opindex mstructure-size-boundary
20914 The sizes of all structures and unions are rounded up to a multiple
20915 of the number of bits set by this option. Permissible values are 8, 32
20916 and 64. The default value varies for different toolchains. For the COFF
20917 targeted toolchain the default value is 8. A value of 64 is only allowed
20918 if the underlying ABI supports it.
20919
20920 Specifying a larger number can produce faster, more efficient code, but
20921 can also increase the size of the program. Different values are potentially
20922 incompatible. Code compiled with one value cannot necessarily expect to
20923 work with code or libraries compiled with another value, if they exchange
20924 information using structures or unions.
20925
20926 This option is deprecated.
20927
20928 @item -mabort-on-noreturn
20929 @opindex mabort-on-noreturn
20930 Generate a call to the function @code{abort} at the end of a
20931 @code{noreturn} function. It is executed if the function tries to
20932 return.
20933
20934 @item -mlong-calls
20935 @itemx -mno-long-calls
20936 @opindex mlong-calls
20937 @opindex mno-long-calls
20938 Tells the compiler to perform function calls by first loading the
20939 address of the function into a register and then performing a subroutine
20940 call on this register. This switch is needed if the target function
20941 lies outside of the 64-megabyte addressing range of the offset-based
20942 version of subroutine call instruction.
20943
20944 Even if this switch is enabled, not all function calls are turned
20945 into long calls. The heuristic is that static functions, functions
20946 that have the @code{short_call} attribute, functions that are inside
20947 the scope of a @code{#pragma no_long_calls} directive, and functions whose
20948 definitions have already been compiled within the current compilation
20949 unit are not turned into long calls. The exceptions to this rule are
20950 that weak function definitions, functions with the @code{long_call}
20951 attribute or the @code{section} attribute, and functions that are within
20952 the scope of a @code{#pragma long_calls} directive are always
20953 turned into long calls.
20954
20955 This feature is not enabled by default. Specifying
20956 @option{-mno-long-calls} restores the default behavior, as does
20957 placing the function calls within the scope of a @code{#pragma
20958 long_calls_off} directive. Note these switches have no effect on how
20959 the compiler generates code to handle function calls via function
20960 pointers.
20961
20962 @item -msingle-pic-base
20963 @opindex msingle-pic-base
20964 Treat the register used for PIC addressing as read-only, rather than
20965 loading it in the prologue for each function. The runtime system is
20966 responsible for initializing this register with an appropriate value
20967 before execution begins.
20968
20969 @item -mpic-register=@var{reg}
20970 @opindex mpic-register
20971 Specify the register to be used for PIC addressing.
20972 For standard PIC base case, the default is any suitable register
20973 determined by compiler. For single PIC base case, the default is
20974 @samp{R9} if target is EABI based or stack-checking is enabled,
20975 otherwise the default is @samp{R10}.
20976
20977 @item -mpic-data-is-text-relative
20978 @opindex mpic-data-is-text-relative
20979 Assume that the displacement between the text and data segments is fixed
20980 at static link time. This permits using PC-relative addressing
20981 operations to access data known to be in the data segment. For
20982 non-VxWorks RTP targets, this option is enabled by default. When
20983 disabled on such targets, it will enable @option{-msingle-pic-base} by
20984 default.
20985
20986 @item -mpoke-function-name
20987 @opindex mpoke-function-name
20988 Write the name of each function into the text section, directly
20989 preceding the function prologue. The generated code is similar to this:
20990
20991 @smallexample
20992 t0
20993 .ascii "arm_poke_function_name", 0
20994 .align
20995 t1
20996 .word 0xff000000 + (t1 - t0)
20997 arm_poke_function_name
20998 mov ip, sp
20999 stmfd sp!, @{fp, ip, lr, pc@}
21000 sub fp, ip, #4
21001 @end smallexample
21002
21003 When performing a stack backtrace, code can inspect the value of
21004 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
21005 location @code{pc - 12} and the top 8 bits are set, then we know that
21006 there is a function name embedded immediately preceding this location
21007 and has length @code{((pc[-3]) & 0xff000000)}.
21008
21009 @item -mthumb
21010 @itemx -marm
21011 @opindex marm
21012 @opindex mthumb
21013
21014 Select between generating code that executes in ARM and Thumb
21015 states. The default for most configurations is to generate code
21016 that executes in ARM state, but the default can be changed by
21017 configuring GCC with the @option{--with-mode=}@var{state}
21018 configure option.
21019
21020 You can also override the ARM and Thumb mode for each function
21021 by using the @code{target("thumb")} and @code{target("arm")} function attributes
21022 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
21023
21024 @item -mflip-thumb
21025 @opindex mflip-thumb
21026 Switch ARM/Thumb modes on alternating functions.
21027 This option is provided for regression testing of mixed Thumb/ARM code
21028 generation, and is not intended for ordinary use in compiling code.
21029
21030 @item -mtpcs-frame
21031 @opindex mtpcs-frame
21032 Generate a stack frame that is compliant with the Thumb Procedure Call
21033 Standard for all non-leaf functions. (A leaf function is one that does
21034 not call any other functions.) The default is @option{-mno-tpcs-frame}.
21035
21036 @item -mtpcs-leaf-frame
21037 @opindex mtpcs-leaf-frame
21038 Generate a stack frame that is compliant with the Thumb Procedure Call
21039 Standard for all leaf functions. (A leaf function is one that does
21040 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
21041
21042 @item -mcallee-super-interworking
21043 @opindex mcallee-super-interworking
21044 Gives all externally visible functions in the file being compiled an ARM
21045 instruction set header which switches to Thumb mode before executing the
21046 rest of the function. This allows these functions to be called from
21047 non-interworking code. This option is not valid in AAPCS configurations
21048 because interworking is enabled by default.
21049
21050 @item -mcaller-super-interworking
21051 @opindex mcaller-super-interworking
21052 Allows calls via function pointers (including virtual functions) to
21053 execute correctly regardless of whether the target code has been
21054 compiled for interworking or not. There is a small overhead in the cost
21055 of executing a function pointer if this option is enabled. This option
21056 is not valid in AAPCS configurations because interworking is enabled
21057 by default.
21058
21059 @item -mtp=@var{name}
21060 @opindex mtp
21061 Specify the access model for the thread local storage pointer. The valid
21062 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
21063 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
21064 (supported in the arm6k architecture), and @samp{auto}, which uses the
21065 best available method for the selected processor. The default setting is
21066 @samp{auto}.
21067
21068 @item -mtls-dialect=@var{dialect}
21069 @opindex mtls-dialect
21070 Specify the dialect to use for accessing thread local storage. Two
21071 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
21072 @samp{gnu} dialect selects the original GNU scheme for supporting
21073 local and global dynamic TLS models. The @samp{gnu2} dialect
21074 selects the GNU descriptor scheme, which provides better performance
21075 for shared libraries. The GNU descriptor scheme is compatible with
21076 the original scheme, but does require new assembler, linker and
21077 library support. Initial and local exec TLS models are unaffected by
21078 this option and always use the original scheme.
21079
21080 @item -mword-relocations
21081 @opindex mword-relocations
21082 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
21083 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
21084 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
21085 is specified. This option conflicts with @option{-mslow-flash-data}.
21086
21087 @item -mfix-cortex-m3-ldrd
21088 @opindex mfix-cortex-m3-ldrd
21089 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
21090 with overlapping destination and base registers are used. This option avoids
21091 generating these instructions. This option is enabled by default when
21092 @option{-mcpu=cortex-m3} is specified.
21093
21094 @item -munaligned-access
21095 @itemx -mno-unaligned-access
21096 @opindex munaligned-access
21097 @opindex mno-unaligned-access
21098 Enables (or disables) reading and writing of 16- and 32- bit values
21099 from addresses that are not 16- or 32- bit aligned. By default
21100 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
21101 ARMv8-M Baseline architectures, and enabled for all other
21102 architectures. If unaligned access is not enabled then words in packed
21103 data structures are accessed a byte at a time.
21104
21105 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
21106 generated object file to either true or false, depending upon the
21107 setting of this option. If unaligned access is enabled then the
21108 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
21109 defined.
21110
21111 @item -mneon-for-64bits
21112 @opindex mneon-for-64bits
21113 This option is deprecated and has no effect.
21114
21115 @item -mslow-flash-data
21116 @opindex mslow-flash-data
21117 Assume loading data from flash is slower than fetching instruction.
21118 Therefore literal load is minimized for better performance.
21119 This option is only supported when compiling for ARMv7 M-profile and
21120 off by default. It conflicts with @option{-mword-relocations}.
21121
21122 @item -masm-syntax-unified
21123 @opindex masm-syntax-unified
21124 Assume inline assembler is using unified asm syntax. The default is
21125 currently off which implies divided syntax. This option has no impact
21126 on Thumb2. However, this may change in future releases of GCC.
21127 Divided syntax should be considered deprecated.
21128
21129 @item -mrestrict-it
21130 @opindex mrestrict-it
21131 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
21132 IT blocks can only contain a single 16-bit instruction from a select
21133 set of instructions. This option is on by default for ARMv8-A Thumb mode.
21134
21135 @item -mprint-tune-info
21136 @opindex mprint-tune-info
21137 Print CPU tuning information as comment in assembler file. This is
21138 an option used only for regression testing of the compiler and not
21139 intended for ordinary use in compiling code. This option is disabled
21140 by default.
21141
21142 @item -mverbose-cost-dump
21143 @opindex mverbose-cost-dump
21144 Enable verbose cost model dumping in the debug dump files. This option is
21145 provided for use in debugging the compiler.
21146
21147 @item -mpure-code
21148 @opindex mpure-code
21149 Do not allow constant data to be placed in code sections.
21150 Additionally, when compiling for ELF object format give all text sections the
21151 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
21152 is only available when generating non-pic code for M-profile targets.
21153
21154 @item -mcmse
21155 @opindex mcmse
21156 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
21157 Development Tools Engineering Specification", which can be found on
21158 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
21159
21160 @item -mfix-cmse-cve-2021-35465
21161 @opindex mfix-cmse-cve-2021-35465
21162 Mitigate against a potential security issue with the @code{VLLDM} instruction
21163 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
21164 enabled by default when the option @option{-mcpu=} is used with
21165 @code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
21166 @option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
21167
21168 @item -mfdpic
21169 @itemx -mno-fdpic
21170 @opindex mfdpic
21171 @opindex mno-fdpic
21172 Select the FDPIC ABI, which uses 64-bit function descriptors to
21173 represent pointers to functions. When the compiler is configured for
21174 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
21175 and implies @option{-fPIE} if none of the PIC/PIE-related options is
21176 provided. On other targets, it only enables the FDPIC-specific code
21177 generation features, and the user should explicitly provide the
21178 PIC/PIE-related options as needed.
21179
21180 Note that static linking is not supported because it would still
21181 involve the dynamic linker when the program self-relocates. If such
21182 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
21183
21184 The opposite @option{-mno-fdpic} option is useful (and required) to
21185 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
21186 toolchain as the one used to build the userland programs.
21187
21188 @end table
21189
21190 @node AVR Options
21191 @subsection AVR Options
21192 @cindex AVR Options
21193
21194 These options are defined for AVR implementations:
21195
21196 @table @gcctabopt
21197 @item -mmcu=@var{mcu}
21198 @opindex mmcu
21199 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
21200
21201 The default for this option is@tie{}@samp{avr2}.
21202
21203 GCC supports the following AVR devices and ISAs:
21204
21205 @include avr-mmcu.texi
21206
21207 @item -mabsdata
21208 @opindex mabsdata
21209
21210 Assume that all data in static storage can be accessed by LDS / STS
21211 instructions. This option has only an effect on reduced Tiny devices like
21212 ATtiny40. See also the @code{absdata}
21213 @ref{AVR Variable Attributes,variable attribute}.
21214
21215 @item -maccumulate-args
21216 @opindex maccumulate-args
21217 Accumulate outgoing function arguments and acquire/release the needed
21218 stack space for outgoing function arguments once in function
21219 prologue/epilogue. Without this option, outgoing arguments are pushed
21220 before calling a function and popped afterwards.
21221
21222 Popping the arguments after the function call can be expensive on
21223 AVR so that accumulating the stack space might lead to smaller
21224 executables because arguments need not be removed from the
21225 stack after such a function call.
21226
21227 This option can lead to reduced code size for functions that perform
21228 several calls to functions that get their arguments on the stack like
21229 calls to printf-like functions.
21230
21231 @item -mbranch-cost=@var{cost}
21232 @opindex mbranch-cost
21233 Set the branch costs for conditional branch instructions to
21234 @var{cost}. Reasonable values for @var{cost} are small, non-negative
21235 integers. The default branch cost is 0.
21236
21237 @item -mcall-prologues
21238 @opindex mcall-prologues
21239 Functions prologues/epilogues are expanded as calls to appropriate
21240 subroutines. Code size is smaller.
21241
21242 @item -mdouble=@var{bits}
21243 @itemx -mlong-double=@var{bits}
21244 @opindex mdouble
21245 @opindex mlong-double
21246 Set the size (in bits) of the @code{double} or @code{long double} type,
21247 respectively. Possible values for @var{bits} are 32 and 64.
21248 Whether or not a specific value for @var{bits} is allowed depends on
21249 the @code{--with-double=} and @code{--with-long-double=}
21250 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
21251 and the same applies for the default values of the options.
21252
21253 @item -mgas-isr-prologues
21254 @opindex mgas-isr-prologues
21255 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
21256 instruction supported by GNU Binutils.
21257 If this option is on, the feature can still be disabled for individual
21258 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
21259 function attribute. This feature is activated per default
21260 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
21261 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
21262
21263 @item -mint8
21264 @opindex mint8
21265 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
21266 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
21267 and @code{long long} is 4 bytes. Please note that this option does not
21268 conform to the C standards, but it results in smaller code
21269 size.
21270
21271 @item -mmain-is-OS_task
21272 @opindex mmain-is-OS_task
21273 Do not save registers in @code{main}. The effect is the same like
21274 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
21275 to @code{main}. It is activated per default if optimization is on.
21276
21277 @item -mn-flash=@var{num}
21278 @opindex mn-flash
21279 Assume that the flash memory has a size of
21280 @var{num} times 64@tie{}KiB.
21281
21282 @item -mno-interrupts
21283 @opindex mno-interrupts
21284 Generated code is not compatible with hardware interrupts.
21285 Code size is smaller.
21286
21287 @item -mrelax
21288 @opindex mrelax
21289 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
21290 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
21291 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
21292 the assembler's command line and the @option{--relax} option to the
21293 linker's command line.
21294
21295 Jump relaxing is performed by the linker because jump offsets are not
21296 known before code is located. Therefore, the assembler code generated by the
21297 compiler is the same, but the instructions in the executable may
21298 differ from instructions in the assembler code.
21299
21300 Relaxing must be turned on if linker stubs are needed, see the
21301 section on @code{EIND} and linker stubs below.
21302
21303 @item -mrmw
21304 @opindex mrmw
21305 Assume that the device supports the Read-Modify-Write
21306 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
21307
21308 @item -mshort-calls
21309 @opindex mshort-calls
21310
21311 Assume that @code{RJMP} and @code{RCALL} can target the whole
21312 program memory.
21313
21314 This option is used internally for multilib selection. It is
21315 not an optimization option, and you don't need to set it by hand.
21316
21317 @item -msp8
21318 @opindex msp8
21319 Treat the stack pointer register as an 8-bit register,
21320 i.e.@: assume the high byte of the stack pointer is zero.
21321 In general, you don't need to set this option by hand.
21322
21323 This option is used internally by the compiler to select and
21324 build multilibs for architectures @code{avr2} and @code{avr25}.
21325 These architectures mix devices with and without @code{SPH}.
21326 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
21327 the compiler driver adds or removes this option from the compiler
21328 proper's command line, because the compiler then knows if the device
21329 or architecture has an 8-bit stack pointer and thus no @code{SPH}
21330 register or not.
21331
21332 @item -mstrict-X
21333 @opindex mstrict-X
21334 Use address register @code{X} in a way proposed by the hardware. This means
21335 that @code{X} is only used in indirect, post-increment or
21336 pre-decrement addressing.
21337
21338 Without this option, the @code{X} register may be used in the same way
21339 as @code{Y} or @code{Z} which then is emulated by additional
21340 instructions.
21341 For example, loading a value with @code{X+const} addressing with a
21342 small non-negative @code{const < 64} to a register @var{Rn} is
21343 performed as
21344
21345 @example
21346 adiw r26, const ; X += const
21347 ld @var{Rn}, X ; @var{Rn} = *X
21348 sbiw r26, const ; X -= const
21349 @end example
21350
21351 @item -mtiny-stack
21352 @opindex mtiny-stack
21353 Only change the lower 8@tie{}bits of the stack pointer.
21354
21355 @item -mfract-convert-truncate
21356 @opindex mfract-convert-truncate
21357 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
21358
21359 @item -nodevicelib
21360 @opindex nodevicelib
21361 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
21362
21363 @item -nodevicespecs
21364 @opindex nodevicespecs
21365 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
21366 command line. The user takes responsibility for supplying the sub-processes
21367 like compiler proper, assembler and linker with appropriate command line
21368 options. This means that the user has to supply her private device specs
21369 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
21370 more need for option @option{-mmcu=@var{mcu}}.
21371
21372 This option can also serve as a replacement for the older way of
21373 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
21374 which contains a folder named @code{device-specs} which contains a specs file named
21375 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
21376
21377 @item -Waddr-space-convert
21378 @opindex Waddr-space-convert
21379 @opindex Wno-addr-space-convert
21380 Warn about conversions between address spaces in the case where the
21381 resulting address space is not contained in the incoming address space.
21382
21383 @item -Wmisspelled-isr
21384 @opindex Wmisspelled-isr
21385 @opindex Wno-misspelled-isr
21386 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
21387 Enabled by default.
21388 @end table
21389
21390 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
21391 @cindex @code{EIND}
21392 Pointers in the implementation are 16@tie{}bits wide.
21393 The address of a function or label is represented as word address so
21394 that indirect jumps and calls can target any code address in the
21395 range of 64@tie{}Ki words.
21396
21397 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
21398 bytes of program memory space, there is a special function register called
21399 @code{EIND} that serves as most significant part of the target address
21400 when @code{EICALL} or @code{EIJMP} instructions are used.
21401
21402 Indirect jumps and calls on these devices are handled as follows by
21403 the compiler and are subject to some limitations:
21404
21405 @itemize @bullet
21406
21407 @item
21408 The compiler never sets @code{EIND}.
21409
21410 @item
21411 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
21412 instructions or might read @code{EIND} directly in order to emulate an
21413 indirect call/jump by means of a @code{RET} instruction.
21414
21415 @item
21416 The compiler assumes that @code{EIND} never changes during the startup
21417 code or during the application. In particular, @code{EIND} is not
21418 saved/restored in function or interrupt service routine
21419 prologue/epilogue.
21420
21421 @item
21422 For indirect calls to functions and computed goto, the linker
21423 generates @emph{stubs}. Stubs are jump pads sometimes also called
21424 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
21425 The stub contains a direct jump to the desired address.
21426
21427 @item
21428 Linker relaxation must be turned on so that the linker generates
21429 the stubs correctly in all situations. See the compiler option
21430 @option{-mrelax} and the linker option @option{--relax}.
21431 There are corner cases where the linker is supposed to generate stubs
21432 but aborts without relaxation and without a helpful error message.
21433
21434 @item
21435 The default linker script is arranged for code with @code{EIND = 0}.
21436 If code is supposed to work for a setup with @code{EIND != 0}, a custom
21437 linker script has to be used in order to place the sections whose
21438 name start with @code{.trampolines} into the segment where @code{EIND}
21439 points to.
21440
21441 @item
21442 The startup code from libgcc never sets @code{EIND}.
21443 Notice that startup code is a blend of code from libgcc and AVR-LibC.
21444 For the impact of AVR-LibC on @code{EIND}, see the
21445 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
21446
21447 @item
21448 It is legitimate for user-specific startup code to set up @code{EIND}
21449 early, for example by means of initialization code located in
21450 section @code{.init3}. Such code runs prior to general startup code
21451 that initializes RAM and calls constructors, but after the bit
21452 of startup code from AVR-LibC that sets @code{EIND} to the segment
21453 where the vector table is located.
21454 @example
21455 #include <avr/io.h>
21456
21457 static void
21458 __attribute__((section(".init3"),naked,used,no_instrument_function))
21459 init3_set_eind (void)
21460 @{
21461 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
21462 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
21463 @}
21464 @end example
21465
21466 @noindent
21467 The @code{__trampolines_start} symbol is defined in the linker script.
21468
21469 @item
21470 Stubs are generated automatically by the linker if
21471 the following two conditions are met:
21472 @itemize @minus
21473
21474 @item The address of a label is taken by means of the @code{gs} modifier
21475 (short for @emph{generate stubs}) like so:
21476 @example
21477 LDI r24, lo8(gs(@var{func}))
21478 LDI r25, hi8(gs(@var{func}))
21479 @end example
21480 @item The final location of that label is in a code segment
21481 @emph{outside} the segment where the stubs are located.
21482 @end itemize
21483
21484 @item
21485 The compiler emits such @code{gs} modifiers for code labels in the
21486 following situations:
21487 @itemize @minus
21488 @item Taking address of a function or code label.
21489 @item Computed goto.
21490 @item If prologue-save function is used, see @option{-mcall-prologues}
21491 command-line option.
21492 @item Switch/case dispatch tables. If you do not want such dispatch
21493 tables you can specify the @option{-fno-jump-tables} command-line option.
21494 @item C and C++ constructors/destructors called during startup/shutdown.
21495 @item If the tools hit a @code{gs()} modifier explained above.
21496 @end itemize
21497
21498 @item
21499 Jumping to non-symbolic addresses like so is @emph{not} supported:
21500
21501 @example
21502 int main (void)
21503 @{
21504 /* Call function at word address 0x2 */
21505 return ((int(*)(void)) 0x2)();
21506 @}
21507 @end example
21508
21509 Instead, a stub has to be set up, i.e.@: the function has to be called
21510 through a symbol (@code{func_4} in the example):
21511
21512 @example
21513 int main (void)
21514 @{
21515 extern int func_4 (void);
21516
21517 /* Call function at byte address 0x4 */
21518 return func_4();
21519 @}
21520 @end example
21521
21522 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
21523 Alternatively, @code{func_4} can be defined in the linker script.
21524 @end itemize
21525
21526 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
21527 @cindex @code{RAMPD}
21528 @cindex @code{RAMPX}
21529 @cindex @code{RAMPY}
21530 @cindex @code{RAMPZ}
21531 Some AVR devices support memories larger than the 64@tie{}KiB range
21532 that can be accessed with 16-bit pointers. To access memory locations
21533 outside this 64@tie{}KiB range, the content of a @code{RAMP}
21534 register is used as high part of the address:
21535 The @code{X}, @code{Y}, @code{Z} address register is concatenated
21536 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
21537 register, respectively, to get a wide address. Similarly,
21538 @code{RAMPD} is used together with direct addressing.
21539
21540 @itemize
21541 @item
21542 The startup code initializes the @code{RAMP} special function
21543 registers with zero.
21544
21545 @item
21546 If a @ref{AVR Named Address Spaces,named address space} other than
21547 generic or @code{__flash} is used, then @code{RAMPZ} is set
21548 as needed before the operation.
21549
21550 @item
21551 If the device supports RAM larger than 64@tie{}KiB and the compiler
21552 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
21553 is reset to zero after the operation.
21554
21555 @item
21556 If the device comes with a specific @code{RAMP} register, the ISR
21557 prologue/epilogue saves/restores that SFR and initializes it with
21558 zero in case the ISR code might (implicitly) use it.
21559
21560 @item
21561 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
21562 If you use inline assembler to read from locations outside the
21563 16-bit address range and change one of the @code{RAMP} registers,
21564 you must reset it to zero after the access.
21565
21566 @end itemize
21567
21568 @subsubsection AVR Built-in Macros
21569
21570 GCC defines several built-in macros so that the user code can test
21571 for the presence or absence of features. Almost any of the following
21572 built-in macros are deduced from device capabilities and thus
21573 triggered by the @option{-mmcu=} command-line option.
21574
21575 For even more AVR-specific built-in macros see
21576 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
21577
21578 @table @code
21579
21580 @item __AVR_ARCH__
21581 Build-in macro that resolves to a decimal number that identifies the
21582 architecture and depends on the @option{-mmcu=@var{mcu}} option.
21583 Possible values are:
21584
21585 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
21586 @code{4}, @code{5}, @code{51}, @code{6}
21587
21588 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
21589 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
21590
21591 respectively and
21592
21593 @code{100},
21594 @code{102}, @code{103}, @code{104},
21595 @code{105}, @code{106}, @code{107}
21596
21597 for @var{mcu}=@code{avrtiny},
21598 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
21599 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
21600 If @var{mcu} specifies a device, this built-in macro is set
21601 accordingly. For example, with @option{-mmcu=atmega8} the macro is
21602 defined to @code{4}.
21603
21604 @item __AVR_@var{Device}__
21605 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
21606 the device's name. For example, @option{-mmcu=atmega8} defines the
21607 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
21608 @code{__AVR_ATtiny261A__}, etc.
21609
21610 The built-in macros' names follow
21611 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
21612 the device name as from the AVR user manual. The difference between
21613 @var{Device} in the built-in macro and @var{device} in
21614 @option{-mmcu=@var{device}} is that the latter is always lowercase.
21615
21616 If @var{device} is not a device but only a core architecture like
21617 @samp{avr51}, this macro is not defined.
21618
21619 @item __AVR_DEVICE_NAME__
21620 Setting @option{-mmcu=@var{device}} defines this built-in macro to
21621 the device's name. For example, with @option{-mmcu=atmega8} the macro
21622 is defined to @code{atmega8}.
21623
21624 If @var{device} is not a device but only a core architecture like
21625 @samp{avr51}, this macro is not defined.
21626
21627 @item __AVR_XMEGA__
21628 The device / architecture belongs to the XMEGA family of devices.
21629
21630 @item __AVR_HAVE_ELPM__
21631 The device has the @code{ELPM} instruction.
21632
21633 @item __AVR_HAVE_ELPMX__
21634 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
21635 R@var{n},Z+} instructions.
21636
21637 @item __AVR_HAVE_MOVW__
21638 The device has the @code{MOVW} instruction to perform 16-bit
21639 register-register moves.
21640
21641 @item __AVR_HAVE_LPMX__
21642 The device has the @code{LPM R@var{n},Z} and
21643 @code{LPM R@var{n},Z+} instructions.
21644
21645 @item __AVR_HAVE_MUL__
21646 The device has a hardware multiplier.
21647
21648 @item __AVR_HAVE_JMP_CALL__
21649 The device has the @code{JMP} and @code{CALL} instructions.
21650 This is the case for devices with more than 8@tie{}KiB of program
21651 memory.
21652
21653 @item __AVR_HAVE_EIJMP_EICALL__
21654 @itemx __AVR_3_BYTE_PC__
21655 The device has the @code{EIJMP} and @code{EICALL} instructions.
21656 This is the case for devices with more than 128@tie{}KiB of program memory.
21657 This also means that the program counter
21658 (PC) is 3@tie{}bytes wide.
21659
21660 @item __AVR_2_BYTE_PC__
21661 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
21662 with up to 128@tie{}KiB of program memory.
21663
21664 @item __AVR_HAVE_8BIT_SP__
21665 @itemx __AVR_HAVE_16BIT_SP__
21666 The stack pointer (SP) register is treated as 8-bit respectively
21667 16-bit register by the compiler.
21668 The definition of these macros is affected by @option{-mtiny-stack}.
21669
21670 @item __AVR_HAVE_SPH__
21671 @itemx __AVR_SP8__
21672 The device has the SPH (high part of stack pointer) special function
21673 register or has an 8-bit stack pointer, respectively.
21674 The definition of these macros is affected by @option{-mmcu=} and
21675 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
21676 by @option{-msp8}.
21677
21678 @item __AVR_HAVE_RAMPD__
21679 @itemx __AVR_HAVE_RAMPX__
21680 @itemx __AVR_HAVE_RAMPY__
21681 @itemx __AVR_HAVE_RAMPZ__
21682 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
21683 @code{RAMPZ} special function register, respectively.
21684
21685 @item __NO_INTERRUPTS__
21686 This macro reflects the @option{-mno-interrupts} command-line option.
21687
21688 @item __AVR_ERRATA_SKIP__
21689 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
21690 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
21691 instructions because of a hardware erratum. Skip instructions are
21692 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
21693 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
21694 set.
21695
21696 @item __AVR_ISA_RMW__
21697 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
21698
21699 @item __AVR_SFR_OFFSET__=@var{offset}
21700 Instructions that can address I/O special function registers directly
21701 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
21702 address as if addressed by an instruction to access RAM like @code{LD}
21703 or @code{STS}. This offset depends on the device architecture and has
21704 to be subtracted from the RAM address in order to get the
21705 respective I/O@tie{}address.
21706
21707 @item __AVR_SHORT_CALLS__
21708 The @option{-mshort-calls} command line option is set.
21709
21710 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
21711 Some devices support reading from flash memory by means of @code{LD*}
21712 instructions. The flash memory is seen in the data address space
21713 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
21714 is not defined, this feature is not available. If defined,
21715 the address space is linear and there is no need to put
21716 @code{.rodata} into RAM. This is handled by the default linker
21717 description file, and is currently available for
21718 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
21719 there is no need to use address spaces like @code{__flash} or
21720 features like attribute @code{progmem} and @code{pgm_read_*}.
21721
21722 @item __WITH_AVRLIBC__
21723 The compiler is configured to be used together with AVR-Libc.
21724 See the @option{--with-avrlibc} configure option.
21725
21726 @item __HAVE_DOUBLE_MULTILIB__
21727 Defined if @option{-mdouble=} acts as a multilib option.
21728
21729 @item __HAVE_DOUBLE32__
21730 @itemx __HAVE_DOUBLE64__
21731 Defined if the compiler supports 32-bit double resp. 64-bit double.
21732 The actual layout is specified by option @option{-mdouble=}.
21733
21734 @item __DEFAULT_DOUBLE__
21735 The size in bits of @code{double} if @option{-mdouble=} is not set.
21736 To test the layout of @code{double} in a program, use the built-in
21737 macro @code{__SIZEOF_DOUBLE__}.
21738
21739 @item __HAVE_LONG_DOUBLE32__
21740 @itemx __HAVE_LONG_DOUBLE64__
21741 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
21742 @itemx __DEFAULT_LONG_DOUBLE__
21743 Same as above, but for @code{long double} instead of @code{double}.
21744
21745 @item __WITH_DOUBLE_COMPARISON__
21746 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
21747 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
21748 and is defined to @code{2} or @code{3}.
21749
21750 @item __WITH_LIBF7_LIBGCC__
21751 @itemx __WITH_LIBF7_MATH__
21752 @itemx __WITH_LIBF7_MATH_SYMBOLS__
21753 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
21754 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
21755
21756 @end table
21757
21758 @node Blackfin Options
21759 @subsection Blackfin Options
21760 @cindex Blackfin Options
21761
21762 @table @gcctabopt
21763 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
21764 @opindex mcpu=
21765 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
21766 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
21767 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
21768 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
21769 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
21770 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
21771 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
21772 @samp{bf561}, @samp{bf592}.
21773
21774 The optional @var{sirevision} specifies the silicon revision of the target
21775 Blackfin processor. Any workarounds available for the targeted silicon revision
21776 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
21777 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
21778 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
21779 hexadecimal digits representing the major and minor numbers in the silicon
21780 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
21781 is not defined. If @var{sirevision} is @samp{any}, the
21782 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
21783 If this optional @var{sirevision} is not used, GCC assumes the latest known
21784 silicon revision of the targeted Blackfin processor.
21785
21786 GCC defines a preprocessor macro for the specified @var{cpu}.
21787 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
21788 provided by libgloss to be linked in if @option{-msim} is not given.
21789
21790 Without this option, @samp{bf532} is used as the processor by default.
21791
21792 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
21793 only the preprocessor macro is defined.
21794
21795 @item -msim
21796 @opindex msim
21797 Specifies that the program will be run on the simulator. This causes
21798 the simulator BSP provided by libgloss to be linked in. This option
21799 has effect only for @samp{bfin-elf} toolchain.
21800 Certain other options, such as @option{-mid-shared-library} and
21801 @option{-mfdpic}, imply @option{-msim}.
21802
21803 @item -momit-leaf-frame-pointer
21804 @opindex momit-leaf-frame-pointer
21805 Don't keep the frame pointer in a register for leaf functions. This
21806 avoids the instructions to save, set up and restore frame pointers and
21807 makes an extra register available in leaf functions.
21808
21809 @item -mspecld-anomaly
21810 @opindex mspecld-anomaly
21811 When enabled, the compiler ensures that the generated code does not
21812 contain speculative loads after jump instructions. If this option is used,
21813 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
21814
21815 @item -mno-specld-anomaly
21816 @opindex mno-specld-anomaly
21817 @opindex mspecld-anomaly
21818 Don't generate extra code to prevent speculative loads from occurring.
21819
21820 @item -mcsync-anomaly
21821 @opindex mcsync-anomaly
21822 When enabled, the compiler ensures that the generated code does not
21823 contain CSYNC or SSYNC instructions too soon after conditional branches.
21824 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
21825
21826 @item -mno-csync-anomaly
21827 @opindex mno-csync-anomaly
21828 @opindex mcsync-anomaly
21829 Don't generate extra code to prevent CSYNC or SSYNC instructions from
21830 occurring too soon after a conditional branch.
21831
21832 @item -mlow64k
21833 @opindex mlow64k
21834 When enabled, the compiler is free to take advantage of the knowledge that
21835 the entire program fits into the low 64k of memory.
21836
21837 @item -mno-low64k
21838 @opindex mno-low64k
21839 Assume that the program is arbitrarily large. This is the default.
21840
21841 @item -mstack-check-l1
21842 @opindex mstack-check-l1
21843 Do stack checking using information placed into L1 scratchpad memory by the
21844 uClinux kernel.
21845
21846 @item -mid-shared-library
21847 @opindex mid-shared-library
21848 Generate code that supports shared libraries via the library ID method.
21849 This allows for execute in place and shared libraries in an environment
21850 without virtual memory management. This option implies @option{-fPIC}.
21851 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21852
21853 @item -mno-id-shared-library
21854 @opindex mno-id-shared-library
21855 @opindex mid-shared-library
21856 Generate code that doesn't assume ID-based shared libraries are being used.
21857 This is the default.
21858
21859 @item -mleaf-id-shared-library
21860 @opindex mleaf-id-shared-library
21861 Generate code that supports shared libraries via the library ID method,
21862 but assumes that this library or executable won't link against any other
21863 ID shared libraries. That allows the compiler to use faster code for jumps
21864 and calls.
21865
21866 @item -mno-leaf-id-shared-library
21867 @opindex mno-leaf-id-shared-library
21868 @opindex mleaf-id-shared-library
21869 Do not assume that the code being compiled won't link against any ID shared
21870 libraries. Slower code is generated for jump and call insns.
21871
21872 @item -mshared-library-id=n
21873 @opindex mshared-library-id
21874 Specifies the identification number of the ID-based shared library being
21875 compiled. Specifying a value of 0 generates more compact code; specifying
21876 other values forces the allocation of that number to the current
21877 library but is no more space- or time-efficient than omitting this option.
21878
21879 @item -msep-data
21880 @opindex msep-data
21881 Generate code that allows the data segment to be located in a different
21882 area of memory from the text segment. This allows for execute in place in
21883 an environment without virtual memory management by eliminating relocations
21884 against the text section.
21885
21886 @item -mno-sep-data
21887 @opindex mno-sep-data
21888 @opindex msep-data
21889 Generate code that assumes that the data segment follows the text segment.
21890 This is the default.
21891
21892 @item -mlong-calls
21893 @itemx -mno-long-calls
21894 @opindex mlong-calls
21895 @opindex mno-long-calls
21896 Tells the compiler to perform function calls by first loading the
21897 address of the function into a register and then performing a subroutine
21898 call on this register. This switch is needed if the target function
21899 lies outside of the 24-bit addressing range of the offset-based
21900 version of subroutine call instruction.
21901
21902 This feature is not enabled by default. Specifying
21903 @option{-mno-long-calls} restores the default behavior. Note these
21904 switches have no effect on how the compiler generates code to handle
21905 function calls via function pointers.
21906
21907 @item -mfast-fp
21908 @opindex mfast-fp
21909 Link with the fast floating-point library. This library relaxes some of
21910 the IEEE floating-point standard's rules for checking inputs against
21911 Not-a-Number (NAN), in the interest of performance.
21912
21913 @item -minline-plt
21914 @opindex minline-plt
21915 Enable inlining of PLT entries in function calls to functions that are
21916 not known to bind locally. It has no effect without @option{-mfdpic}.
21917
21918 @item -mmulticore
21919 @opindex mmulticore
21920 Build a standalone application for multicore Blackfin processors.
21921 This option causes proper start files and link scripts supporting
21922 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
21923 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
21924
21925 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
21926 selects the one-application-per-core programming model. Without
21927 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
21928 programming model is used. In this model, the main function of Core B
21929 should be named as @code{coreb_main}.
21930
21931 If this option is not used, the single-core application programming
21932 model is used.
21933
21934 @item -mcorea
21935 @opindex mcorea
21936 Build a standalone application for Core A of BF561 when using
21937 the one-application-per-core programming model. Proper start files
21938 and link scripts are used to support Core A, and the macro
21939 @code{__BFIN_COREA} is defined.
21940 This option can only be used in conjunction with @option{-mmulticore}.
21941
21942 @item -mcoreb
21943 @opindex mcoreb
21944 Build a standalone application for Core B of BF561 when using
21945 the one-application-per-core programming model. Proper start files
21946 and link scripts are used to support Core B, and the macro
21947 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
21948 should be used instead of @code{main}.
21949 This option can only be used in conjunction with @option{-mmulticore}.
21950
21951 @item -msdram
21952 @opindex msdram
21953 Build a standalone application for SDRAM. Proper start files and
21954 link scripts are used to put the application into SDRAM, and the macro
21955 @code{__BFIN_SDRAM} is defined.
21956 The loader should initialize SDRAM before loading the application.
21957
21958 @item -micplb
21959 @opindex micplb
21960 Assume that ICPLBs are enabled at run time. This has an effect on certain
21961 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
21962 are enabled; for standalone applications the default is off.
21963 @end table
21964
21965 @node C6X Options
21966 @subsection C6X Options
21967 @cindex C6X Options
21968
21969 @table @gcctabopt
21970 @item -march=@var{name}
21971 @opindex march
21972 This specifies the name of the target architecture. GCC uses this
21973 name to determine what kind of instructions it can emit when generating
21974 assembly code. Permissible names are: @samp{c62x},
21975 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
21976
21977 @item -mbig-endian
21978 @opindex mbig-endian
21979 Generate code for a big-endian target.
21980
21981 @item -mlittle-endian
21982 @opindex mlittle-endian
21983 Generate code for a little-endian target. This is the default.
21984
21985 @item -msim
21986 @opindex msim
21987 Choose startup files and linker script suitable for the simulator.
21988
21989 @item -msdata=default
21990 @opindex msdata=default
21991 Put small global and static data in the @code{.neardata} section,
21992 which is pointed to by register @code{B14}. Put small uninitialized
21993 global and static data in the @code{.bss} section, which is adjacent
21994 to the @code{.neardata} section. Put small read-only data into the
21995 @code{.rodata} section. The corresponding sections used for large
21996 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
21997
21998 @item -msdata=all
21999 @opindex msdata=all
22000 Put all data, not just small objects, into the sections reserved for
22001 small data, and use addressing relative to the @code{B14} register to
22002 access them.
22003
22004 @item -msdata=none
22005 @opindex msdata=none
22006 Make no use of the sections reserved for small data, and use absolute
22007 addresses to access all data. Put all initialized global and static
22008 data in the @code{.fardata} section, and all uninitialized data in the
22009 @code{.far} section. Put all constant data into the @code{.const}
22010 section.
22011 @end table
22012
22013 @node CRIS Options
22014 @subsection CRIS Options
22015 @cindex CRIS Options
22016
22017 These options are defined specifically for the CRIS ports.
22018
22019 @table @gcctabopt
22020 @item -march=@var{architecture-type}
22021 @itemx -mcpu=@var{architecture-type}
22022 @opindex march
22023 @opindex mcpu
22024 Generate code for the specified architecture. The choices for
22025 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
22026 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
22027 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
22028 @samp{v10}.
22029
22030 @item -mtune=@var{architecture-type}
22031 @opindex mtune
22032 Tune to @var{architecture-type} everything applicable about the generated
22033 code, except for the ABI and the set of available instructions. The
22034 choices for @var{architecture-type} are the same as for
22035 @option{-march=@var{architecture-type}}.
22036
22037 @item -mmax-stack-frame=@var{n}
22038 @opindex mmax-stack-frame
22039 Warn when the stack frame of a function exceeds @var{n} bytes.
22040
22041 @item -metrax4
22042 @itemx -metrax100
22043 @opindex metrax4
22044 @opindex metrax100
22045 The options @option{-metrax4} and @option{-metrax100} are synonyms for
22046 @option{-march=v3} and @option{-march=v8} respectively.
22047
22048 @item -mmul-bug-workaround
22049 @itemx -mno-mul-bug-workaround
22050 @opindex mmul-bug-workaround
22051 @opindex mno-mul-bug-workaround
22052 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
22053 models where it applies. This option is active by default.
22054
22055 @item -mpdebug
22056 @opindex mpdebug
22057 Enable CRIS-specific verbose debug-related information in the assembly
22058 code. This option also has the effect of turning off the @samp{#NO_APP}
22059 formatted-code indicator to the assembler at the beginning of the
22060 assembly file.
22061
22062 @item -mcc-init
22063 @opindex mcc-init
22064 Do not use condition-code results from previous instruction; always emit
22065 compare and test instructions before use of condition codes.
22066
22067 @item -mno-side-effects
22068 @opindex mno-side-effects
22069 @opindex mside-effects
22070 Do not emit instructions with side effects in addressing modes other than
22071 post-increment.
22072
22073 @item -mstack-align
22074 @itemx -mno-stack-align
22075 @itemx -mdata-align
22076 @itemx -mno-data-align
22077 @itemx -mconst-align
22078 @itemx -mno-const-align
22079 @opindex mstack-align
22080 @opindex mno-stack-align
22081 @opindex mdata-align
22082 @opindex mno-data-align
22083 @opindex mconst-align
22084 @opindex mno-const-align
22085 These options (@samp{no-} options) arrange (eliminate arrangements) for the
22086 stack frame, individual data and constants to be aligned for the maximum
22087 single data access size for the chosen CPU model. The default is to
22088 arrange for 32-bit alignment. ABI details such as structure layout are
22089 not affected by these options.
22090
22091 @item -m32-bit
22092 @itemx -m16-bit
22093 @itemx -m8-bit
22094 @opindex m32-bit
22095 @opindex m16-bit
22096 @opindex m8-bit
22097 Similar to the stack- data- and const-align options above, these options
22098 arrange for stack frame, writable data and constants to all be 32-bit,
22099 16-bit or 8-bit aligned. The default is 32-bit alignment.
22100
22101 @item -mno-prologue-epilogue
22102 @itemx -mprologue-epilogue
22103 @opindex mno-prologue-epilogue
22104 @opindex mprologue-epilogue
22105 With @option{-mno-prologue-epilogue}, the normal function prologue and
22106 epilogue which set up the stack frame are omitted and no return
22107 instructions or return sequences are generated in the code. Use this
22108 option only together with visual inspection of the compiled code: no
22109 warnings or errors are generated when call-saved registers must be saved,
22110 or storage for local variables needs to be allocated.
22111
22112 @item -mno-gotplt
22113 @itemx -mgotplt
22114 @opindex mno-gotplt
22115 @opindex mgotplt
22116 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
22117 instruction sequences that load addresses for functions from the PLT part
22118 of the GOT rather than (traditional on other architectures) calls to the
22119 PLT@. The default is @option{-mgotplt}.
22120
22121 @item -melf
22122 @opindex melf
22123 Legacy no-op option only recognized with the cris-axis-elf and
22124 cris-axis-linux-gnu targets.
22125
22126 @item -mlinux
22127 @opindex mlinux
22128 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
22129
22130 @item -sim
22131 @opindex sim
22132 This option, recognized for the cris-axis-elf, arranges
22133 to link with input-output functions from a simulator library. Code,
22134 initialized data and zero-initialized data are allocated consecutively.
22135
22136 @item -sim2
22137 @opindex sim2
22138 Like @option{-sim}, but pass linker options to locate initialized data at
22139 0x40000000 and zero-initialized data at 0x80000000.
22140 @end table
22141
22142 @node CR16 Options
22143 @subsection CR16 Options
22144 @cindex CR16 Options
22145
22146 These options are defined specifically for the CR16 ports.
22147
22148 @table @gcctabopt
22149
22150 @item -mmac
22151 @opindex mmac
22152 Enable the use of multiply-accumulate instructions. Disabled by default.
22153
22154 @item -mcr16cplus
22155 @itemx -mcr16c
22156 @opindex mcr16cplus
22157 @opindex mcr16c
22158 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
22159 is default.
22160
22161 @item -msim
22162 @opindex msim
22163 Links the library libsim.a which is in compatible with simulator. Applicable
22164 to ELF compiler only.
22165
22166 @item -mint32
22167 @opindex mint32
22168 Choose integer type as 32-bit wide.
22169
22170 @item -mbit-ops
22171 @opindex mbit-ops
22172 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
22173
22174 @item -mdata-model=@var{model}
22175 @opindex mdata-model
22176 Choose a data model. The choices for @var{model} are @samp{near},
22177 @samp{far} or @samp{medium}. @samp{medium} is default.
22178 However, @samp{far} is not valid with @option{-mcr16c}, as the
22179 CR16C architecture does not support the far data model.
22180 @end table
22181
22182 @node C-SKY Options
22183 @subsection C-SKY Options
22184 @cindex C-SKY Options
22185
22186 GCC supports these options when compiling for C-SKY V2 processors.
22187
22188 @table @gcctabopt
22189
22190 @item -march=@var{arch}
22191 @opindex march=
22192 Specify the C-SKY target architecture. Valid values for @var{arch} are:
22193 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
22194 The default is @samp{ck810}.
22195
22196 @item -mcpu=@var{cpu}
22197 @opindex mcpu=
22198 Specify the C-SKY target processor. Valid values for @var{cpu} are:
22199 @samp{ck801}, @samp{ck801t},
22200 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
22201 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
22202 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
22203 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
22204 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
22205 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
22206 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
22207 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
22208 @samp{ck803eftr1}, @samp{ck803efhtr1},
22209 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
22210 @samp{ck803sef}, @samp{ck803seft},
22211 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
22212 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
22213 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
22214 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
22215
22216 @item -mbig-endian
22217 @opindex mbig-endian
22218 @itemx -EB
22219 @opindex EB
22220 @itemx -mlittle-endian
22221 @opindex mlittle-endian
22222 @itemx -EL
22223 @opindex EL
22224
22225 Select big- or little-endian code. The default is little-endian.
22226
22227 @item -mfloat-abi=@var{name}
22228 @opindex mfloat-abi
22229 Specifies which floating-point ABI to use. Permissible values
22230 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22231
22232 Specifying @samp{soft} causes GCC to generate output containing
22233 library calls for floating-point operations.
22234 @samp{softfp} allows the generation of code using hardware floating-point
22235 instructions, but still uses the soft-float calling conventions.
22236 @samp{hard} allows generation of floating-point instructions
22237 and uses FPU-specific calling conventions.
22238
22239 The default depends on the specific target configuration. Note that
22240 the hard-float and soft-float ABIs are not link-compatible; you must
22241 compile your entire program with the same ABI, and link with a
22242 compatible set of libraries.
22243
22244 @item -mhard-float
22245 @opindex mhard-float
22246 @itemx -msoft-float
22247 @opindex msoft-float
22248
22249 Select hardware or software floating-point implementations.
22250 The default is soft float.
22251
22252 @item -mdouble-float
22253 @itemx -mno-double-float
22254 @opindex mdouble-float
22255 When @option{-mhard-float} is in effect, enable generation of
22256 double-precision float instructions. This is the default except
22257 when compiling for CK803.
22258
22259 @item -mfdivdu
22260 @itemx -mno-fdivdu
22261 @opindex mfdivdu
22262 When @option{-mhard-float} is in effect, enable generation of
22263 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
22264 This is the default except when compiling for CK803.
22265
22266 @item -mfpu=@var{fpu}
22267 @opindex mfpu=
22268 Select the floating-point processor. This option can only be used with
22269 @option{-mhard-float}.
22270 Values for @var{fpu} are
22271 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
22272 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
22273 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
22274
22275 @item -melrw
22276 @itemx -mno-elrw
22277 @opindex melrw
22278 Enable the extended @code{lrw} instruction. This option defaults to on
22279 for CK801 and off otherwise.
22280
22281 @item -mistack
22282 @itemx -mno-istack
22283 @opindex mistack
22284 Enable interrupt stack instructions; the default is off.
22285
22286 The @option{-mistack} option is required to handle the
22287 @code{interrupt} and @code{isr} function attributes
22288 (@pxref{C-SKY Function Attributes}).
22289
22290 @item -mmp
22291 @opindex mmp
22292 Enable multiprocessor instructions; the default is off.
22293
22294 @item -mcp
22295 @opindex mcp
22296 Enable coprocessor instructions; the default is off.
22297
22298 @item -mcache
22299 @opindex mcache
22300 Enable coprocessor instructions; the default is off.
22301
22302 @item -msecurity
22303 @opindex msecurity
22304 Enable C-SKY security instructions; the default is off.
22305
22306 @item -mtrust
22307 @opindex mtrust
22308 Enable C-SKY trust instructions; the default is off.
22309
22310 @item -mdsp
22311 @opindex mdsp
22312 @itemx -medsp
22313 @opindex medsp
22314 @itemx -mvdsp
22315 @opindex mvdsp
22316 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
22317 All of these options default to off.
22318
22319 @item -mdiv
22320 @itemx -mno-div
22321 @opindex mdiv
22322 Generate divide instructions. Default is off.
22323
22324 @item -msmart
22325 @itemx -mno-smart
22326 @opindex msmart
22327 Generate code for Smart Mode, using only registers numbered 0-7 to allow
22328 use of 16-bit instructions. This option is ignored for CK801 where this
22329 is the required behavior, and it defaults to on for CK802.
22330 For other targets, the default is off.
22331
22332 @item -mhigh-registers
22333 @itemx -mno-high-registers
22334 @opindex mhigh-registers
22335 Generate code using the high registers numbered 16-31. This option
22336 is not supported on CK801, CK802, or CK803, and is enabled by default
22337 for other processors.
22338
22339 @item -manchor
22340 @itemx -mno-anchor
22341 @opindex manchor
22342 Generate code using global anchor symbol addresses.
22343
22344 @item -mpushpop
22345 @itemx -mno-pushpop
22346 @opindex mpushpop
22347 Generate code using @code{push} and @code{pop} instructions. This option
22348 defaults to on.
22349
22350 @item -mmultiple-stld
22351 @itemx -mstm
22352 @itemx -mno-multiple-stld
22353 @itemx -mno-stm
22354 @opindex mmultiple-stld
22355 Generate code using @code{stm} and @code{ldm} instructions. This option
22356 isn't supported on CK801 but is enabled by default on other processors.
22357
22358 @item -mconstpool
22359 @itemx -mno-constpool
22360 @opindex mconstpool
22361 Create constant pools in the compiler instead of deferring it to the
22362 assembler. This option is the default and required for correct code
22363 generation on CK801 and CK802, and is optional on other processors.
22364
22365 @item -mstack-size
22366 @item -mno-stack-size
22367 @opindex mstack-size
22368 Emit @code{.stack_size} directives for each function in the assembly
22369 output. This option defaults to off.
22370
22371 @item -mccrt
22372 @itemx -mno-ccrt
22373 @opindex mccrt
22374 Generate code for the C-SKY compiler runtime instead of libgcc. This
22375 option defaults to off.
22376
22377 @item -mbranch-cost=@var{n}
22378 @opindex mbranch-cost=
22379 Set the branch costs to roughly @code{n} instructions. The default is 1.
22380
22381 @item -msched-prolog
22382 @itemx -mno-sched-prolog
22383 @opindex msched-prolog
22384 Permit scheduling of function prologue and epilogue sequences. Using
22385 this option can result in code that is not compliant with the C-SKY V2 ABI
22386 prologue requirements and that cannot be debugged or backtraced.
22387 It is disabled by default.
22388
22389 @item -msim
22390 @opindex msim
22391 Links the library libsemi.a which is in compatible with simulator. Applicable
22392 to ELF compiler only.
22393
22394 @end table
22395
22396 @node Darwin Options
22397 @subsection Darwin Options
22398 @cindex Darwin options
22399
22400 These options are defined for all architectures running the Darwin operating
22401 system.
22402
22403 FSF GCC on Darwin does not create ``fat'' object files; it creates
22404 an object file for the single architecture that GCC was built to
22405 target. Apple's GCC on Darwin does create ``fat'' files if multiple
22406 @option{-arch} options are used; it does so by running the compiler or
22407 linker multiple times and joining the results together with
22408 @file{lipo}.
22409
22410 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
22411 @samp{i686}) is determined by the flags that specify the ISA
22412 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
22413 @option{-force_cpusubtype_ALL} option can be used to override this.
22414
22415 The Darwin tools vary in their behavior when presented with an ISA
22416 mismatch. The assembler, @file{as}, only permits instructions to
22417 be used that are valid for the subtype of the file it is generating,
22418 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
22419 The linker for shared libraries, @file{/usr/bin/libtool}, fails
22420 and prints an error if asked to create a shared library with a less
22421 restrictive subtype than its input files (for instance, trying to put
22422 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
22423 for executables, @command{ld}, quietly gives the executable the most
22424 restrictive subtype of any of its input files.
22425
22426 @table @gcctabopt
22427 @item -F@var{dir}
22428 @opindex F
22429 Add the framework directory @var{dir} to the head of the list of
22430 directories to be searched for header files. These directories are
22431 interleaved with those specified by @option{-I} options and are
22432 scanned in a left-to-right order.
22433
22434 A framework directory is a directory with frameworks in it. A
22435 framework is a directory with a @file{Headers} and/or
22436 @file{PrivateHeaders} directory contained directly in it that ends
22437 in @file{.framework}. The name of a framework is the name of this
22438 directory excluding the @file{.framework}. Headers associated with
22439 the framework are found in one of those two directories, with
22440 @file{Headers} being searched first. A subframework is a framework
22441 directory that is in a framework's @file{Frameworks} directory.
22442 Includes of subframework headers can only appear in a header of a
22443 framework that contains the subframework, or in a sibling subframework
22444 header. Two subframeworks are siblings if they occur in the same
22445 framework. A subframework should not have the same name as a
22446 framework; a warning is issued if this is violated. Currently a
22447 subframework cannot have subframeworks; in the future, the mechanism
22448 may be extended to support this. The standard frameworks can be found
22449 in @file{/System/Library/Frameworks} and
22450 @file{/Library/Frameworks}. An example include looks like
22451 @code{#include <Framework/header.h>}, where @file{Framework} denotes
22452 the name of the framework and @file{header.h} is found in the
22453 @file{PrivateHeaders} or @file{Headers} directory.
22454
22455 @item -iframework@var{dir}
22456 @opindex iframework
22457 Like @option{-F} except the directory is a treated as a system
22458 directory. The main difference between this @option{-iframework} and
22459 @option{-F} is that with @option{-iframework} the compiler does not
22460 warn about constructs contained within header files found via
22461 @var{dir}. This option is valid only for the C family of languages.
22462
22463 @item -gused
22464 @opindex gused
22465 Emit debugging information for symbols that are used. For stabs
22466 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
22467 This is by default ON@.
22468
22469 @item -gfull
22470 @opindex gfull
22471 Emit debugging information for all symbols and types.
22472
22473 @item -mmacosx-version-min=@var{version}
22474 The earliest version of MacOS X that this executable will run on
22475 is @var{version}. Typical values of @var{version} include @code{10.1},
22476 @code{10.2}, and @code{10.3.9}.
22477
22478 If the compiler was built to use the system's headers by default,
22479 then the default for this option is the system version on which the
22480 compiler is running, otherwise the default is to make choices that
22481 are compatible with as many systems and code bases as possible.
22482
22483 @item -mkernel
22484 @opindex mkernel
22485 Enable kernel development mode. The @option{-mkernel} option sets
22486 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
22487 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
22488 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
22489 applicable. This mode also sets @option{-mno-altivec},
22490 @option{-msoft-float}, @option{-fno-builtin} and
22491 @option{-mlong-branch} for PowerPC targets.
22492
22493 @item -mone-byte-bool
22494 @opindex mone-byte-bool
22495 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
22496 By default @code{sizeof(bool)} is @code{4} when compiling for
22497 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
22498 option has no effect on x86.
22499
22500 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
22501 to generate code that is not binary compatible with code generated
22502 without that switch. Using this switch may require recompiling all
22503 other modules in a program, including system libraries. Use this
22504 switch to conform to a non-default data model.
22505
22506 @item -mfix-and-continue
22507 @itemx -ffix-and-continue
22508 @itemx -findirect-data
22509 @opindex mfix-and-continue
22510 @opindex ffix-and-continue
22511 @opindex findirect-data
22512 Generate code suitable for fast turnaround development, such as to
22513 allow GDB to dynamically load @file{.o} files into already-running
22514 programs. @option{-findirect-data} and @option{-ffix-and-continue}
22515 are provided for backwards compatibility.
22516
22517 @item -all_load
22518 @opindex all_load
22519 Loads all members of static archive libraries.
22520 See man ld(1) for more information.
22521
22522 @item -arch_errors_fatal
22523 @opindex arch_errors_fatal
22524 Cause the errors having to do with files that have the wrong architecture
22525 to be fatal.
22526
22527 @item -bind_at_load
22528 @opindex bind_at_load
22529 Causes the output file to be marked such that the dynamic linker will
22530 bind all undefined references when the file is loaded or launched.
22531
22532 @item -bundle
22533 @opindex bundle
22534 Produce a Mach-o bundle format file.
22535 See man ld(1) for more information.
22536
22537 @item -bundle_loader @var{executable}
22538 @opindex bundle_loader
22539 This option specifies the @var{executable} that will load the build
22540 output file being linked. See man ld(1) for more information.
22541
22542 @item -dynamiclib
22543 @opindex dynamiclib
22544 When passed this option, GCC produces a dynamic library instead of
22545 an executable when linking, using the Darwin @file{libtool} command.
22546
22547 @item -force_cpusubtype_ALL
22548 @opindex force_cpusubtype_ALL
22549 This causes GCC's output file to have the @samp{ALL} subtype, instead of
22550 one controlled by the @option{-mcpu} or @option{-march} option.
22551
22552 @item -allowable_client @var{client_name}
22553 @itemx -client_name
22554 @itemx -compatibility_version
22555 @itemx -current_version
22556 @itemx -dead_strip
22557 @itemx -dependency-file
22558 @itemx -dylib_file
22559 @itemx -dylinker_install_name
22560 @itemx -dynamic
22561 @itemx -exported_symbols_list
22562 @itemx -filelist
22563 @need 800
22564 @itemx -flat_namespace
22565 @itemx -force_flat_namespace
22566 @itemx -headerpad_max_install_names
22567 @itemx -image_base
22568 @itemx -init
22569 @itemx -install_name
22570 @itemx -keep_private_externs
22571 @itemx -multi_module
22572 @itemx -multiply_defined
22573 @itemx -multiply_defined_unused
22574 @need 800
22575 @itemx -noall_load
22576 @itemx -no_dead_strip_inits_and_terms
22577 @itemx -nofixprebinding
22578 @itemx -nomultidefs
22579 @itemx -noprebind
22580 @itemx -noseglinkedit
22581 @itemx -pagezero_size
22582 @itemx -prebind
22583 @itemx -prebind_all_twolevel_modules
22584 @itemx -private_bundle
22585 @need 800
22586 @itemx -read_only_relocs
22587 @itemx -sectalign
22588 @itemx -sectobjectsymbols
22589 @itemx -whyload
22590 @itemx -seg1addr
22591 @itemx -sectcreate
22592 @itemx -sectobjectsymbols
22593 @itemx -sectorder
22594 @itemx -segaddr
22595 @itemx -segs_read_only_addr
22596 @need 800
22597 @itemx -segs_read_write_addr
22598 @itemx -seg_addr_table
22599 @itemx -seg_addr_table_filename
22600 @itemx -seglinkedit
22601 @itemx -segprot
22602 @itemx -segs_read_only_addr
22603 @itemx -segs_read_write_addr
22604 @itemx -single_module
22605 @itemx -static
22606 @itemx -sub_library
22607 @need 800
22608 @itemx -sub_umbrella
22609 @itemx -twolevel_namespace
22610 @itemx -umbrella
22611 @itemx -undefined
22612 @itemx -unexported_symbols_list
22613 @itemx -weak_reference_mismatches
22614 @itemx -whatsloaded
22615 @opindex allowable_client
22616 @opindex client_name
22617 @opindex compatibility_version
22618 @opindex current_version
22619 @opindex dead_strip
22620 @opindex dependency-file
22621 @opindex dylib_file
22622 @opindex dylinker_install_name
22623 @opindex dynamic
22624 @opindex exported_symbols_list
22625 @opindex filelist
22626 @opindex flat_namespace
22627 @opindex force_flat_namespace
22628 @opindex headerpad_max_install_names
22629 @opindex image_base
22630 @opindex init
22631 @opindex install_name
22632 @opindex keep_private_externs
22633 @opindex multi_module
22634 @opindex multiply_defined
22635 @opindex multiply_defined_unused
22636 @opindex noall_load
22637 @opindex no_dead_strip_inits_and_terms
22638 @opindex nofixprebinding
22639 @opindex nomultidefs
22640 @opindex noprebind
22641 @opindex noseglinkedit
22642 @opindex pagezero_size
22643 @opindex prebind
22644 @opindex prebind_all_twolevel_modules
22645 @opindex private_bundle
22646 @opindex read_only_relocs
22647 @opindex sectalign
22648 @opindex sectobjectsymbols
22649 @opindex whyload
22650 @opindex seg1addr
22651 @opindex sectcreate
22652 @opindex sectobjectsymbols
22653 @opindex sectorder
22654 @opindex segaddr
22655 @opindex segs_read_only_addr
22656 @opindex segs_read_write_addr
22657 @opindex seg_addr_table
22658 @opindex seg_addr_table_filename
22659 @opindex seglinkedit
22660 @opindex segprot
22661 @opindex segs_read_only_addr
22662 @opindex segs_read_write_addr
22663 @opindex single_module
22664 @opindex static
22665 @opindex sub_library
22666 @opindex sub_umbrella
22667 @opindex twolevel_namespace
22668 @opindex umbrella
22669 @opindex undefined
22670 @opindex unexported_symbols_list
22671 @opindex weak_reference_mismatches
22672 @opindex whatsloaded
22673 These options are passed to the Darwin linker. The Darwin linker man page
22674 describes them in detail.
22675 @end table
22676
22677 @node DEC Alpha Options
22678 @subsection DEC Alpha Options
22679
22680 These @samp{-m} options are defined for the DEC Alpha implementations:
22681
22682 @table @gcctabopt
22683 @item -mno-soft-float
22684 @itemx -msoft-float
22685 @opindex mno-soft-float
22686 @opindex msoft-float
22687 Use (do not use) the hardware floating-point instructions for
22688 floating-point operations. When @option{-msoft-float} is specified,
22689 functions in @file{libgcc.a} are used to perform floating-point
22690 operations. Unless they are replaced by routines that emulate the
22691 floating-point operations, or compiled in such a way as to call such
22692 emulations routines, these routines issue floating-point
22693 operations. If you are compiling for an Alpha without floating-point
22694 operations, you must ensure that the library is built so as not to call
22695 them.
22696
22697 Note that Alpha implementations without floating-point operations are
22698 required to have floating-point registers.
22699
22700 @item -mfp-reg
22701 @itemx -mno-fp-regs
22702 @opindex mfp-reg
22703 @opindex mno-fp-regs
22704 Generate code that uses (does not use) the floating-point register set.
22705 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
22706 register set is not used, floating-point operands are passed in integer
22707 registers as if they were integers and floating-point results are passed
22708 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
22709 so any function with a floating-point argument or return value called by code
22710 compiled with @option{-mno-fp-regs} must also be compiled with that
22711 option.
22712
22713 A typical use of this option is building a kernel that does not use,
22714 and hence need not save and restore, any floating-point registers.
22715
22716 @item -mieee
22717 @opindex mieee
22718 The Alpha architecture implements floating-point hardware optimized for
22719 maximum performance. It is mostly compliant with the IEEE floating-point
22720 standard. However, for full compliance, software assistance is
22721 required. This option generates code fully IEEE-compliant code
22722 @emph{except} that the @var{inexact-flag} is not maintained (see below).
22723 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
22724 defined during compilation. The resulting code is less efficient but is
22725 able to correctly support denormalized numbers and exceptional IEEE
22726 values such as not-a-number and plus/minus infinity. Other Alpha
22727 compilers call this option @option{-ieee_with_no_inexact}.
22728
22729 @item -mieee-with-inexact
22730 @opindex mieee-with-inexact
22731 This is like @option{-mieee} except the generated code also maintains
22732 the IEEE @var{inexact-flag}. Turning on this option causes the
22733 generated code to implement fully-compliant IEEE math. In addition to
22734 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
22735 macro. On some Alpha implementations the resulting code may execute
22736 significantly slower than the code generated by default. Since there is
22737 very little code that depends on the @var{inexact-flag}, you should
22738 normally not specify this option. Other Alpha compilers call this
22739 option @option{-ieee_with_inexact}.
22740
22741 @item -mfp-trap-mode=@var{trap-mode}
22742 @opindex mfp-trap-mode
22743 This option controls what floating-point related traps are enabled.
22744 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
22745 The trap mode can be set to one of four values:
22746
22747 @table @samp
22748 @item n
22749 This is the default (normal) setting. The only traps that are enabled
22750 are the ones that cannot be disabled in software (e.g., division by zero
22751 trap).
22752
22753 @item u
22754 In addition to the traps enabled by @samp{n}, underflow traps are enabled
22755 as well.
22756
22757 @item su
22758 Like @samp{u}, but the instructions are marked to be safe for software
22759 completion (see Alpha architecture manual for details).
22760
22761 @item sui
22762 Like @samp{su}, but inexact traps are enabled as well.
22763 @end table
22764
22765 @item -mfp-rounding-mode=@var{rounding-mode}
22766 @opindex mfp-rounding-mode
22767 Selects the IEEE rounding mode. Other Alpha compilers call this option
22768 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
22769 of:
22770
22771 @table @samp
22772 @item n
22773 Normal IEEE rounding mode. Floating-point numbers are rounded towards
22774 the nearest machine number or towards the even machine number in case
22775 of a tie.
22776
22777 @item m
22778 Round towards minus infinity.
22779
22780 @item c
22781 Chopped rounding mode. Floating-point numbers are rounded towards zero.
22782
22783 @item d
22784 Dynamic rounding mode. A field in the floating-point control register
22785 (@var{fpcr}, see Alpha architecture reference manual) controls the
22786 rounding mode in effect. The C library initializes this register for
22787 rounding towards plus infinity. Thus, unless your program modifies the
22788 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
22789 @end table
22790
22791 @item -mtrap-precision=@var{trap-precision}
22792 @opindex mtrap-precision
22793 In the Alpha architecture, floating-point traps are imprecise. This
22794 means without software assistance it is impossible to recover from a
22795 floating trap and program execution normally needs to be terminated.
22796 GCC can generate code that can assist operating system trap handlers
22797 in determining the exact location that caused a floating-point trap.
22798 Depending on the requirements of an application, different levels of
22799 precisions can be selected:
22800
22801 @table @samp
22802 @item p
22803 Program precision. This option is the default and means a trap handler
22804 can only identify which program caused a floating-point exception.
22805
22806 @item f
22807 Function precision. The trap handler can determine the function that
22808 caused a floating-point exception.
22809
22810 @item i
22811 Instruction precision. The trap handler can determine the exact
22812 instruction that caused a floating-point exception.
22813 @end table
22814
22815 Other Alpha compilers provide the equivalent options called
22816 @option{-scope_safe} and @option{-resumption_safe}.
22817
22818 @item -mieee-conformant
22819 @opindex mieee-conformant
22820 This option marks the generated code as IEEE conformant. You must not
22821 use this option unless you also specify @option{-mtrap-precision=i} and either
22822 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
22823 is to emit the line @samp{.eflag 48} in the function prologue of the
22824 generated assembly file.
22825
22826 @item -mbuild-constants
22827 @opindex mbuild-constants
22828 Normally GCC examines a 32- or 64-bit integer constant to
22829 see if it can construct it from smaller constants in two or three
22830 instructions. If it cannot, it outputs the constant as a literal and
22831 generates code to load it from the data segment at run time.
22832
22833 Use this option to require GCC to construct @emph{all} integer constants
22834 using code, even if it takes more instructions (the maximum is six).
22835
22836 You typically use this option to build a shared library dynamic
22837 loader. Itself a shared library, it must relocate itself in memory
22838 before it can find the variables and constants in its own data segment.
22839
22840 @item -mbwx
22841 @itemx -mno-bwx
22842 @itemx -mcix
22843 @itemx -mno-cix
22844 @itemx -mfix
22845 @itemx -mno-fix
22846 @itemx -mmax
22847 @itemx -mno-max
22848 @opindex mbwx
22849 @opindex mno-bwx
22850 @opindex mcix
22851 @opindex mno-cix
22852 @opindex mfix
22853 @opindex mno-fix
22854 @opindex mmax
22855 @opindex mno-max
22856 Indicate whether GCC should generate code to use the optional BWX,
22857 CIX, FIX and MAX instruction sets. The default is to use the instruction
22858 sets supported by the CPU type specified via @option{-mcpu=} option or that
22859 of the CPU on which GCC was built if none is specified.
22860
22861 @item -mfloat-vax
22862 @itemx -mfloat-ieee
22863 @opindex mfloat-vax
22864 @opindex mfloat-ieee
22865 Generate code that uses (does not use) VAX F and G floating-point
22866 arithmetic instead of IEEE single and double precision.
22867
22868 @item -mexplicit-relocs
22869 @itemx -mno-explicit-relocs
22870 @opindex mexplicit-relocs
22871 @opindex mno-explicit-relocs
22872 Older Alpha assemblers provided no way to generate symbol relocations
22873 except via assembler macros. Use of these macros does not allow
22874 optimal instruction scheduling. GNU binutils as of version 2.12
22875 supports a new syntax that allows the compiler to explicitly mark
22876 which relocations should apply to which instructions. This option
22877 is mostly useful for debugging, as GCC detects the capabilities of
22878 the assembler when it is built and sets the default accordingly.
22879
22880 @item -msmall-data
22881 @itemx -mlarge-data
22882 @opindex msmall-data
22883 @opindex mlarge-data
22884 When @option{-mexplicit-relocs} is in effect, static data is
22885 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
22886 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
22887 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
22888 16-bit relocations off of the @code{$gp} register. This limits the
22889 size of the small data area to 64KB, but allows the variables to be
22890 directly accessed via a single instruction.
22891
22892 The default is @option{-mlarge-data}. With this option the data area
22893 is limited to just below 2GB@. Programs that require more than 2GB of
22894 data must use @code{malloc} or @code{mmap} to allocate the data in the
22895 heap instead of in the program's data segment.
22896
22897 When generating code for shared libraries, @option{-fpic} implies
22898 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
22899
22900 @item -msmall-text
22901 @itemx -mlarge-text
22902 @opindex msmall-text
22903 @opindex mlarge-text
22904 When @option{-msmall-text} is used, the compiler assumes that the
22905 code of the entire program (or shared library) fits in 4MB, and is
22906 thus reachable with a branch instruction. When @option{-msmall-data}
22907 is used, the compiler can assume that all local symbols share the
22908 same @code{$gp} value, and thus reduce the number of instructions
22909 required for a function call from 4 to 1.
22910
22911 The default is @option{-mlarge-text}.
22912
22913 @item -mcpu=@var{cpu_type}
22914 @opindex mcpu
22915 Set the instruction set and instruction scheduling parameters for
22916 machine type @var{cpu_type}. You can specify either the @samp{EV}
22917 style name or the corresponding chip number. GCC supports scheduling
22918 parameters for the EV4, EV5 and EV6 family of processors and
22919 chooses the default values for the instruction set from the processor
22920 you specify. If you do not specify a processor type, GCC defaults
22921 to the processor on which the compiler was built.
22922
22923 Supported values for @var{cpu_type} are
22924
22925 @table @samp
22926 @item ev4
22927 @itemx ev45
22928 @itemx 21064
22929 Schedules as an EV4 and has no instruction set extensions.
22930
22931 @item ev5
22932 @itemx 21164
22933 Schedules as an EV5 and has no instruction set extensions.
22934
22935 @item ev56
22936 @itemx 21164a
22937 Schedules as an EV5 and supports the BWX extension.
22938
22939 @item pca56
22940 @itemx 21164pc
22941 @itemx 21164PC
22942 Schedules as an EV5 and supports the BWX and MAX extensions.
22943
22944 @item ev6
22945 @itemx 21264
22946 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
22947
22948 @item ev67
22949 @itemx 21264a
22950 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
22951 @end table
22952
22953 Native toolchains also support the value @samp{native},
22954 which selects the best architecture option for the host processor.
22955 @option{-mcpu=native} has no effect if GCC does not recognize
22956 the processor.
22957
22958 @item -mtune=@var{cpu_type}
22959 @opindex mtune
22960 Set only the instruction scheduling parameters for machine type
22961 @var{cpu_type}. The instruction set is not changed.
22962
22963 Native toolchains also support the value @samp{native},
22964 which selects the best architecture option for the host processor.
22965 @option{-mtune=native} has no effect if GCC does not recognize
22966 the processor.
22967
22968 @item -mmemory-latency=@var{time}
22969 @opindex mmemory-latency
22970 Sets the latency the scheduler should assume for typical memory
22971 references as seen by the application. This number is highly
22972 dependent on the memory access patterns used by the application
22973 and the size of the external cache on the machine.
22974
22975 Valid options for @var{time} are
22976
22977 @table @samp
22978 @item @var{number}
22979 A decimal number representing clock cycles.
22980
22981 @item L1
22982 @itemx L2
22983 @itemx L3
22984 @itemx main
22985 The compiler contains estimates of the number of clock cycles for
22986 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
22987 (also called Dcache, Scache, and Bcache), as well as to main memory.
22988 Note that L3 is only valid for EV5.
22989
22990 @end table
22991 @end table
22992
22993 @node eBPF Options
22994 @subsection eBPF Options
22995 @cindex eBPF Options
22996
22997 @table @gcctabopt
22998 @item -mframe-limit=@var{bytes}
22999 This specifies the hard limit for frame sizes, in bytes. Currently,
23000 the value that can be specified should be less than or equal to
23001 @samp{32767}. Defaults to whatever limit is imposed by the version of
23002 the Linux kernel targeted.
23003
23004 @item -mkernel=@var{version}
23005 @opindex mkernel
23006 This specifies the minimum version of the kernel that will run the
23007 compiled program. GCC uses this version to determine which
23008 instructions to use, what kernel helpers to allow, etc. Currently,
23009 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
23010 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
23011 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
23012 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
23013 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
23014 @samp{5.2}, @samp{latest} and @samp{native}.
23015
23016 @item -mbig-endian
23017 @opindex mbig-endian
23018 Generate code for a big-endian target.
23019
23020 @item -mlittle-endian
23021 @opindex mlittle-endian
23022 Generate code for a little-endian target. This is the default.
23023
23024 @item -mjmpext
23025 @opindex mjmpext
23026 Enable generation of extra conditional-branch instructions.
23027 Enabled for CPU v2 and above.
23028
23029 @item -mjmp32
23030 @opindex mjmp32
23031 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
23032
23033 @item -malu32
23034 @opindex malu32
23035 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
23036
23037 @item -mcpu=@var{version}
23038 @opindex mcpu
23039 This specifies which version of the eBPF ISA to target. Newer versions
23040 may not be supported by all kernels. The default is @samp{v3}.
23041
23042 Supported values for @var{version} are:
23043
23044 @table @samp
23045 @item v1
23046 The first stable eBPF ISA with no special features or extensions.
23047
23048 @item v2
23049 Supports the jump extensions, as in @option{-mjmpext}.
23050
23051 @item v3
23052 All features of v2, plus:
23053 @itemize @minus
23054 @item 32-bit jump operations, as in @option{-mjmp32}
23055 @item 32-bit ALU operations, as in @option{-malu32}
23056 @end itemize
23057
23058 @end table
23059
23060 @item -mco-re
23061 @opindex mco-re
23062 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
23063 is implied by @option{-gbtf}.
23064
23065 @item -mno-co-re
23066 @opindex mno-co-re
23067 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
23068 support is enabled by default when generating BTF debug information for
23069 the BPF target.
23070
23071 @item -mxbpf
23072 Generate code for an expanded version of BPF, which relaxes some of
23073 the restrictions imposed by the BPF architecture:
23074 @itemize @minus
23075 @item Save and restore callee-saved registers at function entry and
23076 exit, respectively.
23077 @end itemize
23078 @end table
23079
23080 @node FR30 Options
23081 @subsection FR30 Options
23082 @cindex FR30 Options
23083
23084 These options are defined specifically for the FR30 port.
23085
23086 @table @gcctabopt
23087
23088 @item -msmall-model
23089 @opindex msmall-model
23090 Use the small address space model. This can produce smaller code, but
23091 it does assume that all symbolic values and addresses fit into a
23092 20-bit range.
23093
23094 @item -mno-lsim
23095 @opindex mno-lsim
23096 Assume that runtime support has been provided and so there is no need
23097 to include the simulator library (@file{libsim.a}) on the linker
23098 command line.
23099
23100 @end table
23101
23102 @node FT32 Options
23103 @subsection FT32 Options
23104 @cindex FT32 Options
23105
23106 These options are defined specifically for the FT32 port.
23107
23108 @table @gcctabopt
23109
23110 @item -msim
23111 @opindex msim
23112 Specifies that the program will be run on the simulator. This causes
23113 an alternate runtime startup and library to be linked.
23114 You must not use this option when generating programs that will run on
23115 real hardware; you must provide your own runtime library for whatever
23116 I/O functions are needed.
23117
23118 @item -mlra
23119 @opindex mlra
23120 Enable Local Register Allocation. This is still experimental for FT32,
23121 so by default the compiler uses standard reload.
23122
23123 @item -mnodiv
23124 @opindex mnodiv
23125 Do not use div and mod instructions.
23126
23127 @item -mft32b
23128 @opindex mft32b
23129 Enable use of the extended instructions of the FT32B processor.
23130
23131 @item -mcompress
23132 @opindex mcompress
23133 Compress all code using the Ft32B code compression scheme.
23134
23135 @item -mnopm
23136 @opindex mnopm
23137 Do not generate code that reads program memory.
23138
23139 @end table
23140
23141 @node FRV Options
23142 @subsection FRV Options
23143 @cindex FRV Options
23144
23145 @table @gcctabopt
23146 @item -mgpr-32
23147 @opindex mgpr-32
23148
23149 Only use the first 32 general-purpose registers.
23150
23151 @item -mgpr-64
23152 @opindex mgpr-64
23153
23154 Use all 64 general-purpose registers.
23155
23156 @item -mfpr-32
23157 @opindex mfpr-32
23158
23159 Use only the first 32 floating-point registers.
23160
23161 @item -mfpr-64
23162 @opindex mfpr-64
23163
23164 Use all 64 floating-point registers.
23165
23166 @item -mhard-float
23167 @opindex mhard-float
23168
23169 Use hardware instructions for floating-point operations.
23170
23171 @item -msoft-float
23172 @opindex msoft-float
23173
23174 Use library routines for floating-point operations.
23175
23176 @item -malloc-cc
23177 @opindex malloc-cc
23178
23179 Dynamically allocate condition code registers.
23180
23181 @item -mfixed-cc
23182 @opindex mfixed-cc
23183
23184 Do not try to dynamically allocate condition code registers, only
23185 use @code{icc0} and @code{fcc0}.
23186
23187 @item -mdword
23188 @opindex mdword
23189
23190 Change ABI to use double word insns.
23191
23192 @item -mno-dword
23193 @opindex mno-dword
23194 @opindex mdword
23195
23196 Do not use double word instructions.
23197
23198 @item -mdouble
23199 @opindex mdouble
23200
23201 Use floating-point double instructions.
23202
23203 @item -mno-double
23204 @opindex mno-double
23205
23206 Do not use floating-point double instructions.
23207
23208 @item -mmedia
23209 @opindex mmedia
23210
23211 Use media instructions.
23212
23213 @item -mno-media
23214 @opindex mno-media
23215
23216 Do not use media instructions.
23217
23218 @item -mmuladd
23219 @opindex mmuladd
23220
23221 Use multiply and add/subtract instructions.
23222
23223 @item -mno-muladd
23224 @opindex mno-muladd
23225
23226 Do not use multiply and add/subtract instructions.
23227
23228 @item -mfdpic
23229 @opindex mfdpic
23230
23231 Select the FDPIC ABI, which uses function descriptors to represent
23232 pointers to functions. Without any PIC/PIE-related options, it
23233 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
23234 assumes GOT entries and small data are within a 12-bit range from the
23235 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
23236 are computed with 32 bits.
23237 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23238
23239 @item -minline-plt
23240 @opindex minline-plt
23241
23242 Enable inlining of PLT entries in function calls to functions that are
23243 not known to bind locally. It has no effect without @option{-mfdpic}.
23244 It's enabled by default if optimizing for speed and compiling for
23245 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
23246 optimization option such as @option{-O3} or above is present in the
23247 command line.
23248
23249 @item -mTLS
23250 @opindex mTLS
23251
23252 Assume a large TLS segment when generating thread-local code.
23253
23254 @item -mtls
23255 @opindex mtls
23256
23257 Do not assume a large TLS segment when generating thread-local code.
23258
23259 @item -mgprel-ro
23260 @opindex mgprel-ro
23261
23262 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
23263 that is known to be in read-only sections. It's enabled by default,
23264 except for @option{-fpic} or @option{-fpie}: even though it may help
23265 make the global offset table smaller, it trades 1 instruction for 4.
23266 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
23267 one of which may be shared by multiple symbols, and it avoids the need
23268 for a GOT entry for the referenced symbol, so it's more likely to be a
23269 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
23270
23271 @item -multilib-library-pic
23272 @opindex multilib-library-pic
23273
23274 Link with the (library, not FD) pic libraries. It's implied by
23275 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
23276 @option{-fpic} without @option{-mfdpic}. You should never have to use
23277 it explicitly.
23278
23279 @item -mlinked-fp
23280 @opindex mlinked-fp
23281
23282 Follow the EABI requirement of always creating a frame pointer whenever
23283 a stack frame is allocated. This option is enabled by default and can
23284 be disabled with @option{-mno-linked-fp}.
23285
23286 @item -mlong-calls
23287 @opindex mlong-calls
23288
23289 Use indirect addressing to call functions outside the current
23290 compilation unit. This allows the functions to be placed anywhere
23291 within the 32-bit address space.
23292
23293 @item -malign-labels
23294 @opindex malign-labels
23295
23296 Try to align labels to an 8-byte boundary by inserting NOPs into the
23297 previous packet. This option only has an effect when VLIW packing
23298 is enabled. It doesn't create new packets; it merely adds NOPs to
23299 existing ones.
23300
23301 @item -mlibrary-pic
23302 @opindex mlibrary-pic
23303
23304 Generate position-independent EABI code.
23305
23306 @item -macc-4
23307 @opindex macc-4
23308
23309 Use only the first four media accumulator registers.
23310
23311 @item -macc-8
23312 @opindex macc-8
23313
23314 Use all eight media accumulator registers.
23315
23316 @item -mpack
23317 @opindex mpack
23318
23319 Pack VLIW instructions.
23320
23321 @item -mno-pack
23322 @opindex mno-pack
23323
23324 Do not pack VLIW instructions.
23325
23326 @item -mno-eflags
23327 @opindex mno-eflags
23328
23329 Do not mark ABI switches in e_flags.
23330
23331 @item -mcond-move
23332 @opindex mcond-move
23333
23334 Enable the use of conditional-move instructions (default).
23335
23336 This switch is mainly for debugging the compiler and will likely be removed
23337 in a future version.
23338
23339 @item -mno-cond-move
23340 @opindex mno-cond-move
23341
23342 Disable the use of conditional-move instructions.
23343
23344 This switch is mainly for debugging the compiler and will likely be removed
23345 in a future version.
23346
23347 @item -mscc
23348 @opindex mscc
23349
23350 Enable the use of conditional set instructions (default).
23351
23352 This switch is mainly for debugging the compiler and will likely be removed
23353 in a future version.
23354
23355 @item -mno-scc
23356 @opindex mno-scc
23357
23358 Disable the use of conditional set instructions.
23359
23360 This switch is mainly for debugging the compiler and will likely be removed
23361 in a future version.
23362
23363 @item -mcond-exec
23364 @opindex mcond-exec
23365
23366 Enable the use of conditional execution (default).
23367
23368 This switch is mainly for debugging the compiler and will likely be removed
23369 in a future version.
23370
23371 @item -mno-cond-exec
23372 @opindex mno-cond-exec
23373
23374 Disable the use of conditional execution.
23375
23376 This switch is mainly for debugging the compiler and will likely be removed
23377 in a future version.
23378
23379 @item -mvliw-branch
23380 @opindex mvliw-branch
23381
23382 Run a pass to pack branches into VLIW instructions (default).
23383
23384 This switch is mainly for debugging the compiler and will likely be removed
23385 in a future version.
23386
23387 @item -mno-vliw-branch
23388 @opindex mno-vliw-branch
23389
23390 Do not run a pass to pack branches into VLIW instructions.
23391
23392 This switch is mainly for debugging the compiler and will likely be removed
23393 in a future version.
23394
23395 @item -mmulti-cond-exec
23396 @opindex mmulti-cond-exec
23397
23398 Enable optimization of @code{&&} and @code{||} in conditional execution
23399 (default).
23400
23401 This switch is mainly for debugging the compiler and will likely be removed
23402 in a future version.
23403
23404 @item -mno-multi-cond-exec
23405 @opindex mno-multi-cond-exec
23406
23407 Disable optimization of @code{&&} and @code{||} in conditional execution.
23408
23409 This switch is mainly for debugging the compiler and will likely be removed
23410 in a future version.
23411
23412 @item -mnested-cond-exec
23413 @opindex mnested-cond-exec
23414
23415 Enable nested conditional execution optimizations (default).
23416
23417 This switch is mainly for debugging the compiler and will likely be removed
23418 in a future version.
23419
23420 @item -mno-nested-cond-exec
23421 @opindex mno-nested-cond-exec
23422
23423 Disable nested conditional execution optimizations.
23424
23425 This switch is mainly for debugging the compiler and will likely be removed
23426 in a future version.
23427
23428 @item -moptimize-membar
23429 @opindex moptimize-membar
23430
23431 This switch removes redundant @code{membar} instructions from the
23432 compiler-generated code. It is enabled by default.
23433
23434 @item -mno-optimize-membar
23435 @opindex mno-optimize-membar
23436 @opindex moptimize-membar
23437
23438 This switch disables the automatic removal of redundant @code{membar}
23439 instructions from the generated code.
23440
23441 @item -mtomcat-stats
23442 @opindex mtomcat-stats
23443
23444 Cause gas to print out tomcat statistics.
23445
23446 @item -mcpu=@var{cpu}
23447 @opindex mcpu
23448
23449 Select the processor type for which to generate code. Possible values are
23450 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
23451 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
23452
23453 @end table
23454
23455 @node GNU/Linux Options
23456 @subsection GNU/Linux Options
23457
23458 These @samp{-m} options are defined for GNU/Linux targets:
23459
23460 @table @gcctabopt
23461 @item -mglibc
23462 @opindex mglibc
23463 Use the GNU C library. This is the default except
23464 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
23465 @samp{*-*-linux-*android*} targets.
23466
23467 @item -muclibc
23468 @opindex muclibc
23469 Use uClibc C library. This is the default on
23470 @samp{*-*-linux-*uclibc*} targets.
23471
23472 @item -mmusl
23473 @opindex mmusl
23474 Use the musl C library. This is the default on
23475 @samp{*-*-linux-*musl*} targets.
23476
23477 @item -mbionic
23478 @opindex mbionic
23479 Use Bionic C library. This is the default on
23480 @samp{*-*-linux-*android*} targets.
23481
23482 @item -mandroid
23483 @opindex mandroid
23484 Compile code compatible with Android platform. This is the default on
23485 @samp{*-*-linux-*android*} targets.
23486
23487 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
23488 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
23489 this option makes the GCC driver pass Android-specific options to the linker.
23490 Finally, this option causes the preprocessor macro @code{__ANDROID__}
23491 to be defined.
23492
23493 @item -tno-android-cc
23494 @opindex tno-android-cc
23495 Disable compilation effects of @option{-mandroid}, i.e., do not enable
23496 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
23497 @option{-fno-rtti} by default.
23498
23499 @item -tno-android-ld
23500 @opindex tno-android-ld
23501 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
23502 linking options to the linker.
23503
23504 @end table
23505
23506 @node H8/300 Options
23507 @subsection H8/300 Options
23508
23509 These @samp{-m} options are defined for the H8/300 implementations:
23510
23511 @table @gcctabopt
23512 @item -mrelax
23513 @opindex mrelax
23514 Shorten some address references at link time, when possible; uses the
23515 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
23516 ld, Using ld}, for a fuller description.
23517
23518 @item -mh
23519 @opindex mh
23520 Generate code for the H8/300H@.
23521
23522 @item -ms
23523 @opindex ms
23524 Generate code for the H8S@.
23525
23526 @item -mn
23527 @opindex mn
23528 Generate code for the H8S and H8/300H in the normal mode. This switch
23529 must be used either with @option{-mh} or @option{-ms}.
23530
23531 @item -ms2600
23532 @opindex ms2600
23533 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
23534
23535 @item -mexr
23536 @opindex mexr
23537 Extended registers are stored on stack before execution of function
23538 with monitor attribute. Default option is @option{-mexr}.
23539 This option is valid only for H8S targets.
23540
23541 @item -mno-exr
23542 @opindex mno-exr
23543 @opindex mexr
23544 Extended registers are not stored on stack before execution of function
23545 with monitor attribute. Default option is @option{-mno-exr}.
23546 This option is valid only for H8S targets.
23547
23548 @item -mint32
23549 @opindex mint32
23550 Make @code{int} data 32 bits by default.
23551
23552 @item -malign-300
23553 @opindex malign-300
23554 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
23555 The default for the H8/300H and H8S is to align longs and floats on
23556 4-byte boundaries.
23557 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
23558 This option has no effect on the H8/300.
23559 @end table
23560
23561 @node HPPA Options
23562 @subsection HPPA Options
23563 @cindex HPPA Options
23564
23565 These @samp{-m} options are defined for the HPPA family of computers:
23566
23567 @table @gcctabopt
23568 @item -march=@var{architecture-type}
23569 @opindex march
23570 Generate code for the specified architecture. The choices for
23571 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
23572 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
23573 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
23574 architecture option for your machine. Code compiled for lower numbered
23575 architectures runs on higher numbered architectures, but not the
23576 other way around.
23577
23578 @item -mpa-risc-1-0
23579 @itemx -mpa-risc-1-1
23580 @itemx -mpa-risc-2-0
23581 @opindex mpa-risc-1-0
23582 @opindex mpa-risc-1-1
23583 @opindex mpa-risc-2-0
23584 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
23585
23586 @item -mcaller-copies
23587 @opindex mcaller-copies
23588 The caller copies function arguments passed by hidden reference. This
23589 option should be used with care as it is not compatible with the default
23590 32-bit runtime. However, only aggregates larger than eight bytes are
23591 passed by hidden reference and the option provides better compatibility
23592 with OpenMP.
23593
23594 @item -mjump-in-delay
23595 @opindex mjump-in-delay
23596 This option is ignored and provided for compatibility purposes only.
23597
23598 @item -mdisable-fpregs
23599 @opindex mdisable-fpregs
23600 Prevent floating-point registers from being used in any manner. This is
23601 necessary for compiling kernels that perform lazy context switching of
23602 floating-point registers. If you use this option and attempt to perform
23603 floating-point operations, the compiler aborts.
23604
23605 @item -mdisable-indexing
23606 @opindex mdisable-indexing
23607 Prevent the compiler from using indexing address modes. This avoids some
23608 rather obscure problems when compiling MIG generated code under MACH@.
23609
23610 @item -mno-space-regs
23611 @opindex mno-space-regs
23612 @opindex mspace-regs
23613 Generate code that assumes the target has no space registers. This allows
23614 GCC to generate faster indirect calls and use unscaled index address modes.
23615
23616 Such code is suitable for level 0 PA systems and kernels.
23617
23618 @item -mfast-indirect-calls
23619 @opindex mfast-indirect-calls
23620 Generate code that assumes calls never cross space boundaries. This
23621 allows GCC to emit code that performs faster indirect calls.
23622
23623 This option does not work in the presence of shared libraries or nested
23624 functions.
23625
23626 @item -mfixed-range=@var{register-range}
23627 @opindex mfixed-range
23628 Generate code treating the given register range as fixed registers.
23629 A fixed register is one that the register allocator cannot use. This is
23630 useful when compiling kernel code. A register range is specified as
23631 two registers separated by a dash. Multiple register ranges can be
23632 specified separated by a comma.
23633
23634 @item -mlong-load-store
23635 @opindex mlong-load-store
23636 Generate 3-instruction load and store sequences as sometimes required by
23637 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
23638 the HP compilers.
23639
23640 @item -mportable-runtime
23641 @opindex mportable-runtime
23642 Use the portable calling conventions proposed by HP for ELF systems.
23643
23644 @item -mgas
23645 @opindex mgas
23646 Enable the use of assembler directives only GAS understands.
23647
23648 @item -mschedule=@var{cpu-type}
23649 @opindex mschedule
23650 Schedule code according to the constraints for the machine type
23651 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
23652 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
23653 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
23654 proper scheduling option for your machine. The default scheduling is
23655 @samp{8000}.
23656
23657 @item -mlinker-opt
23658 @opindex mlinker-opt
23659 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
23660 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
23661 linkers in which they give bogus error messages when linking some programs.
23662
23663 @item -msoft-float
23664 @opindex msoft-float
23665 Generate output containing library calls for floating point.
23666 @strong{Warning:} the requisite libraries are not available for all HPPA
23667 targets. Normally the facilities of the machine's usual C compiler are
23668 used, but this cannot be done directly in cross-compilation. You must make
23669 your own arrangements to provide suitable library functions for
23670 cross-compilation.
23671
23672 @option{-msoft-float} changes the calling convention in the output file;
23673 therefore, it is only useful if you compile @emph{all} of a program with
23674 this option. In particular, you need to compile @file{libgcc.a}, the
23675 library that comes with GCC, with @option{-msoft-float} in order for
23676 this to work.
23677
23678 @item -msio
23679 @opindex msio
23680 Generate the predefine, @code{_SIO}, for server IO@. The default is
23681 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
23682 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
23683 options are available under HP-UX and HI-UX@.
23684
23685 @item -mgnu-ld
23686 @opindex mgnu-ld
23687 Use options specific to GNU @command{ld}.
23688 This passes @option{-shared} to @command{ld} when
23689 building a shared library. It is the default when GCC is configured,
23690 explicitly or implicitly, with the GNU linker. This option does not
23691 affect which @command{ld} is called; it only changes what parameters
23692 are passed to that @command{ld}.
23693 The @command{ld} that is called is determined by the
23694 @option{--with-ld} configure option, GCC's program search path, and
23695 finally by the user's @env{PATH}. The linker used by GCC can be printed
23696 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
23697 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23698
23699 @item -mhp-ld
23700 @opindex mhp-ld
23701 Use options specific to HP @command{ld}.
23702 This passes @option{-b} to @command{ld} when building
23703 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
23704 links. It is the default when GCC is configured, explicitly or
23705 implicitly, with the HP linker. This option does not affect
23706 which @command{ld} is called; it only changes what parameters are passed to that
23707 @command{ld}.
23708 The @command{ld} that is called is determined by the @option{--with-ld}
23709 configure option, GCC's program search path, and finally by the user's
23710 @env{PATH}. The linker used by GCC can be printed using @samp{which
23711 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
23712 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23713
23714 @item -mlong-calls
23715 @opindex mno-long-calls
23716 @opindex mlong-calls
23717 Generate code that uses long call sequences. This ensures that a call
23718 is always able to reach linker generated stubs. The default is to generate
23719 long calls only when the distance from the call site to the beginning
23720 of the function or translation unit, as the case may be, exceeds a
23721 predefined limit set by the branch type being used. The limits for
23722 normal calls are 7,600,000 and 240,000 bytes, respectively for the
23723 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
23724 240,000 bytes.
23725
23726 Distances are measured from the beginning of functions when using the
23727 @option{-ffunction-sections} option, or when using the @option{-mgas}
23728 and @option{-mno-portable-runtime} options together under HP-UX with
23729 the SOM linker.
23730
23731 It is normally not desirable to use this option as it degrades
23732 performance. However, it may be useful in large applications,
23733 particularly when partial linking is used to build the application.
23734
23735 The types of long calls used depends on the capabilities of the
23736 assembler and linker, and the type of code being generated. The
23737 impact on systems that support long absolute calls, and long pic
23738 symbol-difference or pc-relative calls should be relatively small.
23739 However, an indirect call is used on 32-bit ELF systems in pic code
23740 and it is quite long.
23741
23742 @item -munix=@var{unix-std}
23743 @opindex march
23744 Generate compiler predefines and select a startfile for the specified
23745 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
23746 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
23747 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
23748 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
23749 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
23750 and later.
23751
23752 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
23753 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
23754 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
23755 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
23756 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
23757 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
23758
23759 It is @emph{important} to note that this option changes the interfaces
23760 for various library routines. It also affects the operational behavior
23761 of the C library. Thus, @emph{extreme} care is needed in using this
23762 option.
23763
23764 Library code that is intended to operate with more than one UNIX
23765 standard must test, set and restore the variable @code{__xpg4_extended_mask}
23766 as appropriate. Most GNU software doesn't provide this capability.
23767
23768 @item -nolibdld
23769 @opindex nolibdld
23770 Suppress the generation of link options to search libdld.sl when the
23771 @option{-static} option is specified on HP-UX 10 and later.
23772
23773 @item -static
23774 @opindex static
23775 The HP-UX implementation of setlocale in libc has a dependency on
23776 libdld.sl. There isn't an archive version of libdld.sl. Thus,
23777 when the @option{-static} option is specified, special link options
23778 are needed to resolve this dependency.
23779
23780 On HP-UX 10 and later, the GCC driver adds the necessary options to
23781 link with libdld.sl when the @option{-static} option is specified.
23782 This causes the resulting binary to be dynamic. On the 64-bit port,
23783 the linkers generate dynamic binaries by default in any case. The
23784 @option{-nolibdld} option can be used to prevent the GCC driver from
23785 adding these link options.
23786
23787 @item -threads
23788 @opindex threads
23789 Add support for multithreading with the @dfn{dce thread} library
23790 under HP-UX@. This option sets flags for both the preprocessor and
23791 linker.
23792 @end table
23793
23794 @node IA-64 Options
23795 @subsection IA-64 Options
23796 @cindex IA-64 Options
23797
23798 These are the @samp{-m} options defined for the Intel IA-64 architecture.
23799
23800 @table @gcctabopt
23801 @item -mbig-endian
23802 @opindex mbig-endian
23803 Generate code for a big-endian target. This is the default for HP-UX@.
23804
23805 @item -mlittle-endian
23806 @opindex mlittle-endian
23807 Generate code for a little-endian target. This is the default for AIX5
23808 and GNU/Linux.
23809
23810 @item -mgnu-as
23811 @itemx -mno-gnu-as
23812 @opindex mgnu-as
23813 @opindex mno-gnu-as
23814 Generate (or don't) code for the GNU assembler. This is the default.
23815 @c Also, this is the default if the configure option @option{--with-gnu-as}
23816 @c is used.
23817
23818 @item -mgnu-ld
23819 @itemx -mno-gnu-ld
23820 @opindex mgnu-ld
23821 @opindex mno-gnu-ld
23822 Generate (or don't) code for the GNU linker. This is the default.
23823 @c Also, this is the default if the configure option @option{--with-gnu-ld}
23824 @c is used.
23825
23826 @item -mno-pic
23827 @opindex mno-pic
23828 Generate code that does not use a global pointer register. The result
23829 is not position independent code, and violates the IA-64 ABI@.
23830
23831 @item -mvolatile-asm-stop
23832 @itemx -mno-volatile-asm-stop
23833 @opindex mvolatile-asm-stop
23834 @opindex mno-volatile-asm-stop
23835 Generate (or don't) a stop bit immediately before and after volatile asm
23836 statements.
23837
23838 @item -mregister-names
23839 @itemx -mno-register-names
23840 @opindex mregister-names
23841 @opindex mno-register-names
23842 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
23843 the stacked registers. This may make assembler output more readable.
23844
23845 @item -mno-sdata
23846 @itemx -msdata
23847 @opindex mno-sdata
23848 @opindex msdata
23849 Disable (or enable) optimizations that use the small data section. This may
23850 be useful for working around optimizer bugs.
23851
23852 @item -mconstant-gp
23853 @opindex mconstant-gp
23854 Generate code that uses a single constant global pointer value. This is
23855 useful when compiling kernel code.
23856
23857 @item -mauto-pic
23858 @opindex mauto-pic
23859 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
23860 This is useful when compiling firmware code.
23861
23862 @item -minline-float-divide-min-latency
23863 @opindex minline-float-divide-min-latency
23864 Generate code for inline divides of floating-point values
23865 using the minimum latency algorithm.
23866
23867 @item -minline-float-divide-max-throughput
23868 @opindex minline-float-divide-max-throughput
23869 Generate code for inline divides of floating-point values
23870 using the maximum throughput algorithm.
23871
23872 @item -mno-inline-float-divide
23873 @opindex mno-inline-float-divide
23874 Do not generate inline code for divides of floating-point values.
23875
23876 @item -minline-int-divide-min-latency
23877 @opindex minline-int-divide-min-latency
23878 Generate code for inline divides of integer values
23879 using the minimum latency algorithm.
23880
23881 @item -minline-int-divide-max-throughput
23882 @opindex minline-int-divide-max-throughput
23883 Generate code for inline divides of integer values
23884 using the maximum throughput algorithm.
23885
23886 @item -mno-inline-int-divide
23887 @opindex mno-inline-int-divide
23888 @opindex minline-int-divide
23889 Do not generate inline code for divides of integer values.
23890
23891 @item -minline-sqrt-min-latency
23892 @opindex minline-sqrt-min-latency
23893 Generate code for inline square roots
23894 using the minimum latency algorithm.
23895
23896 @item -minline-sqrt-max-throughput
23897 @opindex minline-sqrt-max-throughput
23898 Generate code for inline square roots
23899 using the maximum throughput algorithm.
23900
23901 @item -mno-inline-sqrt
23902 @opindex mno-inline-sqrt
23903 Do not generate inline code for @code{sqrt}.
23904
23905 @item -mfused-madd
23906 @itemx -mno-fused-madd
23907 @opindex mfused-madd
23908 @opindex mno-fused-madd
23909 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
23910 instructions. The default is to use these instructions.
23911
23912 @item -mno-dwarf2-asm
23913 @itemx -mdwarf2-asm
23914 @opindex mno-dwarf2-asm
23915 @opindex mdwarf2-asm
23916 Don't (or do) generate assembler code for the DWARF line number debugging
23917 info. This may be useful when not using the GNU assembler.
23918
23919 @item -mearly-stop-bits
23920 @itemx -mno-early-stop-bits
23921 @opindex mearly-stop-bits
23922 @opindex mno-early-stop-bits
23923 Allow stop bits to be placed earlier than immediately preceding the
23924 instruction that triggered the stop bit. This can improve instruction
23925 scheduling, but does not always do so.
23926
23927 @item -mfixed-range=@var{register-range}
23928 @opindex mfixed-range
23929 Generate code treating the given register range as fixed registers.
23930 A fixed register is one that the register allocator cannot use. This is
23931 useful when compiling kernel code. A register range is specified as
23932 two registers separated by a dash. Multiple register ranges can be
23933 specified separated by a comma.
23934
23935 @item -mtls-size=@var{tls-size}
23936 @opindex mtls-size
23937 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
23938 64.
23939
23940 @item -mtune=@var{cpu-type}
23941 @opindex mtune
23942 Tune the instruction scheduling for a particular CPU, Valid values are
23943 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
23944 and @samp{mckinley}.
23945
23946 @item -milp32
23947 @itemx -mlp64
23948 @opindex milp32
23949 @opindex mlp64
23950 Generate code for a 32-bit or 64-bit environment.
23951 The 32-bit environment sets int, long and pointer to 32 bits.
23952 The 64-bit environment sets int to 32 bits and long and pointer
23953 to 64 bits. These are HP-UX specific flags.
23954
23955 @item -mno-sched-br-data-spec
23956 @itemx -msched-br-data-spec
23957 @opindex mno-sched-br-data-spec
23958 @opindex msched-br-data-spec
23959 (Dis/En)able data speculative scheduling before reload.
23960 This results in generation of @code{ld.a} instructions and
23961 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23962 The default setting is disabled.
23963
23964 @item -msched-ar-data-spec
23965 @itemx -mno-sched-ar-data-spec
23966 @opindex msched-ar-data-spec
23967 @opindex mno-sched-ar-data-spec
23968 (En/Dis)able data speculative scheduling after reload.
23969 This results in generation of @code{ld.a} instructions and
23970 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23971 The default setting is enabled.
23972
23973 @item -mno-sched-control-spec
23974 @itemx -msched-control-spec
23975 @opindex mno-sched-control-spec
23976 @opindex msched-control-spec
23977 (Dis/En)able control speculative scheduling. This feature is
23978 available only during region scheduling (i.e.@: before reload).
23979 This results in generation of the @code{ld.s} instructions and
23980 the corresponding check instructions @code{chk.s}.
23981 The default setting is disabled.
23982
23983 @item -msched-br-in-data-spec
23984 @itemx -mno-sched-br-in-data-spec
23985 @opindex msched-br-in-data-spec
23986 @opindex mno-sched-br-in-data-spec
23987 (En/Dis)able speculative scheduling of the instructions that
23988 are dependent on the data speculative loads before reload.
23989 This is effective only with @option{-msched-br-data-spec} enabled.
23990 The default setting is enabled.
23991
23992 @item -msched-ar-in-data-spec
23993 @itemx -mno-sched-ar-in-data-spec
23994 @opindex msched-ar-in-data-spec
23995 @opindex mno-sched-ar-in-data-spec
23996 (En/Dis)able speculative scheduling of the instructions that
23997 are dependent on the data speculative loads after reload.
23998 This is effective only with @option{-msched-ar-data-spec} enabled.
23999 The default setting is enabled.
24000
24001 @item -msched-in-control-spec
24002 @itemx -mno-sched-in-control-spec
24003 @opindex msched-in-control-spec
24004 @opindex mno-sched-in-control-spec
24005 (En/Dis)able speculative scheduling of the instructions that
24006 are dependent on the control speculative loads.
24007 This is effective only with @option{-msched-control-spec} enabled.
24008 The default setting is enabled.
24009
24010 @item -mno-sched-prefer-non-data-spec-insns
24011 @itemx -msched-prefer-non-data-spec-insns
24012 @opindex mno-sched-prefer-non-data-spec-insns
24013 @opindex msched-prefer-non-data-spec-insns
24014 If enabled, data-speculative instructions are chosen for schedule
24015 only if there are no other choices at the moment. This makes
24016 the use of the data speculation much more conservative.
24017 The default setting is disabled.
24018
24019 @item -mno-sched-prefer-non-control-spec-insns
24020 @itemx -msched-prefer-non-control-spec-insns
24021 @opindex mno-sched-prefer-non-control-spec-insns
24022 @opindex msched-prefer-non-control-spec-insns
24023 If enabled, control-speculative instructions are chosen for schedule
24024 only if there are no other choices at the moment. This makes
24025 the use of the control speculation much more conservative.
24026 The default setting is disabled.
24027
24028 @item -mno-sched-count-spec-in-critical-path
24029 @itemx -msched-count-spec-in-critical-path
24030 @opindex mno-sched-count-spec-in-critical-path
24031 @opindex msched-count-spec-in-critical-path
24032 If enabled, speculative dependencies are considered during
24033 computation of the instructions priorities. This makes the use of the
24034 speculation a bit more conservative.
24035 The default setting is disabled.
24036
24037 @item -msched-spec-ldc
24038 @opindex msched-spec-ldc
24039 Use a simple data speculation check. This option is on by default.
24040
24041 @item -msched-control-spec-ldc
24042 @opindex msched-spec-ldc
24043 Use a simple check for control speculation. This option is on by default.
24044
24045 @item -msched-stop-bits-after-every-cycle
24046 @opindex msched-stop-bits-after-every-cycle
24047 Place a stop bit after every cycle when scheduling. This option is on
24048 by default.
24049
24050 @item -msched-fp-mem-deps-zero-cost
24051 @opindex msched-fp-mem-deps-zero-cost
24052 Assume that floating-point stores and loads are not likely to cause a conflict
24053 when placed into the same instruction group. This option is disabled by
24054 default.
24055
24056 @item -msel-sched-dont-check-control-spec
24057 @opindex msel-sched-dont-check-control-spec
24058 Generate checks for control speculation in selective scheduling.
24059 This flag is disabled by default.
24060
24061 @item -msched-max-memory-insns=@var{max-insns}
24062 @opindex msched-max-memory-insns
24063 Limit on the number of memory insns per instruction group, giving lower
24064 priority to subsequent memory insns attempting to schedule in the same
24065 instruction group. Frequently useful to prevent cache bank conflicts.
24066 The default value is 1.
24067
24068 @item -msched-max-memory-insns-hard-limit
24069 @opindex msched-max-memory-insns-hard-limit
24070 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
24071 disallowing more than that number in an instruction group.
24072 Otherwise, the limit is ``soft'', meaning that non-memory operations
24073 are preferred when the limit is reached, but memory operations may still
24074 be scheduled.
24075
24076 @end table
24077
24078 @node LM32 Options
24079 @subsection LM32 Options
24080 @cindex LM32 options
24081
24082 These @option{-m} options are defined for the LatticeMico32 architecture:
24083
24084 @table @gcctabopt
24085 @item -mbarrel-shift-enabled
24086 @opindex mbarrel-shift-enabled
24087 Enable barrel-shift instructions.
24088
24089 @item -mdivide-enabled
24090 @opindex mdivide-enabled
24091 Enable divide and modulus instructions.
24092
24093 @item -mmultiply-enabled
24094 @opindex multiply-enabled
24095 Enable multiply instructions.
24096
24097 @item -msign-extend-enabled
24098 @opindex msign-extend-enabled
24099 Enable sign extend instructions.
24100
24101 @item -muser-enabled
24102 @opindex muser-enabled
24103 Enable user-defined instructions.
24104
24105 @end table
24106
24107 @node M32C Options
24108 @subsection M32C Options
24109 @cindex M32C options
24110
24111 @table @gcctabopt
24112 @item -mcpu=@var{name}
24113 @opindex mcpu=
24114 Select the CPU for which code is generated. @var{name} may be one of
24115 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
24116 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
24117 the M32C/80 series.
24118
24119 @item -msim
24120 @opindex msim
24121 Specifies that the program will be run on the simulator. This causes
24122 an alternate runtime library to be linked in which supports, for
24123 example, file I/O@. You must not use this option when generating
24124 programs that will run on real hardware; you must provide your own
24125 runtime library for whatever I/O functions are needed.
24126
24127 @item -memregs=@var{number}
24128 @opindex memregs=
24129 Specifies the number of memory-based pseudo-registers GCC uses
24130 during code generation. These pseudo-registers are used like real
24131 registers, so there is a tradeoff between GCC's ability to fit the
24132 code into available registers, and the performance penalty of using
24133 memory instead of registers. Note that all modules in a program must
24134 be compiled with the same value for this option. Because of that, you
24135 must not use this option with GCC's default runtime libraries.
24136
24137 @end table
24138
24139 @node M32R/D Options
24140 @subsection M32R/D Options
24141 @cindex M32R/D options
24142
24143 These @option{-m} options are defined for Renesas M32R/D architectures:
24144
24145 @table @gcctabopt
24146 @item -m32r2
24147 @opindex m32r2
24148 Generate code for the M32R/2@.
24149
24150 @item -m32rx
24151 @opindex m32rx
24152 Generate code for the M32R/X@.
24153
24154 @item -m32r
24155 @opindex m32r
24156 Generate code for the M32R@. This is the default.
24157
24158 @item -mmodel=small
24159 @opindex mmodel=small
24160 Assume all objects live in the lower 16MB of memory (so that their addresses
24161 can be loaded with the @code{ld24} instruction), and assume all subroutines
24162 are reachable with the @code{bl} instruction.
24163 This is the default.
24164
24165 The addressability of a particular object can be set with the
24166 @code{model} attribute.
24167
24168 @item -mmodel=medium
24169 @opindex mmodel=medium
24170 Assume objects may be anywhere in the 32-bit address space (the compiler
24171 generates @code{seth/add3} instructions to load their addresses), and
24172 assume all subroutines are reachable with the @code{bl} instruction.
24173
24174 @item -mmodel=large
24175 @opindex mmodel=large
24176 Assume objects may be anywhere in the 32-bit address space (the compiler
24177 generates @code{seth/add3} instructions to load their addresses), and
24178 assume subroutines may not be reachable with the @code{bl} instruction
24179 (the compiler generates the much slower @code{seth/add3/jl}
24180 instruction sequence).
24181
24182 @item -msdata=none
24183 @opindex msdata=none
24184 Disable use of the small data area. Variables are put into
24185 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
24186 @code{section} attribute has been specified).
24187 This is the default.
24188
24189 The small data area consists of sections @code{.sdata} and @code{.sbss}.
24190 Objects may be explicitly put in the small data area with the
24191 @code{section} attribute using one of these sections.
24192
24193 @item -msdata=sdata
24194 @opindex msdata=sdata
24195 Put small global and static data in the small data area, but do not
24196 generate special code to reference them.
24197
24198 @item -msdata=use
24199 @opindex msdata=use
24200 Put small global and static data in the small data area, and generate
24201 special instructions to reference them.
24202
24203 @item -G @var{num}
24204 @opindex G
24205 @cindex smaller data references
24206 Put global and static objects less than or equal to @var{num} bytes
24207 into the small data or BSS sections instead of the normal data or BSS
24208 sections. The default value of @var{num} is 8.
24209 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
24210 for this option to have any effect.
24211
24212 All modules should be compiled with the same @option{-G @var{num}} value.
24213 Compiling with different values of @var{num} may or may not work; if it
24214 doesn't the linker gives an error message---incorrect code is not
24215 generated.
24216
24217 @item -mdebug
24218 @opindex mdebug
24219 Makes the M32R-specific code in the compiler display some statistics
24220 that might help in debugging programs.
24221
24222 @item -malign-loops
24223 @opindex malign-loops
24224 Align all loops to a 32-byte boundary.
24225
24226 @item -mno-align-loops
24227 @opindex mno-align-loops
24228 Do not enforce a 32-byte alignment for loops. This is the default.
24229
24230 @item -missue-rate=@var{number}
24231 @opindex missue-rate=@var{number}
24232 Issue @var{number} instructions per cycle. @var{number} can only be 1
24233 or 2.
24234
24235 @item -mbranch-cost=@var{number}
24236 @opindex mbranch-cost=@var{number}
24237 @var{number} can only be 1 or 2. If it is 1 then branches are
24238 preferred over conditional code, if it is 2, then the opposite applies.
24239
24240 @item -mflush-trap=@var{number}
24241 @opindex mflush-trap=@var{number}
24242 Specifies the trap number to use to flush the cache. The default is
24243 12. Valid numbers are between 0 and 15 inclusive.
24244
24245 @item -mno-flush-trap
24246 @opindex mno-flush-trap
24247 Specifies that the cache cannot be flushed by using a trap.
24248
24249 @item -mflush-func=@var{name}
24250 @opindex mflush-func=@var{name}
24251 Specifies the name of the operating system function to call to flush
24252 the cache. The default is @samp{_flush_cache}, but a function call
24253 is only used if a trap is not available.
24254
24255 @item -mno-flush-func
24256 @opindex mno-flush-func
24257 Indicates that there is no OS function for flushing the cache.
24258
24259 @end table
24260
24261 @node M680x0 Options
24262 @subsection M680x0 Options
24263 @cindex M680x0 options
24264
24265 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
24266 The default settings depend on which architecture was selected when
24267 the compiler was configured; the defaults for the most common choices
24268 are given below.
24269
24270 @table @gcctabopt
24271 @item -march=@var{arch}
24272 @opindex march
24273 Generate code for a specific M680x0 or ColdFire instruction set
24274 architecture. Permissible values of @var{arch} for M680x0
24275 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
24276 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
24277 architectures are selected according to Freescale's ISA classification
24278 and the permissible values are: @samp{isaa}, @samp{isaaplus},
24279 @samp{isab} and @samp{isac}.
24280
24281 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
24282 code for a ColdFire target. The @var{arch} in this macro is one of the
24283 @option{-march} arguments given above.
24284
24285 When used together, @option{-march} and @option{-mtune} select code
24286 that runs on a family of similar processors but that is optimized
24287 for a particular microarchitecture.
24288
24289 @item -mcpu=@var{cpu}
24290 @opindex mcpu
24291 Generate code for a specific M680x0 or ColdFire processor.
24292 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
24293 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
24294 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
24295 below, which also classifies the CPUs into families:
24296
24297 @multitable @columnfractions 0.20 0.80
24298 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
24299 @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}
24300 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
24301 @item @samp{5206e} @tab @samp{5206e}
24302 @item @samp{5208} @tab @samp{5207} @samp{5208}
24303 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
24304 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
24305 @item @samp{5216} @tab @samp{5214} @samp{5216}
24306 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
24307 @item @samp{5225} @tab @samp{5224} @samp{5225}
24308 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
24309 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
24310 @item @samp{5249} @tab @samp{5249}
24311 @item @samp{5250} @tab @samp{5250}
24312 @item @samp{5271} @tab @samp{5270} @samp{5271}
24313 @item @samp{5272} @tab @samp{5272}
24314 @item @samp{5275} @tab @samp{5274} @samp{5275}
24315 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
24316 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
24317 @item @samp{5307} @tab @samp{5307}
24318 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
24319 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
24320 @item @samp{5407} @tab @samp{5407}
24321 @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}
24322 @end multitable
24323
24324 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
24325 @var{arch} is compatible with @var{cpu}. Other combinations of
24326 @option{-mcpu} and @option{-march} are rejected.
24327
24328 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
24329 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
24330 where the value of @var{family} is given by the table above.
24331
24332 @item -mtune=@var{tune}
24333 @opindex mtune
24334 Tune the code for a particular microarchitecture within the
24335 constraints set by @option{-march} and @option{-mcpu}.
24336 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
24337 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
24338 and @samp{cpu32}. The ColdFire microarchitectures
24339 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
24340
24341 You can also use @option{-mtune=68020-40} for code that needs
24342 to run relatively well on 68020, 68030 and 68040 targets.
24343 @option{-mtune=68020-60} is similar but includes 68060 targets
24344 as well. These two options select the same tuning decisions as
24345 @option{-m68020-40} and @option{-m68020-60} respectively.
24346
24347 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
24348 when tuning for 680x0 architecture @var{arch}. It also defines
24349 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
24350 option is used. If GCC is tuning for a range of architectures,
24351 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
24352 it defines the macros for every architecture in the range.
24353
24354 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
24355 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
24356 of the arguments given above.
24357
24358 @item -m68000
24359 @itemx -mc68000
24360 @opindex m68000
24361 @opindex mc68000
24362 Generate output for a 68000. This is the default
24363 when the compiler is configured for 68000-based systems.
24364 It is equivalent to @option{-march=68000}.
24365
24366 Use this option for microcontrollers with a 68000 or EC000 core,
24367 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
24368
24369 @item -m68010
24370 @opindex m68010
24371 Generate output for a 68010. This is the default
24372 when the compiler is configured for 68010-based systems.
24373 It is equivalent to @option{-march=68010}.
24374
24375 @item -m68020
24376 @itemx -mc68020
24377 @opindex m68020
24378 @opindex mc68020
24379 Generate output for a 68020. This is the default
24380 when the compiler is configured for 68020-based systems.
24381 It is equivalent to @option{-march=68020}.
24382
24383 @item -m68030
24384 @opindex m68030
24385 Generate output for a 68030. This is the default when the compiler is
24386 configured for 68030-based systems. It is equivalent to
24387 @option{-march=68030}.
24388
24389 @item -m68040
24390 @opindex m68040
24391 Generate output for a 68040. This is the default when the compiler is
24392 configured for 68040-based systems. It is equivalent to
24393 @option{-march=68040}.
24394
24395 This option inhibits the use of 68881/68882 instructions that have to be
24396 emulated by software on the 68040. Use this option if your 68040 does not
24397 have code to emulate those instructions.
24398
24399 @item -m68060
24400 @opindex m68060
24401 Generate output for a 68060. This is the default when the compiler is
24402 configured for 68060-based systems. It is equivalent to
24403 @option{-march=68060}.
24404
24405 This option inhibits the use of 68020 and 68881/68882 instructions that
24406 have to be emulated by software on the 68060. Use this option if your 68060
24407 does not have code to emulate those instructions.
24408
24409 @item -mcpu32
24410 @opindex mcpu32
24411 Generate output for a CPU32. This is the default
24412 when the compiler is configured for CPU32-based systems.
24413 It is equivalent to @option{-march=cpu32}.
24414
24415 Use this option for microcontrollers with a
24416 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
24417 68336, 68340, 68341, 68349 and 68360.
24418
24419 @item -m5200
24420 @opindex m5200
24421 Generate output for a 520X ColdFire CPU@. This is the default
24422 when the compiler is configured for 520X-based systems.
24423 It is equivalent to @option{-mcpu=5206}, and is now deprecated
24424 in favor of that option.
24425
24426 Use this option for microcontroller with a 5200 core, including
24427 the MCF5202, MCF5203, MCF5204 and MCF5206.
24428
24429 @item -m5206e
24430 @opindex m5206e
24431 Generate output for a 5206e ColdFire CPU@. The option is now
24432 deprecated in favor of the equivalent @option{-mcpu=5206e}.
24433
24434 @item -m528x
24435 @opindex m528x
24436 Generate output for a member of the ColdFire 528X family.
24437 The option is now deprecated in favor of the equivalent
24438 @option{-mcpu=528x}.
24439
24440 @item -m5307
24441 @opindex m5307
24442 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
24443 in favor of the equivalent @option{-mcpu=5307}.
24444
24445 @item -m5407
24446 @opindex m5407
24447 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
24448 in favor of the equivalent @option{-mcpu=5407}.
24449
24450 @item -mcfv4e
24451 @opindex mcfv4e
24452 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
24453 This includes use of hardware floating-point instructions.
24454 The option is equivalent to @option{-mcpu=547x}, and is now
24455 deprecated in favor of that option.
24456
24457 @item -m68020-40
24458 @opindex m68020-40
24459 Generate output for a 68040, without using any of the new instructions.
24460 This results in code that can run relatively efficiently on either a
24461 68020/68881 or a 68030 or a 68040. The generated code does use the
24462 68881 instructions that are emulated on the 68040.
24463
24464 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
24465
24466 @item -m68020-60
24467 @opindex m68020-60
24468 Generate output for a 68060, without using any of the new instructions.
24469 This results in code that can run relatively efficiently on either a
24470 68020/68881 or a 68030 or a 68040. The generated code does use the
24471 68881 instructions that are emulated on the 68060.
24472
24473 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
24474
24475 @item -mhard-float
24476 @itemx -m68881
24477 @opindex mhard-float
24478 @opindex m68881
24479 Generate floating-point instructions. This is the default for 68020
24480 and above, and for ColdFire devices that have an FPU@. It defines the
24481 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
24482 on ColdFire targets.
24483
24484 @item -msoft-float
24485 @opindex msoft-float
24486 Do not generate floating-point instructions; use library calls instead.
24487 This is the default for 68000, 68010, and 68832 targets. It is also
24488 the default for ColdFire devices that have no FPU.
24489
24490 @item -mdiv
24491 @itemx -mno-div
24492 @opindex mdiv
24493 @opindex mno-div
24494 Generate (do not generate) ColdFire hardware divide and remainder
24495 instructions. If @option{-march} is used without @option{-mcpu},
24496 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
24497 architectures. Otherwise, the default is taken from the target CPU
24498 (either the default CPU, or the one specified by @option{-mcpu}). For
24499 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
24500 @option{-mcpu=5206e}.
24501
24502 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
24503
24504 @item -mshort
24505 @opindex mshort
24506 Consider type @code{int} to be 16 bits wide, like @code{short int}.
24507 Additionally, parameters passed on the stack are also aligned to a
24508 16-bit boundary even on targets whose API mandates promotion to 32-bit.
24509
24510 @item -mno-short
24511 @opindex mno-short
24512 Do not consider type @code{int} to be 16 bits wide. This is the default.
24513
24514 @item -mnobitfield
24515 @itemx -mno-bitfield
24516 @opindex mnobitfield
24517 @opindex mno-bitfield
24518 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
24519 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
24520
24521 @item -mbitfield
24522 @opindex mbitfield
24523 Do use the bit-field instructions. The @option{-m68020} option implies
24524 @option{-mbitfield}. This is the default if you use a configuration
24525 designed for a 68020.
24526
24527 @item -mrtd
24528 @opindex mrtd
24529 Use a different function-calling convention, in which functions
24530 that take a fixed number of arguments return with the @code{rtd}
24531 instruction, which pops their arguments while returning. This
24532 saves one instruction in the caller since there is no need to pop
24533 the arguments there.
24534
24535 This calling convention is incompatible with the one normally
24536 used on Unix, so you cannot use it if you need to call libraries
24537 compiled with the Unix compiler.
24538
24539 Also, you must provide function prototypes for all functions that
24540 take variable numbers of arguments (including @code{printf});
24541 otherwise incorrect code is generated for calls to those
24542 functions.
24543
24544 In addition, seriously incorrect code results if you call a
24545 function with too many arguments. (Normally, extra arguments are
24546 harmlessly ignored.)
24547
24548 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
24549 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
24550
24551 The default is @option{-mno-rtd}.
24552
24553 @item -malign-int
24554 @itemx -mno-align-int
24555 @opindex malign-int
24556 @opindex mno-align-int
24557 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
24558 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
24559 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
24560 Aligning variables on 32-bit boundaries produces code that runs somewhat
24561 faster on processors with 32-bit busses at the expense of more memory.
24562
24563 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
24564 aligns structures containing the above types differently than
24565 most published application binary interface specifications for the m68k.
24566
24567 @opindex mpcrel
24568 Use the pc-relative addressing mode of the 68000 directly, instead of
24569 using a global offset table. At present, this option implies @option{-fpic},
24570 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
24571 not presently supported with @option{-mpcrel}, though this could be supported for
24572 68020 and higher processors.
24573
24574 @item -mno-strict-align
24575 @itemx -mstrict-align
24576 @opindex mno-strict-align
24577 @opindex mstrict-align
24578 Do not (do) assume that unaligned memory references are handled by
24579 the system.
24580
24581 @item -msep-data
24582 Generate code that allows the data segment to be located in a different
24583 area of memory from the text segment. This allows for execute-in-place in
24584 an environment without virtual memory management. This option implies
24585 @option{-fPIC}.
24586
24587 @item -mno-sep-data
24588 Generate code that assumes that the data segment follows the text segment.
24589 This is the default.
24590
24591 @item -mid-shared-library
24592 Generate code that supports shared libraries via the library ID method.
24593 This allows for execute-in-place and shared libraries in an environment
24594 without virtual memory management. This option implies @option{-fPIC}.
24595
24596 @item -mno-id-shared-library
24597 Generate code that doesn't assume ID-based shared libraries are being used.
24598 This is the default.
24599
24600 @item -mshared-library-id=n
24601 Specifies the identification number of the ID-based shared library being
24602 compiled. Specifying a value of 0 generates more compact code; specifying
24603 other values forces the allocation of that number to the current
24604 library, but is no more space- or time-efficient than omitting this option.
24605
24606 @item -mxgot
24607 @itemx -mno-xgot
24608 @opindex mxgot
24609 @opindex mno-xgot
24610 When generating position-independent code for ColdFire, generate code
24611 that works if the GOT has more than 8192 entries. This code is
24612 larger and slower than code generated without this option. On M680x0
24613 processors, this option is not needed; @option{-fPIC} suffices.
24614
24615 GCC normally uses a single instruction to load values from the GOT@.
24616 While this is relatively efficient, it only works if the GOT
24617 is smaller than about 64k. Anything larger causes the linker
24618 to report an error such as:
24619
24620 @cindex relocation truncated to fit (ColdFire)
24621 @smallexample
24622 relocation truncated to fit: R_68K_GOT16O foobar
24623 @end smallexample
24624
24625 If this happens, you should recompile your code with @option{-mxgot}.
24626 It should then work with very large GOTs. However, code generated with
24627 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
24628 the value of a global symbol.
24629
24630 Note that some linkers, including newer versions of the GNU linker,
24631 can create multiple GOTs and sort GOT entries. If you have such a linker,
24632 you should only need to use @option{-mxgot} when compiling a single
24633 object file that accesses more than 8192 GOT entries. Very few do.
24634
24635 These options have no effect unless GCC is generating
24636 position-independent code.
24637
24638 @item -mlong-jump-table-offsets
24639 @opindex mlong-jump-table-offsets
24640 Use 32-bit offsets in @code{switch} tables. The default is to use
24641 16-bit offsets.
24642
24643 @end table
24644
24645 @node MCore Options
24646 @subsection MCore Options
24647 @cindex MCore options
24648
24649 These are the @samp{-m} options defined for the Motorola M*Core
24650 processors.
24651
24652 @table @gcctabopt
24653
24654 @item -mhardlit
24655 @itemx -mno-hardlit
24656 @opindex mhardlit
24657 @opindex mno-hardlit
24658 Inline constants into the code stream if it can be done in two
24659 instructions or less.
24660
24661 @item -mdiv
24662 @itemx -mno-div
24663 @opindex mdiv
24664 @opindex mno-div
24665 Use the divide instruction. (Enabled by default).
24666
24667 @item -mrelax-immediate
24668 @itemx -mno-relax-immediate
24669 @opindex mrelax-immediate
24670 @opindex mno-relax-immediate
24671 Allow arbitrary-sized immediates in bit operations.
24672
24673 @item -mwide-bitfields
24674 @itemx -mno-wide-bitfields
24675 @opindex mwide-bitfields
24676 @opindex mno-wide-bitfields
24677 Always treat bit-fields as @code{int}-sized.
24678
24679 @item -m4byte-functions
24680 @itemx -mno-4byte-functions
24681 @opindex m4byte-functions
24682 @opindex mno-4byte-functions
24683 Force all functions to be aligned to a 4-byte boundary.
24684
24685 @item -mcallgraph-data
24686 @itemx -mno-callgraph-data
24687 @opindex mcallgraph-data
24688 @opindex mno-callgraph-data
24689 Emit callgraph information.
24690
24691 @item -mslow-bytes
24692 @itemx -mno-slow-bytes
24693 @opindex mslow-bytes
24694 @opindex mno-slow-bytes
24695 Prefer word access when reading byte quantities.
24696
24697 @item -mlittle-endian
24698 @itemx -mbig-endian
24699 @opindex mlittle-endian
24700 @opindex mbig-endian
24701 Generate code for a little-endian target.
24702
24703 @item -m210
24704 @itemx -m340
24705 @opindex m210
24706 @opindex m340
24707 Generate code for the 210 processor.
24708
24709 @item -mno-lsim
24710 @opindex mno-lsim
24711 Assume that runtime support has been provided and so omit the
24712 simulator library (@file{libsim.a)} from the linker command line.
24713
24714 @item -mstack-increment=@var{size}
24715 @opindex mstack-increment
24716 Set the maximum amount for a single stack increment operation. Large
24717 values can increase the speed of programs that contain functions
24718 that need a large amount of stack space, but they can also trigger a
24719 segmentation fault if the stack is extended too much. The default
24720 value is 0x1000.
24721
24722 @end table
24723
24724 @node MeP Options
24725 @subsection MeP Options
24726 @cindex MeP options
24727
24728 @table @gcctabopt
24729
24730 @item -mabsdiff
24731 @opindex mabsdiff
24732 Enables the @code{abs} instruction, which is the absolute difference
24733 between two registers.
24734
24735 @item -mall-opts
24736 @opindex mall-opts
24737 Enables all the optional instructions---average, multiply, divide, bit
24738 operations, leading zero, absolute difference, min/max, clip, and
24739 saturation.
24740
24741
24742 @item -maverage
24743 @opindex maverage
24744 Enables the @code{ave} instruction, which computes the average of two
24745 registers.
24746
24747 @item -mbased=@var{n}
24748 @opindex mbased=
24749 Variables of size @var{n} bytes or smaller are placed in the
24750 @code{.based} section by default. Based variables use the @code{$tp}
24751 register as a base register, and there is a 128-byte limit to the
24752 @code{.based} section.
24753
24754 @item -mbitops
24755 @opindex mbitops
24756 Enables the bit operation instructions---bit test (@code{btstm}), set
24757 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
24758 test-and-set (@code{tas}).
24759
24760 @item -mc=@var{name}
24761 @opindex mc=
24762 Selects which section constant data is placed in. @var{name} may
24763 be @samp{tiny}, @samp{near}, or @samp{far}.
24764
24765 @item -mclip
24766 @opindex mclip
24767 Enables the @code{clip} instruction. Note that @option{-mclip} is not
24768 useful unless you also provide @option{-mminmax}.
24769
24770 @item -mconfig=@var{name}
24771 @opindex mconfig=
24772 Selects one of the built-in core configurations. Each MeP chip has
24773 one or more modules in it; each module has a core CPU and a variety of
24774 coprocessors, optional instructions, and peripherals. The
24775 @code{MeP-Integrator} tool, not part of GCC, provides these
24776 configurations through this option; using this option is the same as
24777 using all the corresponding command-line options. The default
24778 configuration is @samp{default}.
24779
24780 @item -mcop
24781 @opindex mcop
24782 Enables the coprocessor instructions. By default, this is a 32-bit
24783 coprocessor. Note that the coprocessor is normally enabled via the
24784 @option{-mconfig=} option.
24785
24786 @item -mcop32
24787 @opindex mcop32
24788 Enables the 32-bit coprocessor's instructions.
24789
24790 @item -mcop64
24791 @opindex mcop64
24792 Enables the 64-bit coprocessor's instructions.
24793
24794 @item -mivc2
24795 @opindex mivc2
24796 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
24797
24798 @item -mdc
24799 @opindex mdc
24800 Causes constant variables to be placed in the @code{.near} section.
24801
24802 @item -mdiv
24803 @opindex mdiv
24804 Enables the @code{div} and @code{divu} instructions.
24805
24806 @item -meb
24807 @opindex meb
24808 Generate big-endian code.
24809
24810 @item -mel
24811 @opindex mel
24812 Generate little-endian code.
24813
24814 @item -mio-volatile
24815 @opindex mio-volatile
24816 Tells the compiler that any variable marked with the @code{io}
24817 attribute is to be considered volatile.
24818
24819 @item -ml
24820 @opindex ml
24821 Causes variables to be assigned to the @code{.far} section by default.
24822
24823 @item -mleadz
24824 @opindex mleadz
24825 Enables the @code{leadz} (leading zero) instruction.
24826
24827 @item -mm
24828 @opindex mm
24829 Causes variables to be assigned to the @code{.near} section by default.
24830
24831 @item -mminmax
24832 @opindex mminmax
24833 Enables the @code{min} and @code{max} instructions.
24834
24835 @item -mmult
24836 @opindex mmult
24837 Enables the multiplication and multiply-accumulate instructions.
24838
24839 @item -mno-opts
24840 @opindex mno-opts
24841 Disables all the optional instructions enabled by @option{-mall-opts}.
24842
24843 @item -mrepeat
24844 @opindex mrepeat
24845 Enables the @code{repeat} and @code{erepeat} instructions, used for
24846 low-overhead looping.
24847
24848 @item -ms
24849 @opindex ms
24850 Causes all variables to default to the @code{.tiny} section. Note
24851 that there is a 65536-byte limit to this section. Accesses to these
24852 variables use the @code{%gp} base register.
24853
24854 @item -msatur
24855 @opindex msatur
24856 Enables the saturation instructions. Note that the compiler does not
24857 currently generate these itself, but this option is included for
24858 compatibility with other tools, like @code{as}.
24859
24860 @item -msdram
24861 @opindex msdram
24862 Link the SDRAM-based runtime instead of the default ROM-based runtime.
24863
24864 @item -msim
24865 @opindex msim
24866 Link the simulator run-time libraries.
24867
24868 @item -msimnovec
24869 @opindex msimnovec
24870 Link the simulator runtime libraries, excluding built-in support
24871 for reset and exception vectors and tables.
24872
24873 @item -mtf
24874 @opindex mtf
24875 Causes all functions to default to the @code{.far} section. Without
24876 this option, functions default to the @code{.near} section.
24877
24878 @item -mtiny=@var{n}
24879 @opindex mtiny=
24880 Variables that are @var{n} bytes or smaller are allocated to the
24881 @code{.tiny} section. These variables use the @code{$gp} base
24882 register. The default for this option is 4, but note that there's a
24883 65536-byte limit to the @code{.tiny} section.
24884
24885 @end table
24886
24887 @node MicroBlaze Options
24888 @subsection MicroBlaze Options
24889 @cindex MicroBlaze Options
24890
24891 @table @gcctabopt
24892
24893 @item -msoft-float
24894 @opindex msoft-float
24895 Use software emulation for floating point (default).
24896
24897 @item -mhard-float
24898 @opindex mhard-float
24899 Use hardware floating-point instructions.
24900
24901 @item -mmemcpy
24902 @opindex mmemcpy
24903 Do not optimize block moves, use @code{memcpy}.
24904
24905 @item -mno-clearbss
24906 @opindex mno-clearbss
24907 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
24908
24909 @item -mcpu=@var{cpu-type}
24910 @opindex mcpu=
24911 Use features of, and schedule code for, the given CPU.
24912 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
24913 where @var{X} is a major version, @var{YY} is the minor version, and
24914 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
24915 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
24916
24917 @item -mxl-soft-mul
24918 @opindex mxl-soft-mul
24919 Use software multiply emulation (default).
24920
24921 @item -mxl-soft-div
24922 @opindex mxl-soft-div
24923 Use software emulation for divides (default).
24924
24925 @item -mxl-barrel-shift
24926 @opindex mxl-barrel-shift
24927 Use the hardware barrel shifter.
24928
24929 @item -mxl-pattern-compare
24930 @opindex mxl-pattern-compare
24931 Use pattern compare instructions.
24932
24933 @item -msmall-divides
24934 @opindex msmall-divides
24935 Use table lookup optimization for small signed integer divisions.
24936
24937 @item -mxl-stack-check
24938 @opindex mxl-stack-check
24939 This option is deprecated. Use @option{-fstack-check} instead.
24940
24941 @item -mxl-gp-opt
24942 @opindex mxl-gp-opt
24943 Use GP-relative @code{.sdata}/@code{.sbss} sections.
24944
24945 @item -mxl-multiply-high
24946 @opindex mxl-multiply-high
24947 Use multiply high instructions for high part of 32x32 multiply.
24948
24949 @item -mxl-float-convert
24950 @opindex mxl-float-convert
24951 Use hardware floating-point conversion instructions.
24952
24953 @item -mxl-float-sqrt
24954 @opindex mxl-float-sqrt
24955 Use hardware floating-point square root instruction.
24956
24957 @item -mbig-endian
24958 @opindex mbig-endian
24959 Generate code for a big-endian target.
24960
24961 @item -mlittle-endian
24962 @opindex mlittle-endian
24963 Generate code for a little-endian target.
24964
24965 @item -mxl-reorder
24966 @opindex mxl-reorder
24967 Use reorder instructions (swap and byte reversed load/store).
24968
24969 @item -mxl-mode-@var{app-model}
24970 Select application model @var{app-model}. Valid models are
24971 @table @samp
24972 @item executable
24973 normal executable (default), uses startup code @file{crt0.o}.
24974
24975 @item xmdstub
24976 for use with Xilinx Microprocessor Debugger (XMD) based
24977 software intrusive debug agent called xmdstub. This uses startup file
24978 @file{crt1.o} and sets the start address of the program to 0x800.
24979
24980 @item bootstrap
24981 for applications that are loaded using a bootloader.
24982 This model uses startup file @file{crt2.o} which does not contain a processor
24983 reset vector handler. This is suitable for transferring control on a
24984 processor reset to the bootloader rather than the application.
24985
24986 @item novectors
24987 for applications that do not require any of the
24988 MicroBlaze vectors. This option may be useful for applications running
24989 within a monitoring application. This model uses @file{crt3.o} as a startup file.
24990 @end table
24991
24992 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
24993 @option{-mxl-mode-@var{app-model}}.
24994
24995 @item -mpic-data-is-text-relative
24996 @opindex mpic-data-is-text-relative
24997 Assume that the displacement between the text and data segments is fixed
24998 at static link time. This allows data to be referenced by offset from start of
24999 text address instead of GOT since PC-relative addressing is not supported.
25000
25001 @end table
25002
25003 @node MIPS Options
25004 @subsection MIPS Options
25005 @cindex MIPS options
25006
25007 @table @gcctabopt
25008
25009 @item -EB
25010 @opindex EB
25011 Generate big-endian code.
25012
25013 @item -EL
25014 @opindex EL
25015 Generate little-endian code. This is the default for @samp{mips*el-*-*}
25016 configurations.
25017
25018 @item -march=@var{arch}
25019 @opindex march
25020 Generate code that runs on @var{arch}, which can be the name of a
25021 generic MIPS ISA, or the name of a particular processor.
25022 The ISA names are:
25023 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
25024 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
25025 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
25026 @samp{mips64r5} and @samp{mips64r6}.
25027 The processor names are:
25028 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
25029 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
25030 @samp{5kc}, @samp{5kf},
25031 @samp{20kc},
25032 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
25033 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
25034 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
25035 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
25036 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
25037 @samp{i6400}, @samp{i6500},
25038 @samp{interaptiv},
25039 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
25040 @samp{gs464e}, @samp{gs264e},
25041 @samp{m4k},
25042 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
25043 @samp{m5100}, @samp{m5101},
25044 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
25045 @samp{orion},
25046 @samp{p5600}, @samp{p6600},
25047 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
25048 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
25049 @samp{r6000}, @samp{r8000},
25050 @samp{rm7000}, @samp{rm9000},
25051 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
25052 @samp{sb1},
25053 @samp{sr71000},
25054 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
25055 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
25056 @samp{xlr} and @samp{xlp}.
25057 The special value @samp{from-abi} selects the
25058 most compatible architecture for the selected ABI (that is,
25059 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
25060
25061 The native Linux/GNU toolchain also supports the value @samp{native},
25062 which selects the best architecture option for the host processor.
25063 @option{-march=native} has no effect if GCC does not recognize
25064 the processor.
25065
25066 In processor names, a final @samp{000} can be abbreviated as @samp{k}
25067 (for example, @option{-march=r2k}). Prefixes are optional, and
25068 @samp{vr} may be written @samp{r}.
25069
25070 Names of the form @samp{@var{n}f2_1} refer to processors with
25071 FPUs clocked at half the rate of the core, names of the form
25072 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
25073 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
25074 processors with FPUs clocked a ratio of 3:2 with respect to the core.
25075 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
25076 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
25077 accepted as synonyms for @samp{@var{n}f1_1}.
25078
25079 GCC defines two macros based on the value of this option. The first
25080 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
25081 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
25082 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
25083 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
25084 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
25085
25086 Note that the @code{_MIPS_ARCH} macro uses the processor names given
25087 above. In other words, it has the full prefix and does not
25088 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
25089 the macro names the resolved architecture (either @code{"mips1"} or
25090 @code{"mips3"}). It names the default architecture when no
25091 @option{-march} option is given.
25092
25093 @item -mtune=@var{arch}
25094 @opindex mtune
25095 Optimize for @var{arch}. Among other things, this option controls
25096 the way instructions are scheduled, and the perceived cost of arithmetic
25097 operations. The list of @var{arch} values is the same as for
25098 @option{-march}.
25099
25100 When this option is not used, GCC optimizes for the processor
25101 specified by @option{-march}. By using @option{-march} and
25102 @option{-mtune} together, it is possible to generate code that
25103 runs on a family of processors, but optimize the code for one
25104 particular member of that family.
25105
25106 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
25107 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
25108 @option{-march} ones described above.
25109
25110 @item -mips1
25111 @opindex mips1
25112 Equivalent to @option{-march=mips1}.
25113
25114 @item -mips2
25115 @opindex mips2
25116 Equivalent to @option{-march=mips2}.
25117
25118 @item -mips3
25119 @opindex mips3
25120 Equivalent to @option{-march=mips3}.
25121
25122 @item -mips4
25123 @opindex mips4
25124 Equivalent to @option{-march=mips4}.
25125
25126 @item -mips32
25127 @opindex mips32
25128 Equivalent to @option{-march=mips32}.
25129
25130 @item -mips32r3
25131 @opindex mips32r3
25132 Equivalent to @option{-march=mips32r3}.
25133
25134 @item -mips32r5
25135 @opindex mips32r5
25136 Equivalent to @option{-march=mips32r5}.
25137
25138 @item -mips32r6
25139 @opindex mips32r6
25140 Equivalent to @option{-march=mips32r6}.
25141
25142 @item -mips64
25143 @opindex mips64
25144 Equivalent to @option{-march=mips64}.
25145
25146 @item -mips64r2
25147 @opindex mips64r2
25148 Equivalent to @option{-march=mips64r2}.
25149
25150 @item -mips64r3
25151 @opindex mips64r3
25152 Equivalent to @option{-march=mips64r3}.
25153
25154 @item -mips64r5
25155 @opindex mips64r5
25156 Equivalent to @option{-march=mips64r5}.
25157
25158 @item -mips64r6
25159 @opindex mips64r6
25160 Equivalent to @option{-march=mips64r6}.
25161
25162 @item -mips16
25163 @itemx -mno-mips16
25164 @opindex mips16
25165 @opindex mno-mips16
25166 Generate (do not generate) MIPS16 code. If GCC is targeting a
25167 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
25168
25169 MIPS16 code generation can also be controlled on a per-function basis
25170 by means of @code{mips16} and @code{nomips16} attributes.
25171 @xref{Function Attributes}, for more information.
25172
25173 @item -mflip-mips16
25174 @opindex mflip-mips16
25175 Generate MIPS16 code on alternating functions. This option is provided
25176 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
25177 not intended for ordinary use in compiling user code.
25178
25179 @item -minterlink-compressed
25180 @itemx -mno-interlink-compressed
25181 @opindex minterlink-compressed
25182 @opindex mno-interlink-compressed
25183 Require (do not require) that code using the standard (uncompressed) MIPS ISA
25184 be link-compatible with MIPS16 and microMIPS code, and vice versa.
25185
25186 For example, code using the standard ISA encoding cannot jump directly
25187 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
25188 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
25189 knows that the target of the jump is not compressed.
25190
25191 @item -minterlink-mips16
25192 @itemx -mno-interlink-mips16
25193 @opindex minterlink-mips16
25194 @opindex mno-interlink-mips16
25195 Aliases of @option{-minterlink-compressed} and
25196 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
25197 and are retained for backwards compatibility.
25198
25199 @item -mabi=32
25200 @itemx -mabi=o64
25201 @itemx -mabi=n32
25202 @itemx -mabi=64
25203 @itemx -mabi=eabi
25204 @opindex mabi=32
25205 @opindex mabi=o64
25206 @opindex mabi=n32
25207 @opindex mabi=64
25208 @opindex mabi=eabi
25209 Generate code for the given ABI@.
25210
25211 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
25212 generates 64-bit code when you select a 64-bit architecture, but you
25213 can use @option{-mgp32} to get 32-bit code instead.
25214
25215 For information about the O64 ABI, see
25216 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
25217
25218 GCC supports a variant of the o32 ABI in which floating-point registers
25219 are 64 rather than 32 bits wide. You can select this combination with
25220 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
25221 and @code{mfhc1} instructions and is therefore only supported for
25222 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
25223
25224 The register assignments for arguments and return values remain the
25225 same, but each scalar value is passed in a single 64-bit register
25226 rather than a pair of 32-bit registers. For example, scalar
25227 floating-point values are returned in @samp{$f0} only, not a
25228 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
25229 remains the same in that the even-numbered double-precision registers
25230 are saved.
25231
25232 Two additional variants of the o32 ABI are supported to enable
25233 a transition from 32-bit to 64-bit registers. These are FPXX
25234 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
25235 The FPXX extension mandates that all code must execute correctly
25236 when run using 32-bit or 64-bit registers. The code can be interlinked
25237 with either FP32 or FP64, but not both.
25238 The FP64A extension is similar to the FP64 extension but forbids the
25239 use of odd-numbered single-precision registers. This can be used
25240 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
25241 processors and allows both FP32 and FP64A code to interlink and
25242 run in the same process without changing FPU modes.
25243
25244 @item -mabicalls
25245 @itemx -mno-abicalls
25246 @opindex mabicalls
25247 @opindex mno-abicalls
25248 Generate (do not generate) code that is suitable for SVR4-style
25249 dynamic objects. @option{-mabicalls} is the default for SVR4-based
25250 systems.
25251
25252 @item -mshared
25253 @itemx -mno-shared
25254 Generate (do not generate) code that is fully position-independent,
25255 and that can therefore be linked into shared libraries. This option
25256 only affects @option{-mabicalls}.
25257
25258 All @option{-mabicalls} code has traditionally been position-independent,
25259 regardless of options like @option{-fPIC} and @option{-fpic}. However,
25260 as an extension, the GNU toolchain allows executables to use absolute
25261 accesses for locally-binding symbols. It can also use shorter GP
25262 initialization sequences and generate direct calls to locally-defined
25263 functions. This mode is selected by @option{-mno-shared}.
25264
25265 @option{-mno-shared} depends on binutils 2.16 or higher and generates
25266 objects that can only be linked by the GNU linker. However, the option
25267 does not affect the ABI of the final executable; it only affects the ABI
25268 of relocatable objects. Using @option{-mno-shared} generally makes
25269 executables both smaller and quicker.
25270
25271 @option{-mshared} is the default.
25272
25273 @item -mplt
25274 @itemx -mno-plt
25275 @opindex mplt
25276 @opindex mno-plt
25277 Assume (do not assume) that the static and dynamic linkers
25278 support PLTs and copy relocations. This option only affects
25279 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
25280 has no effect without @option{-msym32}.
25281
25282 You can make @option{-mplt} the default by configuring
25283 GCC with @option{--with-mips-plt}. The default is
25284 @option{-mno-plt} otherwise.
25285
25286 @item -mxgot
25287 @itemx -mno-xgot
25288 @opindex mxgot
25289 @opindex mno-xgot
25290 Lift (do not lift) the usual restrictions on the size of the global
25291 offset table.
25292
25293 GCC normally uses a single instruction to load values from the GOT@.
25294 While this is relatively efficient, it only works if the GOT
25295 is smaller than about 64k. Anything larger causes the linker
25296 to report an error such as:
25297
25298 @cindex relocation truncated to fit (MIPS)
25299 @smallexample
25300 relocation truncated to fit: R_MIPS_GOT16 foobar
25301 @end smallexample
25302
25303 If this happens, you should recompile your code with @option{-mxgot}.
25304 This works with very large GOTs, although the code is also
25305 less efficient, since it takes three instructions to fetch the
25306 value of a global symbol.
25307
25308 Note that some linkers can create multiple GOTs. If you have such a
25309 linker, you should only need to use @option{-mxgot} when a single object
25310 file accesses more than 64k's worth of GOT entries. Very few do.
25311
25312 These options have no effect unless GCC is generating position
25313 independent code.
25314
25315 @item -mgp32
25316 @opindex mgp32
25317 Assume that general-purpose registers are 32 bits wide.
25318
25319 @item -mgp64
25320 @opindex mgp64
25321 Assume that general-purpose registers are 64 bits wide.
25322
25323 @item -mfp32
25324 @opindex mfp32
25325 Assume that floating-point registers are 32 bits wide.
25326
25327 @item -mfp64
25328 @opindex mfp64
25329 Assume that floating-point registers are 64 bits wide.
25330
25331 @item -mfpxx
25332 @opindex mfpxx
25333 Do not assume the width of floating-point registers.
25334
25335 @item -mhard-float
25336 @opindex mhard-float
25337 Use floating-point coprocessor instructions.
25338
25339 @item -msoft-float
25340 @opindex msoft-float
25341 Do not use floating-point coprocessor instructions. Implement
25342 floating-point calculations using library calls instead.
25343
25344 @item -mno-float
25345 @opindex mno-float
25346 Equivalent to @option{-msoft-float}, but additionally asserts that the
25347 program being compiled does not perform any floating-point operations.
25348 This option is presently supported only by some bare-metal MIPS
25349 configurations, where it may select a special set of libraries
25350 that lack all floating-point support (including, for example, the
25351 floating-point @code{printf} formats).
25352 If code compiled with @option{-mno-float} accidentally contains
25353 floating-point operations, it is likely to suffer a link-time
25354 or run-time failure.
25355
25356 @item -msingle-float
25357 @opindex msingle-float
25358 Assume that the floating-point coprocessor only supports single-precision
25359 operations.
25360
25361 @item -mdouble-float
25362 @opindex mdouble-float
25363 Assume that the floating-point coprocessor supports double-precision
25364 operations. This is the default.
25365
25366 @item -modd-spreg
25367 @itemx -mno-odd-spreg
25368 @opindex modd-spreg
25369 @opindex mno-odd-spreg
25370 Enable the use of odd-numbered single-precision floating-point registers
25371 for the o32 ABI. This is the default for processors that are known to
25372 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
25373 is set by default.
25374
25375 @item -mabs=2008
25376 @itemx -mabs=legacy
25377 @opindex mabs=2008
25378 @opindex mabs=legacy
25379 These options control the treatment of the special not-a-number (NaN)
25380 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
25381 @code{neg.@i{fmt}} machine instructions.
25382
25383 By default or when @option{-mabs=legacy} is used the legacy
25384 treatment is selected. In this case these instructions are considered
25385 arithmetic and avoided where correct operation is required and the
25386 input operand might be a NaN. A longer sequence of instructions that
25387 manipulate the sign bit of floating-point datum manually is used
25388 instead unless the @option{-ffinite-math-only} option has also been
25389 specified.
25390
25391 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
25392 this case these instructions are considered non-arithmetic and therefore
25393 operating correctly in all cases, including in particular where the
25394 input operand is a NaN. These instructions are therefore always used
25395 for the respective operations.
25396
25397 @item -mnan=2008
25398 @itemx -mnan=legacy
25399 @opindex mnan=2008
25400 @opindex mnan=legacy
25401 These options control the encoding of the special not-a-number (NaN)
25402 IEEE 754 floating-point data.
25403
25404 The @option{-mnan=legacy} option selects the legacy encoding. In this
25405 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
25406 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
25407 by the first bit of their trailing significand field being 1.
25408
25409 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
25410 this case qNaNs are denoted by the first bit of their trailing
25411 significand field being 1, whereas sNaNs are denoted by the first bit of
25412 their trailing significand field being 0.
25413
25414 The default is @option{-mnan=legacy} unless GCC has been configured with
25415 @option{--with-nan=2008}.
25416
25417 @item -mllsc
25418 @itemx -mno-llsc
25419 @opindex mllsc
25420 @opindex mno-llsc
25421 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
25422 implement atomic memory built-in functions. When neither option is
25423 specified, GCC uses the instructions if the target architecture
25424 supports them.
25425
25426 @option{-mllsc} is useful if the runtime environment can emulate the
25427 instructions and @option{-mno-llsc} can be useful when compiling for
25428 nonstandard ISAs. You can make either option the default by
25429 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
25430 respectively. @option{--with-llsc} is the default for some
25431 configurations; see the installation documentation for details.
25432
25433 @item -mdsp
25434 @itemx -mno-dsp
25435 @opindex mdsp
25436 @opindex mno-dsp
25437 Use (do not use) revision 1 of the MIPS DSP ASE@.
25438 @xref{MIPS DSP Built-in Functions}. This option defines the
25439 preprocessor macro @code{__mips_dsp}. It also defines
25440 @code{__mips_dsp_rev} to 1.
25441
25442 @item -mdspr2
25443 @itemx -mno-dspr2
25444 @opindex mdspr2
25445 @opindex mno-dspr2
25446 Use (do not use) revision 2 of the MIPS DSP ASE@.
25447 @xref{MIPS DSP Built-in Functions}. This option defines the
25448 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
25449 It also defines @code{__mips_dsp_rev} to 2.
25450
25451 @item -msmartmips
25452 @itemx -mno-smartmips
25453 @opindex msmartmips
25454 @opindex mno-smartmips
25455 Use (do not use) the MIPS SmartMIPS ASE.
25456
25457 @item -mpaired-single
25458 @itemx -mno-paired-single
25459 @opindex mpaired-single
25460 @opindex mno-paired-single
25461 Use (do not use) paired-single floating-point instructions.
25462 @xref{MIPS Paired-Single Support}. This option requires
25463 hardware floating-point support to be enabled.
25464
25465 @item -mdmx
25466 @itemx -mno-mdmx
25467 @opindex mdmx
25468 @opindex mno-mdmx
25469 Use (do not use) MIPS Digital Media Extension instructions.
25470 This option can only be used when generating 64-bit code and requires
25471 hardware floating-point support to be enabled.
25472
25473 @item -mips3d
25474 @itemx -mno-mips3d
25475 @opindex mips3d
25476 @opindex mno-mips3d
25477 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
25478 The option @option{-mips3d} implies @option{-mpaired-single}.
25479
25480 @item -mmicromips
25481 @itemx -mno-micromips
25482 @opindex mmicromips
25483 @opindex mno-mmicromips
25484 Generate (do not generate) microMIPS code.
25485
25486 MicroMIPS code generation can also be controlled on a per-function basis
25487 by means of @code{micromips} and @code{nomicromips} attributes.
25488 @xref{Function Attributes}, for more information.
25489
25490 @item -mmt
25491 @itemx -mno-mt
25492 @opindex mmt
25493 @opindex mno-mt
25494 Use (do not use) MT Multithreading instructions.
25495
25496 @item -mmcu
25497 @itemx -mno-mcu
25498 @opindex mmcu
25499 @opindex mno-mcu
25500 Use (do not use) the MIPS MCU ASE instructions.
25501
25502 @item -meva
25503 @itemx -mno-eva
25504 @opindex meva
25505 @opindex mno-eva
25506 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
25507
25508 @item -mvirt
25509 @itemx -mno-virt
25510 @opindex mvirt
25511 @opindex mno-virt
25512 Use (do not use) the MIPS Virtualization (VZ) instructions.
25513
25514 @item -mxpa
25515 @itemx -mno-xpa
25516 @opindex mxpa
25517 @opindex mno-xpa
25518 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
25519
25520 @item -mcrc
25521 @itemx -mno-crc
25522 @opindex mcrc
25523 @opindex mno-crc
25524 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
25525
25526 @item -mginv
25527 @itemx -mno-ginv
25528 @opindex mginv
25529 @opindex mno-ginv
25530 Use (do not use) the MIPS Global INValidate (GINV) instructions.
25531
25532 @item -mloongson-mmi
25533 @itemx -mno-loongson-mmi
25534 @opindex mloongson-mmi
25535 @opindex mno-loongson-mmi
25536 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
25537
25538 @item -mloongson-ext
25539 @itemx -mno-loongson-ext
25540 @opindex mloongson-ext
25541 @opindex mno-loongson-ext
25542 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
25543
25544 @item -mloongson-ext2
25545 @itemx -mno-loongson-ext2
25546 @opindex mloongson-ext2
25547 @opindex mno-loongson-ext2
25548 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
25549
25550 @item -mlong64
25551 @opindex mlong64
25552 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
25553 an explanation of the default and the way that the pointer size is
25554 determined.
25555
25556 @item -mlong32
25557 @opindex mlong32
25558 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
25559
25560 The default size of @code{int}s, @code{long}s and pointers depends on
25561 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
25562 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
25563 32-bit @code{long}s. Pointers are the same size as @code{long}s,
25564 or the same size as integer registers, whichever is smaller.
25565
25566 @item -msym32
25567 @itemx -mno-sym32
25568 @opindex msym32
25569 @opindex mno-sym32
25570 Assume (do not assume) that all symbols have 32-bit values, regardless
25571 of the selected ABI@. This option is useful in combination with
25572 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
25573 to generate shorter and faster references to symbolic addresses.
25574
25575 @item -G @var{num}
25576 @opindex G
25577 Put definitions of externally-visible data in a small data section
25578 if that data is no bigger than @var{num} bytes. GCC can then generate
25579 more efficient accesses to the data; see @option{-mgpopt} for details.
25580
25581 The default @option{-G} option depends on the configuration.
25582
25583 @item -mlocal-sdata
25584 @itemx -mno-local-sdata
25585 @opindex mlocal-sdata
25586 @opindex mno-local-sdata
25587 Extend (do not extend) the @option{-G} behavior to local data too,
25588 such as to static variables in C@. @option{-mlocal-sdata} is the
25589 default for all configurations.
25590
25591 If the linker complains that an application is using too much small data,
25592 you might want to try rebuilding the less performance-critical parts with
25593 @option{-mno-local-sdata}. You might also want to build large
25594 libraries with @option{-mno-local-sdata}, so that the libraries leave
25595 more room for the main program.
25596
25597 @item -mextern-sdata
25598 @itemx -mno-extern-sdata
25599 @opindex mextern-sdata
25600 @opindex mno-extern-sdata
25601 Assume (do not assume) that externally-defined data is in
25602 a small data section if the size of that data is within the @option{-G} limit.
25603 @option{-mextern-sdata} is the default for all configurations.
25604
25605 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
25606 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
25607 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
25608 is placed in a small data section. If @var{Var} is defined by another
25609 module, you must either compile that module with a high-enough
25610 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
25611 definition. If @var{Var} is common, you must link the application
25612 with a high-enough @option{-G} setting.
25613
25614 The easiest way of satisfying these restrictions is to compile
25615 and link every module with the same @option{-G} option. However,
25616 you may wish to build a library that supports several different
25617 small data limits. You can do this by compiling the library with
25618 the highest supported @option{-G} setting and additionally using
25619 @option{-mno-extern-sdata} to stop the library from making assumptions
25620 about externally-defined data.
25621
25622 @item -mgpopt
25623 @itemx -mno-gpopt
25624 @opindex mgpopt
25625 @opindex mno-gpopt
25626 Use (do not use) GP-relative accesses for symbols that are known to be
25627 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
25628 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
25629 configurations.
25630
25631 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
25632 might not hold the value of @code{_gp}. For example, if the code is
25633 part of a library that might be used in a boot monitor, programs that
25634 call boot monitor routines pass an unknown value in @code{$gp}.
25635 (In such situations, the boot monitor itself is usually compiled
25636 with @option{-G0}.)
25637
25638 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
25639 @option{-mno-extern-sdata}.
25640
25641 @item -membedded-data
25642 @itemx -mno-embedded-data
25643 @opindex membedded-data
25644 @opindex mno-embedded-data
25645 Allocate variables to the read-only data section first if possible, then
25646 next in the small data section if possible, otherwise in data. This gives
25647 slightly slower code than the default, but reduces the amount of RAM required
25648 when executing, and thus may be preferred for some embedded systems.
25649
25650 @item -muninit-const-in-rodata
25651 @itemx -mno-uninit-const-in-rodata
25652 @opindex muninit-const-in-rodata
25653 @opindex mno-uninit-const-in-rodata
25654 Put uninitialized @code{const} variables in the read-only data section.
25655 This option is only meaningful in conjunction with @option{-membedded-data}.
25656
25657 @item -mcode-readable=@var{setting}
25658 @opindex mcode-readable
25659 Specify whether GCC may generate code that reads from executable sections.
25660 There are three possible settings:
25661
25662 @table @gcctabopt
25663 @item -mcode-readable=yes
25664 Instructions may freely access executable sections. This is the
25665 default setting.
25666
25667 @item -mcode-readable=pcrel
25668 MIPS16 PC-relative load instructions can access executable sections,
25669 but other instructions must not do so. This option is useful on 4KSc
25670 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
25671 It is also useful on processors that can be configured to have a dual
25672 instruction/data SRAM interface and that, like the M4K, automatically
25673 redirect PC-relative loads to the instruction RAM.
25674
25675 @item -mcode-readable=no
25676 Instructions must not access executable sections. This option can be
25677 useful on targets that are configured to have a dual instruction/data
25678 SRAM interface but that (unlike the M4K) do not automatically redirect
25679 PC-relative loads to the instruction RAM.
25680 @end table
25681
25682 @item -msplit-addresses
25683 @itemx -mno-split-addresses
25684 @opindex msplit-addresses
25685 @opindex mno-split-addresses
25686 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
25687 relocation operators. This option has been superseded by
25688 @option{-mexplicit-relocs} but is retained for backwards compatibility.
25689
25690 @item -mexplicit-relocs
25691 @itemx -mno-explicit-relocs
25692 @opindex mexplicit-relocs
25693 @opindex mno-explicit-relocs
25694 Use (do not use) assembler relocation operators when dealing with symbolic
25695 addresses. The alternative, selected by @option{-mno-explicit-relocs},
25696 is to use assembler macros instead.
25697
25698 @option{-mexplicit-relocs} is the default if GCC was configured
25699 to use an assembler that supports relocation operators.
25700
25701 @item -mcheck-zero-division
25702 @itemx -mno-check-zero-division
25703 @opindex mcheck-zero-division
25704 @opindex mno-check-zero-division
25705 Trap (do not trap) on integer division by zero.
25706
25707 The default is @option{-mcheck-zero-division}.
25708
25709 @item -mdivide-traps
25710 @itemx -mdivide-breaks
25711 @opindex mdivide-traps
25712 @opindex mdivide-breaks
25713 MIPS systems check for division by zero by generating either a
25714 conditional trap or a break instruction. Using traps results in
25715 smaller code, but is only supported on MIPS II and later. Also, some
25716 versions of the Linux kernel have a bug that prevents trap from
25717 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
25718 allow conditional traps on architectures that support them and
25719 @option{-mdivide-breaks} to force the use of breaks.
25720
25721 The default is usually @option{-mdivide-traps}, but this can be
25722 overridden at configure time using @option{--with-divide=breaks}.
25723 Divide-by-zero checks can be completely disabled using
25724 @option{-mno-check-zero-division}.
25725
25726 @item -mload-store-pairs
25727 @itemx -mno-load-store-pairs
25728 @opindex mload-store-pairs
25729 @opindex mno-load-store-pairs
25730 Enable (disable) an optimization that pairs consecutive load or store
25731 instructions to enable load/store bonding. This option is enabled by
25732 default but only takes effect when the selected architecture is known
25733 to support bonding.
25734
25735 @item -munaligned-access
25736 @itemx -mno-unaligned-access
25737 @opindex munaligned-access
25738 @opindex mno-unaligned-access
25739 Enable (disable) direct unaligned access for MIPS Release 6.
25740 MIPSr6 requires load/store unaligned-access support,
25741 by hardware or trap&emulate.
25742 So @option{-mno-unaligned-access} may be needed by kernel.
25743
25744 @item -mmemcpy
25745 @itemx -mno-memcpy
25746 @opindex mmemcpy
25747 @opindex mno-memcpy
25748 Force (do not force) the use of @code{memcpy} for non-trivial block
25749 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
25750 most constant-sized copies.
25751
25752 @item -mlong-calls
25753 @itemx -mno-long-calls
25754 @opindex mlong-calls
25755 @opindex mno-long-calls
25756 Disable (do not disable) use of the @code{jal} instruction. Calling
25757 functions using @code{jal} is more efficient but requires the caller
25758 and callee to be in the same 256 megabyte segment.
25759
25760 This option has no effect on abicalls code. The default is
25761 @option{-mno-long-calls}.
25762
25763 @item -mmad
25764 @itemx -mno-mad
25765 @opindex mmad
25766 @opindex mno-mad
25767 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
25768 instructions, as provided by the R4650 ISA@.
25769
25770 @item -mimadd
25771 @itemx -mno-imadd
25772 @opindex mimadd
25773 @opindex mno-imadd
25774 Enable (disable) use of the @code{madd} and @code{msub} integer
25775 instructions. The default is @option{-mimadd} on architectures
25776 that support @code{madd} and @code{msub} except for the 74k
25777 architecture where it was found to generate slower code.
25778
25779 @item -mfused-madd
25780 @itemx -mno-fused-madd
25781 @opindex mfused-madd
25782 @opindex mno-fused-madd
25783 Enable (disable) use of the floating-point multiply-accumulate
25784 instructions, when they are available. The default is
25785 @option{-mfused-madd}.
25786
25787 On the R8000 CPU when multiply-accumulate instructions are used,
25788 the intermediate product is calculated to infinite precision
25789 and is not subject to the FCSR Flush to Zero bit. This may be
25790 undesirable in some circumstances. On other processors the result
25791 is numerically identical to the equivalent computation using
25792 separate multiply, add, subtract and negate instructions.
25793
25794 @item -nocpp
25795 @opindex nocpp
25796 Tell the MIPS assembler to not run its preprocessor over user
25797 assembler files (with a @samp{.s} suffix) when assembling them.
25798
25799 @item -mfix-24k
25800 @itemx -mno-fix-24k
25801 @opindex mfix-24k
25802 @opindex mno-fix-24k
25803 Work around the 24K E48 (lost data on stores during refill) errata.
25804 The workarounds are implemented by the assembler rather than by GCC@.
25805
25806 @item -mfix-r4000
25807 @itemx -mno-fix-r4000
25808 @opindex mfix-r4000
25809 @opindex mno-fix-r4000
25810 Work around certain R4000 CPU errata:
25811 @itemize @minus
25812 @item
25813 A double-word or a variable shift may give an incorrect result if executed
25814 immediately after starting an integer division.
25815 @item
25816 A double-word or a variable shift may give an incorrect result if executed
25817 while an integer multiplication is in progress.
25818 @item
25819 An integer division may give an incorrect result if started in a delay slot
25820 of a taken branch or a jump.
25821 @end itemize
25822
25823 @item -mfix-r4400
25824 @itemx -mno-fix-r4400
25825 @opindex mfix-r4400
25826 @opindex mno-fix-r4400
25827 Work around certain R4400 CPU errata:
25828 @itemize @minus
25829 @item
25830 A double-word or a variable shift may give an incorrect result if executed
25831 immediately after starting an integer division.
25832 @end itemize
25833
25834 @item -mfix-r10000
25835 @itemx -mno-fix-r10000
25836 @opindex mfix-r10000
25837 @opindex mno-fix-r10000
25838 Work around certain R10000 errata:
25839 @itemize @minus
25840 @item
25841 @code{ll}/@code{sc} sequences may not behave atomically on revisions
25842 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
25843 @end itemize
25844
25845 This option can only be used if the target architecture supports
25846 branch-likely instructions. @option{-mfix-r10000} is the default when
25847 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
25848 otherwise.
25849
25850 @item -mfix-r5900
25851 @itemx -mno-fix-r5900
25852 @opindex mfix-r5900
25853 Do not attempt to schedule the preceding instruction into the delay slot
25854 of a branch instruction placed at the end of a short loop of six
25855 instructions or fewer and always schedule a @code{nop} instruction there
25856 instead. The short loop bug under certain conditions causes loops to
25857 execute only once or twice, due to a hardware bug in the R5900 chip. The
25858 workaround is implemented by the assembler rather than by GCC@.
25859
25860 @item -mfix-rm7000
25861 @itemx -mno-fix-rm7000
25862 @opindex mfix-rm7000
25863 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
25864 workarounds are implemented by the assembler rather than by GCC@.
25865
25866 @item -mfix-vr4120
25867 @itemx -mno-fix-vr4120
25868 @opindex mfix-vr4120
25869 Work around certain VR4120 errata:
25870 @itemize @minus
25871 @item
25872 @code{dmultu} does not always produce the correct result.
25873 @item
25874 @code{div} and @code{ddiv} do not always produce the correct result if one
25875 of the operands is negative.
25876 @end itemize
25877 The workarounds for the division errata rely on special functions in
25878 @file{libgcc.a}. At present, these functions are only provided by
25879 the @code{mips64vr*-elf} configurations.
25880
25881 Other VR4120 errata require a NOP to be inserted between certain pairs of
25882 instructions. These errata are handled by the assembler, not by GCC itself.
25883
25884 @item -mfix-vr4130
25885 @opindex mfix-vr4130
25886 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
25887 workarounds are implemented by the assembler rather than by GCC,
25888 although GCC avoids using @code{mflo} and @code{mfhi} if the
25889 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
25890 instructions are available instead.
25891
25892 @item -mfix-sb1
25893 @itemx -mno-fix-sb1
25894 @opindex mfix-sb1
25895 Work around certain SB-1 CPU core errata.
25896 (This flag currently works around the SB-1 revision 2
25897 ``F1'' and ``F2'' floating-point errata.)
25898
25899 @item -mr10k-cache-barrier=@var{setting}
25900 @opindex mr10k-cache-barrier
25901 Specify whether GCC should insert cache barriers to avoid the
25902 side effects of speculation on R10K processors.
25903
25904 In common with many processors, the R10K tries to predict the outcome
25905 of a conditional branch and speculatively executes instructions from
25906 the ``taken'' branch. It later aborts these instructions if the
25907 predicted outcome is wrong. However, on the R10K, even aborted
25908 instructions can have side effects.
25909
25910 This problem only affects kernel stores and, depending on the system,
25911 kernel loads. As an example, a speculatively-executed store may load
25912 the target memory into cache and mark the cache line as dirty, even if
25913 the store itself is later aborted. If a DMA operation writes to the
25914 same area of memory before the ``dirty'' line is flushed, the cached
25915 data overwrites the DMA-ed data. See the R10K processor manual
25916 for a full description, including other potential problems.
25917
25918 One workaround is to insert cache barrier instructions before every memory
25919 access that might be speculatively executed and that might have side
25920 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
25921 controls GCC's implementation of this workaround. It assumes that
25922 aborted accesses to any byte in the following regions does not have
25923 side effects:
25924
25925 @enumerate
25926 @item
25927 the memory occupied by the current function's stack frame;
25928
25929 @item
25930 the memory occupied by an incoming stack argument;
25931
25932 @item
25933 the memory occupied by an object with a link-time-constant address.
25934 @end enumerate
25935
25936 It is the kernel's responsibility to ensure that speculative
25937 accesses to these regions are indeed safe.
25938
25939 If the input program contains a function declaration such as:
25940
25941 @smallexample
25942 void foo (void);
25943 @end smallexample
25944
25945 then the implementation of @code{foo} must allow @code{j foo} and
25946 @code{jal foo} to be executed speculatively. GCC honors this
25947 restriction for functions it compiles itself. It expects non-GCC
25948 functions (such as hand-written assembly code) to do the same.
25949
25950 The option has three forms:
25951
25952 @table @gcctabopt
25953 @item -mr10k-cache-barrier=load-store
25954 Insert a cache barrier before a load or store that might be
25955 speculatively executed and that might have side effects even
25956 if aborted.
25957
25958 @item -mr10k-cache-barrier=store
25959 Insert a cache barrier before a store that might be speculatively
25960 executed and that might have side effects even if aborted.
25961
25962 @item -mr10k-cache-barrier=none
25963 Disable the insertion of cache barriers. This is the default setting.
25964 @end table
25965
25966 @item -mflush-func=@var{func}
25967 @itemx -mno-flush-func
25968 @opindex mflush-func
25969 Specifies the function to call to flush the I and D caches, or to not
25970 call any such function. If called, the function must take the same
25971 arguments as the common @code{_flush_func}, that is, the address of the
25972 memory range for which the cache is being flushed, the size of the
25973 memory range, and the number 3 (to flush both caches). The default
25974 depends on the target GCC was configured for, but commonly is either
25975 @code{_flush_func} or @code{__cpu_flush}.
25976
25977 @item mbranch-cost=@var{num}
25978 @opindex mbranch-cost
25979 Set the cost of branches to roughly @var{num} ``simple'' instructions.
25980 This cost is only a heuristic and is not guaranteed to produce
25981 consistent results across releases. A zero cost redundantly selects
25982 the default, which is based on the @option{-mtune} setting.
25983
25984 @item -mbranch-likely
25985 @itemx -mno-branch-likely
25986 @opindex mbranch-likely
25987 @opindex mno-branch-likely
25988 Enable or disable use of Branch Likely instructions, regardless of the
25989 default for the selected architecture. By default, Branch Likely
25990 instructions may be generated if they are supported by the selected
25991 architecture. An exception is for the MIPS32 and MIPS64 architectures
25992 and processors that implement those architectures; for those, Branch
25993 Likely instructions are not be generated by default because the MIPS32
25994 and MIPS64 architectures specifically deprecate their use.
25995
25996 @item -mcompact-branches=never
25997 @itemx -mcompact-branches=optimal
25998 @itemx -mcompact-branches=always
25999 @opindex mcompact-branches=never
26000 @opindex mcompact-branches=optimal
26001 @opindex mcompact-branches=always
26002 These options control which form of branches will be generated. The
26003 default is @option{-mcompact-branches=optimal}.
26004
26005 The @option{-mcompact-branches=never} option ensures that compact branch
26006 instructions will never be generated.
26007
26008 The @option{-mcompact-branches=always} option ensures that a compact
26009 branch instruction will be generated if available. If a compact branch
26010 instruction is not available, a delay slot form of the branch will be
26011 used instead.
26012
26013 This option is supported from MIPS Release 6 onwards.
26014
26015 The @option{-mcompact-branches=optimal} option will cause a delay slot
26016 branch to be used if one is available in the current ISA and the delay
26017 slot is successfully filled. If the delay slot is not filled, a compact
26018 branch will be chosen if one is available.
26019
26020 @item -mfp-exceptions
26021 @itemx -mno-fp-exceptions
26022 @opindex mfp-exceptions
26023 Specifies whether FP exceptions are enabled. This affects how
26024 FP instructions are scheduled for some processors.
26025 The default is that FP exceptions are
26026 enabled.
26027
26028 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
26029 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
26030 FP pipe.
26031
26032 @item -mvr4130-align
26033 @itemx -mno-vr4130-align
26034 @opindex mvr4130-align
26035 The VR4130 pipeline is two-way superscalar, but can only issue two
26036 instructions together if the first one is 8-byte aligned. When this
26037 option is enabled, GCC aligns pairs of instructions that it
26038 thinks should execute in parallel.
26039
26040 This option only has an effect when optimizing for the VR4130.
26041 It normally makes code faster, but at the expense of making it bigger.
26042 It is enabled by default at optimization level @option{-O3}.
26043
26044 @item -msynci
26045 @itemx -mno-synci
26046 @opindex msynci
26047 Enable (disable) generation of @code{synci} instructions on
26048 architectures that support it. The @code{synci} instructions (if
26049 enabled) are generated when @code{__builtin___clear_cache} is
26050 compiled.
26051
26052 This option defaults to @option{-mno-synci}, but the default can be
26053 overridden by configuring GCC with @option{--with-synci}.
26054
26055 When compiling code for single processor systems, it is generally safe
26056 to use @code{synci}. However, on many multi-core (SMP) systems, it
26057 does not invalidate the instruction caches on all cores and may lead
26058 to undefined behavior.
26059
26060 @item -mrelax-pic-calls
26061 @itemx -mno-relax-pic-calls
26062 @opindex mrelax-pic-calls
26063 Try to turn PIC calls that are normally dispatched via register
26064 @code{$25} into direct calls. This is only possible if the linker can
26065 resolve the destination at link time and if the destination is within
26066 range for a direct call.
26067
26068 @option{-mrelax-pic-calls} is the default if GCC was configured to use
26069 an assembler and a linker that support the @code{.reloc} assembly
26070 directive and @option{-mexplicit-relocs} is in effect. With
26071 @option{-mno-explicit-relocs}, this optimization can be performed by the
26072 assembler and the linker alone without help from the compiler.
26073
26074 @item -mmcount-ra-address
26075 @itemx -mno-mcount-ra-address
26076 @opindex mmcount-ra-address
26077 @opindex mno-mcount-ra-address
26078 Emit (do not emit) code that allows @code{_mcount} to modify the
26079 calling function's return address. When enabled, this option extends
26080 the usual @code{_mcount} interface with a new @var{ra-address}
26081 parameter, which has type @code{intptr_t *} and is passed in register
26082 @code{$12}. @code{_mcount} can then modify the return address by
26083 doing both of the following:
26084 @itemize
26085 @item
26086 Returning the new address in register @code{$31}.
26087 @item
26088 Storing the new address in @code{*@var{ra-address}},
26089 if @var{ra-address} is nonnull.
26090 @end itemize
26091
26092 The default is @option{-mno-mcount-ra-address}.
26093
26094 @item -mframe-header-opt
26095 @itemx -mno-frame-header-opt
26096 @opindex mframe-header-opt
26097 Enable (disable) frame header optimization in the o32 ABI. When using the
26098 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
26099 function to write out register arguments. When enabled, this optimization
26100 will suppress the allocation of the frame header if it can be determined that
26101 it is unused.
26102
26103 This optimization is off by default at all optimization levels.
26104
26105 @item -mlxc1-sxc1
26106 @itemx -mno-lxc1-sxc1
26107 @opindex mlxc1-sxc1
26108 When applicable, enable (disable) the generation of @code{lwxc1},
26109 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
26110
26111 @item -mmadd4
26112 @itemx -mno-madd4
26113 @opindex mmadd4
26114 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
26115 @code{madd.d} and related instructions. Enabled by default.
26116
26117 @end table
26118
26119 @node MMIX Options
26120 @subsection MMIX Options
26121 @cindex MMIX Options
26122
26123 These options are defined for the MMIX:
26124
26125 @table @gcctabopt
26126 @item -mlibfuncs
26127 @itemx -mno-libfuncs
26128 @opindex mlibfuncs
26129 @opindex mno-libfuncs
26130 Specify that intrinsic library functions are being compiled, passing all
26131 values in registers, no matter the size.
26132
26133 @item -mepsilon
26134 @itemx -mno-epsilon
26135 @opindex mepsilon
26136 @opindex mno-epsilon
26137 Generate floating-point comparison instructions that compare with respect
26138 to the @code{rE} epsilon register.
26139
26140 @item -mabi=mmixware
26141 @itemx -mabi=gnu
26142 @opindex mabi=mmixware
26143 @opindex mabi=gnu
26144 Generate code that passes function parameters and return values that (in
26145 the called function) are seen as registers @code{$0} and up, as opposed to
26146 the GNU ABI which uses global registers @code{$231} and up.
26147
26148 @item -mzero-extend
26149 @itemx -mno-zero-extend
26150 @opindex mzero-extend
26151 @opindex mno-zero-extend
26152 When reading data from memory in sizes shorter than 64 bits, use (do not
26153 use) zero-extending load instructions by default, rather than
26154 sign-extending ones.
26155
26156 @item -mknuthdiv
26157 @itemx -mno-knuthdiv
26158 @opindex mknuthdiv
26159 @opindex mno-knuthdiv
26160 Make the result of a division yielding a remainder have the same sign as
26161 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
26162 remainder follows the sign of the dividend. Both methods are
26163 arithmetically valid, the latter being almost exclusively used.
26164
26165 @item -mtoplevel-symbols
26166 @itemx -mno-toplevel-symbols
26167 @opindex mtoplevel-symbols
26168 @opindex mno-toplevel-symbols
26169 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
26170 code can be used with the @code{PREFIX} assembly directive.
26171
26172 @item -melf
26173 @opindex melf
26174 Generate an executable in the ELF format, rather than the default
26175 @samp{mmo} format used by the @command{mmix} simulator.
26176
26177 @item -mbranch-predict
26178 @itemx -mno-branch-predict
26179 @opindex mbranch-predict
26180 @opindex mno-branch-predict
26181 Use (do not use) the probable-branch instructions, when static branch
26182 prediction indicates a probable branch.
26183
26184 @item -mbase-addresses
26185 @itemx -mno-base-addresses
26186 @opindex mbase-addresses
26187 @opindex mno-base-addresses
26188 Generate (do not generate) code that uses @emph{base addresses}. Using a
26189 base address automatically generates a request (handled by the assembler
26190 and the linker) for a constant to be set up in a global register. The
26191 register is used for one or more base address requests within the range 0
26192 to 255 from the value held in the register. The generally leads to short
26193 and fast code, but the number of different data items that can be
26194 addressed is limited. This means that a program that uses lots of static
26195 data may require @option{-mno-base-addresses}.
26196
26197 @item -msingle-exit
26198 @itemx -mno-single-exit
26199 @opindex msingle-exit
26200 @opindex mno-single-exit
26201 Force (do not force) generated code to have a single exit point in each
26202 function.
26203 @end table
26204
26205 @node MN10300 Options
26206 @subsection MN10300 Options
26207 @cindex MN10300 options
26208
26209 These @option{-m} options are defined for Matsushita MN10300 architectures:
26210
26211 @table @gcctabopt
26212 @item -mmult-bug
26213 @opindex mmult-bug
26214 Generate code to avoid bugs in the multiply instructions for the MN10300
26215 processors. This is the default.
26216
26217 @item -mno-mult-bug
26218 @opindex mno-mult-bug
26219 Do not generate code to avoid bugs in the multiply instructions for the
26220 MN10300 processors.
26221
26222 @item -mam33
26223 @opindex mam33
26224 Generate code using features specific to the AM33 processor.
26225
26226 @item -mno-am33
26227 @opindex mno-am33
26228 Do not generate code using features specific to the AM33 processor. This
26229 is the default.
26230
26231 @item -mam33-2
26232 @opindex mam33-2
26233 Generate code using features specific to the AM33/2.0 processor.
26234
26235 @item -mam34
26236 @opindex mam34
26237 Generate code using features specific to the AM34 processor.
26238
26239 @item -mtune=@var{cpu-type}
26240 @opindex mtune
26241 Use the timing characteristics of the indicated CPU type when
26242 scheduling instructions. This does not change the targeted processor
26243 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
26244 @samp{am33-2} or @samp{am34}.
26245
26246 @item -mreturn-pointer-on-d0
26247 @opindex mreturn-pointer-on-d0
26248 When generating a function that returns a pointer, return the pointer
26249 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
26250 only in @code{a0}, and attempts to call such functions without a prototype
26251 result in errors. Note that this option is on by default; use
26252 @option{-mno-return-pointer-on-d0} to disable it.
26253
26254 @item -mno-crt0
26255 @opindex mno-crt0
26256 Do not link in the C run-time initialization object file.
26257
26258 @item -mrelax
26259 @opindex mrelax
26260 Indicate to the linker that it should perform a relaxation optimization pass
26261 to shorten branches, calls and absolute memory addresses. This option only
26262 has an effect when used on the command line for the final link step.
26263
26264 This option makes symbolic debugging impossible.
26265
26266 @item -mliw
26267 @opindex mliw
26268 Allow the compiler to generate @emph{Long Instruction Word}
26269 instructions if the target is the @samp{AM33} or later. This is the
26270 default. This option defines the preprocessor macro @code{__LIW__}.
26271
26272 @item -mno-liw
26273 @opindex mno-liw
26274 Do not allow the compiler to generate @emph{Long Instruction Word}
26275 instructions. This option defines the preprocessor macro
26276 @code{__NO_LIW__}.
26277
26278 @item -msetlb
26279 @opindex msetlb
26280 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
26281 instructions if the target is the @samp{AM33} or later. This is the
26282 default. This option defines the preprocessor macro @code{__SETLB__}.
26283
26284 @item -mno-setlb
26285 @opindex mno-setlb
26286 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
26287 instructions. This option defines the preprocessor macro
26288 @code{__NO_SETLB__}.
26289
26290 @end table
26291
26292 @node Moxie Options
26293 @subsection Moxie Options
26294 @cindex Moxie Options
26295
26296 @table @gcctabopt
26297
26298 @item -meb
26299 @opindex meb
26300 Generate big-endian code. This is the default for @samp{moxie-*-*}
26301 configurations.
26302
26303 @item -mel
26304 @opindex mel
26305 Generate little-endian code.
26306
26307 @item -mmul.x
26308 @opindex mmul.x
26309 Generate mul.x and umul.x instructions. This is the default for
26310 @samp{moxiebox-*-*} configurations.
26311
26312 @item -mno-crt0
26313 @opindex mno-crt0
26314 Do not link in the C run-time initialization object file.
26315
26316 @end table
26317
26318 @node MSP430 Options
26319 @subsection MSP430 Options
26320 @cindex MSP430 Options
26321
26322 These options are defined for the MSP430:
26323
26324 @table @gcctabopt
26325
26326 @item -masm-hex
26327 @opindex masm-hex
26328 Force assembly output to always use hex constants. Normally such
26329 constants are signed decimals, but this option is available for
26330 testsuite and/or aesthetic purposes.
26331
26332 @item -mmcu=
26333 @opindex mmcu=
26334 Select the MCU to target. This is used to create a C preprocessor
26335 symbol based upon the MCU name, converted to upper case and pre- and
26336 post-fixed with @samp{__}. This in turn is used by the
26337 @file{msp430.h} header file to select an MCU-specific supplementary
26338 header file.
26339
26340 The option also sets the ISA to use. If the MCU name is one that is
26341 known to only support the 430 ISA then that is selected, otherwise the
26342 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
26343 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
26344 name selects the 430X ISA.
26345
26346 In addition an MCU-specific linker script is added to the linker
26347 command line. The script's name is the name of the MCU with
26348 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
26349 command line defines the C preprocessor symbol @code{__XXX__} and
26350 cause the linker to search for a script called @file{xxx.ld}.
26351
26352 The ISA and hardware multiply supported for the different MCUs is hard-coded
26353 into GCC. However, an external @samp{devices.csv} file can be used to
26354 extend device support beyond those that have been hard-coded.
26355
26356 GCC searches for the @samp{devices.csv} file using the following methods in the
26357 given precedence order, where the first method takes precendence over the
26358 second which takes precedence over the third.
26359
26360 @table @asis
26361 @item Include path specified with @code{-I} and @code{-L}
26362 @samp{devices.csv} will be searched for in each of the directories specified by
26363 include paths and linker library search paths.
26364 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
26365 Define the value of the global environment variable
26366 @samp{MSP430_GCC_INCLUDE_DIR}
26367 to the full path to the directory containing devices.csv, and GCC will search
26368 this directory for devices.csv. If devices.csv is found, this directory will
26369 also be registered as an include path, and linker library path. Header files
26370 and linker scripts in this directory can therefore be used without manually
26371 specifying @code{-I} and @code{-L} on the command line.
26372 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
26373 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
26374 toolchain root directory. This directory does not exist in a default
26375 installation, but if the user has created it and copied @samp{devices.csv}
26376 there, then the MCU data will be read. As above, this directory will
26377 also be registered as an include path, and linker library path.
26378
26379 @end table
26380 If none of the above search methods find @samp{devices.csv}, then the
26381 hard-coded MCU data is used.
26382
26383
26384 @item -mwarn-mcu
26385 @itemx -mno-warn-mcu
26386 @opindex mwarn-mcu
26387 @opindex mno-warn-mcu
26388 This option enables or disables warnings about conflicts between the
26389 MCU name specified by the @option{-mmcu} option and the ISA set by the
26390 @option{-mcpu} option and/or the hardware multiply support set by the
26391 @option{-mhwmult} option. It also toggles warnings about unrecognized
26392 MCU names. This option is on by default.
26393
26394 @item -mcpu=
26395 @opindex mcpu=
26396 Specifies the ISA to use. Accepted values are @samp{msp430},
26397 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
26398 @option{-mmcu=} option should be used to select the ISA.
26399
26400 @item -msim
26401 @opindex msim
26402 Link to the simulator runtime libraries and linker script. Overrides
26403 any scripts that would be selected by the @option{-mmcu=} option.
26404
26405 @item -mlarge
26406 @opindex mlarge
26407 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
26408
26409 @item -msmall
26410 @opindex msmall
26411 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
26412
26413 @item -mrelax
26414 @opindex mrelax
26415 This option is passed to the assembler and linker, and allows the
26416 linker to perform certain optimizations that cannot be done until
26417 the final link.
26418
26419 @item mhwmult=
26420 @opindex mhwmult=
26421 Describes the type of hardware multiply supported by the target.
26422 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
26423 for the original 16-bit-only multiply supported by early MCUs.
26424 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
26425 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
26426 A value of @samp{auto} can also be given. This tells GCC to deduce
26427 the hardware multiply support based upon the MCU name provided by the
26428 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
26429 the MCU name is not recognized then no hardware multiply support is
26430 assumed. @code{auto} is the default setting.
26431
26432 Hardware multiplies are normally performed by calling a library
26433 routine. This saves space in the generated code. When compiling at
26434 @option{-O3} or higher however the hardware multiplier is invoked
26435 inline. This makes for bigger, but faster code.
26436
26437 The hardware multiply routines disable interrupts whilst running and
26438 restore the previous interrupt state when they finish. This makes
26439 them safe to use inside interrupt handlers as well as in normal code.
26440
26441 @item -minrt
26442 @opindex minrt
26443 Enable the use of a minimum runtime environment - no static
26444 initializers or constructors. This is intended for memory-constrained
26445 devices. The compiler includes special symbols in some objects
26446 that tell the linker and runtime which code fragments are required.
26447
26448 @item -mtiny-printf
26449 @opindex mtiny-printf
26450 Enable reduced code size @code{printf} and @code{puts} library functions.
26451 The @samp{tiny} implementations of these functions are not reentrant, so
26452 must be used with caution in multi-threaded applications.
26453
26454 Support for streams has been removed and the string to be printed will
26455 always be sent to stdout via the @code{write} syscall. The string is not
26456 buffered before it is sent to write.
26457
26458 This option requires Newlib Nano IO, so GCC must be configured with
26459 @samp{--enable-newlib-nano-formatted-io}.
26460
26461 @item -mmax-inline-shift=
26462 @opindex mmax-inline-shift=
26463 This option takes an integer between 0 and 64 inclusive, and sets
26464 the maximum number of inline shift instructions which should be emitted to
26465 perform a shift operation by a constant amount. When this value needs to be
26466 exceeded, an mspabi helper function is used instead. The default value is 4.
26467
26468 This only affects cases where a shift by multiple positions cannot be
26469 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
26470
26471 Shifts of a 32-bit value are at least twice as costly, so the value passed for
26472 this option is divided by 2 and the resulting value used instead.
26473
26474 @item -mcode-region=
26475 @itemx -mdata-region=
26476 @opindex mcode-region
26477 @opindex mdata-region
26478 These options tell the compiler where to place functions and data that
26479 do not have one of the @code{lower}, @code{upper}, @code{either} or
26480 @code{section} attributes. Possible values are @code{lower},
26481 @code{upper}, @code{either} or @code{any}. The first three behave
26482 like the corresponding attribute. The fourth possible value -
26483 @code{any} - is the default. It leaves placement entirely up to the
26484 linker script and how it assigns the standard sections
26485 (@code{.text}, @code{.data}, etc) to the memory regions.
26486
26487 @item -msilicon-errata=
26488 @opindex msilicon-errata
26489 This option passes on a request to assembler to enable the fixes for
26490 the named silicon errata.
26491
26492 @item -msilicon-errata-warn=
26493 @opindex msilicon-errata-warn
26494 This option passes on a request to the assembler to enable warning
26495 messages when a silicon errata might need to be applied.
26496
26497 @item -mwarn-devices-csv
26498 @itemx -mno-warn-devices-csv
26499 @opindex mwarn-devices-csv
26500 @opindex mno-warn-devices-csv
26501 Warn if @samp{devices.csv} is not found or there are problem parsing it
26502 (default: on).
26503
26504 @end table
26505
26506 @node NDS32 Options
26507 @subsection NDS32 Options
26508 @cindex NDS32 Options
26509
26510 These options are defined for NDS32 implementations:
26511
26512 @table @gcctabopt
26513
26514 @item -mbig-endian
26515 @opindex mbig-endian
26516 Generate code in big-endian mode.
26517
26518 @item -mlittle-endian
26519 @opindex mlittle-endian
26520 Generate code in little-endian mode.
26521
26522 @item -mreduced-regs
26523 @opindex mreduced-regs
26524 Use reduced-set registers for register allocation.
26525
26526 @item -mfull-regs
26527 @opindex mfull-regs
26528 Use full-set registers for register allocation.
26529
26530 @item -mcmov
26531 @opindex mcmov
26532 Generate conditional move instructions.
26533
26534 @item -mno-cmov
26535 @opindex mno-cmov
26536 Do not generate conditional move instructions.
26537
26538 @item -mext-perf
26539 @opindex mext-perf
26540 Generate performance extension instructions.
26541
26542 @item -mno-ext-perf
26543 @opindex mno-ext-perf
26544 Do not generate performance extension instructions.
26545
26546 @item -mext-perf2
26547 @opindex mext-perf2
26548 Generate performance extension 2 instructions.
26549
26550 @item -mno-ext-perf2
26551 @opindex mno-ext-perf2
26552 Do not generate performance extension 2 instructions.
26553
26554 @item -mext-string
26555 @opindex mext-string
26556 Generate string extension instructions.
26557
26558 @item -mno-ext-string
26559 @opindex mno-ext-string
26560 Do not generate string extension instructions.
26561
26562 @item -mv3push
26563 @opindex mv3push
26564 Generate v3 push25/pop25 instructions.
26565
26566 @item -mno-v3push
26567 @opindex mno-v3push
26568 Do not generate v3 push25/pop25 instructions.
26569
26570 @item -m16-bit
26571 @opindex m16-bit
26572 Generate 16-bit instructions.
26573
26574 @item -mno-16-bit
26575 @opindex mno-16-bit
26576 Do not generate 16-bit instructions.
26577
26578 @item -misr-vector-size=@var{num}
26579 @opindex misr-vector-size
26580 Specify the size of each interrupt vector, which must be 4 or 16.
26581
26582 @item -mcache-block-size=@var{num}
26583 @opindex mcache-block-size
26584 Specify the size of each cache block,
26585 which must be a power of 2 between 4 and 512.
26586
26587 @item -march=@var{arch}
26588 @opindex march
26589 Specify the name of the target architecture.
26590
26591 @item -mcmodel=@var{code-model}
26592 @opindex mcmodel
26593 Set the code model to one of
26594 @table @asis
26595 @item @samp{small}
26596 All the data and read-only data segments must be within 512KB addressing space.
26597 The text segment must be within 16MB addressing space.
26598 @item @samp{medium}
26599 The data segment must be within 512KB while the read-only data segment can be
26600 within 4GB addressing space. The text segment should be still within 16MB
26601 addressing space.
26602 @item @samp{large}
26603 All the text and data segments can be within 4GB addressing space.
26604 @end table
26605
26606 @item -mctor-dtor
26607 @opindex mctor-dtor
26608 Enable constructor/destructor feature.
26609
26610 @item -mrelax
26611 @opindex mrelax
26612 Guide linker to relax instructions.
26613
26614 @end table
26615
26616 @node Nios II Options
26617 @subsection Nios II Options
26618 @cindex Nios II options
26619 @cindex Altera Nios II options
26620
26621 These are the options defined for the Altera Nios II processor.
26622
26623 @table @gcctabopt
26624
26625 @item -G @var{num}
26626 @opindex G
26627 @cindex smaller data references
26628 Put global and static objects less than or equal to @var{num} bytes
26629 into the small data or BSS sections instead of the normal data or BSS
26630 sections. The default value of @var{num} is 8.
26631
26632 @item -mgpopt=@var{option}
26633 @itemx -mgpopt
26634 @itemx -mno-gpopt
26635 @opindex mgpopt
26636 @opindex mno-gpopt
26637 Generate (do not generate) GP-relative accesses. The following
26638 @var{option} names are recognized:
26639
26640 @table @samp
26641
26642 @item none
26643 Do not generate GP-relative accesses.
26644
26645 @item local
26646 Generate GP-relative accesses for small data objects that are not
26647 external, weak, or uninitialized common symbols.
26648 Also use GP-relative addressing for objects that
26649 have been explicitly placed in a small data section via a @code{section}
26650 attribute.
26651
26652 @item global
26653 As for @samp{local}, but also generate GP-relative accesses for
26654 small data objects that are external, weak, or common. If you use this option,
26655 you must ensure that all parts of your program (including libraries) are
26656 compiled with the same @option{-G} setting.
26657
26658 @item data
26659 Generate GP-relative accesses for all data objects in the program. If you
26660 use this option, the entire data and BSS segments
26661 of your program must fit in 64K of memory and you must use an appropriate
26662 linker script to allocate them within the addressable range of the
26663 global pointer.
26664
26665 @item all
26666 Generate GP-relative addresses for function pointers as well as data
26667 pointers. If you use this option, the entire text, data, and BSS segments
26668 of your program must fit in 64K of memory and you must use an appropriate
26669 linker script to allocate them within the addressable range of the
26670 global pointer.
26671
26672 @end table
26673
26674 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
26675 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
26676
26677 The default is @option{-mgpopt} except when @option{-fpic} or
26678 @option{-fPIC} is specified to generate position-independent code.
26679 Note that the Nios II ABI does not permit GP-relative accesses from
26680 shared libraries.
26681
26682 You may need to specify @option{-mno-gpopt} explicitly when building
26683 programs that include large amounts of small data, including large
26684 GOT data sections. In this case, the 16-bit offset for GP-relative
26685 addressing may not be large enough to allow access to the entire
26686 small data section.
26687
26688 @item -mgprel-sec=@var{regexp}
26689 @opindex mgprel-sec
26690 This option specifies additional section names that can be accessed via
26691 GP-relative addressing. It is most useful in conjunction with
26692 @code{section} attributes on variable declarations
26693 (@pxref{Common Variable Attributes}) and a custom linker script.
26694 The @var{regexp} is a POSIX Extended Regular Expression.
26695
26696 This option does not affect the behavior of the @option{-G} option, and
26697 the specified sections are in addition to the standard @code{.sdata}
26698 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
26699
26700 @item -mr0rel-sec=@var{regexp}
26701 @opindex mr0rel-sec
26702 This option specifies names of sections that can be accessed via a
26703 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
26704 of the 32-bit address space. It is most useful in conjunction with
26705 @code{section} attributes on variable declarations
26706 (@pxref{Common Variable Attributes}) and a custom linker script.
26707 The @var{regexp} is a POSIX Extended Regular Expression.
26708
26709 In contrast to the use of GP-relative addressing for small data,
26710 zero-based addressing is never generated by default and there are no
26711 conventional section names used in standard linker scripts for sections
26712 in the low or high areas of memory.
26713
26714 @item -mel
26715 @itemx -meb
26716 @opindex mel
26717 @opindex meb
26718 Generate little-endian (default) or big-endian (experimental) code,
26719 respectively.
26720
26721 @item -march=@var{arch}
26722 @opindex march
26723 This specifies the name of the target Nios II architecture. GCC uses this
26724 name to determine what kind of instructions it can emit when generating
26725 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
26726
26727 The preprocessor macro @code{__nios2_arch__} is available to programs,
26728 with value 1 or 2, indicating the targeted ISA level.
26729
26730 @item -mbypass-cache
26731 @itemx -mno-bypass-cache
26732 @opindex mno-bypass-cache
26733 @opindex mbypass-cache
26734 Force all load and store instructions to always bypass cache by
26735 using I/O variants of the instructions. The default is not to
26736 bypass the cache.
26737
26738 @item -mno-cache-volatile
26739 @itemx -mcache-volatile
26740 @opindex mcache-volatile
26741 @opindex mno-cache-volatile
26742 Volatile memory access bypass the cache using the I/O variants of
26743 the load and store instructions. The default is not to bypass the cache.
26744
26745 @item -mno-fast-sw-div
26746 @itemx -mfast-sw-div
26747 @opindex mno-fast-sw-div
26748 @opindex mfast-sw-div
26749 Do not use table-based fast divide for small numbers. The default
26750 is to use the fast divide at @option{-O3} and above.
26751
26752 @item -mno-hw-mul
26753 @itemx -mhw-mul
26754 @itemx -mno-hw-mulx
26755 @itemx -mhw-mulx
26756 @itemx -mno-hw-div
26757 @itemx -mhw-div
26758 @opindex mno-hw-mul
26759 @opindex mhw-mul
26760 @opindex mno-hw-mulx
26761 @opindex mhw-mulx
26762 @opindex mno-hw-div
26763 @opindex mhw-div
26764 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
26765 instructions by the compiler. The default is to emit @code{mul}
26766 and not emit @code{div} and @code{mulx}.
26767
26768 @item -mbmx
26769 @itemx -mno-bmx
26770 @itemx -mcdx
26771 @itemx -mno-cdx
26772 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
26773 CDX (code density) instructions. Enabling these instructions also
26774 requires @option{-march=r2}. Since these instructions are optional
26775 extensions to the R2 architecture, the default is not to emit them.
26776
26777 @item -mcustom-@var{insn}=@var{N}
26778 @itemx -mno-custom-@var{insn}
26779 @opindex mcustom-@var{insn}
26780 @opindex mno-custom-@var{insn}
26781 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
26782 custom instruction with encoding @var{N} when generating code that uses
26783 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
26784 instruction 253 for single-precision floating-point add operations instead
26785 of the default behavior of using a library call.
26786
26787 The following values of @var{insn} are supported. Except as otherwise
26788 noted, floating-point operations are expected to be implemented with
26789 normal IEEE 754 semantics and correspond directly to the C operators or the
26790 equivalent GCC built-in functions (@pxref{Other Builtins}).
26791
26792 Single-precision floating point:
26793 @table @asis
26794
26795 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
26796 Binary arithmetic operations.
26797
26798 @item @samp{fnegs}
26799 Unary negation.
26800
26801 @item @samp{fabss}
26802 Unary absolute value.
26803
26804 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
26805 Comparison operations.
26806
26807 @item @samp{fmins}, @samp{fmaxs}
26808 Floating-point minimum and maximum. These instructions are only
26809 generated if @option{-ffinite-math-only} is specified.
26810
26811 @item @samp{fsqrts}
26812 Unary square root operation.
26813
26814 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
26815 Floating-point trigonometric and exponential functions. These instructions
26816 are only generated if @option{-funsafe-math-optimizations} is also specified.
26817
26818 @end table
26819
26820 Double-precision floating point:
26821 @table @asis
26822
26823 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
26824 Binary arithmetic operations.
26825
26826 @item @samp{fnegd}
26827 Unary negation.
26828
26829 @item @samp{fabsd}
26830 Unary absolute value.
26831
26832 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
26833 Comparison operations.
26834
26835 @item @samp{fmind}, @samp{fmaxd}
26836 Double-precision minimum and maximum. These instructions are only
26837 generated if @option{-ffinite-math-only} is specified.
26838
26839 @item @samp{fsqrtd}
26840 Unary square root operation.
26841
26842 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
26843 Double-precision trigonometric and exponential functions. These instructions
26844 are only generated if @option{-funsafe-math-optimizations} is also specified.
26845
26846 @end table
26847
26848 Conversions:
26849 @table @asis
26850 @item @samp{fextsd}
26851 Conversion from single precision to double precision.
26852
26853 @item @samp{ftruncds}
26854 Conversion from double precision to single precision.
26855
26856 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
26857 Conversion from floating point to signed or unsigned integer types, with
26858 truncation towards zero.
26859
26860 @item @samp{round}
26861 Conversion from single-precision floating point to signed integer,
26862 rounding to the nearest integer and ties away from zero.
26863 This corresponds to the @code{__builtin_lroundf} function when
26864 @option{-fno-math-errno} is used.
26865
26866 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
26867 Conversion from signed or unsigned integer types to floating-point types.
26868
26869 @end table
26870
26871 In addition, all of the following transfer instructions for internal
26872 registers X and Y must be provided to use any of the double-precision
26873 floating-point instructions. Custom instructions taking two
26874 double-precision source operands expect the first operand in the
26875 64-bit register X. The other operand (or only operand of a unary
26876 operation) is given to the custom arithmetic instruction with the
26877 least significant half in source register @var{src1} and the most
26878 significant half in @var{src2}. A custom instruction that returns a
26879 double-precision result returns the most significant 32 bits in the
26880 destination register and the other half in 32-bit register Y.
26881 GCC automatically generates the necessary code sequences to write
26882 register X and/or read register Y when double-precision floating-point
26883 instructions are used.
26884
26885 @table @asis
26886
26887 @item @samp{fwrx}
26888 Write @var{src1} into the least significant half of X and @var{src2} into
26889 the most significant half of X.
26890
26891 @item @samp{fwry}
26892 Write @var{src1} into Y.
26893
26894 @item @samp{frdxhi}, @samp{frdxlo}
26895 Read the most or least (respectively) significant half of X and store it in
26896 @var{dest}.
26897
26898 @item @samp{frdy}
26899 Read the value of Y and store it into @var{dest}.
26900 @end table
26901
26902 Note that you can gain more local control over generation of Nios II custom
26903 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
26904 and @code{target("no-custom-@var{insn}")} function attributes
26905 (@pxref{Function Attributes})
26906 or pragmas (@pxref{Function Specific Option Pragmas}).
26907
26908 @item -mcustom-fpu-cfg=@var{name}
26909 @opindex mcustom-fpu-cfg
26910
26911 This option enables a predefined, named set of custom instruction encodings
26912 (see @option{-mcustom-@var{insn}} above).
26913 Currently, the following sets are defined:
26914
26915 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
26916 @gccoptlist{-mcustom-fmuls=252 @gol
26917 -mcustom-fadds=253 @gol
26918 -mcustom-fsubs=254 @gol
26919 -fsingle-precision-constant}
26920
26921 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
26922 @gccoptlist{-mcustom-fmuls=252 @gol
26923 -mcustom-fadds=253 @gol
26924 -mcustom-fsubs=254 @gol
26925 -mcustom-fdivs=255 @gol
26926 -fsingle-precision-constant}
26927
26928 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
26929 @gccoptlist{-mcustom-floatus=243 @gol
26930 -mcustom-fixsi=244 @gol
26931 -mcustom-floatis=245 @gol
26932 -mcustom-fcmpgts=246 @gol
26933 -mcustom-fcmples=249 @gol
26934 -mcustom-fcmpeqs=250 @gol
26935 -mcustom-fcmpnes=251 @gol
26936 -mcustom-fmuls=252 @gol
26937 -mcustom-fadds=253 @gol
26938 -mcustom-fsubs=254 @gol
26939 -mcustom-fdivs=255 @gol
26940 -fsingle-precision-constant}
26941
26942 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
26943 @gccoptlist{-mcustom-fabss=224 @gol
26944 -mcustom-fnegs=225 @gol
26945 -mcustom-fcmpnes=226 @gol
26946 -mcustom-fcmpeqs=227 @gol
26947 -mcustom-fcmpges=228 @gol
26948 -mcustom-fcmpgts=229 @gol
26949 -mcustom-fcmples=230 @gol
26950 -mcustom-fcmplts=231 @gol
26951 -mcustom-fmaxs=232 @gol
26952 -mcustom-fmins=233 @gol
26953 -mcustom-round=248 @gol
26954 -mcustom-fixsi=249 @gol
26955 -mcustom-floatis=250 @gol
26956 -mcustom-fsqrts=251 @gol
26957 -mcustom-fmuls=252 @gol
26958 -mcustom-fadds=253 @gol
26959 -mcustom-fsubs=254 @gol
26960 -mcustom-fdivs=255 @gol}
26961
26962 Custom instruction assignments given by individual
26963 @option{-mcustom-@var{insn}=} options override those given by
26964 @option{-mcustom-fpu-cfg=}, regardless of the
26965 order of the options on the command line.
26966
26967 Note that you can gain more local control over selection of a FPU
26968 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
26969 function attribute (@pxref{Function Attributes})
26970 or pragma (@pxref{Function Specific Option Pragmas}).
26971
26972 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
26973 Hardware 2 Component}. Please note that the custom instructions enabled by
26974 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
26975 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
26976 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
26977 specified. In contrast to the other configurations,
26978 @option{-fsingle-precision-constant} is not set.
26979
26980 @end table
26981
26982 These additional @samp{-m} options are available for the Altera Nios II
26983 ELF (bare-metal) target:
26984
26985 @table @gcctabopt
26986
26987 @item -mhal
26988 @opindex mhal
26989 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
26990 startup and termination code, and is typically used in conjunction with
26991 @option{-msys-crt0=} to specify the location of the alternate startup code
26992 provided by the HAL BSP.
26993
26994 @item -msmallc
26995 @opindex msmallc
26996 Link with a limited version of the C library, @option{-lsmallc}, rather than
26997 Newlib.
26998
26999 @item -msys-crt0=@var{startfile}
27000 @opindex msys-crt0
27001 @var{startfile} is the file name of the startfile (crt0) to use
27002 when linking. This option is only useful in conjunction with @option{-mhal}.
27003
27004 @item -msys-lib=@var{systemlib}
27005 @opindex msys-lib
27006 @var{systemlib} is the library name of the library that provides
27007 low-level system calls required by the C library,
27008 e.g.@: @code{read} and @code{write}.
27009 This option is typically used to link with a library provided by a HAL BSP.
27010
27011 @end table
27012
27013 @node Nvidia PTX Options
27014 @subsection Nvidia PTX Options
27015 @cindex Nvidia PTX options
27016 @cindex nvptx options
27017
27018 These options are defined for Nvidia PTX:
27019
27020 @table @gcctabopt
27021
27022 @item -m64
27023 @opindex m64
27024 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
27025 supported.
27026
27027 @item -misa=@var{ISA-string}
27028 @opindex march
27029 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
27030 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
27031 @samp{sm_35}. The default ISA is sm_35.
27032
27033 @item -mptx=@var{version-string}
27034 @opindex mptx
27035 Generate code for given the specified PTX version (e.g.@: @samp{6.3}).
27036 Valid version strings include @samp{3.1} and @samp{6.3}. The default PTX
27037 version is 3.1.
27038
27039 @item -mmainkernel
27040 @opindex mmainkernel
27041 Link in code for a __main kernel. This is for stand-alone instead of
27042 offloading execution.
27043
27044 @item -moptimize
27045 @opindex moptimize
27046 Apply partitioned execution optimizations. This is the default when any
27047 level of optimization is selected.
27048
27049 @item -msoft-stack
27050 @opindex msoft-stack
27051 Generate code that does not use @code{.local} memory
27052 directly for stack storage. Instead, a per-warp stack pointer is
27053 maintained explicitly. This enables variable-length stack allocation (with
27054 variable-length arrays or @code{alloca}), and when global memory is used for
27055 underlying storage, makes it possible to access automatic variables from other
27056 threads, or with atomic instructions. This code generation variant is used
27057 for OpenMP offloading, but the option is exposed on its own for the purpose
27058 of testing the compiler; to generate code suitable for linking into programs
27059 using OpenMP offloading, use option @option{-mgomp}.
27060
27061 @item -muniform-simt
27062 @opindex muniform-simt
27063 Switch to code generation variant that allows to execute all threads in each
27064 warp, while maintaining memory state and side effects as if only one thread
27065 in each warp was active outside of OpenMP SIMD regions. All atomic operations
27066 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
27067 current lane index equals the master lane index), and the register being
27068 assigned is copied via a shuffle instruction from the master lane. Outside of
27069 SIMD regions lane 0 is the master; inside, each thread sees itself as the
27070 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
27071 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
27072 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
27073 with current lane index to compute the master lane index.
27074
27075 @item -mgomp
27076 @opindex mgomp
27077 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
27078 @option{-muniform-simt} options, and selects corresponding multilib variant.
27079
27080 @end table
27081
27082 @node OpenRISC Options
27083 @subsection OpenRISC Options
27084 @cindex OpenRISC Options
27085
27086 These options are defined for OpenRISC:
27087
27088 @table @gcctabopt
27089
27090 @item -mboard=@var{name}
27091 @opindex mboard
27092 Configure a board specific runtime. This will be passed to the linker for
27093 newlib board library linking. The default is @code{or1ksim}.
27094
27095 @item -mnewlib
27096 @opindex mnewlib
27097 This option is ignored; it is for compatibility purposes only. This used to
27098 select linker and preprocessor options for use with newlib.
27099
27100 @item -msoft-div
27101 @itemx -mhard-div
27102 @opindex msoft-div
27103 @opindex mhard-div
27104 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
27105 This default is hardware divide.
27106
27107 @item -msoft-mul
27108 @itemx -mhard-mul
27109 @opindex msoft-mul
27110 @opindex mhard-mul
27111 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
27112 This default is hardware multiply.
27113
27114 @item -msoft-float
27115 @itemx -mhard-float
27116 @opindex msoft-float
27117 @opindex mhard-float
27118 Select software or hardware for floating point operations.
27119 The default is software.
27120
27121 @item -mdouble-float
27122 @opindex mdouble-float
27123 When @option{-mhard-float} is selected, enables generation of double-precision
27124 floating point instructions. By default functions from @file{libgcc} are used
27125 to perform double-precision floating point operations.
27126
27127 @item -munordered-float
27128 @opindex munordered-float
27129 When @option{-mhard-float} is selected, enables generation of unordered
27130 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
27131 functions from @file{libgcc} are used to perform unordered floating point
27132 compare and set flag operations.
27133
27134 @item -mcmov
27135 @opindex mcmov
27136 Enable generation of conditional move (@code{l.cmov}) instructions. By
27137 default the equivalent will be generated using set and branch.
27138
27139 @item -mror
27140 @opindex mror
27141 Enable generation of rotate right (@code{l.ror}) instructions. By default
27142 functions from @file{libgcc} are used to perform rotate right operations.
27143
27144 @item -mrori
27145 @opindex mrori
27146 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
27147 By default functions from @file{libgcc} are used to perform rotate right with
27148 immediate operations.
27149
27150 @item -msext
27151 @opindex msext
27152 Enable generation of sign extension (@code{l.ext*}) instructions. By default
27153 memory loads are used to perform sign extension.
27154
27155 @item -msfimm
27156 @opindex msfimm
27157 Enable generation of compare and set flag with immediate (@code{l.sf*i})
27158 instructions. By default extra instructions will be generated to store the
27159 immediate to a register first.
27160
27161 @item -mshftimm
27162 @opindex mshftimm
27163 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
27164 @code{l.slli}) instructions. By default extra instructions will be generated
27165 to store the immediate to a register first.
27166
27167 @item -mcmodel=small
27168 @opindex mcmodel=small
27169 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
27170 the default model.
27171
27172 @item -mcmodel=large
27173 @opindex mcmodel=large
27174 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
27175
27176
27177 @end table
27178
27179 @node PDP-11 Options
27180 @subsection PDP-11 Options
27181 @cindex PDP-11 Options
27182
27183 These options are defined for the PDP-11:
27184
27185 @table @gcctabopt
27186 @item -mfpu
27187 @opindex mfpu
27188 Use hardware FPP floating point. This is the default. (FIS floating
27189 point on the PDP-11/40 is not supported.) Implies -m45.
27190
27191 @item -msoft-float
27192 @opindex msoft-float
27193 Do not use hardware floating point.
27194
27195 @item -mac0
27196 @opindex mac0
27197 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
27198
27199 @item -mno-ac0
27200 @opindex mno-ac0
27201 Return floating-point results in memory. This is the default.
27202
27203 @item -m40
27204 @opindex m40
27205 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
27206
27207 @item -m45
27208 @opindex m45
27209 Generate code for a PDP-11/45. This is the default.
27210
27211 @item -m10
27212 @opindex m10
27213 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
27214
27215 @item -mint16
27216 @itemx -mno-int32
27217 @opindex mint16
27218 @opindex mno-int32
27219 Use 16-bit @code{int}. This is the default.
27220
27221 @item -mint32
27222 @itemx -mno-int16
27223 @opindex mint32
27224 @opindex mno-int16
27225 Use 32-bit @code{int}.
27226
27227 @item -msplit
27228 @opindex msplit
27229 Target has split instruction and data space. Implies -m45.
27230
27231 @item -munix-asm
27232 @opindex munix-asm
27233 Use Unix assembler syntax.
27234
27235 @item -mdec-asm
27236 @opindex mdec-asm
27237 Use DEC assembler syntax.
27238
27239 @item -mgnu-asm
27240 @opindex mgnu-asm
27241 Use GNU assembler syntax. This is the default.
27242
27243 @item -mlra
27244 @opindex mlra
27245 Use the new LRA register allocator. By default, the old ``reload''
27246 allocator is used.
27247 @end table
27248
27249 @node picoChip Options
27250 @subsection picoChip Options
27251 @cindex picoChip options
27252
27253 These @samp{-m} options are defined for picoChip implementations:
27254
27255 @table @gcctabopt
27256
27257 @item -mae=@var{ae_type}
27258 @opindex mcpu
27259 Set the instruction set, register set, and instruction scheduling
27260 parameters for array element type @var{ae_type}. Supported values
27261 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
27262
27263 @option{-mae=ANY} selects a completely generic AE type. Code
27264 generated with this option runs on any of the other AE types. The
27265 code is not as efficient as it would be if compiled for a specific
27266 AE type, and some types of operation (e.g., multiplication) do not
27267 work properly on all types of AE.
27268
27269 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
27270 for compiled code, and is the default.
27271
27272 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
27273 option may suffer from poor performance of byte (char) manipulation,
27274 since the DSP AE does not provide hardware support for byte load/stores.
27275
27276 @item -msymbol-as-address
27277 Enable the compiler to directly use a symbol name as an address in a
27278 load/store instruction, without first loading it into a
27279 register. Typically, the use of this option generates larger
27280 programs, which run faster than when the option isn't used. However, the
27281 results vary from program to program, so it is left as a user option,
27282 rather than being permanently enabled.
27283
27284 @item -mno-inefficient-warnings
27285 Disables warnings about the generation of inefficient code. These
27286 warnings can be generated, for example, when compiling code that
27287 performs byte-level memory operations on the MAC AE type. The MAC AE has
27288 no hardware support for byte-level memory operations, so all byte
27289 load/stores must be synthesized from word load/store operations. This is
27290 inefficient and a warning is generated to indicate
27291 that you should rewrite the code to avoid byte operations, or to target
27292 an AE type that has the necessary hardware support. This option disables
27293 these warnings.
27294
27295 @end table
27296
27297 @node PowerPC Options
27298 @subsection PowerPC Options
27299 @cindex PowerPC options
27300
27301 These are listed under @xref{RS/6000 and PowerPC Options}.
27302
27303 @node PRU Options
27304 @subsection PRU Options
27305 @cindex PRU Options
27306
27307 These command-line options are defined for PRU target:
27308
27309 @table @gcctabopt
27310 @item -minrt
27311 @opindex minrt
27312 Link with a minimum runtime environment, with no support for static
27313 initializers and constructors. Using this option can significantly reduce
27314 the size of the final ELF binary. Beware that the compiler could still
27315 generate code with static initializers and constructors. It is up to the
27316 programmer to ensure that the source program will not use those features.
27317
27318 @item -mmcu=@var{mcu}
27319 @opindex mmcu
27320 Specify the PRU MCU variant to use. Check Newlib for the exact list of
27321 supported MCUs.
27322
27323 @item -mno-relax
27324 @opindex mno-relax
27325 Make GCC pass the @option{--no-relax} command-line option to the linker
27326 instead of the @option{--relax} option.
27327
27328 @item -mloop
27329 @opindex mloop
27330 Allow (or do not allow) GCC to use the LOOP instruction.
27331
27332 @item -mabi=@var{variant}
27333 @opindex mabi
27334 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
27335 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
27336 more naturally with certain GCC assumptions. These are the differences:
27337
27338 @table @samp
27339 @item Function Pointer Size
27340 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
27341 supports only 32-bit data and code pointers.
27342
27343 @item Optional Return Value Pointer
27344 Function return values larger than 64 bits are passed by using a hidden
27345 pointer as the first argument of the function. TI ABI, though, mandates that
27346 the pointer can be NULL in case the caller is not using the returned value.
27347 GNU always passes and expects a valid return value pointer.
27348
27349 @end table
27350
27351 The current @option{-mabi=ti} implementation simply raises a compile error
27352 when any of the above code constructs is detected. As a consequence
27353 the standard C library cannot be built and it is omitted when linking with
27354 @option{-mabi=ti}.
27355
27356 Relaxation is a GNU feature and for safety reasons is disabled when using
27357 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
27358 instructions, so the GNU linker cannot adjust them when shortening adjacent
27359 LDI32 pseudo instructions.
27360
27361 @end table
27362
27363 @node RISC-V Options
27364 @subsection RISC-V Options
27365 @cindex RISC-V Options
27366
27367 These command-line options are defined for RISC-V targets:
27368
27369 @table @gcctabopt
27370 @item -mbranch-cost=@var{n}
27371 @opindex mbranch-cost
27372 Set the cost of branches to roughly @var{n} instructions.
27373
27374 @item -mplt
27375 @itemx -mno-plt
27376 @opindex plt
27377 When generating PIC code, do or don't allow the use of PLTs. Ignored for
27378 non-PIC. The default is @option{-mplt}.
27379
27380 @item -mabi=@var{ABI-string}
27381 @opindex mabi
27382 Specify integer and floating-point calling convention. @var{ABI-string}
27383 contains two parts: the size of integer types and the registers used for
27384 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
27385 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
27386 32-bit), and that floating-point values up to 64 bits wide are passed in F
27387 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
27388 allows the compiler to generate code that uses the F and D extensions but only
27389 allows floating-point values up to 32 bits long to be passed in registers; or
27390 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
27391 passed in registers.
27392
27393 The default for this argument is system dependent, users who want a specific
27394 calling convention should specify one explicitly. The valid calling
27395 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
27396 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
27397 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
27398 invalid because the ABI requires 64-bit values be passed in F registers, but F
27399 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
27400 only be used with the @samp{rv32e} architecture. This ABI is not well
27401 specified at present, and is subject to change.
27402
27403 @item -mfdiv
27404 @itemx -mno-fdiv
27405 @opindex mfdiv
27406 Do or don't use hardware floating-point divide and square root instructions.
27407 This requires the F or D extensions for floating-point registers. The default
27408 is to use them if the specified architecture has these instructions.
27409
27410 @item -mdiv
27411 @itemx -mno-div
27412 @opindex mdiv
27413 Do or don't use hardware instructions for integer division. This requires the
27414 M extension. The default is to use them if the specified architecture has
27415 these instructions.
27416
27417 @item -march=@var{ISA-string}
27418 @opindex march
27419 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
27420 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
27421 @samp{rv32imaf}.
27422
27423 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
27424
27425 If both @option{-march} and @option{-mcpu=} are not specified, the default for
27426 this argument is system dependent, users who want a specific architecture
27427 extensions should specify one explicitly.
27428
27429 @item -mcpu=@var{processor-string}
27430 @opindex mcpu
27431 Use architecture of and optimize the output for the given processor, specified
27432 by particular CPU name.
27433 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
27434 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
27435 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
27436 @samp{sifive-u54}, and @samp{sifive-u74}.
27437
27438 @item -mtune=@var{processor-string}
27439 @opindex mtune
27440 Optimize the output for the given processor, specified by microarchitecture or
27441 particular CPU name. Permissible values for this option are: @samp{rocket},
27442 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
27443 @samp{size}, and all valid options for @option{-mcpu=}.
27444
27445 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
27446 the default is @samp{rocket} if both are not specified.
27447
27448 The @samp{size} choice is not intended for use by end-users. This is used
27449 when @option{-Os} is specified. It overrides the instruction cost info
27450 provided by @option{-mtune=}, but does not override the pipeline info. This
27451 helps reduce code size while still giving good performance.
27452
27453 @item -mpreferred-stack-boundary=@var{num}
27454 @opindex mpreferred-stack-boundary
27455 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27456 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27457 the default is 4 (16 bytes or 128-bits).
27458
27459 @strong{Warning:} If you use this switch, then you must build all modules with
27460 the same value, including any libraries. This includes the system libraries
27461 and startup modules.
27462
27463 @item -msmall-data-limit=@var{n}
27464 @opindex msmall-data-limit
27465 Put global and static data smaller than @var{n} bytes into a special section
27466 (on some targets).
27467
27468 @item -msave-restore
27469 @itemx -mno-save-restore
27470 @opindex msave-restore
27471 Do or don't use smaller but slower prologue and epilogue code that uses
27472 library function calls. The default is to use fast inline prologues and
27473 epilogues.
27474
27475 @item -mshorten-memrefs
27476 @itemx -mno-shorten-memrefs
27477 @opindex mshorten-memrefs
27478 Do or do not attempt to make more use of compressed load/store instructions by
27479 replacing a load/store of 'base register + large offset' with a new load/store
27480 of 'new base + small offset'. If the new base gets stored in a compressed
27481 register, then the new load/store can be compressed. Currently targets 32-bit
27482 integer load/stores only.
27483
27484 @item -mstrict-align
27485 @itemx -mno-strict-align
27486 @opindex mstrict-align
27487 Do not or do generate unaligned memory accesses. The default is set depending
27488 on whether the processor we are optimizing for supports fast unaligned access
27489 or not.
27490
27491 @item -mcmodel=medlow
27492 @opindex mcmodel=medlow
27493 Generate code for the medium-low code model. The program and its statically
27494 defined symbols must lie within a single 2 GiB address range and must lie
27495 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
27496 statically or dynamically linked. This is the default code model.
27497
27498 @item -mcmodel=medany
27499 @opindex mcmodel=medany
27500 Generate code for the medium-any code model. The program and its statically
27501 defined symbols must be within any single 2 GiB address range. Programs can be
27502 statically or dynamically linked.
27503
27504 @item -mexplicit-relocs
27505 @itemx -mno-exlicit-relocs
27506 Use or do not use assembler relocation operators when dealing with symbolic
27507 addresses. The alternative is to use assembler macros instead, which may
27508 limit optimization.
27509
27510 @item -mrelax
27511 @itemx -mno-relax
27512 Take advantage of linker relaxations to reduce the number of instructions
27513 required to materialize symbol addresses. The default is to take advantage of
27514 linker relaxations.
27515
27516 @item -memit-attribute
27517 @itemx -mno-emit-attribute
27518 Emit (do not emit) RISC-V attribute to record extra information into ELF
27519 objects. This feature requires at least binutils 2.32.
27520
27521 @item -malign-data=@var{type}
27522 @opindex malign-data
27523 Control how GCC aligns variables and constants of array, structure, or union
27524 types. Supported values for @var{type} are @samp{xlen} which uses x register
27525 width as the alignment value, and @samp{natural} which uses natural alignment.
27526 @samp{xlen} is the default.
27527
27528 @item -mbig-endian
27529 @opindex mbig-endian
27530 Generate big-endian code. This is the default when GCC is configured for a
27531 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
27532
27533 @item -mlittle-endian
27534 @opindex mlittle-endian
27535 Generate little-endian code. This is the default when GCC is configured for a
27536 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
27537 @samp{riscv32be-*-*} target.
27538
27539 @item -mstack-protector-guard=@var{guard}
27540 @itemx -mstack-protector-guard-reg=@var{reg}
27541 @itemx -mstack-protector-guard-offset=@var{offset}
27542 @opindex mstack-protector-guard
27543 @opindex mstack-protector-guard-reg
27544 @opindex mstack-protector-guard-offset
27545 Generate stack protection code using canary at @var{guard}. Supported
27546 locations are @samp{global} for a global canary or @samp{tls} for per-thread
27547 canary in the TLS block.
27548
27549 With the latter choice the options
27550 @option{-mstack-protector-guard-reg=@var{reg}} and
27551 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27552 which register to use as base register for reading the canary,
27553 and from what offset from that base register. There is no default
27554 register or offset as this is entirely for use within the Linux
27555 kernel.
27556 @end table
27557
27558 @node RL78 Options
27559 @subsection RL78 Options
27560 @cindex RL78 Options
27561
27562 @table @gcctabopt
27563
27564 @item -msim
27565 @opindex msim
27566 Links in additional target libraries to support operation within a
27567 simulator.
27568
27569 @item -mmul=none
27570 @itemx -mmul=g10
27571 @itemx -mmul=g13
27572 @itemx -mmul=g14
27573 @itemx -mmul=rl78
27574 @opindex mmul
27575 Specifies the type of hardware multiplication and division support to
27576 be used. The simplest is @code{none}, which uses software for both
27577 multiplication and division. This is the default. The @code{g13}
27578 value is for the hardware multiply/divide peripheral found on the
27579 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
27580 the multiplication and division instructions supported by the RL78/G14
27581 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
27582 the value @code{mg10} is an alias for @code{none}.
27583
27584 In addition a C preprocessor macro is defined, based upon the setting
27585 of this option. Possible values are: @code{__RL78_MUL_NONE__},
27586 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
27587
27588 @item -mcpu=g10
27589 @itemx -mcpu=g13
27590 @itemx -mcpu=g14
27591 @itemx -mcpu=rl78
27592 @opindex mcpu
27593 Specifies the RL78 core to target. The default is the G14 core, also
27594 known as an S3 core or just RL78. The G13 or S2 core does not have
27595 multiply or divide instructions, instead it uses a hardware peripheral
27596 for these operations. The G10 or S1 core does not have register
27597 banks, so it uses a different calling convention.
27598
27599 If this option is set it also selects the type of hardware multiply
27600 support to use, unless this is overridden by an explicit
27601 @option{-mmul=none} option on the command line. Thus specifying
27602 @option{-mcpu=g13} enables the use of the G13 hardware multiply
27603 peripheral and specifying @option{-mcpu=g10} disables the use of
27604 hardware multiplications altogether.
27605
27606 Note, although the RL78/G14 core is the default target, specifying
27607 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
27608 change the behavior of the toolchain since it also enables G14
27609 hardware multiply support. If these options are not specified on the
27610 command line then software multiplication routines will be used even
27611 though the code targets the RL78 core. This is for backwards
27612 compatibility with older toolchains which did not have hardware
27613 multiply and divide support.
27614
27615 In addition a C preprocessor macro is defined, based upon the setting
27616 of this option. Possible values are: @code{__RL78_G10__},
27617 @code{__RL78_G13__} or @code{__RL78_G14__}.
27618
27619 @item -mg10
27620 @itemx -mg13
27621 @itemx -mg14
27622 @itemx -mrl78
27623 @opindex mg10
27624 @opindex mg13
27625 @opindex mg14
27626 @opindex mrl78
27627 These are aliases for the corresponding @option{-mcpu=} option. They
27628 are provided for backwards compatibility.
27629
27630 @item -mallregs
27631 @opindex mallregs
27632 Allow the compiler to use all of the available registers. By default
27633 registers @code{r24..r31} are reserved for use in interrupt handlers.
27634 With this option enabled these registers can be used in ordinary
27635 functions as well.
27636
27637 @item -m64bit-doubles
27638 @itemx -m32bit-doubles
27639 @opindex m64bit-doubles
27640 @opindex m32bit-doubles
27641 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
27642 or 32 bits (@option{-m32bit-doubles}) in size. The default is
27643 @option{-m32bit-doubles}.
27644
27645 @item -msave-mduc-in-interrupts
27646 @itemx -mno-save-mduc-in-interrupts
27647 @opindex msave-mduc-in-interrupts
27648 @opindex mno-save-mduc-in-interrupts
27649 Specifies that interrupt handler functions should preserve the
27650 MDUC registers. This is only necessary if normal code might use
27651 the MDUC registers, for example because it performs multiplication
27652 and division operations. The default is to ignore the MDUC registers
27653 as this makes the interrupt handlers faster. The target option -mg13
27654 needs to be passed for this to work as this feature is only available
27655 on the G13 target (S2 core). The MDUC registers will only be saved
27656 if the interrupt handler performs a multiplication or division
27657 operation or it calls another function.
27658
27659 @end table
27660
27661 @node RS/6000 and PowerPC Options
27662 @subsection IBM RS/6000 and PowerPC Options
27663 @cindex RS/6000 and PowerPC Options
27664 @cindex IBM RS/6000 and PowerPC Options
27665
27666 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
27667 @table @gcctabopt
27668 @item -mpowerpc-gpopt
27669 @itemx -mno-powerpc-gpopt
27670 @itemx -mpowerpc-gfxopt
27671 @itemx -mno-powerpc-gfxopt
27672 @need 800
27673 @itemx -mpowerpc64
27674 @itemx -mno-powerpc64
27675 @itemx -mmfcrf
27676 @itemx -mno-mfcrf
27677 @itemx -mpopcntb
27678 @itemx -mno-popcntb
27679 @itemx -mpopcntd
27680 @itemx -mno-popcntd
27681 @itemx -mfprnd
27682 @itemx -mno-fprnd
27683 @need 800
27684 @itemx -mcmpb
27685 @itemx -mno-cmpb
27686 @itemx -mhard-dfp
27687 @itemx -mno-hard-dfp
27688 @opindex mpowerpc-gpopt
27689 @opindex mno-powerpc-gpopt
27690 @opindex mpowerpc-gfxopt
27691 @opindex mno-powerpc-gfxopt
27692 @opindex mpowerpc64
27693 @opindex mno-powerpc64
27694 @opindex mmfcrf
27695 @opindex mno-mfcrf
27696 @opindex mpopcntb
27697 @opindex mno-popcntb
27698 @opindex mpopcntd
27699 @opindex mno-popcntd
27700 @opindex mfprnd
27701 @opindex mno-fprnd
27702 @opindex mcmpb
27703 @opindex mno-cmpb
27704 @opindex mhard-dfp
27705 @opindex mno-hard-dfp
27706 You use these options to specify which instructions are available on the
27707 processor you are using. The default value of these options is
27708 determined when configuring GCC@. Specifying the
27709 @option{-mcpu=@var{cpu_type}} overrides the specification of these
27710 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
27711 rather than the options listed above.
27712
27713 Specifying @option{-mpowerpc-gpopt} allows
27714 GCC to use the optional PowerPC architecture instructions in the
27715 General Purpose group, including floating-point square root. Specifying
27716 @option{-mpowerpc-gfxopt} allows GCC to
27717 use the optional PowerPC architecture instructions in the Graphics
27718 group, including floating-point select.
27719
27720 The @option{-mmfcrf} option allows GCC to generate the move from
27721 condition register field instruction implemented on the POWER4
27722 processor and other processors that support the PowerPC V2.01
27723 architecture.
27724 The @option{-mpopcntb} option allows GCC to generate the popcount and
27725 double-precision FP reciprocal estimate instruction implemented on the
27726 POWER5 processor and other processors that support the PowerPC V2.02
27727 architecture.
27728 The @option{-mpopcntd} option allows GCC to generate the popcount
27729 instruction implemented on the POWER7 processor and other processors
27730 that support the PowerPC V2.06 architecture.
27731 The @option{-mfprnd} option allows GCC to generate the FP round to
27732 integer instructions implemented on the POWER5+ processor and other
27733 processors that support the PowerPC V2.03 architecture.
27734 The @option{-mcmpb} option allows GCC to generate the compare bytes
27735 instruction implemented on the POWER6 processor and other processors
27736 that support the PowerPC V2.05 architecture.
27737 The @option{-mhard-dfp} option allows GCC to generate the decimal
27738 floating-point instructions implemented on some POWER processors.
27739
27740 The @option{-mpowerpc64} option allows GCC to generate the additional
27741 64-bit instructions that are found in the full PowerPC64 architecture
27742 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
27743 @option{-mno-powerpc64}.
27744
27745 @item -mcpu=@var{cpu_type}
27746 @opindex mcpu
27747 Set architecture type, register usage, and
27748 instruction scheduling parameters for machine type @var{cpu_type}.
27749 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
27750 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
27751 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
27752 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
27753 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
27754 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
27755 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
27756 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
27757 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
27758 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
27759 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
27760 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
27761
27762 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
27763 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
27764 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
27765 architecture machine types, with an appropriate, generic processor
27766 model assumed for scheduling purposes.
27767
27768 Specifying @samp{native} as cpu type detects and selects the
27769 architecture option that corresponds to the host processor of the
27770 system performing the compilation.
27771 @option{-mcpu=native} has no effect if GCC does not recognize the
27772 processor.
27773
27774 The other options specify a specific processor. Code generated under
27775 those options runs best on that processor, and may not run at all on
27776 others.
27777
27778 The @option{-mcpu} options automatically enable or disable the
27779 following options:
27780
27781 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
27782 -mpopcntb -mpopcntd -mpowerpc64 @gol
27783 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
27784 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
27785 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
27786 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
27787 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
27788 -mrop-protect}
27789
27790 The particular options set for any particular CPU varies between
27791 compiler versions, depending on what setting seems to produce optimal
27792 code for that CPU; it doesn't necessarily reflect the actual hardware's
27793 capabilities. If you wish to set an individual option to a particular
27794 value, you may specify it after the @option{-mcpu} option, like
27795 @option{-mcpu=970 -mno-altivec}.
27796
27797 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
27798 not enabled or disabled by the @option{-mcpu} option at present because
27799 AIX does not have full support for these options. You may still
27800 enable or disable them individually if you're sure it'll work in your
27801 environment.
27802
27803 @item -mtune=@var{cpu_type}
27804 @opindex mtune
27805 Set the instruction scheduling parameters for machine type
27806 @var{cpu_type}, but do not set the architecture type or register usage,
27807 as @option{-mcpu=@var{cpu_type}} does. The same
27808 values for @var{cpu_type} are used for @option{-mtune} as for
27809 @option{-mcpu}. If both are specified, the code generated uses the
27810 architecture and registers set by @option{-mcpu}, but the
27811 scheduling parameters set by @option{-mtune}.
27812
27813 @item -mcmodel=small
27814 @opindex mcmodel=small
27815 Generate PowerPC64 code for the small model: The TOC is limited to
27816 64k.
27817
27818 @item -mcmodel=medium
27819 @opindex mcmodel=medium
27820 Generate PowerPC64 code for the medium model: The TOC and other static
27821 data may be up to a total of 4G in size. This is the default for 64-bit
27822 Linux.
27823
27824 @item -mcmodel=large
27825 @opindex mcmodel=large
27826 Generate PowerPC64 code for the large model: The TOC may be up to 4G
27827 in size. Other data and code is only limited by the 64-bit address
27828 space.
27829
27830 @item -maltivec
27831 @itemx -mno-altivec
27832 @opindex maltivec
27833 @opindex mno-altivec
27834 Generate code that uses (does not use) AltiVec instructions, and also
27835 enable the use of built-in functions that allow more direct access to
27836 the AltiVec instruction set. You may also need to set
27837 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
27838 enhancements.
27839
27840 When @option{-maltivec} is used, the element order for AltiVec intrinsics
27841 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
27842 match array element order corresponding to the endianness of the
27843 target. That is, element zero identifies the leftmost element in a
27844 vector register when targeting a big-endian platform, and identifies
27845 the rightmost element in a vector register when targeting a
27846 little-endian platform.
27847
27848 @item -mvrsave
27849 @itemx -mno-vrsave
27850 @opindex mvrsave
27851 @opindex mno-vrsave
27852 Generate VRSAVE instructions when generating AltiVec code.
27853
27854 @item -msecure-plt
27855 @opindex msecure-plt
27856 Generate code that allows @command{ld} and @command{ld.so}
27857 to build executables and shared
27858 libraries with non-executable @code{.plt} and @code{.got} sections.
27859 This is a PowerPC
27860 32-bit SYSV ABI option.
27861
27862 @item -mbss-plt
27863 @opindex mbss-plt
27864 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
27865 fills in, and
27866 requires @code{.plt} and @code{.got}
27867 sections that are both writable and executable.
27868 This is a PowerPC 32-bit SYSV ABI option.
27869
27870 @item -misel
27871 @itemx -mno-isel
27872 @opindex misel
27873 @opindex mno-isel
27874 This switch enables or disables the generation of ISEL instructions.
27875
27876 @item -mvsx
27877 @itemx -mno-vsx
27878 @opindex mvsx
27879 @opindex mno-vsx
27880 Generate code that uses (does not use) vector/scalar (VSX)
27881 instructions, and also enable the use of built-in functions that allow
27882 more direct access to the VSX instruction set.
27883
27884 @item -mcrypto
27885 @itemx -mno-crypto
27886 @opindex mcrypto
27887 @opindex mno-crypto
27888 Enable the use (disable) of the built-in functions that allow direct
27889 access to the cryptographic instructions that were added in version
27890 2.07 of the PowerPC ISA.
27891
27892 @item -mhtm
27893 @itemx -mno-htm
27894 @opindex mhtm
27895 @opindex mno-htm
27896 Enable (disable) the use of the built-in functions that allow direct
27897 access to the Hardware Transactional Memory (HTM) instructions that
27898 were added in version 2.07 of the PowerPC ISA.
27899
27900 @item -mpower8-fusion
27901 @itemx -mno-power8-fusion
27902 @opindex mpower8-fusion
27903 @opindex mno-power8-fusion
27904 Generate code that keeps (does not keeps) some integer operations
27905 adjacent so that the instructions can be fused together on power8 and
27906 later processors.
27907
27908 @item -mpower8-vector
27909 @itemx -mno-power8-vector
27910 @opindex mpower8-vector
27911 @opindex mno-power8-vector
27912 Generate code that uses (does not use) the vector and scalar
27913 instructions that were added in version 2.07 of the PowerPC ISA. Also
27914 enable the use of built-in functions that allow more direct access to
27915 the vector instructions.
27916
27917 @item -mquad-memory
27918 @itemx -mno-quad-memory
27919 @opindex mquad-memory
27920 @opindex mno-quad-memory
27921 Generate code that uses (does not use) the non-atomic quad word memory
27922 instructions. The @option{-mquad-memory} option requires use of
27923 64-bit mode.
27924
27925 @item -mquad-memory-atomic
27926 @itemx -mno-quad-memory-atomic
27927 @opindex mquad-memory-atomic
27928 @opindex mno-quad-memory-atomic
27929 Generate code that uses (does not use) the atomic quad word memory
27930 instructions. The @option{-mquad-memory-atomic} option requires use of
27931 64-bit mode.
27932
27933 @item -mfloat128
27934 @itemx -mno-float128
27935 @opindex mfloat128
27936 @opindex mno-float128
27937 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
27938 and use either software emulation for IEEE 128-bit floating point or
27939 hardware instructions.
27940
27941 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
27942 128-bit floating point support. The IEEE 128-bit floating point is only
27943 supported on Linux.
27944
27945 The default for @option{-mfloat128} is enabled on PowerPC Linux
27946 systems using the VSX instruction set, and disabled on other systems.
27947
27948 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
27949 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
27950 point support will also enable the generation of ISA 3.0 IEEE 128-bit
27951 floating point instructions. Otherwise, if you do not specify to
27952 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
27953 system, IEEE 128-bit floating point will be done with software
27954 emulation.
27955
27956 @item -mfloat128-hardware
27957 @itemx -mno-float128-hardware
27958 @opindex mfloat128-hardware
27959 @opindex mno-float128-hardware
27960 Enable/disable using ISA 3.0 hardware instructions to support the
27961 @var{__float128} data type.
27962
27963 The default for @option{-mfloat128-hardware} is enabled on PowerPC
27964 Linux systems using the ISA 3.0 instruction set, and disabled on other
27965 systems.
27966
27967 @item -m32
27968 @itemx -m64
27969 @opindex m32
27970 @opindex m64
27971 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
27972 targets (including GNU/Linux). The 32-bit environment sets int, long
27973 and pointer to 32 bits and generates code that runs on any PowerPC
27974 variant. The 64-bit environment sets int to 32 bits and long and
27975 pointer to 64 bits, and generates code for PowerPC64, as for
27976 @option{-mpowerpc64}.
27977
27978 @item -mfull-toc
27979 @itemx -mno-fp-in-toc
27980 @itemx -mno-sum-in-toc
27981 @itemx -mminimal-toc
27982 @opindex mfull-toc
27983 @opindex mno-fp-in-toc
27984 @opindex mno-sum-in-toc
27985 @opindex mminimal-toc
27986 Modify generation of the TOC (Table Of Contents), which is created for
27987 every executable file. The @option{-mfull-toc} option is selected by
27988 default. In that case, GCC allocates at least one TOC entry for
27989 each unique non-automatic variable reference in your program. GCC
27990 also places floating-point constants in the TOC@. However, only
27991 16,384 entries are available in the TOC@.
27992
27993 If you receive a linker error message that saying you have overflowed
27994 the available TOC space, you can reduce the amount of TOC space used
27995 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
27996 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
27997 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
27998 generate code to calculate the sum of an address and a constant at
27999 run time instead of putting that sum into the TOC@. You may specify one
28000 or both of these options. Each causes GCC to produce very slightly
28001 slower and larger code at the expense of conserving TOC space.
28002
28003 If you still run out of space in the TOC even when you specify both of
28004 these options, specify @option{-mminimal-toc} instead. This option causes
28005 GCC to make only one TOC entry for every file. When you specify this
28006 option, GCC produces code that is slower and larger but which
28007 uses extremely little TOC space. You may wish to use this option
28008 only on files that contain less frequently-executed code.
28009
28010 @item -maix64
28011 @itemx -maix32
28012 @opindex maix64
28013 @opindex maix32
28014 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
28015 @code{long} type, and the infrastructure needed to support them.
28016 Specifying @option{-maix64} implies @option{-mpowerpc64},
28017 while @option{-maix32} disables the 64-bit ABI and
28018 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
28019
28020 @item -mxl-compat
28021 @itemx -mno-xl-compat
28022 @opindex mxl-compat
28023 @opindex mno-xl-compat
28024 Produce code that conforms more closely to IBM XL compiler semantics
28025 when using AIX-compatible ABI@. Pass floating-point arguments to
28026 prototyped functions beyond the register save area (RSA) on the stack
28027 in addition to argument FPRs. Do not assume that most significant
28028 double in 128-bit long double value is properly rounded when comparing
28029 values and converting to double. Use XL symbol names for long double
28030 support routines.
28031
28032 The AIX calling convention was extended but not initially documented to
28033 handle an obscure K&R C case of calling a function that takes the
28034 address of its arguments with fewer arguments than declared. IBM XL
28035 compilers access floating-point arguments that do not fit in the
28036 RSA from the stack when a subroutine is compiled without
28037 optimization. Because always storing floating-point arguments on the
28038 stack is inefficient and rarely needed, this option is not enabled by
28039 default and only is necessary when calling subroutines compiled by IBM
28040 XL compilers without optimization.
28041
28042 @item -mpe
28043 @opindex mpe
28044 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
28045 application written to use message passing with special startup code to
28046 enable the application to run. The system must have PE installed in the
28047 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
28048 must be overridden with the @option{-specs=} option to specify the
28049 appropriate directory location. The Parallel Environment does not
28050 support threads, so the @option{-mpe} option and the @option{-pthread}
28051 option are incompatible.
28052
28053 @item -malign-natural
28054 @itemx -malign-power
28055 @opindex malign-natural
28056 @opindex malign-power
28057 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
28058 @option{-malign-natural} overrides the ABI-defined alignment of larger
28059 types, such as floating-point doubles, on their natural size-based boundary.
28060 The option @option{-malign-power} instructs GCC to follow the ABI-specified
28061 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
28062
28063 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
28064 is not supported.
28065
28066 @item -msoft-float
28067 @itemx -mhard-float
28068 @opindex msoft-float
28069 @opindex mhard-float
28070 Generate code that does not use (uses) the floating-point register set.
28071 Software floating-point emulation is provided if you use the
28072 @option{-msoft-float} option, and pass the option to GCC when linking.
28073
28074 @item -mmultiple
28075 @itemx -mno-multiple
28076 @opindex mmultiple
28077 @opindex mno-multiple
28078 Generate code that uses (does not use) the load multiple word
28079 instructions and the store multiple word instructions. These
28080 instructions are generated by default on POWER systems, and not
28081 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
28082 PowerPC systems, since those instructions do not work when the
28083 processor is in little-endian mode. The exceptions are PPC740 and
28084 PPC750 which permit these instructions in little-endian mode.
28085
28086 @item -mupdate
28087 @itemx -mno-update
28088 @opindex mupdate
28089 @opindex mno-update
28090 Generate code that uses (does not use) the load or store instructions
28091 that update the base register to the address of the calculated memory
28092 location. These instructions are generated by default. If you use
28093 @option{-mno-update}, there is a small window between the time that the
28094 stack pointer is updated and the address of the previous frame is
28095 stored, which means code that walks the stack frame across interrupts or
28096 signals may get corrupted data.
28097
28098 @item -mavoid-indexed-addresses
28099 @itemx -mno-avoid-indexed-addresses
28100 @opindex mavoid-indexed-addresses
28101 @opindex mno-avoid-indexed-addresses
28102 Generate code that tries to avoid (not avoid) the use of indexed load
28103 or store instructions. These instructions can incur a performance
28104 penalty on Power6 processors in certain situations, such as when
28105 stepping through large arrays that cross a 16M boundary. This option
28106 is enabled by default when targeting Power6 and disabled otherwise.
28107
28108 @item -mfused-madd
28109 @itemx -mno-fused-madd
28110 @opindex mfused-madd
28111 @opindex mno-fused-madd
28112 Generate code that uses (does not use) the floating-point multiply and
28113 accumulate instructions. These instructions are generated by default
28114 if hardware floating point is used. The machine-dependent
28115 @option{-mfused-madd} option is now mapped to the machine-independent
28116 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
28117 mapped to @option{-ffp-contract=off}.
28118
28119 @item -mmulhw
28120 @itemx -mno-mulhw
28121 @opindex mmulhw
28122 @opindex mno-mulhw
28123 Generate code that uses (does not use) the half-word multiply and
28124 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
28125 These instructions are generated by default when targeting those
28126 processors.
28127
28128 @item -mdlmzb
28129 @itemx -mno-dlmzb
28130 @opindex mdlmzb
28131 @opindex mno-dlmzb
28132 Generate code that uses (does not use) the string-search @samp{dlmzb}
28133 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
28134 generated by default when targeting those processors.
28135
28136 @item -mno-bit-align
28137 @itemx -mbit-align
28138 @opindex mno-bit-align
28139 @opindex mbit-align
28140 On System V.4 and embedded PowerPC systems do not (do) force structures
28141 and unions that contain bit-fields to be aligned to the base type of the
28142 bit-field.
28143
28144 For example, by default a structure containing nothing but 8
28145 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
28146 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
28147 the structure is aligned to a 1-byte boundary and is 1 byte in
28148 size.
28149
28150 @item -mno-strict-align
28151 @itemx -mstrict-align
28152 @opindex mno-strict-align
28153 @opindex mstrict-align
28154 On System V.4 and embedded PowerPC systems do not (do) assume that
28155 unaligned memory references are handled by the system.
28156
28157 @item -mrelocatable
28158 @itemx -mno-relocatable
28159 @opindex mrelocatable
28160 @opindex mno-relocatable
28161 Generate code that allows (does not allow) a static executable to be
28162 relocated to a different address at run time. A simple embedded
28163 PowerPC system loader should relocate the entire contents of
28164 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
28165 a table of 32-bit addresses generated by this option. For this to
28166 work, all objects linked together must be compiled with
28167 @option{-mrelocatable} or @option{-mrelocatable-lib}.
28168 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
28169
28170 @item -mrelocatable-lib
28171 @itemx -mno-relocatable-lib
28172 @opindex mrelocatable-lib
28173 @opindex mno-relocatable-lib
28174 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
28175 @code{.fixup} section to allow static executables to be relocated at
28176 run time, but @option{-mrelocatable-lib} does not use the smaller stack
28177 alignment of @option{-mrelocatable}. Objects compiled with
28178 @option{-mrelocatable-lib} may be linked with objects compiled with
28179 any combination of the @option{-mrelocatable} options.
28180
28181 @item -mno-toc
28182 @itemx -mtoc
28183 @opindex mno-toc
28184 @opindex mtoc
28185 On System V.4 and embedded PowerPC systems do not (do) assume that
28186 register 2 contains a pointer to a global area pointing to the addresses
28187 used in the program.
28188
28189 @item -mlittle
28190 @itemx -mlittle-endian
28191 @opindex mlittle
28192 @opindex mlittle-endian
28193 On System V.4 and embedded PowerPC systems compile code for the
28194 processor in little-endian mode. The @option{-mlittle-endian} option is
28195 the same as @option{-mlittle}.
28196
28197 @item -mbig
28198 @itemx -mbig-endian
28199 @opindex mbig
28200 @opindex mbig-endian
28201 On System V.4 and embedded PowerPC systems compile code for the
28202 processor in big-endian mode. The @option{-mbig-endian} option is
28203 the same as @option{-mbig}.
28204
28205 @item -mdynamic-no-pic
28206 @opindex mdynamic-no-pic
28207 On Darwin and Mac OS X systems, compile code so that it is not
28208 relocatable, but that its external references are relocatable. The
28209 resulting code is suitable for applications, but not shared
28210 libraries.
28211
28212 @item -msingle-pic-base
28213 @opindex msingle-pic-base
28214 Treat the register used for PIC addressing as read-only, rather than
28215 loading it in the prologue for each function. The runtime system is
28216 responsible for initializing this register with an appropriate value
28217 before execution begins.
28218
28219 @item -mprioritize-restricted-insns=@var{priority}
28220 @opindex mprioritize-restricted-insns
28221 This option controls the priority that is assigned to
28222 dispatch-slot restricted instructions during the second scheduling
28223 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
28224 or @samp{2} to assign no, highest, or second-highest (respectively)
28225 priority to dispatch-slot restricted
28226 instructions.
28227
28228 @item -msched-costly-dep=@var{dependence_type}
28229 @opindex msched-costly-dep
28230 This option controls which dependences are considered costly
28231 by the target during instruction scheduling. The argument
28232 @var{dependence_type} takes one of the following values:
28233
28234 @table @asis
28235 @item @samp{no}
28236 No dependence is costly.
28237
28238 @item @samp{all}
28239 All dependences are costly.
28240
28241 @item @samp{true_store_to_load}
28242 A true dependence from store to load is costly.
28243
28244 @item @samp{store_to_load}
28245 Any dependence from store to load is costly.
28246
28247 @item @var{number}
28248 Any dependence for which the latency is greater than or equal to
28249 @var{number} is costly.
28250 @end table
28251
28252 @item -minsert-sched-nops=@var{scheme}
28253 @opindex minsert-sched-nops
28254 This option controls which NOP insertion scheme is used during
28255 the second scheduling pass. The argument @var{scheme} takes one of the
28256 following values:
28257
28258 @table @asis
28259 @item @samp{no}
28260 Don't insert NOPs.
28261
28262 @item @samp{pad}
28263 Pad with NOPs any dispatch group that has vacant issue slots,
28264 according to the scheduler's grouping.
28265
28266 @item @samp{regroup_exact}
28267 Insert NOPs to force costly dependent insns into
28268 separate groups. Insert exactly as many NOPs as needed to force an insn
28269 to a new group, according to the estimated processor grouping.
28270
28271 @item @var{number}
28272 Insert NOPs to force costly dependent insns into
28273 separate groups. Insert @var{number} NOPs to force an insn to a new group.
28274 @end table
28275
28276 @item -mcall-sysv
28277 @opindex mcall-sysv
28278 On System V.4 and embedded PowerPC systems compile code using calling
28279 conventions that adhere to the March 1995 draft of the System V
28280 Application Binary Interface, PowerPC processor supplement. This is the
28281 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
28282
28283 @item -mcall-sysv-eabi
28284 @itemx -mcall-eabi
28285 @opindex mcall-sysv-eabi
28286 @opindex mcall-eabi
28287 Specify both @option{-mcall-sysv} and @option{-meabi} options.
28288
28289 @item -mcall-sysv-noeabi
28290 @opindex mcall-sysv-noeabi
28291 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
28292
28293 @item -mcall-aixdesc
28294 @opindex m
28295 On System V.4 and embedded PowerPC systems compile code for the AIX
28296 operating system.
28297
28298 @item -mcall-linux
28299 @opindex mcall-linux
28300 On System V.4 and embedded PowerPC systems compile code for the
28301 Linux-based GNU system.
28302
28303 @item -mcall-freebsd
28304 @opindex mcall-freebsd
28305 On System V.4 and embedded PowerPC systems compile code for the
28306 FreeBSD operating system.
28307
28308 @item -mcall-netbsd
28309 @opindex mcall-netbsd
28310 On System V.4 and embedded PowerPC systems compile code for the
28311 NetBSD operating system.
28312
28313 @item -mcall-openbsd
28314 @opindex mcall-netbsd
28315 On System V.4 and embedded PowerPC systems compile code for the
28316 OpenBSD operating system.
28317
28318 @item -mtraceback=@var{traceback_type}
28319 @opindex mtraceback
28320 Select the type of traceback table. Valid values for @var{traceback_type}
28321 are @samp{full}, @samp{part}, and @samp{no}.
28322
28323 @item -maix-struct-return
28324 @opindex maix-struct-return
28325 Return all structures in memory (as specified by the AIX ABI)@.
28326
28327 @item -msvr4-struct-return
28328 @opindex msvr4-struct-return
28329 Return structures smaller than 8 bytes in registers (as specified by the
28330 SVR4 ABI)@.
28331
28332 @item -mabi=@var{abi-type}
28333 @opindex mabi
28334 Extend the current ABI with a particular extension, or remove such extension.
28335 Valid values are: @samp{altivec}, @samp{no-altivec},
28336 @samp{ibmlongdouble}, @samp{ieeelongdouble},
28337 @samp{elfv1}, @samp{elfv2},
28338 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
28339
28340 @item -mabi=ibmlongdouble
28341 @opindex mabi=ibmlongdouble
28342 Change the current ABI to use IBM extended-precision long double.
28343 This is not likely to work if your system defaults to using IEEE
28344 extended-precision long double. If you change the long double type
28345 from IEEE extended-precision, the compiler will issue a warning unless
28346 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28347 to be enabled.
28348
28349 @item -mabi=ieeelongdouble
28350 @opindex mabi=ieeelongdouble
28351 Change the current ABI to use IEEE extended-precision long double.
28352 This is not likely to work if your system defaults to using IBM
28353 extended-precision long double. If you change the long double type
28354 from IBM extended-precision, the compiler will issue a warning unless
28355 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28356 to be enabled.
28357
28358 @item -mabi=elfv1
28359 @opindex mabi=elfv1
28360 Change the current ABI to use the ELFv1 ABI.
28361 This is the default ABI for big-endian PowerPC 64-bit Linux.
28362 Overriding the default ABI requires special system support and is
28363 likely to fail in spectacular ways.
28364
28365 @item -mabi=elfv2
28366 @opindex mabi=elfv2
28367 Change the current ABI to use the ELFv2 ABI.
28368 This is the default ABI for little-endian PowerPC 64-bit Linux.
28369 Overriding the default ABI requires special system support and is
28370 likely to fail in spectacular ways.
28371
28372 @item -mgnu-attribute
28373 @itemx -mno-gnu-attribute
28374 @opindex mgnu-attribute
28375 @opindex mno-gnu-attribute
28376 Emit .gnu_attribute assembly directives to set tag/value pairs in a
28377 .gnu.attributes section that specify ABI variations in function
28378 parameters or return values.
28379
28380 @item -mprototype
28381 @itemx -mno-prototype
28382 @opindex mprototype
28383 @opindex mno-prototype
28384 On System V.4 and embedded PowerPC systems assume that all calls to
28385 variable argument functions are properly prototyped. Otherwise, the
28386 compiler must insert an instruction before every non-prototyped call to
28387 set or clear bit 6 of the condition code register (@code{CR}) to
28388 indicate whether floating-point values are passed in the floating-point
28389 registers in case the function takes variable arguments. With
28390 @option{-mprototype}, only calls to prototyped variable argument functions
28391 set or clear the bit.
28392
28393 @item -msim
28394 @opindex msim
28395 On embedded PowerPC systems, assume that the startup module is called
28396 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
28397 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
28398 configurations.
28399
28400 @item -mmvme
28401 @opindex mmvme
28402 On embedded PowerPC systems, assume that the startup module is called
28403 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
28404 @file{libc.a}.
28405
28406 @item -mads
28407 @opindex mads
28408 On embedded PowerPC systems, assume that the startup module is called
28409 @file{crt0.o} and the standard C libraries are @file{libads.a} and
28410 @file{libc.a}.
28411
28412 @item -myellowknife
28413 @opindex myellowknife
28414 On embedded PowerPC systems, assume that the startup module is called
28415 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
28416 @file{libc.a}.
28417
28418 @item -mvxworks
28419 @opindex mvxworks
28420 On System V.4 and embedded PowerPC systems, specify that you are
28421 compiling for a VxWorks system.
28422
28423 @item -memb
28424 @opindex memb
28425 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
28426 header to indicate that @samp{eabi} extended relocations are used.
28427
28428 @item -meabi
28429 @itemx -mno-eabi
28430 @opindex meabi
28431 @opindex mno-eabi
28432 On System V.4 and embedded PowerPC systems do (do not) adhere to the
28433 Embedded Applications Binary Interface (EABI), which is a set of
28434 modifications to the System V.4 specifications. Selecting @option{-meabi}
28435 means that the stack is aligned to an 8-byte boundary, a function
28436 @code{__eabi} is called from @code{main} to set up the EABI
28437 environment, and the @option{-msdata} option can use both @code{r2} and
28438 @code{r13} to point to two separate small data areas. Selecting
28439 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
28440 no EABI initialization function is called from @code{main}, and the
28441 @option{-msdata} option only uses @code{r13} to point to a single
28442 small data area. The @option{-meabi} option is on by default if you
28443 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
28444
28445 @item -msdata=eabi
28446 @opindex msdata=eabi
28447 On System V.4 and embedded PowerPC systems, put small initialized
28448 @code{const} global and static data in the @code{.sdata2} section, which
28449 is pointed to by register @code{r2}. Put small initialized
28450 non-@code{const} global and static data in the @code{.sdata} section,
28451 which is pointed to by register @code{r13}. Put small uninitialized
28452 global and static data in the @code{.sbss} section, which is adjacent to
28453 the @code{.sdata} section. The @option{-msdata=eabi} option is
28454 incompatible with the @option{-mrelocatable} option. The
28455 @option{-msdata=eabi} option also sets the @option{-memb} option.
28456
28457 @item -msdata=sysv
28458 @opindex msdata=sysv
28459 On System V.4 and embedded PowerPC systems, put small global and static
28460 data in the @code{.sdata} section, which is pointed to by register
28461 @code{r13}. Put small uninitialized global and static data in the
28462 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
28463 The @option{-msdata=sysv} option is incompatible with the
28464 @option{-mrelocatable} option.
28465
28466 @item -msdata=default
28467 @itemx -msdata
28468 @opindex msdata=default
28469 @opindex msdata
28470 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
28471 compile code the same as @option{-msdata=eabi}, otherwise compile code the
28472 same as @option{-msdata=sysv}.
28473
28474 @item -msdata=data
28475 @opindex msdata=data
28476 On System V.4 and embedded PowerPC systems, put small global
28477 data in the @code{.sdata} section. Put small uninitialized global
28478 data in the @code{.sbss} section. Do not use register @code{r13}
28479 to address small data however. This is the default behavior unless
28480 other @option{-msdata} options are used.
28481
28482 @item -msdata=none
28483 @itemx -mno-sdata
28484 @opindex msdata=none
28485 @opindex mno-sdata
28486 On embedded PowerPC systems, put all initialized global and static data
28487 in the @code{.data} section, and all uninitialized data in the
28488 @code{.bss} section.
28489
28490 @item -mreadonly-in-sdata
28491 @opindex mreadonly-in-sdata
28492 @opindex mno-readonly-in-sdata
28493 Put read-only objects in the @code{.sdata} section as well. This is the
28494 default.
28495
28496 @item -mblock-move-inline-limit=@var{num}
28497 @opindex mblock-move-inline-limit
28498 Inline all block moves (such as calls to @code{memcpy} or structure
28499 copies) less than or equal to @var{num} bytes. The minimum value for
28500 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
28501 targets. The default value is target-specific.
28502
28503 @item -mblock-compare-inline-limit=@var{num}
28504 @opindex mblock-compare-inline-limit
28505 Generate non-looping inline code for all block compares (such as calls
28506 to @code{memcmp} or structure compares) less than or equal to @var{num}
28507 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
28508 block compare is disabled. The default value is target-specific.
28509
28510 @item -mblock-compare-inline-loop-limit=@var{num}
28511 @opindex mblock-compare-inline-loop-limit
28512 Generate an inline expansion using loop code for all block compares that
28513 are less than or equal to @var{num} bytes, but greater than the limit
28514 for non-loop inline block compare expansion. If the block length is not
28515 constant, at most @var{num} bytes will be compared before @code{memcmp}
28516 is called to compare the remainder of the block. The default value is
28517 target-specific.
28518
28519 @item -mstring-compare-inline-limit=@var{num}
28520 @opindex mstring-compare-inline-limit
28521 Compare at most @var{num} string bytes with inline code.
28522 If the difference or end of string is not found at the
28523 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
28524 take care of the rest of the comparison. The default is 64 bytes.
28525
28526 @item -G @var{num}
28527 @opindex G
28528 @cindex smaller data references (PowerPC)
28529 @cindex .sdata/.sdata2 references (PowerPC)
28530 On embedded PowerPC systems, put global and static items less than or
28531 equal to @var{num} bytes into the small data or BSS sections instead of
28532 the normal data or BSS section. By default, @var{num} is 8. The
28533 @option{-G @var{num}} switch is also passed to the linker.
28534 All modules should be compiled with the same @option{-G @var{num}} value.
28535
28536 @item -mregnames
28537 @itemx -mno-regnames
28538 @opindex mregnames
28539 @opindex mno-regnames
28540 On System V.4 and embedded PowerPC systems do (do not) emit register
28541 names in the assembly language output using symbolic forms.
28542
28543 @item -mlongcall
28544 @itemx -mno-longcall
28545 @opindex mlongcall
28546 @opindex mno-longcall
28547 By default assume that all calls are far away so that a longer and more
28548 expensive calling sequence is required. This is required for calls
28549 farther than 32 megabytes (33,554,432 bytes) from the current location.
28550 A short call is generated if the compiler knows
28551 the call cannot be that far away. This setting can be overridden by
28552 the @code{shortcall} function attribute, or by @code{#pragma
28553 longcall(0)}.
28554
28555 Some linkers are capable of detecting out-of-range calls and generating
28556 glue code on the fly. On these systems, long calls are unnecessary and
28557 generate slower code. As of this writing, the AIX linker can do this,
28558 as can the GNU linker for PowerPC/64. It is planned to add this feature
28559 to the GNU linker for 32-bit PowerPC systems as well.
28560
28561 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
28562 GCC can generate long calls using an inline PLT call sequence (see
28563 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
28564 ELFv1 (big-endian) do not support inline PLT calls.
28565
28566 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
28567 callee, L42}, plus a @dfn{branch island} (glue code). The two target
28568 addresses represent the callee and the branch island. The
28569 Darwin/PPC linker prefers the first address and generates a @code{bl
28570 callee} if the PPC @code{bl} instruction reaches the callee directly;
28571 otherwise, the linker generates @code{bl L42} to call the branch
28572 island. The branch island is appended to the body of the
28573 calling function; it computes the full 32-bit address of the callee
28574 and jumps to it.
28575
28576 On Mach-O (Darwin) systems, this option directs the compiler emit to
28577 the glue for every direct call, and the Darwin linker decides whether
28578 to use or discard it.
28579
28580 In the future, GCC may ignore all longcall specifications
28581 when the linker is known to generate glue.
28582
28583 @item -mpltseq
28584 @itemx -mno-pltseq
28585 @opindex mpltseq
28586 @opindex mno-pltseq
28587 Implement (do not implement) -fno-plt and long calls using an inline
28588 PLT call sequence that supports lazy linking and long calls to
28589 functions in dlopen'd shared libraries. Inline PLT calls are only
28590 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
28591 linkers, and are enabled by default if the support is detected when
28592 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
28593 configured with @option{--enable-secureplt}. @option{-mpltseq} code
28594 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
28595 linked together.
28596
28597 @item -mtls-markers
28598 @itemx -mno-tls-markers
28599 @opindex mtls-markers
28600 @opindex mno-tls-markers
28601 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
28602 specifying the function argument. The relocation allows the linker to
28603 reliably associate function call with argument setup instructions for
28604 TLS optimization, which in turn allows GCC to better schedule the
28605 sequence.
28606
28607 @item -mrecip
28608 @itemx -mno-recip
28609 @opindex mrecip
28610 This option enables use of the reciprocal estimate and
28611 reciprocal square root estimate instructions with additional
28612 Newton-Raphson steps to increase precision instead of doing a divide or
28613 square root and divide for floating-point arguments. You should use
28614 the @option{-ffast-math} option when using @option{-mrecip} (or at
28615 least @option{-funsafe-math-optimizations},
28616 @option{-ffinite-math-only}, @option{-freciprocal-math} and
28617 @option{-fno-trapping-math}). Note that while the throughput of the
28618 sequence is generally higher than the throughput of the non-reciprocal
28619 instruction, the precision of the sequence can be decreased by up to 2
28620 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
28621 roots.
28622
28623 @item -mrecip=@var{opt}
28624 @opindex mrecip=opt
28625 This option controls which reciprocal estimate instructions
28626 may be used. @var{opt} is a comma-separated list of options, which may
28627 be preceded by a @code{!} to invert the option:
28628
28629 @table @samp
28630
28631 @item all
28632 Enable all estimate instructions.
28633
28634 @item default
28635 Enable the default instructions, equivalent to @option{-mrecip}.
28636
28637 @item none
28638 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28639
28640 @item div
28641 Enable the reciprocal approximation instructions for both
28642 single and double precision.
28643
28644 @item divf
28645 Enable the single-precision reciprocal approximation instructions.
28646
28647 @item divd
28648 Enable the double-precision reciprocal approximation instructions.
28649
28650 @item rsqrt
28651 Enable the reciprocal square root approximation instructions for both
28652 single and double precision.
28653
28654 @item rsqrtf
28655 Enable the single-precision reciprocal square root approximation instructions.
28656
28657 @item rsqrtd
28658 Enable the double-precision reciprocal square root approximation instructions.
28659
28660 @end table
28661
28662 So, for example, @option{-mrecip=all,!rsqrtd} enables
28663 all of the reciprocal estimate instructions, except for the
28664 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
28665 which handle the double-precision reciprocal square root calculations.
28666
28667 @item -mrecip-precision
28668 @itemx -mno-recip-precision
28669 @opindex mrecip-precision
28670 Assume (do not assume) that the reciprocal estimate instructions
28671 provide higher-precision estimates than is mandated by the PowerPC
28672 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
28673 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
28674 The double-precision square root estimate instructions are not generated by
28675 default on low-precision machines, since they do not provide an
28676 estimate that converges after three steps.
28677
28678 @item -mveclibabi=@var{type}
28679 @opindex mveclibabi
28680 Specifies the ABI type to use for vectorizing intrinsics using an
28681 external library. The only type supported at present is @samp{mass},
28682 which specifies to use IBM's Mathematical Acceleration Subsystem
28683 (MASS) libraries for vectorizing intrinsics using external libraries.
28684 GCC currently emits calls to @code{acosd2}, @code{acosf4},
28685 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
28686 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
28687 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
28688 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
28689 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
28690 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
28691 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
28692 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
28693 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
28694 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
28695 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
28696 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
28697 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
28698 for power7. Both @option{-ftree-vectorize} and
28699 @option{-funsafe-math-optimizations} must also be enabled. The MASS
28700 libraries must be specified at link time.
28701
28702 @item -mfriz
28703 @itemx -mno-friz
28704 @opindex mfriz
28705 Generate (do not generate) the @code{friz} instruction when the
28706 @option{-funsafe-math-optimizations} option is used to optimize
28707 rounding of floating-point values to 64-bit integer and back to floating
28708 point. The @code{friz} instruction does not return the same value if
28709 the floating-point number is too large to fit in an integer.
28710
28711 @item -mpointers-to-nested-functions
28712 @itemx -mno-pointers-to-nested-functions
28713 @opindex mpointers-to-nested-functions
28714 Generate (do not generate) code to load up the static chain register
28715 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
28716 systems where a function pointer points to a 3-word descriptor giving
28717 the function address, TOC value to be loaded in register @code{r2}, and
28718 static chain value to be loaded in register @code{r11}. The
28719 @option{-mpointers-to-nested-functions} is on by default. You cannot
28720 call through pointers to nested functions or pointers
28721 to functions compiled in other languages that use the static chain if
28722 you use @option{-mno-pointers-to-nested-functions}.
28723
28724 @item -msave-toc-indirect
28725 @itemx -mno-save-toc-indirect
28726 @opindex msave-toc-indirect
28727 Generate (do not generate) code to save the TOC value in the reserved
28728 stack location in the function prologue if the function calls through
28729 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
28730 saved in the prologue, it is saved just before the call through the
28731 pointer. The @option{-mno-save-toc-indirect} option is the default.
28732
28733 @item -mcompat-align-parm
28734 @itemx -mno-compat-align-parm
28735 @opindex mcompat-align-parm
28736 Generate (do not generate) code to pass structure parameters with a
28737 maximum alignment of 64 bits, for compatibility with older versions
28738 of GCC.
28739
28740 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
28741 structure parameter on a 128-bit boundary when that structure contained
28742 a member requiring 128-bit alignment. This is corrected in more
28743 recent versions of GCC. This option may be used to generate code
28744 that is compatible with functions compiled with older versions of
28745 GCC.
28746
28747 The @option{-mno-compat-align-parm} option is the default.
28748
28749 @item -mstack-protector-guard=@var{guard}
28750 @itemx -mstack-protector-guard-reg=@var{reg}
28751 @itemx -mstack-protector-guard-offset=@var{offset}
28752 @itemx -mstack-protector-guard-symbol=@var{symbol}
28753 @opindex mstack-protector-guard
28754 @opindex mstack-protector-guard-reg
28755 @opindex mstack-protector-guard-offset
28756 @opindex mstack-protector-guard-symbol
28757 Generate stack protection code using canary at @var{guard}. Supported
28758 locations are @samp{global} for global canary or @samp{tls} for per-thread
28759 canary in the TLS block (the default with GNU libc version 2.4 or later).
28760
28761 With the latter choice the options
28762 @option{-mstack-protector-guard-reg=@var{reg}} and
28763 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28764 which register to use as base register for reading the canary, and from what
28765 offset from that base register. The default for those is as specified in the
28766 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
28767 the offset with a symbol reference to a canary in the TLS block.
28768
28769 @item -mpcrel
28770 @itemx -mno-pcrel
28771 @opindex mpcrel
28772 @opindex mno-pcrel
28773 Generate (do not generate) pc-relative addressing. The @option{-mpcrel}
28774 option requires that the medium code model (@option{-mcmodel=medium})
28775 and prefixed addressing (@option{-mprefixed}) options are enabled.
28776
28777 @item -mprefixed
28778 @itemx -mno-prefixed
28779 @opindex mprefixed
28780 @opindex mno-prefixed
28781 Generate (do not generate) addressing modes using prefixed load and
28782 store instructions. The @option{-mprefixed} option requires that
28783 the option @option{-mcpu=power10} (or later) is enabled.
28784
28785 @item -mmma
28786 @itemx -mno-mma
28787 @opindex mmma
28788 @opindex mno-mma
28789 Generate (do not generate) the MMA instructions. The @option{-mma}
28790 option requires that the option @option{-mcpu=power10} (or later)
28791 is enabled.
28792
28793 @item -mrop-protect
28794 @itemx -mno-rop-protect
28795 @opindex mrop-protect
28796 @opindex mno-rop-protect
28797 Generate (do not generate) ROP protection instructions when the target
28798 processor supports them. Currently this option disables the shrink-wrap
28799 optimization (@option{-fshrink-wrap}).
28800
28801 @item -mprivileged
28802 @itemx -mno-privileged
28803 @opindex mprivileged
28804 @opindex mno-privileged
28805 Generate (do not generate) code that will run in privileged state.
28806
28807 @item -mblock-ops-unaligned-vsx
28808 @itemx -mno-block-ops-unaligned-vsx
28809 @opindex block-ops-unaligned-vsx
28810 @opindex no-block-ops-unaligned-vsx
28811 Generate (do not generate) unaligned vsx loads and stores for
28812 inline expansion of @code{memcpy} and @code{memmove}.
28813 @end table
28814
28815 @node RX Options
28816 @subsection RX Options
28817 @cindex RX Options
28818
28819 These command-line options are defined for RX targets:
28820
28821 @table @gcctabopt
28822 @item -m64bit-doubles
28823 @itemx -m32bit-doubles
28824 @opindex m64bit-doubles
28825 @opindex m32bit-doubles
28826 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28827 or 32 bits (@option{-m32bit-doubles}) in size. The default is
28828 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
28829 works on 32-bit values, which is why the default is
28830 @option{-m32bit-doubles}.
28831
28832 @item -fpu
28833 @itemx -nofpu
28834 @opindex fpu
28835 @opindex nofpu
28836 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
28837 floating-point hardware. The default is enabled for the RX600
28838 series and disabled for the RX200 series.
28839
28840 Floating-point instructions are only generated for 32-bit floating-point
28841 values, however, so the FPU hardware is not used for doubles if the
28842 @option{-m64bit-doubles} option is used.
28843
28844 @emph{Note} If the @option{-fpu} option is enabled then
28845 @option{-funsafe-math-optimizations} is also enabled automatically.
28846 This is because the RX FPU instructions are themselves unsafe.
28847
28848 @item -mcpu=@var{name}
28849 @opindex mcpu
28850 Selects the type of RX CPU to be targeted. Currently three types are
28851 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
28852 the specific @samp{RX610} CPU. The default is @samp{RX600}.
28853
28854 The only difference between @samp{RX600} and @samp{RX610} is that the
28855 @samp{RX610} does not support the @code{MVTIPL} instruction.
28856
28857 The @samp{RX200} series does not have a hardware floating-point unit
28858 and so @option{-nofpu} is enabled by default when this type is
28859 selected.
28860
28861 @item -mbig-endian-data
28862 @itemx -mlittle-endian-data
28863 @opindex mbig-endian-data
28864 @opindex mlittle-endian-data
28865 Store data (but not code) in the big-endian format. The default is
28866 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
28867 format.
28868
28869 @item -msmall-data-limit=@var{N}
28870 @opindex msmall-data-limit
28871 Specifies the maximum size in bytes of global and static variables
28872 which can be placed into the small data area. Using the small data
28873 area can lead to smaller and faster code, but the size of area is
28874 limited and it is up to the programmer to ensure that the area does
28875 not overflow. Also when the small data area is used one of the RX's
28876 registers (usually @code{r13}) is reserved for use pointing to this
28877 area, so it is no longer available for use by the compiler. This
28878 could result in slower and/or larger code if variables are pushed onto
28879 the stack instead of being held in this register.
28880
28881 Note, common variables (variables that have not been initialized) and
28882 constants are not placed into the small data area as they are assigned
28883 to other sections in the output executable.
28884
28885 The default value is zero, which disables this feature. Note, this
28886 feature is not enabled by default with higher optimization levels
28887 (@option{-O2} etc) because of the potentially detrimental effects of
28888 reserving a register. It is up to the programmer to experiment and
28889 discover whether this feature is of benefit to their program. See the
28890 description of the @option{-mpid} option for a description of how the
28891 actual register to hold the small data area pointer is chosen.
28892
28893 @item -msim
28894 @itemx -mno-sim
28895 @opindex msim
28896 @opindex mno-sim
28897 Use the simulator runtime. The default is to use the libgloss
28898 board-specific runtime.
28899
28900 @item -mas100-syntax
28901 @itemx -mno-as100-syntax
28902 @opindex mas100-syntax
28903 @opindex mno-as100-syntax
28904 When generating assembler output use a syntax that is compatible with
28905 Renesas's AS100 assembler. This syntax can also be handled by the GAS
28906 assembler, but it has some restrictions so it is not generated by default.
28907
28908 @item -mmax-constant-size=@var{N}
28909 @opindex mmax-constant-size
28910 Specifies the maximum size, in bytes, of a constant that can be used as
28911 an operand in a RX instruction. Although the RX instruction set does
28912 allow constants of up to 4 bytes in length to be used in instructions,
28913 a longer value equates to a longer instruction. Thus in some
28914 circumstances it can be beneficial to restrict the size of constants
28915 that are used in instructions. Constants that are too big are instead
28916 placed into a constant pool and referenced via register indirection.
28917
28918 The value @var{N} can be between 0 and 4. A value of 0 (the default)
28919 or 4 means that constants of any size are allowed.
28920
28921 @item -mrelax
28922 @opindex mrelax
28923 Enable linker relaxation. Linker relaxation is a process whereby the
28924 linker attempts to reduce the size of a program by finding shorter
28925 versions of various instructions. Disabled by default.
28926
28927 @item -mint-register=@var{N}
28928 @opindex mint-register
28929 Specify the number of registers to reserve for fast interrupt handler
28930 functions. The value @var{N} can be between 0 and 4. A value of 1
28931 means that register @code{r13} is reserved for the exclusive use
28932 of fast interrupt handlers. A value of 2 reserves @code{r13} and
28933 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
28934 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
28935 A value of 0, the default, does not reserve any registers.
28936
28937 @item -msave-acc-in-interrupts
28938 @opindex msave-acc-in-interrupts
28939 Specifies that interrupt handler functions should preserve the
28940 accumulator register. This is only necessary if normal code might use
28941 the accumulator register, for example because it performs 64-bit
28942 multiplications. The default is to ignore the accumulator as this
28943 makes the interrupt handlers faster.
28944
28945 @item -mpid
28946 @itemx -mno-pid
28947 @opindex mpid
28948 @opindex mno-pid
28949 Enables the generation of position independent data. When enabled any
28950 access to constant data is done via an offset from a base address
28951 held in a register. This allows the location of constant data to be
28952 determined at run time without requiring the executable to be
28953 relocated, which is a benefit to embedded applications with tight
28954 memory constraints. Data that can be modified is not affected by this
28955 option.
28956
28957 Note, using this feature reserves a register, usually @code{r13}, for
28958 the constant data base address. This can result in slower and/or
28959 larger code, especially in complicated functions.
28960
28961 The actual register chosen to hold the constant data base address
28962 depends upon whether the @option{-msmall-data-limit} and/or the
28963 @option{-mint-register} command-line options are enabled. Starting
28964 with register @code{r13} and proceeding downwards, registers are
28965 allocated first to satisfy the requirements of @option{-mint-register},
28966 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
28967 is possible for the small data area register to be @code{r8} if both
28968 @option{-mint-register=4} and @option{-mpid} are specified on the
28969 command line.
28970
28971 By default this feature is not enabled. The default can be restored
28972 via the @option{-mno-pid} command-line option.
28973
28974 @item -mno-warn-multiple-fast-interrupts
28975 @itemx -mwarn-multiple-fast-interrupts
28976 @opindex mno-warn-multiple-fast-interrupts
28977 @opindex mwarn-multiple-fast-interrupts
28978 Prevents GCC from issuing a warning message if it finds more than one
28979 fast interrupt handler when it is compiling a file. The default is to
28980 issue a warning for each extra fast interrupt handler found, as the RX
28981 only supports one such interrupt.
28982
28983 @item -mallow-string-insns
28984 @itemx -mno-allow-string-insns
28985 @opindex mallow-string-insns
28986 @opindex mno-allow-string-insns
28987 Enables or disables the use of the string manipulation instructions
28988 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
28989 @code{SWHILE} and also the @code{RMPA} instruction. These
28990 instructions may prefetch data, which is not safe to do if accessing
28991 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
28992 for more information).
28993
28994 The default is to allow these instructions, but it is not possible for
28995 GCC to reliably detect all circumstances where a string instruction
28996 might be used to access an I/O register, so their use cannot be
28997 disabled automatically. Instead it is reliant upon the programmer to
28998 use the @option{-mno-allow-string-insns} option if their program
28999 accesses I/O space.
29000
29001 When the instructions are enabled GCC defines the C preprocessor
29002 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
29003 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
29004
29005 @item -mjsr
29006 @itemx -mno-jsr
29007 @opindex mjsr
29008 @opindex mno-jsr
29009 Use only (or not only) @code{JSR} instructions to access functions.
29010 This option can be used when code size exceeds the range of @code{BSR}
29011 instructions. Note that @option{-mno-jsr} does not mean to not use
29012 @code{JSR} but instead means that any type of branch may be used.
29013 @end table
29014
29015 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
29016 has special significance to the RX port when used with the
29017 @code{interrupt} function attribute. This attribute indicates a
29018 function intended to process fast interrupts. GCC ensures
29019 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
29020 and/or @code{r13} and only provided that the normal use of the
29021 corresponding registers have been restricted via the
29022 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
29023 options.
29024
29025 @node S/390 and zSeries Options
29026 @subsection S/390 and zSeries Options
29027 @cindex S/390 and zSeries Options
29028
29029 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
29030
29031 @table @gcctabopt
29032 @item -mhard-float
29033 @itemx -msoft-float
29034 @opindex mhard-float
29035 @opindex msoft-float
29036 Use (do not use) the hardware floating-point instructions and registers
29037 for floating-point operations. When @option{-msoft-float} is specified,
29038 functions in @file{libgcc.a} are used to perform floating-point
29039 operations. When @option{-mhard-float} is specified, the compiler
29040 generates IEEE floating-point instructions. This is the default.
29041
29042 @item -mhard-dfp
29043 @itemx -mno-hard-dfp
29044 @opindex mhard-dfp
29045 @opindex mno-hard-dfp
29046 Use (do not use) the hardware decimal-floating-point instructions for
29047 decimal-floating-point operations. When @option{-mno-hard-dfp} is
29048 specified, functions in @file{libgcc.a} are used to perform
29049 decimal-floating-point operations. When @option{-mhard-dfp} is
29050 specified, the compiler generates decimal-floating-point hardware
29051 instructions. This is the default for @option{-march=z9-ec} or higher.
29052
29053 @item -mlong-double-64
29054 @itemx -mlong-double-128
29055 @opindex mlong-double-64
29056 @opindex mlong-double-128
29057 These switches control the size of @code{long double} type. A size
29058 of 64 bits makes the @code{long double} type equivalent to the @code{double}
29059 type. This is the default.
29060
29061 @item -mbackchain
29062 @itemx -mno-backchain
29063 @opindex mbackchain
29064 @opindex mno-backchain
29065 Store (do not store) the address of the caller's frame as backchain pointer
29066 into the callee's stack frame.
29067 A backchain may be needed to allow debugging using tools that do not understand
29068 DWARF call frame information.
29069 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
29070 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
29071 the backchain is placed into the topmost word of the 96/160 byte register
29072 save area.
29073
29074 In general, code compiled with @option{-mbackchain} is call-compatible with
29075 code compiled with @option{-mno-backchain}; however, use of the backchain
29076 for debugging purposes usually requires that the whole binary is built with
29077 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
29078 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
29079 to build a linux kernel use @option{-msoft-float}.
29080
29081 The default is to not maintain the backchain.
29082
29083 @item -mpacked-stack
29084 @itemx -mno-packed-stack
29085 @opindex mpacked-stack
29086 @opindex mno-packed-stack
29087 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
29088 specified, the compiler uses the all fields of the 96/160 byte register save
29089 area only for their default purpose; unused fields still take up stack space.
29090 When @option{-mpacked-stack} is specified, register save slots are densely
29091 packed at the top of the register save area; unused space is reused for other
29092 purposes, allowing for more efficient use of the available stack space.
29093 However, when @option{-mbackchain} is also in effect, the topmost word of
29094 the save area is always used to store the backchain, and the return address
29095 register is always saved two words below the backchain.
29096
29097 As long as the stack frame backchain is not used, code generated with
29098 @option{-mpacked-stack} is call-compatible with code generated with
29099 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
29100 S/390 or zSeries generated code that uses the stack frame backchain at run
29101 time, not just for debugging purposes. Such code is not call-compatible
29102 with code compiled with @option{-mpacked-stack}. Also, note that the
29103 combination of @option{-mbackchain},
29104 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
29105 to build a linux kernel use @option{-msoft-float}.
29106
29107 The default is to not use the packed stack layout.
29108
29109 @item -msmall-exec
29110 @itemx -mno-small-exec
29111 @opindex msmall-exec
29112 @opindex mno-small-exec
29113 Generate (or do not generate) code using the @code{bras} instruction
29114 to do subroutine calls.
29115 This only works reliably if the total executable size does not
29116 exceed 64k. The default is to use the @code{basr} instruction instead,
29117 which does not have this limitation.
29118
29119 @item -m64
29120 @itemx -m31
29121 @opindex m64
29122 @opindex m31
29123 When @option{-m31} is specified, generate code compliant to the
29124 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
29125 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
29126 particular to generate 64-bit instructions. For the @samp{s390}
29127 targets, the default is @option{-m31}, while the @samp{s390x}
29128 targets default to @option{-m64}.
29129
29130 @item -mzarch
29131 @itemx -mesa
29132 @opindex mzarch
29133 @opindex mesa
29134 When @option{-mzarch} is specified, generate code using the
29135 instructions available on z/Architecture.
29136 When @option{-mesa} is specified, generate code using the
29137 instructions available on ESA/390. Note that @option{-mesa} is
29138 not possible with @option{-m64}.
29139 When generating code compliant to the GNU/Linux for S/390 ABI,
29140 the default is @option{-mesa}. When generating code compliant
29141 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
29142
29143 @item -mhtm
29144 @itemx -mno-htm
29145 @opindex mhtm
29146 @opindex mno-htm
29147 The @option{-mhtm} option enables a set of builtins making use of
29148 instructions available with the transactional execution facility
29149 introduced with the IBM zEnterprise EC12 machine generation
29150 @ref{S/390 System z Built-in Functions}.
29151 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
29152
29153 @item -mvx
29154 @itemx -mno-vx
29155 @opindex mvx
29156 @opindex mno-vx
29157 When @option{-mvx} is specified, generate code using the instructions
29158 available with the vector extension facility introduced with the IBM
29159 z13 machine generation.
29160 This option changes the ABI for some vector type values with regard to
29161 alignment and calling conventions. In case vector type values are
29162 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
29163 command will be added to mark the resulting binary with the ABI used.
29164 @option{-mvx} is enabled by default when using @option{-march=z13}.
29165
29166 @item -mzvector
29167 @itemx -mno-zvector
29168 @opindex mzvector
29169 @opindex mno-zvector
29170 The @option{-mzvector} option enables vector language extensions and
29171 builtins using instructions available with the vector extension
29172 facility introduced with the IBM z13 machine generation.
29173 This option adds support for @samp{vector} to be used as a keyword to
29174 define vector type variables and arguments. @samp{vector} is only
29175 available when GNU extensions are enabled. It will not be expanded
29176 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
29177 In addition to the GCC low-level builtins @option{-mzvector} enables
29178 a set of builtins added for compatibility with AltiVec-style
29179 implementations like Power and Cell. In order to make use of these
29180 builtins the header file @file{vecintrin.h} needs to be included.
29181 @option{-mzvector} is disabled by default.
29182
29183 @item -mmvcle
29184 @itemx -mno-mvcle
29185 @opindex mmvcle
29186 @opindex mno-mvcle
29187 Generate (or do not generate) code using the @code{mvcle} instruction
29188 to perform block moves. When @option{-mno-mvcle} is specified,
29189 use a @code{mvc} loop instead. This is the default unless optimizing for
29190 size.
29191
29192 @item -mdebug
29193 @itemx -mno-debug
29194 @opindex mdebug
29195 @opindex mno-debug
29196 Print (or do not print) additional debug information when compiling.
29197 The default is to not print debug information.
29198
29199 @item -march=@var{cpu-type}
29200 @opindex march
29201 Generate code that runs on @var{cpu-type}, which is the name of a
29202 system representing a certain processor type. Possible values for
29203 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
29204 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
29205 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
29206 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
29207
29208 The default is @option{-march=z900}.
29209
29210 Specifying @samp{native} as cpu type can be used to select the best
29211 architecture option for the host processor.
29212 @option{-march=native} has no effect if GCC does not recognize the
29213 processor.
29214
29215 @item -mtune=@var{cpu-type}
29216 @opindex mtune
29217 Tune to @var{cpu-type} everything applicable about the generated code,
29218 except for the ABI and the set of available instructions.
29219 The list of @var{cpu-type} values is the same as for @option{-march}.
29220 The default is the value used for @option{-march}.
29221
29222 @item -mtpf-trace
29223 @itemx -mno-tpf-trace
29224 @opindex mtpf-trace
29225 @opindex mno-tpf-trace
29226 Generate code that adds (does not add) in TPF OS specific branches to trace
29227 routines in the operating system. This option is off by default, even
29228 when compiling for the TPF OS@.
29229
29230 @item -mtpf-trace-skip
29231 @itemx -mno-tpf-trace-skip
29232 @opindex mtpf-trace-skip
29233 @opindex mno-tpf-trace-skip
29234 Generate code that changes (does not change) the default branch
29235 targets enabled by @option{-mtpf-trace} to point to specialized trace
29236 routines providing the ability of selectively skipping function trace
29237 entries for the TPF OS. This option is off by default, even when
29238 compiling for the TPF OS and specifying @option{-mtpf-trace}.
29239
29240 @item -mfused-madd
29241 @itemx -mno-fused-madd
29242 @opindex mfused-madd
29243 @opindex mno-fused-madd
29244 Generate code that uses (does not use) the floating-point multiply and
29245 accumulate instructions. These instructions are generated by default if
29246 hardware floating point is used.
29247
29248 @item -mwarn-framesize=@var{framesize}
29249 @opindex mwarn-framesize
29250 Emit a warning if the current function exceeds the given frame size. Because
29251 this is a compile-time check it doesn't need to be a real problem when the program
29252 runs. It is intended to identify functions that most probably cause
29253 a stack overflow. It is useful to be used in an environment with limited stack
29254 size e.g.@: the linux kernel.
29255
29256 @item -mwarn-dynamicstack
29257 @opindex mwarn-dynamicstack
29258 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
29259 arrays. This is generally a bad idea with a limited stack size.
29260
29261 @item -mstack-guard=@var{stack-guard}
29262 @itemx -mstack-size=@var{stack-size}
29263 @opindex mstack-guard
29264 @opindex mstack-size
29265 If these options are provided the S/390 back end emits additional instructions in
29266 the function prologue that trigger a trap if the stack size is @var{stack-guard}
29267 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
29268 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
29269 the frame size of the compiled function is chosen.
29270 These options are intended to be used to help debugging stack overflow problems.
29271 The additionally emitted code causes only little overhead and hence can also be
29272 used in production-like systems without greater performance degradation. The given
29273 values have to be exact powers of 2 and @var{stack-size} has to be greater than
29274 @var{stack-guard} without exceeding 64k.
29275 In order to be efficient the extra code makes the assumption that the stack starts
29276 at an address aligned to the value given by @var{stack-size}.
29277 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
29278
29279 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
29280 @opindex mhotpatch
29281 If the hotpatch option is enabled, a ``hot-patching'' function
29282 prologue is generated for all functions in the compilation unit.
29283 The funtion label is prepended with the given number of two-byte
29284 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
29285 the label, 2 * @var{post-halfwords} bytes are appended, using the
29286 largest NOP like instructions the architecture allows (maximum
29287 1000000).
29288
29289 If both arguments are zero, hotpatching is disabled.
29290
29291 This option can be overridden for individual functions with the
29292 @code{hotpatch} attribute.
29293 @end table
29294
29295 @node Score Options
29296 @subsection Score Options
29297 @cindex Score Options
29298
29299 These options are defined for Score implementations:
29300
29301 @table @gcctabopt
29302 @item -meb
29303 @opindex meb
29304 Compile code for big-endian mode. This is the default.
29305
29306 @item -mel
29307 @opindex mel
29308 Compile code for little-endian mode.
29309
29310 @item -mnhwloop
29311 @opindex mnhwloop
29312 Disable generation of @code{bcnz} instructions.
29313
29314 @item -muls
29315 @opindex muls
29316 Enable generation of unaligned load and store instructions.
29317
29318 @item -mmac
29319 @opindex mmac
29320 Enable the use of multiply-accumulate instructions. Disabled by default.
29321
29322 @item -mscore5
29323 @opindex mscore5
29324 Specify the SCORE5 as the target architecture.
29325
29326 @item -mscore5u
29327 @opindex mscore5u
29328 Specify the SCORE5U of the target architecture.
29329
29330 @item -mscore7
29331 @opindex mscore7
29332 Specify the SCORE7 as the target architecture. This is the default.
29333
29334 @item -mscore7d
29335 @opindex mscore7d
29336 Specify the SCORE7D as the target architecture.
29337 @end table
29338
29339 @node SH Options
29340 @subsection SH Options
29341
29342 These @samp{-m} options are defined for the SH implementations:
29343
29344 @table @gcctabopt
29345 @item -m1
29346 @opindex m1
29347 Generate code for the SH1.
29348
29349 @item -m2
29350 @opindex m2
29351 Generate code for the SH2.
29352
29353 @item -m2e
29354 Generate code for the SH2e.
29355
29356 @item -m2a-nofpu
29357 @opindex m2a-nofpu
29358 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
29359 that the floating-point unit is not used.
29360
29361 @item -m2a-single-only
29362 @opindex m2a-single-only
29363 Generate code for the SH2a-FPU, in such a way that no double-precision
29364 floating-point operations are used.
29365
29366 @item -m2a-single
29367 @opindex m2a-single
29368 Generate code for the SH2a-FPU assuming the floating-point unit is in
29369 single-precision mode by default.
29370
29371 @item -m2a
29372 @opindex m2a
29373 Generate code for the SH2a-FPU assuming the floating-point unit is in
29374 double-precision mode by default.
29375
29376 @item -m3
29377 @opindex m3
29378 Generate code for the SH3.
29379
29380 @item -m3e
29381 @opindex m3e
29382 Generate code for the SH3e.
29383
29384 @item -m4-nofpu
29385 @opindex m4-nofpu
29386 Generate code for the SH4 without a floating-point unit.
29387
29388 @item -m4-single-only
29389 @opindex m4-single-only
29390 Generate code for the SH4 with a floating-point unit that only
29391 supports single-precision arithmetic.
29392
29393 @item -m4-single
29394 @opindex m4-single
29395 Generate code for the SH4 assuming the floating-point unit is in
29396 single-precision mode by default.
29397
29398 @item -m4
29399 @opindex m4
29400 Generate code for the SH4.
29401
29402 @item -m4-100
29403 @opindex m4-100
29404 Generate code for SH4-100.
29405
29406 @item -m4-100-nofpu
29407 @opindex m4-100-nofpu
29408 Generate code for SH4-100 in such a way that the
29409 floating-point unit is not used.
29410
29411 @item -m4-100-single
29412 @opindex m4-100-single
29413 Generate code for SH4-100 assuming the floating-point unit is in
29414 single-precision mode by default.
29415
29416 @item -m4-100-single-only
29417 @opindex m4-100-single-only
29418 Generate code for SH4-100 in such a way that no double-precision
29419 floating-point operations are used.
29420
29421 @item -m4-200
29422 @opindex m4-200
29423 Generate code for SH4-200.
29424
29425 @item -m4-200-nofpu
29426 @opindex m4-200-nofpu
29427 Generate code for SH4-200 without in such a way that the
29428 floating-point unit is not used.
29429
29430 @item -m4-200-single
29431 @opindex m4-200-single
29432 Generate code for SH4-200 assuming the floating-point unit is in
29433 single-precision mode by default.
29434
29435 @item -m4-200-single-only
29436 @opindex m4-200-single-only
29437 Generate code for SH4-200 in such a way that no double-precision
29438 floating-point operations are used.
29439
29440 @item -m4-300
29441 @opindex m4-300
29442 Generate code for SH4-300.
29443
29444 @item -m4-300-nofpu
29445 @opindex m4-300-nofpu
29446 Generate code for SH4-300 without in such a way that the
29447 floating-point unit is not used.
29448
29449 @item -m4-300-single
29450 @opindex m4-300-single
29451 Generate code for SH4-300 in such a way that no double-precision
29452 floating-point operations are used.
29453
29454 @item -m4-300-single-only
29455 @opindex m4-300-single-only
29456 Generate code for SH4-300 in such a way that no double-precision
29457 floating-point operations are used.
29458
29459 @item -m4-340
29460 @opindex m4-340
29461 Generate code for SH4-340 (no MMU, no FPU).
29462
29463 @item -m4-500
29464 @opindex m4-500
29465 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
29466 assembler.
29467
29468 @item -m4a-nofpu
29469 @opindex m4a-nofpu
29470 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
29471 floating-point unit is not used.
29472
29473 @item -m4a-single-only
29474 @opindex m4a-single-only
29475 Generate code for the SH4a, in such a way that no double-precision
29476 floating-point operations are used.
29477
29478 @item -m4a-single
29479 @opindex m4a-single
29480 Generate code for the SH4a assuming the floating-point unit is in
29481 single-precision mode by default.
29482
29483 @item -m4a
29484 @opindex m4a
29485 Generate code for the SH4a.
29486
29487 @item -m4al
29488 @opindex m4al
29489 Same as @option{-m4a-nofpu}, except that it implicitly passes
29490 @option{-dsp} to the assembler. GCC doesn't generate any DSP
29491 instructions at the moment.
29492
29493 @item -mb
29494 @opindex mb
29495 Compile code for the processor in big-endian mode.
29496
29497 @item -ml
29498 @opindex ml
29499 Compile code for the processor in little-endian mode.
29500
29501 @item -mdalign
29502 @opindex mdalign
29503 Align doubles at 64-bit boundaries. Note that this changes the calling
29504 conventions, and thus some functions from the standard C library do
29505 not work unless you recompile it first with @option{-mdalign}.
29506
29507 @item -mrelax
29508 @opindex mrelax
29509 Shorten some address references at link time, when possible; uses the
29510 linker option @option{-relax}.
29511
29512 @item -mbigtable
29513 @opindex mbigtable
29514 Use 32-bit offsets in @code{switch} tables. The default is to use
29515 16-bit offsets.
29516
29517 @item -mbitops
29518 @opindex mbitops
29519 Enable the use of bit manipulation instructions on SH2A.
29520
29521 @item -mfmovd
29522 @opindex mfmovd
29523 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
29524 alignment constraints.
29525
29526 @item -mrenesas
29527 @opindex mrenesas
29528 Comply with the calling conventions defined by Renesas.
29529
29530 @item -mno-renesas
29531 @opindex mno-renesas
29532 Comply with the calling conventions defined for GCC before the Renesas
29533 conventions were available. This option is the default for all
29534 targets of the SH toolchain.
29535
29536 @item -mnomacsave
29537 @opindex mnomacsave
29538 Mark the @code{MAC} register as call-clobbered, even if
29539 @option{-mrenesas} is given.
29540
29541 @item -mieee
29542 @itemx -mno-ieee
29543 @opindex mieee
29544 @opindex mno-ieee
29545 Control the IEEE compliance of floating-point comparisons, which affects the
29546 handling of cases where the result of a comparison is unordered. By default
29547 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
29548 enabled @option{-mno-ieee} is implicitly set, which results in faster
29549 floating-point greater-equal and less-equal comparisons. The implicit settings
29550 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
29551
29552 @item -minline-ic_invalidate
29553 @opindex minline-ic_invalidate
29554 Inline code to invalidate instruction cache entries after setting up
29555 nested function trampolines.
29556 This option has no effect if @option{-musermode} is in effect and the selected
29557 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
29558 instruction.
29559 If the selected code generation option does not allow the use of the @code{icbi}
29560 instruction, and @option{-musermode} is not in effect, the inlined code
29561 manipulates the instruction cache address array directly with an associative
29562 write. This not only requires privileged mode at run time, but it also
29563 fails if the cache line had been mapped via the TLB and has become unmapped.
29564
29565 @item -misize
29566 @opindex misize
29567 Dump instruction size and location in the assembly code.
29568
29569 @item -mpadstruct
29570 @opindex mpadstruct
29571 This option is deprecated. It pads structures to multiple of 4 bytes,
29572 which is incompatible with the SH ABI@.
29573
29574 @item -matomic-model=@var{model}
29575 @opindex matomic-model=@var{model}
29576 Sets the model of atomic operations and additional parameters as a comma
29577 separated list. For details on the atomic built-in functions see
29578 @ref{__atomic Builtins}. The following models and parameters are supported:
29579
29580 @table @samp
29581
29582 @item none
29583 Disable compiler generated atomic sequences and emit library calls for atomic
29584 operations. This is the default if the target is not @code{sh*-*-linux*}.
29585
29586 @item soft-gusa
29587 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
29588 built-in functions. The generated atomic sequences require additional support
29589 from the interrupt/exception handling code of the system and are only suitable
29590 for SH3* and SH4* single-core systems. This option is enabled by default when
29591 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
29592 this option also partially utilizes the hardware atomic instructions
29593 @code{movli.l} and @code{movco.l} to create more efficient code, unless
29594 @samp{strict} is specified.
29595
29596 @item soft-tcb
29597 Generate software atomic sequences that use a variable in the thread control
29598 block. This is a variation of the gUSA sequences which can also be used on
29599 SH1* and SH2* targets. The generated atomic sequences require additional
29600 support from the interrupt/exception handling code of the system and are only
29601 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
29602 parameter has to be specified as well.
29603
29604 @item soft-imask
29605 Generate software atomic sequences that temporarily disable interrupts by
29606 setting @code{SR.IMASK = 1111}. This model works only when the program runs
29607 in privileged mode and is only suitable for single-core systems. Additional
29608 support from the interrupt/exception handling code of the system is not
29609 required. This model is enabled by default when the target is
29610 @code{sh*-*-linux*} and SH1* or SH2*.
29611
29612 @item hard-llcs
29613 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
29614 instructions only. This is only available on SH4A and is suitable for
29615 multi-core systems. Since the hardware instructions support only 32 bit atomic
29616 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
29617 Code compiled with this option is also compatible with other software
29618 atomic model interrupt/exception handling systems if executed on an SH4A
29619 system. Additional support from the interrupt/exception handling code of the
29620 system is not required for this model.
29621
29622 @item gbr-offset=
29623 This parameter specifies the offset in bytes of the variable in the thread
29624 control block structure that should be used by the generated atomic sequences
29625 when the @samp{soft-tcb} model has been selected. For other models this
29626 parameter is ignored. The specified value must be an integer multiple of four
29627 and in the range 0-1020.
29628
29629 @item strict
29630 This parameter prevents mixed usage of multiple atomic models, even if they
29631 are compatible, and makes the compiler generate atomic sequences of the
29632 specified model only.
29633
29634 @end table
29635
29636 @item -mtas
29637 @opindex mtas
29638 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
29639 Notice that depending on the particular hardware and software configuration
29640 this can degrade overall performance due to the operand cache line flushes
29641 that are implied by the @code{tas.b} instruction. On multi-core SH4A
29642 processors the @code{tas.b} instruction must be used with caution since it
29643 can result in data corruption for certain cache configurations.
29644
29645 @item -mprefergot
29646 @opindex mprefergot
29647 When generating position-independent code, emit function calls using
29648 the Global Offset Table instead of the Procedure Linkage Table.
29649
29650 @item -musermode
29651 @itemx -mno-usermode
29652 @opindex musermode
29653 @opindex mno-usermode
29654 Don't allow (allow) the compiler generating privileged mode code. Specifying
29655 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
29656 inlined code would not work in user mode. @option{-musermode} is the default
29657 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
29658 @option{-musermode} has no effect, since there is no user mode.
29659
29660 @item -multcost=@var{number}
29661 @opindex multcost=@var{number}
29662 Set the cost to assume for a multiply insn.
29663
29664 @item -mdiv=@var{strategy}
29665 @opindex mdiv=@var{strategy}
29666 Set the division strategy to be used for integer division operations.
29667 @var{strategy} can be one of:
29668
29669 @table @samp
29670
29671 @item call-div1
29672 Calls a library function that uses the single-step division instruction
29673 @code{div1} to perform the operation. Division by zero calculates an
29674 unspecified result and does not trap. This is the default except for SH4,
29675 SH2A and SHcompact.
29676
29677 @item call-fp
29678 Calls a library function that performs the operation in double precision
29679 floating point. Division by zero causes a floating-point exception. This is
29680 the default for SHcompact with FPU. Specifying this for targets that do not
29681 have a double precision FPU defaults to @code{call-div1}.
29682
29683 @item call-table
29684 Calls a library function that uses a lookup table for small divisors and
29685 the @code{div1} instruction with case distinction for larger divisors. Division
29686 by zero calculates an unspecified result and does not trap. This is the default
29687 for SH4. Specifying this for targets that do not have dynamic shift
29688 instructions defaults to @code{call-div1}.
29689
29690 @end table
29691
29692 When a division strategy has not been specified the default strategy is
29693 selected based on the current target. For SH2A the default strategy is to
29694 use the @code{divs} and @code{divu} instructions instead of library function
29695 calls.
29696
29697 @item -maccumulate-outgoing-args
29698 @opindex maccumulate-outgoing-args
29699 Reserve space once for outgoing arguments in the function prologue rather
29700 than around each call. Generally beneficial for performance and size. Also
29701 needed for unwinding to avoid changing the stack frame around conditional code.
29702
29703 @item -mdivsi3_libfunc=@var{name}
29704 @opindex mdivsi3_libfunc=@var{name}
29705 Set the name of the library function used for 32-bit signed division to
29706 @var{name}.
29707 This only affects the name used in the @samp{call} division strategies, and
29708 the compiler still expects the same sets of input/output/clobbered registers as
29709 if this option were not present.
29710
29711 @item -mfixed-range=@var{register-range}
29712 @opindex mfixed-range
29713 Generate code treating the given register range as fixed registers.
29714 A fixed register is one that the register allocator cannot use. This is
29715 useful when compiling kernel code. A register range is specified as
29716 two registers separated by a dash. Multiple register ranges can be
29717 specified separated by a comma.
29718
29719 @item -mbranch-cost=@var{num}
29720 @opindex mbranch-cost=@var{num}
29721 Assume @var{num} to be the cost for a branch instruction. Higher numbers
29722 make the compiler try to generate more branch-free code if possible.
29723 If not specified the value is selected depending on the processor type that
29724 is being compiled for.
29725
29726 @item -mzdcbranch
29727 @itemx -mno-zdcbranch
29728 @opindex mzdcbranch
29729 @opindex mno-zdcbranch
29730 Assume (do not assume) that zero displacement conditional branch instructions
29731 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
29732 compiler prefers zero displacement branch code sequences. This is
29733 enabled by default when generating code for SH4 and SH4A. It can be explicitly
29734 disabled by specifying @option{-mno-zdcbranch}.
29735
29736 @item -mcbranch-force-delay-slot
29737 @opindex mcbranch-force-delay-slot
29738 Force the usage of delay slots for conditional branches, which stuffs the delay
29739 slot with a @code{nop} if a suitable instruction cannot be found. By default
29740 this option is disabled. It can be enabled to work around hardware bugs as
29741 found in the original SH7055.
29742
29743 @item -mfused-madd
29744 @itemx -mno-fused-madd
29745 @opindex mfused-madd
29746 @opindex mno-fused-madd
29747 Generate code that uses (does not use) the floating-point multiply and
29748 accumulate instructions. These instructions are generated by default
29749 if hardware floating point is used. The machine-dependent
29750 @option{-mfused-madd} option is now mapped to the machine-independent
29751 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29752 mapped to @option{-ffp-contract=off}.
29753
29754 @item -mfsca
29755 @itemx -mno-fsca
29756 @opindex mfsca
29757 @opindex mno-fsca
29758 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
29759 and cosine approximations. The option @option{-mfsca} must be used in
29760 combination with @option{-funsafe-math-optimizations}. It is enabled by default
29761 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
29762 approximations even if @option{-funsafe-math-optimizations} is in effect.
29763
29764 @item -mfsrra
29765 @itemx -mno-fsrra
29766 @opindex mfsrra
29767 @opindex mno-fsrra
29768 Allow or disallow the compiler to emit the @code{fsrra} instruction for
29769 reciprocal square root approximations. The option @option{-mfsrra} must be used
29770 in combination with @option{-funsafe-math-optimizations} and
29771 @option{-ffinite-math-only}. It is enabled by default when generating code for
29772 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
29773 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
29774 in effect.
29775
29776 @item -mpretend-cmove
29777 @opindex mpretend-cmove
29778 Prefer zero-displacement conditional branches for conditional move instruction
29779 patterns. This can result in faster code on the SH4 processor.
29780
29781 @item -mfdpic
29782 @opindex fdpic
29783 Generate code using the FDPIC ABI.
29784
29785 @end table
29786
29787 @node Solaris 2 Options
29788 @subsection Solaris 2 Options
29789 @cindex Solaris 2 options
29790
29791 These @samp{-m} options are supported on Solaris 2:
29792
29793 @table @gcctabopt
29794 @item -mclear-hwcap
29795 @opindex mclear-hwcap
29796 @option{-mclear-hwcap} tells the compiler to remove the hardware
29797 capabilities generated by the Solaris assembler. This is only necessary
29798 when object files use ISA extensions not supported by the current
29799 machine, but check at runtime whether or not to use them.
29800
29801 @item -mimpure-text
29802 @opindex mimpure-text
29803 @option{-mimpure-text}, used in addition to @option{-shared}, tells
29804 the compiler to not pass @option{-z text} to the linker when linking a
29805 shared object. Using this option, you can link position-dependent
29806 code into a shared object.
29807
29808 @option{-mimpure-text} suppresses the ``relocations remain against
29809 allocatable but non-writable sections'' linker error message.
29810 However, the necessary relocations trigger copy-on-write, and the
29811 shared object is not actually shared across processes. Instead of
29812 using @option{-mimpure-text}, you should compile all source code with
29813 @option{-fpic} or @option{-fPIC}.
29814
29815 @end table
29816
29817 These switches are supported in addition to the above on Solaris 2:
29818
29819 @table @gcctabopt
29820 @item -pthreads
29821 @opindex pthreads
29822 This is a synonym for @option{-pthread}.
29823 @end table
29824
29825 @node SPARC Options
29826 @subsection SPARC Options
29827 @cindex SPARC options
29828
29829 These @samp{-m} options are supported on the SPARC:
29830
29831 @table @gcctabopt
29832 @item -mno-app-regs
29833 @itemx -mapp-regs
29834 @opindex mno-app-regs
29835 @opindex mapp-regs
29836 Specify @option{-mapp-regs} to generate output using the global registers
29837 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
29838 global register 1, each global register 2 through 4 is then treated as an
29839 allocable register that is clobbered by function calls. This is the default.
29840
29841 To be fully SVR4 ABI-compliant at the cost of some performance loss,
29842 specify @option{-mno-app-regs}. You should compile libraries and system
29843 software with this option.
29844
29845 @item -mflat
29846 @itemx -mno-flat
29847 @opindex mflat
29848 @opindex mno-flat
29849 With @option{-mflat}, the compiler does not generate save/restore instructions
29850 and uses a ``flat'' or single register window model. This model is compatible
29851 with the regular register window model. The local registers and the input
29852 registers (0--5) are still treated as ``call-saved'' registers and are
29853 saved on the stack as needed.
29854
29855 With @option{-mno-flat} (the default), the compiler generates save/restore
29856 instructions (except for leaf functions). This is the normal operating mode.
29857
29858 @item -mfpu
29859 @itemx -mhard-float
29860 @opindex mfpu
29861 @opindex mhard-float
29862 Generate output containing floating-point instructions. This is the
29863 default.
29864
29865 @item -mno-fpu
29866 @itemx -msoft-float
29867 @opindex mno-fpu
29868 @opindex msoft-float
29869 Generate output containing library calls for floating point.
29870 @strong{Warning:} the requisite libraries are not available for all SPARC
29871 targets. Normally the facilities of the machine's usual C compiler are
29872 used, but this cannot be done directly in cross-compilation. You must make
29873 your own arrangements to provide suitable library functions for
29874 cross-compilation. The embedded targets @samp{sparc-*-aout} and
29875 @samp{sparclite-*-*} do provide software floating-point support.
29876
29877 @option{-msoft-float} changes the calling convention in the output file;
29878 therefore, it is only useful if you compile @emph{all} of a program with
29879 this option. In particular, you need to compile @file{libgcc.a}, the
29880 library that comes with GCC, with @option{-msoft-float} in order for
29881 this to work.
29882
29883 @item -mhard-quad-float
29884 @opindex mhard-quad-float
29885 Generate output containing quad-word (long double) floating-point
29886 instructions.
29887
29888 @item -msoft-quad-float
29889 @opindex msoft-quad-float
29890 Generate output containing library calls for quad-word (long double)
29891 floating-point instructions. The functions called are those specified
29892 in the SPARC ABI@. This is the default.
29893
29894 As of this writing, there are no SPARC implementations that have hardware
29895 support for the quad-word floating-point instructions. They all invoke
29896 a trap handler for one of these instructions, and then the trap handler
29897 emulates the effect of the instruction. Because of the trap handler overhead,
29898 this is much slower than calling the ABI library routines. Thus the
29899 @option{-msoft-quad-float} option is the default.
29900
29901 @item -mno-unaligned-doubles
29902 @itemx -munaligned-doubles
29903 @opindex mno-unaligned-doubles
29904 @opindex munaligned-doubles
29905 Assume that doubles have 8-byte alignment. This is the default.
29906
29907 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
29908 alignment only if they are contained in another type, or if they have an
29909 absolute address. Otherwise, it assumes they have 4-byte alignment.
29910 Specifying this option avoids some rare compatibility problems with code
29911 generated by other compilers. It is not the default because it results
29912 in a performance loss, especially for floating-point code.
29913
29914 @item -muser-mode
29915 @itemx -mno-user-mode
29916 @opindex muser-mode
29917 @opindex mno-user-mode
29918 Do not generate code that can only run in supervisor mode. This is relevant
29919 only for the @code{casa} instruction emitted for the LEON3 processor. This
29920 is the default.
29921
29922 @item -mfaster-structs
29923 @itemx -mno-faster-structs
29924 @opindex mfaster-structs
29925 @opindex mno-faster-structs
29926 With @option{-mfaster-structs}, the compiler assumes that structures
29927 should have 8-byte alignment. This enables the use of pairs of
29928 @code{ldd} and @code{std} instructions for copies in structure
29929 assignment, in place of twice as many @code{ld} and @code{st} pairs.
29930 However, the use of this changed alignment directly violates the SPARC
29931 ABI@. Thus, it's intended only for use on targets where the developer
29932 acknowledges that their resulting code is not directly in line with
29933 the rules of the ABI@.
29934
29935 @item -mstd-struct-return
29936 @itemx -mno-std-struct-return
29937 @opindex mstd-struct-return
29938 @opindex mno-std-struct-return
29939 With @option{-mstd-struct-return}, the compiler generates checking code
29940 in functions returning structures or unions to detect size mismatches
29941 between the two sides of function calls, as per the 32-bit ABI@.
29942
29943 The default is @option{-mno-std-struct-return}. This option has no effect
29944 in 64-bit mode.
29945
29946 @item -mlra
29947 @itemx -mno-lra
29948 @opindex mlra
29949 @opindex mno-lra
29950 Enable Local Register Allocation. This is the default for SPARC since GCC 7
29951 so @option{-mno-lra} needs to be passed to get old Reload.
29952
29953 @item -mcpu=@var{cpu_type}
29954 @opindex mcpu
29955 Set the instruction set, register set, and instruction scheduling parameters
29956 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
29957 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
29958 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
29959 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
29960 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
29961 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
29962 @samp{m8}.
29963
29964 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
29965 which selects the best architecture option for the host processor.
29966 @option{-mcpu=native} has no effect if GCC does not recognize
29967 the processor.
29968
29969 Default instruction scheduling parameters are used for values that select
29970 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
29971 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
29972
29973 Here is a list of each supported architecture and their supported
29974 implementations.
29975
29976 @table @asis
29977 @item v7
29978 cypress, leon3v7
29979
29980 @item v8
29981 supersparc, hypersparc, leon, leon3, leon5
29982
29983 @item sparclite
29984 f930, f934, sparclite86x
29985
29986 @item sparclet
29987 tsc701
29988
29989 @item v9
29990 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
29991 niagara7, m8
29992 @end table
29993
29994 By default (unless configured otherwise), GCC generates code for the V7
29995 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
29996 additionally optimizes it for the Cypress CY7C602 chip, as used in the
29997 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
29998 SPARCStation 1, 2, IPX etc.
29999
30000 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
30001 architecture. The only difference from V7 code is that the compiler emits
30002 the integer multiply and integer divide instructions which exist in SPARC-V8
30003 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
30004 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
30005 2000 series.
30006
30007 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
30008 the SPARC architecture. This adds the integer multiply, integer divide step
30009 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
30010 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
30011 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
30012 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
30013 MB86934 chip, which is the more recent SPARClite with FPU@.
30014
30015 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
30016 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
30017 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
30018 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
30019 optimizes it for the TEMIC SPARClet chip.
30020
30021 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
30022 architecture. This adds 64-bit integer and floating-point move instructions,
30023 3 additional floating-point condition code registers and conditional move
30024 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
30025 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
30026 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
30027 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
30028 @option{-mcpu=niagara}, the compiler additionally optimizes it for
30029 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
30030 additionally optimizes it for Sun UltraSPARC T2 chips. With
30031 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
30032 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
30033 additionally optimizes it for Sun UltraSPARC T4 chips. With
30034 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
30035 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
30036 additionally optimizes it for Oracle M8 chips.
30037
30038 @item -mtune=@var{cpu_type}
30039 @opindex mtune
30040 Set the instruction scheduling parameters for machine type
30041 @var{cpu_type}, but do not set the instruction set or register set that the
30042 option @option{-mcpu=@var{cpu_type}} does.
30043
30044 The same values for @option{-mcpu=@var{cpu_type}} can be used for
30045 @option{-mtune=@var{cpu_type}}, but the only useful values are those
30046 that select a particular CPU implementation. Those are
30047 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
30048 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
30049 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
30050 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
30051 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
30052 and GNU/Linux toolchains, @samp{native} can also be used.
30053
30054 @item -mv8plus
30055 @itemx -mno-v8plus
30056 @opindex mv8plus
30057 @opindex mno-v8plus
30058 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
30059 difference from the V8 ABI is that the global and out registers are
30060 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
30061 mode for all SPARC-V9 processors.
30062
30063 @item -mvis
30064 @itemx -mno-vis
30065 @opindex mvis
30066 @opindex mno-vis
30067 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
30068 Visual Instruction Set extensions. The default is @option{-mno-vis}.
30069
30070 @item -mvis2
30071 @itemx -mno-vis2
30072 @opindex mvis2
30073 @opindex mno-vis2
30074 With @option{-mvis2}, GCC generates code that takes advantage of
30075 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
30076 default is @option{-mvis2} when targeting a cpu that supports such
30077 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
30078 also sets @option{-mvis}.
30079
30080 @item -mvis3
30081 @itemx -mno-vis3
30082 @opindex mvis3
30083 @opindex mno-vis3
30084 With @option{-mvis3}, GCC generates code that takes advantage of
30085 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
30086 default is @option{-mvis3} when targeting a cpu that supports such
30087 instructions, such as niagara-3 and later. Setting @option{-mvis3}
30088 also sets @option{-mvis2} and @option{-mvis}.
30089
30090 @item -mvis4
30091 @itemx -mno-vis4
30092 @opindex mvis4
30093 @opindex mno-vis4
30094 With @option{-mvis4}, GCC generates code that takes advantage of
30095 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
30096 default is @option{-mvis4} when targeting a cpu that supports such
30097 instructions, such as niagara-7 and later. Setting @option{-mvis4}
30098 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
30099
30100 @item -mvis4b
30101 @itemx -mno-vis4b
30102 @opindex mvis4b
30103 @opindex mno-vis4b
30104 With @option{-mvis4b}, GCC generates code that takes advantage of
30105 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
30106 the additional VIS instructions introduced in the Oracle SPARC
30107 Architecture 2017. The default is @option{-mvis4b} when targeting a
30108 cpu that supports such instructions, such as m8 and later. Setting
30109 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
30110 @option{-mvis2} and @option{-mvis}.
30111
30112 @item -mcbcond
30113 @itemx -mno-cbcond
30114 @opindex mcbcond
30115 @opindex mno-cbcond
30116 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
30117 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
30118 when targeting a CPU that supports such instructions, such as Niagara-4 and
30119 later.
30120
30121 @item -mfmaf
30122 @itemx -mno-fmaf
30123 @opindex mfmaf
30124 @opindex mno-fmaf
30125 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
30126 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
30127 when targeting a CPU that supports such instructions, such as Niagara-3 and
30128 later.
30129
30130 @item -mfsmuld
30131 @itemx -mno-fsmuld
30132 @opindex mfsmuld
30133 @opindex mno-fsmuld
30134 With @option{-mfsmuld}, GCC generates code that takes advantage of the
30135 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
30136 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
30137 or V9 with FPU except @option{-mcpu=leon}.
30138
30139 @item -mpopc
30140 @itemx -mno-popc
30141 @opindex mpopc
30142 @opindex mno-popc
30143 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
30144 Population Count instruction. The default is @option{-mpopc}
30145 when targeting a CPU that supports such an instruction, such as Niagara-2 and
30146 later.
30147
30148 @item -msubxc
30149 @itemx -mno-subxc
30150 @opindex msubxc
30151 @opindex mno-subxc
30152 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
30153 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
30154 when targeting a CPU that supports such an instruction, such as Niagara-7 and
30155 later.
30156
30157 @item -mfix-at697f
30158 @opindex mfix-at697f
30159 Enable the documented workaround for the single erratum of the Atmel AT697F
30160 processor (which corresponds to erratum #13 of the AT697E processor).
30161
30162 @item -mfix-ut699
30163 @opindex mfix-ut699
30164 Enable the documented workarounds for the floating-point errata and the data
30165 cache nullify errata of the UT699 processor.
30166
30167 @item -mfix-ut700
30168 @opindex mfix-ut700
30169 Enable the documented workaround for the back-to-back store errata of
30170 the UT699E/UT700 processor.
30171
30172 @item -mfix-gr712rc
30173 @opindex mfix-gr712rc
30174 Enable the documented workaround for the back-to-back store errata of
30175 the GR712RC processor.
30176 @end table
30177
30178 These @samp{-m} options are supported in addition to the above
30179 on SPARC-V9 processors in 64-bit environments:
30180
30181 @table @gcctabopt
30182 @item -m32
30183 @itemx -m64
30184 @opindex m32
30185 @opindex m64
30186 Generate code for a 32-bit or 64-bit environment.
30187 The 32-bit environment sets int, long and pointer to 32 bits.
30188 The 64-bit environment sets int to 32 bits and long and pointer
30189 to 64 bits.
30190
30191 @item -mcmodel=@var{which}
30192 @opindex mcmodel
30193 Set the code model to one of
30194
30195 @table @samp
30196 @item medlow
30197 The Medium/Low code model: 64-bit addresses, programs
30198 must be linked in the low 32 bits of memory. Programs can be statically
30199 or dynamically linked.
30200
30201 @item medmid
30202 The Medium/Middle code model: 64-bit addresses, programs
30203 must be linked in the low 44 bits of memory, the text and data segments must
30204 be less than 2GB in size and the data segment must be located within 2GB of
30205 the text segment.
30206
30207 @item medany
30208 The Medium/Anywhere code model: 64-bit addresses, programs
30209 may be linked anywhere in memory, the text and data segments must be less
30210 than 2GB in size and the data segment must be located within 2GB of the
30211 text segment.
30212
30213 @item embmedany
30214 The Medium/Anywhere code model for embedded systems:
30215 64-bit addresses, the text and data segments must be less than 2GB in
30216 size, both starting anywhere in memory (determined at link time). The
30217 global register %g4 points to the base of the data segment. Programs
30218 are statically linked and PIC is not supported.
30219 @end table
30220
30221 @item -mmemory-model=@var{mem-model}
30222 @opindex mmemory-model
30223 Set the memory model in force on the processor to one of
30224
30225 @table @samp
30226 @item default
30227 The default memory model for the processor and operating system.
30228
30229 @item rmo
30230 Relaxed Memory Order
30231
30232 @item pso
30233 Partial Store Order
30234
30235 @item tso
30236 Total Store Order
30237
30238 @item sc
30239 Sequential Consistency
30240 @end table
30241
30242 These memory models are formally defined in Appendix D of the SPARC-V9
30243 architecture manual, as set in the processor's @code{PSTATE.MM} field.
30244
30245 @item -mstack-bias
30246 @itemx -mno-stack-bias
30247 @opindex mstack-bias
30248 @opindex mno-stack-bias
30249 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
30250 frame pointer if present, are offset by @minus{}2047 which must be added back
30251 when making stack frame references. This is the default in 64-bit mode.
30252 Otherwise, assume no such offset is present.
30253 @end table
30254
30255 @node System V Options
30256 @subsection Options for System V
30257
30258 These additional options are available on System V Release 4 for
30259 compatibility with other compilers on those systems:
30260
30261 @table @gcctabopt
30262 @item -G
30263 @opindex G
30264 Create a shared object.
30265 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
30266
30267 @item -Qy
30268 @opindex Qy
30269 Identify the versions of each tool used by the compiler, in a
30270 @code{.ident} assembler directive in the output.
30271
30272 @item -Qn
30273 @opindex Qn
30274 Refrain from adding @code{.ident} directives to the output file (this is
30275 the default).
30276
30277 @item -YP,@var{dirs}
30278 @opindex YP
30279 Search the directories @var{dirs}, and no others, for libraries
30280 specified with @option{-l}.
30281
30282 @item -Ym,@var{dir}
30283 @opindex Ym
30284 Look in the directory @var{dir} to find the M4 preprocessor.
30285 The assembler uses this option.
30286 @c This is supposed to go with a -Yd for predefined M4 macro files, but
30287 @c the generic assembler that comes with Solaris takes just -Ym.
30288 @end table
30289
30290 @node TILE-Gx Options
30291 @subsection TILE-Gx Options
30292 @cindex TILE-Gx options
30293
30294 These @samp{-m} options are supported on the TILE-Gx:
30295
30296 @table @gcctabopt
30297 @item -mcmodel=small
30298 @opindex mcmodel=small
30299 Generate code for the small model. The distance for direct calls is
30300 limited to 500M in either direction. PC-relative addresses are 32
30301 bits. Absolute addresses support the full address range.
30302
30303 @item -mcmodel=large
30304 @opindex mcmodel=large
30305 Generate code for the large model. There is no limitation on call
30306 distance, pc-relative addresses, or absolute addresses.
30307
30308 @item -mcpu=@var{name}
30309 @opindex mcpu
30310 Selects the type of CPU to be targeted. Currently the only supported
30311 type is @samp{tilegx}.
30312
30313 @item -m32
30314 @itemx -m64
30315 @opindex m32
30316 @opindex m64
30317 Generate code for a 32-bit or 64-bit environment. The 32-bit
30318 environment sets int, long, and pointer to 32 bits. The 64-bit
30319 environment sets int to 32 bits and long and pointer to 64 bits.
30320
30321 @item -mbig-endian
30322 @itemx -mlittle-endian
30323 @opindex mbig-endian
30324 @opindex mlittle-endian
30325 Generate code in big/little endian mode, respectively.
30326 @end table
30327
30328 @node TILEPro Options
30329 @subsection TILEPro Options
30330 @cindex TILEPro options
30331
30332 These @samp{-m} options are supported on the TILEPro:
30333
30334 @table @gcctabopt
30335 @item -mcpu=@var{name}
30336 @opindex mcpu
30337 Selects the type of CPU to be targeted. Currently the only supported
30338 type is @samp{tilepro}.
30339
30340 @item -m32
30341 @opindex m32
30342 Generate code for a 32-bit environment, which sets int, long, and
30343 pointer to 32 bits. This is the only supported behavior so the flag
30344 is essentially ignored.
30345 @end table
30346
30347 @node V850 Options
30348 @subsection V850 Options
30349 @cindex V850 Options
30350
30351 These @samp{-m} options are defined for V850 implementations:
30352
30353 @table @gcctabopt
30354 @item -mlong-calls
30355 @itemx -mno-long-calls
30356 @opindex mlong-calls
30357 @opindex mno-long-calls
30358 Treat all calls as being far away (near). If calls are assumed to be
30359 far away, the compiler always loads the function's address into a
30360 register, and calls indirect through the pointer.
30361
30362 @item -mno-ep
30363 @itemx -mep
30364 @opindex mno-ep
30365 @opindex mep
30366 Do not optimize (do optimize) basic blocks that use the same index
30367 pointer 4 or more times to copy pointer into the @code{ep} register, and
30368 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
30369 option is on by default if you optimize.
30370
30371 @item -mno-prolog-function
30372 @itemx -mprolog-function
30373 @opindex mno-prolog-function
30374 @opindex mprolog-function
30375 Do not use (do use) external functions to save and restore registers
30376 at the prologue and epilogue of a function. The external functions
30377 are slower, but use less code space if more than one function saves
30378 the same number of registers. The @option{-mprolog-function} option
30379 is on by default if you optimize.
30380
30381 @item -mspace
30382 @opindex mspace
30383 Try to make the code as small as possible. At present, this just turns
30384 on the @option{-mep} and @option{-mprolog-function} options.
30385
30386 @item -mtda=@var{n}
30387 @opindex mtda
30388 Put static or global variables whose size is @var{n} bytes or less into
30389 the tiny data area that register @code{ep} points to. The tiny data
30390 area can hold up to 256 bytes in total (128 bytes for byte references).
30391
30392 @item -msda=@var{n}
30393 @opindex msda
30394 Put static or global variables whose size is @var{n} bytes or less into
30395 the small data area that register @code{gp} points to. The small data
30396 area can hold up to 64 kilobytes.
30397
30398 @item -mzda=@var{n}
30399 @opindex mzda
30400 Put static or global variables whose size is @var{n} bytes or less into
30401 the first 32 kilobytes of memory.
30402
30403 @item -mv850
30404 @opindex mv850
30405 Specify that the target processor is the V850.
30406
30407 @item -mv850e3v5
30408 @opindex mv850e3v5
30409 Specify that the target processor is the V850E3V5. The preprocessor
30410 constant @code{__v850e3v5__} is defined if this option is used.
30411
30412 @item -mv850e2v4
30413 @opindex mv850e2v4
30414 Specify that the target processor is the V850E3V5. This is an alias for
30415 the @option{-mv850e3v5} option.
30416
30417 @item -mv850e2v3
30418 @opindex mv850e2v3
30419 Specify that the target processor is the V850E2V3. The preprocessor
30420 constant @code{__v850e2v3__} is defined if this option is used.
30421
30422 @item -mv850e2
30423 @opindex mv850e2
30424 Specify that the target processor is the V850E2. The preprocessor
30425 constant @code{__v850e2__} is defined if this option is used.
30426
30427 @item -mv850e1
30428 @opindex mv850e1
30429 Specify that the target processor is the V850E1. The preprocessor
30430 constants @code{__v850e1__} and @code{__v850e__} are defined if
30431 this option is used.
30432
30433 @item -mv850es
30434 @opindex mv850es
30435 Specify that the target processor is the V850ES. This is an alias for
30436 the @option{-mv850e1} option.
30437
30438 @item -mv850e
30439 @opindex mv850e
30440 Specify that the target processor is the V850E@. The preprocessor
30441 constant @code{__v850e__} is defined if this option is used.
30442
30443 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
30444 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
30445 are defined then a default target processor is chosen and the
30446 relevant @samp{__v850*__} preprocessor constant is defined.
30447
30448 The preprocessor constants @code{__v850} and @code{__v851__} are always
30449 defined, regardless of which processor variant is the target.
30450
30451 @item -mdisable-callt
30452 @itemx -mno-disable-callt
30453 @opindex mdisable-callt
30454 @opindex mno-disable-callt
30455 This option suppresses generation of the @code{CALLT} instruction for the
30456 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
30457 architecture.
30458
30459 This option is enabled by default when the RH850 ABI is
30460 in use (see @option{-mrh850-abi}), and disabled by default when the
30461 GCC ABI is in use. If @code{CALLT} instructions are being generated
30462 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
30463
30464 @item -mrelax
30465 @itemx -mno-relax
30466 @opindex mrelax
30467 @opindex mno-relax
30468 Pass on (or do not pass on) the @option{-mrelax} command-line option
30469 to the assembler.
30470
30471 @item -mlong-jumps
30472 @itemx -mno-long-jumps
30473 @opindex mlong-jumps
30474 @opindex mno-long-jumps
30475 Disable (or re-enable) the generation of PC-relative jump instructions.
30476
30477 @item -msoft-float
30478 @itemx -mhard-float
30479 @opindex msoft-float
30480 @opindex mhard-float
30481 Disable (or re-enable) the generation of hardware floating point
30482 instructions. This option is only significant when the target
30483 architecture is @samp{V850E2V3} or higher. If hardware floating point
30484 instructions are being generated then the C preprocessor symbol
30485 @code{__FPU_OK__} is defined, otherwise the symbol
30486 @code{__NO_FPU__} is defined.
30487
30488 @item -mloop
30489 @opindex mloop
30490 Enables the use of the e3v5 LOOP instruction. The use of this
30491 instruction is not enabled by default when the e3v5 architecture is
30492 selected because its use is still experimental.
30493
30494 @item -mrh850-abi
30495 @itemx -mghs
30496 @opindex mrh850-abi
30497 @opindex mghs
30498 Enables support for the RH850 version of the V850 ABI. This is the
30499 default. With this version of the ABI the following rules apply:
30500
30501 @itemize
30502 @item
30503 Integer sized structures and unions are returned via a memory pointer
30504 rather than a register.
30505
30506 @item
30507 Large structures and unions (more than 8 bytes in size) are passed by
30508 value.
30509
30510 @item
30511 Functions are aligned to 16-bit boundaries.
30512
30513 @item
30514 The @option{-m8byte-align} command-line option is supported.
30515
30516 @item
30517 The @option{-mdisable-callt} command-line option is enabled by
30518 default. The @option{-mno-disable-callt} command-line option is not
30519 supported.
30520 @end itemize
30521
30522 When this version of the ABI is enabled the C preprocessor symbol
30523 @code{__V850_RH850_ABI__} is defined.
30524
30525 @item -mgcc-abi
30526 @opindex mgcc-abi
30527 Enables support for the old GCC version of the V850 ABI. With this
30528 version of the ABI the following rules apply:
30529
30530 @itemize
30531 @item
30532 Integer sized structures and unions are returned in register @code{r10}.
30533
30534 @item
30535 Large structures and unions (more than 8 bytes in size) are passed by
30536 reference.
30537
30538 @item
30539 Functions are aligned to 32-bit boundaries, unless optimizing for
30540 size.
30541
30542 @item
30543 The @option{-m8byte-align} command-line option is not supported.
30544
30545 @item
30546 The @option{-mdisable-callt} command-line option is supported but not
30547 enabled by default.
30548 @end itemize
30549
30550 When this version of the ABI is enabled the C preprocessor symbol
30551 @code{__V850_GCC_ABI__} is defined.
30552
30553 @item -m8byte-align
30554 @itemx -mno-8byte-align
30555 @opindex m8byte-align
30556 @opindex mno-8byte-align
30557 Enables support for @code{double} and @code{long long} types to be
30558 aligned on 8-byte boundaries. The default is to restrict the
30559 alignment of all objects to at most 4-bytes. When
30560 @option{-m8byte-align} is in effect the C preprocessor symbol
30561 @code{__V850_8BYTE_ALIGN__} is defined.
30562
30563 @item -mbig-switch
30564 @opindex mbig-switch
30565 Generate code suitable for big switch tables. Use this option only if
30566 the assembler/linker complain about out of range branches within a switch
30567 table.
30568
30569 @item -mapp-regs
30570 @opindex mapp-regs
30571 This option causes r2 and r5 to be used in the code generated by
30572 the compiler. This setting is the default.
30573
30574 @item -mno-app-regs
30575 @opindex mno-app-regs
30576 This option causes r2 and r5 to be treated as fixed registers.
30577
30578 @end table
30579
30580 @node VAX Options
30581 @subsection VAX Options
30582 @cindex VAX options
30583
30584 These @samp{-m} options are defined for the VAX:
30585
30586 @table @gcctabopt
30587 @item -munix
30588 @opindex munix
30589 Do not output certain jump instructions (@code{aobleq} and so on)
30590 that the Unix assembler for the VAX cannot handle across long
30591 ranges.
30592
30593 @item -mgnu
30594 @opindex mgnu
30595 Do output those jump instructions, on the assumption that the
30596 GNU assembler is being used.
30597
30598 @item -mg
30599 @opindex mg
30600 Output code for G-format floating-point numbers instead of D-format.
30601
30602 @item -mlra
30603 @itemx -mno-lra
30604 @opindex mlra
30605 @opindex mno-lra
30606 Enable Local Register Allocation. This is still experimental for the VAX,
30607 so by default the compiler uses standard reload.
30608 @end table
30609
30610 @node Visium Options
30611 @subsection Visium Options
30612 @cindex Visium options
30613
30614 @table @gcctabopt
30615
30616 @item -mdebug
30617 @opindex mdebug
30618 A program which performs file I/O and is destined to run on an MCM target
30619 should be linked with this option. It causes the libraries libc.a and
30620 libdebug.a to be linked. The program should be run on the target under
30621 the control of the GDB remote debugging stub.
30622
30623 @item -msim
30624 @opindex msim
30625 A program which performs file I/O and is destined to run on the simulator
30626 should be linked with option. This causes libraries libc.a and libsim.a to
30627 be linked.
30628
30629 @item -mfpu
30630 @itemx -mhard-float
30631 @opindex mfpu
30632 @opindex mhard-float
30633 Generate code containing floating-point instructions. This is the
30634 default.
30635
30636 @item -mno-fpu
30637 @itemx -msoft-float
30638 @opindex mno-fpu
30639 @opindex msoft-float
30640 Generate code containing library calls for floating-point.
30641
30642 @option{-msoft-float} changes the calling convention in the output file;
30643 therefore, it is only useful if you compile @emph{all} of a program with
30644 this option. In particular, you need to compile @file{libgcc.a}, the
30645 library that comes with GCC, with @option{-msoft-float} in order for
30646 this to work.
30647
30648 @item -mcpu=@var{cpu_type}
30649 @opindex mcpu
30650 Set the instruction set, register set, and instruction scheduling parameters
30651 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
30652 @samp{mcm}, @samp{gr5} and @samp{gr6}.
30653
30654 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
30655
30656 By default (unless configured otherwise), GCC generates code for the GR5
30657 variant of the Visium architecture.
30658
30659 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
30660 architecture. The only difference from GR5 code is that the compiler will
30661 generate block move instructions.
30662
30663 @item -mtune=@var{cpu_type}
30664 @opindex mtune
30665 Set the instruction scheduling parameters for machine type @var{cpu_type},
30666 but do not set the instruction set or register set that the option
30667 @option{-mcpu=@var{cpu_type}} would.
30668
30669 @item -msv-mode
30670 @opindex msv-mode
30671 Generate code for the supervisor mode, where there are no restrictions on
30672 the access to general registers. This is the default.
30673
30674 @item -muser-mode
30675 @opindex muser-mode
30676 Generate code for the user mode, where the access to some general registers
30677 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
30678 mode; on the GR6, only registers r29 to r31 are affected.
30679 @end table
30680
30681 @node VMS Options
30682 @subsection VMS Options
30683
30684 These @samp{-m} options are defined for the VMS implementations:
30685
30686 @table @gcctabopt
30687 @item -mvms-return-codes
30688 @opindex mvms-return-codes
30689 Return VMS condition codes from @code{main}. The default is to return POSIX-style
30690 condition (e.g.@: error) codes.
30691
30692 @item -mdebug-main=@var{prefix}
30693 @opindex mdebug-main=@var{prefix}
30694 Flag the first routine whose name starts with @var{prefix} as the main
30695 routine for the debugger.
30696
30697 @item -mmalloc64
30698 @opindex mmalloc64
30699 Default to 64-bit memory allocation routines.
30700
30701 @item -mpointer-size=@var{size}
30702 @opindex mpointer-size=@var{size}
30703 Set the default size of pointers. Possible options for @var{size} are
30704 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
30705 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
30706 The later option disables @code{pragma pointer_size}.
30707 @end table
30708
30709 @node VxWorks Options
30710 @subsection VxWorks Options
30711 @cindex VxWorks Options
30712
30713 The options in this section are defined for all VxWorks targets.
30714 Options specific to the target hardware are listed with the other
30715 options for that target.
30716
30717 @table @gcctabopt
30718 @item -mrtp
30719 @opindex mrtp
30720 GCC can generate code for both VxWorks kernels and real time processes
30721 (RTPs). This option switches from the former to the latter. It also
30722 defines the preprocessor macro @code{__RTP__}.
30723
30724 @item -non-static
30725 @opindex non-static
30726 Link an RTP executable against shared libraries rather than static
30727 libraries. The options @option{-static} and @option{-shared} can
30728 also be used for RTPs (@pxref{Link Options}); @option{-static}
30729 is the default.
30730
30731 @item -Bstatic
30732 @itemx -Bdynamic
30733 @opindex Bstatic
30734 @opindex Bdynamic
30735 These options are passed down to the linker. They are defined for
30736 compatibility with Diab.
30737
30738 @item -Xbind-lazy
30739 @opindex Xbind-lazy
30740 Enable lazy binding of function calls. This option is equivalent to
30741 @option{-Wl,-z,now} and is defined for compatibility with Diab.
30742
30743 @item -Xbind-now
30744 @opindex Xbind-now
30745 Disable lazy binding of function calls. This option is the default and
30746 is defined for compatibility with Diab.
30747 @end table
30748
30749 @node x86 Options
30750 @subsection x86 Options
30751 @cindex x86 Options
30752
30753 These @samp{-m} options are defined for the x86 family of computers.
30754
30755 @table @gcctabopt
30756
30757 @item -march=@var{cpu-type}
30758 @opindex march
30759 Generate instructions for the machine type @var{cpu-type}. In contrast to
30760 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
30761 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
30762 to generate code that may not run at all on processors other than the one
30763 indicated. Specifying @option{-march=@var{cpu-type}} implies
30764 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
30765
30766 The choices for @var{cpu-type} are:
30767
30768 @table @samp
30769 @item native
30770 This selects the CPU to generate code for at compilation time by determining
30771 the processor type of the compiling machine. Using @option{-march=native}
30772 enables all instruction subsets supported by the local machine (hence
30773 the result might not run on different machines). Using @option{-mtune=native}
30774 produces code optimized for the local machine under the constraints
30775 of the selected instruction set.
30776
30777 @item x86-64
30778 A generic CPU with 64-bit extensions.
30779
30780 @item x86-64-v2
30781 @itemx x86-64-v3
30782 @itemx x86-64-v4
30783 These choices for @var{cpu-type} select the corresponding
30784 micro-architecture level from the x86-64 psABI. On ABIs other than
30785 the x86-64 psABI they select the same CPU features as the x86-64 psABI
30786 documents for the particular micro-architecture level.
30787
30788 Since these @var{cpu-type} values do not have a corresponding
30789 @option{-mtune} setting, using @option{-march} with these values enables
30790 generic tuning. Specific tuning can be enabled using the
30791 @option{-mtune=@var{other-cpu-type}} option with an appropriate
30792 @var{other-cpu-type} value.
30793
30794 @item i386
30795 Original Intel i386 CPU@.
30796
30797 @item i486
30798 Intel i486 CPU@. (No scheduling is implemented for this chip.)
30799
30800 @item i586
30801 @itemx pentium
30802 Intel Pentium CPU with no MMX support.
30803
30804 @item lakemont
30805 Intel Lakemont MCU, based on Intel Pentium CPU.
30806
30807 @item pentium-mmx
30808 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
30809
30810 @item pentiumpro
30811 Intel Pentium Pro CPU@.
30812
30813 @item i686
30814 When used with @option{-march}, the Pentium Pro
30815 instruction set is used, so the code runs on all i686 family chips.
30816 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
30817
30818 @item pentium2
30819 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
30820 support.
30821
30822 @item pentium3
30823 @itemx pentium3m
30824 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
30825 set support.
30826
30827 @item pentium-m
30828 Intel Pentium M; low-power version of Intel Pentium III CPU
30829 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
30830
30831 @item pentium4
30832 @itemx pentium4m
30833 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
30834
30835 @item prescott
30836 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
30837 set support.
30838
30839 @item nocona
30840 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
30841 SSE2 and SSE3 instruction set support.
30842
30843 @item core2
30844 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
30845 instruction set support.
30846
30847 @item nehalem
30848 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30849 SSE4.1, SSE4.2 and POPCNT instruction set support.
30850
30851 @item westmere
30852 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30853 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
30854
30855 @item sandybridge
30856 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30857 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
30858
30859 @item ivybridge
30860 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30861 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
30862 instruction set support.
30863
30864 @item haswell
30865 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30866 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30867 BMI, BMI2 and F16C instruction set support.
30868
30869 @item broadwell
30870 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30871 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
30872 F16C, RDSEED ADCX and PREFETCHW instruction set support.
30873
30874 @item skylake
30875 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30876 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30877 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
30878 instruction set support.
30879
30880 @item bonnell
30881 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
30882 instruction set support.
30883
30884 @item silvermont
30885 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30886 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
30887
30888 @item goldmont
30889 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30890 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30891 XSAVEOPT and FSGSBASE instruction set support.
30892
30893 @item goldmont-plus
30894 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30895 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
30896 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
30897
30898 @item tremont
30899 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30900 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30901 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30902 MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
30903
30904 @item knl
30905 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30906 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30907 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30908 AVX512ER and AVX512CD instruction set support.
30909
30910 @item knm
30911 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30912 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30913 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30914 AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
30915 set support.
30916
30917 @item skylake-avx512
30918 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30919 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30920 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30921 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
30922
30923 @item cannonlake
30924 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30925 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30926 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30927 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30928 AVX512IFMA, SHA and UMIP instruction set support.
30929
30930 @item icelake-client
30931 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30932 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30933 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30934 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30935 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30936 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30937
30938 @item icelake-server
30939 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30940 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30941 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30942 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30943 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30944 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
30945 set support.
30946
30947 @item cascadelake
30948 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30949 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30950 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30951 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
30952
30953 @item cooperlake
30954 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30955 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30956 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30957 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
30958 set support.
30959
30960 @item tigerlake
30961 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30962 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30963 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30964 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
30965 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
30966 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
30967 instruction set support.
30968
30969 @item sapphirerapids
30970 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30971 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
30972 FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
30973 AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
30974 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
30975 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8 and AVX-VNNI
30976 instruction set support.
30977
30978 @item alderlake
30979 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30980 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30981 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30982 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
30983 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI
30984 instruction set support.
30985
30986 @item rocketlake
30987 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30988 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30989 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30990 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30991 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30992 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30993
30994 @item k6
30995 AMD K6 CPU with MMX instruction set support.
30996
30997 @item k6-2
30998 @itemx k6-3
30999 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
31000
31001 @item athlon
31002 @itemx athlon-tbird
31003 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
31004 support.
31005
31006 @item athlon-4
31007 @itemx athlon-xp
31008 @itemx athlon-mp
31009 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
31010 instruction set support.
31011
31012 @item k8
31013 @itemx opteron
31014 @itemx athlon64
31015 @itemx athlon-fx
31016 Processors based on the AMD K8 core with x86-64 instruction set support,
31017 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
31018 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
31019 instruction set extensions.)
31020
31021 @item k8-sse3
31022 @itemx opteron-sse3
31023 @itemx athlon64-sse3
31024 Improved versions of AMD K8 cores with SSE3 instruction set support.
31025
31026 @item amdfam10
31027 @itemx barcelona
31028 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
31029 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
31030 instruction set extensions.)
31031
31032 @item bdver1
31033 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
31034 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
31035 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
31036
31037 @item bdver2
31038 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
31039 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
31040 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
31041 extensions.)
31042
31043 @item bdver3
31044 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
31045 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
31046 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
31047 64-bit instruction set extensions.)
31048
31049 @item bdver4
31050 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
31051 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
31052 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
31053 SSE4.2, ABM and 64-bit instruction set extensions.)
31054
31055 @item znver1
31056 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
31057 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
31058 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
31059 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
31060 instruction set extensions.)
31061
31062 @item znver2
31063 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
31064 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
31065 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
31066 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
31067 WBNOINVD, and 64-bit instruction set extensions.)
31068
31069 @item znver3
31070 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
31071 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
31072 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
31073 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
31074 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
31075
31076 @item btver1
31077 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
31078 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
31079 instruction set extensions.)
31080
31081 @item btver2
31082 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
31083 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
31084 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
31085
31086 @item winchip-c6
31087 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
31088 set support.
31089
31090 @item winchip2
31091 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
31092 instruction set support.
31093
31094 @item c3
31095 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
31096 (No scheduling is implemented for this chip.)
31097
31098 @item c3-2
31099 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
31100 (No scheduling is implemented for this chip.)
31101
31102 @item c7
31103 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
31104 (No scheduling is implemented for this chip.)
31105
31106 @item samuel-2
31107 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
31108 (No scheduling is implemented for this chip.)
31109
31110 @item nehemiah
31111 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
31112 (No scheduling is implemented for this chip.)
31113
31114 @item esther
31115 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
31116 (No scheduling is implemented for this chip.)
31117
31118 @item eden-x2
31119 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
31120 (No scheduling is implemented for this chip.)
31121
31122 @item eden-x4
31123 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
31124 AVX and AVX2 instruction set support.
31125 (No scheduling is implemented for this chip.)
31126
31127 @item nano
31128 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
31129 instruction set support.
31130 (No scheduling is implemented for this chip.)
31131
31132 @item nano-1000
31133 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
31134 instruction set support.
31135 (No scheduling is implemented for this chip.)
31136
31137 @item nano-2000
31138 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
31139 instruction set support.
31140 (No scheduling is implemented for this chip.)
31141
31142 @item nano-3000
31143 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
31144 instruction set support.
31145 (No scheduling is implemented for this chip.)
31146
31147 @item nano-x2
31148 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
31149 instruction set support.
31150 (No scheduling is implemented for this chip.)
31151
31152 @item nano-x4
31153 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
31154 instruction set support.
31155 (No scheduling is implemented for this chip.)
31156
31157 @item geode
31158 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
31159 @end table
31160
31161 @item -mtune=@var{cpu-type}
31162 @opindex mtune
31163 Tune to @var{cpu-type} everything applicable about the generated code, except
31164 for the ABI and the set of available instructions.
31165 While picking a specific @var{cpu-type} schedules things appropriately
31166 for that particular chip, the compiler does not generate any code that
31167 cannot run on the default machine type unless you use a
31168 @option{-march=@var{cpu-type}} option.
31169 For example, if GCC is configured for i686-pc-linux-gnu
31170 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
31171 but still runs on i686 machines.
31172
31173 The choices for @var{cpu-type} are the same as for @option{-march}.
31174 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
31175
31176 @table @samp
31177 @item generic
31178 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
31179 If you know the CPU on which your code will run, then you should use
31180 the corresponding @option{-mtune} or @option{-march} option instead of
31181 @option{-mtune=generic}. But, if you do not know exactly what CPU users
31182 of your application will have, then you should use this option.
31183
31184 As new processors are deployed in the marketplace, the behavior of this
31185 option will change. Therefore, if you upgrade to a newer version of
31186 GCC, code generation controlled by this option will change to reflect
31187 the processors
31188 that are most common at the time that version of GCC is released.
31189
31190 There is no @option{-march=generic} option because @option{-march}
31191 indicates the instruction set the compiler can use, and there is no
31192 generic instruction set applicable to all processors. In contrast,
31193 @option{-mtune} indicates the processor (or, in this case, collection of
31194 processors) for which the code is optimized.
31195
31196 @item intel
31197 Produce code optimized for the most current Intel processors, which are
31198 Haswell and Silvermont for this version of GCC. If you know the CPU
31199 on which your code will run, then you should use the corresponding
31200 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
31201 But, if you want your application performs better on both Haswell and
31202 Silvermont, then you should use this option.
31203
31204 As new Intel processors are deployed in the marketplace, the behavior of
31205 this option will change. Therefore, if you upgrade to a newer version of
31206 GCC, code generation controlled by this option will change to reflect
31207 the most current Intel processors at the time that version of GCC is
31208 released.
31209
31210 There is no @option{-march=intel} option because @option{-march} indicates
31211 the instruction set the compiler can use, and there is no common
31212 instruction set applicable to all processors. In contrast,
31213 @option{-mtune} indicates the processor (or, in this case, collection of
31214 processors) for which the code is optimized.
31215 @end table
31216
31217 @item -mcpu=@var{cpu-type}
31218 @opindex mcpu
31219 A deprecated synonym for @option{-mtune}.
31220
31221 @item -mfpmath=@var{unit}
31222 @opindex mfpmath
31223 Generate floating-point arithmetic for selected unit @var{unit}. The choices
31224 for @var{unit} are:
31225
31226 @table @samp
31227 @item 387
31228 Use the standard 387 floating-point coprocessor present on the majority of chips and
31229 emulated otherwise. Code compiled with this option runs almost everywhere.
31230 The temporary results are computed in 80-bit precision instead of the precision
31231 specified by the type, resulting in slightly different results compared to most
31232 of other chips. See @option{-ffloat-store} for more detailed description.
31233
31234 This is the default choice for non-Darwin x86-32 targets.
31235
31236 @item sse
31237 Use scalar floating-point instructions present in the SSE instruction set.
31238 This instruction set is supported by Pentium III and newer chips,
31239 and in the AMD line
31240 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
31241 instruction set supports only single-precision arithmetic, thus the double and
31242 extended-precision arithmetic are still done using 387. A later version, present
31243 only in Pentium 4 and AMD x86-64 chips, supports double-precision
31244 arithmetic too.
31245
31246 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
31247 or @option{-msse2} switches to enable SSE extensions and make this option
31248 effective. For the x86-64 compiler, these extensions are enabled by default.
31249
31250 The resulting code should be considerably faster in the majority of cases and avoid
31251 the numerical instability problems of 387 code, but may break some existing
31252 code that expects temporaries to be 80 bits.
31253
31254 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
31255 and the default choice for x86-32 targets with the SSE2 instruction set
31256 when @option{-ffast-math} is enabled.
31257
31258 @item sse,387
31259 @itemx sse+387
31260 @itemx both
31261 Attempt to utilize both instruction sets at once. This effectively doubles the
31262 amount of available registers, and on chips with separate execution units for
31263 387 and SSE the execution resources too. Use this option with care, as it is
31264 still experimental, because the GCC register allocator does not model separate
31265 functional units well, resulting in unstable performance.
31266 @end table
31267
31268 @item -masm=@var{dialect}
31269 @opindex masm=@var{dialect}
31270 Output assembly instructions using selected @var{dialect}. Also affects
31271 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
31272 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
31273 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
31274 not support @samp{intel}.
31275
31276 @item -mieee-fp
31277 @itemx -mno-ieee-fp
31278 @opindex mieee-fp
31279 @opindex mno-ieee-fp
31280 Control whether or not the compiler uses IEEE floating-point
31281 comparisons. These correctly handle the case where the result of a
31282 comparison is unordered.
31283
31284 @item -m80387
31285 @itemx -mhard-float
31286 @opindex 80387
31287 @opindex mhard-float
31288 Generate output containing 80387 instructions for floating point.
31289
31290 @item -mno-80387
31291 @itemx -msoft-float
31292 @opindex no-80387
31293 @opindex msoft-float
31294 Generate output containing library calls for floating point.
31295
31296 @strong{Warning:} the requisite libraries are not part of GCC@.
31297 Normally the facilities of the machine's usual C compiler are used, but
31298 this cannot be done directly in cross-compilation. You must make your
31299 own arrangements to provide suitable library functions for
31300 cross-compilation.
31301
31302 On machines where a function returns floating-point results in the 80387
31303 register stack, some floating-point opcodes may be emitted even if
31304 @option{-msoft-float} is used.
31305
31306 @item -mno-fp-ret-in-387
31307 @opindex mno-fp-ret-in-387
31308 @opindex mfp-ret-in-387
31309 Do not use the FPU registers for return values of functions.
31310
31311 The usual calling convention has functions return values of types
31312 @code{float} and @code{double} in an FPU register, even if there
31313 is no FPU@. The idea is that the operating system should emulate
31314 an FPU@.
31315
31316 The option @option{-mno-fp-ret-in-387} causes such values to be returned
31317 in ordinary CPU registers instead.
31318
31319 @item -mno-fancy-math-387
31320 @opindex mno-fancy-math-387
31321 @opindex mfancy-math-387
31322 Some 387 emulators do not support the @code{sin}, @code{cos} and
31323 @code{sqrt} instructions for the 387. Specify this option to avoid
31324 generating those instructions.
31325 This option is overridden when @option{-march}
31326 indicates that the target CPU always has an FPU and so the
31327 instruction does not need emulation. These
31328 instructions are not generated unless you also use the
31329 @option{-funsafe-math-optimizations} switch.
31330
31331 @item -malign-double
31332 @itemx -mno-align-double
31333 @opindex malign-double
31334 @opindex mno-align-double
31335 Control whether GCC aligns @code{double}, @code{long double}, and
31336 @code{long long} variables on a two-word boundary or a one-word
31337 boundary. Aligning @code{double} variables on a two-word boundary
31338 produces code that runs somewhat faster on a Pentium at the
31339 expense of more memory.
31340
31341 On x86-64, @option{-malign-double} is enabled by default.
31342
31343 @strong{Warning:} if you use the @option{-malign-double} switch,
31344 structures containing the above types are aligned differently than
31345 the published application binary interface specifications for the x86-32
31346 and are not binary compatible with structures in code compiled
31347 without that switch.
31348
31349 @item -m96bit-long-double
31350 @itemx -m128bit-long-double
31351 @opindex m96bit-long-double
31352 @opindex m128bit-long-double
31353 These switches control the size of @code{long double} type. The x86-32
31354 application binary interface specifies the size to be 96 bits,
31355 so @option{-m96bit-long-double} is the default in 32-bit mode.
31356
31357 Modern architectures (Pentium and newer) prefer @code{long double}
31358 to be aligned to an 8- or 16-byte boundary. In arrays or structures
31359 conforming to the ABI, this is not possible. So specifying
31360 @option{-m128bit-long-double} aligns @code{long double}
31361 to a 16-byte boundary by padding the @code{long double} with an additional
31362 32-bit zero.
31363
31364 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
31365 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
31366
31367 Notice that neither of these options enable any extra precision over the x87
31368 standard of 80 bits for a @code{long double}.
31369
31370 @strong{Warning:} if you override the default value for your target ABI, this
31371 changes the size of
31372 structures and arrays containing @code{long double} variables,
31373 as well as modifying the function calling convention for functions taking
31374 @code{long double}. Hence they are not binary-compatible
31375 with code compiled without that switch.
31376
31377 @item -mlong-double-64
31378 @itemx -mlong-double-80
31379 @itemx -mlong-double-128
31380 @opindex mlong-double-64
31381 @opindex mlong-double-80
31382 @opindex mlong-double-128
31383 These switches control the size of @code{long double} type. A size
31384 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31385 type. This is the default for 32-bit Bionic C library. A size
31386 of 128 bits makes the @code{long double} type equivalent to the
31387 @code{__float128} type. This is the default for 64-bit Bionic C library.
31388
31389 @strong{Warning:} if you override the default value for your target ABI, this
31390 changes the size of
31391 structures and arrays containing @code{long double} variables,
31392 as well as modifying the function calling convention for functions taking
31393 @code{long double}. Hence they are not binary-compatible
31394 with code compiled without that switch.
31395
31396 @item -malign-data=@var{type}
31397 @opindex malign-data
31398 Control how GCC aligns variables. Supported values for @var{type} are
31399 @samp{compat} uses increased alignment value compatible uses GCC 4.8
31400 and earlier, @samp{abi} uses alignment value as specified by the
31401 psABI, and @samp{cacheline} uses increased alignment value to match
31402 the cache line size. @samp{compat} is the default.
31403
31404 @item -mlarge-data-threshold=@var{threshold}
31405 @opindex mlarge-data-threshold
31406 When @option{-mcmodel=medium} is specified, data objects larger than
31407 @var{threshold} are placed in the large data section. This value must be the
31408 same across all objects linked into the binary, and defaults to 65535.
31409
31410 @item -mrtd
31411 @opindex mrtd
31412 Use a different function-calling convention, in which functions that
31413 take a fixed number of arguments return with the @code{ret @var{num}}
31414 instruction, which pops their arguments while returning. This saves one
31415 instruction in the caller since there is no need to pop the arguments
31416 there.
31417
31418 You can specify that an individual function is called with this calling
31419 sequence with the function attribute @code{stdcall}. You can also
31420 override the @option{-mrtd} option by using the function attribute
31421 @code{cdecl}. @xref{Function Attributes}.
31422
31423 @strong{Warning:} this calling convention is incompatible with the one
31424 normally used on Unix, so you cannot use it if you need to call
31425 libraries compiled with the Unix compiler.
31426
31427 Also, you must provide function prototypes for all functions that
31428 take variable numbers of arguments (including @code{printf});
31429 otherwise incorrect code is generated for calls to those
31430 functions.
31431
31432 In addition, seriously incorrect code results if you call a
31433 function with too many arguments. (Normally, extra arguments are
31434 harmlessly ignored.)
31435
31436 @item -mregparm=@var{num}
31437 @opindex mregparm
31438 Control how many registers are used to pass integer arguments. By
31439 default, no registers are used to pass arguments, and at most 3
31440 registers can be used. You can control this behavior for a specific
31441 function by using the function attribute @code{regparm}.
31442 @xref{Function Attributes}.
31443
31444 @strong{Warning:} if you use this switch, and
31445 @var{num} is nonzero, then you must build all modules with the same
31446 value, including any libraries. This includes the system libraries and
31447 startup modules.
31448
31449 @item -msseregparm
31450 @opindex msseregparm
31451 Use SSE register passing conventions for float and double arguments
31452 and return values. You can control this behavior for a specific
31453 function by using the function attribute @code{sseregparm}.
31454 @xref{Function Attributes}.
31455
31456 @strong{Warning:} if you use this switch then you must build all
31457 modules with the same value, including any libraries. This includes
31458 the system libraries and startup modules.
31459
31460 @item -mvect8-ret-in-mem
31461 @opindex mvect8-ret-in-mem
31462 Return 8-byte vectors in memory instead of MMX registers. This is the
31463 default on VxWorks to match the ABI of the Sun Studio compilers until
31464 version 12. @emph{Only} use this option if you need to remain
31465 compatible with existing code produced by those previous compiler
31466 versions or older versions of GCC@.
31467
31468 @item -mpc32
31469 @itemx -mpc64
31470 @itemx -mpc80
31471 @opindex mpc32
31472 @opindex mpc64
31473 @opindex mpc80
31474
31475 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
31476 is specified, the significands of results of floating-point operations are
31477 rounded to 24 bits (single precision); @option{-mpc64} rounds the
31478 significands of results of floating-point operations to 53 bits (double
31479 precision) and @option{-mpc80} rounds the significands of results of
31480 floating-point operations to 64 bits (extended double precision), which is
31481 the default. When this option is used, floating-point operations in higher
31482 precisions are not available to the programmer without setting the FPU
31483 control word explicitly.
31484
31485 Setting the rounding of floating-point operations to less than the default
31486 80 bits can speed some programs by 2% or more. Note that some mathematical
31487 libraries assume that extended-precision (80-bit) floating-point operations
31488 are enabled by default; routines in such libraries could suffer significant
31489 loss of accuracy, typically through so-called ``catastrophic cancellation'',
31490 when this option is used to set the precision to less than extended precision.
31491
31492 @item -mstackrealign
31493 @opindex mstackrealign
31494 Realign the stack at entry. On the x86, the @option{-mstackrealign}
31495 option generates an alternate prologue and epilogue that realigns the
31496 run-time stack if necessary. This supports mixing legacy codes that keep
31497 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
31498 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
31499 applicable to individual functions.
31500
31501 @item -mpreferred-stack-boundary=@var{num}
31502 @opindex mpreferred-stack-boundary
31503 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
31504 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
31505 the default is 4 (16 bytes or 128 bits).
31506
31507 @strong{Warning:} When generating code for the x86-64 architecture with
31508 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
31509 used to keep the stack boundary aligned to 8 byte boundary. Since
31510 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
31511 intended to be used in controlled environment where stack space is
31512 important limitation. This option leads to wrong code when functions
31513 compiled with 16 byte stack alignment (such as functions from a standard
31514 library) are called with misaligned stack. In this case, SSE
31515 instructions may lead to misaligned memory access traps. In addition,
31516 variable arguments are handled incorrectly for 16 byte aligned
31517 objects (including x87 long double and __int128), leading to wrong
31518 results. You must build all modules with
31519 @option{-mpreferred-stack-boundary=3}, including any libraries. This
31520 includes the system libraries and startup modules.
31521
31522 @item -mincoming-stack-boundary=@var{num}
31523 @opindex mincoming-stack-boundary
31524 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
31525 boundary. If @option{-mincoming-stack-boundary} is not specified,
31526 the one specified by @option{-mpreferred-stack-boundary} is used.
31527
31528 On Pentium and Pentium Pro, @code{double} and @code{long double} values
31529 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
31530 suffer significant run time performance penalties. On Pentium III, the
31531 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
31532 properly if it is not 16-byte aligned.
31533
31534 To ensure proper alignment of this values on the stack, the stack boundary
31535 must be as aligned as that required by any value stored on the stack.
31536 Further, every function must be generated such that it keeps the stack
31537 aligned. Thus calling a function compiled with a higher preferred
31538 stack boundary from a function compiled with a lower preferred stack
31539 boundary most likely misaligns the stack. It is recommended that
31540 libraries that use callbacks always use the default setting.
31541
31542 This extra alignment does consume extra stack space, and generally
31543 increases code size. Code that is sensitive to stack space usage, such
31544 as embedded systems and operating system kernels, may want to reduce the
31545 preferred alignment to @option{-mpreferred-stack-boundary=2}.
31546
31547 @need 200
31548 @item -mmmx
31549 @opindex mmmx
31550 @need 200
31551 @itemx -msse
31552 @opindex msse
31553 @need 200
31554 @itemx -msse2
31555 @opindex msse2
31556 @need 200
31557 @itemx -msse3
31558 @opindex msse3
31559 @need 200
31560 @itemx -mssse3
31561 @opindex mssse3
31562 @need 200
31563 @itemx -msse4
31564 @opindex msse4
31565 @need 200
31566 @itemx -msse4a
31567 @opindex msse4a
31568 @need 200
31569 @itemx -msse4.1
31570 @opindex msse4.1
31571 @need 200
31572 @itemx -msse4.2
31573 @opindex msse4.2
31574 @need 200
31575 @itemx -mavx
31576 @opindex mavx
31577 @need 200
31578 @itemx -mavx2
31579 @opindex mavx2
31580 @need 200
31581 @itemx -mavx512f
31582 @opindex mavx512f
31583 @need 200
31584 @itemx -mavx512pf
31585 @opindex mavx512pf
31586 @need 200
31587 @itemx -mavx512er
31588 @opindex mavx512er
31589 @need 200
31590 @itemx -mavx512cd
31591 @opindex mavx512cd
31592 @need 200
31593 @itemx -mavx512vl
31594 @opindex mavx512vl
31595 @need 200
31596 @itemx -mavx512bw
31597 @opindex mavx512bw
31598 @need 200
31599 @itemx -mavx512dq
31600 @opindex mavx512dq
31601 @need 200
31602 @itemx -mavx512ifma
31603 @opindex mavx512ifma
31604 @need 200
31605 @itemx -mavx512vbmi
31606 @opindex mavx512vbmi
31607 @need 200
31608 @itemx -msha
31609 @opindex msha
31610 @need 200
31611 @itemx -maes
31612 @opindex maes
31613 @need 200
31614 @itemx -mpclmul
31615 @opindex mpclmul
31616 @need 200
31617 @itemx -mclflushopt
31618 @opindex mclflushopt
31619 @need 200
31620 @itemx -mclwb
31621 @opindex mclwb
31622 @need 200
31623 @itemx -mfsgsbase
31624 @opindex mfsgsbase
31625 @need 200
31626 @itemx -mptwrite
31627 @opindex mptwrite
31628 @need 200
31629 @itemx -mrdrnd
31630 @opindex mrdrnd
31631 @need 200
31632 @itemx -mf16c
31633 @opindex mf16c
31634 @need 200
31635 @itemx -mfma
31636 @opindex mfma
31637 @need 200
31638 @itemx -mpconfig
31639 @opindex mpconfig
31640 @need 200
31641 @itemx -mwbnoinvd
31642 @opindex mwbnoinvd
31643 @need 200
31644 @itemx -mfma4
31645 @opindex mfma4
31646 @need 200
31647 @itemx -mprfchw
31648 @opindex mprfchw
31649 @need 200
31650 @itemx -mrdpid
31651 @opindex mrdpid
31652 @need 200
31653 @itemx -mprefetchwt1
31654 @opindex mprefetchwt1
31655 @need 200
31656 @itemx -mrdseed
31657 @opindex mrdseed
31658 @need 200
31659 @itemx -msgx
31660 @opindex msgx
31661 @need 200
31662 @itemx -mxop
31663 @opindex mxop
31664 @need 200
31665 @itemx -mlwp
31666 @opindex mlwp
31667 @need 200
31668 @itemx -m3dnow
31669 @opindex m3dnow
31670 @need 200
31671 @itemx -m3dnowa
31672 @opindex m3dnowa
31673 @need 200
31674 @itemx -mpopcnt
31675 @opindex mpopcnt
31676 @need 200
31677 @itemx -mabm
31678 @opindex mabm
31679 @need 200
31680 @itemx -madx
31681 @opindex madx
31682 @need 200
31683 @itemx -mbmi
31684 @opindex mbmi
31685 @need 200
31686 @itemx -mbmi2
31687 @opindex mbmi2
31688 @need 200
31689 @itemx -mlzcnt
31690 @opindex mlzcnt
31691 @need 200
31692 @itemx -mfxsr
31693 @opindex mfxsr
31694 @need 200
31695 @itemx -mxsave
31696 @opindex mxsave
31697 @need 200
31698 @itemx -mxsaveopt
31699 @opindex mxsaveopt
31700 @need 200
31701 @itemx -mxsavec
31702 @opindex mxsavec
31703 @need 200
31704 @itemx -mxsaves
31705 @opindex mxsaves
31706 @need 200
31707 @itemx -mrtm
31708 @opindex mrtm
31709 @need 200
31710 @itemx -mhle
31711 @opindex mhle
31712 @need 200
31713 @itemx -mtbm
31714 @opindex mtbm
31715 @need 200
31716 @itemx -mmwaitx
31717 @opindex mmwaitx
31718 @need 200
31719 @itemx -mclzero
31720 @opindex mclzero
31721 @need 200
31722 @itemx -mpku
31723 @opindex mpku
31724 @need 200
31725 @itemx -mavx512vbmi2
31726 @opindex mavx512vbmi2
31727 @need 200
31728 @itemx -mavx512bf16
31729 @opindex mavx512bf16
31730 @need 200
31731 @itemx -mavx512fp16
31732 @opindex mavx512fp16
31733 @need 200
31734 @itemx -mgfni
31735 @opindex mgfni
31736 @need 200
31737 @itemx -mvaes
31738 @opindex mvaes
31739 @need 200
31740 @itemx -mwaitpkg
31741 @opindex mwaitpkg
31742 @need 200
31743 @itemx -mvpclmulqdq
31744 @opindex mvpclmulqdq
31745 @need 200
31746 @itemx -mavx512bitalg
31747 @opindex mavx512bitalg
31748 @need 200
31749 @itemx -mmovdiri
31750 @opindex mmovdiri
31751 @need 200
31752 @itemx -mmovdir64b
31753 @opindex mmovdir64b
31754 @need 200
31755 @itemx -menqcmd
31756 @opindex menqcmd
31757 @itemx -muintr
31758 @opindex muintr
31759 @need 200
31760 @itemx -mtsxldtrk
31761 @opindex mtsxldtrk
31762 @need 200
31763 @itemx -mavx512vpopcntdq
31764 @opindex mavx512vpopcntdq
31765 @need 200
31766 @itemx -mavx512vp2intersect
31767 @opindex mavx512vp2intersect
31768 @need 200
31769 @itemx -mavx5124fmaps
31770 @opindex mavx5124fmaps
31771 @need 200
31772 @itemx -mavx512vnni
31773 @opindex mavx512vnni
31774 @need 200
31775 @itemx -mavxvnni
31776 @opindex mavxvnni
31777 @need 200
31778 @itemx -mavx5124vnniw
31779 @opindex mavx5124vnniw
31780 @need 200
31781 @itemx -mcldemote
31782 @opindex mcldemote
31783 @need 200
31784 @itemx -mserialize
31785 @opindex mserialize
31786 @need 200
31787 @itemx -mamx-tile
31788 @opindex mamx-tile
31789 @need 200
31790 @itemx -mamx-int8
31791 @opindex mamx-int8
31792 @need 200
31793 @itemx -mamx-bf16
31794 @opindex mamx-bf16
31795 @need 200
31796 @itemx -mhreset
31797 @opindex mhreset
31798 @itemx -mkl
31799 @opindex mkl
31800 @need 200
31801 @itemx -mwidekl
31802 @opindex mwidekl
31803 These switches enable the use of instructions in the MMX, SSE,
31804 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
31805 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
31806 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
31807 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
31808 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
31809 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
31810 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
31811 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
31812 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16
31813 or CLDEMOTE extended instruction sets. Each has a corresponding
31814 @option{-mno-} option to disable use of these instructions.
31815
31816 These extensions are also available as built-in functions: see
31817 @ref{x86 Built-in Functions}, for details of the functions enabled and
31818 disabled by these switches.
31819
31820 To generate SSE/SSE2 instructions automatically from floating-point
31821 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
31822
31823 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
31824 generates new AVX instructions or AVX equivalence for all SSEx instructions
31825 when needed.
31826
31827 These options enable GCC to use these extended instructions in
31828 generated code, even without @option{-mfpmath=sse}. Applications that
31829 perform run-time CPU detection must compile separate files for each
31830 supported architecture, using the appropriate flags. In particular,
31831 the file containing the CPU detection code should be compiled without
31832 these options.
31833
31834 @item -mdump-tune-features
31835 @opindex mdump-tune-features
31836 This option instructs GCC to dump the names of the x86 performance
31837 tuning features and default settings. The names can be used in
31838 @option{-mtune-ctrl=@var{feature-list}}.
31839
31840 @item -mtune-ctrl=@var{feature-list}
31841 @opindex mtune-ctrl=@var{feature-list}
31842 This option is used to do fine grain control of x86 code generation features.
31843 @var{feature-list} is a comma separated list of @var{feature} names. See also
31844 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
31845 on if it is not preceded with @samp{^}, otherwise, it is turned off.
31846 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
31847 developers. Using it may lead to code paths not covered by testing and can
31848 potentially result in compiler ICEs or runtime errors.
31849
31850 @item -mno-default
31851 @opindex mno-default
31852 This option instructs GCC to turn off all tunable features. See also
31853 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
31854
31855 @item -mcld
31856 @opindex mcld
31857 This option instructs GCC to emit a @code{cld} instruction in the prologue
31858 of functions that use string instructions. String instructions depend on
31859 the DF flag to select between autoincrement or autodecrement mode. While the
31860 ABI specifies the DF flag to be cleared on function entry, some operating
31861 systems violate this specification by not clearing the DF flag in their
31862 exception dispatchers. The exception handler can be invoked with the DF flag
31863 set, which leads to wrong direction mode when string instructions are used.
31864 This option can be enabled by default on 32-bit x86 targets by configuring
31865 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
31866 instructions can be suppressed with the @option{-mno-cld} compiler option
31867 in this case.
31868
31869 @item -mvzeroupper
31870 @opindex mvzeroupper
31871 This option instructs GCC to emit a @code{vzeroupper} instruction
31872 before a transfer of control flow out of the function to minimize
31873 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
31874 intrinsics.
31875
31876 @item -mprefer-avx128
31877 @opindex mprefer-avx128
31878 This option instructs GCC to use 128-bit AVX instructions instead of
31879 256-bit AVX instructions in the auto-vectorizer.
31880
31881 @item -mprefer-vector-width=@var{opt}
31882 @opindex mprefer-vector-width
31883 This option instructs GCC to use @var{opt}-bit vector width in instructions
31884 instead of default on the selected platform.
31885
31886 @item -mmove-max=@var{bits}
31887 @opindex mmove-max
31888 This option instructs GCC to set the maximum number of bits can be
31889 moved from memory to memory efficiently to @var{bits}. The valid
31890 @var{bits} are 128, 256 and 512.
31891
31892 @item -mstore-max=@var{bits}
31893 @opindex mstore-max
31894 This option instructs GCC to set the maximum number of bits can be
31895 stored to memory efficiently to @var{bits}. The valid @var{bits} are
31896 128, 256 and 512.
31897
31898 @table @samp
31899 @item none
31900 No extra limitations applied to GCC other than defined by the selected platform.
31901
31902 @item 128
31903 Prefer 128-bit vector width for instructions.
31904
31905 @item 256
31906 Prefer 256-bit vector width for instructions.
31907
31908 @item 512
31909 Prefer 512-bit vector width for instructions.
31910 @end table
31911
31912 @item -mcx16
31913 @opindex mcx16
31914 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
31915 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
31916 objects. This is useful for atomic updates of data structures exceeding one
31917 machine word in size. The compiler uses this instruction to implement
31918 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
31919 128-bit integers, a library call is always used.
31920
31921 @item -msahf
31922 @opindex msahf
31923 This option enables generation of @code{SAHF} instructions in 64-bit code.
31924 Early Intel Pentium 4 CPUs with Intel 64 support,
31925 prior to the introduction of Pentium 4 G1 step in December 2005,
31926 lacked the @code{LAHF} and @code{SAHF} instructions
31927 which are supported by AMD64.
31928 These are load and store instructions, respectively, for certain status flags.
31929 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
31930 @code{drem}, and @code{remainder} built-in functions;
31931 see @ref{Other Builtins} for details.
31932
31933 @item -mmovbe
31934 @opindex mmovbe
31935 This option enables use of the @code{movbe} instruction to implement
31936 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
31937
31938 @item -mshstk
31939 @opindex mshstk
31940 The @option{-mshstk} option enables shadow stack built-in functions
31941 from x86 Control-flow Enforcement Technology (CET).
31942
31943 @item -mcrc32
31944 @opindex mcrc32
31945 This option enables built-in functions @code{__builtin_ia32_crc32qi},
31946 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
31947 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
31948
31949 @item -mmwait
31950 @opindex mmwait
31951 This option enables built-in functions @code{__builtin_ia32_monitor},
31952 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
31953 @code{mwait} machine instructions.
31954
31955 @item -mrecip
31956 @opindex mrecip
31957 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
31958 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
31959 with an additional Newton-Raphson step
31960 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
31961 (and their vectorized
31962 variants) for single-precision floating-point arguments. These instructions
31963 are generated only when @option{-funsafe-math-optimizations} is enabled
31964 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
31965 Note that while the throughput of the sequence is higher than the throughput
31966 of the non-reciprocal instruction, the precision of the sequence can be
31967 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
31968
31969 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
31970 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
31971 combination), and doesn't need @option{-mrecip}.
31972
31973 Also note that GCC emits the above sequence with additional Newton-Raphson step
31974 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
31975 already with @option{-ffast-math} (or the above option combination), and
31976 doesn't need @option{-mrecip}.
31977
31978 @item -mrecip=@var{opt}
31979 @opindex mrecip=opt
31980 This option controls which reciprocal estimate instructions
31981 may be used. @var{opt} is a comma-separated list of options, which may
31982 be preceded by a @samp{!} to invert the option:
31983
31984 @table @samp
31985 @item all
31986 Enable all estimate instructions.
31987
31988 @item default
31989 Enable the default instructions, equivalent to @option{-mrecip}.
31990
31991 @item none
31992 Disable all estimate instructions, equivalent to @option{-mno-recip}.
31993
31994 @item div
31995 Enable the approximation for scalar division.
31996
31997 @item vec-div
31998 Enable the approximation for vectorized division.
31999
32000 @item sqrt
32001 Enable the approximation for scalar square root.
32002
32003 @item vec-sqrt
32004 Enable the approximation for vectorized square root.
32005 @end table
32006
32007 So, for example, @option{-mrecip=all,!sqrt} enables
32008 all of the reciprocal approximations, except for square root.
32009
32010 @item -mveclibabi=@var{type}
32011 @opindex mveclibabi
32012 Specifies the ABI type to use for vectorizing intrinsics using an
32013 external library. Supported values for @var{type} are @samp{svml}
32014 for the Intel short
32015 vector math library and @samp{acml} for the AMD math core library.
32016 To use this option, both @option{-ftree-vectorize} and
32017 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
32018 ABI-compatible library must be specified at link time.
32019
32020 GCC currently emits calls to @code{vmldExp2},
32021 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
32022 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
32023 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
32024 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
32025 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
32026 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
32027 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
32028 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
32029 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
32030 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
32031 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
32032 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
32033 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
32034 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
32035 when @option{-mveclibabi=acml} is used.
32036
32037 @item -mabi=@var{name}
32038 @opindex mabi
32039 Generate code for the specified calling convention. Permissible values
32040 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
32041 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
32042 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
32043 You can control this behavior for specific functions by
32044 using the function attributes @code{ms_abi} and @code{sysv_abi}.
32045 @xref{Function Attributes}.
32046
32047 @item -mforce-indirect-call
32048 @opindex mforce-indirect-call
32049 Force all calls to functions to be indirect. This is useful
32050 when using Intel Processor Trace where it generates more precise timing
32051 information for function calls.
32052
32053 @item -mmanual-endbr
32054 @opindex mmanual-endbr
32055 Insert ENDBR instruction at function entry only via the @code{cf_check}
32056 function attribute. This is useful when used with the option
32057 @option{-fcf-protection=branch} to control ENDBR insertion at the
32058 function entry.
32059
32060 @item -mcall-ms2sysv-xlogues
32061 @opindex mcall-ms2sysv-xlogues
32062 @opindex mno-call-ms2sysv-xlogues
32063 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
32064 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
32065 default, the code for saving and restoring these registers is emitted inline,
32066 resulting in fairly lengthy prologues and epilogues. Using
32067 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
32068 use stubs in the static portion of libgcc to perform these saves and restores,
32069 thus reducing function size at the cost of a few extra instructions.
32070
32071 @item -mtls-dialect=@var{type}
32072 @opindex mtls-dialect
32073 Generate code to access thread-local storage using the @samp{gnu} or
32074 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
32075 @samp{gnu2} is more efficient, but it may add compile- and run-time
32076 requirements that cannot be satisfied on all systems.
32077
32078 @item -mpush-args
32079 @itemx -mno-push-args
32080 @opindex mpush-args
32081 @opindex mno-push-args
32082 Use PUSH operations to store outgoing parameters. This method is shorter
32083 and usually equally fast as method using SUB/MOV operations and is enabled
32084 by default. In some cases disabling it may improve performance because of
32085 improved scheduling and reduced dependencies.
32086
32087 @item -maccumulate-outgoing-args
32088 @opindex maccumulate-outgoing-args
32089 If enabled, the maximum amount of space required for outgoing arguments is
32090 computed in the function prologue. This is faster on most modern CPUs
32091 because of reduced dependencies, improved scheduling and reduced stack usage
32092 when the preferred stack boundary is not equal to 2. The drawback is a notable
32093 increase in code size. This switch implies @option{-mno-push-args}.
32094
32095 @item -mthreads
32096 @opindex mthreads
32097 Support thread-safe exception handling on MinGW. Programs that rely
32098 on thread-safe exception handling must compile and link all code with the
32099 @option{-mthreads} option. When compiling, @option{-mthreads} defines
32100 @option{-D_MT}; when linking, it links in a special thread helper library
32101 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
32102
32103 @item -mms-bitfields
32104 @itemx -mno-ms-bitfields
32105 @opindex mms-bitfields
32106 @opindex mno-ms-bitfields
32107
32108 Enable/disable bit-field layout compatible with the native Microsoft
32109 Windows compiler.
32110
32111 If @code{packed} is used on a structure, or if bit-fields are used,
32112 it may be that the Microsoft ABI lays out the structure differently
32113 than the way GCC normally does. Particularly when moving packed
32114 data between functions compiled with GCC and the native Microsoft compiler
32115 (either via function call or as data in a file), it may be necessary to access
32116 either format.
32117
32118 This option is enabled by default for Microsoft Windows
32119 targets. This behavior can also be controlled locally by use of variable
32120 or type attributes. For more information, see @ref{x86 Variable Attributes}
32121 and @ref{x86 Type Attributes}.
32122
32123 The Microsoft structure layout algorithm is fairly simple with the exception
32124 of the bit-field packing.
32125 The padding and alignment of members of structures and whether a bit-field
32126 can straddle a storage-unit boundary are determine by these rules:
32127
32128 @enumerate
32129 @item Structure members are stored sequentially in the order in which they are
32130 declared: the first member has the lowest memory address and the last member
32131 the highest.
32132
32133 @item Every data object has an alignment requirement. The alignment requirement
32134 for all data except structures, unions, and arrays is either the size of the
32135 object or the current packing size (specified with either the
32136 @code{aligned} attribute or the @code{pack} pragma),
32137 whichever is less. For structures, unions, and arrays,
32138 the alignment requirement is the largest alignment requirement of its members.
32139 Every object is allocated an offset so that:
32140
32141 @smallexample
32142 offset % alignment_requirement == 0
32143 @end smallexample
32144
32145 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
32146 unit if the integral types are the same size and if the next bit-field fits
32147 into the current allocation unit without crossing the boundary imposed by the
32148 common alignment requirements of the bit-fields.
32149 @end enumerate
32150
32151 MSVC interprets zero-length bit-fields in the following ways:
32152
32153 @enumerate
32154 @item If a zero-length bit-field is inserted between two bit-fields that
32155 are normally coalesced, the bit-fields are not coalesced.
32156
32157 For example:
32158
32159 @smallexample
32160 struct
32161 @{
32162 unsigned long bf_1 : 12;
32163 unsigned long : 0;
32164 unsigned long bf_2 : 12;
32165 @} t1;
32166 @end smallexample
32167
32168 @noindent
32169 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
32170 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
32171
32172 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
32173 alignment of the zero-length bit-field is greater than the member that follows it,
32174 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
32175
32176 For example:
32177
32178 @smallexample
32179 struct
32180 @{
32181 char foo : 4;
32182 short : 0;
32183 char bar;
32184 @} t2;
32185
32186 struct
32187 @{
32188 char foo : 4;
32189 short : 0;
32190 double bar;
32191 @} t3;
32192 @end smallexample
32193
32194 @noindent
32195 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
32196 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
32197 bit-field does not affect the alignment of @code{bar} or, as a result, the size
32198 of the structure.
32199
32200 Taking this into account, it is important to note the following:
32201
32202 @enumerate
32203 @item If a zero-length bit-field follows a normal bit-field, the type of the
32204 zero-length bit-field may affect the alignment of the structure as whole. For
32205 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
32206 normal bit-field, and is of type short.
32207
32208 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
32209 still affect the alignment of the structure:
32210
32211 @smallexample
32212 struct
32213 @{
32214 char foo : 6;
32215 long : 0;
32216 @} t4;
32217 @end smallexample
32218
32219 @noindent
32220 Here, @code{t4} takes up 4 bytes.
32221 @end enumerate
32222
32223 @item Zero-length bit-fields following non-bit-field members are ignored:
32224
32225 @smallexample
32226 struct
32227 @{
32228 char foo;
32229 long : 0;
32230 char bar;
32231 @} t5;
32232 @end smallexample
32233
32234 @noindent
32235 Here, @code{t5} takes up 2 bytes.
32236 @end enumerate
32237
32238
32239 @item -mno-align-stringops
32240 @opindex mno-align-stringops
32241 @opindex malign-stringops
32242 Do not align the destination of inlined string operations. This switch reduces
32243 code size and improves performance in case the destination is already aligned,
32244 but GCC doesn't know about it.
32245
32246 @item -minline-all-stringops
32247 @opindex minline-all-stringops
32248 By default GCC inlines string operations only when the destination is
32249 known to be aligned to least a 4-byte boundary.
32250 This enables more inlining and increases code
32251 size, but may improve performance of code that depends on fast
32252 @code{memcpy} and @code{memset} for short lengths.
32253 The option enables inline expansion of @code{strlen} for all
32254 pointer alignments.
32255
32256 @item -minline-stringops-dynamically
32257 @opindex minline-stringops-dynamically
32258 For string operations of unknown size, use run-time checks with
32259 inline code for small blocks and a library call for large blocks.
32260
32261 @item -mstringop-strategy=@var{alg}
32262 @opindex mstringop-strategy=@var{alg}
32263 Override the internal decision heuristic for the particular algorithm to use
32264 for inlining string operations. The allowed values for @var{alg} are:
32265
32266 @table @samp
32267 @item rep_byte
32268 @itemx rep_4byte
32269 @itemx rep_8byte
32270 Expand using i386 @code{rep} prefix of the specified size.
32271
32272 @item byte_loop
32273 @itemx loop
32274 @itemx unrolled_loop
32275 Expand into an inline loop.
32276
32277 @item libcall
32278 Always use a library call.
32279 @end table
32280
32281 @item -mmemcpy-strategy=@var{strategy}
32282 @opindex mmemcpy-strategy=@var{strategy}
32283 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
32284 should be inlined and what inline algorithm to use when the expected size
32285 of the copy operation is known. @var{strategy}
32286 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
32287 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
32288 the max byte size with which inline algorithm @var{alg} is allowed. For the last
32289 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
32290 in the list must be specified in increasing order. The minimal byte size for
32291 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
32292 preceding range.
32293
32294 @item -mmemset-strategy=@var{strategy}
32295 @opindex mmemset-strategy=@var{strategy}
32296 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
32297 @code{__builtin_memset} expansion.
32298
32299 @item -momit-leaf-frame-pointer
32300 @opindex momit-leaf-frame-pointer
32301 Don't keep the frame pointer in a register for leaf functions. This
32302 avoids the instructions to save, set up, and restore frame pointers and
32303 makes an extra register available in leaf functions. The option
32304 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
32305 which might make debugging harder.
32306
32307 @item -mtls-direct-seg-refs
32308 @itemx -mno-tls-direct-seg-refs
32309 @opindex mtls-direct-seg-refs
32310 Controls whether TLS variables may be accessed with offsets from the
32311 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
32312 or whether the thread base pointer must be added. Whether or not this
32313 is valid depends on the operating system, and whether it maps the
32314 segment to cover the entire TLS area.
32315
32316 For systems that use the GNU C Library, the default is on.
32317
32318 @item -msse2avx
32319 @itemx -mno-sse2avx
32320 @opindex msse2avx
32321 Specify that the assembler should encode SSE instructions with VEX
32322 prefix. The option @option{-mavx} turns this on by default.
32323
32324 @item -mfentry
32325 @itemx -mno-fentry
32326 @opindex mfentry
32327 If profiling is active (@option{-pg}), put the profiling
32328 counter call before the prologue.
32329 Note: On x86 architectures the attribute @code{ms_hook_prologue}
32330 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
32331
32332 @item -mrecord-mcount
32333 @itemx -mno-record-mcount
32334 @opindex mrecord-mcount
32335 If profiling is active (@option{-pg}), generate a __mcount_loc section
32336 that contains pointers to each profiling call. This is useful for
32337 automatically patching and out calls.
32338
32339 @item -mnop-mcount
32340 @itemx -mno-nop-mcount
32341 @opindex mnop-mcount
32342 If profiling is active (@option{-pg}), generate the calls to
32343 the profiling functions as NOPs. This is useful when they
32344 should be patched in later dynamically. This is likely only
32345 useful together with @option{-mrecord-mcount}.
32346
32347 @item -minstrument-return=@var{type}
32348 @opindex minstrument-return
32349 Instrument function exit in -pg -mfentry instrumented functions with
32350 call to specified function. This only instruments true returns ending
32351 with ret, but not sibling calls ending with jump. Valid types
32352 are @var{none} to not instrument, @var{call} to generate a call to __return__,
32353 or @var{nop5} to generate a 5 byte nop.
32354
32355 @item -mrecord-return
32356 @itemx -mno-record-return
32357 @opindex mrecord-return
32358 Generate a __return_loc section pointing to all return instrumentation code.
32359
32360 @item -mfentry-name=@var{name}
32361 @opindex mfentry-name
32362 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
32363
32364 @item -mfentry-section=@var{name}
32365 @opindex mfentry-section
32366 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
32367
32368 @item -mskip-rax-setup
32369 @itemx -mno-skip-rax-setup
32370 @opindex mskip-rax-setup
32371 When generating code for the x86-64 architecture with SSE extensions
32372 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
32373 register when there are no variable arguments passed in vector registers.
32374
32375 @strong{Warning:} Since RAX register is used to avoid unnecessarily
32376 saving vector registers on stack when passing variable arguments, the
32377 impacts of this option are callees may waste some stack space,
32378 misbehave or jump to a random location. GCC 4.4 or newer don't have
32379 those issues, regardless the RAX register value.
32380
32381 @item -m8bit-idiv
32382 @itemx -mno-8bit-idiv
32383 @opindex m8bit-idiv
32384 On some processors, like Intel Atom, 8-bit unsigned integer divide is
32385 much faster than 32-bit/64-bit integer divide. This option generates a
32386 run-time check. If both dividend and divisor are within range of 0
32387 to 255, 8-bit unsigned integer divide is used instead of
32388 32-bit/64-bit integer divide.
32389
32390 @item -mavx256-split-unaligned-load
32391 @itemx -mavx256-split-unaligned-store
32392 @opindex mavx256-split-unaligned-load
32393 @opindex mavx256-split-unaligned-store
32394 Split 32-byte AVX unaligned load and store.
32395
32396 @item -mstack-protector-guard=@var{guard}
32397 @itemx -mstack-protector-guard-reg=@var{reg}
32398 @itemx -mstack-protector-guard-offset=@var{offset}
32399 @opindex mstack-protector-guard
32400 @opindex mstack-protector-guard-reg
32401 @opindex mstack-protector-guard-offset
32402 Generate stack protection code using canary at @var{guard}. Supported
32403 locations are @samp{global} for global canary or @samp{tls} for per-thread
32404 canary in the TLS block (the default). This option has effect only when
32405 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
32406
32407 With the latter choice the options
32408 @option{-mstack-protector-guard-reg=@var{reg}} and
32409 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32410 which segment register (@code{%fs} or @code{%gs}) to use as base register
32411 for reading the canary, and from what offset from that base register.
32412 The default for those is as specified in the relevant ABI.
32413
32414 @item -mgeneral-regs-only
32415 @opindex mgeneral-regs-only
32416 Generate code that uses only the general-purpose registers. This
32417 prevents the compiler from using floating-point, vector, mask and bound
32418 registers.
32419
32420 @item -mrelax-cmpxchg-loop
32421 @opindex mrelax-cmpxchg-loop
32422 Relax cmpxchg loop by emitting an early load and compare before cmpxchg,
32423 execute pause if load value is not expected. This reduces excessive
32424 cachline bouncing when and works for all atomic logic fetch builtins
32425 that generates compare and swap loop.
32426
32427 @item -mindirect-branch=@var{choice}
32428 @opindex mindirect-branch
32429 Convert indirect call and jump with @var{choice}. The default is
32430 @samp{keep}, which keeps indirect call and jump unmodified.
32431 @samp{thunk} converts indirect call and jump to call and return thunk.
32432 @samp{thunk-inline} converts indirect call and jump to inlined call
32433 and return thunk. @samp{thunk-extern} converts indirect call and jump
32434 to external call and return thunk provided in a separate object file.
32435 You can control this behavior for a specific function by using the
32436 function attribute @code{indirect_branch}. @xref{Function Attributes}.
32437
32438 Note that @option{-mcmodel=large} is incompatible with
32439 @option{-mindirect-branch=thunk} and
32440 @option{-mindirect-branch=thunk-extern} since the thunk function may
32441 not be reachable in the large code model.
32442
32443 Note that @option{-mindirect-branch=thunk-extern} is compatible with
32444 @option{-fcf-protection=branch} since the external thunk can be made
32445 to enable control-flow check.
32446
32447 @item -mfunction-return=@var{choice}
32448 @opindex mfunction-return
32449 Convert function return with @var{choice}. The default is @samp{keep},
32450 which keeps function return unmodified. @samp{thunk} converts function
32451 return to call and return thunk. @samp{thunk-inline} converts function
32452 return to inlined call and return thunk. @samp{thunk-extern} converts
32453 function return to external call and return thunk provided in a separate
32454 object file. You can control this behavior for a specific function by
32455 using the function attribute @code{function_return}.
32456 @xref{Function Attributes}.
32457
32458 Note that @option{-mindirect-return=thunk-extern} is compatible with
32459 @option{-fcf-protection=branch} since the external thunk can be made
32460 to enable control-flow check.
32461
32462 Note that @option{-mcmodel=large} is incompatible with
32463 @option{-mfunction-return=thunk} and
32464 @option{-mfunction-return=thunk-extern} since the thunk function may
32465 not be reachable in the large code model.
32466
32467
32468 @item -mindirect-branch-register
32469 @opindex mindirect-branch-register
32470 Force indirect call and jump via register.
32471
32472 @item -mharden-sls=@var{choice}
32473 @opindex mharden-sls
32474 Generate code to mitigate against straight line speculation (SLS) with
32475 @var{choice}. The default is @samp{none} which disables all SLS
32476 hardening. @samp{return} enables SLS hardening for function return.
32477 @samp{indirect-branch} enables SLS hardening for indirect branch.
32478 @samp{all} enables all SLS hardening.
32479
32480 @item -mindirect-branch-cs-prefix
32481 @opindex mindirect-branch-cs-prefix
32482 Add CS prefix to call and jmp to indirect thunk with branch target in
32483 r8-r15 registers so that the call and jmp instruction length is 6 bytes
32484 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
32485 @samp{lfence; jmp *%r8-r15} at run-time.
32486
32487 @end table
32488
32489 These @samp{-m} switches are supported in addition to the above
32490 on x86-64 processors in 64-bit environments.
32491
32492 @table @gcctabopt
32493 @item -m32
32494 @itemx -m64
32495 @itemx -mx32
32496 @itemx -m16
32497 @itemx -miamcu
32498 @opindex m32
32499 @opindex m64
32500 @opindex mx32
32501 @opindex m16
32502 @opindex miamcu
32503 Generate code for a 16-bit, 32-bit or 64-bit environment.
32504 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
32505 to 32 bits, and
32506 generates code that runs on any i386 system.
32507
32508 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
32509 types to 64 bits, and generates code for the x86-64 architecture.
32510 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
32511 and @option{-mdynamic-no-pic} options.
32512
32513 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
32514 to 32 bits, and
32515 generates code for the x86-64 architecture.
32516
32517 The @option{-m16} option is the same as @option{-m32}, except for that
32518 it outputs the @code{.code16gcc} assembly directive at the beginning of
32519 the assembly output so that the binary can run in 16-bit mode.
32520
32521 The @option{-miamcu} option generates code which conforms to Intel MCU
32522 psABI. It requires the @option{-m32} option to be turned on.
32523
32524 @item -mno-red-zone
32525 @opindex mno-red-zone
32526 @opindex mred-zone
32527 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
32528 by the x86-64 ABI; it is a 128-byte area beyond the location of the
32529 stack pointer that is not modified by signal or interrupt handlers
32530 and therefore can be used for temporary data without adjusting the stack
32531 pointer. The flag @option{-mno-red-zone} disables this red zone.
32532
32533 @item -mcmodel=small
32534 @opindex mcmodel=small
32535 Generate code for the small code model: the program and its symbols must
32536 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
32537 Programs can be statically or dynamically linked. This is the default
32538 code model.
32539
32540 @item -mcmodel=kernel
32541 @opindex mcmodel=kernel
32542 Generate code for the kernel code model. The kernel runs in the
32543 negative 2 GB of the address space.
32544 This model has to be used for Linux kernel code.
32545
32546 @item -mcmodel=medium
32547 @opindex mcmodel=medium
32548 Generate code for the medium model: the program is linked in the lower 2
32549 GB of the address space. Small symbols are also placed there. Symbols
32550 with sizes larger than @option{-mlarge-data-threshold} are put into
32551 large data or BSS sections and can be located above 2GB. Programs can
32552 be statically or dynamically linked.
32553
32554 @item -mcmodel=large
32555 @opindex mcmodel=large
32556 Generate code for the large model. This model makes no assumptions
32557 about addresses and sizes of sections.
32558
32559 @item -maddress-mode=long
32560 @opindex maddress-mode=long
32561 Generate code for long address mode. This is only supported for 64-bit
32562 and x32 environments. It is the default address mode for 64-bit
32563 environments.
32564
32565 @item -maddress-mode=short
32566 @opindex maddress-mode=short
32567 Generate code for short address mode. This is only supported for 32-bit
32568 and x32 environments. It is the default address mode for 32-bit and
32569 x32 environments.
32570
32571 @item -mneeded
32572 @itemx -mno-needed
32573 @opindex mneeded
32574 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
32575 indicate the micro-architecture ISA level required to execute the binary.
32576 @end table
32577
32578 @node x86 Windows Options
32579 @subsection x86 Windows Options
32580 @cindex x86 Windows Options
32581 @cindex Windows Options for x86
32582
32583 These additional options are available for Microsoft Windows targets:
32584
32585 @table @gcctabopt
32586 @item -mconsole
32587 @opindex mconsole
32588 This option
32589 specifies that a console application is to be generated, by
32590 instructing the linker to set the PE header subsystem type
32591 required for console applications.
32592 This option is available for Cygwin and MinGW targets and is
32593 enabled by default on those targets.
32594
32595 @item -mdll
32596 @opindex mdll
32597 This option is available for Cygwin and MinGW targets. It
32598 specifies that a DLL---a dynamic link library---is to be
32599 generated, enabling the selection of the required runtime
32600 startup object and entry point.
32601
32602 @item -mnop-fun-dllimport
32603 @opindex mnop-fun-dllimport
32604 This option is available for Cygwin and MinGW targets. It
32605 specifies that the @code{dllimport} attribute should be ignored.
32606
32607 @item -mthreads
32608 @opindex mthreads
32609 This option is available for MinGW targets. It specifies
32610 that MinGW-specific thread support is to be used.
32611
32612 @item -municode
32613 @opindex municode
32614 This option is available for MinGW-w64 targets. It causes
32615 the @code{UNICODE} preprocessor macro to be predefined, and
32616 chooses Unicode-capable runtime startup code.
32617
32618 @item -mwin32
32619 @opindex mwin32
32620 This option is available for Cygwin and MinGW targets. It
32621 specifies that the typical Microsoft Windows predefined macros are to
32622 be set in the pre-processor, but does not influence the choice
32623 of runtime library/startup code.
32624
32625 @item -mwindows
32626 @opindex mwindows
32627 This option is available for Cygwin and MinGW targets. It
32628 specifies that a GUI application is to be generated by
32629 instructing the linker to set the PE header subsystem type
32630 appropriately.
32631
32632 @item -fno-set-stack-executable
32633 @opindex fno-set-stack-executable
32634 @opindex fset-stack-executable
32635 This option is available for MinGW targets. It specifies that
32636 the executable flag for the stack used by nested functions isn't
32637 set. This is necessary for binaries running in kernel mode of
32638 Microsoft Windows, as there the User32 API, which is used to set executable
32639 privileges, isn't available.
32640
32641 @item -fwritable-relocated-rdata
32642 @opindex fno-writable-relocated-rdata
32643 @opindex fwritable-relocated-rdata
32644 This option is available for MinGW and Cygwin targets. It specifies
32645 that relocated-data in read-only section is put into the @code{.data}
32646 section. This is a necessary for older runtimes not supporting
32647 modification of @code{.rdata} sections for pseudo-relocation.
32648
32649 @item -mpe-aligned-commons
32650 @opindex mpe-aligned-commons
32651 This option is available for Cygwin and MinGW targets. It
32652 specifies that the GNU extension to the PE file format that
32653 permits the correct alignment of COMMON variables should be
32654 used when generating code. It is enabled by default if
32655 GCC detects that the target assembler found during configuration
32656 supports the feature.
32657 @end table
32658
32659 See also under @ref{x86 Options} for standard options.
32660
32661 @node Xstormy16 Options
32662 @subsection Xstormy16 Options
32663 @cindex Xstormy16 Options
32664
32665 These options are defined for Xstormy16:
32666
32667 @table @gcctabopt
32668 @item -msim
32669 @opindex msim
32670 Choose startup files and linker script suitable for the simulator.
32671 @end table
32672
32673 @node Xtensa Options
32674 @subsection Xtensa Options
32675 @cindex Xtensa Options
32676
32677 These options are supported for Xtensa targets:
32678
32679 @table @gcctabopt
32680 @item -mconst16
32681 @itemx -mno-const16
32682 @opindex mconst16
32683 @opindex mno-const16
32684 Enable or disable use of @code{CONST16} instructions for loading
32685 constant values. The @code{CONST16} instruction is currently not a
32686 standard option from Tensilica. When enabled, @code{CONST16}
32687 instructions are always used in place of the standard @code{L32R}
32688 instructions. The use of @code{CONST16} is enabled by default only if
32689 the @code{L32R} instruction is not available.
32690
32691 @item -mfused-madd
32692 @itemx -mno-fused-madd
32693 @opindex mfused-madd
32694 @opindex mno-fused-madd
32695 Enable or disable use of fused multiply/add and multiply/subtract
32696 instructions in the floating-point option. This has no effect if the
32697 floating-point option is not also enabled. Disabling fused multiply/add
32698 and multiply/subtract instructions forces the compiler to use separate
32699 instructions for the multiply and add/subtract operations. This may be
32700 desirable in some cases where strict IEEE 754-compliant results are
32701 required: the fused multiply add/subtract instructions do not round the
32702 intermediate result, thereby producing results with @emph{more} bits of
32703 precision than specified by the IEEE standard. Disabling fused multiply
32704 add/subtract instructions also ensures that the program output is not
32705 sensitive to the compiler's ability to combine multiply and add/subtract
32706 operations.
32707
32708 @item -mserialize-volatile
32709 @itemx -mno-serialize-volatile
32710 @opindex mserialize-volatile
32711 @opindex mno-serialize-volatile
32712 When this option is enabled, GCC inserts @code{MEMW} instructions before
32713 @code{volatile} memory references to guarantee sequential consistency.
32714 The default is @option{-mserialize-volatile}. Use
32715 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
32716
32717 @item -mforce-no-pic
32718 @opindex mforce-no-pic
32719 For targets, like GNU/Linux, where all user-mode Xtensa code must be
32720 position-independent code (PIC), this option disables PIC for compiling
32721 kernel code.
32722
32723 @item -mtext-section-literals
32724 @itemx -mno-text-section-literals
32725 @opindex mtext-section-literals
32726 @opindex mno-text-section-literals
32727 These options control the treatment of literal pools. The default is
32728 @option{-mno-text-section-literals}, which places literals in a separate
32729 section in the output file. This allows the literal pool to be placed
32730 in a data RAM/ROM, and it also allows the linker to combine literal
32731 pools from separate object files to remove redundant literals and
32732 improve code size. With @option{-mtext-section-literals}, the literals
32733 are interspersed in the text section in order to keep them as close as
32734 possible to their references. This may be necessary for large assembly
32735 files. Literals for each function are placed right before that function.
32736
32737 @item -mauto-litpools
32738 @itemx -mno-auto-litpools
32739 @opindex mauto-litpools
32740 @opindex mno-auto-litpools
32741 These options control the treatment of literal pools. The default is
32742 @option{-mno-auto-litpools}, which places literals in a separate
32743 section in the output file unless @option{-mtext-section-literals} is
32744 used. With @option{-mauto-litpools} the literals are interspersed in
32745 the text section by the assembler. Compiler does not produce explicit
32746 @code{.literal} directives and loads literals into registers with
32747 @code{MOVI} instructions instead of @code{L32R} to let the assembler
32748 do relaxation and place literals as necessary. This option allows
32749 assembler to create several literal pools per function and assemble
32750 very big functions, which may not be possible with
32751 @option{-mtext-section-literals}.
32752
32753 @item -mtarget-align
32754 @itemx -mno-target-align
32755 @opindex mtarget-align
32756 @opindex mno-target-align
32757 When this option is enabled, GCC instructs the assembler to
32758 automatically align instructions to reduce branch penalties at the
32759 expense of some code density. The assembler attempts to widen density
32760 instructions to align branch targets and the instructions following call
32761 instructions. If there are not enough preceding safe density
32762 instructions to align a target, no widening is performed. The
32763 default is @option{-mtarget-align}. These options do not affect the
32764 treatment of auto-aligned instructions like @code{LOOP}, which the
32765 assembler always aligns, either by widening density instructions or
32766 by inserting NOP instructions.
32767
32768 @item -mlongcalls
32769 @itemx -mno-longcalls
32770 @opindex mlongcalls
32771 @opindex mno-longcalls
32772 When this option is enabled, GCC instructs the assembler to translate
32773 direct calls to indirect calls unless it can determine that the target
32774 of a direct call is in the range allowed by the call instruction. This
32775 translation typically occurs for calls to functions in other source
32776 files. Specifically, the assembler translates a direct @code{CALL}
32777 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
32778 The default is @option{-mno-longcalls}. This option should be used in
32779 programs where the call target can potentially be out of range. This
32780 option is implemented in the assembler, not the compiler, so the
32781 assembly code generated by GCC still shows direct call
32782 instructions---look at the disassembled object code to see the actual
32783 instructions. Note that the assembler uses an indirect call for
32784 every cross-file call, not just those that really are out of range.
32785
32786 @item -mabi=@var{name}
32787 @opindex mabi
32788 Generate code for the specified ABI@. Permissible values are: @samp{call0},
32789 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
32790
32791 @item -mabi=call0
32792 @opindex mabi=call0
32793 When this option is enabled function parameters are passed in registers
32794 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
32795 caller-saved, and register @code{a15} may be used as a frame pointer.
32796 When this version of the ABI is enabled the C preprocessor symbol
32797 @code{__XTENSA_CALL0_ABI__} is defined.
32798
32799 @item -mabi=windowed
32800 @opindex mabi=windowed
32801 When this option is enabled function parameters are passed in registers
32802 @code{a10} through @code{a15}, and called function rotates register window
32803 by 8 registers on entry so that its arguments are found in registers
32804 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
32805 pointer. Register window is rotated 8 registers back upon return.
32806 When this version of the ABI is enabled the C preprocessor symbol
32807 @code{__XTENSA_WINDOWED_ABI__} is defined.
32808 @end table
32809
32810 @node zSeries Options
32811 @subsection zSeries Options
32812 @cindex zSeries options
32813
32814 These are listed under @xref{S/390 and zSeries Options}.
32815
32816
32817 @c man end
32818
32819 @node Spec Files
32820 @section Specifying Subprocesses and the Switches to Pass to Them
32821 @cindex Spec Files
32822
32823 @command{gcc} is a driver program. It performs its job by invoking a
32824 sequence of other programs to do the work of compiling, assembling and
32825 linking. GCC interprets its command-line parameters and uses these to
32826 deduce which programs it should invoke, and which command-line options
32827 it ought to place on their command lines. This behavior is controlled
32828 by @dfn{spec strings}. In most cases there is one spec string for each
32829 program that GCC can invoke, but a few programs have multiple spec
32830 strings to control their behavior. The spec strings built into GCC can
32831 be overridden by using the @option{-specs=} command-line switch to specify
32832 a spec file.
32833
32834 @dfn{Spec files} are plain-text files that are used to construct spec
32835 strings. They consist of a sequence of directives separated by blank
32836 lines. The type of directive is determined by the first non-whitespace
32837 character on the line, which can be one of the following:
32838
32839 @table @code
32840 @item %@var{command}
32841 Issues a @var{command} to the spec file processor. The commands that can
32842 appear here are:
32843
32844 @table @code
32845 @item %include <@var{file}>
32846 @cindex @code{%include}
32847 Search for @var{file} and insert its text at the current point in the
32848 specs file.
32849
32850 @item %include_noerr <@var{file}>
32851 @cindex @code{%include_noerr}
32852 Just like @samp{%include}, but do not generate an error message if the include
32853 file cannot be found.
32854
32855 @item %rename @var{old_name} @var{new_name}
32856 @cindex @code{%rename}
32857 Rename the spec string @var{old_name} to @var{new_name}.
32858
32859 @end table
32860
32861 @item *[@var{spec_name}]:
32862 This tells the compiler to create, override or delete the named spec
32863 string. All lines after this directive up to the next directive or
32864 blank line are considered to be the text for the spec string. If this
32865 results in an empty string then the spec is deleted. (Or, if the
32866 spec did not exist, then nothing happens.) Otherwise, if the spec
32867 does not currently exist a new spec is created. If the spec does
32868 exist then its contents are overridden by the text of this
32869 directive, unless the first character of that text is the @samp{+}
32870 character, in which case the text is appended to the spec.
32871
32872 @item [@var{suffix}]:
32873 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
32874 and up to the next directive or blank line are considered to make up the
32875 spec string for the indicated suffix. When the compiler encounters an
32876 input file with the named suffix, it processes the spec string in
32877 order to work out how to compile that file. For example:
32878
32879 @smallexample
32880 .ZZ:
32881 z-compile -input %i
32882 @end smallexample
32883
32884 This says that any input file whose name ends in @samp{.ZZ} should be
32885 passed to the program @samp{z-compile}, which should be invoked with the
32886 command-line switch @option{-input} and with the result of performing the
32887 @samp{%i} substitution. (See below.)
32888
32889 As an alternative to providing a spec string, the text following a
32890 suffix directive can be one of the following:
32891
32892 @table @code
32893 @item @@@var{language}
32894 This says that the suffix is an alias for a known @var{language}. This is
32895 similar to using the @option{-x} command-line switch to GCC to specify a
32896 language explicitly. For example:
32897
32898 @smallexample
32899 .ZZ:
32900 @@c++
32901 @end smallexample
32902
32903 Says that .ZZ files are, in fact, C++ source files.
32904
32905 @item #@var{name}
32906 This causes an error messages saying:
32907
32908 @smallexample
32909 @var{name} compiler not installed on this system.
32910 @end smallexample
32911 @end table
32912
32913 GCC already has an extensive list of suffixes built into it.
32914 This directive adds an entry to the end of the list of suffixes, but
32915 since the list is searched from the end backwards, it is effectively
32916 possible to override earlier entries using this technique.
32917
32918 @end table
32919
32920 GCC has the following spec strings built into it. Spec files can
32921 override these strings or create their own. Note that individual
32922 targets can also add their own spec strings to this list.
32923
32924 @smallexample
32925 asm Options to pass to the assembler
32926 asm_final Options to pass to the assembler post-processor
32927 cpp Options to pass to the C preprocessor
32928 cc1 Options to pass to the C compiler
32929 cc1plus Options to pass to the C++ compiler
32930 endfile Object files to include at the end of the link
32931 link Options to pass to the linker
32932 lib Libraries to include on the command line to the linker
32933 libgcc Decides which GCC support library to pass to the linker
32934 linker Sets the name of the linker
32935 predefines Defines to be passed to the C preprocessor
32936 signed_char Defines to pass to CPP to say whether @code{char} is signed
32937 by default
32938 startfile Object files to include at the start of the link
32939 @end smallexample
32940
32941 Here is a small example of a spec file:
32942
32943 @smallexample
32944 %rename lib old_lib
32945
32946 *lib:
32947 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
32948 @end smallexample
32949
32950 This example renames the spec called @samp{lib} to @samp{old_lib} and
32951 then overrides the previous definition of @samp{lib} with a new one.
32952 The new definition adds in some extra command-line options before
32953 including the text of the old definition.
32954
32955 @dfn{Spec strings} are a list of command-line options to be passed to their
32956 corresponding program. In addition, the spec strings can contain
32957 @samp{%}-prefixed sequences to substitute variable text or to
32958 conditionally insert text into the command line. Using these constructs
32959 it is possible to generate quite complex command lines.
32960
32961 Here is a table of all defined @samp{%}-sequences for spec
32962 strings. Note that spaces are not generated automatically around the
32963 results of expanding these sequences. Therefore you can concatenate them
32964 together or combine them with constant text in a single argument.
32965
32966 @table @code
32967 @item %%
32968 Substitute one @samp{%} into the program name or argument.
32969
32970 @item %"
32971 Substitute an empty argument.
32972
32973 @item %i
32974 Substitute the name of the input file being processed.
32975
32976 @item %b
32977 Substitute the basename for outputs related with the input file being
32978 processed. This is often the substring up to (and not including) the
32979 last period and not including the directory but, unless %w is active, it
32980 expands to the basename for auxiliary outputs, which may be influenced
32981 by an explicit output name, and by various other options that control
32982 how auxiliary outputs are named.
32983
32984 @item %B
32985 This is the same as @samp{%b}, but include the file suffix (text after
32986 the last period). Without %w, it expands to the basename for dump
32987 outputs.
32988
32989 @item %d
32990 Marks the argument containing or following the @samp{%d} as a
32991 temporary file name, so that that file is deleted if GCC exits
32992 successfully. Unlike @samp{%g}, this contributes no text to the
32993 argument.
32994
32995 @item %g@var{suffix}
32996 Substitute a file name that has suffix @var{suffix} and is chosen
32997 once per compilation, and mark the argument in the same way as
32998 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
32999 name is now chosen in a way that is hard to predict even when previously
33000 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
33001 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
33002 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
33003 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
33004 was simply substituted with a file name chosen once per compilation,
33005 without regard to any appended suffix (which was therefore treated
33006 just like ordinary text), making such attacks more likely to succeed.
33007
33008 @item %u@var{suffix}
33009 Like @samp{%g}, but generates a new temporary file name
33010 each time it appears instead of once per compilation.
33011
33012 @item %U@var{suffix}
33013 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
33014 new one if there is no such last file name. In the absence of any
33015 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
33016 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
33017 involves the generation of two distinct file names, one
33018 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
33019 simply substituted with a file name chosen for the previous @samp{%u},
33020 without regard to any appended suffix.
33021
33022 @item %j@var{suffix}
33023 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
33024 writable, and if @option{-save-temps} is not used;
33025 otherwise, substitute the name
33026 of a temporary file, just like @samp{%u}. This temporary file is not
33027 meant for communication between processes, but rather as a junk
33028 disposal mechanism.
33029
33030 @item %|@var{suffix}
33031 @itemx %m@var{suffix}
33032 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
33033 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
33034 all. These are the two most common ways to instruct a program that it
33035 should read from standard input or write to standard output. If you
33036 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
33037 construct: see for example @file{gcc/fortran/lang-specs.h}.
33038
33039 @item %.@var{SUFFIX}
33040 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
33041 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
33042 terminated by the next space or %.
33043
33044 @item %w
33045 Marks the argument containing or following the @samp{%w} as the
33046 designated output file of this compilation. This puts the argument
33047 into the sequence of arguments that @samp{%o} substitutes.
33048
33049 @item %V
33050 Indicates that this compilation produces no output file.
33051
33052 @item %o
33053 Substitutes the names of all the output files, with spaces
33054 automatically placed around them. You should write spaces
33055 around the @samp{%o} as well or the results are undefined.
33056 @samp{%o} is for use in the specs for running the linker.
33057 Input files whose names have no recognized suffix are not compiled
33058 at all, but they are included among the output files, so they are
33059 linked.
33060
33061 @item %O
33062 Substitutes the suffix for object files. Note that this is
33063 handled specially when it immediately follows @samp{%g, %u, or %U},
33064 because of the need for those to form complete file names. The
33065 handling is such that @samp{%O} is treated exactly as if it had already
33066 been substituted, except that @samp{%g, %u, and %U} do not currently
33067 support additional @var{suffix} characters following @samp{%O} as they do
33068 following, for example, @samp{.o}.
33069
33070 @item %I
33071 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
33072 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
33073 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
33074 and @option{-imultilib} as necessary.
33075
33076 @item %s
33077 Current argument is the name of a library or startup file of some sort.
33078 Search for that file in a standard list of directories and substitute
33079 the full name found. The current working directory is included in the
33080 list of directories scanned.
33081
33082 @item %T
33083 Current argument is the name of a linker script. Search for that file
33084 in the current list of directories to scan for libraries. If the file
33085 is located insert a @option{--script} option into the command line
33086 followed by the full path name found. If the file is not found then
33087 generate an error message. Note: the current working directory is not
33088 searched.
33089
33090 @item %e@var{str}
33091 Print @var{str} as an error message. @var{str} is terminated by a newline.
33092 Use this when inconsistent options are detected.
33093
33094 @item %n@var{str}
33095 Print @var{str} as a notice. @var{str} is terminated by a newline.
33096
33097 @item %(@var{name})
33098 Substitute the contents of spec string @var{name} at this point.
33099
33100 @item %x@{@var{option}@}
33101 Accumulate an option for @samp{%X}.
33102
33103 @item %X
33104 Output the accumulated linker options specified by a @samp{%x} spec string.
33105
33106 @item %Y
33107 Output the accumulated assembler options specified by @option{-Wa}.
33108
33109 @item %Z
33110 Output the accumulated preprocessor options specified by @option{-Wp}.
33111
33112 @item %M
33113 Output @code{multilib_os_dir}.
33114
33115 @item %R
33116 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
33117
33118 @item %a
33119 Process the @code{asm} spec. This is used to compute the
33120 switches to be passed to the assembler.
33121
33122 @item %A
33123 Process the @code{asm_final} spec. This is a spec string for
33124 passing switches to an assembler post-processor, if such a program is
33125 needed.
33126
33127 @item %l
33128 Process the @code{link} spec. This is the spec for computing the
33129 command line passed to the linker. Typically it makes use of the
33130 @samp{%L %G %S %D and %E} sequences.
33131
33132 @item %D
33133 Dump out a @option{-L} option for each directory that GCC believes might
33134 contain startup files. If the target supports multilibs then the
33135 current multilib directory is prepended to each of these paths.
33136
33137 @item %L
33138 Process the @code{lib} spec. This is a spec string for deciding which
33139 libraries are included on the command line to the linker.
33140
33141 @item %G
33142 Process the @code{libgcc} spec. This is a spec string for deciding
33143 which GCC support library is included on the command line to the linker.
33144
33145 @item %S
33146 Process the @code{startfile} spec. This is a spec for deciding which
33147 object files are the first ones passed to the linker. Typically
33148 this might be a file named @file{crt0.o}.
33149
33150 @item %E
33151 Process the @code{endfile} spec. This is a spec string that specifies
33152 the last object files that are passed to the linker.
33153
33154 @item %C
33155 Process the @code{cpp} spec. This is used to construct the arguments
33156 to be passed to the C preprocessor.
33157
33158 @item %1
33159 Process the @code{cc1} spec. This is used to construct the options to be
33160 passed to the actual C compiler (@command{cc1}).
33161
33162 @item %2
33163 Process the @code{cc1plus} spec. This is used to construct the options to be
33164 passed to the actual C++ compiler (@command{cc1plus}).
33165
33166 @item %*
33167 Substitute the variable part of a matched option. See below.
33168 Note that each comma in the substituted string is replaced by
33169 a single space.
33170
33171 @item %<S
33172 Remove all occurrences of @code{-S} from the command line. Note---this
33173 command is position dependent. @samp{%} commands in the spec string
33174 before this one see @code{-S}, @samp{%} commands in the spec string
33175 after this one do not.
33176
33177 @item %<S*
33178 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
33179
33180 @item %>S
33181 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
33182
33183 @item %:@var{function}(@var{args})
33184 Call the named function @var{function}, passing it @var{args}.
33185 @var{args} is first processed as a nested spec string, then split
33186 into an argument vector in the usual fashion. The function returns
33187 a string which is processed as if it had appeared literally as part
33188 of the current spec.
33189
33190 The following built-in spec functions are provided:
33191
33192 @table @code
33193 @item @code{getenv}
33194 The @code{getenv} spec function takes two arguments: an environment
33195 variable name and a string. If the environment variable is not
33196 defined, a fatal error is issued. Otherwise, the return value is the
33197 value of the environment variable concatenated with the string. For
33198 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
33199
33200 @smallexample
33201 %:getenv(TOPDIR /include)
33202 @end smallexample
33203
33204 expands to @file{/path/to/top/include}.
33205
33206 @item @code{if-exists}
33207 The @code{if-exists} spec function takes one argument, an absolute
33208 pathname to a file. If the file exists, @code{if-exists} returns the
33209 pathname. Here is a small example of its usage:
33210
33211 @smallexample
33212 *startfile:
33213 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
33214 @end smallexample
33215
33216 @item @code{if-exists-else}
33217 The @code{if-exists-else} spec function is similar to the @code{if-exists}
33218 spec function, except that it takes two arguments. The first argument is
33219 an absolute pathname to a file. If the file exists, @code{if-exists-else}
33220 returns the pathname. If it does not exist, it returns the second argument.
33221 This way, @code{if-exists-else} can be used to select one file or another,
33222 based on the existence of the first. Here is a small example of its usage:
33223
33224 @smallexample
33225 *startfile:
33226 crt0%O%s %:if-exists(crti%O%s) \
33227 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
33228 @end smallexample
33229
33230 @item @code{if-exists-then-else}
33231 The @code{if-exists-then-else} spec function takes at least two arguments
33232 and an optional third one. The first argument is an absolute pathname to a
33233 file. If the file exists, the function returns the second argument.
33234 If the file does not exist, the function returns the third argument if there
33235 is one, or NULL otherwise. This can be used to expand one text, or optionally
33236 another, based on the existence of a file. Here is a small example of its
33237 usage:
33238
33239 @smallexample
33240 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
33241 @end smallexample
33242
33243 @item @code{sanitize}
33244 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
33245 any address, thread or undefined behavior sanitizers are active.
33246
33247 @smallexample
33248 %@{%:sanitize(address):-funwind-tables@}
33249 @end smallexample
33250
33251 @item @code{replace-outfile}
33252 The @code{replace-outfile} spec function takes two arguments. It looks for the
33253 first argument in the outfiles array and replaces it with the second argument. Here
33254 is a small example of its usage:
33255
33256 @smallexample
33257 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
33258 @end smallexample
33259
33260 @item @code{remove-outfile}
33261 The @code{remove-outfile} spec function takes one argument. It looks for the
33262 first argument in the outfiles array and removes it. Here is a small example
33263 its usage:
33264
33265 @smallexample
33266 %:remove-outfile(-lm)
33267 @end smallexample
33268
33269 @item @code{version-compare}
33270 The @code{version-compare} spec function takes four or five arguments of the following
33271 form:
33272
33273 @smallexample
33274 <comparison-op> <arg1> [<arg2>] <switch> <result>
33275 @end smallexample
33276
33277 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
33278 The supported @code{comparison-op} values are:
33279
33280 @table @code
33281 @item >=
33282 True if @code{switch} is a later (or same) version than @code{arg1}
33283
33284 @item !>
33285 Opposite of @code{>=}
33286
33287 @item <
33288 True if @code{switch} is an earlier version than @code{arg1}
33289
33290 @item !<
33291 Opposite of @code{<}
33292
33293 @item ><
33294 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
33295
33296 @item <>
33297 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
33298 @end table
33299
33300 If the @code{switch} is not present at all, the condition is false unless the first character
33301 of the @code{comparison-op} is @code{!}.
33302
33303 @smallexample
33304 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
33305 @end smallexample
33306
33307 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
33308 passed.
33309
33310 @item @code{include}
33311 The @code{include} spec function behaves much like @code{%include}, with the advantage
33312 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
33313 the filename, and looks for it in the startfile path. It always returns NULL.
33314
33315 @smallexample
33316 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
33317 @end smallexample
33318
33319 @item @code{pass-through-libs}
33320 The @code{pass-through-libs} spec function takes any number of arguments. It
33321 finds any @option{-l} options and any non-options ending in @file{.a} (which it
33322 assumes are the names of linker input library archive files) and returns a
33323 result containing all the found arguments each prepended by
33324 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
33325 intended to be passed to the LTO linker plugin.
33326
33327 @smallexample
33328 %:pass-through-libs(%G %L %G)
33329 @end smallexample
33330
33331 @item @code{print-asm-header}
33332 The @code{print-asm-header} function takes no arguments and simply
33333 prints a banner like:
33334
33335 @smallexample
33336 Assembler options
33337 =================
33338
33339 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
33340 @end smallexample
33341
33342 It is used to separate compiler options from assembler options
33343 in the @option{--target-help} output.
33344
33345 @item @code{gt}
33346 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
33347 empty string) if the second-to-last argument is greater than the last argument, and NULL
33348 otherwise. The following example inserts the @code{link_gomp} spec if the last
33349 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
33350
33351 @smallexample
33352 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
33353 @end smallexample
33354
33355 @item @code{debug-level-gt}
33356 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
33357 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
33358 otherwise.
33359
33360 @smallexample
33361 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
33362 @end smallexample
33363 @end table
33364
33365 @item %@{S@}
33366 Substitutes the @code{-S} switch, if that switch is given to GCC@.
33367 If that switch is not specified, this substitutes nothing. Note that
33368 the leading dash is omitted when specifying this option, and it is
33369 automatically inserted if the substitution is performed. Thus the spec
33370 string @samp{%@{foo@}} matches the command-line option @option{-foo}
33371 and outputs the command-line option @option{-foo}.
33372
33373 @item %W@{S@}
33374 Like %@{@code{S}@} but mark last argument supplied within as a file to be
33375 deleted on failure.
33376
33377 @item %@@@{S@}
33378 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
33379 @code{@@FILE} if an @code{@@file} argument has been supplied.
33380
33381 @item %@{S*@}
33382 Substitutes all the switches specified to GCC whose names start
33383 with @code{-S}, but which also take an argument. This is used for
33384 switches like @option{-o}, @option{-D}, @option{-I}, etc.
33385 GCC considers @option{-o foo} as being
33386 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
33387 text, including the space. Thus two arguments are generated.
33388
33389 @item %@{S*&T*@}
33390 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
33391 (the order of @code{S} and @code{T} in the spec is not significant).
33392 There can be any number of ampersand-separated variables; for each the
33393 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
33394
33395 @item %@{S:X@}
33396 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
33397
33398 @item %@{!S:X@}
33399 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
33400
33401 @item %@{S*:X@}
33402 Substitutes @code{X} if one or more switches whose names start with
33403 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
33404 once, no matter how many such switches appeared. However, if @code{%*}
33405 appears somewhere in @code{X}, then @code{X} is substituted once
33406 for each matching switch, with the @code{%*} replaced by the part of
33407 that switch matching the @code{*}.
33408
33409 If @code{%*} appears as the last part of a spec sequence then a space
33410 is added after the end of the last substitution. If there is more
33411 text in the sequence, however, then a space is not generated. This
33412 allows the @code{%*} substitution to be used as part of a larger
33413 string. For example, a spec string like this:
33414
33415 @smallexample
33416 %@{mcu=*:--script=%*/memory.ld@}
33417 @end smallexample
33418
33419 @noindent
33420 when matching an option like @option{-mcu=newchip} produces:
33421
33422 @smallexample
33423 --script=newchip/memory.ld
33424 @end smallexample
33425
33426 @item %@{.S:X@}
33427 Substitutes @code{X}, if processing a file with suffix @code{S}.
33428
33429 @item %@{!.S:X@}
33430 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
33431
33432 @item %@{,S:X@}
33433 Substitutes @code{X}, if processing a file for language @code{S}.
33434
33435 @item %@{!,S:X@}
33436 Substitutes @code{X}, if not processing a file for language @code{S}.
33437
33438 @item %@{S|P:X@}
33439 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
33440 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
33441 @code{*} sequences as well, although they have a stronger binding than
33442 the @samp{|}. If @code{%*} appears in @code{X}, all of the
33443 alternatives must be starred, and only the first matching alternative
33444 is substituted.
33445
33446 For example, a spec string like this:
33447
33448 @smallexample
33449 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
33450 @end smallexample
33451
33452 @noindent
33453 outputs the following command-line options from the following input
33454 command-line options:
33455
33456 @smallexample
33457 fred.c -foo -baz
33458 jim.d -bar -boggle
33459 -d fred.c -foo -baz -boggle
33460 -d jim.d -bar -baz -boggle
33461 @end smallexample
33462
33463 @item %@{%:@var{function}(@var{args}):X@}
33464
33465 Call function named @var{function} with args @var{args}. If the
33466 function returns non-NULL, then @code{X} is substituted, if it returns
33467 NULL, it isn't substituted.
33468
33469 @item %@{S:X; T:Y; :D@}
33470
33471 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
33472 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
33473 be as many clauses as you need. This may be combined with @code{.},
33474 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
33475
33476
33477 @end table
33478
33479 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
33480 or similar construct can use a backslash to ignore the special meaning
33481 of the character following it, thus allowing literal matching of a
33482 character that is otherwise specially treated. For example,
33483 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
33484 @option{-std=iso9899:1999} option is given.
33485
33486 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
33487 construct may contain other nested @samp{%} constructs or spaces, or
33488 even newlines. They are processed as usual, as described above.
33489 Trailing white space in @code{X} is ignored. White space may also
33490 appear anywhere on the left side of the colon in these constructs,
33491 except between @code{.} or @code{*} and the corresponding word.
33492
33493 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
33494 handled specifically in these constructs. If another value of
33495 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
33496 @option{-W} switch is found later in the command line, the earlier
33497 switch value is ignored, except with @{@code{S}*@} where @code{S} is
33498 just one letter, which passes all matching options.
33499
33500 The character @samp{|} at the beginning of the predicate text is used to
33501 indicate that a command should be piped to the following command, but
33502 only if @option{-pipe} is specified.
33503
33504 It is built into GCC which switches take arguments and which do not.
33505 (You might think it would be useful to generalize this to allow each
33506 compiler's spec to say which switches take arguments. But this cannot
33507 be done in a consistent fashion. GCC cannot even decide which input
33508 files have been specified without knowing which switches take arguments,
33509 and it must know which input files to compile in order to tell which
33510 compilers to run).
33511
33512 GCC also knows implicitly that arguments starting in @option{-l} are to be
33513 treated as compiler output files, and passed to the linker in their
33514 proper position among the other output files.
33515
33516 @node Environment Variables
33517 @section Environment Variables Affecting GCC
33518 @cindex environment variables
33519
33520 @c man begin ENVIRONMENT
33521 This section describes several environment variables that affect how GCC
33522 operates. Some of them work by specifying directories or prefixes to use
33523 when searching for various kinds of files. Some are used to specify other
33524 aspects of the compilation environment.
33525
33526 Note that you can also specify places to search using options such as
33527 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
33528 take precedence over places specified using environment variables, which
33529 in turn take precedence over those specified by the configuration of GCC@.
33530 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
33531 GNU Compiler Collection (GCC) Internals}.
33532
33533 @table @env
33534 @item LANG
33535 @itemx LC_CTYPE
33536 @c @itemx LC_COLLATE
33537 @itemx LC_MESSAGES
33538 @c @itemx LC_MONETARY
33539 @c @itemx LC_NUMERIC
33540 @c @itemx LC_TIME
33541 @itemx LC_ALL
33542 @findex LANG
33543 @findex LC_CTYPE
33544 @c @findex LC_COLLATE
33545 @findex LC_MESSAGES
33546 @c @findex LC_MONETARY
33547 @c @findex LC_NUMERIC
33548 @c @findex LC_TIME
33549 @findex LC_ALL
33550 @cindex locale
33551 These environment variables control the way that GCC uses
33552 localization information which allows GCC to work with different
33553 national conventions. GCC inspects the locale categories
33554 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
33555 so. These locale categories can be set to any value supported by your
33556 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
33557 Kingdom encoded in UTF-8.
33558
33559 The @env{LC_CTYPE} environment variable specifies character
33560 classification. GCC uses it to determine the character boundaries in
33561 a string; this is needed for some multibyte encodings that contain quote
33562 and escape characters that are otherwise interpreted as a string
33563 end or escape.
33564
33565 The @env{LC_MESSAGES} environment variable specifies the language to
33566 use in diagnostic messages.
33567
33568 If the @env{LC_ALL} environment variable is set, it overrides the value
33569 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
33570 and @env{LC_MESSAGES} default to the value of the @env{LANG}
33571 environment variable. If none of these variables are set, GCC
33572 defaults to traditional C English behavior.
33573
33574 @item TMPDIR
33575 @findex TMPDIR
33576 If @env{TMPDIR} is set, it specifies the directory to use for temporary
33577 files. GCC uses temporary files to hold the output of one stage of
33578 compilation which is to be used as input to the next stage: for example,
33579 the output of the preprocessor, which is the input to the compiler
33580 proper.
33581
33582 @item GCC_COMPARE_DEBUG
33583 @findex GCC_COMPARE_DEBUG
33584 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
33585 @option{-fcompare-debug} to the compiler driver. See the documentation
33586 of this option for more details.
33587
33588 @item GCC_EXEC_PREFIX
33589 @findex GCC_EXEC_PREFIX
33590 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
33591 names of the subprograms executed by the compiler. No slash is added
33592 when this prefix is combined with the name of a subprogram, but you can
33593 specify a prefix that ends with a slash if you wish.
33594
33595 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
33596 an appropriate prefix to use based on the pathname it is invoked with.
33597
33598 If GCC cannot find the subprogram using the specified prefix, it
33599 tries looking in the usual places for the subprogram.
33600
33601 The default value of @env{GCC_EXEC_PREFIX} is
33602 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
33603 the installed compiler. In many cases @var{prefix} is the value
33604 of @code{prefix} when you ran the @file{configure} script.
33605
33606 Other prefixes specified with @option{-B} take precedence over this prefix.
33607
33608 This prefix is also used for finding files such as @file{crt0.o} that are
33609 used for linking.
33610
33611 In addition, the prefix is used in an unusual way in finding the
33612 directories to search for header files. For each of the standard
33613 directories whose name normally begins with @samp{/usr/local/lib/gcc}
33614 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
33615 replacing that beginning with the specified prefix to produce an
33616 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
33617 @file{foo/bar} just before it searches the standard directory
33618 @file{/usr/local/lib/bar}.
33619 If a standard directory begins with the configured
33620 @var{prefix} then the value of @var{prefix} is replaced by
33621 @env{GCC_EXEC_PREFIX} when looking for header files.
33622
33623 @item COMPILER_PATH
33624 @findex COMPILER_PATH
33625 The value of @env{COMPILER_PATH} is a colon-separated list of
33626 directories, much like @env{PATH}. GCC tries the directories thus
33627 specified when searching for subprograms, if it cannot find the
33628 subprograms using @env{GCC_EXEC_PREFIX}.
33629
33630 @item LIBRARY_PATH
33631 @findex LIBRARY_PATH
33632 The value of @env{LIBRARY_PATH} is a colon-separated list of
33633 directories, much like @env{PATH}. When configured as a native compiler,
33634 GCC tries the directories thus specified when searching for special
33635 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
33636 using GCC also uses these directories when searching for ordinary
33637 libraries for the @option{-l} option (but directories specified with
33638 @option{-L} come first).
33639
33640 @item LANG
33641 @findex LANG
33642 @cindex locale definition
33643 This variable is used to pass locale information to the compiler. One way in
33644 which this information is used is to determine the character set to be used
33645 when character literals, string literals and comments are parsed in C and C++.
33646 When the compiler is configured to allow multibyte characters,
33647 the following values for @env{LANG} are recognized:
33648
33649 @table @samp
33650 @item C-JIS
33651 Recognize JIS characters.
33652 @item C-SJIS
33653 Recognize SJIS characters.
33654 @item C-EUCJP
33655 Recognize EUCJP characters.
33656 @end table
33657
33658 If @env{LANG} is not defined, or if it has some other value, then the
33659 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
33660 recognize and translate multibyte characters.
33661
33662 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
33663 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
33664 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
33665 then additional text will be emitted to stderr when fix-it hints are
33666 emitted. @option{-fdiagnostics-parseable-fixits} and
33667 @option{-fno-diagnostics-parseable-fixits} take precedence over this
33668 environment variable.
33669
33670 @table @samp
33671 @item fixits-v1
33672 Emit parseable fix-it hints, equivalent to
33673 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
33674 expressed as a count of bytes, starting at byte 1 for the initial column.
33675
33676 @item fixits-v2
33677 As @code{fixits-v1}, but columns are expressed as display columns,
33678 as per @option{-fdiagnostics-column-unit=display}.
33679 @end table
33680
33681 @end table
33682
33683 @noindent
33684 Some additional environment variables affect the behavior of the
33685 preprocessor.
33686
33687 @include cppenv.texi
33688
33689 @c man end
33690
33691 @node Precompiled Headers
33692 @section Using Precompiled Headers
33693 @cindex precompiled headers
33694 @cindex speed of compilation
33695
33696 Often large projects have many header files that are included in every
33697 source file. The time the compiler takes to process these header files
33698 over and over again can account for nearly all of the time required to
33699 build the project. To make builds faster, GCC allows you to
33700 @dfn{precompile} a header file.
33701
33702 To create a precompiled header file, simply compile it as you would any
33703 other file, if necessary using the @option{-x} option to make the driver
33704 treat it as a C or C++ header file. You may want to use a
33705 tool like @command{make} to keep the precompiled header up-to-date when
33706 the headers it contains change.
33707
33708 A precompiled header file is searched for when @code{#include} is
33709 seen in the compilation. As it searches for the included file
33710 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
33711 compiler looks for a precompiled header in each directory just before it
33712 looks for the include file in that directory. The name searched for is
33713 the name specified in the @code{#include} with @samp{.gch} appended. If
33714 the precompiled header file cannot be used, it is ignored.
33715
33716 For instance, if you have @code{#include "all.h"}, and you have
33717 @file{all.h.gch} in the same directory as @file{all.h}, then the
33718 precompiled header file is used if possible, and the original
33719 header is used otherwise.
33720
33721 Alternatively, you might decide to put the precompiled header file in a
33722 directory and use @option{-I} to ensure that directory is searched
33723 before (or instead of) the directory containing the original header.
33724 Then, if you want to check that the precompiled header file is always
33725 used, you can put a file of the same name as the original header in this
33726 directory containing an @code{#error} command.
33727
33728 This also works with @option{-include}. So yet another way to use
33729 precompiled headers, good for projects not designed with precompiled
33730 header files in mind, is to simply take most of the header files used by
33731 a project, include them from another header file, precompile that header
33732 file, and @option{-include} the precompiled header. If the header files
33733 have guards against multiple inclusion, they are skipped because
33734 they've already been included (in the precompiled header).
33735
33736 If you need to precompile the same header file for different
33737 languages, targets, or compiler options, you can instead make a
33738 @emph{directory} named like @file{all.h.gch}, and put each precompiled
33739 header in the directory, perhaps using @option{-o}. It doesn't matter
33740 what you call the files in the directory; every precompiled header in
33741 the directory is considered. The first precompiled header
33742 encountered in the directory that is valid for this compilation is
33743 used; they're searched in no particular order.
33744
33745 There are many other possibilities, limited only by your imagination,
33746 good sense, and the constraints of your build system.
33747
33748 A precompiled header file can be used only when these conditions apply:
33749
33750 @itemize
33751 @item
33752 Only one precompiled header can be used in a particular compilation.
33753
33754 @item
33755 A precompiled header cannot be used once the first C token is seen. You
33756 can have preprocessor directives before a precompiled header; you cannot
33757 include a precompiled header from inside another header.
33758
33759 @item
33760 The precompiled header file must be produced for the same language as
33761 the current compilation. You cannot use a C precompiled header for a C++
33762 compilation.
33763
33764 @item
33765 The precompiled header file must have been produced by the same compiler
33766 binary as the current compilation is using.
33767
33768 @item
33769 Any macros defined before the precompiled header is included must
33770 either be defined in the same way as when the precompiled header was
33771 generated, or must not affect the precompiled header, which usually
33772 means that they don't appear in the precompiled header at all.
33773
33774 The @option{-D} option is one way to define a macro before a
33775 precompiled header is included; using a @code{#define} can also do it.
33776 There are also some options that define macros implicitly, like
33777 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
33778 defined this way.
33779
33780 @item If debugging information is output when using the precompiled
33781 header, using @option{-g} or similar, the same kind of debugging information
33782 must have been output when building the precompiled header. However,
33783 a precompiled header built using @option{-g} can be used in a compilation
33784 when no debugging information is being output.
33785
33786 @item The same @option{-m} options must generally be used when building
33787 and using the precompiled header. @xref{Submodel Options},
33788 for any cases where this rule is relaxed.
33789
33790 @item Each of the following options must be the same when building and using
33791 the precompiled header:
33792
33793 @gccoptlist{-fexceptions}
33794
33795 @item
33796 Some other command-line options starting with @option{-f},
33797 @option{-p}, or @option{-O} must be defined in the same way as when
33798 the precompiled header was generated. At present, it's not clear
33799 which options are safe to change and which are not; the safest choice
33800 is to use exactly the same options when generating and using the
33801 precompiled header. The following are known to be safe:
33802
33803 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
33804 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
33805 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
33806 -pedantic-errors}
33807
33808 @item Address space layout randomization (ASLR) can lead to not binary identical
33809 PCH files. If you rely on stable PCH file contents disable ASLR when generating
33810 PCH files.
33811
33812 @end itemize
33813
33814 For all of these except the last, the compiler automatically
33815 ignores the precompiled header if the conditions aren't met. If you
33816 find an option combination that doesn't work and doesn't cause the
33817 precompiled header to be ignored, please consider filing a bug report,
33818 see @ref{Bugs}.
33819
33820 If you do use differing options when generating and using the
33821 precompiled header, the actual behavior is a mixture of the
33822 behavior for the options. For instance, if you use @option{-g} to
33823 generate the precompiled header but not when using it, you may or may
33824 not get debugging information for routines in the precompiled header.
33825
33826 @node C++ Modules
33827 @section C++ Modules
33828 @cindex speed of compilation
33829
33830 Modules are a C++20 language feature. As the name suggests, they
33831 provides a modular compilation system, intending to provide both
33832 faster builds and better library isolation. The ``Merging Modules''
33833 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
33834 of changes to the standard, although it does not capture later
33835 changes. That specification is now part of C++20,
33836 @uref{git@@github.com:cplusplus/draft.git}, it is considered complete
33837 (there may be defect reports to come).
33838
33839 @emph{G++'s modules support is not complete.} Other than bugs, the
33840 known missing pieces are:
33841
33842 @table @emph
33843
33844 @item Private Module Fragment
33845 The Private Module Fragment is recognized, but an error is emitted.
33846
33847 @item Partition definition visibility rules
33848 Entities may be defined in implementation partitions, and those
33849 definitions are not available outside of the module. This is not
33850 implemented, and the definitions are available to extra-module use.
33851
33852 @item Textual merging of reachable GM entities
33853 Entities may be multiply defined across different header-units.
33854 These must be de-duplicated, and this is implemented across imports,
33855 or when an import redefines a textually-defined entity. However the
33856 reverse is not implemented---textually redefining an entity that has
33857 been defined in an imported header-unit. A redefinition error is
33858 emitted.
33859
33860 @item Translation-Unit local referencing rules
33861 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
33862 (@uref{https://wg21.link/p2003}) add limitations on which entities an
33863 exported region may reference (for instance, the entities an exported
33864 template definition may reference). These are not fully implemented.
33865
33866 @item Language-linkage module attachment
33867 Declarations with explicit language linkage (@code{extern "C"} or
33868 @code{extern "C++"}) are attached to the global module, even when in
33869 the purview of a named module. This is not implemented. Such
33870 declarations will be attached to the module, if any, in which they are
33871 declared.
33872
33873 @item Standard Library Header Units
33874 The Standard Library is not provided as importable header units. If
33875 you want to import such units, you must explicitly build them first.
33876 If you do not do this with care, you may have multiple declarations,
33877 which the module machinery must merge---compiler resource usage can be
33878 affected by how you partition header files into header units.
33879
33880 @end table
33881
33882 Modular compilation is @emph{not} enabled with just the
33883 @option{-std=c++20} option. You must explicitly enable it with the
33884 @option{-fmodules-ts} option. It is independent of the language
33885 version selected, although in pre-C++20 versions, it is of course an
33886 extension.
33887
33888 No new source file suffixes are required or supported. If you wish to
33889 use a non-standard suffix (@pxref{Overall Options}), you also need
33890 to provide a @option{-x c++} option too.@footnote{Some users like to
33891 distinguish module interface files with a new suffix, such as naming
33892 the source @code{module.cppm}, which involves
33893 teaching all tools about the new suffix. A different scheme, such as
33894 naming @code{module-m.cpp} would be less invasive.}
33895
33896 Compiling a module interface unit produces an additional output (to
33897 the assembly or object file), called a Compiled Module Interface
33898 (CMI). This encodes the exported declarations of the module.
33899 Importing a module reads in the CMI. The import graph is a Directed
33900 Acyclic Graph (DAG). You must build imports before the importer.
33901
33902 Header files may themselves be compiled to header units, which are a
33903 transitional ability aiming at faster compilation. The
33904 @option{-fmodule-header} option is used to enable this, and implies
33905 the @option{-fmodules-ts} option. These CMIs are named by the fully
33906 resolved underlying header file, and thus may be a complete pathname
33907 containing subdirectories. If the header file is found at an absolute
33908 pathname, the CMI location is still relative to a CMI root directory.
33909
33910 As header files often have no suffix, you commonly have to specify a
33911 @option{-x} option to tell the compiler the source is a header file.
33912 You may use @option{-x c++-header}, @option{-x c++-user-header} or
33913 @option{-x c++-system-header}. When used in conjunction with
33914 @option{-fmodules-ts}, these all imply an appropriate
33915 @option{-fmodule-header} option. The latter two variants use the
33916 user or system include path to search for the file specified. This
33917 allows you to, for instance, compile standard library header files as
33918 header units, without needing to know exactly where they are
33919 installed. Specifying the language as one of these variants also
33920 inhibits output of the object file, as header files have no associated
33921 object file.
33922
33923 The @option{-fmodule-only} option disables generation of the
33924 associated object file for compiling a module interface. Only the CMI
33925 is generated. This option is implied when using the
33926 @option{-fmodule-header} option.
33927
33928 The @option{-flang-info-include-translate} and
33929 @option{-flang-info-include-translate-not} options notes whether
33930 include translation occurs or not. With no argument, the first will
33931 note all include translation. The second will note all
33932 non-translations of include files not known to intentionally be
33933 textual. With an argument, queries about include translation of a
33934 header files with that particular trailing pathname are noted. You
33935 may repeat this form to cover several different header files. This
33936 option may be helpful in determining whether include translation is
33937 happening---if it is working correctly, it behaves as if it isn't
33938 there at all.
33939
33940 The @option{-flang-info-module-cmi} option can be used to determine
33941 where the compiler is reading a CMI from. Without the option, the
33942 compiler is silent when such a read is successful. This option has an
33943 optional argument, which will restrict the notification to just the
33944 set of named modules or header units specified.
33945
33946 The @option{-Winvalid-imported-macros} option causes all imported macros
33947 to be resolved at the end of compilation. Without this, imported
33948 macros are only resolved when expanded or (re)defined. This option
33949 detects conflicting import definitions for all macros.
33950
33951 For details of the @option{-fmodule-mapper} family of options,
33952 @pxref{C++ Module Mapper}.
33953
33954 @menu
33955 * C++ Module Mapper:: Module Mapper
33956 * C++ Module Preprocessing:: Module Preprocessing
33957 * C++ Compiled Module Interface:: Compiled Module Interface
33958 @end menu
33959
33960 @node C++ Module Mapper
33961 @subsection Module Mapper
33962 @cindex C++ Module Mapper
33963
33964 A module mapper provides a server or file that the compiler queries to
33965 determine the mapping between module names and CMI files. It is also
33966 used to build CMIs on demand. @emph{Mapper functionality is in its
33967 infancy and is intended for experimentation with build system
33968 interactions.}
33969
33970 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
33971 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
33972 have one of the following forms:
33973
33974 @table @gcctabopt
33975
33976 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
33977 An optional hostname and a numeric port number to connect to. If the
33978 hostname is omitted, the loopback address is used. If the hostname
33979 corresponds to multiple IPV6 addresses, these are tried in turn, until
33980 one is successful. If your host lacks IPv6, this form is
33981 non-functional. If you must use IPv4 use
33982 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
33983
33984 @item =@var{socket}@r{[}?@var{ident}@r{]}
33985 A local domain socket. If your host lacks local domain sockets, this
33986 form is non-functional.
33987
33988 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
33989 A program to spawn, and communicate with on its stdin/stdout streams.
33990 Your @var{PATH} environment variable is searched for the program.
33991 Arguments are separated by space characters, (it is not possible for
33992 one of the arguments delivered to the program to contain a space). An
33993 exception is if @var{program} begins with @@. In that case
33994 @var{program} (sans @@) is looked for in the compiler's internal
33995 binary directory. Thus the sample mapper-server can be specified
33996 with @code{@@g++-mapper-server}.
33997
33998 @item <>@r{[}?@var{ident}@r{]}
33999 @item <>@var{inout}@r{[}?@var{ident}@r{]}
34000 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
34001 Named pipes or file descriptors to communicate over. The first form,
34002 @option{<>}, communicates over stdin and stdout. The other forms
34003 allow you to specify a file descriptor or name a pipe. A numeric value
34004 is interpreted as a file descriptor, otherwise named pipe is opened.
34005 The second form specifies a bidirectional pipe and the last form
34006 allows specifying two independent pipes. Using file descriptors
34007 directly in this manner is fragile in general, as it can require the
34008 cooperation of intermediate processes. In particular using stdin &
34009 stdout is fraught with danger as other compiler options might also
34010 cause the compiler to read stdin or write stdout, and it can have
34011 unfortunate interactions with signal delivery from the terminal.
34012
34013 @item @var{file}@r{[}?@var{ident}@r{]}
34014 A mapping file consisting of space-separated module-name, filename
34015 pairs, one per line. Only the mappings for the direct imports and any
34016 module export name need be provided. If other mappings are provided,
34017 they override those stored in any imported CMI files. A repository
34018 root may be specified in the mapping file by using @samp{$root} as the
34019 module name in the first active line. Use of this option will disable
34020 any default module->CMI name mapping.
34021
34022 @end table
34023
34024 As shown, an optional @var{ident} may suffix the first word of the
34025 option, indicated by a @samp{?} prefix. The value is used in the
34026 initial handshake with the module server, or to specify a prefix on
34027 mapping file lines. In the server case, the main source file name is
34028 used if no @var{ident} is specified. In the file case, all non-blank
34029 lines are significant, unless a value is specified, in which case only
34030 lines beginning with @var{ident} are significant. The @var{ident}
34031 must be separated by whitespace from the module name. Be aware that
34032 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
34033 significant to the shell, and therefore may need quoting.
34034
34035 The mapper is connected to or loaded lazily, when the first module
34036 mapping is required. The networking protocols are only supported on
34037 hosts that provide networking. If no mapper is specified a default is
34038 provided.
34039
34040 A project-specific mapper is expected to be provided by the build
34041 system that invokes the compiler. It is not expected that a
34042 general-purpose server is provided for all compilations. As such, the
34043 server will know the build configuration, the compiler it invoked, and
34044 the environment (such as working directory) in which that is
34045 operating. As it may parallelize builds, several compilations may
34046 connect to the same socket.
34047
34048 The default mapper generates CMI files in a @samp{gcm.cache}
34049 directory. CMI files have a @samp{.gcm} suffix. The module unit name
34050 is used directly to provide the basename. Header units construct a
34051 relative path using the underlying header file name. If the path is
34052 already relative, a @samp{,} directory is prepended. Internal
34053 @samp{..} components are translated to @samp{,,}. No attempt is made
34054 to canonicalize these filenames beyond that done by the preprocessor's
34055 include search algorithm, as in general it is ambiguous when symbolic
34056 links are present.
34057
34058 The mapper protocol was published as ``A Module Mapper''
34059 @uref{https://wg21.link/p1184}. The implementation is provided by
34060 @command{libcody}, @uref{https://github.com/urnathan/libcody},
34061 which specifies the canonical protocol definition. A proof of concept
34062 server implementation embedded in @command{make} was described in
34063 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
34064
34065 @node C++ Module Preprocessing
34066 @subsection Module Preprocessing
34067 @cindex C++ Module Preprocessing
34068
34069 Modules affect preprocessing because of header units and include
34070 translation. Some uses of the preprocessor as a separate step either
34071 do not produce a correct output, or require CMIs to be available.
34072
34073 Header units import macros. These macros can affect later conditional
34074 inclusion, which therefore can cascade to differing import sets. When
34075 preprocessing, it is necessary to load the CMI. If a header unit is
34076 unavailable, the preprocessor issues a warning and continue (when
34077 not just preprocessing, an error is emitted). Detecting such imports
34078 requires preprocessor tokenization of the input stream to phase 4
34079 (macro expansion).
34080
34081 Include translation converts @code{#include}, @code{#include_next} and
34082 @code{#import} directives to internal @code{import} declarations.
34083 Whether a particular directive is translated is controlled by the
34084 module mapper. Header unit names are canonicalized during
34085 preprocessing.
34086
34087 Dependency information can be emitted for macro import, extending the
34088 functionality of @option{-MD} and @option{-MMD} options. Detection of
34089 import declarations also requires phase 4 preprocessing, and thus
34090 requires full preprocessing (or compilation).
34091
34092 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
34093 preprocessing before phase 4.
34094
34095 The @option{-save-temps} option uses @option{-fdirectives-only} for
34096 preprocessing, and preserve the macro definitions in the preprocessed
34097 output. Usually you also want to use this option when explicitly
34098 preprocessing a header-unit, or consuming such preprocessed output:
34099
34100 @smallexample
34101 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
34102 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
34103 @end smallexample
34104
34105 @node C++ Compiled Module Interface
34106 @subsection Compiled Module Interface
34107 @cindex C++ Compiled Module Interface
34108
34109 CMIs are an additional artifact when compiling named module
34110 interfaces, partitions or header units. These are read when
34111 importing. CMI contents are implementation-specific, and in GCC's
34112 case tied to the compiler version. Consider them a rebuildable cache
34113 artifact, not a distributable object.
34114
34115 When creating an output CMI, any missing directory components are
34116 created in a manner that is safe for concurrent builds creating
34117 multiple, different, CMIs within a common subdirectory tree.
34118
34119 CMI contents are written to a temporary file, which is then atomically
34120 renamed. Observers either see old contents (if there is an
34121 existing file), or complete new contents. They do not observe the
34122 CMI during its creation. This is unlike object file writing, which
34123 may be observed by an external process.
34124
34125 CMIs are read in lazily, if the host OS provides @code{mmap}
34126 functionality. Generally blocks are read when name lookup or template
34127 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
34128 option may be used.
34129
34130 The @option{--param lazy-modules=@var{n}} parameter controls the limit
34131 on the number of concurrently open module files during lazy loading.
34132 Should more modules be imported, an LRU algorithm is used to determine
34133 which files to close---until that file is needed again. This limit
34134 may be exceeded with deep module dependency hierarchies. With large
34135 code bases there may be more imports than the process limit of file
34136 descriptors. By default, the limit is a few less than the per-process
34137 file descriptor hard limit, if that is determinable.@footnote{Where
34138 applicable the soft limit is incremented as needed towards the hard limit.}
34139
34140 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
34141 You may use @command{readelf} to inspect them, although section
34142 contents are largely undecipherable. There is a section named
34143 @code{.gnu.c++.README}, which contains human-readable text. Other
34144 than the first line, each line consists of @code{@var{tag}: @code{value}}
34145 tuples.
34146
34147 @smallexample
34148 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
34149
34150 String dump of section '.gnu.c++.README':
34151 [ 0] GNU C++ primary module interface
34152 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
34153 [ 6f] version: 2020/11/16-04:54
34154 [ 89] module: foo
34155 [ 95] source: c_b.ii
34156 [ a4] dialect: C++20/coroutines
34157 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
34158 [ ee] repository: gcm.cache
34159 [ 104] buildtime: 2020/11/16 15:03:21 UTC
34160 [ 127] localtime: 2020/11/16 07:03:21 PST
34161 [ 14a] export: foo:part1 foo-part1.gcm
34162 @end smallexample
34163
34164 Amongst other things, this lists the source that was built, C++
34165 dialect used and imports of the module.@footnote{The precise contents
34166 of this output may change.} The timestamp is the same value as that
34167 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
34168 explicitly specified with the environment variable
34169 @code{SOURCE_DATE_EPOCH}. For further details
34170 @pxref{Environment Variables}.
34171
34172 A set of related CMIs may be copied, provided the relative pathnames
34173 are preserved.
34174
34175 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
34176 it may be removed or altered. The section numbering of the sections
34177 whose names do not begin with @code{.gnu.c++.}, or are not the string
34178 section is significant and must not be altered.