]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
5345bc3def370981c1d091067aa9ca303fd5f19b
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2020 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-2020 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 @code{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 @end menu
176
177 @c man begin OPTIONS
178
179 @node Option Summary
180 @section Option Summary
181
182 Here is a summary of all the options, grouped by type. Explanations are
183 in the following sections.
184
185 @table @emph
186 @item Overall Options
187 @xref{Overall Options,,Options Controlling the Kind of Output}.
188 @gccoptlist{-c -S -E -o @var{file} @gol
189 -dumpbase @var{dumpbase} -dumpbase-ext @var{auxdropsuf} @gol
190 -dumpdir @var{dumppfx} -x @var{language} @gol
191 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
192 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
193 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
194 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
195 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
196
197 @item C Language Options
198 @xref{C Dialect Options,,Options Controlling C Dialect}.
199 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
200 -fpermitted-flt-eval-methods=@var{standard} @gol
201 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
202 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
203 -fhosted -ffreestanding @gol
204 -fopenacc -fopenacc-dim=@var{geom} @gol
205 -fopenmp -fopenmp-simd @gol
206 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
207 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
208 -fsigned-bitfields -fsigned-char @gol
209 -funsigned-bitfields -funsigned-char}
210
211 @item C++ Language Options
212 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
213 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
214 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
215 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
216 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
217 -fno-elide-constructors @gol
218 -fno-enforce-eh-specs @gol
219 -fno-gnu-keywords @gol
220 -fno-implicit-templates @gol
221 -fno-implicit-inline-templates @gol
222 -fno-implement-inlines -fms-extensions @gol
223 -fnew-inheriting-ctors @gol
224 -fnew-ttp-matching @gol
225 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
226 -fno-optional-diags -fpermissive @gol
227 -fno-pretty-templates @gol
228 -fno-rtti -fsized-deallocation @gol
229 -ftemplate-backtrace-limit=@var{n} @gol
230 -ftemplate-depth=@var{n} @gol
231 -fno-threadsafe-statics -fuse-cxa-atexit @gol
232 -fno-weak -nostdinc++ @gol
233 -fvisibility-inlines-hidden @gol
234 -fvisibility-ms-compat @gol
235 -fext-numeric-literals @gol
236 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
237 -Wno-class-conversion -Wclass-memaccess @gol
238 -Wcomma-subscript -Wconditionally-supported @gol
239 -Wno-conversion-null -Wctor-dtor-privacy -Wno-delete-incomplete @gol
240 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
241 -Weffc++ -Wextra-semi -Wno-inaccessible-base @gol
242 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
243 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-tags @gol
244 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
245 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
246 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
247 -Wredundant-move -Wredundant-tags @gol
248 -Wreorder -Wregister @gol
249 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
250 -Wno-non-template-friend -Wold-style-cast @gol
251 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
252 -Wsized-deallocation -Wsuggest-final-methods @gol
253 -Wsuggest-final-types -Wsuggest-override @gol
254 -Wno-terminate -Wuseless-cast -Wvirtual-inheritance @gol
255 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
256
257 @item Objective-C and Objective-C++ Language Options
258 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
259 Objective-C and Objective-C++ Dialects}.
260 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
261 -fgnu-runtime -fnext-runtime @gol
262 -fno-nil-receivers @gol
263 -fobjc-abi-version=@var{n} @gol
264 -fobjc-call-cxx-cdtors @gol
265 -fobjc-direct-dispatch @gol
266 -fobjc-exceptions @gol
267 -fobjc-gc @gol
268 -fobjc-nilcheck @gol
269 -fobjc-std=objc1 @gol
270 -fno-local-ivars @gol
271 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
272 -freplace-objc-classes @gol
273 -fzero-link @gol
274 -gen-decls @gol
275 -Wassign-intercept -Wno-property-assign-default @gol
276 -Wno-protocol -Wselector @gol
277 -Wstrict-selector-match @gol
278 -Wundeclared-selector}
279
280 @item Diagnostic Message Formatting Options
281 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
282 @gccoptlist{-fmessage-length=@var{n} @gol
283 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
284 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
285 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
286 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
287 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
288 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
289 -fno-diagnostics-show-cwe @gol
290 -fdiagnostics-minimum-margin-width=@var{width} @gol
291 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
292 -fdiagnostics-show-template-tree -fno-elide-type @gol
293 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
294 -fdiagnostics-show-path-depths @gol
295 -fno-show-column}
296
297 @item Warning Options
298 @xref{Warning Options,,Options to Request or Suppress Warnings}.
299 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
300 -pedantic-errors @gol
301 -w -Wextra -Wall -Wabi=@var{n} @gol
302 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
303 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
304 -Walloca -Walloca-larger-than=@var{byte-size} @gol
305 -Wno-aggressive-loop-optimizations @gol
306 -Warith-conversion @gol
307 -Warray-bounds -Warray-bounds=@var{n} @gol
308 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
309 -Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
310 -Wno-builtin-declaration-mismatch @gol
311 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
312 -Wc11-c2x-compat @gol
313 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
314 -Wc++20-compat @gol
315 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
316 -Wchar-subscripts @gol
317 -Wclobbered -Wcomment @gol
318 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
319 -Wdangling-else -Wdate-time @gol
320 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
321 -Wdisabled-optimization @gol
322 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
323 -Wno-div-by-zero -Wdouble-promotion @gol
324 -Wduplicated-branches -Wduplicated-cond @gol
325 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
326 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
327 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
328 -Wno-format-contains-nul -Wno-format-extra-args @gol
329 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
330 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
331 -Wformat-y2k -Wframe-address @gol
332 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
333 -Wno-hsa -Wno-if-not-aligned -Wno-ignored-attributes @gol
334 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
335 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
336 -Wno-implicit-function-declaration -Wno-implicit-int @gol
337 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
338 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
339 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
340 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
341 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
342 -Wmemset-elt-size -Wmemset-transposed-args @gol
343 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
344 -Wmissing-field-initializers -Wmissing-format-attribute @gol
345 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
346 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
347 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
348 -Wnull-dereference -Wno-odr -Wopenmp-simd @gol
349 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
350 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
351 -Wparentheses -Wno-pedantic-ms-format @gol
352 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
353 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
354 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
355 -Wno-scalar-storage-order -Wsequence-point @gol
356 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
357 -Wno-shadow-ivar @gol
358 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
359 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
360 -Wsign-compare -Wsign-conversion @gol
361 -Wno-sizeof-array-argument @gol
362 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
363 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
364 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
365 -Wstring-compare @gol
366 -Wstringop-overflow=@var{n} -Wno-stringop-truncation @gol
367 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
368 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
369 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
370 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
371 -Wtype-limits -Wundef @gol
372 -Wuninitialized -Wunknown-pragmas @gol
373 -Wunsuffixed-float-constants -Wunused @gol
374 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
375 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
376 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
377 -Wunused-macros @gol
378 -Wunused-parameter -Wno-unused-result @gol
379 -Wunused-value -Wunused-variable @gol
380 -Wno-varargs -Wvariadic-macros @gol
381 -Wvector-operation-performance @gol
382 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
383 -Wvolatile-register-var -Wwrite-strings @gol
384 -Wzero-length-bounds}
385
386 @item Static Analyzer Options
387 @gccoptlist{
388 -fanalyzer @gol
389 -fanalyzer-call-summaries @gol
390 -fanalyzer-checker=@var{name} @gol
391 -fanalyzer-fine-grained @gol
392 -fanalyzer-state-merge @gol
393 -fanalyzer-state-purge @gol
394 -fanalyzer-transitivity @gol
395 -fanalyzer-verbose-edges @gol
396 -fanalyzer-verbose-state-changes @gol
397 -fanalyzer-verbosity=@var{level} @gol
398 -fdump-analyzer @gol
399 -fdump-analyzer-stderr @gol
400 -fdump-analyzer-callgraph @gol
401 -fdump-analyzer-exploded-graph @gol
402 -fdump-analyzer-exploded-nodes @gol
403 -fdump-analyzer-exploded-nodes-2 @gol
404 -fdump-analyzer-exploded-nodes-3 @gol
405 -fdump-analyzer-state-purge @gol
406 -fdump-analyzer-supergraph @gol
407 -Wno-analyzer-double-fclose @gol
408 -Wno-analyzer-double-free @gol
409 -Wno-analyzer-exposure-through-output-file @gol
410 -Wno-analyzer-file-leak @gol
411 -Wno-analyzer-free-of-non-heap @gol
412 -Wno-analyzer-malloc-leak @gol
413 -Wno-analyzer-null-argument @gol
414 -Wno-analyzer-null-dereference @gol
415 -Wno-analyzer-possible-null-argument @gol
416 -Wno-analyzer-possible-null-dereference @gol
417 -Wno-analyzer-stale-setjmp-buffer @gol
418 -Wno-analyzer-tainted-array-index @gol
419 -Wanalyzer-too-complex @gol
420 -Wno-analyzer-unsafe-call-within-signal-handler @gol
421 -Wno-analyzer-use-after-free @gol
422 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
423 -Wno-analyzer-use-of-uninitialized-value @gol
424 }
425
426 @item C and Objective-C-only Warning Options
427 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
428 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
429 -Wold-style-declaration -Wold-style-definition @gol
430 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
431 -Wdeclaration-after-statement -Wpointer-sign}
432
433 @item Debugging Options
434 @xref{Debugging Options,,Options for Debugging Your Program}.
435 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
436 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
437 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
438 -gas-loc-support -gno-as-loc-support @gol
439 -gas-locview-support -gno-as-locview-support @gol
440 -gcolumn-info -gno-column-info @gol
441 -gstatement-frontiers -gno-statement-frontiers @gol
442 -gvariable-location-views -gno-variable-location-views @gol
443 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
444 -ginline-points -gno-inline-points @gol
445 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
446 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
447 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
448 -fno-eliminate-unused-debug-types @gol
449 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
450 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
451 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
452 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
453 -fvar-tracking -fvar-tracking-assignments}
454
455 @item Optimization Options
456 @xref{Optimize Options,,Options that Control Optimization}.
457 @gccoptlist{-faggressive-loop-optimizations @gol
458 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
459 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
460 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
461 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
462 -fno-allocation-dce -fallow-store-data-races @gol
463 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
464 -fauto-inc-dec -fbranch-probabilities @gol
465 -fcaller-saves @gol
466 -fcombine-stack-adjustments -fconserve-stack @gol
467 -fcompare-elim -fcprop-registers -fcrossjumping @gol
468 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
469 -fcx-limited-range @gol
470 -fdata-sections -fdce -fdelayed-branch @gol
471 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
472 -fdevirtualize-at-ltrans -fdse @gol
473 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
474 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
475 -ffinite-loops @gol
476 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
477 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
478 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
479 -fif-conversion2 -findirect-inlining @gol
480 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
481 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
482 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
483 -fipa-reference -fipa-reference-addressable @gol
484 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
485 -flive-patching=@var{level} @gol
486 -fira-region=@var{region} -fira-hoist-pressure @gol
487 -fira-loop-pressure -fno-ira-share-save-slots @gol
488 -fno-ira-share-spill-slots @gol
489 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
490 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
491 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
492 -floop-block -floop-interchange -floop-strip-mine @gol
493 -floop-unroll-and-jam -floop-nest-optimize @gol
494 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
495 -flto-partition=@var{alg} -fmerge-all-constants @gol
496 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
497 -fmove-loop-invariants -fno-branch-count-reg @gol
498 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
499 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
500 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
501 -fno-sched-spec -fno-signed-zeros @gol
502 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
503 -fomit-frame-pointer -foptimize-sibling-calls @gol
504 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
505 -fprefetch-loop-arrays @gol
506 -fprofile-correction @gol
507 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
508 -fprofile-values -fprofile-reorder-functions @gol
509 -freciprocal-math -free -frename-registers -freorder-blocks @gol
510 -freorder-blocks-algorithm=@var{algorithm} @gol
511 -freorder-blocks-and-partition -freorder-functions @gol
512 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
513 -frounding-math -fsave-optimization-record @gol
514 -fsched2-use-superblocks -fsched-pressure @gol
515 -fsched-spec-load -fsched-spec-load-dangerous @gol
516 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
517 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
518 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
519 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
520 -fschedule-fusion @gol
521 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
522 -fselective-scheduling -fselective-scheduling2 @gol
523 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
524 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
525 -fsignaling-nans @gol
526 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
527 -fsplit-paths @gol
528 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
529 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
530 -fthread-jumps -ftracer -ftree-bit-ccp @gol
531 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
532 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
533 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
534 -ftree-loop-if-convert -ftree-loop-im @gol
535 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
536 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
537 -ftree-loop-vectorize @gol
538 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
539 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
540 -ftree-switch-conversion -ftree-tail-merge @gol
541 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
542 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
543 -funsafe-math-optimizations -funswitch-loops @gol
544 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
545 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
546 --param @var{name}=@var{value}
547 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
548
549 @item Program Instrumentation Options
550 @xref{Instrumentation Options,,Program Instrumentation Options}.
551 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
552 -fprofile-abs-path @gol
553 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
554 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
555 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
556 -fprofile-exclude-files=@var{regex} -fprofile-reproducibility @gol
557 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
558 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
559 -fsanitize-undefined-trap-on-error -fbounds-check @gol
560 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
561 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
562 -fstack-protector-explicit -fstack-check @gol
563 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
564 -fno-stack-limit -fsplit-stack @gol
565 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
566 -fvtv-counts -fvtv-debug @gol
567 -finstrument-functions @gol
568 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
569 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
570
571 @item Preprocessor Options
572 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
573 @gccoptlist{-A@var{question}=@var{answer} @gol
574 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
575 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
576 -dD -dI -dM -dN -dU @gol
577 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
578 -fexec-charset=@var{charset} -fextended-identifiers @gol
579 -finput-charset=@var{charset} -flarge-source-files @gol
580 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
581 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
582 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
583 -fwide-exec-charset=@var{charset} -fworking-directory @gol
584 -H -imacros @var{file} -include @var{file} @gol
585 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
586 -no-integrated-cpp -P -pthread -remap @gol
587 -traditional -traditional-cpp -trigraphs @gol
588 -U@var{macro} -undef @gol
589 -Wp,@var{option} -Xpreprocessor @var{option}}
590
591 @item Assembler Options
592 @xref{Assembler Options,,Passing Options to the Assembler}.
593 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
594
595 @item Linker Options
596 @xref{Link Options,,Options for Linking}.
597 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
598 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
599 -e @var{entry} --entry=@var{entry} @gol
600 -pie -pthread -r -rdynamic @gol
601 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
602 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
603 -shared -shared-libgcc -symbolic @gol
604 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
605 -u @var{symbol} -z @var{keyword}}
606
607 @item Directory Options
608 @xref{Directory Options,,Options for Directory Search}.
609 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
610 -idirafter @var{dir} @gol
611 -imacros @var{file} -imultilib @var{dir} @gol
612 -iplugindir=@var{dir} -iprefix @var{file} @gol
613 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
614 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
615 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
616 -nostdinc -nostdinc++ --sysroot=@var{dir}}
617
618 @item Code Generation Options
619 @xref{Code Gen Options,,Options for Code Generation Conventions}.
620 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
621 -ffixed-@var{reg} -fexceptions @gol
622 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
623 -fasynchronous-unwind-tables @gol
624 -fno-gnu-unique @gol
625 -finhibit-size-directive -fcommon -fno-ident @gol
626 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
627 -fno-jump-tables @gol
628 -frecord-gcc-switches @gol
629 -freg-struct-return -fshort-enums -fshort-wchar @gol
630 -fverbose-asm -fpack-struct[=@var{n}] @gol
631 -fleading-underscore -ftls-model=@var{model} @gol
632 -fstack-reuse=@var{reuse_level} @gol
633 -ftrampolines -ftrapv -fwrapv @gol
634 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
635 -fstrict-volatile-bitfields -fsync-libcalls}
636
637 @item Developer Options
638 @xref{Developer Options,,GCC Developer Options}.
639 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
640 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
641 -fchecking -fchecking=@var{n}
642 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
643 -fdisable-ipa-@var{pass_name} @gol
644 -fdisable-rtl-@var{pass_name} @gol
645 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
646 -fdisable-tree-@var{pass_name} @gol
647 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
648 -fdump-debug -fdump-earlydebug @gol
649 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
650 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
651 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
652 -fdump-lang-all @gol
653 -fdump-lang-@var{switch} @gol
654 -fdump-lang-@var{switch}-@var{options} @gol
655 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
656 -fdump-passes @gol
657 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
658 -fdump-statistics @gol
659 -fdump-tree-all @gol
660 -fdump-tree-@var{switch} @gol
661 -fdump-tree-@var{switch}-@var{options} @gol
662 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
663 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
664 -fenable-@var{kind}-@var{pass} @gol
665 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
666 -fira-verbose=@var{n} @gol
667 -flto-report -flto-report-wpa -fmem-report-wpa @gol
668 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
669 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
670 -fprofile-report @gol
671 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
672 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
673 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
674 -fvar-tracking-assignments-toggle -gtoggle @gol
675 -print-file-name=@var{library} -print-libgcc-file-name @gol
676 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
677 -print-prog-name=@var{program} -print-search-dirs -Q @gol
678 -print-sysroot -print-sysroot-headers-suffix @gol
679 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
680
681 @item Machine-Dependent Options
682 @xref{Submodel Options,,Machine-Dependent Options}.
683 @c This list is ordered alphanumerically by subsection name.
684 @c Try and put the significant identifier (CPU or system) first,
685 @c so users have a clue at guessing where the ones they want will be.
686
687 @emph{AArch64 Options}
688 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
689 -mgeneral-regs-only @gol
690 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
691 -mstrict-align -mno-strict-align @gol
692 -momit-leaf-frame-pointer @gol
693 -mtls-dialect=desc -mtls-dialect=traditional @gol
694 -mtls-size=@var{size} @gol
695 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
696 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
697 -mpc-relative-literal-loads @gol
698 -msign-return-address=@var{scope} @gol
699 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
700 +@var{b-key}]|@var{bti} @gol
701 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
702 -moverride=@var{string} -mverbose-cost-dump @gol
703 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
704 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
705 -moutline-atomics }
706
707 @emph{Adapteva Epiphany Options}
708 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
709 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
710 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
711 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
712 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
713 -msplit-vecmove-early -m1reg-@var{reg}}
714
715 @emph{AMD GCN Options}
716 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
717
718 @emph{ARC Options}
719 @gccoptlist{-mbarrel-shifter -mjli-always @gol
720 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
721 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
722 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
723 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
724 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
725 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
726 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
727 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
728 -mvolatile-cache -mtp-regno=@var{regno} @gol
729 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
730 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
731 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
732 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
733 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
734 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
735 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
736 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
737
738 @emph{ARM Options}
739 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
740 -mabi=@var{name} @gol
741 -mapcs-stack-check -mno-apcs-stack-check @gol
742 -mapcs-reentrant -mno-apcs-reentrant @gol
743 -mgeneral-regs-only @gol
744 -msched-prolog -mno-sched-prolog @gol
745 -mlittle-endian -mbig-endian @gol
746 -mbe8 -mbe32 @gol
747 -mfloat-abi=@var{name} @gol
748 -mfp16-format=@var{name}
749 -mthumb-interwork -mno-thumb-interwork @gol
750 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
751 -mtune=@var{name} -mprint-tune-info @gol
752 -mstructure-size-boundary=@var{n} @gol
753 -mabort-on-noreturn @gol
754 -mlong-calls -mno-long-calls @gol
755 -msingle-pic-base -mno-single-pic-base @gol
756 -mpic-register=@var{reg} @gol
757 -mnop-fun-dllimport @gol
758 -mpoke-function-name @gol
759 -mthumb -marm -mflip-thumb @gol
760 -mtpcs-frame -mtpcs-leaf-frame @gol
761 -mcaller-super-interworking -mcallee-super-interworking @gol
762 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
763 -mword-relocations @gol
764 -mfix-cortex-m3-ldrd @gol
765 -munaligned-access @gol
766 -mneon-for-64bits @gol
767 -mslow-flash-data @gol
768 -masm-syntax-unified @gol
769 -mrestrict-it @gol
770 -mverbose-cost-dump @gol
771 -mpure-code @gol
772 -mcmse @gol
773 -mfdpic}
774
775 @emph{AVR Options}
776 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
777 -mbranch-cost=@var{cost} @gol
778 -mcall-prologues -mgas-isr-prologues -mint8 @gol
779 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
780 -mn_flash=@var{size} -mno-interrupts @gol
781 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
782 -mfract-convert-truncate @gol
783 -mshort-calls -nodevicelib -nodevicespecs @gol
784 -Waddr-space-convert -Wmisspelled-isr}
785
786 @emph{Blackfin Options}
787 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
788 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
789 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
790 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
791 -mno-id-shared-library -mshared-library-id=@var{n} @gol
792 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
793 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
794 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
795 -micplb}
796
797 @emph{C6X Options}
798 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
799 -msim -msdata=@var{sdata-type}}
800
801 @emph{CRIS Options}
802 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
803 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
804 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
805 -mstack-align -mdata-align -mconst-align @gol
806 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
807 -melf -maout -melinux -mlinux -sim -sim2 @gol
808 -mmul-bug-workaround -mno-mul-bug-workaround}
809
810 @emph{CR16 Options}
811 @gccoptlist{-mmac @gol
812 -mcr16cplus -mcr16c @gol
813 -msim -mint32 -mbit-ops
814 -mdata-model=@var{model}}
815
816 @emph{C-SKY Options}
817 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
818 -mbig-endian -EB -mlittle-endian -EL @gol
819 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
820 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
821 -mdsp -medsp -mvdsp @gol
822 -mdiv -msmart -mhigh-registers -manchor @gol
823 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
824 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
825
826 @emph{Darwin Options}
827 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
828 -arch_only -bind_at_load -bundle -bundle_loader @gol
829 -client_name -compatibility_version -current_version @gol
830 -dead_strip @gol
831 -dependency-file -dylib_file -dylinker_install_name @gol
832 -dynamic -dynamiclib -exported_symbols_list @gol
833 -filelist -flat_namespace -force_cpusubtype_ALL @gol
834 -force_flat_namespace -headerpad_max_install_names @gol
835 -iframework @gol
836 -image_base -init -install_name -keep_private_externs @gol
837 -multi_module -multiply_defined -multiply_defined_unused @gol
838 -noall_load -no_dead_strip_inits_and_terms @gol
839 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
840 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
841 -private_bundle -read_only_relocs -sectalign @gol
842 -sectobjectsymbols -whyload -seg1addr @gol
843 -sectcreate -sectobjectsymbols -sectorder @gol
844 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
845 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
846 -segprot -segs_read_only_addr -segs_read_write_addr @gol
847 -single_module -static -sub_library -sub_umbrella @gol
848 -twolevel_namespace -umbrella -undefined @gol
849 -unexported_symbols_list -weak_reference_mismatches @gol
850 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
851 -mkernel -mone-byte-bool}
852
853 @emph{DEC Alpha Options}
854 @gccoptlist{-mno-fp-regs -msoft-float @gol
855 -mieee -mieee-with-inexact -mieee-conformant @gol
856 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
857 -mtrap-precision=@var{mode} -mbuild-constants @gol
858 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
859 -mbwx -mmax -mfix -mcix @gol
860 -mfloat-vax -mfloat-ieee @gol
861 -mexplicit-relocs -msmall-data -mlarge-data @gol
862 -msmall-text -mlarge-text @gol
863 -mmemory-latency=@var{time}}
864
865 @emph{eBPF Options}
866 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
867 -mframe-limit=@var{bytes} -mxbpf}
868
869 @emph{FR30 Options}
870 @gccoptlist{-msmall-model -mno-lsim}
871
872 @emph{FT32 Options}
873 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
874
875 @emph{FRV Options}
876 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
877 -mhard-float -msoft-float @gol
878 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
879 -mdouble -mno-double @gol
880 -mmedia -mno-media -mmuladd -mno-muladd @gol
881 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
882 -mlinked-fp -mlong-calls -malign-labels @gol
883 -mlibrary-pic -macc-4 -macc-8 @gol
884 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
885 -moptimize-membar -mno-optimize-membar @gol
886 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
887 -mvliw-branch -mno-vliw-branch @gol
888 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
889 -mno-nested-cond-exec -mtomcat-stats @gol
890 -mTLS -mtls @gol
891 -mcpu=@var{cpu}}
892
893 @emph{GNU/Linux Options}
894 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
895 -tno-android-cc -tno-android-ld}
896
897 @emph{H8/300 Options}
898 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
899
900 @emph{HPPA Options}
901 @gccoptlist{-march=@var{architecture-type} @gol
902 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
903 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
904 -mfixed-range=@var{register-range} @gol
905 -mjump-in-delay -mlinker-opt -mlong-calls @gol
906 -mlong-load-store -mno-disable-fpregs @gol
907 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
908 -mno-jump-in-delay -mno-long-load-store @gol
909 -mno-portable-runtime -mno-soft-float @gol
910 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
911 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
912 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
913 -munix=@var{unix-std} -nolibdld -static -threads}
914
915 @emph{IA-64 Options}
916 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
917 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
918 -mconstant-gp -mauto-pic -mfused-madd @gol
919 -minline-float-divide-min-latency @gol
920 -minline-float-divide-max-throughput @gol
921 -mno-inline-float-divide @gol
922 -minline-int-divide-min-latency @gol
923 -minline-int-divide-max-throughput @gol
924 -mno-inline-int-divide @gol
925 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
926 -mno-inline-sqrt @gol
927 -mdwarf2-asm -mearly-stop-bits @gol
928 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
929 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
930 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
931 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
932 -msched-spec-ldc -msched-spec-control-ldc @gol
933 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
934 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
935 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
936 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
937
938 @emph{LM32 Options}
939 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
940 -msign-extend-enabled -muser-enabled}
941
942 @emph{M32R/D Options}
943 @gccoptlist{-m32r2 -m32rx -m32r @gol
944 -mdebug @gol
945 -malign-loops -mno-align-loops @gol
946 -missue-rate=@var{number} @gol
947 -mbranch-cost=@var{number} @gol
948 -mmodel=@var{code-size-model-type} @gol
949 -msdata=@var{sdata-type} @gol
950 -mno-flush-func -mflush-func=@var{name} @gol
951 -mno-flush-trap -mflush-trap=@var{number} @gol
952 -G @var{num}}
953
954 @emph{M32C Options}
955 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
956
957 @emph{M680x0 Options}
958 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
959 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
960 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
961 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
962 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
963 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
964 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
965 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
966 -mxgot -mno-xgot -mlong-jump-table-offsets}
967
968 @emph{MCore Options}
969 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
970 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
971 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
972 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
973 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
974
975 @emph{MeP Options}
976 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
977 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
978 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
979 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
980 -mtiny=@var{n}}
981
982 @emph{MicroBlaze Options}
983 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
984 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
985 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
986 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
987 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
988 -mpic-data-is-text-relative}
989
990 @emph{MIPS Options}
991 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
992 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
993 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
994 -mips16 -mno-mips16 -mflip-mips16 @gol
995 -minterlink-compressed -mno-interlink-compressed @gol
996 -minterlink-mips16 -mno-interlink-mips16 @gol
997 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
998 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
999 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1000 -mno-float -msingle-float -mdouble-float @gol
1001 -modd-spreg -mno-odd-spreg @gol
1002 -mabs=@var{mode} -mnan=@var{encoding} @gol
1003 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1004 -mmcu -mmno-mcu @gol
1005 -meva -mno-eva @gol
1006 -mvirt -mno-virt @gol
1007 -mxpa -mno-xpa @gol
1008 -mcrc -mno-crc @gol
1009 -mginv -mno-ginv @gol
1010 -mmicromips -mno-micromips @gol
1011 -mmsa -mno-msa @gol
1012 -mloongson-mmi -mno-loongson-mmi @gol
1013 -mloongson-ext -mno-loongson-ext @gol
1014 -mloongson-ext2 -mno-loongson-ext2 @gol
1015 -mfpu=@var{fpu-type} @gol
1016 -msmartmips -mno-smartmips @gol
1017 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1018 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1019 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1020 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1021 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1022 -membedded-data -mno-embedded-data @gol
1023 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1024 -mcode-readable=@var{setting} @gol
1025 -msplit-addresses -mno-split-addresses @gol
1026 -mexplicit-relocs -mno-explicit-relocs @gol
1027 -mcheck-zero-division -mno-check-zero-division @gol
1028 -mdivide-traps -mdivide-breaks @gol
1029 -mload-store-pairs -mno-load-store-pairs @gol
1030 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1031 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1032 -mfix-24k -mno-fix-24k @gol
1033 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1034 -mfix-r5900 -mno-fix-r5900 @gol
1035 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1036 -mfix-vr4120 -mno-fix-vr4120 @gol
1037 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1038 -mflush-func=@var{func} -mno-flush-func @gol
1039 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1040 -mcompact-branches=@var{policy} @gol
1041 -mfp-exceptions -mno-fp-exceptions @gol
1042 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1043 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1044 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1045 -mframe-header-opt -mno-frame-header-opt}
1046
1047 @emph{MMIX Options}
1048 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1049 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1050 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1051 -mno-base-addresses -msingle-exit -mno-single-exit}
1052
1053 @emph{MN10300 Options}
1054 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1055 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1056 -mtune=@var{cpu-type} @gol
1057 -mreturn-pointer-on-d0 @gol
1058 -mno-crt0 -mrelax -mliw -msetlb}
1059
1060 @emph{Moxie Options}
1061 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1062
1063 @emph{MSP430 Options}
1064 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1065 -mwarn-mcu @gol
1066 -mcode-region= -mdata-region= @gol
1067 -msilicon-errata= -msilicon-errata-warn= @gol
1068 -mhwmult= -minrt -mtiny-printf}
1069
1070 @emph{NDS32 Options}
1071 @gccoptlist{-mbig-endian -mlittle-endian @gol
1072 -mreduced-regs -mfull-regs @gol
1073 -mcmov -mno-cmov @gol
1074 -mext-perf -mno-ext-perf @gol
1075 -mext-perf2 -mno-ext-perf2 @gol
1076 -mext-string -mno-ext-string @gol
1077 -mv3push -mno-v3push @gol
1078 -m16bit -mno-16bit @gol
1079 -misr-vector-size=@var{num} @gol
1080 -mcache-block-size=@var{num} @gol
1081 -march=@var{arch} @gol
1082 -mcmodel=@var{code-model} @gol
1083 -mctor-dtor -mrelax}
1084
1085 @emph{Nios II Options}
1086 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1087 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1088 -mel -meb @gol
1089 -mno-bypass-cache -mbypass-cache @gol
1090 -mno-cache-volatile -mcache-volatile @gol
1091 -mno-fast-sw-div -mfast-sw-div @gol
1092 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1093 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1094 -mcustom-fpu-cfg=@var{name} @gol
1095 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1096 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1097
1098 @emph{Nvidia PTX Options}
1099 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1100
1101 @emph{OpenRISC Options}
1102 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1103 -msoft-mul -msoft-div @gol
1104 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1105 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1106
1107 @emph{PDP-11 Options}
1108 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1109 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1110 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1111
1112 @emph{picoChip Options}
1113 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1114 -msymbol-as-address -mno-inefficient-warnings}
1115
1116 @emph{PowerPC Options}
1117 See RS/6000 and PowerPC Options.
1118
1119 @emph{PRU Options}
1120 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1121 -mabi=@var{variant} @gol}
1122
1123 @emph{RISC-V Options}
1124 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1125 -mplt -mno-plt @gol
1126 -mabi=@var{ABI-string} @gol
1127 -mfdiv -mno-fdiv @gol
1128 -mdiv -mno-div @gol
1129 -march=@var{ISA-string} @gol
1130 -mtune=@var{processor-string} @gol
1131 -mpreferred-stack-boundary=@var{num} @gol
1132 -msmall-data-limit=@var{N-bytes} @gol
1133 -msave-restore -mno-save-restore @gol
1134 -mshorten-memrefs -mno-shorten-memrefs @gol
1135 -mstrict-align -mno-strict-align @gol
1136 -mcmodel=medlow -mcmodel=medany @gol
1137 -mexplicit-relocs -mno-explicit-relocs @gol
1138 -mrelax -mno-relax @gol
1139 -mriscv-attribute -mmo-riscv-attribute @gol
1140 -malign-data=@var{type}}
1141
1142 @emph{RL78 Options}
1143 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1144 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1145 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1146
1147 @emph{RS/6000 and PowerPC Options}
1148 @gccoptlist{-mcpu=@var{cpu-type} @gol
1149 -mtune=@var{cpu-type} @gol
1150 -mcmodel=@var{code-model} @gol
1151 -mpowerpc64 @gol
1152 -maltivec -mno-altivec @gol
1153 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1154 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1155 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1156 -mfprnd -mno-fprnd @gol
1157 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1158 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1159 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1160 -malign-power -malign-natural @gol
1161 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1162 -mupdate -mno-update @gol
1163 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1164 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1165 -mstrict-align -mno-strict-align -mrelocatable @gol
1166 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1167 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1168 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1169 -mprioritize-restricted-insns=@var{priority} @gol
1170 -msched-costly-dep=@var{dependence_type} @gol
1171 -minsert-sched-nops=@var{scheme} @gol
1172 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1173 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1174 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1175 -mtraceback=@var{traceback_type} @gol
1176 -maix-struct-return -msvr4-struct-return @gol
1177 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1178 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1179 -mblock-move-inline-limit=@var{num} @gol
1180 -mblock-compare-inline-limit=@var{num} @gol
1181 -mblock-compare-inline-loop-limit=@var{num} @gol
1182 -mstring-compare-inline-limit=@var{num} @gol
1183 -misel -mno-isel @gol
1184 -mvrsave -mno-vrsave @gol
1185 -mmulhw -mno-mulhw @gol
1186 -mdlmzb -mno-dlmzb @gol
1187 -mprototype -mno-prototype @gol
1188 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1189 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1190 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1191 -mno-recip-precision @gol
1192 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1193 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1194 -msave-toc-indirect -mno-save-toc-indirect @gol
1195 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1196 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1197 -mquad-memory -mno-quad-memory @gol
1198 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1199 -mcompat-align-parm -mno-compat-align-parm @gol
1200 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1201 -mgnu-attribute -mno-gnu-attribute @gol
1202 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1203 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1204 -mpcrel -mno-pcrel}
1205
1206 @emph{RX Options}
1207 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1208 -mcpu=@gol
1209 -mbig-endian-data -mlittle-endian-data @gol
1210 -msmall-data @gol
1211 -msim -mno-sim@gol
1212 -mas100-syntax -mno-as100-syntax@gol
1213 -mrelax@gol
1214 -mmax-constant-size=@gol
1215 -mint-register=@gol
1216 -mpid@gol
1217 -mallow-string-insns -mno-allow-string-insns@gol
1218 -mjsr@gol
1219 -mno-warn-multiple-fast-interrupts@gol
1220 -msave-acc-in-interrupts}
1221
1222 @emph{S/390 and zSeries Options}
1223 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1224 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1225 -mlong-double-64 -mlong-double-128 @gol
1226 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1227 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1228 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1229 -mhtm -mvx -mzvector @gol
1230 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1231 -mfused-madd -mno-fused-madd @gol
1232 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1233 -mhotpatch=@var{halfwords},@var{halfwords}}
1234
1235 @emph{Score Options}
1236 @gccoptlist{-meb -mel @gol
1237 -mnhwloop @gol
1238 -muls @gol
1239 -mmac @gol
1240 -mscore5 -mscore5u -mscore7 -mscore7d}
1241
1242 @emph{SH Options}
1243 @gccoptlist{-m1 -m2 -m2e @gol
1244 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1245 -m3 -m3e @gol
1246 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1247 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1248 -mb -ml -mdalign -mrelax @gol
1249 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1250 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1251 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1252 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1253 -maccumulate-outgoing-args @gol
1254 -matomic-model=@var{atomic-model} @gol
1255 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1256 -mcbranch-force-delay-slot @gol
1257 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1258 -mpretend-cmove -mtas}
1259
1260 @emph{Solaris 2 Options}
1261 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1262 -pthreads}
1263
1264 @emph{SPARC Options}
1265 @gccoptlist{-mcpu=@var{cpu-type} @gol
1266 -mtune=@var{cpu-type} @gol
1267 -mcmodel=@var{code-model} @gol
1268 -mmemory-model=@var{mem-model} @gol
1269 -m32 -m64 -mapp-regs -mno-app-regs @gol
1270 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1271 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1272 -mhard-quad-float -msoft-quad-float @gol
1273 -mstack-bias -mno-stack-bias @gol
1274 -mstd-struct-return -mno-std-struct-return @gol
1275 -munaligned-doubles -mno-unaligned-doubles @gol
1276 -muser-mode -mno-user-mode @gol
1277 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1278 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1279 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1280 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1281 -mpopc -mno-popc -msubxc -mno-subxc @gol
1282 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1283 -mlra -mno-lra}
1284
1285 @emph{System V Options}
1286 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1287
1288 @emph{TILE-Gx Options}
1289 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1290 -mcmodel=@var{code-model}}
1291
1292 @emph{TILEPro Options}
1293 @gccoptlist{-mcpu=@var{cpu} -m32}
1294
1295 @emph{V850 Options}
1296 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1297 -mprolog-function -mno-prolog-function -mspace @gol
1298 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1299 -mapp-regs -mno-app-regs @gol
1300 -mdisable-callt -mno-disable-callt @gol
1301 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1302 -mv850e -mv850 -mv850e3v5 @gol
1303 -mloop @gol
1304 -mrelax @gol
1305 -mlong-jumps @gol
1306 -msoft-float @gol
1307 -mhard-float @gol
1308 -mgcc-abi @gol
1309 -mrh850-abi @gol
1310 -mbig-switch}
1311
1312 @emph{VAX Options}
1313 @gccoptlist{-mg -mgnu -munix}
1314
1315 @emph{Visium Options}
1316 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1317 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1318
1319 @emph{VMS Options}
1320 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1321 -mpointer-size=@var{size}}
1322
1323 @emph{VxWorks Options}
1324 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1325 -Xbind-lazy -Xbind-now}
1326
1327 @emph{x86 Options}
1328 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1329 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1330 -mfpmath=@var{unit} @gol
1331 -masm=@var{dialect} -mno-fancy-math-387 @gol
1332 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1333 -mno-wide-multiply -mrtd -malign-double @gol
1334 -mpreferred-stack-boundary=@var{num} @gol
1335 -mincoming-stack-boundary=@var{num} @gol
1336 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1337 -mrecip -mrecip=@var{opt} @gol
1338 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1339 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1340 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1341 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1342 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1343 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1344 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1345 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1346 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1347 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1348 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1349 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1350 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1351 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1352 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1353 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1354 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1355 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1356 -mregparm=@var{num} -msseregparm @gol
1357 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1358 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1359 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1360 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1361 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1362 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1363 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1364 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1365 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1366 -mstack-protector-guard-reg=@var{reg} @gol
1367 -mstack-protector-guard-offset=@var{offset} @gol
1368 -mstack-protector-guard-symbol=@var{symbol} @gol
1369 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1370 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1371 -mindirect-branch-register}
1372
1373 @emph{x86 Windows Options}
1374 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1375 -mnop-fun-dllimport -mthread @gol
1376 -municode -mwin32 -mwindows -fno-set-stack-executable}
1377
1378 @emph{Xstormy16 Options}
1379 @gccoptlist{-msim}
1380
1381 @emph{Xtensa Options}
1382 @gccoptlist{-mconst16 -mno-const16 @gol
1383 -mfused-madd -mno-fused-madd @gol
1384 -mforce-no-pic @gol
1385 -mserialize-volatile -mno-serialize-volatile @gol
1386 -mtext-section-literals -mno-text-section-literals @gol
1387 -mauto-litpools -mno-auto-litpools @gol
1388 -mtarget-align -mno-target-align @gol
1389 -mlongcalls -mno-longcalls}
1390
1391 @emph{zSeries Options}
1392 See S/390 and zSeries Options.
1393 @end table
1394
1395
1396 @node Overall Options
1397 @section Options Controlling the Kind of Output
1398
1399 Compilation can involve up to four stages: preprocessing, compilation
1400 proper, assembly and linking, always in that order. GCC is capable of
1401 preprocessing and compiling several files either into several
1402 assembler input files, or into one assembler input file; then each
1403 assembler input file produces an object file, and linking combines all
1404 the object files (those newly compiled, and those specified as input)
1405 into an executable file.
1406
1407 @cindex file name suffix
1408 For any given input file, the file name suffix determines what kind of
1409 compilation is done:
1410
1411 @table @gcctabopt
1412 @item @var{file}.c
1413 C source code that must be preprocessed.
1414
1415 @item @var{file}.i
1416 C source code that should not be preprocessed.
1417
1418 @item @var{file}.ii
1419 C++ source code that should not be preprocessed.
1420
1421 @item @var{file}.m
1422 Objective-C source code. Note that you must link with the @file{libobjc}
1423 library to make an Objective-C program work.
1424
1425 @item @var{file}.mi
1426 Objective-C source code that should not be preprocessed.
1427
1428 @item @var{file}.mm
1429 @itemx @var{file}.M
1430 Objective-C++ source code. Note that you must link with the @file{libobjc}
1431 library to make an Objective-C++ program work. Note that @samp{.M} refers
1432 to a literal capital M@.
1433
1434 @item @var{file}.mii
1435 Objective-C++ source code that should not be preprocessed.
1436
1437 @item @var{file}.h
1438 C, C++, Objective-C or Objective-C++ header file to be turned into a
1439 precompiled header (default), or C, C++ header file to be turned into an
1440 Ada spec (via the @option{-fdump-ada-spec} switch).
1441
1442 @item @var{file}.cc
1443 @itemx @var{file}.cp
1444 @itemx @var{file}.cxx
1445 @itemx @var{file}.cpp
1446 @itemx @var{file}.CPP
1447 @itemx @var{file}.c++
1448 @itemx @var{file}.C
1449 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1450 the last two letters must both be literally @samp{x}. Likewise,
1451 @samp{.C} refers to a literal capital C@.
1452
1453 @item @var{file}.mm
1454 @itemx @var{file}.M
1455 Objective-C++ source code that must be preprocessed.
1456
1457 @item @var{file}.mii
1458 Objective-C++ source code that should not be preprocessed.
1459
1460 @item @var{file}.hh
1461 @itemx @var{file}.H
1462 @itemx @var{file}.hp
1463 @itemx @var{file}.hxx
1464 @itemx @var{file}.hpp
1465 @itemx @var{file}.HPP
1466 @itemx @var{file}.h++
1467 @itemx @var{file}.tcc
1468 C++ header file to be turned into a precompiled header or Ada spec.
1469
1470 @item @var{file}.f
1471 @itemx @var{file}.for
1472 @itemx @var{file}.ftn
1473 Fixed form Fortran source code that should not be preprocessed.
1474
1475 @item @var{file}.F
1476 @itemx @var{file}.FOR
1477 @itemx @var{file}.fpp
1478 @itemx @var{file}.FPP
1479 @itemx @var{file}.FTN
1480 Fixed form Fortran source code that must be preprocessed (with the traditional
1481 preprocessor).
1482
1483 @item @var{file}.f90
1484 @itemx @var{file}.f95
1485 @itemx @var{file}.f03
1486 @itemx @var{file}.f08
1487 Free form Fortran source code that should not be preprocessed.
1488
1489 @item @var{file}.F90
1490 @itemx @var{file}.F95
1491 @itemx @var{file}.F03
1492 @itemx @var{file}.F08
1493 Free form Fortran source code that must be preprocessed (with the
1494 traditional preprocessor).
1495
1496 @item @var{file}.go
1497 Go source code.
1498
1499 @item @var{file}.brig
1500 BRIG files (binary representation of HSAIL).
1501
1502 @item @var{file}.d
1503 D source code.
1504
1505 @item @var{file}.di
1506 D interface file.
1507
1508 @item @var{file}.dd
1509 D documentation code (Ddoc).
1510
1511 @item @var{file}.ads
1512 Ada source code file that contains a library unit declaration (a
1513 declaration of a package, subprogram, or generic, or a generic
1514 instantiation), or a library unit renaming declaration (a package,
1515 generic, or subprogram renaming declaration). Such files are also
1516 called @dfn{specs}.
1517
1518 @item @var{file}.adb
1519 Ada source code file containing a library unit body (a subprogram or
1520 package body). Such files are also called @dfn{bodies}.
1521
1522 @c GCC also knows about some suffixes for languages not yet included:
1523 @c Ratfor:
1524 @c @var{file}.r
1525
1526 @item @var{file}.s
1527 Assembler code.
1528
1529 @item @var{file}.S
1530 @itemx @var{file}.sx
1531 Assembler code that must be preprocessed.
1532
1533 @item @var{other}
1534 An object file to be fed straight into linking.
1535 Any file name with no recognized suffix is treated this way.
1536 @end table
1537
1538 @opindex x
1539 You can specify the input language explicitly with the @option{-x} option:
1540
1541 @table @gcctabopt
1542 @item -x @var{language}
1543 Specify explicitly the @var{language} for the following input files
1544 (rather than letting the compiler choose a default based on the file
1545 name suffix). This option applies to all following input files until
1546 the next @option{-x} option. Possible values for @var{language} are:
1547 @smallexample
1548 c c-header cpp-output
1549 c++ c++-header c++-cpp-output
1550 objective-c objective-c-header objective-c-cpp-output
1551 objective-c++ objective-c++-header objective-c++-cpp-output
1552 assembler assembler-with-cpp
1553 ada
1554 d
1555 f77 f77-cpp-input f95 f95-cpp-input
1556 go
1557 brig
1558 @end smallexample
1559
1560 @item -x none
1561 Turn off any specification of a language, so that subsequent files are
1562 handled according to their file name suffixes (as they are if @option{-x}
1563 has not been used at all).
1564 @end table
1565
1566 If you only want some of the stages of compilation, you can use
1567 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1568 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1569 @command{gcc} is to stop. Note that some combinations (for example,
1570 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1571
1572 @table @gcctabopt
1573 @item -c
1574 @opindex c
1575 Compile or assemble the source files, but do not link. The linking
1576 stage simply is not done. The ultimate output is in the form of an
1577 object file for each source file.
1578
1579 By default, the object file name for a source file is made by replacing
1580 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1581
1582 Unrecognized input files, not requiring compilation or assembly, are
1583 ignored.
1584
1585 @item -S
1586 @opindex S
1587 Stop after the stage of compilation proper; do not assemble. The output
1588 is in the form of an assembler code file for each non-assembler input
1589 file specified.
1590
1591 By default, the assembler file name for a source file is made by
1592 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1593
1594 Input files that don't require compilation are ignored.
1595
1596 @item -E
1597 @opindex E
1598 Stop after the preprocessing stage; do not run the compiler proper. The
1599 output is in the form of preprocessed source code, which is sent to the
1600 standard output.
1601
1602 Input files that don't require preprocessing are ignored.
1603
1604 @cindex output file option
1605 @item -o @var{file}
1606 @opindex o
1607 Place the primary output in file @var{file}. This applies to whatever
1608 sort of output is being produced, whether it be an executable file, an
1609 object file, an assembler file or preprocessed C code.
1610
1611 If @option{-o} is not specified, the default is to put an executable
1612 file in @file{a.out}, the object file for
1613 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1614 assembler file in @file{@var{source}.s}, a precompiled header file in
1615 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1616 standard output.
1617
1618 Though @option{-o} names only the primary output, it also affects the
1619 naming of auxiliary and dump outputs. See the examples below. Unless
1620 overridden, both auxiliary outputs and dump outputs are placed in the
1621 same directory as the primary output. In auxiliary outputs, the suffix
1622 of the input file is replaced with that of the auxiliary output file
1623 type; in dump outputs, the suffix of the dump file is appended to the
1624 input file suffix. In compilation commands, the base name of both
1625 auxiliary and dump outputs is that of the primary output; in compile and
1626 link commands, the primary output name, minus the executable suffix, is
1627 combined with the input file name. If both share the same base name,
1628 disregarding the suffix, the result of the combination is that base
1629 name, otherwise, they are concatenated, separated by a dash.
1630
1631 @smallexample
1632 gcc -c foo.c ...
1633 @end smallexample
1634
1635 will use @file{foo.o} as the primary output, and place aux outputs and
1636 dumps next to it, e.g., aux file @file{foo.dwo} for
1637 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1638 @option{-fdump-rtl-final}.
1639
1640 If a non-linker output file is explicitly specified, aux and dump files
1641 by default take the same base name:
1642
1643 @smallexample
1644 gcc -c foo.c -o dir/foobar.o ...
1645 @end smallexample
1646
1647 will name aux outputs @file{dir/foobar.*} and dump outputs
1648 @file{dir/foobar.c.*}.
1649
1650 A linker output will instead prefix aux and dump outputs:
1651
1652 @smallexample
1653 gcc foo.c bar.c -o dir/foobar ...
1654 @end smallexample
1655
1656 will generally name aux outputs @file{dir/foobar-foo.*} and
1657 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1658 @file{dir/foobar-bar.c.*}.
1659
1660 The one exception to the above is when the executable shares the base
1661 name with the single input:
1662
1663 @smallexample
1664 gcc foo.c -o dir/foo ...
1665 @end smallexample
1666
1667 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1668 named @file{dir/foo.c.*}.
1669
1670 The location and the names of auxiliary and dump outputs can be adjusted
1671 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1672 @option{-dumpdir}, @option{-save-temps=cwd}, and
1673 @option{-save-temps=obj}.
1674
1675
1676 @item -dumpbase @var{dumpbase}
1677 @opindex dumpbase
1678 This option sets the base name for auxiliary and dump output files. It
1679 does not affect the name of the primary output file. Intermediate
1680 outputs, when preserved, are not regarded as primary outputs, but as
1681 auxiliary outputs:
1682
1683 @smallexample
1684 gcc -save-temps -S foo.c
1685 @end smallexample
1686
1687 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1688 then compiles to the (implied) output file @file{foo.s}, whereas:
1689
1690 @smallexample
1691 gcc -save-temps -dumpbase save-foo -c foo.c
1692 @end smallexample
1693
1694 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1695 an intermediate, thus auxiliary output), and then assembles to the
1696 (implied) output file @file{foo.o}.
1697
1698 Absent this option, dump and aux files take their names from the input
1699 file, or from the (non-linker) output file, if one is explicitly
1700 specified: dump output files (e.g. those requested by @option{-fdump-*}
1701 options) with the input name suffix, and aux output files (those
1702 requested by other non-dump options, e.g. @code{-save-temps},
1703 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1704
1705 Similar suffix differentiation of dump and aux outputs can be attained
1706 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1707 @option{-dumpbase-ext .suf}.
1708
1709 If @var{dumpbase} is explicitly specified with any directory component,
1710 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1711 @option{-save-temps=*}) is ignored, and instead of appending to it,
1712 @var{dumpbase} fully overrides it:
1713
1714 @smallexample
1715 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1716 -dumpdir pfx- -save-temps=cwd ...
1717 @end smallexample
1718
1719 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1720 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1721 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1722
1723 When @option{-dumpbase} is specified in a command that compiles multiple
1724 inputs, or that compiles and then links, it may be combined with
1725 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1726 file is compiled using the combined @var{dumppfx}, and default values
1727 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1728 file:
1729
1730 @smallexample
1731 gcc foo.c bar.c -c -dumpbase main ...
1732 @end smallexample
1733
1734 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1735 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1736 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1737 and @file{main-bar.*}.
1738
1739 An empty string specified as @var{dumpbase} avoids the influence of the
1740 output basename in the naming of auxiliary and dump outputs during
1741 compilation, computing default values :
1742
1743 @smallexample
1744 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1745 @end smallexample
1746
1747 will name aux outputs @file{dir/foo.*} and dump outputs
1748 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1749 name, but the directory still defaults to that of the output.
1750
1751 The empty-string dumpbase does not prevent the use of the output
1752 basename for outputs during linking:
1753
1754 @smallexample
1755 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1756 @end smallexample
1757
1758 The compilation of the source files will name auxiliary outputs
1759 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1760 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1761 linking will use @file{dir/foobar.} as the prefix for dumps and
1762 auxiliary files.
1763
1764
1765 @item -dumpbase-ext @var{auxdropsuf}
1766 @opindex dumpbase-ext
1767 When forming the name of an auxiliary (but not a dump) output file, drop
1768 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1769 suffixes. If not specified, this option defaults to the suffix of a
1770 default @var{dumpbase}, i.e., the suffix of the input file when
1771 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1772 is combined with @var{dumppfx}.
1773
1774 @smallexample
1775 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1776 @end smallexample
1777
1778 creates @file{dir/foo.o} as the main output, and generates auxiliary
1779 outputs in @file{dir/x-foo.*}, taking the location of the primary
1780 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1781 outputs retain the suffix: @file{dir/x-foo.c.*}.
1782
1783 This option is disregarded if it does not match the suffix of a
1784 specified @var{dumpbase}, except as an alternative to the executable
1785 suffix when appending the linker output base name to @var{dumppfx}, as
1786 specified below:
1787
1788 @smallexample
1789 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1790 @end smallexample
1791
1792 creates @file{main.out} as the primary output, and avoids overwriting
1793 the auxiliary and dump outputs by using the executable name minus
1794 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1795 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1796 @file{main-foo.c.*} and @file{main-bar.c.*}.
1797
1798
1799 @item -dumpdir @var{dumppfx}
1800 @opindex dumpdir
1801 When forming the name of an auxiliary or dump output file, use
1802 @var{dumppfx} as a prefix:
1803
1804 @smallexample
1805 gcc -dumpdir pfx- -c foo.c ...
1806 @end smallexample
1807
1808 creates @file{foo.o} as the primary output, and auxiliary outputs named
1809 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1810 @var{dumpbase} derived from the default primary output, derived in turn
1811 from the input name. Dump outputs also take the input name suffix:
1812 @file{pfx-foo.c.*}.
1813
1814 If @var{dumppfx} is to be used as a directory name, it must end with a
1815 directory separator:
1816
1817 @smallexample
1818 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1819 @end smallexample
1820
1821 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1822 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1823 default @var{dumpbase} derived from the primary output name. Dump
1824 outputs also take the input name suffix: @file{dir/bar.c.*}.
1825
1826 It defaults to the location of the output file; options
1827 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1828 default, just like an explicit @option{-dumpdir} option. In case
1829 multiple such options are given, the last one prevails:
1830
1831 @smallexample
1832 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1833 @end smallexample
1834
1835 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1836 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1837 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1838 default for @option{-save-temps}, nor that the output directory is
1839 implicitly the current directory. Dump outputs are named
1840 @file{foo.c.*}.
1841
1842 When compiling from multiple input files, if @option{-dumpbase} is
1843 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1844 are appended to (or override, if containing any directory components) an
1845 explicit or defaulted @var{dumppfx}, so that each of the multiple
1846 compilations gets differently-named aux and dump outputs.
1847
1848 @smallexample
1849 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1850 @end smallexample
1851
1852 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1853 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1854 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1855 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1856 single-input compilation:
1857
1858 @smallexample
1859 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1860 @end smallexample
1861
1862 that, applying @option{-dumpbase} to a single source, does not compute
1863 and append a separate @var{dumpbase} per input file. Its auxiliary and
1864 dump outputs go in @file{dir/pfx-main.*}.
1865
1866 When compiling and then linking from multiple input files, a defaulted
1867 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1868 transformation above (e.g. the compilation of @file{foo.c} and
1869 @file{bar.c} above, but without @option{-c}). If neither
1870 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1871 base name, minus @var{auxdropsuf}, if specified, or the executable
1872 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1873 instead. Note, however, that unlike earlier cases of linking:
1874
1875 @smallexample
1876 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1877 @end smallexample
1878
1879 does not append the output name @file{main} to @var{dumppfx}, because
1880 @option{-dumpdir} is explicitly specified. The goal is that the
1881 explicitly-specified @var{dumppfx} may contain the specified output name
1882 as part of the prefix, if desired; only an explicitly-specified
1883 @option{-dumpbase} would be combined with it, in order to avoid simply
1884 discarding a meaningful option.
1885
1886 When compiling and then linking from a single input file, the linker
1887 output base name will only be appended to the default @var{dumppfx} as
1888 above if it does not share the base name with the single input file
1889 name. This has been covered in single-input linking cases above, but
1890 not with an explicit @option{-dumpdir} that inhibits the combination,
1891 even if overridden by @option{-save-temps=*}:
1892
1893 @smallexample
1894 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1895 @end smallexample
1896
1897 Auxiliary outputs are named @file{foo.*}, and dump outputs
1898 @file{foo.c.*}, in the current working directory as ultimately requested
1899 by @option{-save-temps=cwd}.
1900
1901 Summing it all up for an intuitive though slightly imprecise data flow:
1902 the primary output name is broken into a directory part and a basename
1903 part; @var{dumppfx} is set to the former, unless overridden by
1904 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1905 to the latter, unless overriden by @option{-dumpbase}. If there are
1906 multiple inputs or linking, this @var{dumpbase} may be combined with
1907 @var{dumppfx} and taken from each input file. Auxiliary output names
1908 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1909 minus suffix, and the auxiliary output suffix; dump output names are
1910 only different in that the suffix from @var{dumpbase} is retained.
1911
1912 When it comes to auxiliary and dump outputs created during LTO
1913 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1914 given or as derived from the linker output name but not from inputs,
1915 even in cases in which this combination would not otherwise be used as
1916 such, is passed down with a trailing period replacing the compiler-added
1917 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1918 being involved in linking, this program does not normally get any
1919 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1920
1921 When running sub-compilers, @command{lto-wrapper} appends LTO stage
1922 names to the received @var{dumppfx}, ensures it contains a directory
1923 component so that it overrides any @option{-dumpdir}, and passes that as
1924 @option{-dumpbase} to sub-compilers.
1925
1926 @item -v
1927 @opindex v
1928 Print (on standard error output) the commands executed to run the stages
1929 of compilation. Also print the version number of the compiler driver
1930 program and of the preprocessor and the compiler proper.
1931
1932 @item -###
1933 @opindex ###
1934 Like @option{-v} except the commands are not executed and arguments
1935 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1936 This is useful for shell scripts to capture the driver-generated command lines.
1937
1938 @item --help
1939 @opindex help
1940 Print (on the standard output) a description of the command-line options
1941 understood by @command{gcc}. If the @option{-v} option is also specified
1942 then @option{--help} is also passed on to the various processes
1943 invoked by @command{gcc}, so that they can display the command-line options
1944 they accept. If the @option{-Wextra} option has also been specified
1945 (prior to the @option{--help} option), then command-line options that
1946 have no documentation associated with them are also displayed.
1947
1948 @item --target-help
1949 @opindex target-help
1950 Print (on the standard output) a description of target-specific command-line
1951 options for each tool. For some targets extra target-specific
1952 information may also be printed.
1953
1954 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1955 Print (on the standard output) a description of the command-line
1956 options understood by the compiler that fit into all specified classes
1957 and qualifiers. These are the supported classes:
1958
1959 @table @asis
1960 @item @samp{optimizers}
1961 Display all of the optimization options supported by the
1962 compiler.
1963
1964 @item @samp{warnings}
1965 Display all of the options controlling warning messages
1966 produced by the compiler.
1967
1968 @item @samp{target}
1969 Display target-specific options. Unlike the
1970 @option{--target-help} option however, target-specific options of the
1971 linker and assembler are not displayed. This is because those
1972 tools do not currently support the extended @option{--help=} syntax.
1973
1974 @item @samp{params}
1975 Display the values recognized by the @option{--param}
1976 option.
1977
1978 @item @var{language}
1979 Display the options supported for @var{language}, where
1980 @var{language} is the name of one of the languages supported in this
1981 version of GCC@. If an option is supported by all languages, one needs
1982 to select @samp{common} class.
1983
1984 @item @samp{common}
1985 Display the options that are common to all languages.
1986 @end table
1987
1988 These are the supported qualifiers:
1989
1990 @table @asis
1991 @item @samp{undocumented}
1992 Display only those options that are undocumented.
1993
1994 @item @samp{joined}
1995 Display options taking an argument that appears after an equal
1996 sign in the same continuous piece of text, such as:
1997 @samp{--help=target}.
1998
1999 @item @samp{separate}
2000 Display options taking an argument that appears as a separate word
2001 following the original option, such as: @samp{-o output-file}.
2002 @end table
2003
2004 Thus for example to display all the undocumented target-specific
2005 switches supported by the compiler, use:
2006
2007 @smallexample
2008 --help=target,undocumented
2009 @end smallexample
2010
2011 The sense of a qualifier can be inverted by prefixing it with the
2012 @samp{^} character, so for example to display all binary warning
2013 options (i.e., ones that are either on or off and that do not take an
2014 argument) that have a description, use:
2015
2016 @smallexample
2017 --help=warnings,^joined,^undocumented
2018 @end smallexample
2019
2020 The argument to @option{--help=} should not consist solely of inverted
2021 qualifiers.
2022
2023 Combining several classes is possible, although this usually
2024 restricts the output so much that there is nothing to display. One
2025 case where it does work, however, is when one of the classes is
2026 @var{target}. For example, to display all the target-specific
2027 optimization options, use:
2028
2029 @smallexample
2030 --help=target,optimizers
2031 @end smallexample
2032
2033 The @option{--help=} option can be repeated on the command line. Each
2034 successive use displays its requested class of options, skipping
2035 those that have already been displayed. If @option{--help} is also
2036 specified anywhere on the command line then this takes precedence
2037 over any @option{--help=} option.
2038
2039 If the @option{-Q} option appears on the command line before the
2040 @option{--help=} option, then the descriptive text displayed by
2041 @option{--help=} is changed. Instead of describing the displayed
2042 options, an indication is given as to whether the option is enabled,
2043 disabled or set to a specific value (assuming that the compiler
2044 knows this at the point where the @option{--help=} option is used).
2045
2046 Here is a truncated example from the ARM port of @command{gcc}:
2047
2048 @smallexample
2049 % gcc -Q -mabi=2 --help=target -c
2050 The following options are target specific:
2051 -mabi= 2
2052 -mabort-on-noreturn [disabled]
2053 -mapcs [disabled]
2054 @end smallexample
2055
2056 The output is sensitive to the effects of previous command-line
2057 options, so for example it is possible to find out which optimizations
2058 are enabled at @option{-O2} by using:
2059
2060 @smallexample
2061 -Q -O2 --help=optimizers
2062 @end smallexample
2063
2064 Alternatively you can discover which binary optimizations are enabled
2065 by @option{-O3} by using:
2066
2067 @smallexample
2068 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2069 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2070 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2071 @end smallexample
2072
2073 @item --version
2074 @opindex version
2075 Display the version number and copyrights of the invoked GCC@.
2076
2077 @item -pass-exit-codes
2078 @opindex pass-exit-codes
2079 Normally the @command{gcc} program exits with the code of 1 if any
2080 phase of the compiler returns a non-success return code. If you specify
2081 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2082 the numerically highest error produced by any phase returning an error
2083 indication. The C, C++, and Fortran front ends return 4 if an internal
2084 compiler error is encountered.
2085
2086 @item -pipe
2087 @opindex pipe
2088 Use pipes rather than temporary files for communication between the
2089 various stages of compilation. This fails to work on some systems where
2090 the assembler is unable to read from a pipe; but the GNU assembler has
2091 no trouble.
2092
2093 @item -specs=@var{file}
2094 @opindex specs
2095 Process @var{file} after the compiler reads in the standard @file{specs}
2096 file, in order to override the defaults which the @command{gcc} driver
2097 program uses when determining what switches to pass to @command{cc1},
2098 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2099 @option{-specs=@var{file}} can be specified on the command line, and they
2100 are processed in order, from left to right. @xref{Spec Files}, for
2101 information about the format of the @var{file}.
2102
2103 @item -wrapper
2104 @opindex wrapper
2105 Invoke all subcommands under a wrapper program. The name of the
2106 wrapper program and its parameters are passed as a comma separated
2107 list.
2108
2109 @smallexample
2110 gcc -c t.c -wrapper gdb,--args
2111 @end smallexample
2112
2113 @noindent
2114 This invokes all subprograms of @command{gcc} under
2115 @samp{gdb --args}, thus the invocation of @command{cc1} is
2116 @samp{gdb --args cc1 @dots{}}.
2117
2118 @item -ffile-prefix-map=@var{old}=@var{new}
2119 @opindex ffile-prefix-map
2120 When compiling files residing in directory @file{@var{old}}, record
2121 any references to them in the result of the compilation as if the
2122 files resided in directory @file{@var{new}} instead. Specifying this
2123 option is equivalent to specifying all the individual
2124 @option{-f*-prefix-map} options. This can be used to make reproducible
2125 builds that are location independent. See also
2126 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
2127
2128 @item -fplugin=@var{name}.so
2129 @opindex fplugin
2130 Load the plugin code in file @var{name}.so, assumed to be a
2131 shared object to be dlopen'd by the compiler. The base name of
2132 the shared object file is used to identify the plugin for the
2133 purposes of argument parsing (See
2134 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2135 Each plugin should define the callback functions specified in the
2136 Plugins API.
2137
2138 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2139 @opindex fplugin-arg
2140 Define an argument called @var{key} with a value of @var{value}
2141 for the plugin called @var{name}.
2142
2143 @item -fdump-ada-spec@r{[}-slim@r{]}
2144 @opindex fdump-ada-spec
2145 For C and C++ source and include files, generate corresponding Ada specs.
2146 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2147 GNAT User's Guide}, which provides detailed documentation on this feature.
2148
2149 @item -fada-spec-parent=@var{unit}
2150 @opindex fada-spec-parent
2151 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2152 Ada specs as child units of parent @var{unit}.
2153
2154 @item -fdump-go-spec=@var{file}
2155 @opindex fdump-go-spec
2156 For input files in any language, generate corresponding Go
2157 declarations in @var{file}. This generates Go @code{const},
2158 @code{type}, @code{var}, and @code{func} declarations which may be a
2159 useful way to start writing a Go interface to code written in some
2160 other language.
2161
2162 @include @value{srcdir}/../libiberty/at-file.texi
2163 @end table
2164
2165 @node Invoking G++
2166 @section Compiling C++ Programs
2167
2168 @cindex suffixes for C++ source
2169 @cindex C++ source file suffixes
2170 C++ source files conventionally use one of the suffixes @samp{.C},
2171 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2172 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2173 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2174 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2175 files with these names and compiles them as C++ programs even if you
2176 call the compiler the same way as for compiling C programs (usually
2177 with the name @command{gcc}).
2178
2179 @findex g++
2180 @findex c++
2181 However, the use of @command{gcc} does not add the C++ library.
2182 @command{g++} is a program that calls GCC and automatically specifies linking
2183 against the C++ library. It treats @samp{.c},
2184 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2185 files unless @option{-x} is used. This program is also useful when
2186 precompiling a C header file with a @samp{.h} extension for use in C++
2187 compilations. On many systems, @command{g++} is also installed with
2188 the name @command{c++}.
2189
2190 @cindex invoking @command{g++}
2191 When you compile C++ programs, you may specify many of the same
2192 command-line options that you use for compiling programs in any
2193 language; or command-line options meaningful for C and related
2194 languages; or options that are meaningful only for C++ programs.
2195 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2196 explanations of options for languages related to C@.
2197 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2198 explanations of options that are meaningful only for C++ programs.
2199
2200 @node C Dialect Options
2201 @section Options Controlling C Dialect
2202 @cindex dialect options
2203 @cindex language dialect options
2204 @cindex options, dialect
2205
2206 The following options control the dialect of C (or languages derived
2207 from C, such as C++, Objective-C and Objective-C++) that the compiler
2208 accepts:
2209
2210 @table @gcctabopt
2211 @cindex ANSI support
2212 @cindex ISO support
2213 @item -ansi
2214 @opindex ansi
2215 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2216 equivalent to @option{-std=c++98}.
2217
2218 This turns off certain features of GCC that are incompatible with ISO
2219 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2220 such as the @code{asm} and @code{typeof} keywords, and
2221 predefined macros such as @code{unix} and @code{vax} that identify the
2222 type of system you are using. It also enables the undesirable and
2223 rarely used ISO trigraph feature. For the C compiler,
2224 it disables recognition of C++ style @samp{//} comments as well as
2225 the @code{inline} keyword.
2226
2227 The alternate keywords @code{__asm__}, @code{__extension__},
2228 @code{__inline__} and @code{__typeof__} continue to work despite
2229 @option{-ansi}. You would not want to use them in an ISO C program, of
2230 course, but it is useful to put them in header files that might be included
2231 in compilations done with @option{-ansi}. Alternate predefined macros
2232 such as @code{__unix__} and @code{__vax__} are also available, with or
2233 without @option{-ansi}.
2234
2235 The @option{-ansi} option does not cause non-ISO programs to be
2236 rejected gratuitously. For that, @option{-Wpedantic} is required in
2237 addition to @option{-ansi}. @xref{Warning Options}.
2238
2239 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2240 option is used. Some header files may notice this macro and refrain
2241 from declaring certain functions or defining certain macros that the
2242 ISO standard doesn't call for; this is to avoid interfering with any
2243 programs that might use these names for other things.
2244
2245 Functions that are normally built in but do not have semantics
2246 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2247 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2248 built-in functions provided by GCC}, for details of the functions
2249 affected.
2250
2251 @item -std=
2252 @opindex std
2253 Determine the language standard. @xref{Standards,,Language Standards
2254 Supported by GCC}, for details of these standard versions. This option
2255 is currently only supported when compiling C or C++.
2256
2257 The compiler can accept several base standards, such as @samp{c90} or
2258 @samp{c++98}, and GNU dialects of those standards, such as
2259 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2260 compiler accepts all programs following that standard plus those
2261 using GNU extensions that do not contradict it. For example,
2262 @option{-std=c90} turns off certain features of GCC that are
2263 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2264 keywords, but not other GNU extensions that do not have a meaning in
2265 ISO C90, such as omitting the middle term of a @code{?:}
2266 expression. On the other hand, when a GNU dialect of a standard is
2267 specified, all features supported by the compiler are enabled, even when
2268 those features change the meaning of the base standard. As a result, some
2269 strict-conforming programs may be rejected. The particular standard
2270 is used by @option{-Wpedantic} to identify which features are GNU
2271 extensions given that version of the standard. For example
2272 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2273 comments, while @option{-std=gnu99 -Wpedantic} does not.
2274
2275 A value for this option must be provided; possible values are
2276
2277 @table @samp
2278 @item c90
2279 @itemx c89
2280 @itemx iso9899:1990
2281 Support all ISO C90 programs (certain GNU extensions that conflict
2282 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2283
2284 @item iso9899:199409
2285 ISO C90 as modified in amendment 1.
2286
2287 @item c99
2288 @itemx c9x
2289 @itemx iso9899:1999
2290 @itemx iso9899:199x
2291 ISO C99. This standard is substantially completely supported, modulo
2292 bugs and floating-point issues
2293 (mainly but not entirely relating to optional C99 features from
2294 Annexes F and G). See
2295 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
2296 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2297
2298 @item c11
2299 @itemx c1x
2300 @itemx iso9899:2011
2301 ISO C11, the 2011 revision of the ISO C standard. This standard is
2302 substantially completely supported, modulo bugs, floating-point issues
2303 (mainly but not entirely relating to optional C11 features from
2304 Annexes F and G) and the optional Annexes K (Bounds-checking
2305 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2306
2307 @item c17
2308 @itemx c18
2309 @itemx iso9899:2017
2310 @itemx iso9899:2018
2311 ISO C17, the 2017 revision of the ISO C standard
2312 (published in 2018). This standard is
2313 same as C11 except for corrections of defects (all of which are also
2314 applied with @option{-std=c11}) and a new value of
2315 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2316
2317 @item c2x
2318 The next version of the ISO C standard, still under development. The
2319 support for this version is experimental and incomplete.
2320
2321 @item gnu90
2322 @itemx gnu89
2323 GNU dialect of ISO C90 (including some C99 features).
2324
2325 @item gnu99
2326 @itemx gnu9x
2327 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2328
2329 @item gnu11
2330 @itemx gnu1x
2331 GNU dialect of ISO C11.
2332 The name @samp{gnu1x} is deprecated.
2333
2334 @item gnu17
2335 @itemx gnu18
2336 GNU dialect of ISO C17. This is the default for C code.
2337
2338 @item gnu2x
2339 The next version of the ISO C standard, still under development, plus
2340 GNU extensions. The support for this version is experimental and
2341 incomplete.
2342
2343 @item c++98
2344 @itemx c++03
2345 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2346 additional defect reports. Same as @option{-ansi} for C++ code.
2347
2348 @item gnu++98
2349 @itemx gnu++03
2350 GNU dialect of @option{-std=c++98}.
2351
2352 @item c++11
2353 @itemx c++0x
2354 The 2011 ISO C++ standard plus amendments.
2355 The name @samp{c++0x} is deprecated.
2356
2357 @item gnu++11
2358 @itemx gnu++0x
2359 GNU dialect of @option{-std=c++11}.
2360 The name @samp{gnu++0x} is deprecated.
2361
2362 @item c++14
2363 @itemx c++1y
2364 The 2014 ISO C++ standard plus amendments.
2365 The name @samp{c++1y} is deprecated.
2366
2367 @item gnu++14
2368 @itemx gnu++1y
2369 GNU dialect of @option{-std=c++14}.
2370 This is the default for C++ code.
2371 The name @samp{gnu++1y} is deprecated.
2372
2373 @item c++17
2374 @itemx c++1z
2375 The 2017 ISO C++ standard plus amendments.
2376 The name @samp{c++1z} is deprecated.
2377
2378 @item gnu++17
2379 @itemx gnu++1z
2380 GNU dialect of @option{-std=c++17}.
2381 The name @samp{gnu++1z} is deprecated.
2382
2383 @item c++20
2384 @itemx c++2a
2385 The next revision of the ISO C++ standard, planned for
2386 2020. Support is highly experimental, and will almost certainly
2387 change in incompatible ways in future releases.
2388
2389 @item gnu++20
2390 @itemx gnu++2a
2391 GNU dialect of @option{-std=c++20}. Support is highly experimental,
2392 and will almost certainly change in incompatible ways in future
2393 releases.
2394 @end table
2395
2396 @item -fgnu89-inline
2397 @opindex fgnu89-inline
2398 The option @option{-fgnu89-inline} tells GCC to use the traditional
2399 GNU semantics for @code{inline} functions when in C99 mode.
2400 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2401 Using this option is roughly equivalent to adding the
2402 @code{gnu_inline} function attribute to all inline functions
2403 (@pxref{Function Attributes}).
2404
2405 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2406 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2407 specifies the default behavior).
2408 This option is not supported in @option{-std=c90} or
2409 @option{-std=gnu90} mode.
2410
2411 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2412 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2413 in effect for @code{inline} functions. @xref{Common Predefined
2414 Macros,,,cpp,The C Preprocessor}.
2415
2416 @item -fpermitted-flt-eval-methods=@var{style}
2417 @opindex fpermitted-flt-eval-methods
2418 @opindex fpermitted-flt-eval-methods=c11
2419 @opindex fpermitted-flt-eval-methods=ts-18661-3
2420 ISO/IEC TS 18661-3 defines new permissible values for
2421 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2422 a semantic type that is an interchange or extended format should be
2423 evaluated to the precision and range of that type. These new values are
2424 a superset of those permitted under C99/C11, which does not specify the
2425 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2426 conforming to C11 may not have been written expecting the possibility of
2427 the new values.
2428
2429 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2430 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2431 or the extended set of values specified in ISO/IEC TS 18661-3.
2432
2433 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2434
2435 The default when in a standards compliant mode (@option{-std=c11} or similar)
2436 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2437 dialect (@option{-std=gnu11} or similar) is
2438 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2439
2440 @item -aux-info @var{filename}
2441 @opindex aux-info
2442 Output to the given filename prototyped declarations for all functions
2443 declared and/or defined in a translation unit, including those in header
2444 files. This option is silently ignored in any language other than C@.
2445
2446 Besides declarations, the file indicates, in comments, the origin of
2447 each declaration (source file and line), whether the declaration was
2448 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2449 @samp{O} for old, respectively, in the first character after the line
2450 number and the colon), and whether it came from a declaration or a
2451 definition (@samp{C} or @samp{F}, respectively, in the following
2452 character). In the case of function definitions, a K&R-style list of
2453 arguments followed by their declarations is also provided, inside
2454 comments, after the declaration.
2455
2456 @item -fallow-parameterless-variadic-functions
2457 @opindex fallow-parameterless-variadic-functions
2458 Accept variadic functions without named parameters.
2459
2460 Although it is possible to define such a function, this is not very
2461 useful as it is not possible to read the arguments. This is only
2462 supported for C as this construct is allowed by C++.
2463
2464 @item -fno-asm
2465 @opindex fno-asm
2466 @opindex fasm
2467 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2468 keyword, so that code can use these words as identifiers. You can use
2469 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2470 instead. @option{-ansi} implies @option{-fno-asm}.
2471
2472 In C++, this switch only affects the @code{typeof} keyword, since
2473 @code{asm} and @code{inline} are standard keywords. You may want to
2474 use the @option{-fno-gnu-keywords} flag instead, which has the same
2475 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2476 switch only affects the @code{asm} and @code{typeof} keywords, since
2477 @code{inline} is a standard keyword in ISO C99.
2478
2479 @item -fno-builtin
2480 @itemx -fno-builtin-@var{function}
2481 @opindex fno-builtin
2482 @opindex fbuiltin
2483 @cindex built-in functions
2484 Don't recognize built-in functions that do not begin with
2485 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2486 functions provided by GCC}, for details of the functions affected,
2487 including those which are not built-in functions when @option{-ansi} or
2488 @option{-std} options for strict ISO C conformance are used because they
2489 do not have an ISO standard meaning.
2490
2491 GCC normally generates special code to handle certain built-in functions
2492 more efficiently; for instance, calls to @code{alloca} may become single
2493 instructions which adjust the stack directly, and calls to @code{memcpy}
2494 may become inline copy loops. The resulting code is often both smaller
2495 and faster, but since the function calls no longer appear as such, you
2496 cannot set a breakpoint on those calls, nor can you change the behavior
2497 of the functions by linking with a different library. In addition,
2498 when a function is recognized as a built-in function, GCC may use
2499 information about that function to warn about problems with calls to
2500 that function, or to generate more efficient code, even if the
2501 resulting code still contains calls to that function. For example,
2502 warnings are given with @option{-Wformat} for bad calls to
2503 @code{printf} when @code{printf} is built in and @code{strlen} is
2504 known not to modify global memory.
2505
2506 With the @option{-fno-builtin-@var{function}} option
2507 only the built-in function @var{function} is
2508 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2509 function is named that is not built-in in this version of GCC, this
2510 option is ignored. There is no corresponding
2511 @option{-fbuiltin-@var{function}} option; if you wish to enable
2512 built-in functions selectively when using @option{-fno-builtin} or
2513 @option{-ffreestanding}, you may define macros such as:
2514
2515 @smallexample
2516 #define abs(n) __builtin_abs ((n))
2517 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2518 @end smallexample
2519
2520 @item -fgimple
2521 @opindex fgimple
2522
2523 Enable parsing of function definitions marked with @code{__GIMPLE}.
2524 This is an experimental feature that allows unit testing of GIMPLE
2525 passes.
2526
2527 @item -fhosted
2528 @opindex fhosted
2529 @cindex hosted environment
2530
2531 Assert that compilation targets a hosted environment. This implies
2532 @option{-fbuiltin}. A hosted environment is one in which the
2533 entire standard library is available, and in which @code{main} has a return
2534 type of @code{int}. Examples are nearly everything except a kernel.
2535 This is equivalent to @option{-fno-freestanding}.
2536
2537 @item -ffreestanding
2538 @opindex ffreestanding
2539 @cindex hosted environment
2540
2541 Assert that compilation targets a freestanding environment. This
2542 implies @option{-fno-builtin}. A freestanding environment
2543 is one in which the standard library may not exist, and program startup may
2544 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2545 This is equivalent to @option{-fno-hosted}.
2546
2547 @xref{Standards,,Language Standards Supported by GCC}, for details of
2548 freestanding and hosted environments.
2549
2550 @item -fopenacc
2551 @opindex fopenacc
2552 @cindex OpenACC accelerator programming
2553 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2554 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2555 compiler generates accelerated code according to the OpenACC Application
2556 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2557 implies @option{-pthread}, and thus is only supported on targets that
2558 have support for @option{-pthread}.
2559
2560 @item -fopenacc-dim=@var{geom}
2561 @opindex fopenacc-dim
2562 @cindex OpenACC accelerator programming
2563 Specify default compute dimensions for parallel offload regions that do
2564 not explicitly specify. The @var{geom} value is a triple of
2565 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2566 can be omitted, to use a target-specific default value.
2567
2568 @item -fopenmp
2569 @opindex fopenmp
2570 @cindex OpenMP parallel
2571 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2572 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2573 compiler generates parallel code according to the OpenMP Application
2574 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2575 implies @option{-pthread}, and thus is only supported on targets that
2576 have support for @option{-pthread}. @option{-fopenmp} implies
2577 @option{-fopenmp-simd}.
2578
2579 @item -fopenmp-simd
2580 @opindex fopenmp-simd
2581 @cindex OpenMP SIMD
2582 @cindex SIMD
2583 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2584 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2585 are ignored.
2586
2587 @item -fgnu-tm
2588 @opindex fgnu-tm
2589 When the option @option{-fgnu-tm} is specified, the compiler
2590 generates code for the Linux variant of Intel's current Transactional
2591 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2592 an experimental feature whose interface may change in future versions
2593 of GCC, as the official specification changes. Please note that not
2594 all architectures are supported for this feature.
2595
2596 For more information on GCC's support for transactional memory,
2597 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2598 Transactional Memory Library}.
2599
2600 Note that the transactional memory feature is not supported with
2601 non-call exceptions (@option{-fnon-call-exceptions}).
2602
2603 @item -fms-extensions
2604 @opindex fms-extensions
2605 Accept some non-standard constructs used in Microsoft header files.
2606
2607 In C++ code, this allows member names in structures to be similar
2608 to previous types declarations.
2609
2610 @smallexample
2611 typedef int UOW;
2612 struct ABC @{
2613 UOW UOW;
2614 @};
2615 @end smallexample
2616
2617 Some cases of unnamed fields in structures and unions are only
2618 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2619 fields within structs/unions}, for details.
2620
2621 Note that this option is off for all targets except for x86
2622 targets using ms-abi.
2623
2624 @item -fplan9-extensions
2625 @opindex fplan9-extensions
2626 Accept some non-standard constructs used in Plan 9 code.
2627
2628 This enables @option{-fms-extensions}, permits passing pointers to
2629 structures with anonymous fields to functions that expect pointers to
2630 elements of the type of the field, and permits referring to anonymous
2631 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2632 struct/union fields within structs/unions}, for details. This is only
2633 supported for C, not C++.
2634
2635 @item -fcond-mismatch
2636 @opindex fcond-mismatch
2637 Allow conditional expressions with mismatched types in the second and
2638 third arguments. The value of such an expression is void. This option
2639 is not supported for C++.
2640
2641 @item -flax-vector-conversions
2642 @opindex flax-vector-conversions
2643 Allow implicit conversions between vectors with differing numbers of
2644 elements and/or incompatible element types. This option should not be
2645 used for new code.
2646
2647 @item -funsigned-char
2648 @opindex funsigned-char
2649 Let the type @code{char} be unsigned, like @code{unsigned char}.
2650
2651 Each kind of machine has a default for what @code{char} should
2652 be. It is either like @code{unsigned char} by default or like
2653 @code{signed char} by default.
2654
2655 Ideally, a portable program should always use @code{signed char} or
2656 @code{unsigned char} when it depends on the signedness of an object.
2657 But many programs have been written to use plain @code{char} and
2658 expect it to be signed, or expect it to be unsigned, depending on the
2659 machines they were written for. This option, and its inverse, let you
2660 make such a program work with the opposite default.
2661
2662 The type @code{char} is always a distinct type from each of
2663 @code{signed char} or @code{unsigned char}, even though its behavior
2664 is always just like one of those two.
2665
2666 @item -fsigned-char
2667 @opindex fsigned-char
2668 Let the type @code{char} be signed, like @code{signed char}.
2669
2670 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2671 the negative form of @option{-funsigned-char}. Likewise, the option
2672 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2673
2674 @item -fsigned-bitfields
2675 @itemx -funsigned-bitfields
2676 @itemx -fno-signed-bitfields
2677 @itemx -fno-unsigned-bitfields
2678 @opindex fsigned-bitfields
2679 @opindex funsigned-bitfields
2680 @opindex fno-signed-bitfields
2681 @opindex fno-unsigned-bitfields
2682 These options control whether a bit-field is signed or unsigned, when the
2683 declaration does not use either @code{signed} or @code{unsigned}. By
2684 default, such a bit-field is signed, because this is consistent: the
2685 basic integer types such as @code{int} are signed types.
2686
2687 @item -fsso-struct=@var{endianness}
2688 @opindex fsso-struct
2689 Set the default scalar storage order of structures and unions to the
2690 specified endianness. The accepted values are @samp{big-endian},
2691 @samp{little-endian} and @samp{native} for the native endianness of
2692 the target (the default). This option is not supported for C++.
2693
2694 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2695 code that is not binary compatible with code generated without it if the
2696 specified endianness is not the native endianness of the target.
2697 @end table
2698
2699 @node C++ Dialect Options
2700 @section Options Controlling C++ Dialect
2701
2702 @cindex compiler options, C++
2703 @cindex C++ options, command-line
2704 @cindex options, C++
2705 This section describes the command-line options that are only meaningful
2706 for C++ programs. You can also use most of the GNU compiler options
2707 regardless of what language your program is in. For example, you
2708 might compile a file @file{firstClass.C} like this:
2709
2710 @smallexample
2711 g++ -g -fstrict-enums -O -c firstClass.C
2712 @end smallexample
2713
2714 @noindent
2715 In this example, only @option{-fstrict-enums} is an option meant
2716 only for C++ programs; you can use the other options with any
2717 language supported by GCC@.
2718
2719 Some options for compiling C programs, such as @option{-std}, are also
2720 relevant for C++ programs.
2721 @xref{C Dialect Options,,Options Controlling C Dialect}.
2722
2723 Here is a list of options that are @emph{only} for compiling C++ programs:
2724
2725 @table @gcctabopt
2726
2727 @item -fabi-version=@var{n}
2728 @opindex fabi-version
2729 Use version @var{n} of the C++ ABI@. The default is version 0.
2730
2731 Version 0 refers to the version conforming most closely to
2732 the C++ ABI specification. Therefore, the ABI obtained using version 0
2733 will change in different versions of G++ as ABI bugs are fixed.
2734
2735 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2736
2737 Version 2 is the version of the C++ ABI that first appeared in G++
2738 3.4, and was the default through G++ 4.9.
2739
2740 Version 3 corrects an error in mangling a constant address as a
2741 template argument.
2742
2743 Version 4, which first appeared in G++ 4.5, implements a standard
2744 mangling for vector types.
2745
2746 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2747 attribute const/volatile on function pointer types, decltype of a
2748 plain decl, and use of a function parameter in the declaration of
2749 another parameter.
2750
2751 Version 6, which first appeared in G++ 4.7, corrects the promotion
2752 behavior of C++11 scoped enums and the mangling of template argument
2753 packs, const/static_cast, prefix ++ and --, and a class scope function
2754 used as a template argument.
2755
2756 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2757 builtin type and corrects the mangling of lambdas in default argument
2758 scope.
2759
2760 Version 8, which first appeared in G++ 4.9, corrects the substitution
2761 behavior of function types with function-cv-qualifiers.
2762
2763 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2764 @code{nullptr_t}.
2765
2766 Version 10, which first appeared in G++ 6.1, adds mangling of
2767 attributes that affect type identity, such as ia32 calling convention
2768 attributes (e.g.@: @samp{stdcall}).
2769
2770 Version 11, which first appeared in G++ 7, corrects the mangling of
2771 sizeof... expressions and operator names. For multiple entities with
2772 the same name within a function, that are declared in different scopes,
2773 the mangling now changes starting with the twelfth occurrence. It also
2774 implies @option{-fnew-inheriting-ctors}.
2775
2776 Version 12, which first appeared in G++ 8, corrects the calling
2777 conventions for empty classes on the x86_64 target and for classes
2778 with only deleted copy/move constructors. It accidentally changes the
2779 calling convention for classes with a deleted copy constructor and a
2780 trivial move constructor.
2781
2782 Version 13, which first appeared in G++ 8.2, fixes the accidental
2783 change in version 12.
2784
2785 Version 14, which first appeared in G++ 10, corrects the mangling of
2786 the nullptr expression.
2787
2788 See also @option{-Wabi}.
2789
2790 @item -fabi-compat-version=@var{n}
2791 @opindex fabi-compat-version
2792 On targets that support strong aliases, G++
2793 works around mangling changes by creating an alias with the correct
2794 mangled name when defining a symbol with an incorrect mangled name.
2795 This switch specifies which ABI version to use for the alias.
2796
2797 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2798 compatibility). If another ABI version is explicitly selected, this
2799 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2800 use @option{-fabi-compat-version=2}.
2801
2802 If this option is not provided but @option{-Wabi=@var{n}} is, that
2803 version is used for compatibility aliases. If this option is provided
2804 along with @option{-Wabi} (without the version), the version from this
2805 option is used for the warning.
2806
2807 @item -fno-access-control
2808 @opindex fno-access-control
2809 @opindex faccess-control
2810 Turn off all access checking. This switch is mainly useful for working
2811 around bugs in the access control code.
2812
2813 @item -faligned-new
2814 @opindex faligned-new
2815 Enable support for C++17 @code{new} of types that require more
2816 alignment than @code{void* ::operator new(std::size_t)} provides. A
2817 numeric argument such as @code{-faligned-new=32} can be used to
2818 specify how much alignment (in bytes) is provided by that function,
2819 but few users will need to override the default of
2820 @code{alignof(std::max_align_t)}.
2821
2822 This flag is enabled by default for @option{-std=c++17}.
2823
2824 @item -fchar8_t
2825 @itemx -fno-char8_t
2826 @opindex fchar8_t
2827 @opindex fno-char8_t
2828 Enable support for @code{char8_t} as adopted for C++2a. This includes
2829 the addition of a new @code{char8_t} fundamental type, changes to the
2830 types of UTF-8 string and character literals, new signatures for
2831 user-defined literals, associated standard library updates, and new
2832 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2833
2834 This option enables functions to be overloaded for ordinary and UTF-8
2835 strings:
2836
2837 @smallexample
2838 int f(const char *); // #1
2839 int f(const char8_t *); // #2
2840 int v1 = f("text"); // Calls #1
2841 int v2 = f(u8"text"); // Calls #2
2842 @end smallexample
2843
2844 @noindent
2845 and introduces new signatures for user-defined literals:
2846
2847 @smallexample
2848 int operator""_udl1(char8_t);
2849 int v3 = u8'x'_udl1;
2850 int operator""_udl2(const char8_t*, std::size_t);
2851 int v4 = u8"text"_udl2;
2852 template<typename T, T...> int operator""_udl3();
2853 int v5 = u8"text"_udl3;
2854 @end smallexample
2855
2856 @noindent
2857 The change to the types of UTF-8 string and character literals introduces
2858 incompatibilities with ISO C++11 and later standards. For example, the
2859 following code is well-formed under ISO C++11, but is ill-formed when
2860 @option{-fchar8_t} is specified.
2861
2862 @smallexample
2863 char ca[] = u8"xx"; // error: char-array initialized from wide
2864 // string
2865 const char *cp = u8"xx";// error: invalid conversion from
2866 // `const char8_t*' to `const char*'
2867 int f(const char*);
2868 auto v = f(u8"xx"); // error: invalid conversion from
2869 // `const char8_t*' to `const char*'
2870 std::string s@{u8"xx"@}; // error: no matching function for call to
2871 // `std::basic_string<char>::basic_string()'
2872 using namespace std::literals;
2873 s = u8"xx"s; // error: conversion from
2874 // `basic_string<char8_t>' to non-scalar
2875 // type `basic_string<char>' requested
2876 @end smallexample
2877
2878 @item -fcheck-new
2879 @opindex fcheck-new
2880 Check that the pointer returned by @code{operator new} is non-null
2881 before attempting to modify the storage allocated. This check is
2882 normally unnecessary because the C++ standard specifies that
2883 @code{operator new} only returns @code{0} if it is declared
2884 @code{throw()}, in which case the compiler always checks the
2885 return value even without this option. In all other cases, when
2886 @code{operator new} has a non-empty exception specification, memory
2887 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2888 @samp{new (nothrow)}.
2889
2890 @item -fconcepts
2891 @itemx -fconcepts-ts
2892 @opindex fconcepts
2893 @opindex fconcepts-ts
2894 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2895 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2896
2897 With @option{-std=c++2a} and above, Concepts are part of the language
2898 standard, so @option{-fconcepts} defaults to on. But the standard
2899 specification of Concepts differs significantly from the TS, so some
2900 constructs that were allowed in the TS but didn't make it into the
2901 standard can still be enabled by @option{-fconcepts-ts}.
2902
2903 @item -fconstexpr-depth=@var{n}
2904 @opindex fconstexpr-depth
2905 Set the maximum nested evaluation depth for C++11 constexpr functions
2906 to @var{n}. A limit is needed to detect endless recursion during
2907 constant expression evaluation. The minimum specified by the standard
2908 is 512.
2909
2910 @item -fconstexpr-cache-depth=@var{n}
2911 @opindex fconstexpr-cache-depth
2912 Set the maximum level of nested evaluation depth for C++11 constexpr
2913 functions that will be cached to @var{n}. This is a heuristic that
2914 trades off compilation speed (when the cache avoids repeated
2915 calculations) against memory consumption (when the cache grows very
2916 large from highly recursive evaluations). The default is 8. Very few
2917 users are likely to want to adjust it, but if your code does heavy
2918 constexpr calculations you might want to experiment to find which
2919 value works best for you.
2920
2921 @item -fconstexpr-loop-limit=@var{n}
2922 @opindex fconstexpr-loop-limit
2923 Set the maximum number of iterations for a loop in C++14 constexpr functions
2924 to @var{n}. A limit is needed to detect infinite loops during
2925 constant expression evaluation. The default is 262144 (1<<18).
2926
2927 @item -fconstexpr-ops-limit=@var{n}
2928 @opindex fconstexpr-ops-limit
2929 Set the maximum number of operations during a single constexpr evaluation.
2930 Even when number of iterations of a single loop is limited with the above limit,
2931 if there are several nested loops and each of them has many iterations but still
2932 smaller than the above limit, or if in a body of some loop or even outside
2933 of a loop too many expressions need to be evaluated, the resulting constexpr
2934 evaluation might take too long.
2935 The default is 33554432 (1<<25).
2936
2937 @item -fcoroutines
2938 @opindex fcoroutines
2939 Enable support for the C++ coroutines extension (experimental).
2940
2941 @item -fno-elide-constructors
2942 @opindex fno-elide-constructors
2943 @opindex felide-constructors
2944 The C++ standard allows an implementation to omit creating a temporary
2945 that is only used to initialize another object of the same type.
2946 Specifying this option disables that optimization, and forces G++ to
2947 call the copy constructor in all cases. This option also causes G++
2948 to call trivial member functions which otherwise would be expanded inline.
2949
2950 In C++17, the compiler is required to omit these temporaries, but this
2951 option still affects trivial member functions.
2952
2953 @item -fno-enforce-eh-specs
2954 @opindex fno-enforce-eh-specs
2955 @opindex fenforce-eh-specs
2956 Don't generate code to check for violation of exception specifications
2957 at run time. This option violates the C++ standard, but may be useful
2958 for reducing code size in production builds, much like defining
2959 @code{NDEBUG}. This does not give user code permission to throw
2960 exceptions in violation of the exception specifications; the compiler
2961 still optimizes based on the specifications, so throwing an
2962 unexpected exception results in undefined behavior at run time.
2963
2964 @item -fextern-tls-init
2965 @itemx -fno-extern-tls-init
2966 @opindex fextern-tls-init
2967 @opindex fno-extern-tls-init
2968 The C++11 and OpenMP standards allow @code{thread_local} and
2969 @code{threadprivate} variables to have dynamic (runtime)
2970 initialization. To support this, any use of such a variable goes
2971 through a wrapper function that performs any necessary initialization.
2972 When the use and definition of the variable are in the same
2973 translation unit, this overhead can be optimized away, but when the
2974 use is in a different translation unit there is significant overhead
2975 even if the variable doesn't actually need dynamic initialization. If
2976 the programmer can be sure that no use of the variable in a
2977 non-defining TU needs to trigger dynamic initialization (either
2978 because the variable is statically initialized, or a use of the
2979 variable in the defining TU will be executed before any uses in
2980 another TU), they can avoid this overhead with the
2981 @option{-fno-extern-tls-init} option.
2982
2983 On targets that support symbol aliases, the default is
2984 @option{-fextern-tls-init}. On targets that do not support symbol
2985 aliases, the default is @option{-fno-extern-tls-init}.
2986
2987 @item -fno-gnu-keywords
2988 @opindex fno-gnu-keywords
2989 @opindex fgnu-keywords
2990 Do not recognize @code{typeof} as a keyword, so that code can use this
2991 word as an identifier. You can use the keyword @code{__typeof__} instead.
2992 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2993 @option{-std=c++98}, @option{-std=c++11}, etc.
2994
2995 @item -fno-implicit-templates
2996 @opindex fno-implicit-templates
2997 @opindex fimplicit-templates
2998 Never emit code for non-inline templates that are instantiated
2999 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3000 If you use this option, you must take care to structure your code to
3001 include all the necessary explicit instantiations to avoid getting
3002 undefined symbols at link time.
3003 @xref{Template Instantiation}, for more information.
3004
3005 @item -fno-implicit-inline-templates
3006 @opindex fno-implicit-inline-templates
3007 @opindex fimplicit-inline-templates
3008 Don't emit code for implicit instantiations of inline templates, either.
3009 The default is to handle inlines differently so that compiles with and
3010 without optimization need the same set of explicit instantiations.
3011
3012 @item -fno-implement-inlines
3013 @opindex fno-implement-inlines
3014 @opindex fimplement-inlines
3015 To save space, do not emit out-of-line copies of inline functions
3016 controlled by @code{#pragma implementation}. This causes linker
3017 errors if these functions are not inlined everywhere they are called.
3018
3019 @item -fms-extensions
3020 @opindex fms-extensions
3021 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3022 int and getting a pointer to member function via non-standard syntax.
3023
3024 @item -fnew-inheriting-ctors
3025 @opindex fnew-inheriting-ctors
3026 Enable the P0136 adjustment to the semantics of C++11 constructor
3027 inheritance. This is part of C++17 but also considered to be a Defect
3028 Report against C++11 and C++14. This flag is enabled by default
3029 unless @option{-fabi-version=10} or lower is specified.
3030
3031 @item -fnew-ttp-matching
3032 @opindex fnew-ttp-matching
3033 Enable the P0522 resolution to Core issue 150, template template
3034 parameters and default arguments: this allows a template with default
3035 template arguments as an argument for a template template parameter
3036 with fewer template parameters. This flag is enabled by default for
3037 @option{-std=c++17}.
3038
3039 @item -fno-nonansi-builtins
3040 @opindex fno-nonansi-builtins
3041 @opindex fnonansi-builtins
3042 Disable built-in declarations of functions that are not mandated by
3043 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3044 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3045
3046 @item -fnothrow-opt
3047 @opindex fnothrow-opt
3048 Treat a @code{throw()} exception specification as if it were a
3049 @code{noexcept} specification to reduce or eliminate the text size
3050 overhead relative to a function with no exception specification. If
3051 the function has local variables of types with non-trivial
3052 destructors, the exception specification actually makes the
3053 function smaller because the EH cleanups for those variables can be
3054 optimized away. The semantic effect is that an exception thrown out of
3055 a function with such an exception specification results in a call
3056 to @code{terminate} rather than @code{unexpected}.
3057
3058 @item -fno-operator-names
3059 @opindex fno-operator-names
3060 @opindex foperator-names
3061 Do not treat the operator name keywords @code{and}, @code{bitand},
3062 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3063 synonyms as keywords.
3064
3065 @item -fno-optional-diags
3066 @opindex fno-optional-diags
3067 @opindex foptional-diags
3068 Disable diagnostics that the standard says a compiler does not need to
3069 issue. Currently, the only such diagnostic issued by G++ is the one for
3070 a name having multiple meanings within a class.
3071
3072 @item -fpermissive
3073 @opindex fpermissive
3074 Downgrade some diagnostics about nonconformant code from errors to
3075 warnings. Thus, using @option{-fpermissive} allows some
3076 nonconforming code to compile.
3077
3078 @item -fno-pretty-templates
3079 @opindex fno-pretty-templates
3080 @opindex fpretty-templates
3081 When an error message refers to a specialization of a function
3082 template, the compiler normally prints the signature of the
3083 template followed by the template arguments and any typedefs or
3084 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3085 rather than @code{void f(int)}) so that it's clear which template is
3086 involved. When an error message refers to a specialization of a class
3087 template, the compiler omits any template arguments that match
3088 the default template arguments for that template. If either of these
3089 behaviors make it harder to understand the error message rather than
3090 easier, you can use @option{-fno-pretty-templates} to disable them.
3091
3092 @item -fno-rtti
3093 @opindex fno-rtti
3094 @opindex frtti
3095 Disable generation of information about every class with virtual
3096 functions for use by the C++ run-time type identification features
3097 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3098 of the language, you can save some space by using this flag. Note that
3099 exception handling uses the same information, but G++ generates it as
3100 needed. The @code{dynamic_cast} operator can still be used for casts that
3101 do not require run-time type information, i.e.@: casts to @code{void *} or to
3102 unambiguous base classes.
3103
3104 Mixing code compiled with @option{-frtti} with that compiled with
3105 @option{-fno-rtti} may not work. For example, programs may
3106 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3107 for a class compiled with @option{-frtti}.
3108
3109 @item -fsized-deallocation
3110 @opindex fsized-deallocation
3111 Enable the built-in global declarations
3112 @smallexample
3113 void operator delete (void *, std::size_t) noexcept;
3114 void operator delete[] (void *, std::size_t) noexcept;
3115 @end smallexample
3116 as introduced in C++14. This is useful for user-defined replacement
3117 deallocation functions that, for example, use the size of the object
3118 to make deallocation faster. Enabled by default under
3119 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3120 warns about places that might want to add a definition.
3121
3122 @item -fstrict-enums
3123 @opindex fstrict-enums
3124 Allow the compiler to optimize using the assumption that a value of
3125 enumerated type can only be one of the values of the enumeration (as
3126 defined in the C++ standard; basically, a value that can be
3127 represented in the minimum number of bits needed to represent all the
3128 enumerators). This assumption may not be valid if the program uses a
3129 cast to convert an arbitrary integer value to the enumerated type.
3130
3131 @item -fstrong-eval-order
3132 @opindex fstrong-eval-order
3133 Evaluate member access, array subscripting, and shift expressions in
3134 left-to-right order, and evaluate assignment in right-to-left order,
3135 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3136 @option{-fstrong-eval-order=some} enables just the ordering of member
3137 access and shift expressions, and is the default without
3138 @option{-std=c++17}.
3139
3140 @item -ftemplate-backtrace-limit=@var{n}
3141 @opindex ftemplate-backtrace-limit
3142 Set the maximum number of template instantiation notes for a single
3143 warning or error to @var{n}. The default value is 10.
3144
3145 @item -ftemplate-depth=@var{n}
3146 @opindex ftemplate-depth
3147 Set the maximum instantiation depth for template classes to @var{n}.
3148 A limit on the template instantiation depth is needed to detect
3149 endless recursions during template class instantiation. ANSI/ISO C++
3150 conforming programs must not rely on a maximum depth greater than 17
3151 (changed to 1024 in C++11). The default value is 900, as the compiler
3152 can run out of stack space before hitting 1024 in some situations.
3153
3154 @item -fno-threadsafe-statics
3155 @opindex fno-threadsafe-statics
3156 @opindex fthreadsafe-statics
3157 Do not emit the extra code to use the routines specified in the C++
3158 ABI for thread-safe initialization of local statics. You can use this
3159 option to reduce code size slightly in code that doesn't need to be
3160 thread-safe.
3161
3162 @item -fuse-cxa-atexit
3163 @opindex fuse-cxa-atexit
3164 Register destructors for objects with static storage duration with the
3165 @code{__cxa_atexit} function rather than the @code{atexit} function.
3166 This option is required for fully standards-compliant handling of static
3167 destructors, but only works if your C library supports
3168 @code{__cxa_atexit}.
3169
3170 @item -fno-use-cxa-get-exception-ptr
3171 @opindex fno-use-cxa-get-exception-ptr
3172 @opindex fuse-cxa-get-exception-ptr
3173 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3174 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3175 if the runtime routine is not available.
3176
3177 @item -fvisibility-inlines-hidden
3178 @opindex fvisibility-inlines-hidden
3179 This switch declares that the user does not attempt to compare
3180 pointers to inline functions or methods where the addresses of the two functions
3181 are taken in different shared objects.
3182
3183 The effect of this is that GCC may, effectively, mark inline methods with
3184 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3185 appear in the export table of a DSO and do not require a PLT indirection
3186 when used within the DSO@. Enabling this option can have a dramatic effect
3187 on load and link times of a DSO as it massively reduces the size of the
3188 dynamic export table when the library makes heavy use of templates.
3189
3190 The behavior of this switch is not quite the same as marking the
3191 methods as hidden directly, because it does not affect static variables
3192 local to the function or cause the compiler to deduce that
3193 the function is defined in only one shared object.
3194
3195 You may mark a method as having a visibility explicitly to negate the
3196 effect of the switch for that method. For example, if you do want to
3197 compare pointers to a particular inline method, you might mark it as
3198 having default visibility. Marking the enclosing class with explicit
3199 visibility has no effect.
3200
3201 Explicitly instantiated inline methods are unaffected by this option
3202 as their linkage might otherwise cross a shared library boundary.
3203 @xref{Template Instantiation}.
3204
3205 @item -fvisibility-ms-compat
3206 @opindex fvisibility-ms-compat
3207 This flag attempts to use visibility settings to make GCC's C++
3208 linkage model compatible with that of Microsoft Visual Studio.
3209
3210 The flag makes these changes to GCC's linkage model:
3211
3212 @enumerate
3213 @item
3214 It sets the default visibility to @code{hidden}, like
3215 @option{-fvisibility=hidden}.
3216
3217 @item
3218 Types, but not their members, are not hidden by default.
3219
3220 @item
3221 The One Definition Rule is relaxed for types without explicit
3222 visibility specifications that are defined in more than one
3223 shared object: those declarations are permitted if they are
3224 permitted when this option is not used.
3225 @end enumerate
3226
3227 In new code it is better to use @option{-fvisibility=hidden} and
3228 export those classes that are intended to be externally visible.
3229 Unfortunately it is possible for code to rely, perhaps accidentally,
3230 on the Visual Studio behavior.
3231
3232 Among the consequences of these changes are that static data members
3233 of the same type with the same name but defined in different shared
3234 objects are different, so changing one does not change the other;
3235 and that pointers to function members defined in different shared
3236 objects may not compare equal. When this flag is given, it is a
3237 violation of the ODR to define types with the same name differently.
3238
3239 @item -fno-weak
3240 @opindex fno-weak
3241 @opindex fweak
3242 Do not use weak symbol support, even if it is provided by the linker.
3243 By default, G++ uses weak symbols if they are available. This
3244 option exists only for testing, and should not be used by end-users;
3245 it results in inferior code and has no benefits. This option may
3246 be removed in a future release of G++.
3247
3248 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3249 @opindex fext-numeric-literals
3250 @opindex fno-ext-numeric-literals
3251 Accept imaginary, fixed-point, or machine-defined
3252 literal number suffixes as GNU extensions.
3253 When this option is turned off these suffixes are treated
3254 as C++11 user-defined literal numeric suffixes.
3255 This is on by default for all pre-C++11 dialects and all GNU dialects:
3256 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3257 @option{-std=gnu++14}.
3258 This option is off by default
3259 for ISO C++11 onwards (@option{-std=c++11}, ...).
3260
3261 @item -nostdinc++
3262 @opindex nostdinc++
3263 Do not search for header files in the standard directories specific to
3264 C++, but do still search the other standard directories. (This option
3265 is used when building the C++ library.)
3266 @end table
3267
3268 In addition, these warning options have meanings only for C++ programs:
3269
3270 @table @gcctabopt
3271 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3272 @opindex Wabi-tag
3273 @opindex Wabi-tag
3274 Warn when a type with an ABI tag is used in a context that does not
3275 have that ABI tag. See @ref{C++ Attributes} for more information
3276 about ABI tags.
3277
3278 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3279 @opindex Wcomma-subscript
3280 @opindex Wno-comma-subscript
3281 Warn about uses of a comma expression within a subscripting expression.
3282 This usage was deprecated in C++2a. However, a comma expression wrapped
3283 in @code{( )} is not deprecated. Example:
3284
3285 @smallexample
3286 @group
3287 void f(int *a, int b, int c) @{
3288 a[b,c]; // deprecated
3289 a[(b,c)]; // OK
3290 @}
3291 @end group
3292 @end smallexample
3293
3294 Enabled by default with @option{-std=c++2a}.
3295
3296 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3297 @opindex Wctor-dtor-privacy
3298 @opindex Wno-ctor-dtor-privacy
3299 Warn when a class seems unusable because all the constructors or
3300 destructors in that class are private, and it has neither friends nor
3301 public static member functions. Also warn if there are no non-private
3302 methods, and there's at least one private member function that isn't
3303 a constructor or destructor.
3304
3305 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3306 @opindex Wdelete-non-virtual-dtor
3307 @opindex Wno-delete-non-virtual-dtor
3308 Warn when @code{delete} is used to destroy an instance of a class that
3309 has virtual functions and non-virtual destructor. It is unsafe to delete
3310 an instance of a derived class through a pointer to a base class if the
3311 base class does not have a virtual destructor. This warning is enabled
3312 by @option{-Wall}.
3313
3314 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3315 @opindex Wdeprecated-copy
3316 @opindex Wno-deprecated-copy
3317 Warn that the implicit declaration of a copy constructor or copy
3318 assignment operator is deprecated if the class has a user-provided
3319 copy constructor or copy assignment operator, in C++11 and up. This
3320 warning is enabled by @option{-Wextra}. With
3321 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3322 user-provided destructor.
3323
3324 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3325 @opindex Winit-list-lifetime
3326 @opindex Wno-init-list-lifetime
3327 Do not warn about uses of @code{std::initializer_list} that are likely
3328 to result in dangling pointers. Since the underlying array for an
3329 @code{initializer_list} is handled like a normal C++ temporary object,
3330 it is easy to inadvertently keep a pointer to the array past the end
3331 of the array's lifetime. For example:
3332
3333 @itemize @bullet
3334 @item
3335 If a function returns a temporary @code{initializer_list}, or a local
3336 @code{initializer_list} variable, the array's lifetime ends at the end
3337 of the return statement, so the value returned has a dangling pointer.
3338
3339 @item
3340 If a new-expression creates an @code{initializer_list}, the array only
3341 lives until the end of the enclosing full-expression, so the
3342 @code{initializer_list} in the heap has a dangling pointer.
3343
3344 @item
3345 When an @code{initializer_list} variable is assigned from a
3346 brace-enclosed initializer list, the temporary array created for the
3347 right side of the assignment only lives until the end of the
3348 full-expression, so at the next statement the @code{initializer_list}
3349 variable has a dangling pointer.
3350
3351 @smallexample
3352 // li's initial underlying array lives as long as li
3353 std::initializer_list<int> li = @{ 1,2,3 @};
3354 // assignment changes li to point to a temporary array
3355 li = @{ 4, 5 @};
3356 // now the temporary is gone and li has a dangling pointer
3357 int i = li.begin()[0] // undefined behavior
3358 @end smallexample
3359
3360 @item
3361 When a list constructor stores the @code{begin} pointer from the
3362 @code{initializer_list} argument, this doesn't extend the lifetime of
3363 the array, so if a class variable is constructed from a temporary
3364 @code{initializer_list}, the pointer is left dangling by the end of
3365 the variable declaration statement.
3366
3367 @end itemize
3368
3369 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3370 @opindex Wliteral-suffix
3371 @opindex Wno-literal-suffix
3372 Do not warn when a string or character literal is followed by a
3373 ud-suffix which does not begin with an underscore. As a conforming
3374 extension, GCC treats such suffixes as separate preprocessing tokens
3375 in order to maintain backwards compatibility with code that uses
3376 formatting macros from @code{<inttypes.h>}. For example:
3377
3378 @smallexample
3379 #define __STDC_FORMAT_MACROS
3380 #include <inttypes.h>
3381 #include <stdio.h>
3382
3383 int main() @{
3384 int64_t i64 = 123;
3385 printf("My int64: %" PRId64"\n", i64);
3386 @}
3387 @end smallexample
3388
3389 In this case, @code{PRId64} is treated as a separate preprocessing token.
3390
3391 This option also controls warnings when a user-defined literal
3392 operator is declared with a literal suffix identifier that doesn't
3393 begin with an underscore. Literal suffix identifiers that don't begin
3394 with an underscore are reserved for future standardization.
3395
3396 These warnings are enabled by default.
3397
3398 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3399 @opindex Wnarrowing
3400 @opindex Wno-narrowing
3401 For C++11 and later standards, narrowing conversions are diagnosed by default,
3402 as required by the standard. A narrowing conversion from a constant produces
3403 an error, and a narrowing conversion from a non-constant produces a warning,
3404 but @option{-Wno-narrowing} suppresses the diagnostic.
3405 Note that this does not affect the meaning of well-formed code;
3406 narrowing conversions are still considered ill-formed in SFINAE contexts.
3407
3408 With @option{-Wnarrowing} in C++98, warn when a narrowing
3409 conversion prohibited by C++11 occurs within
3410 @samp{@{ @}}, e.g.
3411
3412 @smallexample
3413 int i = @{ 2.2 @}; // error: narrowing from double to int
3414 @end smallexample
3415
3416 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3417
3418 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3419 @opindex Wnoexcept
3420 @opindex Wno-noexcept
3421 Warn when a noexcept-expression evaluates to false because of a call
3422 to a function that does not have a non-throwing exception
3423 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3424 the compiler to never throw an exception.
3425
3426 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3427 @opindex Wnoexcept-type
3428 @opindex Wno-noexcept-type
3429 Warn if the C++17 feature making @code{noexcept} part of a function
3430 type changes the mangled name of a symbol relative to C++14. Enabled
3431 by @option{-Wabi} and @option{-Wc++17-compat}.
3432
3433 As an example:
3434
3435 @smallexample
3436 template <class T> void f(T t) @{ t(); @};
3437 void g() noexcept;
3438 void h() @{ f(g); @}
3439 @end smallexample
3440
3441 @noindent
3442 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3443 C++17 it calls @code{f<void(*)()noexcept>}.
3444
3445 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3446 @opindex Wclass-memaccess
3447 @opindex Wno-class-memaccess
3448 Warn when the destination of a call to a raw memory function such as
3449 @code{memset} or @code{memcpy} is an object of class type, and when writing
3450 into such an object might bypass the class non-trivial or deleted constructor
3451 or copy assignment, violate const-correctness or encapsulation, or corrupt
3452 virtual table pointers. Modifying the representation of such objects may
3453 violate invariants maintained by member functions of the class. For example,
3454 the call to @code{memset} below is undefined because it modifies a non-trivial
3455 class object and is, therefore, diagnosed. The safe way to either initialize
3456 or clear the storage of objects of such types is by using the appropriate
3457 constructor or assignment operator, if one is available.
3458 @smallexample
3459 std::string str = "abc";
3460 memset (&str, 0, sizeof str);
3461 @end smallexample
3462 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3463 Explicitly casting the pointer to the class object to @code{void *} or
3464 to a type that can be safely accessed by the raw memory function suppresses
3465 the warning.
3466
3467 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3468 @opindex Wnon-virtual-dtor
3469 @opindex Wno-non-virtual-dtor
3470 Warn when a class has virtual functions and an accessible non-virtual
3471 destructor itself or in an accessible polymorphic base class, in which
3472 case it is possible but unsafe to delete an instance of a derived
3473 class through a pointer to the class itself or base class. This
3474 warning is automatically enabled if @option{-Weffc++} is specified.
3475
3476 @item -Wregister @r{(C++ and Objective-C++ only)}
3477 @opindex Wregister
3478 @opindex Wno-register
3479 Warn on uses of the @code{register} storage class specifier, except
3480 when it is part of the GNU @ref{Explicit Register Variables} extension.
3481 The use of the @code{register} keyword as storage class specifier has
3482 been deprecated in C++11 and removed in C++17.
3483 Enabled by default with @option{-std=c++17}.
3484
3485 @item -Wreorder @r{(C++ and Objective-C++ only)}
3486 @opindex Wreorder
3487 @opindex Wno-reorder
3488 @cindex reordering, warning
3489 @cindex warning for reordering of member initializers
3490 Warn when the order of member initializers given in the code does not
3491 match the order in which they must be executed. For instance:
3492
3493 @smallexample
3494 struct A @{
3495 int i;
3496 int j;
3497 A(): j (0), i (1) @{ @}
3498 @};
3499 @end smallexample
3500
3501 @noindent
3502 The compiler rearranges the member initializers for @code{i}
3503 and @code{j} to match the declaration order of the members, emitting
3504 a warning to that effect. This warning is enabled by @option{-Wall}.
3505
3506 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3507 @opindex Wpessimizing-move
3508 @opindex Wno-pessimizing-move
3509 This warning warns when a call to @code{std::move} prevents copy
3510 elision. A typical scenario when copy elision can occur is when returning in
3511 a function with a class return type, when the expression being returned is the
3512 name of a non-volatile automatic object, and is not a function parameter, and
3513 has the same type as the function return type.
3514
3515 @smallexample
3516 struct T @{
3517 @dots{}
3518 @};
3519 T fn()
3520 @{
3521 T t;
3522 @dots{}
3523 return std::move (t);
3524 @}
3525 @end smallexample
3526
3527 But in this example, the @code{std::move} call prevents copy elision.
3528
3529 This warning is enabled by @option{-Wall}.
3530
3531 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3532 @opindex Wredundant-move
3533 @opindex Wno-redundant-move
3534 This warning warns about redundant calls to @code{std::move}; that is, when
3535 a move operation would have been performed even without the @code{std::move}
3536 call. This happens because the compiler is forced to treat the object as if
3537 it were an rvalue in certain situations such as returning a local variable,
3538 where copy elision isn't applicable. Consider:
3539
3540 @smallexample
3541 struct T @{
3542 @dots{}
3543 @};
3544 T fn(T t)
3545 @{
3546 @dots{}
3547 return std::move (t);
3548 @}
3549 @end smallexample
3550
3551 Here, the @code{std::move} call is redundant. Because G++ implements Core
3552 Issue 1579, another example is:
3553
3554 @smallexample
3555 struct T @{ // convertible to U
3556 @dots{}
3557 @};
3558 struct U @{
3559 @dots{}
3560 @};
3561 U fn()
3562 @{
3563 T t;
3564 @dots{}
3565 return std::move (t);
3566 @}
3567 @end smallexample
3568 In this example, copy elision isn't applicable because the type of the
3569 expression being returned and the function return type differ, yet G++
3570 treats the return value as if it were designated by an rvalue.
3571
3572 This warning is enabled by @option{-Wextra}.
3573
3574 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3575 @opindex Wredundant-tags
3576 @opindex Wno-redundant-tags
3577 Warn about redundant class-key and enum-key in references to class types
3578 and enumerated types in contexts where the key can be eliminated without
3579 causing an ambiguity. For example:
3580
3581 @smallexample
3582 struct foo;
3583 struct foo *p; // warn that keyword struct can be eliminated
3584 @end smallexample
3585
3586 @noindent
3587 On the other hand, in this example there is no warning:
3588
3589 @smallexample
3590 struct foo;
3591 void foo (); // "hides" struct foo
3592 void bar (struct foo&); // no warning, keyword struct is necessary
3593 @end smallexample
3594
3595 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3596 @opindex Wsubobject-linkage
3597 @opindex Wno-subobject-linkage
3598 Do not warn
3599 if a class type has a base or a field whose type uses the anonymous
3600 namespace or depends on a type with no linkage. If a type A depends on
3601 a type B with no or internal linkage, defining it in multiple
3602 translation units would be an ODR violation because the meaning of B
3603 is different in each translation unit. If A only appears in a single
3604 translation unit, the best way to silence the warning is to give it
3605 internal linkage by putting it in an anonymous namespace as well. The
3606 compiler doesn't give this warning for types defined in the main .C
3607 file, as those are unlikely to have multiple definitions.
3608 @option{-Wsubobject-linkage} is enabled by default.
3609
3610 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3611 @opindex Weffc++
3612 @opindex Wno-effc++
3613 Warn about violations of the following style guidelines from Scott Meyers'
3614 @cite{Effective C++} series of books:
3615
3616 @itemize @bullet
3617 @item
3618 Define a copy constructor and an assignment operator for classes
3619 with dynamically-allocated memory.
3620
3621 @item
3622 Prefer initialization to assignment in constructors.
3623
3624 @item
3625 Have @code{operator=} return a reference to @code{*this}.
3626
3627 @item
3628 Don't try to return a reference when you must return an object.
3629
3630 @item
3631 Distinguish between prefix and postfix forms of increment and
3632 decrement operators.
3633
3634 @item
3635 Never overload @code{&&}, @code{||}, or @code{,}.
3636
3637 @end itemize
3638
3639 This option also enables @option{-Wnon-virtual-dtor}, which is also
3640 one of the effective C++ recommendations. However, the check is
3641 extended to warn about the lack of virtual destructor in accessible
3642 non-polymorphic bases classes too.
3643
3644 When selecting this option, be aware that the standard library
3645 headers do not obey all of these guidelines; use @samp{grep -v}
3646 to filter out those warnings.
3647
3648 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3649 @opindex Wstrict-null-sentinel
3650 @opindex Wno-strict-null-sentinel
3651 Warn about the use of an uncasted @code{NULL} as sentinel. When
3652 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3653 to @code{__null}. Although it is a null pointer constant rather than a
3654 null pointer, it is guaranteed to be of the same size as a pointer.
3655 But this use is not portable across different compilers.
3656
3657 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3658 @opindex Wno-non-template-friend
3659 @opindex Wnon-template-friend
3660 Disable warnings when non-template friend functions are declared
3661 within a template. In very old versions of GCC that predate implementation
3662 of the ISO standard, declarations such as
3663 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3664 could be interpreted as a particular specialization of a template
3665 function; the warning exists to diagnose compatibility problems,
3666 and is enabled by default.
3667
3668 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3669 @opindex Wold-style-cast
3670 @opindex Wno-old-style-cast
3671 Warn if an old-style (C-style) cast to a non-void type is used within
3672 a C++ program. The new-style casts (@code{dynamic_cast},
3673 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3674 less vulnerable to unintended effects and much easier to search for.
3675
3676 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3677 @opindex Woverloaded-virtual
3678 @opindex Wno-overloaded-virtual
3679 @cindex overloaded virtual function, warning
3680 @cindex warning for overloaded virtual function
3681 Warn when a function declaration hides virtual functions from a
3682 base class. For example, in:
3683
3684 @smallexample
3685 struct A @{
3686 virtual void f();
3687 @};
3688
3689 struct B: public A @{
3690 void f(int);
3691 @};
3692 @end smallexample
3693
3694 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3695 like:
3696
3697 @smallexample
3698 B* b;
3699 b->f();
3700 @end smallexample
3701
3702 @noindent
3703 fails to compile.
3704
3705 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3706 @opindex Wno-pmf-conversions
3707 @opindex Wpmf-conversions
3708 Disable the diagnostic for converting a bound pointer to member function
3709 to a plain pointer.
3710
3711 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3712 @opindex Wsign-promo
3713 @opindex Wno-sign-promo
3714 Warn when overload resolution chooses a promotion from unsigned or
3715 enumerated type to a signed type, over a conversion to an unsigned type of
3716 the same size. Previous versions of G++ tried to preserve
3717 unsignedness, but the standard mandates the current behavior.
3718
3719 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3720 @opindex Wtemplates
3721 @opindex Wno-templates
3722 Warn when a primary template declaration is encountered. Some coding
3723 rules disallow templates, and this may be used to enforce that rule.
3724 The warning is inactive inside a system header file, such as the STL, so
3725 one can still use the STL. One may also instantiate or specialize
3726 templates.
3727
3728 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3729 @opindex Wmismatched-tags
3730 @opindex Wno-mismatched-tags
3731 Warn for declarations of structs, classes, and class templates and their
3732 specializations with a class-key that does not match either the definition
3733 or the first declaration if no definition is provided.
3734
3735 For example, the declaration of @code{struct Object} in the argument list
3736 of @code{draw} triggers the warning. To avoid it, either remove the redundant
3737 class-key @code{struct} or replace it with @code{class} to match its definition.
3738 @smallexample
3739 class Object @{
3740 public:
3741 virtual ~Object () = 0;
3742 @};
3743 void draw (struct Object*);
3744 @end smallexample
3745
3746 It is not wrong to declare a class with the class-key @code{struct} as
3747 the example above shows. The @option{-Wmismatched-tags} option is intended
3748 to help achieve a consistent style of class declarations. In code that is
3749 intended to be portable to Windows-based compilers the warning helps prevent
3750 unresolved references due to the difference in the mangling of symbols
3751 declared with different class-keys. The option can be used either on its
3752 own or in conjunction with @option{-Wredundant-tags}.
3753
3754 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3755 @opindex Wmultiple-inheritance
3756 @opindex Wno-multiple-inheritance
3757 Warn when a class is defined with multiple direct base classes. Some
3758 coding rules disallow multiple inheritance, and this may be used to
3759 enforce that rule. The warning is inactive inside a system header file,
3760 such as the STL, so one can still use the STL. One may also define
3761 classes that indirectly use multiple inheritance.
3762
3763 @item -Wvirtual-inheritance
3764 @opindex Wvirtual-inheritance
3765 @opindex Wno-virtual-inheritance
3766 Warn when a class is defined with a virtual direct base class. Some
3767 coding rules disallow multiple inheritance, and this may be used to
3768 enforce that rule. The warning is inactive inside a system header file,
3769 such as the STL, so one can still use the STL. One may also define
3770 classes that indirectly use virtual inheritance.
3771
3772 @item -Wno-virtual-move-assign
3773 @opindex Wvirtual-move-assign
3774 @opindex Wno-virtual-move-assign
3775 Suppress warnings about inheriting from a virtual base with a
3776 non-trivial C++11 move assignment operator. This is dangerous because
3777 if the virtual base is reachable along more than one path, it is
3778 moved multiple times, which can mean both objects end up in the
3779 moved-from state. If the move assignment operator is written to avoid
3780 moving from a moved-from object, this warning can be disabled.
3781
3782 @item -Wnamespaces
3783 @opindex Wnamespaces
3784 @opindex Wno-namespaces
3785 Warn when a namespace definition is opened. Some coding rules disallow
3786 namespaces, and this may be used to enforce that rule. The warning is
3787 inactive inside a system header file, such as the STL, so one can still
3788 use the STL. One may also use using directives and qualified names.
3789
3790 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3791 @opindex Wterminate
3792 @opindex Wno-terminate
3793 Disable the warning about a throw-expression that will immediately
3794 result in a call to @code{terminate}.
3795
3796 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3797 @opindex Wno-class-conversion
3798 @opindex Wclass-conversion
3799 Do not warn when a conversion function converts an
3800 object to the same type, to a base class of that type, or to void; such
3801 a conversion function will never be called.
3802
3803 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3804 @opindex Wvolatile
3805 @opindex Wno-volatile
3806 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3807 postfix and prefix @code{++} and @code{--} expressions of
3808 @code{volatile}-qualified types, using simple assignments where the left
3809 operand is a @code{volatile}-qualified non-class type for their value,
3810 compound assignments where the left operand is a @code{volatile}-qualified
3811 non-class type, @code{volatile}-qualified function return type,
3812 @code{volatile}-qualified parameter type, and structured bindings of a
3813 @code{volatile}-qualified type. This usage was deprecated in C++20.
3814
3815 Enabled by default with @option{-std=c++2a}.
3816
3817 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
3818 @opindex Wzero-as-null-pointer-constant
3819 @opindex Wno-zero-as-null-pointer-constant
3820 Warn when a literal @samp{0} is used as null pointer constant. This can
3821 be useful to facilitate the conversion to @code{nullptr} in C++11.
3822
3823 @item -Waligned-new
3824 @opindex Waligned-new
3825 @opindex Wno-aligned-new
3826 Warn about a new-expression of a type that requires greater alignment
3827 than the @code{alignof(std::max_align_t)} but uses an allocation
3828 function without an explicit alignment parameter. This option is
3829 enabled by @option{-Wall}.
3830
3831 Normally this only warns about global allocation functions, but
3832 @option{-Waligned-new=all} also warns about class member allocation
3833 functions.
3834
3835 @item -Wno-placement-new
3836 @itemx -Wplacement-new=@var{n}
3837 @opindex Wplacement-new
3838 @opindex Wno-placement-new
3839 Warn about placement new expressions with undefined behavior, such as
3840 constructing an object in a buffer that is smaller than the type of
3841 the object. For example, the placement new expression below is diagnosed
3842 because it attempts to construct an array of 64 integers in a buffer only
3843 64 bytes large.
3844 @smallexample
3845 char buf [64];
3846 new (buf) int[64];
3847 @end smallexample
3848 This warning is enabled by default.
3849
3850 @table @gcctabopt
3851 @item -Wplacement-new=1
3852 This is the default warning level of @option{-Wplacement-new}. At this
3853 level the warning is not issued for some strictly undefined constructs that
3854 GCC allows as extensions for compatibility with legacy code. For example,
3855 the following @code{new} expression is not diagnosed at this level even
3856 though it has undefined behavior according to the C++ standard because
3857 it writes past the end of the one-element array.
3858 @smallexample
3859 struct S @{ int n, a[1]; @};
3860 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3861 new (s->a)int [32]();
3862 @end smallexample
3863
3864 @item -Wplacement-new=2
3865 At this level, in addition to diagnosing all the same constructs as at level
3866 1, a diagnostic is also issued for placement new expressions that construct
3867 an object in the last member of structure whose type is an array of a single
3868 element and whose size is less than the size of the object being constructed.
3869 While the previous example would be diagnosed, the following construct makes
3870 use of the flexible member array extension to avoid the warning at level 2.
3871 @smallexample
3872 struct S @{ int n, a[]; @};
3873 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3874 new (s->a)int [32]();
3875 @end smallexample
3876
3877 @end table
3878
3879 @item -Wcatch-value
3880 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
3881 @opindex Wcatch-value
3882 @opindex Wno-catch-value
3883 Warn about catch handlers that do not catch via reference.
3884 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
3885 warn about polymorphic class types that are caught by value.
3886 With @option{-Wcatch-value=2} warn about all class types that are caught
3887 by value. With @option{-Wcatch-value=3} warn about all types that are
3888 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
3889
3890 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
3891 @opindex Wconditionally-supported
3892 @opindex Wno-conditionally-supported
3893 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3894
3895 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
3896 @opindex Wdelete-incomplete
3897 @opindex Wno-delete-incomplete
3898 Do not warn when deleting a pointer to incomplete type, which may cause
3899 undefined behavior at runtime. This warning is enabled by default.
3900
3901 @item -Wextra-semi @r{(C++, Objective-C++ only)}
3902 @opindex Wextra-semi
3903 @opindex Wno-extra-semi
3904 Warn about redundant semicolons after in-class function definitions.
3905
3906 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
3907 @opindex Winaccessible-base
3908 @opindex Wno-inaccessible-base
3909 This option controls warnings
3910 when a base class is inaccessible in a class derived from it due to
3911 ambiguity. The warning is enabled by default.
3912 Note that the warning for ambiguous virtual
3913 bases is enabled by the @option{-Wextra} option.
3914 @smallexample
3915 @group
3916 struct A @{ int a; @};
3917
3918 struct B : A @{ @};
3919
3920 struct C : B, A @{ @};
3921 @end group
3922 @end smallexample
3923
3924 @item -Wno-inherited-variadic-ctor
3925 @opindex Winherited-variadic-ctor
3926 @opindex Wno-inherited-variadic-ctor
3927 Suppress warnings about use of C++11 inheriting constructors when the
3928 base class inherited from has a C variadic constructor; the warning is
3929 on by default because the ellipsis is not inherited.
3930
3931 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
3932 @opindex Wno-invalid-offsetof
3933 @opindex Winvalid-offsetof
3934 Suppress warnings from applying the @code{offsetof} macro to a non-POD
3935 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
3936 to a non-standard-layout type is undefined. In existing C++ implementations,
3937 however, @code{offsetof} typically gives meaningful results.
3938 This flag is for users who are aware that they are
3939 writing nonportable code and who have deliberately chosen to ignore the
3940 warning about it.
3941
3942 The restrictions on @code{offsetof} may be relaxed in a future version
3943 of the C++ standard.
3944
3945 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
3946 @opindex Wsized-deallocation
3947 @opindex Wno-sized-deallocation
3948 Warn about a definition of an unsized deallocation function
3949 @smallexample
3950 void operator delete (void *) noexcept;
3951 void operator delete[] (void *) noexcept;
3952 @end smallexample
3953 without a definition of the corresponding sized deallocation function
3954 @smallexample
3955 void operator delete (void *, std::size_t) noexcept;
3956 void operator delete[] (void *, std::size_t) noexcept;
3957 @end smallexample
3958 or vice versa. Enabled by @option{-Wextra} along with
3959 @option{-fsized-deallocation}.
3960
3961 @item -Wsuggest-final-types
3962 @opindex Wno-suggest-final-types
3963 @opindex Wsuggest-final-types
3964 Warn about types with virtual methods where code quality would be improved
3965 if the type were declared with the C++11 @code{final} specifier,
3966 or, if possible,
3967 declared in an anonymous namespace. This allows GCC to more aggressively
3968 devirtualize the polymorphic calls. This warning is more effective with
3969 link-time optimization,
3970 where the information about the class hierarchy graph is
3971 more complete.
3972
3973 @item -Wsuggest-final-methods
3974 @opindex Wno-suggest-final-methods
3975 @opindex Wsuggest-final-methods
3976 Warn about virtual methods where code quality would be improved if the method
3977 were declared with the C++11 @code{final} specifier,
3978 or, if possible, its type were
3979 declared in an anonymous namespace or with the @code{final} specifier.
3980 This warning is
3981 more effective with link-time optimization, where the information about the
3982 class hierarchy graph is more complete. It is recommended to first consider
3983 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
3984 annotations.
3985
3986 @item -Wsuggest-override
3987 @opindex Wsuggest-override
3988 @opindex Wno-suggest-override
3989 Warn about overriding virtual functions that are not marked with the
3990 @code{override} keyword.
3991
3992 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
3993 @opindex Wuseless-cast
3994 @opindex Wno-useless-cast
3995 Warn when an expression is casted to its own type.
3996
3997 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
3998 @opindex Wconversion-null
3999 @opindex Wno-conversion-null
4000 Do not warn for conversions between @code{NULL} and non-pointer
4001 types. @option{-Wconversion-null} is enabled by default.
4002
4003 @end table
4004
4005 @node Objective-C and Objective-C++ Dialect Options
4006 @section Options Controlling Objective-C and Objective-C++ Dialects
4007
4008 @cindex compiler options, Objective-C and Objective-C++
4009 @cindex Objective-C and Objective-C++ options, command-line
4010 @cindex options, Objective-C and Objective-C++
4011 (NOTE: This manual does not describe the Objective-C and Objective-C++
4012 languages themselves. @xref{Standards,,Language Standards
4013 Supported by GCC}, for references.)
4014
4015 This section describes the command-line options that are only meaningful
4016 for Objective-C and Objective-C++ programs. You can also use most of
4017 the language-independent GNU compiler options.
4018 For example, you might compile a file @file{some_class.m} like this:
4019
4020 @smallexample
4021 gcc -g -fgnu-runtime -O -c some_class.m
4022 @end smallexample
4023
4024 @noindent
4025 In this example, @option{-fgnu-runtime} is an option meant only for
4026 Objective-C and Objective-C++ programs; you can use the other options with
4027 any language supported by GCC@.
4028
4029 Note that since Objective-C is an extension of the C language, Objective-C
4030 compilations may also use options specific to the C front-end (e.g.,
4031 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4032 C++-specific options (e.g., @option{-Wabi}).
4033
4034 Here is a list of options that are @emph{only} for compiling Objective-C
4035 and Objective-C++ programs:
4036
4037 @table @gcctabopt
4038 @item -fconstant-string-class=@var{class-name}
4039 @opindex fconstant-string-class
4040 Use @var{class-name} as the name of the class to instantiate for each
4041 literal string specified with the syntax @code{@@"@dots{}"}. The default
4042 class name is @code{NXConstantString} if the GNU runtime is being used, and
4043 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4044 @option{-fconstant-cfstrings} option, if also present, overrides the
4045 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4046 to be laid out as constant CoreFoundation strings.
4047
4048 @item -fgnu-runtime
4049 @opindex fgnu-runtime
4050 Generate object code compatible with the standard GNU Objective-C
4051 runtime. This is the default for most types of systems.
4052
4053 @item -fnext-runtime
4054 @opindex fnext-runtime
4055 Generate output compatible with the NeXT runtime. This is the default
4056 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4057 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4058 used.
4059
4060 @item -fno-nil-receivers
4061 @opindex fno-nil-receivers
4062 @opindex fnil-receivers
4063 Assume that all Objective-C message dispatches (@code{[receiver
4064 message:arg]}) in this translation unit ensure that the receiver is
4065 not @code{nil}. This allows for more efficient entry points in the
4066 runtime to be used. This option is only available in conjunction with
4067 the NeXT runtime and ABI version 0 or 1.
4068
4069 @item -fobjc-abi-version=@var{n}
4070 @opindex fobjc-abi-version
4071 Use version @var{n} of the Objective-C ABI for the selected runtime.
4072 This option is currently supported only for the NeXT runtime. In that
4073 case, Version 0 is the traditional (32-bit) ABI without support for
4074 properties and other Objective-C 2.0 additions. Version 1 is the
4075 traditional (32-bit) ABI with support for properties and other
4076 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4077 nothing is specified, the default is Version 0 on 32-bit target
4078 machines, and Version 2 on 64-bit target machines.
4079
4080 @item -fobjc-call-cxx-cdtors
4081 @opindex fobjc-call-cxx-cdtors
4082 For each Objective-C class, check if any of its instance variables is a
4083 C++ object with a non-trivial default constructor. If so, synthesize a
4084 special @code{- (id) .cxx_construct} instance method which runs
4085 non-trivial default constructors on any such instance variables, in order,
4086 and then return @code{self}. Similarly, check if any instance variable
4087 is a C++ object with a non-trivial destructor, and if so, synthesize a
4088 special @code{- (void) .cxx_destruct} method which runs
4089 all such default destructors, in reverse order.
4090
4091 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4092 methods thusly generated only operate on instance variables
4093 declared in the current Objective-C class, and not those inherited
4094 from superclasses. It is the responsibility of the Objective-C
4095 runtime to invoke all such methods in an object's inheritance
4096 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4097 by the runtime immediately after a new object instance is allocated;
4098 the @code{- (void) .cxx_destruct} methods are invoked immediately
4099 before the runtime deallocates an object instance.
4100
4101 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4102 support for invoking the @code{- (id) .cxx_construct} and
4103 @code{- (void) .cxx_destruct} methods.
4104
4105 @item -fobjc-direct-dispatch
4106 @opindex fobjc-direct-dispatch
4107 Allow fast jumps to the message dispatcher. On Darwin this is
4108 accomplished via the comm page.
4109
4110 @item -fobjc-exceptions
4111 @opindex fobjc-exceptions
4112 Enable syntactic support for structured exception handling in
4113 Objective-C, similar to what is offered by C++. This option
4114 is required to use the Objective-C keywords @code{@@try},
4115 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4116 @code{@@synchronized}. This option is available with both the GNU
4117 runtime and the NeXT runtime (but not available in conjunction with
4118 the NeXT runtime on Mac OS X 10.2 and earlier).
4119
4120 @item -fobjc-gc
4121 @opindex fobjc-gc
4122 Enable garbage collection (GC) in Objective-C and Objective-C++
4123 programs. This option is only available with the NeXT runtime; the
4124 GNU runtime has a different garbage collection implementation that
4125 does not require special compiler flags.
4126
4127 @item -fobjc-nilcheck
4128 @opindex fobjc-nilcheck
4129 For the NeXT runtime with version 2 of the ABI, check for a nil
4130 receiver in method invocations before doing the actual method call.
4131 This is the default and can be disabled using
4132 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4133 checked for nil in this way no matter what this flag is set to.
4134 Currently this flag does nothing when the GNU runtime, or an older
4135 version of the NeXT runtime ABI, is used.
4136
4137 @item -fobjc-std=objc1
4138 @opindex fobjc-std
4139 Conform to the language syntax of Objective-C 1.0, the language
4140 recognized by GCC 4.0. This only affects the Objective-C additions to
4141 the C/C++ language; it does not affect conformance to C/C++ standards,
4142 which is controlled by the separate C/C++ dialect option flags. When
4143 this option is used with the Objective-C or Objective-C++ compiler,
4144 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4145 This is useful if you need to make sure that your Objective-C code can
4146 be compiled with older versions of GCC@.
4147
4148 @item -freplace-objc-classes
4149 @opindex freplace-objc-classes
4150 Emit a special marker instructing @command{ld(1)} not to statically link in
4151 the resulting object file, and allow @command{dyld(1)} to load it in at
4152 run time instead. This is used in conjunction with the Fix-and-Continue
4153 debugging mode, where the object file in question may be recompiled and
4154 dynamically reloaded in the course of program execution, without the need
4155 to restart the program itself. Currently, Fix-and-Continue functionality
4156 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4157 and later.
4158
4159 @item -fzero-link
4160 @opindex fzero-link
4161 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4162 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4163 compile time) with static class references that get initialized at load time,
4164 which improves run-time performance. Specifying the @option{-fzero-link} flag
4165 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4166 to be retained. This is useful in Zero-Link debugging mode, since it allows
4167 for individual class implementations to be modified during program execution.
4168 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4169 regardless of command-line options.
4170
4171 @item -fno-local-ivars
4172 @opindex fno-local-ivars
4173 @opindex flocal-ivars
4174 By default instance variables in Objective-C can be accessed as if
4175 they were local variables from within the methods of the class they're
4176 declared in. This can lead to shadowing between instance variables
4177 and other variables declared either locally inside a class method or
4178 globally with the same name. Specifying the @option{-fno-local-ivars}
4179 flag disables this behavior thus avoiding variable shadowing issues.
4180
4181 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4182 @opindex fivar-visibility
4183 Set the default instance variable visibility to the specified option
4184 so that instance variables declared outside the scope of any access
4185 modifier directives default to the specified visibility.
4186
4187 @item -gen-decls
4188 @opindex gen-decls
4189 Dump interface declarations for all classes seen in the source file to a
4190 file named @file{@var{sourcename}.decl}.
4191
4192 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4193 @opindex Wassign-intercept
4194 @opindex Wno-assign-intercept
4195 Warn whenever an Objective-C assignment is being intercepted by the
4196 garbage collector.
4197
4198 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4199 @opindex Wproperty-assign-default
4200 @opindex Wno-property-assign-default
4201 Do not warn if a property for an Objective-C object has no assign
4202 semantics specified.
4203
4204 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4205 @opindex Wno-protocol
4206 @opindex Wprotocol
4207 If a class is declared to implement a protocol, a warning is issued for
4208 every method in the protocol that is not implemented by the class. The
4209 default behavior is to issue a warning for every method not explicitly
4210 implemented in the class, even if a method implementation is inherited
4211 from the superclass. If you use the @option{-Wno-protocol} option, then
4212 methods inherited from the superclass are considered to be implemented,
4213 and no warning is issued for them.
4214
4215 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4216 @opindex Wselector
4217 @opindex Wno-selector
4218 Warn if multiple methods of different types for the same selector are
4219 found during compilation. The check is performed on the list of methods
4220 in the final stage of compilation. Additionally, a check is performed
4221 for each selector appearing in a @code{@@selector(@dots{})}
4222 expression, and a corresponding method for that selector has been found
4223 during compilation. Because these checks scan the method table only at
4224 the end of compilation, these warnings are not produced if the final
4225 stage of compilation is not reached, for example because an error is
4226 found during compilation, or because the @option{-fsyntax-only} option is
4227 being used.
4228
4229 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4230 @opindex Wstrict-selector-match
4231 @opindex Wno-strict-selector-match
4232 Warn if multiple methods with differing argument and/or return types are
4233 found for a given selector when attempting to send a message using this
4234 selector to a receiver of type @code{id} or @code{Class}. When this flag
4235 is off (which is the default behavior), the compiler omits such warnings
4236 if any differences found are confined to types that share the same size
4237 and alignment.
4238
4239 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4240 @opindex Wundeclared-selector
4241 @opindex Wno-undeclared-selector
4242 Warn if a @code{@@selector(@dots{})} expression referring to an
4243 undeclared selector is found. A selector is considered undeclared if no
4244 method with that name has been declared before the
4245 @code{@@selector(@dots{})} expression, either explicitly in an
4246 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4247 an @code{@@implementation} section. This option always performs its
4248 checks as soon as a @code{@@selector(@dots{})} expression is found,
4249 while @option{-Wselector} only performs its checks in the final stage of
4250 compilation. This also enforces the coding style convention
4251 that methods and selectors must be declared before being used.
4252
4253 @item -print-objc-runtime-info
4254 @opindex print-objc-runtime-info
4255 Generate C header describing the largest structure that is passed by
4256 value, if any.
4257
4258 @end table
4259
4260 @node Diagnostic Message Formatting Options
4261 @section Options to Control Diagnostic Messages Formatting
4262 @cindex options to control diagnostics formatting
4263 @cindex diagnostic messages
4264 @cindex message formatting
4265
4266 Traditionally, diagnostic messages have been formatted irrespective of
4267 the output device's aspect (e.g.@: its width, @dots{}). You can use the
4268 options described below
4269 to control the formatting algorithm for diagnostic messages,
4270 e.g.@: how many characters per line, how often source location
4271 information should be reported. Note that some language front ends may not
4272 honor these options.
4273
4274 @table @gcctabopt
4275 @item -fmessage-length=@var{n}
4276 @opindex fmessage-length
4277 Try to format error messages so that they fit on lines of about
4278 @var{n} characters. If @var{n} is zero, then no line-wrapping is
4279 done; each error message appears on a single line. This is the
4280 default for all front ends.
4281
4282 Note - this option also affects the display of the @samp{#error} and
4283 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4284 function/type/variable attribute. It does not however affect the
4285 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4286
4287 @item -fdiagnostics-show-location=once
4288 @opindex fdiagnostics-show-location
4289 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
4290 reporter to emit source location information @emph{once}; that is, in
4291 case the message is too long to fit on a single physical line and has to
4292 be wrapped, the source location won't be emitted (as prefix) again,
4293 over and over, in subsequent continuation lines. This is the default
4294 behavior.
4295
4296 @item -fdiagnostics-show-location=every-line
4297 Only meaningful in line-wrapping mode. Instructs the diagnostic
4298 messages reporter to emit the same source location information (as
4299 prefix) for physical lines that result from the process of breaking
4300 a message which is too long to fit on a single line.
4301
4302 @item -fdiagnostics-color[=@var{WHEN}]
4303 @itemx -fno-diagnostics-color
4304 @opindex fdiagnostics-color
4305 @cindex highlight, color
4306 @vindex GCC_COLORS @r{environment variable}
4307 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
4308 or @samp{auto}. The default depends on how the compiler has been configured,
4309 it can be any of the above @var{WHEN} options or also @samp{never}
4310 if @env{GCC_COLORS} environment variable isn't present in the environment,
4311 and @samp{auto} otherwise.
4312 @samp{auto} makes GCC use color only when the standard error is a terminal,
4313 and when not executing in an emacs shell.
4314 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4315 aliases for @option{-fdiagnostics-color=always} and
4316 @option{-fdiagnostics-color=never}, respectively.
4317
4318 The colors are defined by the environment variable @env{GCC_COLORS}.
4319 Its value is a colon-separated list of capabilities and Select Graphic
4320 Rendition (SGR) substrings. SGR commands are interpreted by the
4321 terminal or terminal emulator. (See the section in the documentation
4322 of your text terminal for permitted values and their meanings as
4323 character attributes.) These substring values are integers in decimal
4324 representation and can be concatenated with semicolons.
4325 Common values to concatenate include
4326 @samp{1} for bold,
4327 @samp{4} for underline,
4328 @samp{5} for blink,
4329 @samp{7} for inverse,
4330 @samp{39} for default foreground color,
4331 @samp{30} to @samp{37} for foreground colors,
4332 @samp{90} to @samp{97} for 16-color mode foreground colors,
4333 @samp{38;5;0} to @samp{38;5;255}
4334 for 88-color and 256-color modes foreground colors,
4335 @samp{49} for default background color,
4336 @samp{40} to @samp{47} for background colors,
4337 @samp{100} to @samp{107} for 16-color mode background colors,
4338 and @samp{48;5;0} to @samp{48;5;255}
4339 for 88-color and 256-color modes background colors.
4340
4341 The default @env{GCC_COLORS} is
4342 @smallexample
4343 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4344 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4345 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4346 type-diff=01;32
4347 @end smallexample
4348 @noindent
4349 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4350 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4351 @samp{01} is bold, and @samp{31} is red.
4352 Setting @env{GCC_COLORS} to the empty string disables colors.
4353 Supported capabilities are as follows.
4354
4355 @table @code
4356 @item error=
4357 @vindex error GCC_COLORS @r{capability}
4358 SGR substring for error: markers.
4359
4360 @item warning=
4361 @vindex warning GCC_COLORS @r{capability}
4362 SGR substring for warning: markers.
4363
4364 @item note=
4365 @vindex note GCC_COLORS @r{capability}
4366 SGR substring for note: markers.
4367
4368 @item path=
4369 @vindex path GCC_COLORS @r{capability}
4370 SGR substring for colorizing paths of control-flow events as printed
4371 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4372 individual events and lines indicating interprocedural calls and returns.
4373
4374 @item range1=
4375 @vindex range1 GCC_COLORS @r{capability}
4376 SGR substring for first additional range.
4377
4378 @item range2=
4379 @vindex range2 GCC_COLORS @r{capability}
4380 SGR substring for second additional range.
4381
4382 @item locus=
4383 @vindex locus GCC_COLORS @r{capability}
4384 SGR substring for location information, @samp{file:line} or
4385 @samp{file:line:column} etc.
4386
4387 @item quote=
4388 @vindex quote GCC_COLORS @r{capability}
4389 SGR substring for information printed within quotes.
4390
4391 @item fixit-insert=
4392 @vindex fixit-insert GCC_COLORS @r{capability}
4393 SGR substring for fix-it hints suggesting text to
4394 be inserted or replaced.
4395
4396 @item fixit-delete=
4397 @vindex fixit-delete GCC_COLORS @r{capability}
4398 SGR substring for fix-it hints suggesting text to
4399 be deleted.
4400
4401 @item diff-filename=
4402 @vindex diff-filename GCC_COLORS @r{capability}
4403 SGR substring for filename headers within generated patches.
4404
4405 @item diff-hunk=
4406 @vindex diff-hunk GCC_COLORS @r{capability}
4407 SGR substring for the starts of hunks within generated patches.
4408
4409 @item diff-delete=
4410 @vindex diff-delete GCC_COLORS @r{capability}
4411 SGR substring for deleted lines within generated patches.
4412
4413 @item diff-insert=
4414 @vindex diff-insert GCC_COLORS @r{capability}
4415 SGR substring for inserted lines within generated patches.
4416
4417 @item type-diff=
4418 @vindex type-diff GCC_COLORS @r{capability}
4419 SGR substring for highlighting mismatching types within template
4420 arguments in the C++ frontend.
4421 @end table
4422
4423 @item -fdiagnostics-urls[=@var{WHEN}]
4424 @opindex fdiagnostics-urls
4425 @cindex urls
4426 @vindex GCC_URLS @r{environment variable}
4427 @vindex TERM_URLS @r{environment variable}
4428 Use escape sequences to embed URLs in diagnostics. For example, when
4429 @option{-fdiagnostics-show-option} emits text showing the command-line
4430 option controlling a diagnostic, embed a URL for documentation of that
4431 option.
4432
4433 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4434 @samp{auto} makes GCC use URL escape sequences only when the standard error
4435 is a terminal, and when not executing in an emacs shell or any graphical
4436 terminal which is known to be incompatible with this feature, see below.
4437
4438 The default depends on how the compiler has been configured.
4439 It can be any of the above @var{WHEN} options.
4440
4441 GCC can also be configured (via the
4442 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4443 so that the default is affected by environment variables.
4444 Under such a configuration, GCC defaults to using @samp{auto}
4445 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4446 present and non-empty in the environment of the compiler, or @samp{never}
4447 if neither are.
4448
4449 However, even with @option{-fdiagnostics-urls=always} the behavior is
4450 dependent on those environment variables:
4451 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4452 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4453 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4454 Any other non-empty value enables the feature.
4455 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4456 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4457 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4458
4459 At this time GCC tries to detect also a few terminals that are known to
4460 not implement the URL feature, and have bugs or at least had bugs in
4461 some versions that are still in use, where the URL escapes are likely
4462 to misbehave, i.e. print garbage on the screen.
4463 That list is currently xfce4-terminal, certain known to be buggy
4464 gnome-terminal versions, the linux console, and mingw.
4465 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4466
4467 @item -fno-diagnostics-show-option
4468 @opindex fno-diagnostics-show-option
4469 @opindex fdiagnostics-show-option
4470 By default, each diagnostic emitted includes text indicating the
4471 command-line option that directly controls the diagnostic (if such an
4472 option is known to the diagnostic machinery). Specifying the
4473 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4474
4475 @item -fno-diagnostics-show-caret
4476 @opindex fno-diagnostics-show-caret
4477 @opindex fdiagnostics-show-caret
4478 By default, each diagnostic emitted includes the original source line
4479 and a caret @samp{^} indicating the column. This option suppresses this
4480 information. The source line is truncated to @var{n} characters, if
4481 the @option{-fmessage-length=n} option is given. When the output is done
4482 to the terminal, the width is limited to the width given by the
4483 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4484
4485 @item -fno-diagnostics-show-labels
4486 @opindex fno-diagnostics-show-labels
4487 @opindex fdiagnostics-show-labels
4488 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4489 diagnostics can label ranges of source code with pertinent information, such
4490 as the types of expressions:
4491
4492 @smallexample
4493 printf ("foo %s bar", long_i + long_j);
4494 ~^ ~~~~~~~~~~~~~~~
4495 | |
4496 char * long int
4497 @end smallexample
4498
4499 This option suppresses the printing of these labels (in the example above,
4500 the vertical bars and the ``char *'' and ``long int'' text).
4501
4502 @item -fno-diagnostics-show-cwe
4503 @opindex fno-diagnostics-show-cwe
4504 @opindex fdiagnostics-show-cwe
4505 Diagnostic messages can optionally have an associated
4506 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4507 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4508 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4509 By default, if this information is present, it will be printed with
4510 the diagnostic. This option suppresses the printing of this metadata.
4511
4512 @item -fno-diagnostics-show-line-numbers
4513 @opindex fno-diagnostics-show-line-numbers
4514 @opindex fdiagnostics-show-line-numbers
4515 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4516 a left margin is printed, showing line numbers. This option suppresses this
4517 left margin.
4518
4519 @item -fdiagnostics-minimum-margin-width=@var{width}
4520 @opindex fdiagnostics-minimum-margin-width
4521 This option controls the minimum width of the left margin printed by
4522 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4523
4524 @item -fdiagnostics-parseable-fixits
4525 @opindex fdiagnostics-parseable-fixits
4526 Emit fix-it hints in a machine-parseable format, suitable for consumption
4527 by IDEs. For each fix-it, a line will be printed after the relevant
4528 diagnostic, starting with the string ``fix-it:''. For example:
4529
4530 @smallexample
4531 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4532 @end smallexample
4533
4534 The location is expressed as a half-open range, expressed as a count of
4535 bytes, starting at byte 1 for the initial column. In the above example,
4536 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4537 given string:
4538
4539 @smallexample
4540 00000000011111111112222222222
4541 12345678901234567890123456789
4542 gtk_widget_showall (dlg);
4543 ^^^^^^^^^^^^^^^^^^
4544 gtk_widget_show_all
4545 @end smallexample
4546
4547 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4548 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4549 (e.g. vertical tab as ``\013'').
4550
4551 An empty replacement string indicates that the given range is to be removed.
4552 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4553 be inserted at the given position.
4554
4555 @item -fdiagnostics-generate-patch
4556 @opindex fdiagnostics-generate-patch
4557 Print fix-it hints to stderr in unified diff format, after any diagnostics
4558 are printed. For example:
4559
4560 @smallexample
4561 --- test.c
4562 +++ test.c
4563 @@ -42,5 +42,5 @@
4564
4565 void show_cb(GtkDialog *dlg)
4566 @{
4567 - gtk_widget_showall(dlg);
4568 + gtk_widget_show_all(dlg);
4569 @}
4570
4571 @end smallexample
4572
4573 The diff may or may not be colorized, following the same rules
4574 as for diagnostics (see @option{-fdiagnostics-color}).
4575
4576 @item -fdiagnostics-show-template-tree
4577 @opindex fdiagnostics-show-template-tree
4578
4579 In the C++ frontend, when printing diagnostics showing mismatching
4580 template types, such as:
4581
4582 @smallexample
4583 could not convert 'std::map<int, std::vector<double> >()'
4584 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4585 @end smallexample
4586
4587 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4588 tree-like structure showing the common and differing parts of the types,
4589 such as:
4590
4591 @smallexample
4592 map<
4593 [...],
4594 vector<
4595 [double != float]>>
4596 @end smallexample
4597
4598 The parts that differ are highlighted with color (``double'' and
4599 ``float'' in this case).
4600
4601 @item -fno-elide-type
4602 @opindex fno-elide-type
4603 @opindex felide-type
4604 By default when the C++ frontend prints diagnostics showing mismatching
4605 template types, common parts of the types are printed as ``[...]'' to
4606 simplify the error message. For example:
4607
4608 @smallexample
4609 could not convert 'std::map<int, std::vector<double> >()'
4610 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4611 @end smallexample
4612
4613 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4614 This flag also affects the output of the
4615 @option{-fdiagnostics-show-template-tree} flag.
4616
4617 @item -fdiagnostics-path-format=@var{KIND}
4618 @opindex fdiagnostics-path-format
4619 Specify how to print paths of control-flow events for diagnostics that
4620 have such a path associated with them.
4621
4622 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4623 the default.
4624
4625 @samp{none} means to not print diagnostic paths.
4626
4627 @samp{separate-events} means to print a separate ``note'' diagnostic for
4628 each event within the diagnostic. For example:
4629
4630 @smallexample
4631 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4632 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4633 test.c:27:3: note: (2) when 'i < count'
4634 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4635 @end smallexample
4636
4637 @samp{inline-events} means to print the events ``inline'' within the source
4638 code. This view attempts to consolidate the events into runs of
4639 sufficiently-close events, printing them as labelled ranges within the source.
4640
4641 For example, the same events as above might be printed as:
4642
4643 @smallexample
4644 'test': events 1-3
4645 |
4646 | 25 | list = PyList_New(0);
4647 | | ^~~~~~~~~~~~~
4648 | | |
4649 | | (1) when 'PyList_New' fails, returning NULL
4650 | 26 |
4651 | 27 | for (i = 0; i < count; i++) @{
4652 | | ~~~
4653 | | |
4654 | | (2) when 'i < count'
4655 | 28 | item = PyLong_FromLong(random());
4656 | 29 | PyList_Append(list, item);
4657 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4658 | | |
4659 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4660 |
4661 @end smallexample
4662
4663 Interprocedural control flow is shown by grouping the events by stack frame,
4664 and using indentation to show how stack frames are nested, pushed, and popped.
4665
4666 For example:
4667
4668 @smallexample
4669 'test': events 1-2
4670 |
4671 | 133 | @{
4672 | | ^
4673 | | |
4674 | | (1) entering 'test'
4675 | 134 | boxed_int *obj = make_boxed_int (i);
4676 | | ~~~~~~~~~~~~~~~~~~
4677 | | |
4678 | | (2) calling 'make_boxed_int'
4679 |
4680 +--> 'make_boxed_int': events 3-4
4681 |
4682 | 120 | @{
4683 | | ^
4684 | | |
4685 | | (3) entering 'make_boxed_int'
4686 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4687 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4688 | | |
4689 | | (4) calling 'wrapped_malloc'
4690 |
4691 +--> 'wrapped_malloc': events 5-6
4692 |
4693 | 7 | @{
4694 | | ^
4695 | | |
4696 | | (5) entering 'wrapped_malloc'
4697 | 8 | return malloc (size);
4698 | | ~~~~~~~~~~~~~
4699 | | |
4700 | | (6) calling 'malloc'
4701 |
4702 <-------------+
4703 |
4704 'test': event 7
4705 |
4706 | 138 | free_boxed_int (obj);
4707 | | ^~~~~~~~~~~~~~~~~~~~
4708 | | |
4709 | | (7) calling 'free_boxed_int'
4710 |
4711 (etc)
4712 @end smallexample
4713
4714 @item -fdiagnostics-show-path-depths
4715 @opindex fdiagnostics-show-path-depths
4716 This option provides additional information when printing control-flow paths
4717 associated with a diagnostic.
4718
4719 If this is option is provided then the stack depth will be printed for
4720 each run of events within @option{-fdiagnostics-path-format=separate-events}.
4721
4722 This is intended for use by GCC developers and plugin developers when
4723 debugging diagnostics that report interprocedural control flow.
4724
4725 @item -fno-show-column
4726 @opindex fno-show-column
4727 @opindex fshow-column
4728 Do not print column numbers in diagnostics. This may be necessary if
4729 diagnostics are being scanned by a program that does not understand the
4730 column numbers, such as @command{dejagnu}.
4731
4732 @item -fdiagnostics-format=@var{FORMAT}
4733 @opindex fdiagnostics-format
4734 Select a different format for printing diagnostics.
4735 @var{FORMAT} is @samp{text} or @samp{json}.
4736 The default is @samp{text}.
4737
4738 The @samp{json} format consists of a top-level JSON array containing JSON
4739 objects representing the diagnostics.
4740
4741 The JSON is emitted as one line, without formatting; the examples below
4742 have been formatted for clarity.
4743
4744 Diagnostics can have child diagnostics. For example, this error and note:
4745
4746 @smallexample
4747 misleading-indentation.c:15:3: warning: this 'if' clause does not
4748 guard... [-Wmisleading-indentation]
4749 15 | if (flag)
4750 | ^~
4751 misleading-indentation.c:17:5: note: ...this statement, but the latter
4752 is misleadingly indented as if it were guarded by the 'if'
4753 17 | y = 2;
4754 | ^
4755 @end smallexample
4756
4757 @noindent
4758 might be printed in JSON form (after formatting) like this:
4759
4760 @smallexample
4761 [
4762 @{
4763 "kind": "warning",
4764 "locations": [
4765 @{
4766 "caret": @{
4767 "column": 3,
4768 "file": "misleading-indentation.c",
4769 "line": 15
4770 @},
4771 "finish": @{
4772 "column": 4,
4773 "file": "misleading-indentation.c",
4774 "line": 15
4775 @}
4776 @}
4777 ],
4778 "message": "this \u2018if\u2019 clause does not guard...",
4779 "option": "-Wmisleading-indentation",
4780 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4781 "children": [
4782 @{
4783 "kind": "note",
4784 "locations": [
4785 @{
4786 "caret": @{
4787 "column": 5,
4788 "file": "misleading-indentation.c",
4789 "line": 17
4790 @}
4791 @}
4792 ],
4793 "message": "...this statement, but the latter is @dots{}"
4794 @}
4795 ]
4796 @},
4797 @dots{}
4798 ]
4799 @end smallexample
4800
4801 @noindent
4802 where the @code{note} is a child of the @code{warning}.
4803
4804 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4805 an @code{option} key describing the command-line option controlling the
4806 warning.
4807
4808 A diagnostic can contain zero or more locations. Each location has up
4809 to three positions within it: a @code{caret} position and optional
4810 @code{start} and @code{finish} positions. A location can also have
4811 an optional @code{label} string. For example, this error:
4812
4813 @smallexample
4814 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4815 'struct s'@} and 'T' @{aka 'struct t'@})
4816 64 | return callee_4a () + callee_4b ();
4817 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4818 | | |
4819 | | T @{aka struct t@}
4820 | S @{aka struct s@}
4821 @end smallexample
4822
4823 @noindent
4824 has three locations. Its primary location is at the ``+'' token at column
4825 23. It has two secondary locations, describing the left and right-hand sides
4826 of the expression, which have labels. It might be printed in JSON form as:
4827
4828 @smallexample
4829 @{
4830 "children": [],
4831 "kind": "error",
4832 "locations": [
4833 @{
4834 "caret": @{
4835 "column": 23, "file": "bad-binary-ops.c", "line": 64
4836 @}
4837 @},
4838 @{
4839 "caret": @{
4840 "column": 10, "file": "bad-binary-ops.c", "line": 64
4841 @},
4842 "finish": @{
4843 "column": 21, "file": "bad-binary-ops.c", "line": 64
4844 @},
4845 "label": "S @{aka struct s@}"
4846 @},
4847 @{
4848 "caret": @{
4849 "column": 25, "file": "bad-binary-ops.c", "line": 64
4850 @},
4851 "finish": @{
4852 "column": 36, "file": "bad-binary-ops.c", "line": 64
4853 @},
4854 "label": "T @{aka struct t@}"
4855 @}
4856 ],
4857 "message": "invalid operands to binary + @dots{}"
4858 @}
4859 @end smallexample
4860
4861 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4862 consisting of half-open intervals, similar to the output of
4863 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4864 with a replacement fix-it hint:
4865
4866 @smallexample
4867 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4868 mean 'color'?
4869 8 | return ptr->colour;
4870 | ^~~~~~
4871 | color
4872 @end smallexample
4873
4874 @noindent
4875 might be printed in JSON form as:
4876
4877 @smallexample
4878 @{
4879 "children": [],
4880 "fixits": [
4881 @{
4882 "next": @{
4883 "column": 21,
4884 "file": "demo.c",
4885 "line": 8
4886 @},
4887 "start": @{
4888 "column": 15,
4889 "file": "demo.c",
4890 "line": 8
4891 @},
4892 "string": "color"
4893 @}
4894 ],
4895 "kind": "error",
4896 "locations": [
4897 @{
4898 "caret": @{
4899 "column": 15,
4900 "file": "demo.c",
4901 "line": 8
4902 @},
4903 "finish": @{
4904 "column": 20,
4905 "file": "demo.c",
4906 "line": 8
4907 @}
4908 @}
4909 ],
4910 "message": "\u2018struct s\u2019 has no member named @dots{}"
4911 @}
4912 @end smallexample
4913
4914 @noindent
4915 where the fix-it hint suggests replacing the text from @code{start} up
4916 to but not including @code{next} with @code{string}'s value. Deletions
4917 are expressed via an empty value for @code{string}, insertions by
4918 having @code{start} equal @code{next}.
4919
4920 If the diagnostic has a path of control-flow events associated with it,
4921 it has a @code{path} array of objects representing the events. Each
4922 event object has a @code{description} string, a @code{location} object,
4923 along with a @code{function} string and a @code{depth} number for
4924 representing interprocedural paths. The @code{function} represents the
4925 current function at that event, and the @code{depth} represents the
4926 stack depth relative to some baseline: the higher, the more frames are
4927 within the stack.
4928
4929 For example, the intraprocedural example shown for
4930 @option{-fdiagnostics-path-format=} might have this JSON for its path:
4931
4932 @smallexample
4933 "path": [
4934 @{
4935 "depth": 0,
4936 "description": "when 'PyList_New' fails, returning NULL",
4937 "function": "test",
4938 "location": @{
4939 "column": 10,
4940 "file": "test.c",
4941 "line": 25
4942 @}
4943 @},
4944 @{
4945 "depth": 0,
4946 "description": "when 'i < count'",
4947 "function": "test",
4948 "location": @{
4949 "column": 3,
4950 "file": "test.c",
4951 "line": 27
4952 @}
4953 @},
4954 @{
4955 "depth": 0,
4956 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4957 "function": "test",
4958 "location": @{
4959 "column": 5,
4960 "file": "test.c",
4961 "line": 29
4962 @}
4963 @}
4964 ]
4965 @end smallexample
4966
4967 @end table
4968
4969 @node Warning Options
4970 @section Options to Request or Suppress Warnings
4971 @cindex options to control warnings
4972 @cindex warning messages
4973 @cindex messages, warning
4974 @cindex suppressing warnings
4975
4976 Warnings are diagnostic messages that report constructions that
4977 are not inherently erroneous but that are risky or suggest there
4978 may have been an error.
4979
4980 The following language-independent options do not enable specific
4981 warnings but control the kinds of diagnostics produced by GCC@.
4982
4983 @table @gcctabopt
4984 @cindex syntax checking
4985 @item -fsyntax-only
4986 @opindex fsyntax-only
4987 Check the code for syntax errors, but don't do anything beyond that.
4988
4989 @item -fmax-errors=@var{n}
4990 @opindex fmax-errors
4991 Limits the maximum number of error messages to @var{n}, at which point
4992 GCC bails out rather than attempting to continue processing the source
4993 code. If @var{n} is 0 (the default), there is no limit on the number
4994 of error messages produced. If @option{-Wfatal-errors} is also
4995 specified, then @option{-Wfatal-errors} takes precedence over this
4996 option.
4997
4998 @item -w
4999 @opindex w
5000 Inhibit all warning messages.
5001
5002 @item -Werror
5003 @opindex Werror
5004 @opindex Wno-error
5005 Make all warnings into errors.
5006
5007 @item -Werror=
5008 @opindex Werror=
5009 @opindex Wno-error=
5010 Make the specified warning into an error. The specifier for a warning
5011 is appended; for example @option{-Werror=switch} turns the warnings
5012 controlled by @option{-Wswitch} into errors. This switch takes a
5013 negative form, to be used to negate @option{-Werror} for specific
5014 warnings; for example @option{-Wno-error=switch} makes
5015 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5016 is in effect.
5017
5018 The warning message for each controllable warning includes the
5019 option that controls the warning. That option can then be used with
5020 @option{-Werror=} and @option{-Wno-error=} as described above.
5021 (Printing of the option in the warning message can be disabled using the
5022 @option{-fno-diagnostics-show-option} flag.)
5023
5024 Note that specifying @option{-Werror=}@var{foo} automatically implies
5025 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5026 imply anything.
5027
5028 @item -Wfatal-errors
5029 @opindex Wfatal-errors
5030 @opindex Wno-fatal-errors
5031 This option causes the compiler to abort compilation on the first error
5032 occurred rather than trying to keep going and printing further error
5033 messages.
5034
5035 @end table
5036
5037 You can request many specific warnings with options beginning with
5038 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5039 implicit declarations. Each of these specific warning options also
5040 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5041 example, @option{-Wno-implicit}. This manual lists only one of the
5042 two forms, whichever is not the default. For further
5043 language-specific options also refer to @ref{C++ Dialect Options} and
5044 @ref{Objective-C and Objective-C++ Dialect Options}.
5045 Additional warnings can be produced by enabling the static analyzer;
5046 @xref{Static Analyzer Options}.
5047
5048 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5049 options, such as @option{-Wunused}, which may turn on further options,
5050 such as @option{-Wunused-value}. The combined effect of positive and
5051 negative forms is that more specific options have priority over less
5052 specific ones, independently of their position in the command-line. For
5053 options of the same specificity, the last one takes effect. Options
5054 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5055 as if they appeared at the end of the command-line.
5056
5057 When an unrecognized warning option is requested (e.g.,
5058 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5059 that the option is not recognized. However, if the @option{-Wno-} form
5060 is used, the behavior is slightly different: no diagnostic is
5061 produced for @option{-Wno-unknown-warning} unless other diagnostics
5062 are being produced. This allows the use of new @option{-Wno-} options
5063 with old compilers, but if something goes wrong, the compiler
5064 warns that an unrecognized option is present.
5065
5066 The effectiveness of some warnings depends on optimizations also being
5067 enabled. For example @option{-Wsuggest-final-types} is more effective
5068 with link-time optimization and @option{-Wmaybe-uninitialized} does not
5069 warn at all unless optimization is enabled.
5070
5071 @table @gcctabopt
5072 @item -Wpedantic
5073 @itemx -pedantic
5074 @opindex pedantic
5075 @opindex Wpedantic
5076 @opindex Wno-pedantic
5077 Issue all the warnings demanded by strict ISO C and ISO C++;
5078 reject all programs that use forbidden extensions, and some other
5079 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5080 version of the ISO C standard specified by any @option{-std} option used.
5081
5082 Valid ISO C and ISO C++ programs should compile properly with or without
5083 this option (though a rare few require @option{-ansi} or a
5084 @option{-std} option specifying the required version of ISO C)@. However,
5085 without this option, certain GNU extensions and traditional C and C++
5086 features are supported as well. With this option, they are rejected.
5087
5088 @option{-Wpedantic} does not cause warning messages for use of the
5089 alternate keywords whose names begin and end with @samp{__}. This alternate
5090 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5091 i.e. @samp{__intN__}.
5092 Pedantic warnings are also disabled in the expression that follows
5093 @code{__extension__}. However, only system header files should use
5094 these escape routes; application programs should avoid them.
5095 @xref{Alternate Keywords}.
5096
5097 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5098 C conformance. They soon find that it does not do quite what they want:
5099 it finds some non-ISO practices, but not all---only those for which
5100 ISO C @emph{requires} a diagnostic, and some others for which
5101 diagnostics have been added.
5102
5103 A feature to report any failure to conform to ISO C might be useful in
5104 some instances, but would require considerable additional work and would
5105 be quite different from @option{-Wpedantic}. We don't have plans to
5106 support such a feature in the near future.
5107
5108 Where the standard specified with @option{-std} represents a GNU
5109 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5110 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5111 extended dialect is based. Warnings from @option{-Wpedantic} are given
5112 where they are required by the base standard. (It does not make sense
5113 for such warnings to be given only for features not in the specified GNU
5114 C dialect, since by definition the GNU dialects of C include all
5115 features the compiler supports with the given option, and there would be
5116 nothing to warn about.)
5117
5118 @item -pedantic-errors
5119 @opindex pedantic-errors
5120 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5121 requires a diagnostic, in some cases where there is undefined behavior
5122 at compile-time and in some other cases that do not prevent compilation
5123 of programs that are valid according to the standard. This is not
5124 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5125 by this option and not enabled by the latter and vice versa.
5126
5127 @item -Wall
5128 @opindex Wall
5129 @opindex Wno-all
5130 This enables all the warnings about constructions that some users
5131 consider questionable, and that are easy to avoid (or modify to
5132 prevent the warning), even in conjunction with macros. This also
5133 enables some language-specific warnings described in @ref{C++ Dialect
5134 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5135
5136 @option{-Wall} turns on the following warning flags:
5137
5138 @gccoptlist{-Waddress @gol
5139 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
5140 -Wbool-compare @gol
5141 -Wbool-operation @gol
5142 -Wc++11-compat -Wc++14-compat @gol
5143 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
5144 -Wchar-subscripts @gol
5145 -Wcomment @gol
5146 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5147 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5148 -Wenum-conversion @r{in C/ObjC;} @gol
5149 -Wformat @gol
5150 -Wformat-overflow @gol
5151 -Wformat-truncation @gol
5152 -Wint-in-bool-context @gol
5153 -Wimplicit @r{(C and Objective-C only)} @gol
5154 -Wimplicit-int @r{(C and Objective-C only)} @gol
5155 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5156 -Winit-self @r{(only for C++)} @gol
5157 -Wlogical-not-parentheses @gol
5158 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
5159 -Wmaybe-uninitialized @gol
5160 -Wmemset-elt-size @gol
5161 -Wmemset-transposed-args @gol
5162 -Wmisleading-indentation @r{(only for C/C++)} @gol
5163 -Wmissing-attributes @gol
5164 -Wmissing-braces @r{(only for C/ObjC)} @gol
5165 -Wmultistatement-macros @gol
5166 -Wnarrowing @r{(only for C++)} @gol
5167 -Wnonnull @gol
5168 -Wnonnull-compare @gol
5169 -Wopenmp-simd @gol
5170 -Wparentheses @gol
5171 -Wpessimizing-move @r{(only for C++)} @gol
5172 -Wpointer-sign @gol
5173 -Wreorder @gol
5174 -Wrestrict @gol
5175 -Wreturn-type @gol
5176 -Wsequence-point @gol
5177 -Wsign-compare @r{(only in C++)} @gol
5178 -Wsizeof-pointer-div @gol
5179 -Wsizeof-pointer-memaccess @gol
5180 -Wstrict-aliasing @gol
5181 -Wstrict-overflow=1 @gol
5182 -Wswitch @gol
5183 -Wtautological-compare @gol
5184 -Wtrigraphs @gol
5185 -Wuninitialized @gol
5186 -Wunknown-pragmas @gol
5187 -Wunused-function @gol
5188 -Wunused-label @gol
5189 -Wunused-value @gol
5190 -Wunused-variable @gol
5191 -Wvolatile-register-var @gol
5192 -Wzero-length-bounds}
5193
5194 Note that some warning flags are not implied by @option{-Wall}. Some of
5195 them warn about constructions that users generally do not consider
5196 questionable, but which occasionally you might wish to check for;
5197 others warn about constructions that are necessary or hard to avoid in
5198 some cases, and there is no simple way to modify the code to suppress
5199 the warning. Some of them are enabled by @option{-Wextra} but many of
5200 them must be enabled individually.
5201
5202 @item -Wextra
5203 @opindex W
5204 @opindex Wextra
5205 @opindex Wno-extra
5206 This enables some extra warning flags that are not enabled by
5207 @option{-Wall}. (This option used to be called @option{-W}. The older
5208 name is still supported, but the newer name is more descriptive.)
5209
5210 @gccoptlist{-Wclobbered @gol
5211 -Wcast-function-type @gol
5212 -Wdeprecated-copy @r{(C++ only)} @gol
5213 -Wempty-body @gol
5214 -Wignored-qualifiers @gol
5215 -Wimplicit-fallthrough=3 @gol
5216 -Wmissing-field-initializers @gol
5217 -Wmissing-parameter-type @r{(C only)} @gol
5218 -Wold-style-declaration @r{(C only)} @gol
5219 -Woverride-init @gol
5220 -Wsign-compare @r{(C only)} @gol
5221 -Wstring-compare @gol
5222 -Wredundant-move @r{(only for C++)} @gol
5223 -Wtype-limits @gol
5224 -Wuninitialized @gol
5225 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
5226 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5227 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5228
5229
5230 The option @option{-Wextra} also prints warning messages for the
5231 following cases:
5232
5233 @itemize @bullet
5234
5235 @item
5236 A pointer is compared against integer zero with @code{<}, @code{<=},
5237 @code{>}, or @code{>=}.
5238
5239 @item
5240 (C++ only) An enumerator and a non-enumerator both appear in a
5241 conditional expression.
5242
5243 @item
5244 (C++ only) Ambiguous virtual bases.
5245
5246 @item
5247 (C++ only) Subscripting an array that has been declared @code{register}.
5248
5249 @item
5250 (C++ only) Taking the address of a variable that has been declared
5251 @code{register}.
5252
5253 @item
5254 (C++ only) A base class is not initialized in the copy constructor
5255 of a derived class.
5256
5257 @end itemize
5258
5259 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5260 @opindex Wabi
5261 @opindex Wno-abi
5262
5263 Warn about code affected by ABI changes. This includes code that may
5264 not be compatible with the vendor-neutral C++ ABI as well as the psABI
5265 for the particular target.
5266
5267 Since G++ now defaults to updating the ABI with each major release,
5268 normally @option{-Wabi} warns only about C++ ABI compatibility
5269 problems if there is a check added later in a release series for an
5270 ABI issue discovered since the initial release. @option{-Wabi} warns
5271 about more things if an older ABI version is selected (with
5272 @option{-fabi-version=@var{n}}).
5273
5274 @option{-Wabi} can also be used with an explicit version number to
5275 warn about C++ ABI compatibility with a particular @option{-fabi-version}
5276 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5277 @option{-fabi-version=2}.
5278
5279 If an explicit version number is provided and
5280 @option{-fabi-compat-version} is not specified, the version number
5281 from this option is used for compatibility aliases. If no explicit
5282 version number is provided with this option, but
5283 @option{-fabi-compat-version} is specified, that version number is
5284 used for C++ ABI warnings.
5285
5286 Although an effort has been made to warn about
5287 all such cases, there are probably some cases that are not warned about,
5288 even though G++ is generating incompatible code. There may also be
5289 cases where warnings are emitted even though the code that is generated
5290 is compatible.
5291
5292 You should rewrite your code to avoid these warnings if you are
5293 concerned about the fact that code generated by G++ may not be binary
5294 compatible with code generated by other compilers.
5295
5296 Known incompatibilities in @option{-fabi-version=2} (which was the
5297 default from GCC 3.4 to 4.9) include:
5298
5299 @itemize @bullet
5300
5301 @item
5302 A template with a non-type template parameter of reference type was
5303 mangled incorrectly:
5304 @smallexample
5305 extern int N;
5306 template <int &> struct S @{@};
5307 void n (S<N>) @{2@}
5308 @end smallexample
5309
5310 This was fixed in @option{-fabi-version=3}.
5311
5312 @item
5313 SIMD vector types declared using @code{__attribute ((vector_size))} were
5314 mangled in a non-standard way that does not allow for overloading of
5315 functions taking vectors of different sizes.
5316
5317 The mangling was changed in @option{-fabi-version=4}.
5318
5319 @item
5320 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5321 qualifiers, and @code{decltype} of a plain declaration was folded away.
5322
5323 These mangling issues were fixed in @option{-fabi-version=5}.
5324
5325 @item
5326 Scoped enumerators passed as arguments to a variadic function are
5327 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5328 On most targets this does not actually affect the parameter passing
5329 ABI, as there is no way to pass an argument smaller than @code{int}.
5330
5331 Also, the ABI changed the mangling of template argument packs,
5332 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5333 a class scope function used as a template argument.
5334
5335 These issues were corrected in @option{-fabi-version=6}.
5336
5337 @item
5338 Lambdas in default argument scope were mangled incorrectly, and the
5339 ABI changed the mangling of @code{nullptr_t}.
5340
5341 These issues were corrected in @option{-fabi-version=7}.
5342
5343 @item
5344 When mangling a function type with function-cv-qualifiers, the
5345 un-qualified function type was incorrectly treated as a substitution
5346 candidate.
5347
5348 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5349
5350 @item
5351 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5352 unaligned accesses. Note that this did not affect the ABI of a
5353 function with a @code{nullptr_t} parameter, as parameters have a
5354 minimum alignment.
5355
5356 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5357
5358 @item
5359 Target-specific attributes that affect the identity of a type, such as
5360 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5361 did not affect the mangled name, leading to name collisions when
5362 function pointers were used as template arguments.
5363
5364 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5365
5366 @end itemize
5367
5368 This option also enables warnings about psABI-related changes.
5369 The known psABI changes at this point include:
5370
5371 @itemize @bullet
5372
5373 @item
5374 For SysV/x86-64, unions with @code{long double} members are
5375 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5376 the case. For example:
5377
5378 @smallexample
5379 union U @{
5380 long double ld;
5381 int i;
5382 @};
5383 @end smallexample
5384
5385 @noindent
5386 @code{union U} is now always passed in memory.
5387
5388 @end itemize
5389
5390 @item -Wchar-subscripts
5391 @opindex Wchar-subscripts
5392 @opindex Wno-char-subscripts
5393 Warn if an array subscript has type @code{char}. This is a common cause
5394 of error, as programmers often forget that this type is signed on some
5395 machines.
5396 This warning is enabled by @option{-Wall}.
5397
5398 @item -Wno-coverage-mismatch
5399 @opindex Wno-coverage-mismatch
5400 @opindex Wcoverage-mismatch
5401 Warn if feedback profiles do not match when using the
5402 @option{-fprofile-use} option.
5403 If a source file is changed between compiling with @option{-fprofile-generate}
5404 and with @option{-fprofile-use}, the files with the profile feedback can fail
5405 to match the source file and GCC cannot use the profile feedback
5406 information. By default, this warning is enabled and is treated as an
5407 error. @option{-Wno-coverage-mismatch} can be used to disable the
5408 warning or @option{-Wno-error=coverage-mismatch} can be used to
5409 disable the error. Disabling the error for this warning can result in
5410 poorly optimized code and is useful only in the
5411 case of very minor changes such as bug fixes to an existing code-base.
5412 Completely disabling the warning is not recommended.
5413
5414 @item -Wno-cpp
5415 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5416 @opindex Wno-cpp
5417 @opindex Wcpp
5418 Suppress warning messages emitted by @code{#warning} directives.
5419
5420 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5421 @opindex Wdouble-promotion
5422 @opindex Wno-double-promotion
5423 Give a warning when a value of type @code{float} is implicitly
5424 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5425 floating-point unit implement @code{float} in hardware, but emulate
5426 @code{double} in software. On such a machine, doing computations
5427 using @code{double} values is much more expensive because of the
5428 overhead required for software emulation.
5429
5430 It is easy to accidentally do computations with @code{double} because
5431 floating-point literals are implicitly of type @code{double}. For
5432 example, in:
5433 @smallexample
5434 @group
5435 float area(float radius)
5436 @{
5437 return 3.14159 * radius * radius;
5438 @}
5439 @end group
5440 @end smallexample
5441 the compiler performs the entire computation with @code{double}
5442 because the floating-point literal is a @code{double}.
5443
5444 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5445 @opindex Wduplicate-decl-specifier
5446 @opindex Wno-duplicate-decl-specifier
5447 Warn if a declaration has duplicate @code{const}, @code{volatile},
5448 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5449 @option{-Wall}.
5450
5451 @item -Wformat
5452 @itemx -Wformat=@var{n}
5453 @opindex Wformat
5454 @opindex Wno-format
5455 @opindex ffreestanding
5456 @opindex fno-builtin
5457 @opindex Wformat=
5458 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5459 the arguments supplied have types appropriate to the format string
5460 specified, and that the conversions specified in the format string make
5461 sense. This includes standard functions, and others specified by format
5462 attributes (@pxref{Function Attributes}), in the @code{printf},
5463 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5464 not in the C standard) families (or other target-specific families).
5465 Which functions are checked without format attributes having been
5466 specified depends on the standard version selected, and such checks of
5467 functions without the attribute specified are disabled by
5468 @option{-ffreestanding} or @option{-fno-builtin}.
5469
5470 The formats are checked against the format features supported by GNU
5471 libc version 2.2. These include all ISO C90 and C99 features, as well
5472 as features from the Single Unix Specification and some BSD and GNU
5473 extensions. Other library implementations may not support all these
5474 features; GCC does not support warning about features that go beyond a
5475 particular library's limitations. However, if @option{-Wpedantic} is used
5476 with @option{-Wformat}, warnings are given about format features not
5477 in the selected standard version (but not for @code{strfmon} formats,
5478 since those are not in any version of the C standard). @xref{C Dialect
5479 Options,,Options Controlling C Dialect}.
5480
5481 @table @gcctabopt
5482 @item -Wformat=1
5483 @itemx -Wformat
5484 @opindex Wformat
5485 @opindex Wformat=1
5486 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5487 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5488 @option{-Wformat} also checks for null format arguments for several
5489 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5490 aspects of this level of format checking can be disabled by the
5491 options: @option{-Wno-format-contains-nul},
5492 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5493 @option{-Wformat} is enabled by @option{-Wall}.
5494
5495 @item -Wformat=2
5496 @opindex Wformat=2
5497 Enable @option{-Wformat} plus additional format checks. Currently
5498 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5499 -Wformat-y2k}.
5500 @end table
5501
5502 @item -Wno-format-contains-nul
5503 @opindex Wno-format-contains-nul
5504 @opindex Wformat-contains-nul
5505 If @option{-Wformat} is specified, do not warn about format strings that
5506 contain NUL bytes.
5507
5508 @item -Wno-format-extra-args
5509 @opindex Wno-format-extra-args
5510 @opindex Wformat-extra-args
5511 If @option{-Wformat} is specified, do not warn about excess arguments to a
5512 @code{printf} or @code{scanf} format function. The C standard specifies
5513 that such arguments are ignored.
5514
5515 Where the unused arguments lie between used arguments that are
5516 specified with @samp{$} operand number specifications, normally
5517 warnings are still given, since the implementation could not know what
5518 type to pass to @code{va_arg} to skip the unused arguments. However,
5519 in the case of @code{scanf} formats, this option suppresses the
5520 warning if the unused arguments are all pointers, since the Single
5521 Unix Specification says that such unused arguments are allowed.
5522
5523 @item -Wformat-overflow
5524 @itemx -Wformat-overflow=@var{level}
5525 @opindex Wformat-overflow
5526 @opindex Wno-format-overflow
5527 Warn about calls to formatted input/output functions such as @code{sprintf}
5528 and @code{vsprintf} that might overflow the destination buffer. When the
5529 exact number of bytes written by a format directive cannot be determined
5530 at compile-time it is estimated based on heuristics that depend on the
5531 @var{level} argument and on optimization. While enabling optimization
5532 will in most cases improve the accuracy of the warning, it may also
5533 result in false positives.
5534
5535 @table @gcctabopt
5536 @item -Wformat-overflow
5537 @itemx -Wformat-overflow=1
5538 @opindex Wformat-overflow
5539 @opindex Wno-format-overflow
5540 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5541 employs a conservative approach that warns only about calls that most
5542 likely overflow the buffer. At this level, numeric arguments to format
5543 directives with unknown values are assumed to have the value of one, and
5544 strings of unknown length to be empty. Numeric arguments that are known
5545 to be bounded to a subrange of their type, or string arguments whose output
5546 is bounded either by their directive's precision or by a finite set of
5547 string literals, are assumed to take on the value within the range that
5548 results in the most bytes on output. For example, the call to @code{sprintf}
5549 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5550 the terminating NUL character (@code{'\0'}) appended by the function
5551 to the destination buffer will be written past its end. Increasing
5552 the size of the buffer by a single byte is sufficient to avoid the
5553 warning, though it may not be sufficient to avoid the overflow.
5554
5555 @smallexample
5556 void f (int a, int b)
5557 @{
5558 char buf [13];
5559 sprintf (buf, "a = %i, b = %i\n", a, b);
5560 @}
5561 @end smallexample
5562
5563 @item -Wformat-overflow=2
5564 Level @var{2} warns also about calls that might overflow the destination
5565 buffer given an argument of sufficient length or magnitude. At level
5566 @var{2}, unknown numeric arguments are assumed to have the minimum
5567 representable value for signed types with a precision greater than 1, and
5568 the maximum representable value otherwise. Unknown string arguments whose
5569 length cannot be assumed to be bounded either by the directive's precision,
5570 or by a finite set of string literals they may evaluate to, or the character
5571 array they may point to, are assumed to be 1 character long.
5572
5573 At level @var{2}, the call in the example above is again diagnosed, but
5574 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5575 @code{%i} directive will write some of its digits beyond the end of
5576 the destination buffer. To make the call safe regardless of the values
5577 of the two variables, the size of the destination buffer must be increased
5578 to at least 34 bytes. GCC includes the minimum size of the buffer in
5579 an informational note following the warning.
5580
5581 An alternative to increasing the size of the destination buffer is to
5582 constrain the range of formatted values. The maximum length of string
5583 arguments can be bounded by specifying the precision in the format
5584 directive. When numeric arguments of format directives can be assumed
5585 to be bounded by less than the precision of their type, choosing
5586 an appropriate length modifier to the format specifier will reduce
5587 the required buffer size. For example, if @var{a} and @var{b} in the
5588 example above can be assumed to be within the precision of
5589 the @code{short int} type then using either the @code{%hi} format
5590 directive or casting the argument to @code{short} reduces the maximum
5591 required size of the buffer to 24 bytes.
5592
5593 @smallexample
5594 void f (int a, int b)
5595 @{
5596 char buf [23];
5597 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5598 @}
5599 @end smallexample
5600 @end table
5601
5602 @item -Wno-format-zero-length
5603 @opindex Wno-format-zero-length
5604 @opindex Wformat-zero-length
5605 If @option{-Wformat} is specified, do not warn about zero-length formats.
5606 The C standard specifies that zero-length formats are allowed.
5607
5608 @item -Wformat-nonliteral
5609 @opindex Wformat-nonliteral
5610 @opindex Wno-format-nonliteral
5611 If @option{-Wformat} is specified, also warn if the format string is not a
5612 string literal and so cannot be checked, unless the format function
5613 takes its format arguments as a @code{va_list}.
5614
5615 @item -Wformat-security
5616 @opindex Wformat-security
5617 @opindex Wno-format-security
5618 If @option{-Wformat} is specified, also warn about uses of format
5619 functions that represent possible security problems. At present, this
5620 warns about calls to @code{printf} and @code{scanf} functions where the
5621 format string is not a string literal and there are no format arguments,
5622 as in @code{printf (foo);}. This may be a security hole if the format
5623 string came from untrusted input and contains @samp{%n}. (This is
5624 currently a subset of what @option{-Wformat-nonliteral} warns about, but
5625 in future warnings may be added to @option{-Wformat-security} that are not
5626 included in @option{-Wformat-nonliteral}.)
5627
5628 @item -Wformat-signedness
5629 @opindex Wformat-signedness
5630 @opindex Wno-format-signedness
5631 If @option{-Wformat} is specified, also warn if the format string
5632 requires an unsigned argument and the argument is signed and vice versa.
5633
5634 @item -Wformat-truncation
5635 @itemx -Wformat-truncation=@var{level}
5636 @opindex Wformat-truncation
5637 @opindex Wno-format-truncation
5638 Warn about calls to formatted input/output functions such as @code{snprintf}
5639 and @code{vsnprintf} that might result in output truncation. When the exact
5640 number of bytes written by a format directive cannot be determined at
5641 compile-time it is estimated based on heuristics that depend on
5642 the @var{level} argument and on optimization. While enabling optimization
5643 will in most cases improve the accuracy of the warning, it may also result
5644 in false positives. Except as noted otherwise, the option uses the same
5645 logic @option{-Wformat-overflow}.
5646
5647 @table @gcctabopt
5648 @item -Wformat-truncation
5649 @itemx -Wformat-truncation=1
5650 @opindex Wformat-truncation
5651 @opindex Wno-format-truncation
5652 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5653 employs a conservative approach that warns only about calls to bounded
5654 functions whose return value is unused and that will most likely result
5655 in output truncation.
5656
5657 @item -Wformat-truncation=2
5658 Level @var{2} warns also about calls to bounded functions whose return
5659 value is used and that might result in truncation given an argument of
5660 sufficient length or magnitude.
5661 @end table
5662
5663 @item -Wformat-y2k
5664 @opindex Wformat-y2k
5665 @opindex Wno-format-y2k
5666 If @option{-Wformat} is specified, also warn about @code{strftime}
5667 formats that may yield only a two-digit year.
5668
5669 @item -Wnonnull
5670 @opindex Wnonnull
5671 @opindex Wno-nonnull
5672 Warn about passing a null pointer for arguments marked as
5673 requiring a non-null value by the @code{nonnull} function attribute.
5674
5675 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
5676 can be disabled with the @option{-Wno-nonnull} option.
5677
5678 @item -Wnonnull-compare
5679 @opindex Wnonnull-compare
5680 @opindex Wno-nonnull-compare
5681 Warn when comparing an argument marked with the @code{nonnull}
5682 function attribute against null inside the function.
5683
5684 @option{-Wnonnull-compare} is included in @option{-Wall}. It
5685 can be disabled with the @option{-Wno-nonnull-compare} option.
5686
5687 @item -Wnull-dereference
5688 @opindex Wnull-dereference
5689 @opindex Wno-null-dereference
5690 Warn if the compiler detects paths that trigger erroneous or
5691 undefined behavior due to dereferencing a null pointer. This option
5692 is only active when @option{-fdelete-null-pointer-checks} is active,
5693 which is enabled by optimizations in most targets. The precision of
5694 the warnings depends on the optimization options used.
5695
5696 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5697 @opindex Winit-self
5698 @opindex Wno-init-self
5699 Warn about uninitialized variables that are initialized with themselves.
5700 Note this option can only be used with the @option{-Wuninitialized} option.
5701
5702 For example, GCC warns about @code{i} being uninitialized in the
5703 following snippet only when @option{-Winit-self} has been specified:
5704 @smallexample
5705 @group
5706 int f()
5707 @{
5708 int i = i;
5709 return i;
5710 @}
5711 @end group
5712 @end smallexample
5713
5714 This warning is enabled by @option{-Wall} in C++.
5715
5716 @item -Wno-implicit-int @r{(C and Objective-C only)}
5717 @opindex Wimplicit-int
5718 @opindex Wno-implicit-int
5719 This option controls warnings when a declaration does not specify a type.
5720 This warning is enabled by default in C99 and later dialects of C,
5721 and also by @option{-Wall}.
5722
5723 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
5724 @opindex Wimplicit-function-declaration
5725 @opindex Wno-implicit-function-declaration
5726 This option controls warnings when a function is used before being declared.
5727 This warning is enabled by default in C99 and later dialects of C,
5728 and also by @option{-Wall}.
5729 The warning is made into an error by @option{-pedantic-errors}.
5730
5731 @item -Wimplicit @r{(C and Objective-C only)}
5732 @opindex Wimplicit
5733 @opindex Wno-implicit
5734 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5735 This warning is enabled by @option{-Wall}.
5736
5737 @item -Wimplicit-fallthrough
5738 @opindex Wimplicit-fallthrough
5739 @opindex Wno-implicit-fallthrough
5740 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5741 and @option{-Wno-implicit-fallthrough} is the same as
5742 @option{-Wimplicit-fallthrough=0}.
5743
5744 @item -Wimplicit-fallthrough=@var{n}
5745 @opindex Wimplicit-fallthrough=
5746 Warn when a switch case falls through. For example:
5747
5748 @smallexample
5749 @group
5750 switch (cond)
5751 @{
5752 case 1:
5753 a = 1;
5754 break;
5755 case 2:
5756 a = 2;
5757 case 3:
5758 a = 3;
5759 break;
5760 @}
5761 @end group
5762 @end smallexample
5763
5764 This warning does not warn when the last statement of a case cannot
5765 fall through, e.g. when there is a return statement or a call to function
5766 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
5767 also takes into account control flow statements, such as ifs, and only
5768 warns when appropriate. E.g.@:
5769
5770 @smallexample
5771 @group
5772 switch (cond)
5773 @{
5774 case 1:
5775 if (i > 3) @{
5776 bar (5);
5777 break;
5778 @} else if (i < 1) @{
5779 bar (0);
5780 @} else
5781 return;
5782 default:
5783 @dots{}
5784 @}
5785 @end group
5786 @end smallexample
5787
5788 Since there are occasions where a switch case fall through is desirable,
5789 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5790 to be used along with a null statement to suppress this warning that
5791 would normally occur:
5792
5793 @smallexample
5794 @group
5795 switch (cond)
5796 @{
5797 case 1:
5798 bar (0);
5799 __attribute__ ((fallthrough));
5800 default:
5801 @dots{}
5802 @}
5803 @end group
5804 @end smallexample
5805
5806 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5807 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
5808 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5809 Instead of these attributes, it is also possible to add a fallthrough comment
5810 to silence the warning. The whole body of the C or C++ style comment should
5811 match the given regular expressions listed below. The option argument @var{n}
5812 specifies what kind of comments are accepted:
5813
5814 @itemize @bullet
5815
5816 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5817
5818 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5819 expression, any comment is used as fallthrough comment.
5820
5821 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
5822 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5823
5824 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5825 following regular expressions:
5826
5827 @itemize @bullet
5828
5829 @item @code{-fallthrough}
5830
5831 @item @code{@@fallthrough@@}
5832
5833 @item @code{lint -fallthrough[ \t]*}
5834
5835 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5836
5837 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5838
5839 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5840
5841 @end itemize
5842
5843 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5844 following regular expressions:
5845
5846 @itemize @bullet
5847
5848 @item @code{-fallthrough}
5849
5850 @item @code{@@fallthrough@@}
5851
5852 @item @code{lint -fallthrough[ \t]*}
5853
5854 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5855
5856 @end itemize
5857
5858 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5859 fallthrough comments, only attributes disable the warning.
5860
5861 @end itemize
5862
5863 The comment needs to be followed after optional whitespace and other comments
5864 by @code{case} or @code{default} keywords or by a user label that precedes some
5865 @code{case} or @code{default} label.
5866
5867 @smallexample
5868 @group
5869 switch (cond)
5870 @{
5871 case 1:
5872 bar (0);
5873 /* FALLTHRU */
5874 default:
5875 @dots{}
5876 @}
5877 @end group
5878 @end smallexample
5879
5880 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5881
5882 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5883 @opindex Wif-not-aligned
5884 @opindex Wno-if-not-aligned
5885 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
5886 should be issued. These warnings are enabled by default.
5887
5888 @item -Wignored-qualifiers @r{(C and C++ only)}
5889 @opindex Wignored-qualifiers
5890 @opindex Wno-ignored-qualifiers
5891 Warn if the return type of a function has a type qualifier
5892 such as @code{const}. For ISO C such a type qualifier has no effect,
5893 since the value returned by a function is not an lvalue.
5894 For C++, the warning is only emitted for scalar types or @code{void}.
5895 ISO C prohibits qualified @code{void} return types on function
5896 definitions, so such return types always receive a warning
5897 even without this option.
5898
5899 This warning is also enabled by @option{-Wextra}.
5900
5901 @item -Wno-ignored-attributes @r{(C and C++ only)}
5902 @opindex Wignored-attributes
5903 @opindex Wno-ignored-attributes
5904 This option controls warnings when an attribute is ignored.
5905 This is different from the
5906 @option{-Wattributes} option in that it warns whenever the compiler decides
5907 to drop an attribute, not that the attribute is either unknown, used in a
5908 wrong place, etc. This warning is enabled by default.
5909
5910 @item -Wmain
5911 @opindex Wmain
5912 @opindex Wno-main
5913 Warn if the type of @code{main} is suspicious. @code{main} should be
5914 a function with external linkage, returning int, taking either zero
5915 arguments, two, or three arguments of appropriate types. This warning
5916 is enabled by default in C++ and is enabled by either @option{-Wall}
5917 or @option{-Wpedantic}.
5918
5919 @item -Wmisleading-indentation @r{(C and C++ only)}
5920 @opindex Wmisleading-indentation
5921 @opindex Wno-misleading-indentation
5922 Warn when the indentation of the code does not reflect the block structure.
5923 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5924 @code{for} clauses with a guarded statement that does not use braces,
5925 followed by an unguarded statement with the same indentation.
5926
5927 In the following example, the call to ``bar'' is misleadingly indented as
5928 if it were guarded by the ``if'' conditional.
5929
5930 @smallexample
5931 if (some_condition ())
5932 foo ();
5933 bar (); /* Gotcha: this is not guarded by the "if". */
5934 @end smallexample
5935
5936 In the case of mixed tabs and spaces, the warning uses the
5937 @option{-ftabstop=} option to determine if the statements line up
5938 (defaulting to 8).
5939
5940 The warning is not issued for code involving multiline preprocessor logic
5941 such as the following example.
5942
5943 @smallexample
5944 if (flagA)
5945 foo (0);
5946 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5947 if (flagB)
5948 #endif
5949 foo (1);
5950 @end smallexample
5951
5952 The warning is not issued after a @code{#line} directive, since this
5953 typically indicates autogenerated code, and no assumptions can be made
5954 about the layout of the file that the directive references.
5955
5956 This warning is enabled by @option{-Wall} in C and C++.
5957
5958 @item -Wmissing-attributes
5959 @opindex Wmissing-attributes
5960 @opindex Wno-missing-attributes
5961 Warn when a declaration of a function is missing one or more attributes
5962 that a related function is declared with and whose absence may adversely
5963 affect the correctness or efficiency of generated code. For example,
5964 the warning is issued for declarations of aliases that use attributes
5965 to specify less restrictive requirements than those of their targets.
5966 This typically represents a potential optimization opportunity.
5967 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5968 issued when the alias is more restrictive than the target, which could
5969 lead to incorrect code generation.
5970 Attributes considered include @code{alloc_align}, @code{alloc_size},
5971 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5972 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5973 @code{returns_nonnull}, and @code{returns_twice}.
5974
5975 In C++, the warning is issued when an explicit specialization of a primary
5976 template declared with attribute @code{alloc_align}, @code{alloc_size},
5977 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5978 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5979 @code{error}, and @code{warning} suppress the warning.
5980 (@pxref{Function Attributes}).
5981
5982 You can use the @code{copy} attribute to apply the same
5983 set of attributes to a declaration as that on another declaration without
5984 explicitly enumerating the attributes. This attribute can be applied
5985 to declarations of functions (@pxref{Common Function Attributes}),
5986 variables (@pxref{Common Variable Attributes}), or types
5987 (@pxref{Common Type Attributes}).
5988
5989 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5990
5991 For example, since the declaration of the primary function template
5992 below makes use of both attribute @code{malloc} and @code{alloc_size}
5993 the declaration of the explicit specialization of the template is
5994 diagnosed because it is missing one of the attributes.
5995
5996 @smallexample
5997 template <class T>
5998 T* __attribute__ ((malloc, alloc_size (1)))
5999 allocate (size_t);
6000
6001 template <>
6002 void* __attribute__ ((malloc)) // missing alloc_size
6003 allocate<void> (size_t);
6004 @end smallexample
6005
6006 @item -Wmissing-braces
6007 @opindex Wmissing-braces
6008 @opindex Wno-missing-braces
6009 Warn if an aggregate or union initializer is not fully bracketed. In
6010 the following example, the initializer for @code{a} is not fully
6011 bracketed, but that for @code{b} is fully bracketed.
6012
6013 @smallexample
6014 int a[2][2] = @{ 0, 1, 2, 3 @};
6015 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6016 @end smallexample
6017
6018 This warning is enabled by @option{-Wall}.
6019
6020 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
6021 @opindex Wmissing-include-dirs
6022 @opindex Wno-missing-include-dirs
6023 Warn if a user-supplied include directory does not exist.
6024
6025 @item -Wno-missing-profile
6026 @opindex Wmissing-profile
6027 @opindex Wno-missing-profile
6028 This option controls warnings if feedback profiles are missing when using the
6029 @option{-fprofile-use} option.
6030 This option diagnoses those cases where a new function or a new file is added
6031 between compiling with @option{-fprofile-generate} and with
6032 @option{-fprofile-use}, without regenerating the profiles.
6033 In these cases, the profile feedback data files do not contain any
6034 profile feedback information for
6035 the newly added function or file respectively. Also, in the case when profile
6036 count data (.gcda) files are removed, GCC cannot use any profile feedback
6037 information. In all these cases, warnings are issued to inform you that a
6038 profile generation step is due.
6039 Ignoring the warning can result in poorly optimized code.
6040 @option{-Wno-missing-profile} can be used to
6041 disable the warning, but this is not recommended and should be done only
6042 when non-existent profile data is justified.
6043
6044 @item -Wmultistatement-macros
6045 @opindex Wmultistatement-macros
6046 @opindex Wno-multistatement-macros
6047 Warn about unsafe multiple statement macros that appear to be guarded
6048 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6049 @code{while}, in which only the first statement is actually guarded after
6050 the macro is expanded.
6051
6052 For example:
6053
6054 @smallexample
6055 #define DOIT x++; y++
6056 if (c)
6057 DOIT;
6058 @end smallexample
6059
6060 will increment @code{y} unconditionally, not just when @code{c} holds.
6061 The can usually be fixed by wrapping the macro in a do-while loop:
6062 @smallexample
6063 #define DOIT do @{ x++; y++; @} while (0)
6064 if (c)
6065 DOIT;
6066 @end smallexample
6067
6068 This warning is enabled by @option{-Wall} in C and C++.
6069
6070 @item -Wparentheses
6071 @opindex Wparentheses
6072 @opindex Wno-parentheses
6073 Warn if parentheses are omitted in certain contexts, such
6074 as when there is an assignment in a context where a truth value
6075 is expected, or when operators are nested whose precedence people
6076 often get confused about.
6077
6078 Also warn if a comparison like @code{x<=y<=z} appears; this is
6079 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6080 interpretation from that of ordinary mathematical notation.
6081
6082 Also warn for dangerous uses of the GNU extension to
6083 @code{?:} with omitted middle operand. When the condition
6084 in the @code{?}: operator is a boolean expression, the omitted value is
6085 always 1. Often programmers expect it to be a value computed
6086 inside the conditional expression instead.
6087
6088 For C++ this also warns for some cases of unnecessary parentheses in
6089 declarations, which can indicate an attempt at a function call instead
6090 of a declaration:
6091 @smallexample
6092 @{
6093 // Declares a local variable called mymutex.
6094 std::unique_lock<std::mutex> (mymutex);
6095 // User meant std::unique_lock<std::mutex> lock (mymutex);
6096 @}
6097 @end smallexample
6098
6099 This warning is enabled by @option{-Wall}.
6100
6101 @item -Wsequence-point
6102 @opindex Wsequence-point
6103 @opindex Wno-sequence-point
6104 Warn about code that may have undefined semantics because of violations
6105 of sequence point rules in the C and C++ standards.
6106
6107 The C and C++ standards define the order in which expressions in a C/C++
6108 program are evaluated in terms of @dfn{sequence points}, which represent
6109 a partial ordering between the execution of parts of the program: those
6110 executed before the sequence point, and those executed after it. These
6111 occur after the evaluation of a full expression (one which is not part
6112 of a larger expression), after the evaluation of the first operand of a
6113 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6114 function is called (but after the evaluation of its arguments and the
6115 expression denoting the called function), and in certain other places.
6116 Other than as expressed by the sequence point rules, the order of
6117 evaluation of subexpressions of an expression is not specified. All
6118 these rules describe only a partial order rather than a total order,
6119 since, for example, if two functions are called within one expression
6120 with no sequence point between them, the order in which the functions
6121 are called is not specified. However, the standards committee have
6122 ruled that function calls do not overlap.
6123
6124 It is not specified when between sequence points modifications to the
6125 values of objects take effect. Programs whose behavior depends on this
6126 have undefined behavior; the C and C++ standards specify that ``Between
6127 the previous and next sequence point an object shall have its stored
6128 value modified at most once by the evaluation of an expression.
6129 Furthermore, the prior value shall be read only to determine the value
6130 to be stored.''. If a program breaks these rules, the results on any
6131 particular implementation are entirely unpredictable.
6132
6133 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6134 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
6135 diagnosed by this option, and it may give an occasional false positive
6136 result, but in general it has been found fairly effective at detecting
6137 this sort of problem in programs.
6138
6139 The C++17 standard will define the order of evaluation of operands in
6140 more cases: in particular it requires that the right-hand side of an
6141 assignment be evaluated before the left-hand side, so the above
6142 examples are no longer undefined. But this option will still warn
6143 about them, to help people avoid writing code that is undefined in C
6144 and earlier revisions of C++.
6145
6146 The standard is worded confusingly, therefore there is some debate
6147 over the precise meaning of the sequence point rules in subtle cases.
6148 Links to discussions of the problem, including proposed formal
6149 definitions, may be found on the GCC readings page, at
6150 @uref{http://gcc.gnu.org/@/readings.html}.
6151
6152 This warning is enabled by @option{-Wall} for C and C++.
6153
6154 @item -Wno-return-local-addr
6155 @opindex Wno-return-local-addr
6156 @opindex Wreturn-local-addr
6157 Do not warn about returning a pointer (or in C++, a reference) to a
6158 variable that goes out of scope after the function returns.
6159
6160 @item -Wreturn-type
6161 @opindex Wreturn-type
6162 @opindex Wno-return-type
6163 Warn whenever a function is defined with a return type that defaults
6164 to @code{int}. Also warn about any @code{return} statement with no
6165 return value in a function whose return type is not @code{void}
6166 (falling off the end of the function body is considered returning
6167 without a value).
6168
6169 For C only, warn about a @code{return} statement with an expression in a
6170 function whose return type is @code{void}, unless the expression type is
6171 also @code{void}. As a GNU extension, the latter case is accepted
6172 without a warning unless @option{-Wpedantic} is used. Attempting
6173 to use the return value of a non-@code{void} function other than @code{main}
6174 that flows off the end by reaching the closing curly brace that terminates
6175 the function is undefined.
6176
6177 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6178 than @code{main} results in undefined behavior even when the value of
6179 the function is not used.
6180
6181 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6182
6183 @item -Wno-shift-count-negative
6184 @opindex Wshift-count-negative
6185 @opindex Wno-shift-count-negative
6186 Controls warnings if a shift count is negative.
6187 This warning is enabled by default.
6188
6189 @item -Wno-shift-count-overflow
6190 @opindex Wshift-count-overflow
6191 @opindex Wno-shift-count-overflow
6192 Controls warnings if a shift count is greater than or equal to the bit width
6193 of the type. This warning is enabled by default.
6194
6195 @item -Wshift-negative-value
6196 @opindex Wshift-negative-value
6197 @opindex Wno-shift-negative-value
6198 Warn if left shifting a negative value. This warning is enabled by
6199 @option{-Wextra} in C99 and C++11 modes (and newer).
6200
6201 @item -Wno-shift-overflow
6202 @itemx -Wshift-overflow=@var{n}
6203 @opindex Wshift-overflow
6204 @opindex Wno-shift-overflow
6205 These options control warnings about left shift overflows.
6206
6207 @table @gcctabopt
6208 @item -Wshift-overflow=1
6209 This is the warning level of @option{-Wshift-overflow} and is enabled
6210 by default in C99 and C++11 modes (and newer). This warning level does
6211 not warn about left-shifting 1 into the sign bit. (However, in C, such
6212 an overflow is still rejected in contexts where an integer constant expression
6213 is required.) No warning is emitted in C++2A mode (and newer), as signed left
6214 shifts always wrap.
6215
6216 @item -Wshift-overflow=2
6217 This warning level also warns about left-shifting 1 into the sign bit,
6218 unless C++14 mode (or newer) is active.
6219 @end table
6220
6221 @item -Wswitch
6222 @opindex Wswitch
6223 @opindex Wno-switch
6224 Warn whenever a @code{switch} statement has an index of enumerated type
6225 and lacks a @code{case} for one or more of the named codes of that
6226 enumeration. (The presence of a @code{default} label prevents this
6227 warning.) @code{case} labels outside the enumeration range also
6228 provoke warnings when this option is used (even if there is a
6229 @code{default} label).
6230 This warning is enabled by @option{-Wall}.
6231
6232 @item -Wswitch-default
6233 @opindex Wswitch-default
6234 @opindex Wno-switch-default
6235 Warn whenever a @code{switch} statement does not have a @code{default}
6236 case.
6237
6238 @item -Wswitch-enum
6239 @opindex Wswitch-enum
6240 @opindex Wno-switch-enum
6241 Warn whenever a @code{switch} statement has an index of enumerated type
6242 and lacks a @code{case} for one or more of the named codes of that
6243 enumeration. @code{case} labels outside the enumeration range also
6244 provoke warnings when this option is used. The only difference
6245 between @option{-Wswitch} and this option is that this option gives a
6246 warning about an omitted enumeration code even if there is a
6247 @code{default} label.
6248
6249 @item -Wno-switch-bool
6250 @opindex Wswitch-bool
6251 @opindex Wno-switch-bool
6252 Do not warn when a @code{switch} statement has an index of boolean type
6253 and the case values are outside the range of a boolean type.
6254 It is possible to suppress this warning by casting the controlling
6255 expression to a type other than @code{bool}. For example:
6256 @smallexample
6257 @group
6258 switch ((int) (a == 4))
6259 @{
6260 @dots{}
6261 @}
6262 @end group
6263 @end smallexample
6264 This warning is enabled by default for C and C++ programs.
6265
6266 @item -Wno-switch-outside-range
6267 @opindex Wswitch-outside-range
6268 @opindex Wno-switch-outside-range
6269 This option controls warnings when a @code{switch} case has a value
6270 that is outside of its
6271 respective type range. This warning is enabled by default for
6272 C and C++ programs.
6273
6274 @item -Wno-switch-unreachable
6275 @opindex Wswitch-unreachable
6276 @opindex Wno-switch-unreachable
6277 Do not warn when a @code{switch} statement contains statements between the
6278 controlling expression and the first case label, which will never be
6279 executed. For example:
6280 @smallexample
6281 @group
6282 switch (cond)
6283 @{
6284 i = 15;
6285 @dots{}
6286 case 5:
6287 @dots{}
6288 @}
6289 @end group
6290 @end smallexample
6291 @option{-Wswitch-unreachable} does not warn if the statement between the
6292 controlling expression and the first case label is just a declaration:
6293 @smallexample
6294 @group
6295 switch (cond)
6296 @{
6297 int i;
6298 @dots{}
6299 case 5:
6300 i = 5;
6301 @dots{}
6302 @}
6303 @end group
6304 @end smallexample
6305 This warning is enabled by default for C and C++ programs.
6306
6307 @item -Wsync-nand @r{(C and C++ only)}
6308 @opindex Wsync-nand
6309 @opindex Wno-sync-nand
6310 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6311 built-in functions are used. These functions changed semantics in GCC 4.4.
6312
6313 @item -Wunused-but-set-parameter
6314 @opindex Wunused-but-set-parameter
6315 @opindex Wno-unused-but-set-parameter
6316 Warn whenever a function parameter is assigned to, but otherwise unused
6317 (aside from its declaration).
6318
6319 To suppress this warning use the @code{unused} attribute
6320 (@pxref{Variable Attributes}).
6321
6322 This warning is also enabled by @option{-Wunused} together with
6323 @option{-Wextra}.
6324
6325 @item -Wunused-but-set-variable
6326 @opindex Wunused-but-set-variable
6327 @opindex Wno-unused-but-set-variable
6328 Warn whenever a local variable is assigned to, but otherwise unused
6329 (aside from its declaration).
6330 This warning is enabled by @option{-Wall}.
6331
6332 To suppress this warning use the @code{unused} attribute
6333 (@pxref{Variable Attributes}).
6334
6335 This warning is also enabled by @option{-Wunused}, which is enabled
6336 by @option{-Wall}.
6337
6338 @item -Wunused-function
6339 @opindex Wunused-function
6340 @opindex Wno-unused-function
6341 Warn whenever a static function is declared but not defined or a
6342 non-inline static function is unused.
6343 This warning is enabled by @option{-Wall}.
6344
6345 @item -Wunused-label
6346 @opindex Wunused-label
6347 @opindex Wno-unused-label
6348 Warn whenever a label is declared but not used.
6349 This warning is enabled by @option{-Wall}.
6350
6351 To suppress this warning use the @code{unused} attribute
6352 (@pxref{Variable Attributes}).
6353
6354 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6355 @opindex Wunused-local-typedefs
6356 @opindex Wno-unused-local-typedefs
6357 Warn when a typedef locally defined in a function is not used.
6358 This warning is enabled by @option{-Wall}.
6359
6360 @item -Wunused-parameter
6361 @opindex Wunused-parameter
6362 @opindex Wno-unused-parameter
6363 Warn whenever a function parameter is unused aside from its declaration.
6364
6365 To suppress this warning use the @code{unused} attribute
6366 (@pxref{Variable Attributes}).
6367
6368 @item -Wno-unused-result
6369 @opindex Wunused-result
6370 @opindex Wno-unused-result
6371 Do not warn if a caller of a function marked with attribute
6372 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6373 its return value. The default is @option{-Wunused-result}.
6374
6375 @item -Wunused-variable
6376 @opindex Wunused-variable
6377 @opindex Wno-unused-variable
6378 Warn whenever a local or static variable is unused aside from its
6379 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6380 but not for C++. This warning is enabled by @option{-Wall}.
6381
6382 To suppress this warning use the @code{unused} attribute
6383 (@pxref{Variable Attributes}).
6384
6385 @item -Wunused-const-variable
6386 @itemx -Wunused-const-variable=@var{n}
6387 @opindex Wunused-const-variable
6388 @opindex Wno-unused-const-variable
6389 Warn whenever a constant static variable is unused aside from its declaration.
6390 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6391 for C, but not for C++. In C this declares variable storage, but in C++ this
6392 is not an error since const variables take the place of @code{#define}s.
6393
6394 To suppress this warning use the @code{unused} attribute
6395 (@pxref{Variable Attributes}).
6396
6397 @table @gcctabopt
6398 @item -Wunused-const-variable=1
6399 This is the warning level that is enabled by @option{-Wunused-variable} for
6400 C. It warns only about unused static const variables defined in the main
6401 compilation unit, but not about static const variables declared in any
6402 header included.
6403
6404 @item -Wunused-const-variable=2
6405 This warning level also warns for unused constant static variables in
6406 headers (excluding system headers). This is the warning level of
6407 @option{-Wunused-const-variable} and must be explicitly requested since
6408 in C++ this isn't an error and in C it might be harder to clean up all
6409 headers included.
6410 @end table
6411
6412 @item -Wunused-value
6413 @opindex Wunused-value
6414 @opindex Wno-unused-value
6415 Warn whenever a statement computes a result that is explicitly not
6416 used. To suppress this warning cast the unused expression to
6417 @code{void}. This includes an expression-statement or the left-hand
6418 side of a comma expression that contains no side effects. For example,
6419 an expression such as @code{x[i,j]} causes a warning, while
6420 @code{x[(void)i,j]} does not.
6421
6422 This warning is enabled by @option{-Wall}.
6423
6424 @item -Wunused
6425 @opindex Wunused
6426 @opindex Wno-unused
6427 All the above @option{-Wunused} options combined.
6428
6429 In order to get a warning about an unused function parameter, you must
6430 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6431 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6432
6433 @item -Wuninitialized
6434 @opindex Wuninitialized
6435 @opindex Wno-uninitialized
6436 Warn if an automatic variable is used without first being initialized.
6437 In C++, warn if a non-static reference or non-static @code{const}
6438 member appears in a class without constructors.
6439
6440 If you want to warn about code that uses the uninitialized value of the
6441 variable in its own initializer, use the @option{-Winit-self} option.
6442
6443 These warnings occur for individual uninitialized elements of
6444 structure, union or array variables as well as for variables that are
6445 uninitialized as a whole. They do not occur for variables or elements
6446 declared @code{volatile}. Because these warnings depend on
6447 optimization, the exact variables or elements for which there are
6448 warnings depend on the precise optimization options and version of GCC
6449 used.
6450
6451 Note that there may be no warning about a variable that is used only
6452 to compute a value that itself is never used, because such
6453 computations may be deleted by data flow analysis before the warnings
6454 are printed.
6455
6456 @item -Wno-invalid-memory-model
6457 @opindex Winvalid-memory-model
6458 @opindex Wno-invalid-memory-model
6459 This option controls warnings
6460 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6461 and the C11 atomic generic functions with a memory consistency argument
6462 that is either invalid for the operation or outside the range of values
6463 of the @code{memory_order} enumeration. For example, since the
6464 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6465 defined for the relaxed, release, and sequentially consistent memory
6466 orders the following code is diagnosed:
6467
6468 @smallexample
6469 void store (int *i)
6470 @{
6471 __atomic_store_n (i, 0, memory_order_consume);
6472 @}
6473 @end smallexample
6474
6475 @option{-Winvalid-memory-model} is enabled by default.
6476
6477 @item -Wmaybe-uninitialized
6478 @opindex Wmaybe-uninitialized
6479 @opindex Wno-maybe-uninitialized
6480 For an automatic (i.e.@: local) variable, if there exists a path from the
6481 function entry to a use of the variable that is initialized, but there exist
6482 some other paths for which the variable is not initialized, the compiler
6483 emits a warning if it cannot prove the uninitialized paths are not
6484 executed at run time.
6485
6486 These warnings are only possible in optimizing compilation, because otherwise
6487 GCC does not keep track of the state of variables.
6488
6489 These warnings are made optional because GCC may not be able to determine when
6490 the code is correct in spite of appearing to have an error. Here is one
6491 example of how this can happen:
6492
6493 @smallexample
6494 @group
6495 @{
6496 int x;
6497 switch (y)
6498 @{
6499 case 1: x = 1;
6500 break;
6501 case 2: x = 4;
6502 break;
6503 case 3: x = 5;
6504 @}
6505 foo (x);
6506 @}
6507 @end group
6508 @end smallexample
6509
6510 @noindent
6511 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6512 always initialized, but GCC doesn't know this. To suppress the
6513 warning, you need to provide a default case with assert(0) or
6514 similar code.
6515
6516 @cindex @code{longjmp} warnings
6517 This option also warns when a non-volatile automatic variable might be
6518 changed by a call to @code{longjmp}.
6519 The compiler sees only the calls to @code{setjmp}. It cannot know
6520 where @code{longjmp} will be called; in fact, a signal handler could
6521 call it at any point in the code. As a result, you may get a warning
6522 even when there is in fact no problem because @code{longjmp} cannot
6523 in fact be called at the place that would cause a problem.
6524
6525 Some spurious warnings can be avoided if you declare all the functions
6526 you use that never return as @code{noreturn}. @xref{Function
6527 Attributes}.
6528
6529 This warning is enabled by @option{-Wall} or @option{-Wextra}.
6530
6531 @item -Wunknown-pragmas
6532 @opindex Wunknown-pragmas
6533 @opindex Wno-unknown-pragmas
6534 @cindex warning for unknown pragmas
6535 @cindex unknown pragmas, warning
6536 @cindex pragmas, warning of unknown
6537 Warn when a @code{#pragma} directive is encountered that is not understood by
6538 GCC@. If this command-line option is used, warnings are even issued
6539 for unknown pragmas in system header files. This is not the case if
6540 the warnings are only enabled by the @option{-Wall} command-line option.
6541
6542 @item -Wno-pragmas
6543 @opindex Wno-pragmas
6544 @opindex Wpragmas
6545 Do not warn about misuses of pragmas, such as incorrect parameters,
6546 invalid syntax, or conflicts between pragmas. See also
6547 @option{-Wunknown-pragmas}.
6548
6549 @item -Wno-prio-ctor-dtor
6550 @opindex Wno-prio-ctor-dtor
6551 @opindex Wprio-ctor-dtor
6552 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6553 The use of constructor and destructor attributes allow you to assign a
6554 priority to the constructor/destructor to control its order of execution
6555 before @code{main} is called or after it returns. The priority values must be
6556 greater than 100 as the compiler reserves priority values between 0--100 for
6557 the implementation.
6558
6559 @item -Wstrict-aliasing
6560 @opindex Wstrict-aliasing
6561 @opindex Wno-strict-aliasing
6562 This option is only active when @option{-fstrict-aliasing} is active.
6563 It warns about code that might break the strict aliasing rules that the
6564 compiler is using for optimization. The warning does not catch all
6565 cases, but does attempt to catch the more common pitfalls. It is
6566 included in @option{-Wall}.
6567 It is equivalent to @option{-Wstrict-aliasing=3}
6568
6569 @item -Wstrict-aliasing=n
6570 @opindex Wstrict-aliasing=n
6571 This option is only active when @option{-fstrict-aliasing} is active.
6572 It warns about code that might break the strict aliasing rules that the
6573 compiler is using for optimization.
6574 Higher levels correspond to higher accuracy (fewer false positives).
6575 Higher levels also correspond to more effort, similar to the way @option{-O}
6576 works.
6577 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6578
6579 Level 1: Most aggressive, quick, least accurate.
6580 Possibly useful when higher levels
6581 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6582 false negatives. However, it has many false positives.
6583 Warns for all pointer conversions between possibly incompatible types,
6584 even if never dereferenced. Runs in the front end only.
6585
6586 Level 2: Aggressive, quick, not too precise.
6587 May still have many false positives (not as many as level 1 though),
6588 and few false negatives (but possibly more than level 1).
6589 Unlike level 1, it only warns when an address is taken. Warns about
6590 incomplete types. Runs in the front end only.
6591
6592 Level 3 (default for @option{-Wstrict-aliasing}):
6593 Should have very few false positives and few false
6594 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
6595 Takes care of the common pun+dereference pattern in the front end:
6596 @code{*(int*)&some_float}.
6597 If optimization is enabled, it also runs in the back end, where it deals
6598 with multiple statement cases using flow-sensitive points-to information.
6599 Only warns when the converted pointer is dereferenced.
6600 Does not warn about incomplete types.
6601
6602 @item -Wstrict-overflow
6603 @itemx -Wstrict-overflow=@var{n}
6604 @opindex Wstrict-overflow
6605 @opindex Wno-strict-overflow
6606 This option is only active when signed overflow is undefined.
6607 It warns about cases where the compiler optimizes based on the
6608 assumption that signed overflow does not occur. Note that it does not
6609 warn about all cases where the code might overflow: it only warns
6610 about cases where the compiler implements some optimization. Thus
6611 this warning depends on the optimization level.
6612
6613 An optimization that assumes that signed overflow does not occur is
6614 perfectly safe if the values of the variables involved are such that
6615 overflow never does, in fact, occur. Therefore this warning can
6616 easily give a false positive: a warning about code that is not
6617 actually a problem. To help focus on important issues, several
6618 warning levels are defined. No warnings are issued for the use of
6619 undefined signed overflow when estimating how many iterations a loop
6620 requires, in particular when determining whether a loop will be
6621 executed at all.
6622
6623 @table @gcctabopt
6624 @item -Wstrict-overflow=1
6625 Warn about cases that are both questionable and easy to avoid. For
6626 example the compiler simplifies
6627 @code{x + 1 > x} to @code{1}. This level of
6628 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6629 are not, and must be explicitly requested.
6630
6631 @item -Wstrict-overflow=2
6632 Also warn about other cases where a comparison is simplified to a
6633 constant. For example: @code{abs (x) >= 0}. This can only be
6634 simplified when signed integer overflow is undefined, because
6635 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6636 zero. @option{-Wstrict-overflow} (with no level) is the same as
6637 @option{-Wstrict-overflow=2}.
6638
6639 @item -Wstrict-overflow=3
6640 Also warn about other cases where a comparison is simplified. For
6641 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6642
6643 @item -Wstrict-overflow=4
6644 Also warn about other simplifications not covered by the above cases.
6645 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6646
6647 @item -Wstrict-overflow=5
6648 Also warn about cases where the compiler reduces the magnitude of a
6649 constant involved in a comparison. For example: @code{x + 2 > y} is
6650 simplified to @code{x + 1 >= y}. This is reported only at the
6651 highest warning level because this simplification applies to many
6652 comparisons, so this warning level gives a very large number of
6653 false positives.
6654 @end table
6655
6656 @item -Wstring-compare
6657 @opindex Wstring-compare
6658 @opindex Wno-string-compare
6659 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6660 determined to be either zero or non-zero in tests for such equality
6661 owing to the length of one argument being greater than the size of
6662 the array the other argument is stored in (or the bound in the case
6663 of @code{strncmp}). Such calls could be mistakes. For example,
6664 the call to @code{strcmp} below is diagnosed because its result is
6665 necessarily non-zero irrespective of the contents of the array @code{a}.
6666
6667 @smallexample
6668 extern char a[4];
6669 void f (char *d)
6670 @{
6671 strcpy (d, "string");
6672 @dots{}
6673 if (0 == strcmp (a, d)) // cannot be true
6674 puts ("a and d are the same");
6675 @}
6676 @end smallexample
6677
6678 @option{-Wstring-compare} is enabled by @option{-Wextra}.
6679
6680 @item -Wstringop-overflow
6681 @itemx -Wstringop-overflow=@var{type}
6682 @opindex Wstringop-overflow
6683 @opindex Wno-stringop-overflow
6684 Warn for calls to string manipulation functions such as @code{memcpy} and
6685 @code{strcpy} that are determined to overflow the destination buffer. The
6686 optional argument is one greater than the type of Object Size Checking to
6687 perform to determine the size of the destination. @xref{Object Size Checking}.
6688 The argument is meaningful only for functions that operate on character arrays
6689 but not for raw memory functions like @code{memcpy} which always make use
6690 of Object Size type-0. The option also warns for calls that specify a size
6691 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6692 The option produces the best results with optimization enabled but can detect
6693 a small subset of simple buffer overflows even without optimization in
6694 calls to the GCC built-in functions like @code{__builtin_memcpy} that
6695 correspond to the standard functions. In any case, the option warns about
6696 just a subset of buffer overflows detected by the corresponding overflow
6697 checking built-ins. For example, the option issues a warning for
6698 the @code{strcpy} call below because it copies at least 5 characters
6699 (the string @code{"blue"} including the terminating NUL) into the buffer
6700 of size 4.
6701
6702 @smallexample
6703 enum Color @{ blue, purple, yellow @};
6704 const char* f (enum Color clr)
6705 @{
6706 static char buf [4];
6707 const char *str;
6708 switch (clr)
6709 @{
6710 case blue: str = "blue"; break;
6711 case purple: str = "purple"; break;
6712 case yellow: str = "yellow"; break;
6713 @}
6714
6715 return strcpy (buf, str); // warning here
6716 @}
6717 @end smallexample
6718
6719 Option @option{-Wstringop-overflow=2} is enabled by default.
6720
6721 @table @gcctabopt
6722 @item -Wstringop-overflow
6723 @itemx -Wstringop-overflow=1
6724 @opindex Wstringop-overflow
6725 @opindex Wno-stringop-overflow
6726 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6727 to determine the sizes of destination objects. This is the default setting
6728 of the option. At this setting the option does not warn for writes past
6729 the end of subobjects of larger objects accessed by pointers unless the
6730 size of the largest surrounding object is known. When the destination may
6731 be one of several objects it is assumed to be the largest one of them. On
6732 Linux systems, when optimization is enabled at this setting the option warns
6733 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6734 a non-zero value.
6735
6736 @item -Wstringop-overflow=2
6737 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6738 to determine the sizes of destination objects. At this setting the option
6739 warna about overflows when writing to members of the largest complete
6740 objects whose exact size is known. However, it does not warn for excessive
6741 writes to the same members of unknown objects referenced by pointers since
6742 they may point to arrays containing unknown numbers of elements.
6743
6744 @item -Wstringop-overflow=3
6745 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6746 to determine the sizes of destination objects. At this setting the option
6747 warns about overflowing the smallest object or data member. This is the
6748 most restrictive setting of the option that may result in warnings for safe
6749 code.
6750
6751 @item -Wstringop-overflow=4
6752 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6753 to determine the sizes of destination objects. At this setting the option
6754 warns about overflowing any data members, and when the destination is
6755 one of several objects it uses the size of the largest of them to decide
6756 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
6757 setting of the option may result in warnings for benign code.
6758 @end table
6759
6760 @item -Wno-stringop-truncation
6761 @opindex Wstringop-truncation
6762 @opindex Wno-stringop-truncation
6763 Do not warn for calls to bounded string manipulation functions
6764 such as @code{strncat},
6765 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6766 or leave the destination unchanged.
6767
6768 In the following example, the call to @code{strncat} specifies a bound that
6769 is less than the length of the source string. As a result, the copy of
6770 the source will be truncated and so the call is diagnosed. To avoid the
6771 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6772
6773 @smallexample
6774 void append (char *buf, size_t bufsize)
6775 @{
6776 strncat (buf, ".txt", 3);
6777 @}
6778 @end smallexample
6779
6780 As another example, the following call to @code{strncpy} results in copying
6781 to @code{d} just the characters preceding the terminating NUL, without
6782 appending the NUL to the end. Assuming the result of @code{strncpy} is
6783 necessarily a NUL-terminated string is a common mistake, and so the call
6784 is diagnosed. To avoid the warning when the result is not expected to be
6785 NUL-terminated, call @code{memcpy} instead.
6786
6787 @smallexample
6788 void copy (char *d, const char *s)
6789 @{
6790 strncpy (d, s, strlen (s));
6791 @}
6792 @end smallexample
6793
6794 In the following example, the call to @code{strncpy} specifies the size
6795 of the destination buffer as the bound. If the length of the source
6796 string is equal to or greater than this size the result of the copy will
6797 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
6798 the warning, specify @code{sizeof buf - 1} as the bound and set the last
6799 element of the buffer to @code{NUL}.
6800
6801 @smallexample
6802 void copy (const char *s)
6803 @{
6804 char buf[80];
6805 strncpy (buf, s, sizeof buf);
6806 @dots{}
6807 @}
6808 @end smallexample
6809
6810 In situations where a character array is intended to store a sequence
6811 of bytes with no terminating @code{NUL} such an array may be annotated
6812 with attribute @code{nonstring} to avoid this warning. Such arrays,
6813 however, are not suitable arguments to functions that expect
6814 @code{NUL}-terminated strings. To help detect accidental misuses of
6815 such arrays GCC issues warnings unless it can prove that the use is
6816 safe. @xref{Common Variable Attributes}.
6817
6818 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6819 @opindex Wsuggest-attribute=
6820 @opindex Wno-suggest-attribute=
6821 Warn for cases where adding an attribute may be beneficial. The
6822 attributes currently supported are listed below.
6823
6824 @table @gcctabopt
6825 @item -Wsuggest-attribute=pure
6826 @itemx -Wsuggest-attribute=const
6827 @itemx -Wsuggest-attribute=noreturn
6828 @itemx -Wmissing-noreturn
6829 @itemx -Wsuggest-attribute=malloc
6830 @opindex Wsuggest-attribute=pure
6831 @opindex Wno-suggest-attribute=pure
6832 @opindex Wsuggest-attribute=const
6833 @opindex Wno-suggest-attribute=const
6834 @opindex Wsuggest-attribute=noreturn
6835 @opindex Wno-suggest-attribute=noreturn
6836 @opindex Wmissing-noreturn
6837 @opindex Wno-missing-noreturn
6838 @opindex Wsuggest-attribute=malloc
6839 @opindex Wno-suggest-attribute=malloc
6840
6841 Warn about functions that might be candidates for attributes
6842 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6843 only warns for functions visible in other compilation units or (in the case of
6844 @code{pure} and @code{const}) if it cannot prove that the function returns
6845 normally. A function returns normally if it doesn't contain an infinite loop or
6846 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6847 requires option @option{-fipa-pure-const}, which is enabled by default at
6848 @option{-O} and higher. Higher optimization levels improve the accuracy
6849 of the analysis.
6850
6851 @item -Wsuggest-attribute=format
6852 @itemx -Wmissing-format-attribute
6853 @opindex Wsuggest-attribute=format
6854 @opindex Wmissing-format-attribute
6855 @opindex Wno-suggest-attribute=format
6856 @opindex Wno-missing-format-attribute
6857 @opindex Wformat
6858 @opindex Wno-format
6859
6860 Warn about function pointers that might be candidates for @code{format}
6861 attributes. Note these are only possible candidates, not absolute ones.
6862 GCC guesses that function pointers with @code{format} attributes that
6863 are used in assignment, initialization, parameter passing or return
6864 statements should have a corresponding @code{format} attribute in the
6865 resulting type. I.e.@: the left-hand side of the assignment or
6866 initialization, the type of the parameter variable, or the return type
6867 of the containing function respectively should also have a @code{format}
6868 attribute to avoid the warning.
6869
6870 GCC also warns about function definitions that might be
6871 candidates for @code{format} attributes. Again, these are only
6872 possible candidates. GCC guesses that @code{format} attributes
6873 might be appropriate for any function that calls a function like
6874 @code{vprintf} or @code{vscanf}, but this might not always be the
6875 case, and some functions for which @code{format} attributes are
6876 appropriate may not be detected.
6877
6878 @item -Wsuggest-attribute=cold
6879 @opindex Wsuggest-attribute=cold
6880 @opindex Wno-suggest-attribute=cold
6881
6882 Warn about functions that might be candidates for @code{cold} attribute. This
6883 is based on static detection and generally only warns about functions which
6884 always leads to a call to another @code{cold} function such as wrappers of
6885 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6886 @end table
6887
6888 @item -Walloc-zero
6889 @opindex Wno-alloc-zero
6890 @opindex Walloc-zero
6891 Warn about calls to allocation functions decorated with attribute
6892 @code{alloc_size} that specify zero bytes, including those to the built-in
6893 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6894 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6895 when called with a zero size differs among implementations (and in the case
6896 of @code{realloc} has been deprecated) relying on it may result in subtle
6897 portability bugs and should be avoided.
6898
6899 @item -Walloc-size-larger-than=@var{byte-size}
6900 @opindex Walloc-size-larger-than=
6901 @opindex Wno-alloc-size-larger-than
6902 Warn about calls to functions decorated with attribute @code{alloc_size}
6903 that attempt to allocate objects larger than the specified number of bytes,
6904 or where the result of the size computation in an integer type with infinite
6905 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6906 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6907 Warnings controlled by the option can be disabled either by specifying
6908 @var{byte-size} of @samp{SIZE_MAX} or more or by
6909 @option{-Wno-alloc-size-larger-than}.
6910 @xref{Function Attributes}.
6911
6912 @item -Wno-alloc-size-larger-than
6913 @opindex Wno-alloc-size-larger-than
6914 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6915 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6916 larger.
6917
6918 @item -Walloca
6919 @opindex Wno-alloca
6920 @opindex Walloca
6921 This option warns on all uses of @code{alloca} in the source.
6922
6923 @item -Walloca-larger-than=@var{byte-size}
6924 @opindex Walloca-larger-than=
6925 @opindex Wno-alloca-larger-than
6926 This option warns on calls to @code{alloca} with an integer argument whose
6927 value is either zero, or that is not bounded by a controlling predicate
6928 that limits its value to at most @var{byte-size}. It also warns for calls
6929 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6930 types are considered unbounded even if they appear to be constrained to
6931 the expected range.
6932
6933 For example, a bounded case of @code{alloca} could be:
6934
6935 @smallexample
6936 void func (size_t n)
6937 @{
6938 void *p;
6939 if (n <= 1000)
6940 p = alloca (n);
6941 else
6942 p = malloc (n);
6943 f (p);
6944 @}
6945 @end smallexample
6946
6947 In the above example, passing @code{-Walloca-larger-than=1000} would not
6948 issue a warning because the call to @code{alloca} is known to be at most
6949 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6950 the compiler would emit a warning.
6951
6952 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6953 controlling predicate constraining its integer argument. For example:
6954
6955 @smallexample
6956 void func ()
6957 @{
6958 void *p = alloca (n);
6959 f (p);
6960 @}
6961 @end smallexample
6962
6963 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6964 a warning, but this time because of the lack of bounds checking.
6965
6966 Note, that even seemingly correct code involving signed integers could
6967 cause a warning:
6968
6969 @smallexample
6970 void func (signed int n)
6971 @{
6972 if (n < 500)
6973 @{
6974 p = alloca (n);
6975 f (p);
6976 @}
6977 @}
6978 @end smallexample
6979
6980 In the above example, @var{n} could be negative, causing a larger than
6981 expected argument to be implicitly cast into the @code{alloca} call.
6982
6983 This option also warns when @code{alloca} is used in a loop.
6984
6985 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6986 but is usually only effective when @option{-ftree-vrp} is active (default
6987 for @option{-O2} and above).
6988
6989 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6990
6991 @item -Wno-alloca-larger-than
6992 @opindex Wno-alloca-larger-than
6993 Disable @option{-Walloca-larger-than=} warnings. The option is
6994 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6995
6996 @item -Warith-conversion
6997 @opindex Warith-conversion
6998 @opindex Wno-arith-conversion
6999 Do warn about implicit conversions from arithmetic operations even
7000 when conversion of the operands to the same type cannot change their
7001 values. This affects warnings from @option{-Wconversion},
7002 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7003
7004 @smallexample
7005 @group
7006 void f (char c, int i)
7007 @{
7008 c = c + i; // warns with @option{-Wconversion}
7009 c = c + 1; // only warns with @option{-Warith-conversion}
7010 @}
7011 @end group
7012 @end smallexample
7013
7014 @item -Warray-bounds
7015 @itemx -Warray-bounds=@var{n}
7016 @opindex Wno-array-bounds
7017 @opindex Warray-bounds
7018 This option is only active when @option{-ftree-vrp} is active
7019 (default for @option{-O2} and above). It warns about subscripts to arrays
7020 that are always out of bounds. This warning is enabled by @option{-Wall}.
7021
7022 @table @gcctabopt
7023 @item -Warray-bounds=1
7024 This is the warning level of @option{-Warray-bounds} and is enabled
7025 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7026
7027 @item -Warray-bounds=2
7028 This warning level also warns about out of bounds access for
7029 arrays at the end of a struct and for arrays accessed through
7030 pointers. This warning level may give a larger number of
7031 false positives and is deactivated by default.
7032 @end table
7033
7034 @item -Wattribute-alias=@var{n}
7035 @itemx -Wno-attribute-alias
7036 @opindex Wattribute-alias
7037 @opindex Wno-attribute-alias
7038 Warn about declarations using the @code{alias} and similar attributes whose
7039 target is incompatible with the type of the alias.
7040 @xref{Function Attributes,,Declaring Attributes of Functions}.
7041
7042 @table @gcctabopt
7043 @item -Wattribute-alias=1
7044 The default warning level of the @option{-Wattribute-alias} option diagnoses
7045 incompatibilities between the type of the alias declaration and that of its
7046 target. Such incompatibilities are typically indicative of bugs.
7047
7048 @item -Wattribute-alias=2
7049
7050 At this level @option{-Wattribute-alias} also diagnoses cases where
7051 the attributes of the alias declaration are more restrictive than the
7052 attributes applied to its target. These mismatches can potentially
7053 result in incorrect code generation. In other cases they may be
7054 benign and could be resolved simply by adding the missing attribute to
7055 the target. For comparison, see the @option{-Wmissing-attributes}
7056 option, which controls diagnostics when the alias declaration is less
7057 restrictive than the target, rather than more restrictive.
7058
7059 Attributes considered include @code{alloc_align}, @code{alloc_size},
7060 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7061 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7062 @code{returns_nonnull}, and @code{returns_twice}.
7063 @end table
7064
7065 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7066 This is the default. You can disable these warnings with either
7067 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7068
7069 @item -Wbool-compare
7070 @opindex Wno-bool-compare
7071 @opindex Wbool-compare
7072 Warn about boolean expression compared with an integer value different from
7073 @code{true}/@code{false}. For instance, the following comparison is
7074 always false:
7075 @smallexample
7076 int n = 5;
7077 @dots{}
7078 if ((n > 1) == 2) @{ @dots{} @}
7079 @end smallexample
7080 This warning is enabled by @option{-Wall}.
7081
7082 @item -Wbool-operation
7083 @opindex Wno-bool-operation
7084 @opindex Wbool-operation
7085 Warn about suspicious operations on expressions of a boolean type. For
7086 instance, bitwise negation of a boolean is very likely a bug in the program.
7087 For C, this warning also warns about incrementing or decrementing a boolean,
7088 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
7089 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7090
7091 This warning is enabled by @option{-Wall}.
7092
7093 @item -Wduplicated-branches
7094 @opindex Wno-duplicated-branches
7095 @opindex Wduplicated-branches
7096 Warn when an if-else has identical branches. This warning detects cases like
7097 @smallexample
7098 if (p != NULL)
7099 return 0;
7100 else
7101 return 0;
7102 @end smallexample
7103 It doesn't warn when both branches contain just a null statement. This warning
7104 also warn for conditional operators:
7105 @smallexample
7106 int i = x ? *p : *p;
7107 @end smallexample
7108
7109 @item -Wduplicated-cond
7110 @opindex Wno-duplicated-cond
7111 @opindex Wduplicated-cond
7112 Warn about duplicated conditions in an if-else-if chain. For instance,
7113 warn for the following code:
7114 @smallexample
7115 if (p->q != NULL) @{ @dots{} @}
7116 else if (p->q != NULL) @{ @dots{} @}
7117 @end smallexample
7118
7119 @item -Wframe-address
7120 @opindex Wno-frame-address
7121 @opindex Wframe-address
7122 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7123 is called with an argument greater than 0. Such calls may return indeterminate
7124 values or crash the program. The warning is included in @option{-Wall}.
7125
7126 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7127 @opindex Wno-discarded-qualifiers
7128 @opindex Wdiscarded-qualifiers
7129 Do not warn if type qualifiers on pointers are being discarded.
7130 Typically, the compiler warns if a @code{const char *} variable is
7131 passed to a function that takes a @code{char *} parameter. This option
7132 can be used to suppress such a warning.
7133
7134 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7135 @opindex Wno-discarded-array-qualifiers
7136 @opindex Wdiscarded-array-qualifiers
7137 Do not warn if type qualifiers on arrays which are pointer targets
7138 are being discarded. Typically, the compiler warns if a
7139 @code{const int (*)[]} variable is passed to a function that
7140 takes a @code{int (*)[]} parameter. This option can be used to
7141 suppress such a warning.
7142
7143 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7144 @opindex Wno-incompatible-pointer-types
7145 @opindex Wincompatible-pointer-types
7146 Do not warn when there is a conversion between pointers that have incompatible
7147 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
7148 which warns for pointer argument passing or assignment with different
7149 signedness.
7150
7151 @item -Wno-int-conversion @r{(C and Objective-C only)}
7152 @opindex Wno-int-conversion
7153 @opindex Wint-conversion
7154 Do not warn about incompatible integer to pointer and pointer to integer
7155 conversions. This warning is about implicit conversions; for explicit
7156 conversions the warnings @option{-Wno-int-to-pointer-cast} and
7157 @option{-Wno-pointer-to-int-cast} may be used.
7158
7159 @item -Wzero-length-bounds
7160 @opindex Wzero-length-bounds
7161 @opindex Wzero-length-bounds
7162 Warn about accesses to elements of zero-length array members that might
7163 overlap other members of the same object. Declaring interior zero-length
7164 arrays is discouraged because accesses to them are undefined. See
7165 @xref{Zero Length}.
7166
7167 For example, the first two stores in function @code{bad} are diagnosed
7168 because the array elements overlap the subsequent members @code{b} and
7169 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
7170 because it is beyond the bounds of the enclosing object.
7171
7172 @smallexample
7173 struct X @{ int a[0]; int b, c; @};
7174 struct X x;
7175
7176 void bad (void)
7177 @{
7178 x.a[0] = 0; // -Wzero-length-bounds
7179 x.a[1] = 1; // -Wzero-length-bounds
7180 x.a[2] = 2; // -Warray-bounds
7181 @}
7182 @end smallexample
7183
7184 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7185
7186 @item -Wno-div-by-zero
7187 @opindex Wno-div-by-zero
7188 @opindex Wdiv-by-zero
7189 Do not warn about compile-time integer division by zero. Floating-point
7190 division by zero is not warned about, as it can be a legitimate way of
7191 obtaining infinities and NaNs.
7192
7193 @item -Wsystem-headers
7194 @opindex Wsystem-headers
7195 @opindex Wno-system-headers
7196 @cindex warnings from system headers
7197 @cindex system headers, warnings from
7198 Print warning messages for constructs found in system header files.
7199 Warnings from system headers are normally suppressed, on the assumption
7200 that they usually do not indicate real problems and would only make the
7201 compiler output harder to read. Using this command-line option tells
7202 GCC to emit warnings from system headers as if they occurred in user
7203 code. However, note that using @option{-Wall} in conjunction with this
7204 option does @emph{not} warn about unknown pragmas in system
7205 headers---for that, @option{-Wunknown-pragmas} must also be used.
7206
7207 @item -Wtautological-compare
7208 @opindex Wtautological-compare
7209 @opindex Wno-tautological-compare
7210 Warn if a self-comparison always evaluates to true or false. This
7211 warning detects various mistakes such as:
7212 @smallexample
7213 int i = 1;
7214 @dots{}
7215 if (i > i) @{ @dots{} @}
7216 @end smallexample
7217
7218 This warning also warns about bitwise comparisons that always evaluate
7219 to true or false, for instance:
7220 @smallexample
7221 if ((a & 16) == 10) @{ @dots{} @}
7222 @end smallexample
7223 will always be false.
7224
7225 This warning is enabled by @option{-Wall}.
7226
7227 @item -Wtrampolines
7228 @opindex Wtrampolines
7229 @opindex Wno-trampolines
7230 Warn about trampolines generated for pointers to nested functions.
7231 A trampoline is a small piece of data or code that is created at run
7232 time on the stack when the address of a nested function is taken, and is
7233 used to call the nested function indirectly. For some targets, it is
7234 made up of data only and thus requires no special treatment. But, for
7235 most targets, it is made up of code and thus requires the stack to be
7236 made executable in order for the program to work properly.
7237
7238 @item -Wfloat-equal
7239 @opindex Wfloat-equal
7240 @opindex Wno-float-equal
7241 Warn if floating-point values are used in equality comparisons.
7242
7243 The idea behind this is that sometimes it is convenient (for the
7244 programmer) to consider floating-point values as approximations to
7245 infinitely precise real numbers. If you are doing this, then you need
7246 to compute (by analyzing the code, or in some other way) the maximum or
7247 likely maximum error that the computation introduces, and allow for it
7248 when performing comparisons (and when producing output, but that's a
7249 different problem). In particular, instead of testing for equality, you
7250 should check to see whether the two values have ranges that overlap; and
7251 this is done with the relational operators, so equality comparisons are
7252 probably mistaken.
7253
7254 @item -Wtraditional @r{(C and Objective-C only)}
7255 @opindex Wtraditional
7256 @opindex Wno-traditional
7257 Warn about certain constructs that behave differently in traditional and
7258 ISO C@. Also warn about ISO C constructs that have no traditional C
7259 equivalent, and/or problematic constructs that should be avoided.
7260
7261 @itemize @bullet
7262 @item
7263 Macro parameters that appear within string literals in the macro body.
7264 In traditional C macro replacement takes place within string literals,
7265 but in ISO C it does not.
7266
7267 @item
7268 In traditional C, some preprocessor directives did not exist.
7269 Traditional preprocessors only considered a line to be a directive
7270 if the @samp{#} appeared in column 1 on the line. Therefore
7271 @option{-Wtraditional} warns about directives that traditional C
7272 understands but ignores because the @samp{#} does not appear as the
7273 first character on the line. It also suggests you hide directives like
7274 @code{#pragma} not understood by traditional C by indenting them. Some
7275 traditional implementations do not recognize @code{#elif}, so this option
7276 suggests avoiding it altogether.
7277
7278 @item
7279 A function-like macro that appears without arguments.
7280
7281 @item
7282 The unary plus operator.
7283
7284 @item
7285 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7286 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
7287 constants.) Note, these suffixes appear in macros defined in the system
7288 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7289 Use of these macros in user code might normally lead to spurious
7290 warnings, however GCC's integrated preprocessor has enough context to
7291 avoid warning in these cases.
7292
7293 @item
7294 A function declared external in one block and then used after the end of
7295 the block.
7296
7297 @item
7298 A @code{switch} statement has an operand of type @code{long}.
7299
7300 @item
7301 A non-@code{static} function declaration follows a @code{static} one.
7302 This construct is not accepted by some traditional C compilers.
7303
7304 @item
7305 The ISO type of an integer constant has a different width or
7306 signedness from its traditional type. This warning is only issued if
7307 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
7308 typically represent bit patterns, are not warned about.
7309
7310 @item
7311 Usage of ISO string concatenation is detected.
7312
7313 @item
7314 Initialization of automatic aggregates.
7315
7316 @item
7317 Identifier conflicts with labels. Traditional C lacks a separate
7318 namespace for labels.
7319
7320 @item
7321 Initialization of unions. If the initializer is zero, the warning is
7322 omitted. This is done under the assumption that the zero initializer in
7323 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7324 initializer warnings and relies on default initialization to zero in the
7325 traditional C case.
7326
7327 @item
7328 Conversions by prototypes between fixed/floating-point values and vice
7329 versa. The absence of these prototypes when compiling with traditional
7330 C causes serious problems. This is a subset of the possible
7331 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7332
7333 @item
7334 Use of ISO C style function definitions. This warning intentionally is
7335 @emph{not} issued for prototype declarations or variadic functions
7336 because these ISO C features appear in your code when using
7337 libiberty's traditional C compatibility macros, @code{PARAMS} and
7338 @code{VPARAMS}. This warning is also bypassed for nested functions
7339 because that feature is already a GCC extension and thus not relevant to
7340 traditional C compatibility.
7341 @end itemize
7342
7343 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7344 @opindex Wtraditional-conversion
7345 @opindex Wno-traditional-conversion
7346 Warn if a prototype causes a type conversion that is different from what
7347 would happen to the same argument in the absence of a prototype. This
7348 includes conversions of fixed point to floating and vice versa, and
7349 conversions changing the width or signedness of a fixed-point argument
7350 except when the same as the default promotion.
7351
7352 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7353 @opindex Wdeclaration-after-statement
7354 @opindex Wno-declaration-after-statement
7355 Warn when a declaration is found after a statement in a block. This
7356 construct, known from C++, was introduced with ISO C99 and is by default
7357 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
7358
7359 @item -Wshadow
7360 @opindex Wshadow
7361 @opindex Wno-shadow
7362 Warn whenever a local variable or type declaration shadows another
7363 variable, parameter, type, class member (in C++), or instance variable
7364 (in Objective-C) or whenever a built-in function is shadowed. Note
7365 that in C++, the compiler warns if a local variable shadows an
7366 explicit typedef, but not if it shadows a struct/class/enum.
7367 If this warning is enabled, it includes also all instances of
7368 local shadowing. This means that @option{-Wno-shadow=local}
7369 and @option{-Wno-shadow=compatible-local} are ignored when
7370 @option{-Wshadow} is used.
7371 Same as @option{-Wshadow=global}.
7372
7373 @item -Wno-shadow-ivar @r{(Objective-C only)}
7374 @opindex Wno-shadow-ivar
7375 @opindex Wshadow-ivar
7376 Do not warn whenever a local variable shadows an instance variable in an
7377 Objective-C method.
7378
7379 @item -Wshadow=global
7380 @opindex Wshadow=global
7381 Warn for any shadowing.
7382 Same as @option{-Wshadow}.
7383
7384 @item -Wshadow=local
7385 @opindex Wshadow=local
7386 Warn when a local variable shadows another local variable or parameter.
7387
7388 @item -Wshadow=compatible-local
7389 @opindex Wshadow=compatible-local
7390 Warn when a local variable shadows another local variable or parameter
7391 whose type is compatible with that of the shadowing variable. In C++,
7392 type compatibility here means the type of the shadowing variable can be
7393 converted to that of the shadowed variable. The creation of this flag
7394 (in addition to @option{-Wshadow=local}) is based on the idea that when
7395 a local variable shadows another one of incompatible type, it is most
7396 likely intentional, not a bug or typo, as shown in the following example:
7397
7398 @smallexample
7399 @group
7400 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7401 @{
7402 for (int i = 0; i < N; ++i)
7403 @{
7404 ...
7405 @}
7406 ...
7407 @}
7408 @end group
7409 @end smallexample
7410
7411 Since the two variable @code{i} in the example above have incompatible types,
7412 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7413 Because their types are incompatible, if a programmer accidentally uses one
7414 in place of the other, type checking is expected to catch that and emit an
7415 error or warning. Use of this flag instead of @option{-Wshadow=local} can
7416 possibly reduce the number of warnings triggered by intentional shadowing.
7417 Note that this also means that shadowing @code{const char *i} by
7418 @code{char *i} does not emit a warning.
7419
7420 This warning is also enabled by @option{-Wshadow=local}.
7421
7422 @item -Wlarger-than=@var{byte-size}
7423 @opindex Wlarger-than=
7424 @opindex Wlarger-than-@var{byte-size}
7425 Warn whenever an object is defined whose size exceeds @var{byte-size}.
7426 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7427 Warnings controlled by the option can be disabled either by specifying
7428 @var{byte-size} of @samp{SIZE_MAX} or more or by
7429 @option{-Wno-larger-than}.
7430
7431 @item -Wno-larger-than
7432 @opindex Wno-larger-than
7433 Disable @option{-Wlarger-than=} warnings. The option is equivalent
7434 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7435
7436 @item -Wframe-larger-than=@var{byte-size}
7437 @opindex Wframe-larger-than=
7438 @opindex Wno-frame-larger-than
7439 Warn if the size of a function frame exceeds @var{byte-size}.
7440 The computation done to determine the stack frame size is approximate
7441 and not conservative.
7442 The actual requirements may be somewhat greater than @var{byte-size}
7443 even if you do not get a warning. In addition, any space allocated
7444 via @code{alloca}, variable-length arrays, or related constructs
7445 is not included by the compiler when determining
7446 whether or not to issue a warning.
7447 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7448 Warnings controlled by the option can be disabled either by specifying
7449 @var{byte-size} of @samp{SIZE_MAX} or more or by
7450 @option{-Wno-frame-larger-than}.
7451
7452 @item -Wno-frame-larger-than
7453 @opindex Wno-frame-larger-than
7454 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
7455 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7456
7457 @item -Wno-free-nonheap-object
7458 @opindex Wno-free-nonheap-object
7459 @opindex Wfree-nonheap-object
7460 Do not warn when attempting to free an object that was not allocated
7461 on the heap.
7462
7463 @item -Wstack-usage=@var{byte-size}
7464 @opindex Wstack-usage
7465 @opindex Wno-stack-usage
7466 Warn if the stack usage of a function might exceed @var{byte-size}.
7467 The computation done to determine the stack usage is conservative.
7468 Any space allocated via @code{alloca}, variable-length arrays, or related
7469 constructs is included by the compiler when determining whether or not to
7470 issue a warning.
7471
7472 The message is in keeping with the output of @option{-fstack-usage}.
7473
7474 @itemize
7475 @item
7476 If the stack usage is fully static but exceeds the specified amount, it's:
7477
7478 @smallexample
7479 warning: stack usage is 1120 bytes
7480 @end smallexample
7481 @item
7482 If the stack usage is (partly) dynamic but bounded, it's:
7483
7484 @smallexample
7485 warning: stack usage might be 1648 bytes
7486 @end smallexample
7487 @item
7488 If the stack usage is (partly) dynamic and not bounded, it's:
7489
7490 @smallexample
7491 warning: stack usage might be unbounded
7492 @end smallexample
7493 @end itemize
7494
7495 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7496 Warnings controlled by the option can be disabled either by specifying
7497 @var{byte-size} of @samp{SIZE_MAX} or more or by
7498 @option{-Wno-stack-usage}.
7499
7500 @item -Wno-stack-usage
7501 @opindex Wno-stack-usage
7502 Disable @option{-Wstack-usage=} warnings. The option is equivalent
7503 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7504
7505 @item -Wunsafe-loop-optimizations
7506 @opindex Wunsafe-loop-optimizations
7507 @opindex Wno-unsafe-loop-optimizations
7508 Warn if the loop cannot be optimized because the compiler cannot
7509 assume anything on the bounds of the loop indices. With
7510 @option{-funsafe-loop-optimizations} warn if the compiler makes
7511 such assumptions.
7512
7513 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7514 @opindex Wno-pedantic-ms-format
7515 @opindex Wpedantic-ms-format
7516 When used in combination with @option{-Wformat}
7517 and @option{-pedantic} without GNU extensions, this option
7518 disables the warnings about non-ISO @code{printf} / @code{scanf} format
7519 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7520 which depend on the MS runtime.
7521
7522 @item -Wpointer-arith
7523 @opindex Wpointer-arith
7524 @opindex Wno-pointer-arith
7525 Warn about anything that depends on the ``size of'' a function type or
7526 of @code{void}. GNU C assigns these types a size of 1, for
7527 convenience in calculations with @code{void *} pointers and pointers
7528 to functions. In C++, warn also when an arithmetic operation involves
7529 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
7530
7531 @item -Wno-pointer-compare
7532 @opindex Wpointer-compare
7533 @opindex Wno-pointer-compare
7534 Do not warn if a pointer is compared with a zero character constant.
7535 This usually
7536 means that the pointer was meant to be dereferenced. For example:
7537
7538 @smallexample
7539 const char *p = foo ();
7540 if (p == '\0')
7541 return 42;
7542 @end smallexample
7543
7544 Note that the code above is invalid in C++11.
7545
7546 This warning is enabled by default.
7547
7548 @item -Wtype-limits
7549 @opindex Wtype-limits
7550 @opindex Wno-type-limits
7551 Warn if a comparison is always true or always false due to the limited
7552 range of the data type, but do not warn for constant expressions. For
7553 example, warn if an unsigned variable is compared against zero with
7554 @code{<} or @code{>=}. This warning is also enabled by
7555 @option{-Wextra}.
7556
7557 @item -Wabsolute-value @r{(C and Objective-C only)}
7558 @opindex Wabsolute-value
7559 @opindex Wno-absolute-value
7560 Warn for calls to standard functions that compute the absolute value
7561 of an argument when a more appropriate standard function is available.
7562 For example, calling @code{abs(3.14)} triggers the warning because the
7563 appropriate function to call to compute the absolute value of a double
7564 argument is @code{fabs}. The option also triggers warnings when the
7565 argument in a call to such a function has an unsigned type. This
7566 warning can be suppressed with an explicit type cast and it is also
7567 enabled by @option{-Wextra}.
7568
7569 @include cppwarnopts.texi
7570
7571 @item -Wbad-function-cast @r{(C and Objective-C only)}
7572 @opindex Wbad-function-cast
7573 @opindex Wno-bad-function-cast
7574 Warn when a function call is cast to a non-matching type.
7575 For example, warn if a call to a function returning an integer type
7576 is cast to a pointer type.
7577
7578 @item -Wc90-c99-compat @r{(C and Objective-C only)}
7579 @opindex Wc90-c99-compat
7580 @opindex Wno-c90-c99-compat
7581 Warn about features not present in ISO C90, but present in ISO C99.
7582 For instance, warn about use of variable length arrays, @code{long long}
7583 type, @code{bool} type, compound literals, designated initializers, and so
7584 on. This option is independent of the standards mode. Warnings are disabled
7585 in the expression that follows @code{__extension__}.
7586
7587 @item -Wc99-c11-compat @r{(C and Objective-C only)}
7588 @opindex Wc99-c11-compat
7589 @opindex Wno-c99-c11-compat
7590 Warn about features not present in ISO C99, but present in ISO C11.
7591 For instance, warn about use of anonymous structures and unions,
7592 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7593 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7594 and so on. This option is independent of the standards mode. Warnings are
7595 disabled in the expression that follows @code{__extension__}.
7596
7597 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
7598 @opindex Wc11-c2x-compat
7599 @opindex Wno-c11-c2x-compat
7600 Warn about features not present in ISO C11, but present in ISO C2X.
7601 For instance, warn about omitting the string in @code{_Static_assert},
7602 use of @samp{[[]]} syntax for attributes, use of decimal
7603 floating-point types, and so on. This option is independent of the
7604 standards mode. Warnings are disabled in the expression that follows
7605 @code{__extension__}.
7606
7607 @item -Wc++-compat @r{(C and Objective-C only)}
7608 @opindex Wc++-compat
7609 @opindex Wno-c++-compat
7610 Warn about ISO C constructs that are outside of the common subset of
7611 ISO C and ISO C++, e.g.@: request for implicit conversion from
7612 @code{void *} to a pointer to non-@code{void} type.
7613
7614 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7615 @opindex Wc++11-compat
7616 @opindex Wno-c++11-compat
7617 Warn about C++ constructs whose meaning differs between ISO C++ 1998
7618 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7619 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
7620 enabled by @option{-Wall}.
7621
7622 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7623 @opindex Wc++14-compat
7624 @opindex Wno-c++14-compat
7625 Warn about C++ constructs whose meaning differs between ISO C++ 2011
7626 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
7627
7628 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7629 @opindex Wc++17-compat
7630 @opindex Wno-c++17-compat
7631 Warn about C++ constructs whose meaning differs between ISO C++ 2014
7632 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
7633
7634 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7635 @opindex Wc++20-compat
7636 @opindex Wno-c++20-compat
7637 Warn about C++ constructs whose meaning differs between ISO C++ 2017
7638 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
7639
7640 @item -Wcast-qual
7641 @opindex Wcast-qual
7642 @opindex Wno-cast-qual
7643 Warn whenever a pointer is cast so as to remove a type qualifier from
7644 the target type. For example, warn if a @code{const char *} is cast
7645 to an ordinary @code{char *}.
7646
7647 Also warn when making a cast that introduces a type qualifier in an
7648 unsafe way. For example, casting @code{char **} to @code{const char **}
7649 is unsafe, as in this example:
7650
7651 @smallexample
7652 /* p is char ** value. */
7653 const char **q = (const char **) p;
7654 /* Assignment of readonly string to const char * is OK. */
7655 *q = "string";
7656 /* Now char** pointer points to read-only memory. */
7657 **p = 'b';
7658 @end smallexample
7659
7660 @item -Wcast-align
7661 @opindex Wcast-align
7662 @opindex Wno-cast-align
7663 Warn whenever a pointer is cast such that the required alignment of the
7664 target is increased. For example, warn if a @code{char *} is cast to
7665 an @code{int *} on machines where integers can only be accessed at
7666 two- or four-byte boundaries.
7667
7668 @item -Wcast-align=strict
7669 @opindex Wcast-align=strict
7670 Warn whenever a pointer is cast such that the required alignment of the
7671 target is increased. For example, warn if a @code{char *} is cast to
7672 an @code{int *} regardless of the target machine.
7673
7674 @item -Wcast-function-type
7675 @opindex Wcast-function-type
7676 @opindex Wno-cast-function-type
7677 Warn when a function pointer is cast to an incompatible function pointer.
7678 In a cast involving function types with a variable argument list only
7679 the types of initial arguments that are provided are considered.
7680 Any parameter of pointer-type matches any other pointer-type. Any benign
7681 differences in integral types are ignored, like @code{int} vs.@: @code{long}
7682 on ILP32 targets. Likewise type qualifiers are ignored. The function
7683 type @code{void (*) (void)} is special and matches everything, which can
7684 be used to suppress this warning.
7685 In a cast involving pointer to member types this warning warns whenever
7686 the type cast is changing the pointer to member type.
7687 This warning is enabled by @option{-Wextra}.
7688
7689 @item -Wwrite-strings
7690 @opindex Wwrite-strings
7691 @opindex Wno-write-strings
7692 When compiling C, give string constants the type @code{const
7693 char[@var{length}]} so that copying the address of one into a
7694 non-@code{const} @code{char *} pointer produces a warning. These
7695 warnings help you find at compile time code that can try to write
7696 into a string constant, but only if you have been very careful about
7697 using @code{const} in declarations and prototypes. Otherwise, it is
7698 just a nuisance. This is why we did not make @option{-Wall} request
7699 these warnings.
7700
7701 When compiling C++, warn about the deprecated conversion from string
7702 literals to @code{char *}. This warning is enabled by default for C++
7703 programs.
7704
7705 @item -Wclobbered
7706 @opindex Wclobbered
7707 @opindex Wno-clobbered
7708 Warn for variables that might be changed by @code{longjmp} or
7709 @code{vfork}. This warning is also enabled by @option{-Wextra}.
7710
7711 @item -Wconversion
7712 @opindex Wconversion
7713 @opindex Wno-conversion
7714 Warn for implicit conversions that may alter a value. This includes
7715 conversions between real and integer, like @code{abs (x)} when
7716 @code{x} is @code{double}; conversions between signed and unsigned,
7717 like @code{unsigned ui = -1}; and conversions to smaller types, like
7718 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7719 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7720 changed by the conversion like in @code{abs (2.0)}. Warnings about
7721 conversions between signed and unsigned integers can be disabled by
7722 using @option{-Wno-sign-conversion}.
7723
7724 For C++, also warn for confusing overload resolution for user-defined
7725 conversions; and conversions that never use a type conversion
7726 operator: conversions to @code{void}, the same type, a base class or a
7727 reference to them. Warnings about conversions between signed and
7728 unsigned integers are disabled by default in C++ unless
7729 @option{-Wsign-conversion} is explicitly enabled.
7730
7731 Warnings about conversion from arithmetic on a small type back to that
7732 type are only given with @option{-Warith-conversion}.
7733
7734 @item -Wdangling-else
7735 @opindex Wdangling-else
7736 @opindex Wno-dangling-else
7737 Warn about constructions where there may be confusion to which
7738 @code{if} statement an @code{else} branch belongs. Here is an example of
7739 such a case:
7740
7741 @smallexample
7742 @group
7743 @{
7744 if (a)
7745 if (b)
7746 foo ();
7747 else
7748 bar ();
7749 @}
7750 @end group
7751 @end smallexample
7752
7753 In C/C++, every @code{else} branch belongs to the innermost possible
7754 @code{if} statement, which in this example is @code{if (b)}. This is
7755 often not what the programmer expected, as illustrated in the above
7756 example by indentation the programmer chose. When there is the
7757 potential for this confusion, GCC issues a warning when this flag
7758 is specified. To eliminate the warning, add explicit braces around
7759 the innermost @code{if} statement so there is no way the @code{else}
7760 can belong to the enclosing @code{if}. The resulting code
7761 looks like this:
7762
7763 @smallexample
7764 @group
7765 @{
7766 if (a)
7767 @{
7768 if (b)
7769 foo ();
7770 else
7771 bar ();
7772 @}
7773 @}
7774 @end group
7775 @end smallexample
7776
7777 This warning is enabled by @option{-Wparentheses}.
7778
7779 @item -Wdate-time
7780 @opindex Wdate-time
7781 @opindex Wno-date-time
7782 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7783 are encountered as they might prevent bit-wise-identical reproducible
7784 compilations.
7785
7786 @item -Wempty-body
7787 @opindex Wempty-body
7788 @opindex Wno-empty-body
7789 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7790 while} statement. This warning is also enabled by @option{-Wextra}.
7791
7792 @item -Wno-endif-labels
7793 @opindex Wendif-labels
7794 @opindex Wno-endif-labels
7795 Do not warn about stray tokens after @code{#else} and @code{#endif}.
7796
7797 @item -Wenum-compare
7798 @opindex Wenum-compare
7799 @opindex Wno-enum-compare
7800 Warn about a comparison between values of different enumerated types.
7801 In C++ enumerated type mismatches in conditional expressions are also
7802 diagnosed and the warning is enabled by default. In C this warning is
7803 enabled by @option{-Wall}.
7804
7805 @item -Wenum-conversion @r{(C, Objective-C only)}
7806 @opindex Wenum-conversion
7807 @opindex Wno-enum-conversion
7808 Warn when a value of enumerated type is implicitly converted to a
7809 different enumerated type. This warning is enabled by @option{-Wextra}.
7810
7811 @item -Wjump-misses-init @r{(C, Objective-C only)}
7812 @opindex Wjump-misses-init
7813 @opindex Wno-jump-misses-init
7814 Warn if a @code{goto} statement or a @code{switch} statement jumps
7815 forward across the initialization of a variable, or jumps backward to a
7816 label after the variable has been initialized. This only warns about
7817 variables that are initialized when they are declared. This warning is
7818 only supported for C and Objective-C; in C++ this sort of branch is an
7819 error in any case.
7820
7821 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7822 can be disabled with the @option{-Wno-jump-misses-init} option.
7823
7824 @item -Wsign-compare
7825 @opindex Wsign-compare
7826 @opindex Wno-sign-compare
7827 @cindex warning for comparison of signed and unsigned values
7828 @cindex comparison of signed and unsigned values, warning
7829 @cindex signed and unsigned values, comparison warning
7830 Warn when a comparison between signed and unsigned values could produce
7831 an incorrect result when the signed value is converted to unsigned.
7832 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7833 also enabled by @option{-Wextra}.
7834
7835 @item -Wsign-conversion
7836 @opindex Wsign-conversion
7837 @opindex Wno-sign-conversion
7838 Warn for implicit conversions that may change the sign of an integer
7839 value, like assigning a signed integer expression to an unsigned
7840 integer variable. An explicit cast silences the warning. In C, this
7841 option is enabled also by @option{-Wconversion}.
7842
7843 @item -Wfloat-conversion
7844 @opindex Wfloat-conversion
7845 @opindex Wno-float-conversion
7846 Warn for implicit conversions that reduce the precision of a real value.
7847 This includes conversions from real to integer, and from higher precision
7848 real to lower precision real values. This option is also enabled by
7849 @option{-Wconversion}.
7850
7851 @item -Wno-scalar-storage-order
7852 @opindex Wno-scalar-storage-order
7853 @opindex Wscalar-storage-order
7854 Do not warn on suspicious constructs involving reverse scalar storage order.
7855
7856 @item -Wsizeof-pointer-div
7857 @opindex Wsizeof-pointer-div
7858 @opindex Wno-sizeof-pointer-div
7859 Warn for suspicious divisions of two sizeof expressions that divide
7860 the pointer size by the element size, which is the usual way to compute
7861 the array size but won't work out correctly with pointers. This warning
7862 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7863 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7864
7865 @item -Wsizeof-pointer-memaccess
7866 @opindex Wsizeof-pointer-memaccess
7867 @opindex Wno-sizeof-pointer-memaccess
7868 Warn for suspicious length parameters to certain string and memory built-in
7869 functions if the argument uses @code{sizeof}. This warning triggers for
7870 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7871 an array, but a pointer, and suggests a possible fix, or about
7872 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7873 also warns about calls to bounded string copy functions like @code{strncat}
7874 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7875 the source array. For example, in the following function the call to
7876 @code{strncat} specifies the size of the source string as the bound. That
7877 is almost certainly a mistake and so the call is diagnosed.
7878 @smallexample
7879 void make_file (const char *name)
7880 @{
7881 char path[PATH_MAX];
7882 strncpy (path, name, sizeof path - 1);
7883 strncat (path, ".text", sizeof ".text");
7884 @dots{}
7885 @}
7886 @end smallexample
7887
7888 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7889
7890 @item -Wno-sizeof-array-argument
7891 @opindex Wsizeof-array-argument
7892 @opindex Wno-sizeof-array-argument
7893 Do not warn when the @code{sizeof} operator is applied to a parameter that is
7894 declared as an array in a function definition. This warning is enabled by
7895 default for C and C++ programs.
7896
7897 @item -Wmemset-elt-size
7898 @opindex Wmemset-elt-size
7899 @opindex Wno-memset-elt-size
7900 Warn for suspicious calls to the @code{memset} built-in function, if the
7901 first argument references an array, and the third argument is a number
7902 equal to the number of elements, but not equal to the size of the array
7903 in memory. This indicates that the user has omitted a multiplication by
7904 the element size. This warning is enabled by @option{-Wall}.
7905
7906 @item -Wmemset-transposed-args
7907 @opindex Wmemset-transposed-args
7908 @opindex Wno-memset-transposed-args
7909 Warn for suspicious calls to the @code{memset} built-in function where
7910 the second argument is not zero and the third argument is zero. For
7911 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7912 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7913 is only emitted if the third argument is a literal zero. Otherwise, if
7914 it is an expression that is folded to zero, or a cast of zero to some
7915 type, it is far less likely that the arguments have been mistakenly
7916 transposed and no warning is emitted. This warning is enabled
7917 by @option{-Wall}.
7918
7919 @item -Waddress
7920 @opindex Waddress
7921 @opindex Wno-address
7922 Warn about suspicious uses of memory addresses. These include using
7923 the address of a function in a conditional expression, such as
7924 @code{void func(void); if (func)}, and comparisons against the memory
7925 address of a string literal, such as @code{if (x == "abc")}. Such
7926 uses typically indicate a programmer error: the address of a function
7927 always evaluates to true, so their use in a conditional usually
7928 indicate that the programmer forgot the parentheses in a function
7929 call; and comparisons against string literals result in unspecified
7930 behavior and are not portable in C, so they usually indicate that the
7931 programmer intended to use @code{strcmp}. This warning is enabled by
7932 @option{-Wall}.
7933
7934 @item -Wno-address-of-packed-member
7935 @opindex Waddress-of-packed-member
7936 @opindex Wno-address-of-packed-member
7937 Do not warn when the address of packed member of struct or union is taken,
7938 which usually results in an unaligned pointer value. This is
7939 enabled by default.
7940
7941 @item -Wlogical-op
7942 @opindex Wlogical-op
7943 @opindex Wno-logical-op
7944 Warn about suspicious uses of logical operators in expressions.
7945 This includes using logical operators in contexts where a
7946 bit-wise operator is likely to be expected. Also warns when
7947 the operands of a logical operator are the same:
7948 @smallexample
7949 extern int a;
7950 if (a < 0 && a < 0) @{ @dots{} @}
7951 @end smallexample
7952
7953 @item -Wlogical-not-parentheses
7954 @opindex Wlogical-not-parentheses
7955 @opindex Wno-logical-not-parentheses
7956 Warn about logical not used on the left hand side operand of a comparison.
7957 This option does not warn if the right operand is considered to be a boolean
7958 expression. Its purpose is to detect suspicious code like the following:
7959 @smallexample
7960 int a;
7961 @dots{}
7962 if (!a > 1) @{ @dots{} @}
7963 @end smallexample
7964
7965 It is possible to suppress the warning by wrapping the LHS into
7966 parentheses:
7967 @smallexample
7968 if ((!a) > 1) @{ @dots{} @}
7969 @end smallexample
7970
7971 This warning is enabled by @option{-Wall}.
7972
7973 @item -Waggregate-return
7974 @opindex Waggregate-return
7975 @opindex Wno-aggregate-return
7976 Warn if any functions that return structures or unions are defined or
7977 called. (In languages where you can return an array, this also elicits
7978 a warning.)
7979
7980 @item -Wno-aggressive-loop-optimizations
7981 @opindex Wno-aggressive-loop-optimizations
7982 @opindex Waggressive-loop-optimizations
7983 Warn if in a loop with constant number of iterations the compiler detects
7984 undefined behavior in some statement during one or more of the iterations.
7985
7986 @item -Wno-attributes
7987 @opindex Wno-attributes
7988 @opindex Wattributes
7989 Do not warn if an unexpected @code{__attribute__} is used, such as
7990 unrecognized attributes, function attributes applied to variables,
7991 etc. This does not stop errors for incorrect use of supported
7992 attributes.
7993
7994 @item -Wno-builtin-declaration-mismatch
7995 @opindex Wno-builtin-declaration-mismatch
7996 @opindex Wbuiltin-declaration-mismatch
7997 Warn if a built-in function is declared with an incompatible signature
7998 or as a non-function, or when a built-in function declared with a type
7999 that does not include a prototype is called with arguments whose promoted
8000 types do not match those expected by the function. When @option{-Wextra}
8001 is specified, also warn when a built-in function that takes arguments is
8002 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
8003 warning is enabled by default. To avoid the warning include the appropriate
8004 header to bring the prototypes of built-in functions into scope.
8005
8006 For example, the call to @code{memset} below is diagnosed by the warning
8007 because the function expects a value of type @code{size_t} as its argument
8008 but the type of @code{32} is @code{int}. With @option{-Wextra},
8009 the declaration of the function is diagnosed as well.
8010 @smallexample
8011 extern void* memset ();
8012 void f (void *d)
8013 @{
8014 memset (d, '\0', 32);
8015 @}
8016 @end smallexample
8017
8018 @item -Wno-builtin-macro-redefined
8019 @opindex Wno-builtin-macro-redefined
8020 @opindex Wbuiltin-macro-redefined
8021 Do not warn if certain built-in macros are redefined. This suppresses
8022 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8023 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8024
8025 @item -Wstrict-prototypes @r{(C and Objective-C only)}
8026 @opindex Wstrict-prototypes
8027 @opindex Wno-strict-prototypes
8028 Warn if a function is declared or defined without specifying the
8029 argument types. (An old-style function definition is permitted without
8030 a warning if preceded by a declaration that specifies the argument
8031 types.)
8032
8033 @item -Wold-style-declaration @r{(C and Objective-C only)}
8034 @opindex Wold-style-declaration
8035 @opindex Wno-old-style-declaration
8036 Warn for obsolescent usages, according to the C Standard, in a
8037 declaration. For example, warn if storage-class specifiers like
8038 @code{static} are not the first things in a declaration. This warning
8039 is also enabled by @option{-Wextra}.
8040
8041 @item -Wold-style-definition @r{(C and Objective-C only)}
8042 @opindex Wold-style-definition
8043 @opindex Wno-old-style-definition
8044 Warn if an old-style function definition is used. A warning is given
8045 even if there is a previous prototype. A definition using @samp{()}
8046 is not considered an old-style definition in C2X mode, because it is
8047 equivalent to @samp{(void)} in that case, but is considered an
8048 old-style definition for older standards.
8049
8050 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
8051 @opindex Wmissing-parameter-type
8052 @opindex Wno-missing-parameter-type
8053 A function parameter is declared without a type specifier in K&R-style
8054 functions:
8055
8056 @smallexample
8057 void foo(bar) @{ @}
8058 @end smallexample
8059
8060 This warning is also enabled by @option{-Wextra}.
8061
8062 @item -Wmissing-prototypes @r{(C and Objective-C only)}
8063 @opindex Wmissing-prototypes
8064 @opindex Wno-missing-prototypes
8065 Warn if a global function is defined without a previous prototype
8066 declaration. This warning is issued even if the definition itself
8067 provides a prototype. Use this option to detect global functions
8068 that do not have a matching prototype declaration in a header file.
8069 This option is not valid for C++ because all function declarations
8070 provide prototypes and a non-matching declaration declares an
8071 overload rather than conflict with an earlier declaration.
8072 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8073
8074 @item -Wmissing-declarations
8075 @opindex Wmissing-declarations
8076 @opindex Wno-missing-declarations
8077 Warn if a global function is defined without a previous declaration.
8078 Do so even if the definition itself provides a prototype.
8079 Use this option to detect global functions that are not declared in
8080 header files. In C, no warnings are issued for functions with previous
8081 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8082 missing prototypes. In C++, no warnings are issued for function templates,
8083 or for inline functions, or for functions in anonymous namespaces.
8084
8085 @item -Wmissing-field-initializers
8086 @opindex Wmissing-field-initializers
8087 @opindex Wno-missing-field-initializers
8088 @opindex W
8089 @opindex Wextra
8090 @opindex Wno-extra
8091 Warn if a structure's initializer has some fields missing. For
8092 example, the following code causes such a warning, because
8093 @code{x.h} is implicitly zero:
8094
8095 @smallexample
8096 struct s @{ int f, g, h; @};
8097 struct s x = @{ 3, 4 @};
8098 @end smallexample
8099
8100 This option does not warn about designated initializers, so the following
8101 modification does not trigger a warning:
8102
8103 @smallexample
8104 struct s @{ int f, g, h; @};
8105 struct s x = @{ .f = 3, .g = 4 @};
8106 @end smallexample
8107
8108 In C this option does not warn about the universal zero initializer
8109 @samp{@{ 0 @}}:
8110
8111 @smallexample
8112 struct s @{ int f, g, h; @};
8113 struct s x = @{ 0 @};
8114 @end smallexample
8115
8116 Likewise, in C++ this option does not warn about the empty @{ @}
8117 initializer, for example:
8118
8119 @smallexample
8120 struct s @{ int f, g, h; @};
8121 s x = @{ @};
8122 @end smallexample
8123
8124 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
8125 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8126
8127 @item -Wno-multichar
8128 @opindex Wno-multichar
8129 @opindex Wmultichar
8130 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8131 Usually they indicate a typo in the user's code, as they have
8132 implementation-defined values, and should not be used in portable code.
8133
8134 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8135 @opindex Wnormalized=
8136 @opindex Wnormalized
8137 @opindex Wno-normalized
8138 @cindex NFC
8139 @cindex NFKC
8140 @cindex character set, input normalization
8141 In ISO C and ISO C++, two identifiers are different if they are
8142 different sequences of characters. However, sometimes when characters
8143 outside the basic ASCII character set are used, you can have two
8144 different character sequences that look the same. To avoid confusion,
8145 the ISO 10646 standard sets out some @dfn{normalization rules} which
8146 when applied ensure that two sequences that look the same are turned into
8147 the same sequence. GCC can warn you if you are using identifiers that
8148 have not been normalized; this option controls that warning.
8149
8150 There are four levels of warning supported by GCC@. The default is
8151 @option{-Wnormalized=nfc}, which warns about any identifier that is
8152 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
8153 recommended form for most uses. It is equivalent to
8154 @option{-Wnormalized}.
8155
8156 Unfortunately, there are some characters allowed in identifiers by
8157 ISO C and ISO C++ that, when turned into NFC, are not allowed in
8158 identifiers. That is, there's no way to use these symbols in portable
8159 ISO C or C++ and have all your identifiers in NFC@.
8160 @option{-Wnormalized=id} suppresses the warning for these characters.
8161 It is hoped that future versions of the standards involved will correct
8162 this, which is why this option is not the default.
8163
8164 You can switch the warning off for all characters by writing
8165 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
8166 only do this if you are using some other normalization scheme (like
8167 ``D''), because otherwise you can easily create bugs that are
8168 literally impossible to see.
8169
8170 Some characters in ISO 10646 have distinct meanings but look identical
8171 in some fonts or display methodologies, especially once formatting has
8172 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
8173 LETTER N'', displays just like a regular @code{n} that has been
8174 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
8175 normalization scheme to convert all these into a standard form as
8176 well, and GCC warns if your code is not in NFKC if you use
8177 @option{-Wnormalized=nfkc}. This warning is comparable to warning
8178 about every identifier that contains the letter O because it might be
8179 confused with the digit 0, and so is not the default, but may be
8180 useful as a local coding convention if the programming environment
8181 cannot be fixed to display these characters distinctly.
8182
8183 @item -Wno-attribute-warning
8184 @opindex Wno-attribute-warning
8185 @opindex Wattribute-warning
8186 Do not warn about usage of functions (@pxref{Function Attributes})
8187 declared with @code{warning} attribute. By default, this warning is
8188 enabled. @option{-Wno-attribute-warning} can be used to disable the
8189 warning or @option{-Wno-error=attribute-warning} can be used to
8190 disable the error when compiled with @option{-Werror} flag.
8191
8192 @item -Wno-deprecated
8193 @opindex Wno-deprecated
8194 @opindex Wdeprecated
8195 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
8196
8197 @item -Wno-deprecated-declarations
8198 @opindex Wno-deprecated-declarations
8199 @opindex Wdeprecated-declarations
8200 Do not warn about uses of functions (@pxref{Function Attributes}),
8201 variables (@pxref{Variable Attributes}), and types (@pxref{Type
8202 Attributes}) marked as deprecated by using the @code{deprecated}
8203 attribute.
8204
8205 @item -Wno-overflow
8206 @opindex Wno-overflow
8207 @opindex Woverflow
8208 Do not warn about compile-time overflow in constant expressions.
8209
8210 @item -Wno-odr
8211 @opindex Wno-odr
8212 @opindex Wodr
8213 Warn about One Definition Rule violations during link-time optimization.
8214 Enabled by default.
8215
8216 @item -Wopenmp-simd
8217 @opindex Wopenmp-simd
8218 @opindex Wno-openmp-simd
8219 Warn if the vectorizer cost model overrides the OpenMP
8220 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
8221 option can be used to relax the cost model.
8222
8223 @item -Woverride-init @r{(C and Objective-C only)}
8224 @opindex Woverride-init
8225 @opindex Wno-override-init
8226 @opindex W
8227 @opindex Wextra
8228 @opindex Wno-extra
8229 Warn if an initialized field without side effects is overridden when
8230 using designated initializers (@pxref{Designated Inits, , Designated
8231 Initializers}).
8232
8233 This warning is included in @option{-Wextra}. To get other
8234 @option{-Wextra} warnings without this one, use @option{-Wextra
8235 -Wno-override-init}.
8236
8237 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
8238 @opindex Woverride-init-side-effects
8239 @opindex Wno-override-init-side-effects
8240 Do not warn if an initialized field with side effects is overridden when
8241 using designated initializers (@pxref{Designated Inits, , Designated
8242 Initializers}). This warning is enabled by default.
8243
8244 @item -Wpacked
8245 @opindex Wpacked
8246 @opindex Wno-packed
8247 Warn if a structure is given the packed attribute, but the packed
8248 attribute has no effect on the layout or size of the structure.
8249 Such structures may be mis-aligned for little benefit. For
8250 instance, in this code, the variable @code{f.x} in @code{struct bar}
8251 is misaligned even though @code{struct bar} does not itself
8252 have the packed attribute:
8253
8254 @smallexample
8255 @group
8256 struct foo @{
8257 int x;
8258 char a, b, c, d;
8259 @} __attribute__((packed));
8260 struct bar @{
8261 char z;
8262 struct foo f;
8263 @};
8264 @end group
8265 @end smallexample
8266
8267 @item -Wnopacked-bitfield-compat
8268 @opindex Wpacked-bitfield-compat
8269 @opindex Wno-packed-bitfield-compat
8270 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
8271 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
8272 the change can lead to differences in the structure layout. GCC
8273 informs you when the offset of such a field has changed in GCC 4.4.
8274 For example there is no longer a 4-bit padding between field @code{a}
8275 and @code{b} in this structure:
8276
8277 @smallexample
8278 struct foo
8279 @{
8280 char a:4;
8281 char b:8;
8282 @} __attribute__ ((packed));
8283 @end smallexample
8284
8285 This warning is enabled by default. Use
8286 @option{-Wno-packed-bitfield-compat} to disable this warning.
8287
8288 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
8289 @opindex Wpacked-not-aligned
8290 @opindex Wno-packed-not-aligned
8291 Warn if a structure field with explicitly specified alignment in a
8292 packed struct or union is misaligned. For example, a warning will
8293 be issued on @code{struct S}, like, @code{warning: alignment 1 of
8294 'struct S' is less than 8}, in this code:
8295
8296 @smallexample
8297 @group
8298 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
8299 struct __attribute__ ((packed)) S @{
8300 struct S8 s8;
8301 @};
8302 @end group
8303 @end smallexample
8304
8305 This warning is enabled by @option{-Wall}.
8306
8307 @item -Wpadded
8308 @opindex Wpadded
8309 @opindex Wno-padded
8310 Warn if padding is included in a structure, either to align an element
8311 of the structure or to align the whole structure. Sometimes when this
8312 happens it is possible to rearrange the fields of the structure to
8313 reduce the padding and so make the structure smaller.
8314
8315 @item -Wredundant-decls
8316 @opindex Wredundant-decls
8317 @opindex Wno-redundant-decls
8318 Warn if anything is declared more than once in the same scope, even in
8319 cases where multiple declaration is valid and changes nothing.
8320
8321 @item -Wrestrict
8322 @opindex Wrestrict
8323 @opindex Wno-restrict
8324 Warn when an object referenced by a @code{restrict}-qualified parameter
8325 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8326 argument, or when copies between such objects overlap. For example,
8327 the call to the @code{strcpy} function below attempts to truncate the string
8328 by replacing its initial characters with the last four. However, because
8329 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8330 the call is diagnosed.
8331
8332 @smallexample
8333 void foo (void)
8334 @{
8335 char a[] = "abcd1234";
8336 strcpy (a, a + 4);
8337 @dots{}
8338 @}
8339 @end smallexample
8340 The @option{-Wrestrict} option detects some instances of simple overlap
8341 even without optimization but works best at @option{-O2} and above. It
8342 is included in @option{-Wall}.
8343
8344 @item -Wnested-externs @r{(C and Objective-C only)}
8345 @opindex Wnested-externs
8346 @opindex Wno-nested-externs
8347 Warn if an @code{extern} declaration is encountered within a function.
8348
8349 @item -Winline
8350 @opindex Winline
8351 @opindex Wno-inline
8352 Warn if a function that is declared as inline cannot be inlined.
8353 Even with this option, the compiler does not warn about failures to
8354 inline functions declared in system headers.
8355
8356 The compiler uses a variety of heuristics to determine whether or not
8357 to inline a function. For example, the compiler takes into account
8358 the size of the function being inlined and the amount of inlining
8359 that has already been done in the current function. Therefore,
8360 seemingly insignificant changes in the source program can cause the
8361 warnings produced by @option{-Winline} to appear or disappear.
8362
8363 @item -Wint-in-bool-context
8364 @opindex Wint-in-bool-context
8365 @opindex Wno-int-in-bool-context
8366 Warn for suspicious use of integer values where boolean values are expected,
8367 such as conditional expressions (?:) using non-boolean integer constants in
8368 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
8369 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
8370 for all kinds of multiplications regardless of the data type.
8371 This warning is enabled by @option{-Wall}.
8372
8373 @item -Wno-int-to-pointer-cast
8374 @opindex Wno-int-to-pointer-cast
8375 @opindex Wint-to-pointer-cast
8376 Suppress warnings from casts to pointer type of an integer of a
8377 different size. In C++, casting to a pointer type of smaller size is
8378 an error. @option{Wint-to-pointer-cast} is enabled by default.
8379
8380
8381 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8382 @opindex Wno-pointer-to-int-cast
8383 @opindex Wpointer-to-int-cast
8384 Suppress warnings from casts from a pointer to an integer type of a
8385 different size.
8386
8387 @item -Winvalid-pch
8388 @opindex Winvalid-pch
8389 @opindex Wno-invalid-pch
8390 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8391 the search path but cannot be used.
8392
8393 @item -Wlong-long
8394 @opindex Wlong-long
8395 @opindex Wno-long-long
8396 Warn if @code{long long} type is used. This is enabled by either
8397 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8398 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
8399
8400 @item -Wvariadic-macros
8401 @opindex Wvariadic-macros
8402 @opindex Wno-variadic-macros
8403 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8404 alternate syntax is used in ISO C99 mode. This is enabled by either
8405 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
8406 messages, use @option{-Wno-variadic-macros}.
8407
8408 @item -Wno-varargs
8409 @opindex Wvarargs
8410 @opindex Wno-varargs
8411 Do not warn upon questionable usage of the macros used to handle variable
8412 arguments like @code{va_start}. These warnings are enabled by default.
8413
8414 @item -Wvector-operation-performance
8415 @opindex Wvector-operation-performance
8416 @opindex Wno-vector-operation-performance
8417 Warn if vector operation is not implemented via SIMD capabilities of the
8418 architecture. Mainly useful for the performance tuning.
8419 Vector operation can be implemented @code{piecewise}, which means that the
8420 scalar operation is performed on every vector element;
8421 @code{in parallel}, which means that the vector operation is implemented
8422 using scalars of wider type, which normally is more performance efficient;
8423 and @code{as a single scalar}, which means that vector fits into a
8424 scalar type.
8425
8426 @item -Wvla
8427 @opindex Wvla
8428 @opindex Wno-vla
8429 Warn if a variable-length array is used in the code.
8430 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8431 the variable-length array.
8432
8433 @item -Wvla-larger-than=@var{byte-size}
8434 @opindex Wvla-larger-than=
8435 @opindex Wno-vla-larger-than
8436 If this option is used, the compiler warns for declarations of
8437 variable-length arrays whose size is either unbounded, or bounded
8438 by an argument that allows the array size to exceed @var{byte-size}
8439 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8440 works, but with variable-length arrays.
8441
8442 Note that GCC may optimize small variable-length arrays of a known
8443 value into plain arrays, so this warning may not get triggered for
8444 such arrays.
8445
8446 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8447 is typically only effective when @option{-ftree-vrp} is active (default
8448 for @option{-O2} and above).
8449
8450 See also @option{-Walloca-larger-than=@var{byte-size}}.
8451
8452 @item -Wno-vla-larger-than
8453 @opindex Wno-vla-larger-than
8454 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
8455 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8456
8457 @item -Wvolatile-register-var
8458 @opindex Wvolatile-register-var
8459 @opindex Wno-volatile-register-var
8460 Warn if a register variable is declared volatile. The volatile
8461 modifier does not inhibit all optimizations that may eliminate reads
8462 and/or writes to register variables. This warning is enabled by
8463 @option{-Wall}.
8464
8465 @item -Wdisabled-optimization
8466 @opindex Wdisabled-optimization
8467 @opindex Wno-disabled-optimization
8468 Warn if a requested optimization pass is disabled. This warning does
8469 not generally indicate that there is anything wrong with your code; it
8470 merely indicates that GCC's optimizers are unable to handle the code
8471 effectively. Often, the problem is that your code is too big or too
8472 complex; GCC refuses to optimize programs when the optimization
8473 itself is likely to take inordinate amounts of time.
8474
8475 @item -Wpointer-sign @r{(C and Objective-C only)}
8476 @opindex Wpointer-sign
8477 @opindex Wno-pointer-sign
8478 Warn for pointer argument passing or assignment with different signedness.
8479 This option is only supported for C and Objective-C@. It is implied by
8480 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8481 @option{-Wno-pointer-sign}.
8482
8483 @item -Wstack-protector
8484 @opindex Wstack-protector
8485 @opindex Wno-stack-protector
8486 This option is only active when @option{-fstack-protector} is active. It
8487 warns about functions that are not protected against stack smashing.
8488
8489 @item -Woverlength-strings
8490 @opindex Woverlength-strings
8491 @opindex Wno-overlength-strings
8492 Warn about string constants that are longer than the ``minimum
8493 maximum'' length specified in the C standard. Modern compilers
8494 generally allow string constants that are much longer than the
8495 standard's minimum limit, but very portable programs should avoid
8496 using longer strings.
8497
8498 The limit applies @emph{after} string constant concatenation, and does
8499 not count the trailing NUL@. In C90, the limit was 509 characters; in
8500 C99, it was raised to 4095. C++98 does not specify a normative
8501 minimum maximum, so we do not diagnose overlength strings in C++@.
8502
8503 This option is implied by @option{-Wpedantic}, and can be disabled with
8504 @option{-Wno-overlength-strings}.
8505
8506 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8507 @opindex Wunsuffixed-float-constants
8508 @opindex Wno-unsuffixed-float-constants
8509
8510 Issue a warning for any floating constant that does not have
8511 a suffix. When used together with @option{-Wsystem-headers} it
8512 warns about such constants in system header files. This can be useful
8513 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8514 from the decimal floating-point extension to C99.
8515
8516 @item -Wno-lto-type-mismatch
8517 @opindex Wlto-type-mismatch
8518 @opindex Wno-lto-type-mismatch
8519
8520 During the link-time optimization, do not warn about type mismatches in
8521 global declarations from different compilation units.
8522 Requires @option{-flto} to be enabled. Enabled by default.
8523
8524 @item -Wno-designated-init @r{(C and Objective-C only)}
8525 @opindex Wdesignated-init
8526 @opindex Wno-designated-init
8527 Suppress warnings when a positional initializer is used to initialize
8528 a structure that has been marked with the @code{designated_init}
8529 attribute.
8530
8531 @item -Wno-hsa
8532 @opindex Whsa
8533 @opindex Wno-hsa
8534 Do not warn when HSAIL cannot be emitted for the compiled function or
8535 OpenMP construct. These warnings are enabled by default.
8536
8537 @end table
8538
8539 @node Static Analyzer Options
8540 @section Options That Control Static Analysis
8541
8542 @table @gcctabopt
8543 @item -fanalyzer
8544 @opindex analyzer
8545 @opindex fanalyzer
8546 @opindex fno-analyzer
8547 This option enables an static analysis of program flow which looks
8548 for ``interesting'' interprocedural paths through the
8549 code, and issues warnings for problems found on them.
8550
8551 This analysis is much more expensive than other GCC warnings.
8552
8553 Enabling this option effectively enables the following warnings:
8554
8555 @gccoptlist{ @gol
8556 -Wanalyzer-double-fclose @gol
8557 -Wanalyzer-double-free @gol
8558 -Wanalyzer-exposure-through-output-file @gol
8559 -Wanalyzer-file-leak @gol
8560 -Wanalyzer-free-of-non-heap @gol
8561 -Wanalyzer-malloc-leak @gol
8562 -Wanalyzer-possible-null-argument @gol
8563 -Wanalyzer-possible-null-dereference @gol
8564 -Wanalyzer-null-argument @gol
8565 -Wanalyzer-null-dereference @gol
8566 -Wanalyzer-stale-setjmp-buffer @gol
8567 -Wanalyzer-tainted-array-index @gol
8568 -Wanalyzer-unsafe-call-within-signal-handler @gol
8569 -Wanalyzer-use-after-free @gol
8570 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8571 }
8572
8573 This option is only available if GCC was configured with analyzer
8574 support enabled.
8575
8576 @item -Wanalyzer-too-complex
8577 @opindex Wanalyzer-too-complex
8578 @opindex Wno-analyzer-too-complex
8579 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8580 to attempt to explore the control flow and data flow in the program,
8581 but these can be defeated by sufficiently complicated code.
8582
8583 By default, the analysis silently stops if the code is too
8584 complicated for the analyzer to fully explore and it reaches an internal
8585 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
8586
8587 @item -Wno-analyzer-double-fclose
8588 @opindex Wanalyzer-double-fclose
8589 @opindex Wno-analyzer-double-fclose
8590 This warning requires @option{-fanalyzer}, which enables it; use
8591 @option{-Wno-analyzer-double-fclose} to disable it.
8592
8593 This diagnostic warns for paths through the code in which a @code{FILE *}
8594 can have @code{fclose} called on it more than once.
8595
8596 @item -Wno-analyzer-double-free
8597 @opindex Wanalyzer-double-free
8598 @opindex Wno-analyzer-double-free
8599 This warning requires @option{-fanalyzer}, which enables it; use
8600 @option{-Wno-analyzer-double-free} to disable it.
8601
8602 This diagnostic warns for paths through the code in which a pointer
8603 can have @code{free} called on it more than once.
8604
8605 @item -Wno-analyzer-exposure-through-output-file
8606 @opindex Wanalyzer-exposure-through-output-file
8607 @opindex Wno-analyzer-exposure-through-output-file
8608 This warning requires @option{-fanalyzer}, which enables it; use
8609 @option{-Wno-analyzer-exposure-through-output-file}
8610 to disable it.
8611
8612 This diagnostic warns for paths through the code in which a
8613 security-sensitive value is written to an output file
8614 (such as writing a password to a log file).
8615
8616 @item -Wno-analyzer-file-leak
8617 @opindex Wanalyzer-file-leak
8618 @opindex Wno-analyzer-file-leak
8619 This warning requires @option{-fanalyzer}, which enables it; use
8620 @option{-Wno-analyzer-file-leak}
8621 to disable it.
8622
8623 This diagnostic warns for paths through the code in which a
8624 @code{<stdio.h>} @code{FILE *} stream object is leaked.
8625
8626 @item -Wno-analyzer-free-of-non-heap
8627 @opindex Wanalyzer-free-of-non-heap
8628 @opindex Wno-analyzer-free-of-non-heap
8629 This warning requires @option{-fanalyzer}, which enables it; use
8630 @option{-Wno-analyzer-free-of-non-heap}
8631 to disable it.
8632
8633 This diagnostic warns for paths through the code in which @code{free}
8634 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
8635
8636 @item -Wno-analyzer-malloc-leak
8637 @opindex Wanalyzer-malloc-leak
8638 @opindex Wno-analyzer-malloc-leak
8639 This warning requires @option{-fanalyzer}, which enables it; use
8640 @option{-Wno-analyzer-malloc-leak}
8641 to disable it.
8642
8643 This diagnostic warns for paths through the code in which a
8644 pointer allocated via @code{malloc} is leaked.
8645
8646 @item -Wno-analyzer-possible-null-argument
8647 @opindex Wanalyzer-possible-null-argument
8648 @opindex Wno-analyzer-possible-null-argument
8649 This warning requires @option{-fanalyzer}, which enables it; use
8650 @option{-Wno-analyzer-possible-null-argument} to disable it.
8651
8652 This diagnostic warns for paths through the code in which a
8653 possibly-NULL value is passed to a function argument marked
8654 with @code{__attribute__((nonnull))} as requiring a non-NULL
8655 value.
8656
8657 @item -Wno-analyzer-possible-null-dereference
8658 @opindex Wanalyzer-possible-null-dereference
8659 @opindex Wno-analyzer-possible-null-dereference
8660 This warning requires @option{-fanalyzer}, which enables it; use
8661 @option{-Wno-analyzer-possible-null-dereference} to disable it.
8662
8663 This diagnostic warns for paths through the code in which a
8664 possibly-NULL value is dereferenced.
8665
8666 @item -Wno-analyzer-null-argument
8667 @opindex Wanalyzer-null-argument
8668 @opindex Wno-analyzer-null-argument
8669 This warning requires @option{-fanalyzer}, which enables it; use
8670 @option{-Wno-analyzer-null-argument} to disable it.
8671
8672 This diagnostic warns for paths through the code in which a
8673 value known to be NULL is passed to a function argument marked
8674 with @code{__attribute__((nonnull))} as requiring a non-NULL
8675 value.
8676
8677 @item -Wno-analyzer-null-dereference
8678 @opindex Wanalyzer-null-dereference
8679 @opindex Wno-analyzer-null-dereference
8680 This warning requires @option{-fanalyzer}, which enables it; use
8681 @option{-Wno-analyzer-null-dereference} to disable it.
8682
8683 This diagnostic warns for paths through the code in which a
8684 value known to be NULL is dereferenced.
8685
8686 @item -Wno-analyzer-stale-setjmp-buffer
8687 @opindex Wanalyzer-stale-setjmp-buffer
8688 @opindex Wno-analyzer-stale-setjmp-buffer
8689 This warning requires @option{-fanalyzer}, which enables it; use
8690 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
8691
8692 This diagnostic warns for paths through the code in which
8693 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
8694 to a @code{setjmp} call in a function that has returned.
8695
8696 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
8697 location, it records the stack frame. The stack frame becomes invalid
8698 when the function containing the @code{setjmp} call returns. Attempting
8699 to rewind to it via @code{longjmp} would reference a stack frame that
8700 no longer exists, and likely lead to a crash (or worse).
8701
8702 @item -Wno-analyzer-tainted-array-index
8703 @opindex Wanalyzer-tainted-array-index
8704 @opindex Wno-analyzer-tainted-array-index
8705 This warning requires both @option{-fanalyzer} and
8706 @option{-fanalyzer-checker=taint} to enable it;
8707 use @option{-Wno-analyzer-tainted-array-index} to disable it.
8708
8709 This diagnostic warns for paths through the code in which a value
8710 that could be under an attacker's control is used as the index
8711 of an array access without being sanitized.
8712
8713 @item -Wno-analyzer-unsafe-call-within-signal-handler
8714 @opindex Wanalyzer-unsafe-call-within-signal-handler
8715 @opindex Wno-analyzer-unsafe-call-within-signal-handler
8716 This warning requires @option{-fanalyzer}, which enables it; use
8717 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
8718
8719 This diagnostic warns for paths through the code in which a
8720 function known to be async-signal-unsafe (such as @code{fprintf}) is
8721 called from a signal handler.
8722
8723 @item -Wno-analyzer-use-after-free
8724 @opindex Wanalyzer-use-after-free
8725 @opindex Wno-analyzer-use-after-free
8726 This warning requires @option{-fanalyzer}, which enables it; use
8727 @option{-Wno-analyzer-use-after-free} to disable it.
8728
8729 This diagnostic warns for paths through the code in which a
8730 pointer is used after @code{free} is called on it.
8731
8732 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8733 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
8734 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
8735 This warning requires @option{-fanalyzer}, which enables it; use
8736 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
8737 to disable it.
8738
8739 This diagnostic warns for paths through the code in which a pointer
8740 is dereferenced that points to a variable in a stale stack frame.
8741
8742 @end table
8743
8744 Pertinent parameters for controlling the exploration are:
8745 @option{--param analyzer-bb-explosion-factor=@var{value}},
8746 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
8747 @option{--param analyzer-max-recursion-depth=@var{value}}, and
8748 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8749
8750 The following options control the analyzer.
8751
8752 @table @gcctabopt
8753
8754 @item -fanalyzer-call-summaries
8755 @opindex fanalyzer-call-summaries
8756 @opindex fno-analyzer-call-summaries
8757 Simplify interprocedural analysis by computing the effect of certain calls,
8758 rather than exploring all paths through the function from callsite to each
8759 possible return.
8760
8761 If enabled, call summaries are only used for functions with more than one
8762 call site, and that are sufficiently complicated (as per
8763 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8764
8765 @item -fanalyzer-checker=@var{name}
8766 @opindex fanalyzer-checker
8767 Restrict the analyzer to run just the named checker, and enable it.
8768
8769 Some checkers are disabled by default (even with @option{-fanalyzer}),
8770 such as the @code{taint} checker that implements
8771 @option{-Wanalyzer-tainted-array-index}, and this option is required
8772 to enable them.
8773
8774 @item -fanalyzer-fine-grained
8775 @opindex fanalyzer-fine-grained
8776 @opindex fno-analyzer-fine-grained
8777 This option is intended for analyzer developers.
8778
8779 Internally the analyzer builds an ``exploded graph'' that combines
8780 control flow graphs with data flow information.
8781
8782 By default, an edge in this graph can contain the effects of a run
8783 of multiple statements within a basic block. With
8784 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
8785
8786 @item -fanalyzer-show-duplicate-count
8787 @opindex fanalyzer-show-duplicate-count
8788 @opindex fno-analyzer-show-duplicate-count
8789 This option is intended for analyzer developers: if multiple diagnostics
8790 have been detected as being duplicates of each other, it emits a note when
8791 reporting the best diagnostic, giving the number of additional diagnostics
8792 that were suppressed by the deduplication logic.
8793
8794 @item -fno-analyzer-state-merge
8795 @opindex fanalyzer-state-merge
8796 @opindex fno-analyzer-state-merge
8797 This option is intended for analyzer developers.
8798
8799 By default the analyzer attempts to simplify analysis by merging
8800 sufficiently similar states at each program point as it builds its
8801 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
8802 merging can be suppressed, for debugging state-handling issues.
8803
8804 @item -fno-analyzer-state-purge
8805 @opindex fanalyzer-state-purge
8806 @opindex fno-analyzer-state-purge
8807 This option is intended for analyzer developers.
8808
8809 By default the analyzer attempts to simplify analysis by purging
8810 aspects of state at a program point that appear to no longer be relevant
8811 e.g. the values of locals that aren't accessed later in the function
8812 and which aren't relevant to leak analysis.
8813
8814 With @option{-fno-analyzer-state-purge} this purging of state can
8815 be suppressed, for debugging state-handling issues.
8816
8817 @item -fanalyzer-transitivity
8818 @opindex fanalyzer-transitivity
8819 @opindex fno-analyzer-transitivity
8820 This option enables transitivity of constraints within the analyzer.
8821
8822 @item -fanalyzer-verbose-edges
8823 This option is intended for analyzer developers. It enables more
8824 verbose, lower-level detail in the descriptions of control flow
8825 within diagnostic paths.
8826
8827 @item -fanalyzer-verbose-state-changes
8828 This option is intended for analyzer developers. It enables more
8829 verbose, lower-level detail in the descriptions of events relating
8830 to state machines within diagnostic paths.
8831
8832 @item -fanalyzer-verbosity=@var{level}
8833 This option controls the complexity of the control flow paths that are
8834 emitted for analyzer diagnostics.
8835
8836 The @var{level} can be one of:
8837
8838 @table @samp
8839 @item 0
8840 At this level, interprocedural call and return events are displayed,
8841 along with the most pertinent state-change events relating to
8842 a diagnostic. For example, for a double-@code{free} diagnostic,
8843 both calls to @code{free} will be shown.
8844
8845 @item 1
8846 As per the previous level, but also show events for the entry
8847 to each function.
8848
8849 @item 2
8850 As per the previous level, but also show events relating to
8851 control flow that are significant to triggering the issue
8852 (e.g. ``true path taken'' at a conditional).
8853
8854 This level is the default.
8855
8856 @item 3
8857 As per the previous level, but show all control flow events, not
8858 just significant ones.
8859
8860 @item 4
8861 This level is intended for analyzer developers; it adds various
8862 other events intended for debugging the analyzer.
8863
8864 @end table
8865
8866 @item -fdump-analyzer
8867 @opindex fdump-analyzer
8868 Dump internal details about what the analyzer is doing to
8869 @file{@var{file}.analyzer.txt}.
8870 This option is overridden by @option{-fdump-analyzer-stderr}.
8871
8872 @item -fdump-analyzer-stderr
8873 @opindex fdump-analyzer-stderr
8874 Dump internal details about what the analyzer is doing to stderr.
8875 This option overrides @option{-fdump-analyzer}.
8876
8877 @item -fdump-analyzer-callgraph
8878 @opindex fdump-analyzer-callgraph
8879 Dump a representation of the call graph suitable for viewing with
8880 GraphViz to @file{@var{file}.callgraph.dot}.
8881
8882 @item -fdump-analyzer-exploded-graph
8883 @opindex fdump-analyzer-exploded-graph
8884 Dump a representation of the ``exploded graph'' suitable for viewing with
8885 GraphViz to @file{@var{file}.eg.dot}.
8886 Nodes are color-coded based on state-machine states to emphasize
8887 state changes.
8888
8889 @item -fdump-analyzer-exploded-nodes
8890 @opindex dump-analyzer-exploded-nodes
8891 Emit diagnostics showing where nodes in the ``exploded graph'' are
8892 in relation to the program source.
8893
8894 @item -fdump-analyzer-exploded-nodes-2
8895 @opindex dump-analyzer-exploded-nodes-2
8896 Dump a textual representation of the ``exploded graph'' to
8897 @file{@var{file}.eg.txt}.
8898
8899 @item -fdump-analyzer-exploded-nodes-3
8900 @opindex dump-analyzer-exploded-nodes-3
8901 Dump a textual representation of the ``exploded graph'' to
8902 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
8903 This is typically a large number of dump files.
8904
8905 @item -fdump-analyzer-state-purge
8906 @opindex fdump-analyzer-state-purge
8907 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
8908 ``supergraph'' suitable for viewing with GraphViz, but annotate the
8909 graph with information on what state will be purged at each node.
8910 The graph is written to @file{@var{file}.state-purge.dot}.
8911
8912 @item -fdump-analyzer-supergraph
8913 @opindex fdump-analyzer-supergraph
8914 Dump representations of the ``supergraph'' suitable for viewing with
8915 GraphViz to @file{@var{file}.supergraph.dot} and to
8916 @file{@var{file}.supergraph-eg.dot}. These show all of the
8917 control flow graphs in the program, with interprocedural edges for
8918 calls and returns. The second dump contains annotations showing nodes
8919 in the ``exploded graph'' and diagnostics associated with them.
8920
8921 @end table
8922
8923 @node Debugging Options
8924 @section Options for Debugging Your Program
8925 @cindex options, debugging
8926 @cindex debugging information options
8927
8928 To tell GCC to emit extra information for use by a debugger, in almost
8929 all cases you need only to add @option{-g} to your other options.
8930
8931 GCC allows you to use @option{-g} with
8932 @option{-O}. The shortcuts taken by optimized code may occasionally
8933 be surprising: some variables you declared may not exist
8934 at all; flow of control may briefly move where you did not expect it;
8935 some statements may not be executed because they compute constant
8936 results or their values are already at hand; some statements may
8937 execute in different places because they have been moved out of loops.
8938 Nevertheless it is possible to debug optimized output. This makes
8939 it reasonable to use the optimizer for programs that might have bugs.
8940
8941 If you are not using some other optimization option, consider
8942 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
8943 With no @option{-O} option at all, some compiler passes that collect
8944 information useful for debugging do not run at all, so that
8945 @option{-Og} may result in a better debugging experience.
8946
8947 @table @gcctabopt
8948 @item -g
8949 @opindex g
8950 Produce debugging information in the operating system's native format
8951 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
8952 information.
8953
8954 On most systems that use stabs format, @option{-g} enables use of extra
8955 debugging information that only GDB can use; this extra information
8956 makes debugging work better in GDB but probably makes other debuggers
8957 crash or
8958 refuse to read the program. If you want to control for certain whether
8959 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
8960 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
8961
8962 @item -ggdb
8963 @opindex ggdb
8964 Produce debugging information for use by GDB@. This means to use the
8965 most expressive format available (DWARF, stabs, or the native format
8966 if neither of those are supported), including GDB extensions if at all
8967 possible.
8968
8969 @item -gdwarf
8970 @itemx -gdwarf-@var{version}
8971 @opindex gdwarf
8972 Produce debugging information in DWARF format (if that is supported).
8973 The value of @var{version} may be either 2, 3, 4 or 5; the default version
8974 for most targets is 4. DWARF Version 5 is only experimental.
8975
8976 Note that with DWARF Version 2, some ports require and always
8977 use some non-conflicting DWARF 3 extensions in the unwind tables.
8978
8979 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
8980 for maximum benefit.
8981
8982 GCC no longer supports DWARF Version 1, which is substantially
8983 different than Version 2 and later. For historical reasons, some
8984 other DWARF-related options such as
8985 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
8986 in their names, but apply to all currently-supported versions of DWARF.
8987
8988 @item -gstabs
8989 @opindex gstabs
8990 Produce debugging information in stabs format (if that is supported),
8991 without GDB extensions. This is the format used by DBX on most BSD
8992 systems. On MIPS, Alpha and System V Release 4 systems this option
8993 produces stabs debugging output that is not understood by DBX@.
8994 On System V Release 4 systems this option requires the GNU assembler.
8995
8996 @item -gstabs+
8997 @opindex gstabs+
8998 Produce debugging information in stabs format (if that is supported),
8999 using GNU extensions understood only by the GNU debugger (GDB)@. The
9000 use of these extensions is likely to make other debuggers crash or
9001 refuse to read the program.
9002
9003 @item -gxcoff
9004 @opindex gxcoff
9005 Produce debugging information in XCOFF format (if that is supported).
9006 This is the format used by the DBX debugger on IBM RS/6000 systems.
9007
9008 @item -gxcoff+
9009 @opindex gxcoff+
9010 Produce debugging information in XCOFF format (if that is supported),
9011 using GNU extensions understood only by the GNU debugger (GDB)@. The
9012 use of these extensions is likely to make other debuggers crash or
9013 refuse to read the program, and may cause assemblers other than the GNU
9014 assembler (GAS) to fail with an error.
9015
9016 @item -gvms
9017 @opindex gvms
9018 Produce debugging information in Alpha/VMS debug format (if that is
9019 supported). This is the format used by DEBUG on Alpha/VMS systems.
9020
9021 @item -g@var{level}
9022 @itemx -ggdb@var{level}
9023 @itemx -gstabs@var{level}
9024 @itemx -gxcoff@var{level}
9025 @itemx -gvms@var{level}
9026 Request debugging information and also use @var{level} to specify how
9027 much information. The default level is 2.
9028
9029 Level 0 produces no debug information at all. Thus, @option{-g0} negates
9030 @option{-g}.
9031
9032 Level 1 produces minimal information, enough for making backtraces in
9033 parts of the program that you don't plan to debug. This includes
9034 descriptions of functions and external variables, and line number
9035 tables, but no information about local variables.
9036
9037 Level 3 includes extra information, such as all the macro definitions
9038 present in the program. Some debuggers support macro expansion when
9039 you use @option{-g3}.
9040
9041 If you use multiple @option{-g} options, with or without level numbers,
9042 the last such option is the one that is effective.
9043
9044 @option{-gdwarf} does not accept a concatenated debug level, to avoid
9045 confusion with @option{-gdwarf-@var{level}}.
9046 Instead use an additional @option{-g@var{level}} option to change the
9047 debug level for DWARF.
9048
9049 @item -fno-eliminate-unused-debug-symbols
9050 @opindex feliminate-unused-debug-symbols
9051 @opindex fno-eliminate-unused-debug-symbols
9052 By default, no debug information is produced for symbols that are not actually
9053 used. Use this option if you want debug information for all symbols.
9054
9055 @item -femit-class-debug-always
9056 @opindex femit-class-debug-always
9057 Instead of emitting debugging information for a C++ class in only one
9058 object file, emit it in all object files using the class. This option
9059 should be used only with debuggers that are unable to handle the way GCC
9060 normally emits debugging information for classes because using this
9061 option increases the size of debugging information by as much as a
9062 factor of two.
9063
9064 @item -fno-merge-debug-strings
9065 @opindex fmerge-debug-strings
9066 @opindex fno-merge-debug-strings
9067 Direct the linker to not merge together strings in the debugging
9068 information that are identical in different object files. Merging is
9069 not supported by all assemblers or linkers. Merging decreases the size
9070 of the debug information in the output file at the cost of increasing
9071 link processing time. Merging is enabled by default.
9072
9073 @item -fdebug-prefix-map=@var{old}=@var{new}
9074 @opindex fdebug-prefix-map
9075 When compiling files residing in directory @file{@var{old}}, record
9076 debugging information describing them as if the files resided in
9077 directory @file{@var{new}} instead. This can be used to replace a
9078 build-time path with an install-time path in the debug info. It can
9079 also be used to change an absolute path to a relative path by using
9080 @file{.} for @var{new}. This can give more reproducible builds, which
9081 are location independent, but may require an extra command to tell GDB
9082 where to find the source files. See also @option{-ffile-prefix-map}.
9083
9084 @item -fvar-tracking
9085 @opindex fvar-tracking
9086 Run variable tracking pass. It computes where variables are stored at each
9087 position in code. Better debugging information is then generated
9088 (if the debugging information format supports this information).
9089
9090 It is enabled by default when compiling with optimization (@option{-Os},
9091 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
9092 the debug info format supports it.
9093
9094 @item -fvar-tracking-assignments
9095 @opindex fvar-tracking-assignments
9096 @opindex fno-var-tracking-assignments
9097 Annotate assignments to user variables early in the compilation and
9098 attempt to carry the annotations over throughout the compilation all the
9099 way to the end, in an attempt to improve debug information while
9100 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
9101
9102 It can be enabled even if var-tracking is disabled, in which case
9103 annotations are created and maintained, but discarded at the end.
9104 By default, this flag is enabled together with @option{-fvar-tracking},
9105 except when selective scheduling is enabled.
9106
9107 @item -gsplit-dwarf
9108 @opindex gsplit-dwarf
9109 Separate as much DWARF debugging information as possible into a
9110 separate output file with the extension @file{.dwo}. This option allows
9111 the build system to avoid linking files with debug information. To
9112 be useful, this option requires a debugger capable of reading @file{.dwo}
9113 files.
9114
9115 @item -gdescribe-dies
9116 @opindex gdescribe-dies
9117 Add description attributes to some DWARF DIEs that have no name attribute,
9118 such as artificial variables, external references and call site
9119 parameter DIEs.
9120
9121 @item -gpubnames
9122 @opindex gpubnames
9123 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
9124
9125 @item -ggnu-pubnames
9126 @opindex ggnu-pubnames
9127 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
9128 suitable for conversion into a GDB@ index. This option is only useful
9129 with a linker that can produce GDB@ index version 7.
9130
9131 @item -fdebug-types-section
9132 @opindex fdebug-types-section
9133 @opindex fno-debug-types-section
9134 When using DWARF Version 4 or higher, type DIEs can be put into
9135 their own @code{.debug_types} section instead of making them part of the
9136 @code{.debug_info} section. It is more efficient to put them in a separate
9137 comdat section since the linker can then remove duplicates.
9138 But not all DWARF consumers support @code{.debug_types} sections yet
9139 and on some objects @code{.debug_types} produces larger instead of smaller
9140 debugging information.
9141
9142 @item -grecord-gcc-switches
9143 @itemx -gno-record-gcc-switches
9144 @opindex grecord-gcc-switches
9145 @opindex gno-record-gcc-switches
9146 This switch causes the command-line options used to invoke the
9147 compiler that may affect code generation to be appended to the
9148 DW_AT_producer attribute in DWARF debugging information. The options
9149 are concatenated with spaces separating them from each other and from
9150 the compiler version.
9151 It is enabled by default.
9152 See also @option{-frecord-gcc-switches} for another
9153 way of storing compiler options into the object file.
9154
9155 @item -gstrict-dwarf
9156 @opindex gstrict-dwarf
9157 Disallow using extensions of later DWARF standard version than selected
9158 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
9159 DWARF extensions from later standard versions is allowed.
9160
9161 @item -gno-strict-dwarf
9162 @opindex gno-strict-dwarf
9163 Allow using extensions of later DWARF standard version than selected with
9164 @option{-gdwarf-@var{version}}.
9165
9166 @item -gas-loc-support
9167 @opindex gas-loc-support
9168 Inform the compiler that the assembler supports @code{.loc} directives.
9169 It may then use them for the assembler to generate DWARF2+ line number
9170 tables.
9171
9172 This is generally desirable, because assembler-generated line-number
9173 tables are a lot more compact than those the compiler can generate
9174 itself.
9175
9176 This option will be enabled by default if, at GCC configure time, the
9177 assembler was found to support such directives.
9178
9179 @item -gno-as-loc-support
9180 @opindex gno-as-loc-support
9181 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
9182 line number tables are to be generated.
9183
9184 @item -gas-locview-support
9185 @opindex gas-locview-support
9186 Inform the compiler that the assembler supports @code{view} assignment
9187 and reset assertion checking in @code{.loc} directives.
9188
9189 This option will be enabled by default if, at GCC configure time, the
9190 assembler was found to support them.
9191
9192 @item -gno-as-locview-support
9193 Force GCC to assign view numbers internally, if
9194 @option{-gvariable-location-views} are explicitly requested.
9195
9196 @item -gcolumn-info
9197 @itemx -gno-column-info
9198 @opindex gcolumn-info
9199 @opindex gno-column-info
9200 Emit location column information into DWARF debugging information, rather
9201 than just file and line.
9202 This option is enabled by default.
9203
9204 @item -gstatement-frontiers
9205 @itemx -gno-statement-frontiers
9206 @opindex gstatement-frontiers
9207 @opindex gno-statement-frontiers
9208 This option causes GCC to create markers in the internal representation
9209 at the beginning of statements, and to keep them roughly in place
9210 throughout compilation, using them to guide the output of @code{is_stmt}
9211 markers in the line number table. This is enabled by default when
9212 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
9213 @dots{}), and outputting DWARF 2 debug information at the normal level.
9214
9215 @item -gvariable-location-views
9216 @itemx -gvariable-location-views=incompat5
9217 @itemx -gno-variable-location-views
9218 @opindex gvariable-location-views
9219 @opindex gvariable-location-views=incompat5
9220 @opindex gno-variable-location-views
9221 Augment variable location lists with progressive view numbers implied
9222 from the line number table. This enables debug information consumers to
9223 inspect state at certain points of the program, even if no instructions
9224 associated with the corresponding source locations are present at that
9225 point. If the assembler lacks support for view numbers in line number
9226 tables, this will cause the compiler to emit the line number table,
9227 which generally makes them somewhat less compact. The augmented line
9228 number tables and location lists are fully backward-compatible, so they
9229 can be consumed by debug information consumers that are not aware of
9230 these augmentations, but they won't derive any benefit from them either.
9231
9232 This is enabled by default when outputting DWARF 2 debug information at
9233 the normal level, as long as there is assembler support,
9234 @option{-fvar-tracking-assignments} is enabled and
9235 @option{-gstrict-dwarf} is not. When assembler support is not
9236 available, this may still be enabled, but it will force GCC to output
9237 internal line number tables, and if
9238 @option{-ginternal-reset-location-views} is not enabled, that will most
9239 certainly lead to silently mismatching location views.
9240
9241 There is a proposed representation for view numbers that is not backward
9242 compatible with the location list format introduced in DWARF 5, that can
9243 be enabled with @option{-gvariable-location-views=incompat5}. This
9244 option may be removed in the future, is only provided as a reference
9245 implementation of the proposed representation. Debug information
9246 consumers are not expected to support this extended format, and they
9247 would be rendered unable to decode location lists using it.
9248
9249 @item -ginternal-reset-location-views
9250 @itemx -gno-internal-reset-location-views
9251 @opindex ginternal-reset-location-views
9252 @opindex gno-internal-reset-location-views
9253 Attempt to determine location views that can be omitted from location
9254 view lists. This requires the compiler to have very accurate insn
9255 length estimates, which isn't always the case, and it may cause
9256 incorrect view lists to be generated silently when using an assembler
9257 that does not support location view lists. The GNU assembler will flag
9258 any such error as a @code{view number mismatch}. This is only enabled
9259 on ports that define a reliable estimation function.
9260
9261 @item -ginline-points
9262 @itemx -gno-inline-points
9263 @opindex ginline-points
9264 @opindex gno-inline-points
9265 Generate extended debug information for inlined functions. Location
9266 view tracking markers are inserted at inlined entry points, so that
9267 address and view numbers can be computed and output in debug
9268 information. This can be enabled independently of location views, in
9269 which case the view numbers won't be output, but it can only be enabled
9270 along with statement frontiers, and it is only enabled by default if
9271 location views are enabled.
9272
9273 @item -gz@r{[}=@var{type}@r{]}
9274 @opindex gz
9275 Produce compressed debug sections in DWARF format, if that is supported.
9276 If @var{type} is not given, the default type depends on the capabilities
9277 of the assembler and linker used. @var{type} may be one of
9278 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
9279 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
9280 compression in traditional GNU format). If the linker doesn't support
9281 writing compressed debug sections, the option is rejected. Otherwise,
9282 if the assembler does not support them, @option{-gz} is silently ignored
9283 when producing object files.
9284
9285 @item -femit-struct-debug-baseonly
9286 @opindex femit-struct-debug-baseonly
9287 Emit debug information for struct-like types
9288 only when the base name of the compilation source file
9289 matches the base name of file in which the struct is defined.
9290
9291 This option substantially reduces the size of debugging information,
9292 but at significant potential loss in type information to the debugger.
9293 See @option{-femit-struct-debug-reduced} for a less aggressive option.
9294 See @option{-femit-struct-debug-detailed} for more detailed control.
9295
9296 This option works only with DWARF debug output.
9297
9298 @item -femit-struct-debug-reduced
9299 @opindex femit-struct-debug-reduced
9300 Emit debug information for struct-like types
9301 only when the base name of the compilation source file
9302 matches the base name of file in which the type is defined,
9303 unless the struct is a template or defined in a system header.
9304
9305 This option significantly reduces the size of debugging information,
9306 with some potential loss in type information to the debugger.
9307 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9308 See @option{-femit-struct-debug-detailed} for more detailed control.
9309
9310 This option works only with DWARF debug output.
9311
9312 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9313 @opindex femit-struct-debug-detailed
9314 Specify the struct-like types
9315 for which the compiler generates debug information.
9316 The intent is to reduce duplicate struct debug information
9317 between different object files within the same program.
9318
9319 This option is a detailed version of
9320 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9321 which serves for most needs.
9322
9323 A specification has the syntax@*
9324 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9325
9326 The optional first word limits the specification to
9327 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9328 A struct type is used directly when it is the type of a variable, member.
9329 Indirect uses arise through pointers to structs.
9330 That is, when use of an incomplete struct is valid, the use is indirect.
9331 An example is
9332 @samp{struct one direct; struct two * indirect;}.
9333
9334 The optional second word limits the specification to
9335 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9336 Generic structs are a bit complicated to explain.
9337 For C++, these are non-explicit specializations of template classes,
9338 or non-template classes within the above.
9339 Other programming languages have generics,
9340 but @option{-femit-struct-debug-detailed} does not yet implement them.
9341
9342 The third word specifies the source files for those
9343 structs for which the compiler should emit debug information.
9344 The values @samp{none} and @samp{any} have the normal meaning.
9345 The value @samp{base} means that
9346 the base of name of the file in which the type declaration appears
9347 must match the base of the name of the main compilation file.
9348 In practice, this means that when compiling @file{foo.c}, debug information
9349 is generated for types declared in that file and @file{foo.h},
9350 but not other header files.
9351 The value @samp{sys} means those types satisfying @samp{base}
9352 or declared in system or compiler headers.
9353
9354 You may need to experiment to determine the best settings for your application.
9355
9356 The default is @option{-femit-struct-debug-detailed=all}.
9357
9358 This option works only with DWARF debug output.
9359
9360 @item -fno-dwarf2-cfi-asm
9361 @opindex fdwarf2-cfi-asm
9362 @opindex fno-dwarf2-cfi-asm
9363 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9364 instead of using GAS @code{.cfi_*} directives.
9365
9366 @item -fno-eliminate-unused-debug-types
9367 @opindex feliminate-unused-debug-types
9368 @opindex fno-eliminate-unused-debug-types
9369 Normally, when producing DWARF output, GCC avoids producing debug symbol
9370 output for types that are nowhere used in the source file being compiled.
9371 Sometimes it is useful to have GCC emit debugging
9372 information for all types declared in a compilation
9373 unit, regardless of whether or not they are actually used
9374 in that compilation unit, for example
9375 if, in the debugger, you want to cast a value to a type that is
9376 not actually used in your program (but is declared). More often,
9377 however, this results in a significant amount of wasted space.
9378 @end table
9379
9380 @node Optimize Options
9381 @section Options That Control Optimization
9382 @cindex optimize options
9383 @cindex options, optimization
9384
9385 These options control various sorts of optimizations.
9386
9387 Without any optimization option, the compiler's goal is to reduce the
9388 cost of compilation and to make debugging produce the expected
9389 results. Statements are independent: if you stop the program with a
9390 breakpoint between statements, you can then assign a new value to any
9391 variable or change the program counter to any other statement in the
9392 function and get exactly the results you expect from the source
9393 code.
9394
9395 Turning on optimization flags makes the compiler attempt to improve
9396 the performance and/or code size at the expense of compilation time
9397 and possibly the ability to debug the program.
9398
9399 The compiler performs optimization based on the knowledge it has of the
9400 program. Compiling multiple files at once to a single output file mode allows
9401 the compiler to use information gained from all of the files when compiling
9402 each of them.
9403
9404 Not all optimizations are controlled directly by a flag. Only
9405 optimizations that have a flag are listed in this section.
9406
9407 Most optimizations are completely disabled at @option{-O0} or if an
9408 @option{-O} level is not set on the command line, even if individual
9409 optimization flags are specified. Similarly, @option{-Og} suppresses
9410 many optimization passes.
9411
9412 Depending on the target and how GCC was configured, a slightly different
9413 set of optimizations may be enabled at each @option{-O} level than
9414 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
9415 to find out the exact set of optimizations that are enabled at each level.
9416 @xref{Overall Options}, for examples.
9417
9418 @table @gcctabopt
9419 @item -O
9420 @itemx -O1
9421 @opindex O
9422 @opindex O1
9423 Optimize. Optimizing compilation takes somewhat more time, and a lot
9424 more memory for a large function.
9425
9426 With @option{-O}, the compiler tries to reduce code size and execution
9427 time, without performing any optimizations that take a great deal of
9428 compilation time.
9429
9430 @c Note that in addition to the default_options_table list in opts.c,
9431 @c several optimization flags default to true but control optimization
9432 @c passes that are explicitly disabled at -O0.
9433
9434 @option{-O} turns on the following optimization flags:
9435
9436 @c Please keep the following list alphabetized.
9437 @gccoptlist{-fauto-inc-dec @gol
9438 -fbranch-count-reg @gol
9439 -fcombine-stack-adjustments @gol
9440 -fcompare-elim @gol
9441 -fcprop-registers @gol
9442 -fdce @gol
9443 -fdefer-pop @gol
9444 -fdelayed-branch @gol
9445 -fdse @gol
9446 -fforward-propagate @gol
9447 -fguess-branch-probability @gol
9448 -fif-conversion @gol
9449 -fif-conversion2 @gol
9450 -finline-functions-called-once @gol
9451 -fipa-profile @gol
9452 -fipa-pure-const @gol
9453 -fipa-reference @gol
9454 -fipa-reference-addressable @gol
9455 -fmerge-constants @gol
9456 -fmove-loop-invariants @gol
9457 -fomit-frame-pointer @gol
9458 -freorder-blocks @gol
9459 -fshrink-wrap @gol
9460 -fshrink-wrap-separate @gol
9461 -fsplit-wide-types @gol
9462 -fssa-backprop @gol
9463 -fssa-phiopt @gol
9464 -ftree-bit-ccp @gol
9465 -ftree-ccp @gol
9466 -ftree-ch @gol
9467 -ftree-coalesce-vars @gol
9468 -ftree-copy-prop @gol
9469 -ftree-dce @gol
9470 -ftree-dominator-opts @gol
9471 -ftree-dse @gol
9472 -ftree-forwprop @gol
9473 -ftree-fre @gol
9474 -ftree-phiprop @gol
9475 -ftree-pta @gol
9476 -ftree-scev-cprop @gol
9477 -ftree-sink @gol
9478 -ftree-slsr @gol
9479 -ftree-sra @gol
9480 -ftree-ter @gol
9481 -funit-at-a-time}
9482
9483 @item -O2
9484 @opindex O2
9485 Optimize even more. GCC performs nearly all supported optimizations
9486 that do not involve a space-speed tradeoff.
9487 As compared to @option{-O}, this option increases both compilation time
9488 and the performance of the generated code.
9489
9490 @option{-O2} turns on all optimization flags specified by @option{-O}. It
9491 also turns on the following optimization flags:
9492
9493 @c Please keep the following list alphabetized!
9494 @gccoptlist{-falign-functions -falign-jumps @gol
9495 -falign-labels -falign-loops @gol
9496 -fcaller-saves @gol
9497 -fcode-hoisting @gol
9498 -fcrossjumping @gol
9499 -fcse-follow-jumps -fcse-skip-blocks @gol
9500 -fdelete-null-pointer-checks @gol
9501 -fdevirtualize -fdevirtualize-speculatively @gol
9502 -fexpensive-optimizations @gol
9503 -ffinite-loops @gol
9504 -fgcse -fgcse-lm @gol
9505 -fhoist-adjacent-loads @gol
9506 -finline-functions @gol
9507 -finline-small-functions @gol
9508 -findirect-inlining @gol
9509 -fipa-bit-cp -fipa-cp -fipa-icf @gol
9510 -fipa-ra -fipa-sra -fipa-vrp @gol
9511 -fisolate-erroneous-paths-dereference @gol
9512 -flra-remat @gol
9513 -foptimize-sibling-calls @gol
9514 -foptimize-strlen @gol
9515 -fpartial-inlining @gol
9516 -fpeephole2 @gol
9517 -freorder-blocks-algorithm=stc @gol
9518 -freorder-blocks-and-partition -freorder-functions @gol
9519 -frerun-cse-after-loop @gol
9520 -fschedule-insns -fschedule-insns2 @gol
9521 -fsched-interblock -fsched-spec @gol
9522 -fstore-merging @gol
9523 -fstrict-aliasing @gol
9524 -fthread-jumps @gol
9525 -ftree-builtin-call-dce @gol
9526 -ftree-pre @gol
9527 -ftree-switch-conversion -ftree-tail-merge @gol
9528 -ftree-vrp}
9529
9530 Please note the warning under @option{-fgcse} about
9531 invoking @option{-O2} on programs that use computed gotos.
9532
9533 @item -O3
9534 @opindex O3
9535 Optimize yet more. @option{-O3} turns on all optimizations specified
9536 by @option{-O2} and also turns on the following optimization flags:
9537
9538 @c Please keep the following list alphabetized!
9539 @gccoptlist{-fgcse-after-reload @gol
9540 -fipa-cp-clone
9541 -floop-interchange @gol
9542 -floop-unroll-and-jam @gol
9543 -fpeel-loops @gol
9544 -fpredictive-commoning @gol
9545 -fsplit-loops @gol
9546 -fsplit-paths @gol
9547 -ftree-loop-distribution @gol
9548 -ftree-loop-vectorize @gol
9549 -ftree-partial-pre @gol
9550 -ftree-slp-vectorize @gol
9551 -funswitch-loops @gol
9552 -fvect-cost-model @gol
9553 -fvect-cost-model=dynamic @gol
9554 -fversion-loops-for-strides}
9555
9556 @item -O0
9557 @opindex O0
9558 Reduce compilation time and make debugging produce the expected
9559 results. This is the default.
9560
9561 @item -Os
9562 @opindex Os
9563 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
9564 except those that often increase code size:
9565
9566 @gccoptlist{-falign-functions -falign-jumps @gol
9567 -falign-labels -falign-loops @gol
9568 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
9569
9570 It also enables @option{-finline-functions}, causes the compiler to tune for
9571 code size rather than execution speed, and performs further optimizations
9572 designed to reduce code size.
9573
9574 @item -Ofast
9575 @opindex Ofast
9576 Disregard strict standards compliance. @option{-Ofast} enables all
9577 @option{-O3} optimizations. It also enables optimizations that are not
9578 valid for all standard-compliant programs.
9579 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9580 and the Fortran-specific @option{-fstack-arrays}, unless
9581 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9582
9583 @item -Og
9584 @opindex Og
9585 Optimize debugging experience. @option{-Og} should be the optimization
9586 level of choice for the standard edit-compile-debug cycle, offering
9587 a reasonable level of optimization while maintaining fast compilation
9588 and a good debugging experience. It is a better choice than @option{-O0}
9589 for producing debuggable code because some compiler passes
9590 that collect debug information are disabled at @option{-O0}.
9591
9592 Like @option{-O0}, @option{-Og} completely disables a number of
9593 optimization passes so that individual options controlling them have
9594 no effect. Otherwise @option{-Og} enables all @option{-O1}
9595 optimization flags except for those that may interfere with debugging:
9596
9597 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
9598 -fdse -fif-conversion -fif-conversion2 @gol
9599 -finline-functions-called-once @gol
9600 -fmove-loop-invariants -fssa-phiopt @gol
9601 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
9602
9603 @end table
9604
9605 If you use multiple @option{-O} options, with or without level numbers,
9606 the last such option is the one that is effective.
9607
9608 Options of the form @option{-f@var{flag}} specify machine-independent
9609 flags. Most flags have both positive and negative forms; the negative
9610 form of @option{-ffoo} is @option{-fno-foo}. In the table
9611 below, only one of the forms is listed---the one you typically
9612 use. You can figure out the other form by either removing @samp{no-}
9613 or adding it.
9614
9615 The following options control specific optimizations. They are either
9616 activated by @option{-O} options or are related to ones that are. You
9617 can use the following flags in the rare cases when ``fine-tuning'' of
9618 optimizations to be performed is desired.
9619
9620 @table @gcctabopt
9621 @item -fno-defer-pop
9622 @opindex fno-defer-pop
9623 @opindex fdefer-pop
9624 For machines that must pop arguments after a function call, always pop
9625 the arguments as soon as each function returns.
9626 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9627 this allows the compiler to let arguments accumulate on the stack for several
9628 function calls and pop them all at once.
9629
9630 @item -fforward-propagate
9631 @opindex fforward-propagate
9632 Perform a forward propagation pass on RTL@. The pass tries to combine two
9633 instructions and checks if the result can be simplified. If loop unrolling
9634 is active, two passes are performed and the second is scheduled after
9635 loop unrolling.
9636
9637 This option is enabled by default at optimization levels @option{-O},
9638 @option{-O2}, @option{-O3}, @option{-Os}.
9639
9640 @item -ffp-contract=@var{style}
9641 @opindex ffp-contract
9642 @option{-ffp-contract=off} disables floating-point expression contraction.
9643 @option{-ffp-contract=fast} enables floating-point expression contraction
9644 such as forming of fused multiply-add operations if the target has
9645 native support for them.
9646 @option{-ffp-contract=on} enables floating-point expression contraction
9647 if allowed by the language standard. This is currently not implemented
9648 and treated equal to @option{-ffp-contract=off}.
9649
9650 The default is @option{-ffp-contract=fast}.
9651
9652 @item -fomit-frame-pointer
9653 @opindex fomit-frame-pointer
9654 Omit the frame pointer in functions that don't need one. This avoids the
9655 instructions to save, set up and restore the frame pointer; on many targets
9656 it also makes an extra register available.
9657
9658 On some targets this flag has no effect because the standard calling sequence
9659 always uses a frame pointer, so it cannot be omitted.
9660
9661 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9662 is used in all functions. Several targets always omit the frame pointer in
9663 leaf functions.
9664
9665 Enabled by default at @option{-O} and higher.
9666
9667 @item -foptimize-sibling-calls
9668 @opindex foptimize-sibling-calls
9669 Optimize sibling and tail recursive calls.
9670
9671 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9672
9673 @item -foptimize-strlen
9674 @opindex foptimize-strlen
9675 Optimize various standard C string functions (e.g.@: @code{strlen},
9676 @code{strchr} or @code{strcpy}) and
9677 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9678
9679 Enabled at levels @option{-O2}, @option{-O3}.
9680
9681 @item -fno-inline
9682 @opindex fno-inline
9683 @opindex finline
9684 Do not expand any functions inline apart from those marked with
9685 the @code{always_inline} attribute. This is the default when not
9686 optimizing.
9687
9688 Single functions can be exempted from inlining by marking them
9689 with the @code{noinline} attribute.
9690
9691 @item -finline-small-functions
9692 @opindex finline-small-functions
9693 Integrate functions into their callers when their body is smaller than expected
9694 function call code (so overall size of program gets smaller). The compiler
9695 heuristically decides which functions are simple enough to be worth integrating
9696 in this way. This inlining applies to all functions, even those not declared
9697 inline.
9698
9699 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9700
9701 @item -findirect-inlining
9702 @opindex findirect-inlining
9703 Inline also indirect calls that are discovered to be known at compile
9704 time thanks to previous inlining. This option has any effect only
9705 when inlining itself is turned on by the @option{-finline-functions}
9706 or @option{-finline-small-functions} options.
9707
9708 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9709
9710 @item -finline-functions
9711 @opindex finline-functions
9712 Consider all functions for inlining, even if they are not declared inline.
9713 The compiler heuristically decides which functions are worth integrating
9714 in this way.
9715
9716 If all calls to a given function are integrated, and the function is
9717 declared @code{static}, then the function is normally not output as
9718 assembler code in its own right.
9719
9720 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
9721 by @option{-fprofile-use} and @option{-fauto-profile}.
9722
9723 @item -finline-functions-called-once
9724 @opindex finline-functions-called-once
9725 Consider all @code{static} functions called once for inlining into their
9726 caller even if they are not marked @code{inline}. If a call to a given
9727 function is integrated, then the function is not output as assembler code
9728 in its own right.
9729
9730 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9731 but not @option{-Og}.
9732
9733 @item -fearly-inlining
9734 @opindex fearly-inlining
9735 Inline functions marked by @code{always_inline} and functions whose body seems
9736 smaller than the function call overhead early before doing
9737 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
9738 makes profiling significantly cheaper and usually inlining faster on programs
9739 having large chains of nested wrapper functions.
9740
9741 Enabled by default.
9742
9743 @item -fipa-sra
9744 @opindex fipa-sra
9745 Perform interprocedural scalar replacement of aggregates, removal of
9746 unused parameters and replacement of parameters passed by reference
9747 by parameters passed by value.
9748
9749 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9750
9751 @item -finline-limit=@var{n}
9752 @opindex finline-limit
9753 By default, GCC limits the size of functions that can be inlined. This flag
9754 allows coarse control of this limit. @var{n} is the size of functions that
9755 can be inlined in number of pseudo instructions.
9756
9757 Inlining is actually controlled by a number of parameters, which may be
9758 specified individually by using @option{--param @var{name}=@var{value}}.
9759 The @option{-finline-limit=@var{n}} option sets some of these parameters
9760 as follows:
9761
9762 @table @gcctabopt
9763 @item max-inline-insns-single
9764 is set to @var{n}/2.
9765 @item max-inline-insns-auto
9766 is set to @var{n}/2.
9767 @end table
9768
9769 See below for a documentation of the individual
9770 parameters controlling inlining and for the defaults of these parameters.
9771
9772 @emph{Note:} there may be no value to @option{-finline-limit} that results
9773 in default behavior.
9774
9775 @emph{Note:} pseudo instruction represents, in this particular context, an
9776 abstract measurement of function's size. In no way does it represent a count
9777 of assembly instructions and as such its exact meaning might change from one
9778 release to an another.
9779
9780 @item -fno-keep-inline-dllexport
9781 @opindex fno-keep-inline-dllexport
9782 @opindex fkeep-inline-dllexport
9783 This is a more fine-grained version of @option{-fkeep-inline-functions},
9784 which applies only to functions that are declared using the @code{dllexport}
9785 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
9786 Functions}.
9787
9788 @item -fkeep-inline-functions
9789 @opindex fkeep-inline-functions
9790 In C, emit @code{static} functions that are declared @code{inline}
9791 into the object file, even if the function has been inlined into all
9792 of its callers. This switch does not affect functions using the
9793 @code{extern inline} extension in GNU C90@. In C++, emit any and all
9794 inline functions into the object file.
9795
9796 @item -fkeep-static-functions
9797 @opindex fkeep-static-functions
9798 Emit @code{static} functions into the object file, even if the function
9799 is never used.
9800
9801 @item -fkeep-static-consts
9802 @opindex fkeep-static-consts
9803 Emit variables declared @code{static const} when optimization isn't turned
9804 on, even if the variables aren't referenced.
9805
9806 GCC enables this option by default. If you want to force the compiler to
9807 check if a variable is referenced, regardless of whether or not
9808 optimization is turned on, use the @option{-fno-keep-static-consts} option.
9809
9810 @item -fmerge-constants
9811 @opindex fmerge-constants
9812 Attempt to merge identical constants (string constants and floating-point
9813 constants) across compilation units.
9814
9815 This option is the default for optimized compilation if the assembler and
9816 linker support it. Use @option{-fno-merge-constants} to inhibit this
9817 behavior.
9818
9819 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9820
9821 @item -fmerge-all-constants
9822 @opindex fmerge-all-constants
9823 Attempt to merge identical constants and identical variables.
9824
9825 This option implies @option{-fmerge-constants}. In addition to
9826 @option{-fmerge-constants} this considers e.g.@: even constant initialized
9827 arrays or initialized constant variables with integral or floating-point
9828 types. Languages like C or C++ require each variable, including multiple
9829 instances of the same variable in recursive calls, to have distinct locations,
9830 so using this option results in non-conforming
9831 behavior.
9832
9833 @item -fmodulo-sched
9834 @opindex fmodulo-sched
9835 Perform swing modulo scheduling immediately before the first scheduling
9836 pass. This pass looks at innermost loops and reorders their
9837 instructions by overlapping different iterations.
9838
9839 @item -fmodulo-sched-allow-regmoves
9840 @opindex fmodulo-sched-allow-regmoves
9841 Perform more aggressive SMS-based modulo scheduling with register moves
9842 allowed. By setting this flag certain anti-dependences edges are
9843 deleted, which triggers the generation of reg-moves based on the
9844 life-range analysis. This option is effective only with
9845 @option{-fmodulo-sched} enabled.
9846
9847 @item -fno-branch-count-reg
9848 @opindex fno-branch-count-reg
9849 @opindex fbranch-count-reg
9850 Disable the optimization pass that scans for opportunities to use
9851 ``decrement and branch'' instructions on a count register instead of
9852 instruction sequences that decrement a register, compare it against zero, and
9853 then branch based upon the result. This option is only meaningful on
9854 architectures that support such instructions, which include x86, PowerPC,
9855 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
9856 doesn't remove the decrement and branch instructions from the generated
9857 instruction stream introduced by other optimization passes.
9858
9859 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9860 except for @option{-Og}.
9861
9862 @item -fno-function-cse
9863 @opindex fno-function-cse
9864 @opindex ffunction-cse
9865 Do not put function addresses in registers; make each instruction that
9866 calls a constant function contain the function's address explicitly.
9867
9868 This option results in less efficient code, but some strange hacks
9869 that alter the assembler output may be confused by the optimizations
9870 performed when this option is not used.
9871
9872 The default is @option{-ffunction-cse}
9873
9874 @item -fno-zero-initialized-in-bss
9875 @opindex fno-zero-initialized-in-bss
9876 @opindex fzero-initialized-in-bss
9877 If the target supports a BSS section, GCC by default puts variables that
9878 are initialized to zero into BSS@. This can save space in the resulting
9879 code.
9880
9881 This option turns off this behavior because some programs explicitly
9882 rely on variables going to the data section---e.g., so that the
9883 resulting executable can find the beginning of that section and/or make
9884 assumptions based on that.
9885
9886 The default is @option{-fzero-initialized-in-bss}.
9887
9888 @item -fthread-jumps
9889 @opindex fthread-jumps
9890 Perform optimizations that check to see if a jump branches to a
9891 location where another comparison subsumed by the first is found. If
9892 so, the first branch is redirected to either the destination of the
9893 second branch or a point immediately following it, depending on whether
9894 the condition is known to be true or false.
9895
9896 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9897
9898 @item -fsplit-wide-types
9899 @opindex fsplit-wide-types
9900 When using a type that occupies multiple registers, such as @code{long
9901 long} on a 32-bit system, split the registers apart and allocate them
9902 independently. This normally generates better code for those types,
9903 but may make debugging more difficult.
9904
9905 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
9906 @option{-Os}.
9907
9908 @item -fsplit-wide-types-early
9909 @opindex fsplit-wide-types-early
9910 Fully split wide types early, instead of very late.
9911 This option has no effect unless @option{-fsplit-wide-types} is turned on.
9912
9913 This is the default on some targets.
9914
9915 @item -fcse-follow-jumps
9916 @opindex fcse-follow-jumps
9917 In common subexpression elimination (CSE), scan through jump instructions
9918 when the target of the jump is not reached by any other path. For
9919 example, when CSE encounters an @code{if} statement with an
9920 @code{else} clause, CSE follows the jump when the condition
9921 tested is false.
9922
9923 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9924
9925 @item -fcse-skip-blocks
9926 @opindex fcse-skip-blocks
9927 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
9928 follow jumps that conditionally skip over blocks. When CSE
9929 encounters a simple @code{if} statement with no else clause,
9930 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
9931 body of the @code{if}.
9932
9933 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9934
9935 @item -frerun-cse-after-loop
9936 @opindex frerun-cse-after-loop
9937 Re-run common subexpression elimination after loop optimizations are
9938 performed.
9939
9940 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9941
9942 @item -fgcse
9943 @opindex fgcse
9944 Perform a global common subexpression elimination pass.
9945 This pass also performs global constant and copy propagation.
9946
9947 @emph{Note:} When compiling a program using computed gotos, a GCC
9948 extension, you may get better run-time performance if you disable
9949 the global common subexpression elimination pass by adding
9950 @option{-fno-gcse} to the command line.
9951
9952 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9953
9954 @item -fgcse-lm
9955 @opindex fgcse-lm
9956 When @option{-fgcse-lm} is enabled, global common subexpression elimination
9957 attempts to move loads that are only killed by stores into themselves. This
9958 allows a loop containing a load/store sequence to be changed to a load outside
9959 the loop, and a copy/store within the loop.
9960
9961 Enabled by default when @option{-fgcse} is enabled.
9962
9963 @item -fgcse-sm
9964 @opindex fgcse-sm
9965 When @option{-fgcse-sm} is enabled, a store motion pass is run after
9966 global common subexpression elimination. This pass attempts to move
9967 stores out of loops. When used in conjunction with @option{-fgcse-lm},
9968 loops containing a load/store sequence can be changed to a load before
9969 the loop and a store after the loop.
9970
9971 Not enabled at any optimization level.
9972
9973 @item -fgcse-las
9974 @opindex fgcse-las
9975 When @option{-fgcse-las} is enabled, the global common subexpression
9976 elimination pass eliminates redundant loads that come after stores to the
9977 same memory location (both partial and full redundancies).
9978
9979 Not enabled at any optimization level.
9980
9981 @item -fgcse-after-reload
9982 @opindex fgcse-after-reload
9983 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
9984 pass is performed after reload. The purpose of this pass is to clean up
9985 redundant spilling.
9986
9987 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9988
9989 @item -faggressive-loop-optimizations
9990 @opindex faggressive-loop-optimizations
9991 This option tells the loop optimizer to use language constraints to
9992 derive bounds for the number of iterations of a loop. This assumes that
9993 loop code does not invoke undefined behavior by for example causing signed
9994 integer overflows or out-of-bound array accesses. The bounds for the
9995 number of iterations of a loop are used to guide loop unrolling and peeling
9996 and loop exit test optimizations.
9997 This option is enabled by default.
9998
9999 @item -funconstrained-commons
10000 @opindex funconstrained-commons
10001 This option tells the compiler that variables declared in common blocks
10002 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
10003 prevents certain optimizations that depend on knowing the array bounds.
10004
10005 @item -fcrossjumping
10006 @opindex fcrossjumping
10007 Perform cross-jumping transformation.
10008 This transformation unifies equivalent code and saves code size. The
10009 resulting code may or may not perform better than without cross-jumping.
10010
10011 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10012
10013 @item -fauto-inc-dec
10014 @opindex fauto-inc-dec
10015 Combine increments or decrements of addresses with memory accesses.
10016 This pass is always skipped on architectures that do not have
10017 instructions to support this. Enabled by default at @option{-O} and
10018 higher on architectures that support this.
10019
10020 @item -fdce
10021 @opindex fdce
10022 Perform dead code elimination (DCE) on RTL@.
10023 Enabled by default at @option{-O} and higher.
10024
10025 @item -fdse
10026 @opindex fdse
10027 Perform dead store elimination (DSE) on RTL@.
10028 Enabled by default at @option{-O} and higher.
10029
10030 @item -fif-conversion
10031 @opindex fif-conversion
10032 Attempt to transform conditional jumps into branch-less equivalents. This
10033 includes use of conditional moves, min, max, set flags and abs instructions, and
10034 some tricks doable by standard arithmetics. The use of conditional execution
10035 on chips where it is available is controlled by @option{-fif-conversion2}.
10036
10037 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
10038 not with @option{-Og}.
10039
10040 @item -fif-conversion2
10041 @opindex fif-conversion2
10042 Use conditional execution (where available) to transform conditional jumps into
10043 branch-less equivalents.
10044
10045 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
10046 not with @option{-Og}.
10047
10048 @item -fdeclone-ctor-dtor
10049 @opindex fdeclone-ctor-dtor
10050 The C++ ABI requires multiple entry points for constructors and
10051 destructors: one for a base subobject, one for a complete object, and
10052 one for a virtual destructor that calls operator delete afterwards.
10053 For a hierarchy with virtual bases, the base and complete variants are
10054 clones, which means two copies of the function. With this option, the
10055 base and complete variants are changed to be thunks that call a common
10056 implementation.
10057
10058 Enabled by @option{-Os}.
10059
10060 @item -fdelete-null-pointer-checks
10061 @opindex fdelete-null-pointer-checks
10062 Assume that programs cannot safely dereference null pointers, and that
10063 no code or data element resides at address zero.
10064 This option enables simple constant
10065 folding optimizations at all optimization levels. In addition, other
10066 optimization passes in GCC use this flag to control global dataflow
10067 analyses that eliminate useless checks for null pointers; these assume
10068 that a memory access to address zero always results in a trap, so
10069 that if a pointer is checked after it has already been dereferenced,
10070 it cannot be null.
10071
10072 Note however that in some environments this assumption is not true.
10073 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
10074 for programs that depend on that behavior.
10075
10076 This option is enabled by default on most targets. On Nios II ELF, it
10077 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
10078
10079 Passes that use the dataflow information
10080 are enabled independently at different optimization levels.
10081
10082 @item -fdevirtualize
10083 @opindex fdevirtualize
10084 Attempt to convert calls to virtual functions to direct calls. This
10085 is done both within a procedure and interprocedurally as part of
10086 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
10087 propagation (@option{-fipa-cp}).
10088 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10089
10090 @item -fdevirtualize-speculatively
10091 @opindex fdevirtualize-speculatively
10092 Attempt to convert calls to virtual functions to speculative direct calls.
10093 Based on the analysis of the type inheritance graph, determine for a given call
10094 the set of likely targets. If the set is small, preferably of size 1, change
10095 the call into a conditional deciding between direct and indirect calls. The
10096 speculative calls enable more optimizations, such as inlining. When they seem
10097 useless after further optimization, they are converted back into original form.
10098
10099 @item -fdevirtualize-at-ltrans
10100 @opindex fdevirtualize-at-ltrans
10101 Stream extra information needed for aggressive devirtualization when running
10102 the link-time optimizer in local transformation mode.
10103 This option enables more devirtualization but
10104 significantly increases the size of streamed data. For this reason it is
10105 disabled by default.
10106
10107 @item -fexpensive-optimizations
10108 @opindex fexpensive-optimizations
10109 Perform a number of minor optimizations that are relatively expensive.
10110
10111 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10112
10113 @item -free
10114 @opindex free
10115 Attempt to remove redundant extension instructions. This is especially
10116 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
10117 registers after writing to their lower 32-bit half.
10118
10119 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
10120 @option{-O3}, @option{-Os}.
10121
10122 @item -fno-lifetime-dse
10123 @opindex fno-lifetime-dse
10124 @opindex flifetime-dse
10125 In C++ the value of an object is only affected by changes within its
10126 lifetime: when the constructor begins, the object has an indeterminate
10127 value, and any changes during the lifetime of the object are dead when
10128 the object is destroyed. Normally dead store elimination will take
10129 advantage of this; if your code relies on the value of the object
10130 storage persisting beyond the lifetime of the object, you can use this
10131 flag to disable this optimization. To preserve stores before the
10132 constructor starts (e.g.@: because your operator new clears the object
10133 storage) but still treat the object as dead after the destructor, you
10134 can use @option{-flifetime-dse=1}. The default behavior can be
10135 explicitly selected with @option{-flifetime-dse=2}.
10136 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
10137
10138 @item -flive-range-shrinkage
10139 @opindex flive-range-shrinkage
10140 Attempt to decrease register pressure through register live range
10141 shrinkage. This is helpful for fast processors with small or moderate
10142 size register sets.
10143
10144 @item -fira-algorithm=@var{algorithm}
10145 @opindex fira-algorithm
10146 Use the specified coloring algorithm for the integrated register
10147 allocator. The @var{algorithm} argument can be @samp{priority}, which
10148 specifies Chow's priority coloring, or @samp{CB}, which specifies
10149 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
10150 for all architectures, but for those targets that do support it, it is
10151 the default because it generates better code.
10152
10153 @item -fira-region=@var{region}
10154 @opindex fira-region
10155 Use specified regions for the integrated register allocator. The
10156 @var{region} argument should be one of the following:
10157
10158 @table @samp
10159
10160 @item all
10161 Use all loops as register allocation regions.
10162 This can give the best results for machines with a small and/or
10163 irregular register set.
10164
10165 @item mixed
10166 Use all loops except for loops with small register pressure
10167 as the regions. This value usually gives
10168 the best results in most cases and for most architectures,
10169 and is enabled by default when compiling with optimization for speed
10170 (@option{-O}, @option{-O2}, @dots{}).
10171
10172 @item one
10173 Use all functions as a single region.
10174 This typically results in the smallest code size, and is enabled by default for
10175 @option{-Os} or @option{-O0}.
10176
10177 @end table
10178
10179 @item -fira-hoist-pressure
10180 @opindex fira-hoist-pressure
10181 Use IRA to evaluate register pressure in the code hoisting pass for
10182 decisions to hoist expressions. This option usually results in smaller
10183 code, but it can slow the compiler down.
10184
10185 This option is enabled at level @option{-Os} for all targets.
10186
10187 @item -fira-loop-pressure
10188 @opindex fira-loop-pressure
10189 Use IRA to evaluate register pressure in loops for decisions to move
10190 loop invariants. This option usually results in generation
10191 of faster and smaller code on machines with large register files (>= 32
10192 registers), but it can slow the compiler down.
10193
10194 This option is enabled at level @option{-O3} for some targets.
10195
10196 @item -fno-ira-share-save-slots
10197 @opindex fno-ira-share-save-slots
10198 @opindex fira-share-save-slots
10199 Disable sharing of stack slots used for saving call-used hard
10200 registers living through a call. Each hard register gets a
10201 separate stack slot, and as a result function stack frames are
10202 larger.
10203
10204 @item -fno-ira-share-spill-slots
10205 @opindex fno-ira-share-spill-slots
10206 @opindex fira-share-spill-slots
10207 Disable sharing of stack slots allocated for pseudo-registers. Each
10208 pseudo-register that does not get a hard register gets a separate
10209 stack slot, and as a result function stack frames are larger.
10210
10211 @item -flra-remat
10212 @opindex flra-remat
10213 Enable CFG-sensitive rematerialization in LRA. Instead of loading
10214 values of spilled pseudos, LRA tries to rematerialize (recalculate)
10215 values if it is profitable.
10216
10217 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10218
10219 @item -fdelayed-branch
10220 @opindex fdelayed-branch
10221 If supported for the target machine, attempt to reorder instructions
10222 to exploit instruction slots available after delayed branch
10223 instructions.
10224
10225 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
10226 but not at @option{-Og}.
10227
10228 @item -fschedule-insns
10229 @opindex fschedule-insns
10230 If supported for the target machine, attempt to reorder instructions to
10231 eliminate execution stalls due to required data being unavailable. This
10232 helps machines that have slow floating point or memory load instructions
10233 by allowing other instructions to be issued until the result of the load
10234 or floating-point instruction is required.
10235
10236 Enabled at levels @option{-O2}, @option{-O3}.
10237
10238 @item -fschedule-insns2
10239 @opindex fschedule-insns2
10240 Similar to @option{-fschedule-insns}, but requests an additional pass of
10241 instruction scheduling after register allocation has been done. This is
10242 especially useful on machines with a relatively small number of
10243 registers and where memory load instructions take more than one cycle.
10244
10245 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10246
10247 @item -fno-sched-interblock
10248 @opindex fno-sched-interblock
10249 @opindex fsched-interblock
10250 Disable instruction scheduling across basic blocks, which
10251 is normally enabled when scheduling before register allocation, i.e.@:
10252 with @option{-fschedule-insns} or at @option{-O2} or higher.
10253
10254 @item -fno-sched-spec
10255 @opindex fno-sched-spec
10256 @opindex fsched-spec
10257 Disable speculative motion of non-load instructions, which
10258 is normally enabled when scheduling before register allocation, i.e.@:
10259 with @option{-fschedule-insns} or at @option{-O2} or higher.
10260
10261 @item -fsched-pressure
10262 @opindex fsched-pressure
10263 Enable register pressure sensitive insn scheduling before register
10264 allocation. This only makes sense when scheduling before register
10265 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
10266 @option{-O2} or higher. Usage of this option can improve the
10267 generated code and decrease its size by preventing register pressure
10268 increase above the number of available hard registers and subsequent
10269 spills in register allocation.
10270
10271 @item -fsched-spec-load
10272 @opindex fsched-spec-load
10273 Allow speculative motion of some load instructions. This only makes
10274 sense when scheduling before register allocation, i.e.@: with
10275 @option{-fschedule-insns} or at @option{-O2} or higher.
10276
10277 @item -fsched-spec-load-dangerous
10278 @opindex fsched-spec-load-dangerous
10279 Allow speculative motion of more load instructions. This only makes
10280 sense when scheduling before register allocation, i.e.@: with
10281 @option{-fschedule-insns} or at @option{-O2} or higher.
10282
10283 @item -fsched-stalled-insns
10284 @itemx -fsched-stalled-insns=@var{n}
10285 @opindex fsched-stalled-insns
10286 Define how many insns (if any) can be moved prematurely from the queue
10287 of stalled insns into the ready list during the second scheduling pass.
10288 @option{-fno-sched-stalled-insns} means that no insns are moved
10289 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
10290 on how many queued insns can be moved prematurely.
10291 @option{-fsched-stalled-insns} without a value is equivalent to
10292 @option{-fsched-stalled-insns=1}.
10293
10294 @item -fsched-stalled-insns-dep
10295 @itemx -fsched-stalled-insns-dep=@var{n}
10296 @opindex fsched-stalled-insns-dep
10297 Define how many insn groups (cycles) are examined for a dependency
10298 on a stalled insn that is a candidate for premature removal from the queue
10299 of stalled insns. This has an effect only during the second scheduling pass,
10300 and only if @option{-fsched-stalled-insns} is used.
10301 @option{-fno-sched-stalled-insns-dep} is equivalent to
10302 @option{-fsched-stalled-insns-dep=0}.
10303 @option{-fsched-stalled-insns-dep} without a value is equivalent to
10304 @option{-fsched-stalled-insns-dep=1}.
10305
10306 @item -fsched2-use-superblocks
10307 @opindex fsched2-use-superblocks
10308 When scheduling after register allocation, use superblock scheduling.
10309 This allows motion across basic block boundaries,
10310 resulting in faster schedules. This option is experimental, as not all machine
10311 descriptions used by GCC model the CPU closely enough to avoid unreliable
10312 results from the algorithm.
10313
10314 This only makes sense when scheduling after register allocation, i.e.@: with
10315 @option{-fschedule-insns2} or at @option{-O2} or higher.
10316
10317 @item -fsched-group-heuristic
10318 @opindex fsched-group-heuristic
10319 Enable the group heuristic in the scheduler. This heuristic favors
10320 the instruction that belongs to a schedule group. This is enabled
10321 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10322 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10323
10324 @item -fsched-critical-path-heuristic
10325 @opindex fsched-critical-path-heuristic
10326 Enable the critical-path heuristic in the scheduler. This heuristic favors
10327 instructions on the critical path. This is enabled by default when
10328 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10329 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10330
10331 @item -fsched-spec-insn-heuristic
10332 @opindex fsched-spec-insn-heuristic
10333 Enable the speculative instruction heuristic in the scheduler. This
10334 heuristic favors speculative instructions with greater dependency weakness.
10335 This is enabled by default when scheduling is enabled, i.e.@:
10336 with @option{-fschedule-insns} or @option{-fschedule-insns2}
10337 or at @option{-O2} or higher.
10338
10339 @item -fsched-rank-heuristic
10340 @opindex fsched-rank-heuristic
10341 Enable the rank heuristic in the scheduler. This heuristic favors
10342 the instruction belonging to a basic block with greater size or frequency.
10343 This is enabled by default when scheduling is enabled, i.e.@:
10344 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10345 at @option{-O2} or higher.
10346
10347 @item -fsched-last-insn-heuristic
10348 @opindex fsched-last-insn-heuristic
10349 Enable the last-instruction heuristic in the scheduler. This heuristic
10350 favors the instruction that is less dependent on the last instruction
10351 scheduled. This is enabled by default when scheduling is enabled,
10352 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10353 at @option{-O2} or higher.
10354
10355 @item -fsched-dep-count-heuristic
10356 @opindex fsched-dep-count-heuristic
10357 Enable the dependent-count heuristic in the scheduler. This heuristic
10358 favors the instruction that has more instructions depending on it.
10359 This is enabled by default when scheduling is enabled, i.e.@:
10360 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10361 at @option{-O2} or higher.
10362
10363 @item -freschedule-modulo-scheduled-loops
10364 @opindex freschedule-modulo-scheduled-loops
10365 Modulo scheduling is performed before traditional scheduling. If a loop
10366 is modulo scheduled, later scheduling passes may change its schedule.
10367 Use this option to control that behavior.
10368
10369 @item -fselective-scheduling
10370 @opindex fselective-scheduling
10371 Schedule instructions using selective scheduling algorithm. Selective
10372 scheduling runs instead of the first scheduler pass.
10373
10374 @item -fselective-scheduling2
10375 @opindex fselective-scheduling2
10376 Schedule instructions using selective scheduling algorithm. Selective
10377 scheduling runs instead of the second scheduler pass.
10378
10379 @item -fsel-sched-pipelining
10380 @opindex fsel-sched-pipelining
10381 Enable software pipelining of innermost loops during selective scheduling.
10382 This option has no effect unless one of @option{-fselective-scheduling} or
10383 @option{-fselective-scheduling2} is turned on.
10384
10385 @item -fsel-sched-pipelining-outer-loops
10386 @opindex fsel-sched-pipelining-outer-loops
10387 When pipelining loops during selective scheduling, also pipeline outer loops.
10388 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10389
10390 @item -fsemantic-interposition
10391 @opindex fsemantic-interposition
10392 Some object formats, like ELF, allow interposing of symbols by the
10393 dynamic linker.
10394 This means that for symbols exported from the DSO, the compiler cannot perform
10395 interprocedural propagation, inlining and other optimizations in anticipation
10396 that the function or variable in question may change. While this feature is
10397 useful, for example, to rewrite memory allocation functions by a debugging
10398 implementation, it is expensive in the terms of code quality.
10399 With @option{-fno-semantic-interposition} the compiler assumes that
10400 if interposition happens for functions the overwriting function will have
10401 precisely the same semantics (and side effects).
10402 Similarly if interposition happens
10403 for variables, the constructor of the variable will be the same. The flag
10404 has no effect for functions explicitly declared inline
10405 (where it is never allowed for interposition to change semantics)
10406 and for symbols explicitly declared weak.
10407
10408 @item -fshrink-wrap
10409 @opindex fshrink-wrap
10410 Emit function prologues only before parts of the function that need it,
10411 rather than at the top of the function. This flag is enabled by default at
10412 @option{-O} and higher.
10413
10414 @item -fshrink-wrap-separate
10415 @opindex fshrink-wrap-separate
10416 Shrink-wrap separate parts of the prologue and epilogue separately, so that
10417 those parts are only executed when needed.
10418 This option is on by default, but has no effect unless @option{-fshrink-wrap}
10419 is also turned on and the target supports this.
10420
10421 @item -fcaller-saves
10422 @opindex fcaller-saves
10423 Enable allocation of values to registers that are clobbered by
10424 function calls, by emitting extra instructions to save and restore the
10425 registers around such calls. Such allocation is done only when it
10426 seems to result in better code.
10427
10428 This option is always enabled by default on certain machines, usually
10429 those which have no call-preserved registers to use instead.
10430
10431 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10432
10433 @item -fcombine-stack-adjustments
10434 @opindex fcombine-stack-adjustments
10435 Tracks stack adjustments (pushes and pops) and stack memory references
10436 and then tries to find ways to combine them.
10437
10438 Enabled by default at @option{-O1} and higher.
10439
10440 @item -fipa-ra
10441 @opindex fipa-ra
10442 Use caller save registers for allocation if those registers are not used by
10443 any called function. In that case it is not necessary to save and restore
10444 them around calls. This is only possible if called functions are part of
10445 same compilation unit as current function and they are compiled before it.
10446
10447 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10448 is disabled if generated code will be instrumented for profiling
10449 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10450 exactly (this happens on targets that do not expose prologues
10451 and epilogues in RTL).
10452
10453 @item -fconserve-stack
10454 @opindex fconserve-stack
10455 Attempt to minimize stack usage. The compiler attempts to use less
10456 stack space, even if that makes the program slower. This option
10457 implies setting the @option{large-stack-frame} parameter to 100
10458 and the @option{large-stack-frame-growth} parameter to 400.
10459
10460 @item -ftree-reassoc
10461 @opindex ftree-reassoc
10462 Perform reassociation on trees. This flag is enabled by default
10463 at @option{-O} and higher.
10464
10465 @item -fcode-hoisting
10466 @opindex fcode-hoisting
10467 Perform code hoisting. Code hoisting tries to move the
10468 evaluation of expressions executed on all paths to the function exit
10469 as early as possible. This is especially useful as a code size
10470 optimization, but it often helps for code speed as well.
10471 This flag is enabled by default at @option{-O2} and higher.
10472
10473 @item -ftree-pre
10474 @opindex ftree-pre
10475 Perform partial redundancy elimination (PRE) on trees. This flag is
10476 enabled by default at @option{-O2} and @option{-O3}.
10477
10478 @item -ftree-partial-pre
10479 @opindex ftree-partial-pre
10480 Make partial redundancy elimination (PRE) more aggressive. This flag is
10481 enabled by default at @option{-O3}.
10482
10483 @item -ftree-forwprop
10484 @opindex ftree-forwprop
10485 Perform forward propagation on trees. This flag is enabled by default
10486 at @option{-O} and higher.
10487
10488 @item -ftree-fre
10489 @opindex ftree-fre
10490 Perform full redundancy elimination (FRE) on trees. The difference
10491 between FRE and PRE is that FRE only considers expressions
10492 that are computed on all paths leading to the redundant computation.
10493 This analysis is faster than PRE, though it exposes fewer redundancies.
10494 This flag is enabled by default at @option{-O} and higher.
10495
10496 @item -ftree-phiprop
10497 @opindex ftree-phiprop
10498 Perform hoisting of loads from conditional pointers on trees. This
10499 pass is enabled by default at @option{-O} and higher.
10500
10501 @item -fhoist-adjacent-loads
10502 @opindex fhoist-adjacent-loads
10503 Speculatively hoist loads from both branches of an if-then-else if the
10504 loads are from adjacent locations in the same structure and the target
10505 architecture has a conditional move instruction. This flag is enabled
10506 by default at @option{-O2} and higher.
10507
10508 @item -ftree-copy-prop
10509 @opindex ftree-copy-prop
10510 Perform copy propagation on trees. This pass eliminates unnecessary
10511 copy operations. This flag is enabled by default at @option{-O} and
10512 higher.
10513
10514 @item -fipa-pure-const
10515 @opindex fipa-pure-const
10516 Discover which functions are pure or constant.
10517 Enabled by default at @option{-O} and higher.
10518
10519 @item -fipa-reference
10520 @opindex fipa-reference
10521 Discover which static variables do not escape the
10522 compilation unit.
10523 Enabled by default at @option{-O} and higher.
10524
10525 @item -fipa-reference-addressable
10526 @opindex fipa-reference-addressable
10527 Discover read-only, write-only and non-addressable static variables.
10528 Enabled by default at @option{-O} and higher.
10529
10530 @item -fipa-stack-alignment
10531 @opindex fipa-stack-alignment
10532 Reduce stack alignment on call sites if possible.
10533 Enabled by default.
10534
10535 @item -fipa-pta
10536 @opindex fipa-pta
10537 Perform interprocedural pointer analysis and interprocedural modification
10538 and reference analysis. This option can cause excessive memory and
10539 compile-time usage on large compilation units. It is not enabled by
10540 default at any optimization level.
10541
10542 @item -fipa-profile
10543 @opindex fipa-profile
10544 Perform interprocedural profile propagation. The functions called only from
10545 cold functions are marked as cold. Also functions executed once (such as
10546 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10547 functions and loop less parts of functions executed once are then optimized for
10548 size.
10549 Enabled by default at @option{-O} and higher.
10550
10551 @item -fipa-cp
10552 @opindex fipa-cp
10553 Perform interprocedural constant propagation.
10554 This optimization analyzes the program to determine when values passed
10555 to functions are constants and then optimizes accordingly.
10556 This optimization can substantially increase performance
10557 if the application has constants passed to functions.
10558 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10559 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10560
10561 @item -fipa-cp-clone
10562 @opindex fipa-cp-clone
10563 Perform function cloning to make interprocedural constant propagation stronger.
10564 When enabled, interprocedural constant propagation performs function cloning
10565 when externally visible function can be called with constant arguments.
10566 Because this optimization can create multiple copies of functions,
10567 it may significantly increase code size
10568 (see @option{--param ipa-cp-unit-growth=@var{value}}).
10569 This flag is enabled by default at @option{-O3}.
10570 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10571
10572 @item -fipa-bit-cp
10573 @opindex fipa-bit-cp
10574 When enabled, perform interprocedural bitwise constant
10575 propagation. This flag is enabled by default at @option{-O2} and
10576 by @option{-fprofile-use} and @option{-fauto-profile}.
10577 It requires that @option{-fipa-cp} is enabled.
10578
10579 @item -fipa-vrp
10580 @opindex fipa-vrp
10581 When enabled, perform interprocedural propagation of value
10582 ranges. This flag is enabled by default at @option{-O2}. It requires
10583 that @option{-fipa-cp} is enabled.
10584
10585 @item -fipa-icf
10586 @opindex fipa-icf
10587 Perform Identical Code Folding for functions and read-only variables.
10588 The optimization reduces code size and may disturb unwind stacks by replacing
10589 a function by equivalent one with a different name. The optimization works
10590 more effectively with link-time optimization enabled.
10591
10592 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10593 works on different levels and thus the optimizations are not same - there are
10594 equivalences that are found only by GCC and equivalences found only by Gold.
10595
10596 This flag is enabled by default at @option{-O2} and @option{-Os}.
10597
10598 @item -flive-patching=@var{level}
10599 @opindex flive-patching
10600 Control GCC's optimizations to produce output suitable for live-patching.
10601
10602 If the compiler's optimization uses a function's body or information extracted
10603 from its body to optimize/change another function, the latter is called an
10604 impacted function of the former. If a function is patched, its impacted
10605 functions should be patched too.
10606
10607 The impacted functions are determined by the compiler's interprocedural
10608 optimizations. For example, a caller is impacted when inlining a function
10609 into its caller,
10610 cloning a function and changing its caller to call this new clone,
10611 or extracting a function's pureness/constness information to optimize
10612 its direct or indirect callers, etc.
10613
10614 Usually, the more IPA optimizations enabled, the larger the number of
10615 impacted functions for each function. In order to control the number of
10616 impacted functions and more easily compute the list of impacted function,
10617 IPA optimizations can be partially enabled at two different levels.
10618
10619 The @var{level} argument should be one of the following:
10620
10621 @table @samp
10622
10623 @item inline-clone
10624
10625 Only enable inlining and cloning optimizations, which includes inlining,
10626 cloning, interprocedural scalar replacement of aggregates and partial inlining.
10627 As a result, when patching a function, all its callers and its clones'
10628 callers are impacted, therefore need to be patched as well.
10629
10630 @option{-flive-patching=inline-clone} disables the following optimization flags:
10631 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
10632 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
10633 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
10634 -fipa-stack-alignment}
10635
10636 @item inline-only-static
10637
10638 Only enable inlining of static functions.
10639 As a result, when patching a static function, all its callers are impacted
10640 and so need to be patched as well.
10641
10642 In addition to all the flags that @option{-flive-patching=inline-clone}
10643 disables,
10644 @option{-flive-patching=inline-only-static} disables the following additional
10645 optimization flags:
10646 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
10647
10648 @end table
10649
10650 When @option{-flive-patching} is specified without any value, the default value
10651 is @var{inline-clone}.
10652
10653 This flag is disabled by default.
10654
10655 Note that @option{-flive-patching} is not supported with link-time optimization
10656 (@option{-flto}).
10657
10658 @item -fisolate-erroneous-paths-dereference
10659 @opindex fisolate-erroneous-paths-dereference
10660 Detect paths that trigger erroneous or undefined behavior due to
10661 dereferencing a null pointer. Isolate those paths from the main control
10662 flow and turn the statement with erroneous or undefined behavior into a trap.
10663 This flag is enabled by default at @option{-O2} and higher and depends on
10664 @option{-fdelete-null-pointer-checks} also being enabled.
10665
10666 @item -fisolate-erroneous-paths-attribute
10667 @opindex fisolate-erroneous-paths-attribute
10668 Detect paths that trigger erroneous or undefined behavior due to a null value
10669 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10670 attribute. Isolate those paths from the main control flow and turn the
10671 statement with erroneous or undefined behavior into a trap. This is not
10672 currently enabled, but may be enabled by @option{-O2} in the future.
10673
10674 @item -ftree-sink
10675 @opindex ftree-sink
10676 Perform forward store motion on trees. This flag is
10677 enabled by default at @option{-O} and higher.
10678
10679 @item -ftree-bit-ccp
10680 @opindex ftree-bit-ccp
10681 Perform sparse conditional bit constant propagation on trees and propagate
10682 pointer alignment information.
10683 This pass only operates on local scalar variables and is enabled by default
10684 at @option{-O1} and higher, except for @option{-Og}.
10685 It requires that @option{-ftree-ccp} is enabled.
10686
10687 @item -ftree-ccp
10688 @opindex ftree-ccp
10689 Perform sparse conditional constant propagation (CCP) on trees. This
10690 pass only operates on local scalar variables and is enabled by default
10691 at @option{-O} and higher.
10692
10693 @item -fssa-backprop
10694 @opindex fssa-backprop
10695 Propagate information about uses of a value up the definition chain
10696 in order to simplify the definitions. For example, this pass strips
10697 sign operations if the sign of a value never matters. The flag is
10698 enabled by default at @option{-O} and higher.
10699
10700 @item -fssa-phiopt
10701 @opindex fssa-phiopt
10702 Perform pattern matching on SSA PHI nodes to optimize conditional
10703 code. This pass is enabled by default at @option{-O1} and higher,
10704 except for @option{-Og}.
10705
10706 @item -ftree-switch-conversion
10707 @opindex ftree-switch-conversion
10708 Perform conversion of simple initializations in a switch to
10709 initializations from a scalar array. This flag is enabled by default
10710 at @option{-O2} and higher.
10711
10712 @item -ftree-tail-merge
10713 @opindex ftree-tail-merge
10714 Look for identical code sequences. When found, replace one with a jump to the
10715 other. This optimization is known as tail merging or cross jumping. This flag
10716 is enabled by default at @option{-O2} and higher. The compilation time
10717 in this pass can
10718 be limited using @option{max-tail-merge-comparisons} parameter and
10719 @option{max-tail-merge-iterations} parameter.
10720
10721 @item -ftree-dce
10722 @opindex ftree-dce
10723 Perform dead code elimination (DCE) on trees. This flag is enabled by
10724 default at @option{-O} and higher.
10725
10726 @item -ftree-builtin-call-dce
10727 @opindex ftree-builtin-call-dce
10728 Perform conditional dead code elimination (DCE) for calls to built-in functions
10729 that may set @code{errno} but are otherwise free of side effects. This flag is
10730 enabled by default at @option{-O2} and higher if @option{-Os} is not also
10731 specified.
10732
10733 @item -ffinite-loops
10734 @opindex ffinite-loops
10735 @opindex fno-finite-loops
10736 Assume that a loop with an exit will eventually take the exit and not loop
10737 indefinitely. This allows the compiler to remove loops that otherwise have
10738 no side-effects, not considering eventual endless looping as such.
10739
10740 This option is enabled by default at @option{-O2} for C++ with -std=c++11
10741 or higher.
10742
10743 @item -ftree-dominator-opts
10744 @opindex ftree-dominator-opts
10745 Perform a variety of simple scalar cleanups (constant/copy
10746 propagation, redundancy elimination, range propagation and expression
10747 simplification) based on a dominator tree traversal. This also
10748 performs jump threading (to reduce jumps to jumps). This flag is
10749 enabled by default at @option{-O} and higher.
10750
10751 @item -ftree-dse
10752 @opindex ftree-dse
10753 Perform dead store elimination (DSE) on trees. A dead store is a store into
10754 a memory location that is later overwritten by another store without
10755 any intervening loads. In this case the earlier store can be deleted. This
10756 flag is enabled by default at @option{-O} and higher.
10757
10758 @item -ftree-ch
10759 @opindex ftree-ch
10760 Perform loop header copying on trees. This is beneficial since it increases
10761 effectiveness of code motion optimizations. It also saves one jump. This flag
10762 is enabled by default at @option{-O} and higher. It is not enabled
10763 for @option{-Os}, since it usually increases code size.
10764
10765 @item -ftree-loop-optimize
10766 @opindex ftree-loop-optimize
10767 Perform loop optimizations on trees. This flag is enabled by default
10768 at @option{-O} and higher.
10769
10770 @item -ftree-loop-linear
10771 @itemx -floop-strip-mine
10772 @itemx -floop-block
10773 @opindex ftree-loop-linear
10774 @opindex floop-strip-mine
10775 @opindex floop-block
10776 Perform loop nest optimizations. Same as
10777 @option{-floop-nest-optimize}. To use this code transformation, GCC has
10778 to be configured with @option{--with-isl} to enable the Graphite loop
10779 transformation infrastructure.
10780
10781 @item -fgraphite-identity
10782 @opindex fgraphite-identity
10783 Enable the identity transformation for graphite. For every SCoP we generate
10784 the polyhedral representation and transform it back to gimple. Using
10785 @option{-fgraphite-identity} we can check the costs or benefits of the
10786 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
10787 are also performed by the code generator isl, like index splitting and
10788 dead code elimination in loops.
10789
10790 @item -floop-nest-optimize
10791 @opindex floop-nest-optimize
10792 Enable the isl based loop nest optimizer. This is a generic loop nest
10793 optimizer based on the Pluto optimization algorithms. It calculates a loop
10794 structure optimized for data-locality and parallelism. This option
10795 is experimental.
10796
10797 @item -floop-parallelize-all
10798 @opindex floop-parallelize-all
10799 Use the Graphite data dependence analysis to identify loops that can
10800 be parallelized. Parallelize all the loops that can be analyzed to
10801 not contain loop carried dependences without checking that it is
10802 profitable to parallelize the loops.
10803
10804 @item -ftree-coalesce-vars
10805 @opindex ftree-coalesce-vars
10806 While transforming the program out of the SSA representation, attempt to
10807 reduce copying by coalescing versions of different user-defined
10808 variables, instead of just compiler temporaries. This may severely
10809 limit the ability to debug an optimized program compiled with
10810 @option{-fno-var-tracking-assignments}. In the negated form, this flag
10811 prevents SSA coalescing of user variables. This option is enabled by
10812 default if optimization is enabled, and it does very little otherwise.
10813
10814 @item -ftree-loop-if-convert
10815 @opindex ftree-loop-if-convert
10816 Attempt to transform conditional jumps in the innermost loops to
10817 branch-less equivalents. The intent is to remove control-flow from
10818 the innermost loops in order to improve the ability of the
10819 vectorization pass to handle these loops. This is enabled by default
10820 if vectorization is enabled.
10821
10822 @item -ftree-loop-distribution
10823 @opindex ftree-loop-distribution
10824 Perform loop distribution. This flag can improve cache performance on
10825 big loop bodies and allow further loop optimizations, like
10826 parallelization or vectorization, to take place. For example, the loop
10827 @smallexample
10828 DO I = 1, N
10829 A(I) = B(I) + C
10830 D(I) = E(I) * F
10831 ENDDO
10832 @end smallexample
10833 is transformed to
10834 @smallexample
10835 DO I = 1, N
10836 A(I) = B(I) + C
10837 ENDDO
10838 DO I = 1, N
10839 D(I) = E(I) * F
10840 ENDDO
10841 @end smallexample
10842 This flag is enabled by default at @option{-O3}.
10843 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10844
10845 @item -ftree-loop-distribute-patterns
10846 @opindex ftree-loop-distribute-patterns
10847 Perform loop distribution of patterns that can be code generated with
10848 calls to a library. This flag is enabled by default at @option{-O2} and
10849 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10850
10851 This pass distributes the initialization loops and generates a call to
10852 memset zero. For example, the loop
10853 @smallexample
10854 DO I = 1, N
10855 A(I) = 0
10856 B(I) = A(I) + I
10857 ENDDO
10858 @end smallexample
10859 is transformed to
10860 @smallexample
10861 DO I = 1, N
10862 A(I) = 0
10863 ENDDO
10864 DO I = 1, N
10865 B(I) = A(I) + I
10866 ENDDO
10867 @end smallexample
10868 and the initialization loop is transformed into a call to memset zero.
10869 This flag is enabled by default at @option{-O3}.
10870 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10871
10872 @item -floop-interchange
10873 @opindex floop-interchange
10874 Perform loop interchange outside of graphite. This flag can improve cache
10875 performance on loop nest and allow further loop optimizations, like
10876 vectorization, to take place. For example, the loop
10877 @smallexample
10878 for (int i = 0; i < N; i++)
10879 for (int j = 0; j < N; j++)
10880 for (int k = 0; k < N; k++)
10881 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10882 @end smallexample
10883 is transformed to
10884 @smallexample
10885 for (int i = 0; i < N; i++)
10886 for (int k = 0; k < N; k++)
10887 for (int j = 0; j < N; j++)
10888 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10889 @end smallexample
10890 This flag is enabled by default at @option{-O3}.
10891 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10892
10893 @item -floop-unroll-and-jam
10894 @opindex floop-unroll-and-jam
10895 Apply unroll and jam transformations on feasible loops. In a loop
10896 nest this unrolls the outer loop by some factor and fuses the resulting
10897 multiple inner loops. This flag is enabled by default at @option{-O3}.
10898 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10899
10900 @item -ftree-loop-im
10901 @opindex ftree-loop-im
10902 Perform loop invariant motion on trees. This pass moves only invariants that
10903 are hard to handle at RTL level (function calls, operations that expand to
10904 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
10905 operands of conditions that are invariant out of the loop, so that we can use
10906 just trivial invariantness analysis in loop unswitching. The pass also includes
10907 store motion.
10908
10909 @item -ftree-loop-ivcanon
10910 @opindex ftree-loop-ivcanon
10911 Create a canonical counter for number of iterations in loops for which
10912 determining number of iterations requires complicated analysis. Later
10913 optimizations then may determine the number easily. Useful especially
10914 in connection with unrolling.
10915
10916 @item -ftree-scev-cprop
10917 @opindex ftree-scev-cprop
10918 Perform final value replacement. If a variable is modified in a loop
10919 in such a way that its value when exiting the loop can be determined using
10920 only its initial value and the number of loop iterations, replace uses of
10921 the final value by such a computation, provided it is sufficiently cheap.
10922 This reduces data dependencies and may allow further simplifications.
10923 Enabled by default at @option{-O} and higher.
10924
10925 @item -fivopts
10926 @opindex fivopts
10927 Perform induction variable optimizations (strength reduction, induction
10928 variable merging and induction variable elimination) on trees.
10929
10930 @item -ftree-parallelize-loops=n
10931 @opindex ftree-parallelize-loops
10932 Parallelize loops, i.e., split their iteration space to run in n threads.
10933 This is only possible for loops whose iterations are independent
10934 and can be arbitrarily reordered. The optimization is only
10935 profitable on multiprocessor machines, for loops that are CPU-intensive,
10936 rather than constrained e.g.@: by memory bandwidth. This option
10937 implies @option{-pthread}, and thus is only supported on targets
10938 that have support for @option{-pthread}.
10939
10940 @item -ftree-pta
10941 @opindex ftree-pta
10942 Perform function-local points-to analysis on trees. This flag is
10943 enabled by default at @option{-O1} and higher, except for @option{-Og}.
10944
10945 @item -ftree-sra
10946 @opindex ftree-sra
10947 Perform scalar replacement of aggregates. This pass replaces structure
10948 references with scalars to prevent committing structures to memory too
10949 early. This flag is enabled by default at @option{-O1} and higher,
10950 except for @option{-Og}.
10951
10952 @item -fstore-merging
10953 @opindex fstore-merging
10954 Perform merging of narrow stores to consecutive memory addresses. This pass
10955 merges contiguous stores of immediate values narrower than a word into fewer
10956 wider stores to reduce the number of instructions. This is enabled by default
10957 at @option{-O2} and higher as well as @option{-Os}.
10958
10959 @item -ftree-ter
10960 @opindex ftree-ter
10961 Perform temporary expression replacement during the SSA->normal phase. Single
10962 use/single def temporaries are replaced at their use location with their
10963 defining expression. This results in non-GIMPLE code, but gives the expanders
10964 much more complex trees to work on resulting in better RTL generation. This is
10965 enabled by default at @option{-O} and higher.
10966
10967 @item -ftree-slsr
10968 @opindex ftree-slsr
10969 Perform straight-line strength reduction on trees. This recognizes related
10970 expressions involving multiplications and replaces them by less expensive
10971 calculations when possible. This is enabled by default at @option{-O} and
10972 higher.
10973
10974 @item -ftree-vectorize
10975 @opindex ftree-vectorize
10976 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
10977 and @option{-ftree-slp-vectorize} if not explicitly specified.
10978
10979 @item -ftree-loop-vectorize
10980 @opindex ftree-loop-vectorize
10981 Perform loop vectorization on trees. This flag is enabled by default at
10982 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10983 and @option{-fauto-profile}.
10984
10985 @item -ftree-slp-vectorize
10986 @opindex ftree-slp-vectorize
10987 Perform basic block vectorization on trees. This flag is enabled by default at
10988 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10989 and @option{-fauto-profile}.
10990
10991 @item -fvect-cost-model=@var{model}
10992 @opindex fvect-cost-model
10993 Alter the cost model used for vectorization. The @var{model} argument
10994 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
10995 With the @samp{unlimited} model the vectorized code-path is assumed
10996 to be profitable while with the @samp{dynamic} model a runtime check
10997 guards the vectorized code-path to enable it only for iteration
10998 counts that will likely execute faster than when executing the original
10999 scalar loop. The @samp{cheap} model disables vectorization of
11000 loops where doing so would be cost prohibitive for example due to
11001 required runtime checks for data dependence or alignment but otherwise
11002 is equal to the @samp{dynamic} model.
11003 The default cost model depends on other optimization flags and is
11004 either @samp{dynamic} or @samp{cheap}.
11005
11006 @item -fsimd-cost-model=@var{model}
11007 @opindex fsimd-cost-model
11008 Alter the cost model used for vectorization of loops marked with the OpenMP
11009 simd directive. The @var{model} argument should be one of
11010 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
11011 have the same meaning as described in @option{-fvect-cost-model} and by
11012 default a cost model defined with @option{-fvect-cost-model} is used.
11013
11014 @item -ftree-vrp
11015 @opindex ftree-vrp
11016 Perform Value Range Propagation on trees. This is similar to the
11017 constant propagation pass, but instead of values, ranges of values are
11018 propagated. This allows the optimizers to remove unnecessary range
11019 checks like array bound checks and null pointer checks. This is
11020 enabled by default at @option{-O2} and higher. Null pointer check
11021 elimination is only done if @option{-fdelete-null-pointer-checks} is
11022 enabled.
11023
11024 @item -fsplit-paths
11025 @opindex fsplit-paths
11026 Split paths leading to loop backedges. This can improve dead code
11027 elimination and common subexpression elimination. This is enabled by
11028 default at @option{-O3} and above.
11029
11030 @item -fsplit-ivs-in-unroller
11031 @opindex fsplit-ivs-in-unroller
11032 Enables expression of values of induction variables in later iterations
11033 of the unrolled loop using the value in the first iteration. This breaks
11034 long dependency chains, thus improving efficiency of the scheduling passes.
11035
11036 A combination of @option{-fweb} and CSE is often sufficient to obtain the
11037 same effect. However, that is not reliable in cases where the loop body
11038 is more complicated than a single basic block. It also does not work at all
11039 on some architectures due to restrictions in the CSE pass.
11040
11041 This optimization is enabled by default.
11042
11043 @item -fvariable-expansion-in-unroller
11044 @opindex fvariable-expansion-in-unroller
11045 With this option, the compiler creates multiple copies of some
11046 local variables when unrolling a loop, which can result in superior code.
11047
11048 This optimization is enabled by default for PowerPC targets, but disabled
11049 by default otherwise.
11050
11051 @item -fpartial-inlining
11052 @opindex fpartial-inlining
11053 Inline parts of functions. This option has any effect only
11054 when inlining itself is turned on by the @option{-finline-functions}
11055 or @option{-finline-small-functions} options.
11056
11057 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11058
11059 @item -fpredictive-commoning
11060 @opindex fpredictive-commoning
11061 Perform predictive commoning optimization, i.e., reusing computations
11062 (especially memory loads and stores) performed in previous
11063 iterations of loops.
11064
11065 This option is enabled at level @option{-O3}.
11066 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11067
11068 @item -fprefetch-loop-arrays
11069 @opindex fprefetch-loop-arrays
11070 If supported by the target machine, generate instructions to prefetch
11071 memory to improve the performance of loops that access large arrays.
11072
11073 This option may generate better or worse code; results are highly
11074 dependent on the structure of loops within the source code.
11075
11076 Disabled at level @option{-Os}.
11077
11078 @item -fno-printf-return-value
11079 @opindex fno-printf-return-value
11080 @opindex fprintf-return-value
11081 Do not substitute constants for known return value of formatted output
11082 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
11083 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
11084 transformation allows GCC to optimize or even eliminate branches based
11085 on the known return value of these functions called with arguments that
11086 are either constant, or whose values are known to be in a range that
11087 makes determining the exact return value possible. For example, when
11088 @option{-fprintf-return-value} is in effect, both the branch and the
11089 body of the @code{if} statement (but not the call to @code{snprint})
11090 can be optimized away when @code{i} is a 32-bit or smaller integer
11091 because the return value is guaranteed to be at most 8.
11092
11093 @smallexample
11094 char buf[9];
11095 if (snprintf (buf, "%08x", i) >= sizeof buf)
11096 @dots{}
11097 @end smallexample
11098
11099 The @option{-fprintf-return-value} option relies on other optimizations
11100 and yields best results with @option{-O2} and above. It works in tandem
11101 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
11102 options. The @option{-fprintf-return-value} option is enabled by default.
11103
11104 @item -fno-peephole
11105 @itemx -fno-peephole2
11106 @opindex fno-peephole
11107 @opindex fpeephole
11108 @opindex fno-peephole2
11109 @opindex fpeephole2
11110 Disable any machine-specific peephole optimizations. The difference
11111 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
11112 are implemented in the compiler; some targets use one, some use the
11113 other, a few use both.
11114
11115 @option{-fpeephole} is enabled by default.
11116 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11117
11118 @item -fno-guess-branch-probability
11119 @opindex fno-guess-branch-probability
11120 @opindex fguess-branch-probability
11121 Do not guess branch probabilities using heuristics.
11122
11123 GCC uses heuristics to guess branch probabilities if they are
11124 not provided by profiling feedback (@option{-fprofile-arcs}). These
11125 heuristics are based on the control flow graph. If some branch probabilities
11126 are specified by @code{__builtin_expect}, then the heuristics are
11127 used to guess branch probabilities for the rest of the control flow graph,
11128 taking the @code{__builtin_expect} info into account. The interactions
11129 between the heuristics and @code{__builtin_expect} can be complex, and in
11130 some cases, it may be useful to disable the heuristics so that the effects
11131 of @code{__builtin_expect} are easier to understand.
11132
11133 It is also possible to specify expected probability of the expression
11134 with @code{__builtin_expect_with_probability} built-in function.
11135
11136 The default is @option{-fguess-branch-probability} at levels
11137 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11138
11139 @item -freorder-blocks
11140 @opindex freorder-blocks
11141 Reorder basic blocks in the compiled function in order to reduce number of
11142 taken branches and improve code locality.
11143
11144 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11145
11146 @item -freorder-blocks-algorithm=@var{algorithm}
11147 @opindex freorder-blocks-algorithm
11148 Use the specified algorithm for basic block reordering. The
11149 @var{algorithm} argument can be @samp{simple}, which does not increase
11150 code size (except sometimes due to secondary effects like alignment),
11151 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
11152 put all often executed code together, minimizing the number of branches
11153 executed by making extra copies of code.
11154
11155 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
11156 @samp{stc} at levels @option{-O2}, @option{-O3}.
11157
11158 @item -freorder-blocks-and-partition
11159 @opindex freorder-blocks-and-partition
11160 In addition to reordering basic blocks in the compiled function, in order
11161 to reduce number of taken branches, partitions hot and cold basic blocks
11162 into separate sections of the assembly and @file{.o} files, to improve
11163 paging and cache locality performance.
11164
11165 This optimization is automatically turned off in the presence of
11166 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
11167 section attribute and on any architecture that does not support named
11168 sections. When @option{-fsplit-stack} is used this option is not
11169 enabled by default (to avoid linker errors), but may be enabled
11170 explicitly (if using a working linker).
11171
11172 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
11173
11174 @item -freorder-functions
11175 @opindex freorder-functions
11176 Reorder functions in the object file in order to
11177 improve code locality. This is implemented by using special
11178 subsections @code{.text.hot} for most frequently executed functions and
11179 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
11180 the linker so object file format must support named sections and linker must
11181 place them in a reasonable way.
11182
11183 This option isn't effective unless you either provide profile feedback
11184 (see @option{-fprofile-arcs} for details) or manually annotate functions with
11185 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
11186
11187 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11188
11189 @item -fstrict-aliasing
11190 @opindex fstrict-aliasing
11191 Allow the compiler to assume the strictest aliasing rules applicable to
11192 the language being compiled. For C (and C++), this activates
11193 optimizations based on the type of expressions. In particular, an
11194 object of one type is assumed never to reside at the same address as an
11195 object of a different type, unless the types are almost the same. For
11196 example, an @code{unsigned int} can alias an @code{int}, but not a
11197 @code{void*} or a @code{double}. A character type may alias any other
11198 type.
11199
11200 @anchor{Type-punning}Pay special attention to code like this:
11201 @smallexample
11202 union a_union @{
11203 int i;
11204 double d;
11205 @};
11206
11207 int f() @{
11208 union a_union t;
11209 t.d = 3.0;
11210 return t.i;
11211 @}
11212 @end smallexample
11213 The practice of reading from a different union member than the one most
11214 recently written to (called ``type-punning'') is common. Even with
11215 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
11216 is accessed through the union type. So, the code above works as
11217 expected. @xref{Structures unions enumerations and bit-fields
11218 implementation}. However, this code might not:
11219 @smallexample
11220 int f() @{
11221 union a_union t;
11222 int* ip;
11223 t.d = 3.0;
11224 ip = &t.i;
11225 return *ip;
11226 @}
11227 @end smallexample
11228
11229 Similarly, access by taking the address, casting the resulting pointer
11230 and dereferencing the result has undefined behavior, even if the cast
11231 uses a union type, e.g.:
11232 @smallexample
11233 int f() @{
11234 double d = 3.0;
11235 return ((union a_union *) &d)->i;
11236 @}
11237 @end smallexample
11238
11239 The @option{-fstrict-aliasing} option is enabled at levels
11240 @option{-O2}, @option{-O3}, @option{-Os}.
11241
11242 @item -falign-functions
11243 @itemx -falign-functions=@var{n}
11244 @itemx -falign-functions=@var{n}:@var{m}
11245 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
11246 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
11247 @opindex falign-functions
11248 Align the start of functions to the next power-of-two greater than or
11249 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
11250 least the first @var{m} bytes of the function can be fetched by the CPU
11251 without crossing an @var{n}-byte alignment boundary.
11252
11253 If @var{m} is not specified, it defaults to @var{n}.
11254
11255 Examples: @option{-falign-functions=32} aligns functions to the next
11256 32-byte boundary, @option{-falign-functions=24} aligns to the next
11257 32-byte boundary only if this can be done by skipping 23 bytes or less,
11258 @option{-falign-functions=32:7} aligns to the next
11259 32-byte boundary only if this can be done by skipping 6 bytes or less.
11260
11261 The second pair of @var{n2}:@var{m2} values allows you to specify
11262 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
11263 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
11264 otherwise aligns to the next 32-byte boundary if this can be done
11265 by skipping 2 bytes or less.
11266 If @var{m2} is not specified, it defaults to @var{n2}.
11267
11268 Some assemblers only support this flag when @var{n} is a power of two;
11269 in that case, it is rounded up.
11270
11271 @option{-fno-align-functions} and @option{-falign-functions=1} are
11272 equivalent and mean that functions are not aligned.
11273
11274 If @var{n} is not specified or is zero, use a machine-dependent default.
11275 The maximum allowed @var{n} option value is 65536.
11276
11277 Enabled at levels @option{-O2}, @option{-O3}.
11278
11279 @item -flimit-function-alignment
11280 If this option is enabled, the compiler tries to avoid unnecessarily
11281 overaligning functions. It attempts to instruct the assembler to align
11282 by the amount specified by @option{-falign-functions}, but not to
11283 skip more bytes than the size of the function.
11284
11285 @item -falign-labels
11286 @itemx -falign-labels=@var{n}
11287 @itemx -falign-labels=@var{n}:@var{m}
11288 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
11289 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
11290 @opindex falign-labels
11291 Align all branch targets to a power-of-two boundary.
11292
11293 Parameters of this option are analogous to the @option{-falign-functions} option.
11294 @option{-fno-align-labels} and @option{-falign-labels=1} are
11295 equivalent and mean that labels are not aligned.
11296
11297 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
11298 are greater than this value, then their values are used instead.
11299
11300 If @var{n} is not specified or is zero, use a machine-dependent default
11301 which is very likely to be @samp{1}, meaning no alignment.
11302 The maximum allowed @var{n} option value is 65536.
11303
11304 Enabled at levels @option{-O2}, @option{-O3}.
11305
11306 @item -falign-loops
11307 @itemx -falign-loops=@var{n}
11308 @itemx -falign-loops=@var{n}:@var{m}
11309 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
11310 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
11311 @opindex falign-loops
11312 Align loops to a power-of-two boundary. If the loops are executed
11313 many times, this makes up for any execution of the dummy padding
11314 instructions.
11315
11316 If @option{-falign-labels} is greater than this value, then its value
11317 is used instead.
11318
11319 Parameters of this option are analogous to the @option{-falign-functions} option.
11320 @option{-fno-align-loops} and @option{-falign-loops=1} are
11321 equivalent and mean that loops are not aligned.
11322 The maximum allowed @var{n} option value is 65536.
11323
11324 If @var{n} is not specified or is zero, use a machine-dependent default.
11325
11326 Enabled at levels @option{-O2}, @option{-O3}.
11327
11328 @item -falign-jumps
11329 @itemx -falign-jumps=@var{n}
11330 @itemx -falign-jumps=@var{n}:@var{m}
11331 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
11332 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
11333 @opindex falign-jumps
11334 Align branch targets to a power-of-two boundary, for branch targets
11335 where the targets can only be reached by jumping. In this case,
11336 no dummy operations need be executed.
11337
11338 If @option{-falign-labels} is greater than this value, then its value
11339 is used instead.
11340
11341 Parameters of this option are analogous to the @option{-falign-functions} option.
11342 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
11343 equivalent and mean that loops are not aligned.
11344
11345 If @var{n} is not specified or is zero, use a machine-dependent default.
11346 The maximum allowed @var{n} option value is 65536.
11347
11348 Enabled at levels @option{-O2}, @option{-O3}.
11349
11350 @item -fno-allocation-dce
11351 @opindex fno-allocation-dce
11352 Do not remove unused C++ allocations in dead code elimination.
11353
11354 @item -fallow-store-data-races
11355 @opindex fallow-store-data-races
11356 Allow the compiler to introduce new data races on stores.
11357
11358 Enabled at level @option{-Ofast}.
11359
11360 @item -funit-at-a-time
11361 @opindex funit-at-a-time
11362 This option is left for compatibility reasons. @option{-funit-at-a-time}
11363 has no effect, while @option{-fno-unit-at-a-time} implies
11364 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11365
11366 Enabled by default.
11367
11368 @item -fno-toplevel-reorder
11369 @opindex fno-toplevel-reorder
11370 @opindex ftoplevel-reorder
11371 Do not reorder top-level functions, variables, and @code{asm}
11372 statements. Output them in the same order that they appear in the
11373 input file. When this option is used, unreferenced static variables
11374 are not removed. This option is intended to support existing code
11375 that relies on a particular ordering. For new code, it is better to
11376 use attributes when possible.
11377
11378 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11379 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11380 Additionally @option{-fno-toplevel-reorder} implies
11381 @option{-fno-section-anchors}.
11382
11383 @item -fweb
11384 @opindex fweb
11385 Constructs webs as commonly used for register allocation purposes and assign
11386 each web individual pseudo register. This allows the register allocation pass
11387 to operate on pseudos directly, but also strengthens several other optimization
11388 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
11389 however, make debugging impossible, since variables no longer stay in a
11390 ``home register''.
11391
11392 Enabled by default with @option{-funroll-loops}.
11393
11394 @item -fwhole-program
11395 @opindex fwhole-program
11396 Assume that the current compilation unit represents the whole program being
11397 compiled. All public functions and variables with the exception of @code{main}
11398 and those merged by attribute @code{externally_visible} become static functions
11399 and in effect are optimized more aggressively by interprocedural optimizers.
11400
11401 This option should not be used in combination with @option{-flto}.
11402 Instead relying on a linker plugin should provide safer and more precise
11403 information.
11404
11405 @item -flto[=@var{n}]
11406 @opindex flto
11407 This option runs the standard link-time optimizer. When invoked
11408 with source code, it generates GIMPLE (one of GCC's internal
11409 representations) and writes it to special ELF sections in the object
11410 file. When the object files are linked together, all the function
11411 bodies are read from these ELF sections and instantiated as if they
11412 had been part of the same translation unit.
11413
11414 To use the link-time optimizer, @option{-flto} and optimization
11415 options should be specified at compile time and during the final link.
11416 It is recommended that you compile all the files participating in the
11417 same link with the same options and also specify those options at
11418 link time.
11419 For example:
11420
11421 @smallexample
11422 gcc -c -O2 -flto foo.c
11423 gcc -c -O2 -flto bar.c
11424 gcc -o myprog -flto -O2 foo.o bar.o
11425 @end smallexample
11426
11427 The first two invocations to GCC save a bytecode representation
11428 of GIMPLE into special ELF sections inside @file{foo.o} and
11429 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
11430 @file{foo.o} and @file{bar.o}, merges the two files into a single
11431 internal image, and compiles the result as usual. Since both
11432 @file{foo.o} and @file{bar.o} are merged into a single image, this
11433 causes all the interprocedural analyses and optimizations in GCC to
11434 work across the two files as if they were a single one. This means,
11435 for example, that the inliner is able to inline functions in
11436 @file{bar.o} into functions in @file{foo.o} and vice-versa.
11437
11438 Another (simpler) way to enable link-time optimization is:
11439
11440 @smallexample
11441 gcc -o myprog -flto -O2 foo.c bar.c
11442 @end smallexample
11443
11444 The above generates bytecode for @file{foo.c} and @file{bar.c},
11445 merges them together into a single GIMPLE representation and optimizes
11446 them as usual to produce @file{myprog}.
11447
11448 The important thing to keep in mind is that to enable link-time
11449 optimizations you need to use the GCC driver to perform the link step.
11450 GCC automatically performs link-time optimization if any of the
11451 objects involved were compiled with the @option{-flto} command-line option.
11452 You can always override
11453 the automatic decision to do link-time optimization
11454 by passing @option{-fno-lto} to the link command.
11455
11456 To make whole program optimization effective, it is necessary to make
11457 certain whole program assumptions. The compiler needs to know
11458 what functions and variables can be accessed by libraries and runtime
11459 outside of the link-time optimized unit. When supported by the linker,
11460 the linker plugin (see @option{-fuse-linker-plugin}) passes information
11461 to the compiler about used and externally visible symbols. When
11462 the linker plugin is not available, @option{-fwhole-program} should be
11463 used to allow the compiler to make these assumptions, which leads
11464 to more aggressive optimization decisions.
11465
11466 When a file is compiled with @option{-flto} without
11467 @option{-fuse-linker-plugin}, the generated object file is larger than
11468 a regular object file because it contains GIMPLE bytecodes and the usual
11469 final code (see @option{-ffat-lto-objects}. This means that
11470 object files with LTO information can be linked as normal object
11471 files; if @option{-fno-lto} is passed to the linker, no
11472 interprocedural optimizations are applied. Note that when
11473 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
11474 but you cannot perform a regular, non-LTO link on them.
11475
11476 When producing the final binary, GCC only
11477 applies link-time optimizations to those files that contain bytecode.
11478 Therefore, you can mix and match object files and libraries with
11479 GIMPLE bytecodes and final object code. GCC automatically selects
11480 which files to optimize in LTO mode and which files to link without
11481 further processing.
11482
11483 Generally, options specified at link time override those
11484 specified at compile time, although in some cases GCC attempts to infer
11485 link-time options from the settings used to compile the input files.
11486
11487 If you do not specify an optimization level option @option{-O} at
11488 link time, then GCC uses the highest optimization level
11489 used when compiling the object files. Note that it is generally
11490 ineffective to specify an optimization level option only at link time and
11491 not at compile time, for two reasons. First, compiling without
11492 optimization suppresses compiler passes that gather information
11493 needed for effective optimization at link time. Second, some early
11494 optimization passes can be performed only at compile time and
11495 not at link time.
11496
11497 There are some code generation flags preserved by GCC when
11498 generating bytecodes, as they need to be used during the final link.
11499 Currently, the following options and their settings are taken from
11500 the first object file that explicitly specifies them:
11501 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
11502 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
11503 and all the @option{-m} target flags.
11504
11505 Certain ABI-changing flags are required to match in all compilation units,
11506 and trying to override this at link time with a conflicting value
11507 is ignored. This includes options such as @option{-freg-struct-return}
11508 and @option{-fpcc-struct-return}.
11509
11510 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11511 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11512 are passed through to the link stage and merged conservatively for
11513 conflicting translation units. Specifically
11514 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11515 precedence; and for example @option{-ffp-contract=off} takes precedence
11516 over @option{-ffp-contract=fast}. You can override them at link time.
11517
11518 Diagnostic options such as @option{-Wstringop-overflow} are passed
11519 through to the link stage and their setting matches that of the
11520 compile-step at function granularity. Note that this matters only
11521 for diagnostics emitted during optimization. Note that code
11522 transforms such as inlining can lead to warnings being enabled
11523 or disabled for regions if code not consistent with the setting
11524 at compile time.
11525
11526 When you need to pass options to the assembler via @option{-Wa} or
11527 @option{-Xassembler} make sure to either compile such translation
11528 units with @option{-fno-lto} or consistently use the same assembler
11529 options on all translation units. You can alternatively also
11530 specify assembler options at LTO link time.
11531
11532 To enable debug info generation you need to supply @option{-g} at
11533 compile time. If any of the input files at link time were built
11534 with debug info generation enabled the link will enable debug info
11535 generation as well. Any elaborate debug info settings
11536 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11537 at the linker command line and mixing different settings in different
11538 translation units is discouraged.
11539
11540 If LTO encounters objects with C linkage declared with incompatible
11541 types in separate translation units to be linked together (undefined
11542 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11543 issued. The behavior is still undefined at run time. Similar
11544 diagnostics may be raised for other languages.
11545
11546 Another feature of LTO is that it is possible to apply interprocedural
11547 optimizations on files written in different languages:
11548
11549 @smallexample
11550 gcc -c -flto foo.c
11551 g++ -c -flto bar.cc
11552 gfortran -c -flto baz.f90
11553 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11554 @end smallexample
11555
11556 Notice that the final link is done with @command{g++} to get the C++
11557 runtime libraries and @option{-lgfortran} is added to get the Fortran
11558 runtime libraries. In general, when mixing languages in LTO mode, you
11559 should use the same link command options as when mixing languages in a
11560 regular (non-LTO) compilation.
11561
11562 If object files containing GIMPLE bytecode are stored in a library archive, say
11563 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11564 are using a linker with plugin support. To create static libraries suitable
11565 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11566 and @command{ranlib};
11567 to show the symbols of object files with GIMPLE bytecode, use
11568 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
11569 and @command{nm} have been compiled with plugin support. At link time, use the
11570 flag @option{-fuse-linker-plugin} to ensure that the library participates in
11571 the LTO optimization process:
11572
11573 @smallexample
11574 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11575 @end smallexample
11576
11577 With the linker plugin enabled, the linker extracts the needed
11578 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11579 to make them part of the aggregated GIMPLE image to be optimized.
11580
11581 If you are not using a linker with plugin support and/or do not
11582 enable the linker plugin, then the objects inside @file{libfoo.a}
11583 are extracted and linked as usual, but they do not participate
11584 in the LTO optimization process. In order to make a static library suitable
11585 for both LTO optimization and usual linkage, compile its object files with
11586 @option{-flto} @option{-ffat-lto-objects}.
11587
11588 Link-time optimizations do not require the presence of the whole program to
11589 operate. If the program does not require any symbols to be exported, it is
11590 possible to combine @option{-flto} and @option{-fwhole-program} to allow
11591 the interprocedural optimizers to use more aggressive assumptions which may
11592 lead to improved optimization opportunities.
11593 Use of @option{-fwhole-program} is not needed when linker plugin is
11594 active (see @option{-fuse-linker-plugin}).
11595
11596 The current implementation of LTO makes no
11597 attempt to generate bytecode that is portable between different
11598 types of hosts. The bytecode files are versioned and there is a
11599 strict version check, so bytecode files generated in one version of
11600 GCC do not work with an older or newer version of GCC.
11601
11602 Link-time optimization does not work well with generation of debugging
11603 information on systems other than those using a combination of ELF and
11604 DWARF.
11605
11606 If you specify the optional @var{n}, the optimization and code
11607 generation done at link time is executed in parallel using @var{n}
11608 parallel jobs by utilizing an installed @command{make} program. The
11609 environment variable @env{MAKE} may be used to override the program
11610 used.
11611
11612 You can also specify @option{-flto=jobserver} to use GNU make's
11613 job server mode to determine the number of parallel jobs. This
11614 is useful when the Makefile calling GCC is already executing in parallel.
11615 You must prepend a @samp{+} to the command recipe in the parent Makefile
11616 for this to work. This option likely only works if @env{MAKE} is
11617 GNU make. Even without the option value, GCC tries to automatically
11618 detect a running GNU make's job server.
11619
11620 Use @option{-flto=auto} to use GNU make's job server, if available,
11621 or otherwise fall back to autodetection of the number of CPU threads
11622 present in your system.
11623
11624 @item -flto-partition=@var{alg}
11625 @opindex flto-partition
11626 Specify the partitioning algorithm used by the link-time optimizer.
11627 The value is either @samp{1to1} to specify a partitioning mirroring
11628 the original source files or @samp{balanced} to specify partitioning
11629 into equally sized chunks (whenever possible) or @samp{max} to create
11630 new partition for every symbol where possible. Specifying @samp{none}
11631 as an algorithm disables partitioning and streaming completely.
11632 The default value is @samp{balanced}. While @samp{1to1} can be used
11633 as an workaround for various code ordering issues, the @samp{max}
11634 partitioning is intended for internal testing only.
11635 The value @samp{one} specifies that exactly one partition should be
11636 used while the value @samp{none} bypasses partitioning and executes
11637 the link-time optimization step directly from the WPA phase.
11638
11639 @item -flto-compression-level=@var{n}
11640 @opindex flto-compression-level
11641 This option specifies the level of compression used for intermediate
11642 language written to LTO object files, and is only meaningful in
11643 conjunction with LTO mode (@option{-flto}). Valid
11644 values are 0 (no compression) to 9 (maximum compression). Values
11645 outside this range are clamped to either 0 or 9. If the option is not
11646 given, a default balanced compression setting is used.
11647
11648 @item -fuse-linker-plugin
11649 @opindex fuse-linker-plugin
11650 Enables the use of a linker plugin during link-time optimization. This
11651 option relies on plugin support in the linker, which is available in gold
11652 or in GNU ld 2.21 or newer.
11653
11654 This option enables the extraction of object files with GIMPLE bytecode out
11655 of library archives. This improves the quality of optimization by exposing
11656 more code to the link-time optimizer. This information specifies what
11657 symbols can be accessed externally (by non-LTO object or during dynamic
11658 linking). Resulting code quality improvements on binaries (and shared
11659 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11660 See @option{-flto} for a description of the effect of this flag and how to
11661 use it.
11662
11663 This option is enabled by default when LTO support in GCC is enabled
11664 and GCC was configured for use with
11665 a linker supporting plugins (GNU ld 2.21 or newer or gold).
11666
11667 @item -ffat-lto-objects
11668 @opindex ffat-lto-objects
11669 Fat LTO objects are object files that contain both the intermediate language
11670 and the object code. This makes them usable for both LTO linking and normal
11671 linking. This option is effective only when compiling with @option{-flto}
11672 and is ignored at link time.
11673
11674 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11675 requires the complete toolchain to be aware of LTO. It requires a linker with
11676 linker plugin support for basic functionality. Additionally,
11677 @command{nm}, @command{ar} and @command{ranlib}
11678 need to support linker plugins to allow a full-featured build environment
11679 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
11680 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11681 to these tools. With non fat LTO makefiles need to be modified to use them.
11682
11683 Note that modern binutils provide plugin auto-load mechanism.
11684 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11685 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11686 @command{gcc-ranlib}).
11687
11688 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11689 support.
11690
11691 @item -fcompare-elim
11692 @opindex fcompare-elim
11693 After register allocation and post-register allocation instruction splitting,
11694 identify arithmetic instructions that compute processor flags similar to a
11695 comparison operation based on that arithmetic. If possible, eliminate the
11696 explicit comparison operation.
11697
11698 This pass only applies to certain targets that cannot explicitly represent
11699 the comparison operation before register allocation is complete.
11700
11701 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11702
11703 @item -fcprop-registers
11704 @opindex fcprop-registers
11705 After register allocation and post-register allocation instruction splitting,
11706 perform a copy-propagation pass to try to reduce scheduling dependencies
11707 and occasionally eliminate the copy.
11708
11709 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11710
11711 @item -fprofile-correction
11712 @opindex fprofile-correction
11713 Profiles collected using an instrumented binary for multi-threaded programs may
11714 be inconsistent due to missed counter updates. When this option is specified,
11715 GCC uses heuristics to correct or smooth out such inconsistencies. By
11716 default, GCC emits an error message when an inconsistent profile is detected.
11717
11718 This option is enabled by @option{-fauto-profile}.
11719
11720 @item -fprofile-partial-training
11721 @opindex fprofile-partial-training
11722 With @code{-fprofile-use} all portions of programs not executed during train
11723 run are optimized agressively for size rather than speed. In some cases it is
11724 not practical to train all possible hot paths in the program. (For
11725 example, program may contain functions specific for a given hardware and
11726 trianing may not cover all hardware configurations program is run on.) With
11727 @code{-fprofile-partial-training} profile feedback will be ignored for all
11728 functions not executed during the train run leading them to be optimized as if
11729 they were compiled without profile feedback. This leads to better performance
11730 when train run is not representative but also leads to significantly bigger
11731 code.
11732
11733 @item -fprofile-use
11734 @itemx -fprofile-use=@var{path}
11735 @opindex fprofile-use
11736 Enable profile feedback-directed optimizations,
11737 and the following optimizations, many of which
11738 are generally profitable only with profile feedback available:
11739
11740 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11741 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11742 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11743 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11744 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11745 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11746 -fprofile-reorder-functions}
11747
11748 Before you can use this option, you must first generate profiling information.
11749 @xref{Instrumentation Options}, for information about the
11750 @option{-fprofile-generate} option.
11751
11752 By default, GCC emits an error message if the feedback profiles do not
11753 match the source code. This error can be turned into a warning by using
11754 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
11755 optimized code. Additionally, by default, GCC also emits a warning message if
11756 the feedback profiles do not exist (see @option{-Wmissing-profile}).
11757
11758 If @var{path} is specified, GCC looks at the @var{path} to find
11759 the profile feedback data files. See @option{-fprofile-dir}.
11760
11761 @item -fauto-profile
11762 @itemx -fauto-profile=@var{path}
11763 @opindex fauto-profile
11764 Enable sampling-based feedback-directed optimizations,
11765 and the following optimizations,
11766 many of which are generally profitable only with profile feedback available:
11767
11768 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11769 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11770 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11771 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11772 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11773 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11774 -fprofile-correction}
11775
11776 @var{path} is the name of a file containing AutoFDO profile information.
11777 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11778
11779 Producing an AutoFDO profile data file requires running your program
11780 with the @command{perf} utility on a supported GNU/Linux target system.
11781 For more information, see @uref{https://perf.wiki.kernel.org/}.
11782
11783 E.g.
11784 @smallexample
11785 perf record -e br_inst_retired:near_taken -b -o perf.data \
11786 -- your_program
11787 @end smallexample
11788
11789 Then use the @command{create_gcov} tool to convert the raw profile data
11790 to a format that can be used by GCC.@ You must also supply the
11791 unstripped binary for your program to this tool.
11792 See @uref{https://github.com/google/autofdo}.
11793
11794 E.g.
11795 @smallexample
11796 create_gcov --binary=your_program.unstripped --profile=perf.data \
11797 --gcov=profile.afdo
11798 @end smallexample
11799 @end table
11800
11801 The following options control compiler behavior regarding floating-point
11802 arithmetic. These options trade off between speed and
11803 correctness. All must be specifically enabled.
11804
11805 @table @gcctabopt
11806 @item -ffloat-store
11807 @opindex ffloat-store
11808 Do not store floating-point variables in registers, and inhibit other
11809 options that might change whether a floating-point value is taken from a
11810 register or memory.
11811
11812 @cindex floating-point precision
11813 This option prevents undesirable excess precision on machines such as
11814 the 68000 where the floating registers (of the 68881) keep more
11815 precision than a @code{double} is supposed to have. Similarly for the
11816 x86 architecture. For most programs, the excess precision does only
11817 good, but a few programs rely on the precise definition of IEEE floating
11818 point. Use @option{-ffloat-store} for such programs, after modifying
11819 them to store all pertinent intermediate computations into variables.
11820
11821 @item -fexcess-precision=@var{style}
11822 @opindex fexcess-precision
11823 This option allows further control over excess precision on machines
11824 where floating-point operations occur in a format with more precision or
11825 range than the IEEE standard and interchange floating-point types. By
11826 default, @option{-fexcess-precision=fast} is in effect; this means that
11827 operations may be carried out in a wider precision than the types specified
11828 in the source if that would result in faster code, and it is unpredictable
11829 when rounding to the types specified in the source code takes place.
11830 When compiling C, if @option{-fexcess-precision=standard} is specified then
11831 excess precision follows the rules specified in ISO C99; in particular,
11832 both casts and assignments cause values to be rounded to their
11833 semantic types (whereas @option{-ffloat-store} only affects
11834 assignments). This option is enabled by default for C if a strict
11835 conformance option such as @option{-std=c99} is used.
11836 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11837 regardless of whether a strict conformance option is used.
11838
11839 @opindex mfpmath
11840 @option{-fexcess-precision=standard} is not implemented for languages
11841 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
11842 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11843 semantics apply without excess precision, and in the latter, rounding
11844 is unpredictable.
11845
11846 @item -ffast-math
11847 @opindex ffast-math
11848 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11849 @option{-ffinite-math-only}, @option{-fno-rounding-math},
11850 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11851 @option{-fexcess-precision=fast}.
11852
11853 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11854
11855 This option is not turned on by any @option{-O} option besides
11856 @option{-Ofast} since it can result in incorrect output for programs
11857 that depend on an exact implementation of IEEE or ISO rules/specifications
11858 for math functions. It may, however, yield faster code for programs
11859 that do not require the guarantees of these specifications.
11860
11861 @item -fno-math-errno
11862 @opindex fno-math-errno
11863 @opindex fmath-errno
11864 Do not set @code{errno} after calling math functions that are executed
11865 with a single instruction, e.g., @code{sqrt}. A program that relies on
11866 IEEE exceptions for math error handling may want to use this flag
11867 for speed while maintaining IEEE arithmetic compatibility.
11868
11869 This option is not turned on by any @option{-O} option since
11870 it can result in incorrect output for programs that depend on
11871 an exact implementation of IEEE or ISO rules/specifications for
11872 math functions. It may, however, yield faster code for programs
11873 that do not require the guarantees of these specifications.
11874
11875 The default is @option{-fmath-errno}.
11876
11877 On Darwin systems, the math library never sets @code{errno}. There is
11878 therefore no reason for the compiler to consider the possibility that
11879 it might, and @option{-fno-math-errno} is the default.
11880
11881 @item -funsafe-math-optimizations
11882 @opindex funsafe-math-optimizations
11883
11884 Allow optimizations for floating-point arithmetic that (a) assume
11885 that arguments and results are valid and (b) may violate IEEE or
11886 ANSI standards. When used at link time, it may include libraries
11887 or startup files that change the default FPU control word or other
11888 similar optimizations.
11889
11890 This option is not turned on by any @option{-O} option since
11891 it can result in incorrect output for programs that depend on
11892 an exact implementation of IEEE or ISO rules/specifications for
11893 math functions. It may, however, yield faster code for programs
11894 that do not require the guarantees of these specifications.
11895 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
11896 @option{-fassociative-math} and @option{-freciprocal-math}.
11897
11898 The default is @option{-fno-unsafe-math-optimizations}.
11899
11900 @item -fassociative-math
11901 @opindex fassociative-math
11902
11903 Allow re-association of operands in series of floating-point operations.
11904 This violates the ISO C and C++ language standard by possibly changing
11905 computation result. NOTE: re-ordering may change the sign of zero as
11906 well as ignore NaNs and inhibit or create underflow or overflow (and
11907 thus cannot be used on code that relies on rounding behavior like
11908 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
11909 and thus may not be used when ordered comparisons are required.
11910 This option requires that both @option{-fno-signed-zeros} and
11911 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
11912 much sense with @option{-frounding-math}. For Fortran the option
11913 is automatically enabled when both @option{-fno-signed-zeros} and
11914 @option{-fno-trapping-math} are in effect.
11915
11916 The default is @option{-fno-associative-math}.
11917
11918 @item -freciprocal-math
11919 @opindex freciprocal-math
11920
11921 Allow the reciprocal of a value to be used instead of dividing by
11922 the value if this enables optimizations. For example @code{x / y}
11923 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
11924 is subject to common subexpression elimination. Note that this loses
11925 precision and increases the number of flops operating on the value.
11926
11927 The default is @option{-fno-reciprocal-math}.
11928
11929 @item -ffinite-math-only
11930 @opindex ffinite-math-only
11931 Allow optimizations for floating-point arithmetic that assume
11932 that arguments and results are not NaNs or +-Infs.
11933
11934 This option is not turned on by any @option{-O} option since
11935 it can result in incorrect output for programs that depend on
11936 an exact implementation of IEEE or ISO rules/specifications for
11937 math functions. It may, however, yield faster code for programs
11938 that do not require the guarantees of these specifications.
11939
11940 The default is @option{-fno-finite-math-only}.
11941
11942 @item -fno-signed-zeros
11943 @opindex fno-signed-zeros
11944 @opindex fsigned-zeros
11945 Allow optimizations for floating-point arithmetic that ignore the
11946 signedness of zero. IEEE arithmetic specifies the behavior of
11947 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
11948 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
11949 This option implies that the sign of a zero result isn't significant.
11950
11951 The default is @option{-fsigned-zeros}.
11952
11953 @item -fno-trapping-math
11954 @opindex fno-trapping-math
11955 @opindex ftrapping-math
11956 Compile code assuming that floating-point operations cannot generate
11957 user-visible traps. These traps include division by zero, overflow,
11958 underflow, inexact result and invalid operation. This option requires
11959 that @option{-fno-signaling-nans} be in effect. Setting this option may
11960 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
11961
11962 This option should never be turned on by any @option{-O} option since
11963 it can result in incorrect output for programs that depend on
11964 an exact implementation of IEEE or ISO rules/specifications for
11965 math functions.
11966
11967 The default is @option{-ftrapping-math}.
11968
11969 @item -frounding-math
11970 @opindex frounding-math
11971 Disable transformations and optimizations that assume default floating-point
11972 rounding behavior. This is round-to-zero for all floating point
11973 to integer conversions, and round-to-nearest for all other arithmetic
11974 truncations. This option should be specified for programs that change
11975 the FP rounding mode dynamically, or that may be executed with a
11976 non-default rounding mode. This option disables constant folding of
11977 floating-point expressions at compile time (which may be affected by
11978 rounding mode) and arithmetic transformations that are unsafe in the
11979 presence of sign-dependent rounding modes.
11980
11981 The default is @option{-fno-rounding-math}.
11982
11983 This option is experimental and does not currently guarantee to
11984 disable all GCC optimizations that are affected by rounding mode.
11985 Future versions of GCC may provide finer control of this setting
11986 using C99's @code{FENV_ACCESS} pragma. This command-line option
11987 will be used to specify the default state for @code{FENV_ACCESS}.
11988
11989 @item -fsignaling-nans
11990 @opindex fsignaling-nans
11991 Compile code assuming that IEEE signaling NaNs may generate user-visible
11992 traps during floating-point operations. Setting this option disables
11993 optimizations that may change the number of exceptions visible with
11994 signaling NaNs. This option implies @option{-ftrapping-math}.
11995
11996 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
11997 be defined.
11998
11999 The default is @option{-fno-signaling-nans}.
12000
12001 This option is experimental and does not currently guarantee to
12002 disable all GCC optimizations that affect signaling NaN behavior.
12003
12004 @item -fno-fp-int-builtin-inexact
12005 @opindex fno-fp-int-builtin-inexact
12006 @opindex ffp-int-builtin-inexact
12007 Do not allow the built-in functions @code{ceil}, @code{floor},
12008 @code{round} and @code{trunc}, and their @code{float} and @code{long
12009 double} variants, to generate code that raises the ``inexact''
12010 floating-point exception for noninteger arguments. ISO C99 and C11
12011 allow these functions to raise the ``inexact'' exception, but ISO/IEC
12012 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
12013 ISO C2X, does not allow these functions to do so.
12014
12015 The default is @option{-ffp-int-builtin-inexact}, allowing the
12016 exception to be raised, unless C2X or a later C standard is selected.
12017 This option does nothing unless @option{-ftrapping-math} is in effect.
12018
12019 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
12020 generate a call to a library function then the ``inexact'' exception
12021 may be raised if the library implementation does not follow TS 18661.
12022
12023 @item -fsingle-precision-constant
12024 @opindex fsingle-precision-constant
12025 Treat floating-point constants as single precision instead of
12026 implicitly converting them to double-precision constants.
12027
12028 @item -fcx-limited-range
12029 @opindex fcx-limited-range
12030 When enabled, this option states that a range reduction step is not
12031 needed when performing complex division. Also, there is no checking
12032 whether the result of a complex multiplication or division is @code{NaN
12033 + I*NaN}, with an attempt to rescue the situation in that case. The
12034 default is @option{-fno-cx-limited-range}, but is enabled by
12035 @option{-ffast-math}.
12036
12037 This option controls the default setting of the ISO C99
12038 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
12039 all languages.
12040
12041 @item -fcx-fortran-rules
12042 @opindex fcx-fortran-rules
12043 Complex multiplication and division follow Fortran rules. Range
12044 reduction is done as part of complex division, but there is no checking
12045 whether the result of a complex multiplication or division is @code{NaN
12046 + I*NaN}, with an attempt to rescue the situation in that case.
12047
12048 The default is @option{-fno-cx-fortran-rules}.
12049
12050 @end table
12051
12052 The following options control optimizations that may improve
12053 performance, but are not enabled by any @option{-O} options. This
12054 section includes experimental options that may produce broken code.
12055
12056 @table @gcctabopt
12057 @item -fbranch-probabilities
12058 @opindex fbranch-probabilities
12059 After running a program compiled with @option{-fprofile-arcs}
12060 (@pxref{Instrumentation Options}),
12061 you can compile it a second time using
12062 @option{-fbranch-probabilities}, to improve optimizations based on
12063 the number of times each branch was taken. When a program
12064 compiled with @option{-fprofile-arcs} exits, it saves arc execution
12065 counts to a file called @file{@var{sourcename}.gcda} for each source
12066 file. The information in this data file is very dependent on the
12067 structure of the generated code, so you must use the same source code
12068 and the same optimization options for both compilations.
12069
12070 With @option{-fbranch-probabilities}, GCC puts a
12071 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
12072 These can be used to improve optimization. Currently, they are only
12073 used in one place: in @file{reorg.c}, instead of guessing which path a
12074 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
12075 exactly determine which path is taken more often.
12076
12077 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12078
12079 @item -fprofile-values
12080 @opindex fprofile-values
12081 If combined with @option{-fprofile-arcs}, it adds code so that some
12082 data about values of expressions in the program is gathered.
12083
12084 With @option{-fbranch-probabilities}, it reads back the data gathered
12085 from profiling values of expressions for usage in optimizations.
12086
12087 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
12088 @option{-fauto-profile}.
12089
12090 @item -fprofile-reorder-functions
12091 @opindex fprofile-reorder-functions
12092 Function reordering based on profile instrumentation collects
12093 first time of execution of a function and orders these functions
12094 in ascending order.
12095
12096 Enabled with @option{-fprofile-use}.
12097
12098 @item -fvpt
12099 @opindex fvpt
12100 If combined with @option{-fprofile-arcs}, this option instructs the compiler
12101 to add code to gather information about values of expressions.
12102
12103 With @option{-fbranch-probabilities}, it reads back the data gathered
12104 and actually performs the optimizations based on them.
12105 Currently the optimizations include specialization of division operations
12106 using the knowledge about the value of the denominator.
12107
12108 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
12109
12110 @item -frename-registers
12111 @opindex frename-registers
12112 Attempt to avoid false dependencies in scheduled code by making use
12113 of registers left over after register allocation. This optimization
12114 most benefits processors with lots of registers. Depending on the
12115 debug information format adopted by the target, however, it can
12116 make debugging impossible, since variables no longer stay in
12117 a ``home register''.
12118
12119 Enabled by default with @option{-funroll-loops}.
12120
12121 @item -fschedule-fusion
12122 @opindex fschedule-fusion
12123 Performs a target dependent pass over the instruction stream to schedule
12124 instructions of same type together because target machine can execute them
12125 more efficiently if they are adjacent to each other in the instruction flow.
12126
12127 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12128
12129 @item -ftracer
12130 @opindex ftracer
12131 Perform tail duplication to enlarge superblock size. This transformation
12132 simplifies the control flow of the function allowing other optimizations to do
12133 a better job.
12134
12135 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12136
12137 @item -funroll-loops
12138 @opindex funroll-loops
12139 Unroll loops whose number of iterations can be determined at compile time or
12140 upon entry to the loop. @option{-funroll-loops} implies
12141 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
12142 It also turns on complete loop peeling (i.e.@: complete removal of loops with
12143 a small constant number of iterations). This option makes code larger, and may
12144 or may not make it run faster.
12145
12146 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12147
12148 @item -funroll-all-loops
12149 @opindex funroll-all-loops
12150 Unroll all loops, even if their number of iterations is uncertain when
12151 the loop is entered. This usually makes programs run more slowly.
12152 @option{-funroll-all-loops} implies the same options as
12153 @option{-funroll-loops}.
12154
12155 @item -fpeel-loops
12156 @opindex fpeel-loops
12157 Peels loops for which there is enough information that they do not
12158 roll much (from profile feedback or static analysis). It also turns on
12159 complete loop peeling (i.e.@: complete removal of loops with small constant
12160 number of iterations).
12161
12162 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
12163
12164 @item -fmove-loop-invariants
12165 @opindex fmove-loop-invariants
12166 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
12167 at level @option{-O1} and higher, except for @option{-Og}.
12168
12169 @item -fsplit-loops
12170 @opindex fsplit-loops
12171 Split a loop into two if it contains a condition that's always true
12172 for one side of the iteration space and false for the other.
12173
12174 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12175
12176 @item -funswitch-loops
12177 @opindex funswitch-loops
12178 Move branches with loop invariant conditions out of the loop, with duplicates
12179 of the loop on both branches (modified according to result of the condition).
12180
12181 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12182
12183 @item -fversion-loops-for-strides
12184 @opindex fversion-loops-for-strides
12185 If a loop iterates over an array with a variable stride, create another
12186 version of the loop that assumes the stride is always one. For example:
12187
12188 @smallexample
12189 for (int i = 0; i < n; ++i)
12190 x[i * stride] = @dots{};
12191 @end smallexample
12192
12193 becomes:
12194
12195 @smallexample
12196 if (stride == 1)
12197 for (int i = 0; i < n; ++i)
12198 x[i] = @dots{};
12199 else
12200 for (int i = 0; i < n; ++i)
12201 x[i * stride] = @dots{};
12202 @end smallexample
12203
12204 This is particularly useful for assumed-shape arrays in Fortran where
12205 (for example) it allows better vectorization assuming contiguous accesses.
12206 This flag is enabled by default at @option{-O3}.
12207 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12208
12209 @item -ffunction-sections
12210 @itemx -fdata-sections
12211 @opindex ffunction-sections
12212 @opindex fdata-sections
12213 Place each function or data item into its own section in the output
12214 file if the target supports arbitrary sections. The name of the
12215 function or the name of the data item determines the section's name
12216 in the output file.
12217
12218 Use these options on systems where the linker can perform optimizations to
12219 improve locality of reference in the instruction space. Most systems using the
12220 ELF object format have linkers with such optimizations. On AIX, the linker
12221 rearranges sections (CSECTs) based on the call graph. The performance impact
12222 varies.
12223
12224 Together with a linker garbage collection (linker @option{--gc-sections}
12225 option) these options may lead to smaller statically-linked executables (after
12226 stripping).
12227
12228 On ELF/DWARF systems these options do not degenerate the quality of the debug
12229 information. There could be issues with other object files/debug info formats.
12230
12231 Only use these options when there are significant benefits from doing so. When
12232 you specify these options, the assembler and linker create larger object and
12233 executable files and are also slower. These options affect code generation.
12234 They prevent optimizations by the compiler and assembler using relative
12235 locations inside a translation unit since the locations are unknown until
12236 link time. An example of such an optimization is relaxing calls to short call
12237 instructions.
12238
12239 @item -fstdarg-opt
12240 @opindex fstdarg-opt
12241 Optimize the prologue of variadic argument functions with respect to usage of
12242 those arguments.
12243
12244 @item -fsection-anchors
12245 @opindex fsection-anchors
12246 Try to reduce the number of symbolic address calculations by using
12247 shared ``anchor'' symbols to address nearby objects. This transformation
12248 can help to reduce the number of GOT entries and GOT accesses on some
12249 targets.
12250
12251 For example, the implementation of the following function @code{foo}:
12252
12253 @smallexample
12254 static int a, b, c;
12255 int foo (void) @{ return a + b + c; @}
12256 @end smallexample
12257
12258 @noindent
12259 usually calculates the addresses of all three variables, but if you
12260 compile it with @option{-fsection-anchors}, it accesses the variables
12261 from a common anchor point instead. The effect is similar to the
12262 following pseudocode (which isn't valid C):
12263
12264 @smallexample
12265 int foo (void)
12266 @{
12267 register int *xr = &x;
12268 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
12269 @}
12270 @end smallexample
12271
12272 Not all targets support this option.
12273
12274 @item --param @var{name}=@var{value}
12275 @opindex param
12276 In some places, GCC uses various constants to control the amount of
12277 optimization that is done. For example, GCC does not inline functions
12278 that contain more than a certain number of instructions. You can
12279 control some of these constants on the command line using the
12280 @option{--param} option.
12281
12282 The names of specific parameters, and the meaning of the values, are
12283 tied to the internals of the compiler, and are subject to change
12284 without notice in future releases.
12285
12286 In order to get minimal, maximal and default value of a parameter,
12287 one can use @option{--help=param -Q} options.
12288
12289 In each case, the @var{value} is an integer. The following choices
12290 of @var{name} are recognized for all targets:
12291
12292 @table @gcctabopt
12293 @item predictable-branch-outcome
12294 When branch is predicted to be taken with probability lower than this threshold
12295 (in percent), then it is considered well predictable.
12296
12297 @item max-rtl-if-conversion-insns
12298 RTL if-conversion tries to remove conditional branches around a block and
12299 replace them with conditionally executed instructions. This parameter
12300 gives the maximum number of instructions in a block which should be
12301 considered for if-conversion. The compiler will
12302 also use other heuristics to decide whether if-conversion is likely to be
12303 profitable.
12304
12305 @item max-rtl-if-conversion-predictable-cost
12306 @itemx max-rtl-if-conversion-unpredictable-cost
12307 RTL if-conversion will try to remove conditional branches around a block
12308 and replace them with conditionally executed instructions. These parameters
12309 give the maximum permissible cost for the sequence that would be generated
12310 by if-conversion depending on whether the branch is statically determined
12311 to be predictable or not. The units for this parameter are the same as
12312 those for the GCC internal seq_cost metric. The compiler will try to
12313 provide a reasonable default for this parameter using the BRANCH_COST
12314 target macro.
12315
12316 @item max-crossjump-edges
12317 The maximum number of incoming edges to consider for cross-jumping.
12318 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
12319 the number of edges incoming to each block. Increasing values mean
12320 more aggressive optimization, making the compilation time increase with
12321 probably small improvement in executable size.
12322
12323 @item min-crossjump-insns
12324 The minimum number of instructions that must be matched at the end
12325 of two blocks before cross-jumping is performed on them. This
12326 value is ignored in the case where all instructions in the block being
12327 cross-jumped from are matched.
12328
12329 @item max-grow-copy-bb-insns
12330 The maximum code size expansion factor when copying basic blocks
12331 instead of jumping. The expansion is relative to a jump instruction.
12332
12333 @item max-goto-duplication-insns
12334 The maximum number of instructions to duplicate to a block that jumps
12335 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
12336 passes, GCC factors computed gotos early in the compilation process,
12337 and unfactors them as late as possible. Only computed jumps at the
12338 end of a basic blocks with no more than max-goto-duplication-insns are
12339 unfactored.
12340
12341 @item max-delay-slot-insn-search
12342 The maximum number of instructions to consider when looking for an
12343 instruction to fill a delay slot. If more than this arbitrary number of
12344 instructions are searched, the time savings from filling the delay slot
12345 are minimal, so stop searching. Increasing values mean more
12346 aggressive optimization, making the compilation time increase with probably
12347 small improvement in execution time.
12348
12349 @item max-delay-slot-live-search
12350 When trying to fill delay slots, the maximum number of instructions to
12351 consider when searching for a block with valid live register
12352 information. Increasing this arbitrarily chosen value means more
12353 aggressive optimization, increasing the compilation time. This parameter
12354 should be removed when the delay slot code is rewritten to maintain the
12355 control-flow graph.
12356
12357 @item max-gcse-memory
12358 The approximate maximum amount of memory that can be allocated in
12359 order to perform the global common subexpression elimination
12360 optimization. If more memory than specified is required, the
12361 optimization is not done.
12362
12363 @item max-gcse-insertion-ratio
12364 If the ratio of expression insertions to deletions is larger than this value
12365 for any expression, then RTL PRE inserts or removes the expression and thus
12366 leaves partially redundant computations in the instruction stream.
12367
12368 @item max-pending-list-length
12369 The maximum number of pending dependencies scheduling allows
12370 before flushing the current state and starting over. Large functions
12371 with few branches or calls can create excessively large lists which
12372 needlessly consume memory and resources.
12373
12374 @item max-modulo-backtrack-attempts
12375 The maximum number of backtrack attempts the scheduler should make
12376 when modulo scheduling a loop. Larger values can exponentially increase
12377 compilation time.
12378
12379 @item max-inline-insns-single
12380 Several parameters control the tree inliner used in GCC@. This number sets the
12381 maximum number of instructions (counted in GCC's internal representation) in a
12382 single function that the tree inliner considers for inlining. This only
12383 affects functions declared inline and methods implemented in a class
12384 declaration (C++).
12385
12386
12387 @item max-inline-insns-auto
12388 When you use @option{-finline-functions} (included in @option{-O3}),
12389 a lot of functions that would otherwise not be considered for inlining
12390 by the compiler are investigated. To those functions, a different
12391 (more restrictive) limit compared to functions declared inline can
12392 be applied (@option{--param max-inline-insns-auto}).
12393
12394 @item max-inline-insns-small
12395 This is bound applied to calls which are considered relevant with
12396 @option{-finline-small-functions}.
12397
12398 @item max-inline-insns-size
12399 This is bound applied to calls which are optimized for size. Small growth
12400 may be desirable to anticipate optimization oppurtunities exposed by inlining.
12401
12402 @item uninlined-function-insns
12403 Number of instructions accounted by inliner for function overhead such as
12404 function prologue and epilogue.
12405
12406 @item uninlined-function-time
12407 Extra time accounted by inliner for function overhead such as time needed to
12408 execute function prologue and epilogue
12409
12410 @item inline-heuristics-hint-percent
12411 The scale (in percents) applied to @option{inline-insns-single},
12412 @option{inline-insns-single-O2}, @option{inline-insns-auto}
12413 when inline heuristics hints that inlining is
12414 very profitable (will enable later optimizations).
12415
12416 @item uninlined-thunk-insns
12417 @item uninlined-thunk-time
12418 Same as @option{--param uninlined-function-insns} and
12419 @option{--param uninlined-function-time} but applied to function thunks
12420
12421 @item inline-min-speedup
12422 When estimated performance improvement of caller + callee runtime exceeds this
12423 threshold (in percent), the function can be inlined regardless of the limit on
12424 @option{--param max-inline-insns-single} and @option{--param
12425 max-inline-insns-auto}.
12426
12427 @item large-function-insns
12428 The limit specifying really large functions. For functions larger than this
12429 limit after inlining, inlining is constrained by
12430 @option{--param large-function-growth}. This parameter is useful primarily
12431 to avoid extreme compilation time caused by non-linear algorithms used by the
12432 back end.
12433
12434 @item large-function-growth
12435 Specifies maximal growth of large function caused by inlining in percents.
12436 For example, parameter value 100 limits large function growth to 2.0 times
12437 the original size.
12438
12439 @item large-unit-insns
12440 The limit specifying large translation unit. Growth caused by inlining of
12441 units larger than this limit is limited by @option{--param inline-unit-growth}.
12442 For small units this might be too tight.
12443 For example, consider a unit consisting of function A
12444 that is inline and B that just calls A three times. If B is small relative to
12445 A, the growth of unit is 300\% and yet such inlining is very sane. For very
12446 large units consisting of small inlineable functions, however, the overall unit
12447 growth limit is needed to avoid exponential explosion of code size. Thus for
12448 smaller units, the size is increased to @option{--param large-unit-insns}
12449 before applying @option{--param inline-unit-growth}.
12450
12451 @item inline-unit-growth
12452 Specifies maximal overall growth of the compilation unit caused by inlining.
12453 For example, parameter value 20 limits unit growth to 1.2 times the original
12454 size. Cold functions (either marked cold via an attribute or by profile
12455 feedback) are not accounted into the unit size.
12456
12457 @item ipa-cp-unit-growth
12458 Specifies maximal overall growth of the compilation unit caused by
12459 interprocedural constant propagation. For example, parameter value 10 limits
12460 unit growth to 1.1 times the original size.
12461
12462 @item large-stack-frame
12463 The limit specifying large stack frames. While inlining the algorithm is trying
12464 to not grow past this limit too much.
12465
12466 @item large-stack-frame-growth
12467 Specifies maximal growth of large stack frames caused by inlining in percents.
12468 For example, parameter value 1000 limits large stack frame growth to 11 times
12469 the original size.
12470
12471 @item max-inline-insns-recursive
12472 @itemx max-inline-insns-recursive-auto
12473 Specifies the maximum number of instructions an out-of-line copy of a
12474 self-recursive inline
12475 function can grow into by performing recursive inlining.
12476
12477 @option{--param max-inline-insns-recursive} applies to functions
12478 declared inline.
12479 For functions not declared inline, recursive inlining
12480 happens only when @option{-finline-functions} (included in @option{-O3}) is
12481 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12482
12483 @item max-inline-recursive-depth
12484 @itemx max-inline-recursive-depth-auto
12485 Specifies the maximum recursion depth used for recursive inlining.
12486
12487 @option{--param max-inline-recursive-depth} applies to functions
12488 declared inline. For functions not declared inline, recursive inlining
12489 happens only when @option{-finline-functions} (included in @option{-O3}) is
12490 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12491
12492 @item min-inline-recursive-probability
12493 Recursive inlining is profitable only for function having deep recursion
12494 in average and can hurt for function having little recursion depth by
12495 increasing the prologue size or complexity of function body to other
12496 optimizers.
12497
12498 When profile feedback is available (see @option{-fprofile-generate}) the actual
12499 recursion depth can be guessed from the probability that function recurses
12500 via a given call expression. This parameter limits inlining only to call
12501 expressions whose probability exceeds the given threshold (in percents).
12502
12503 @item early-inlining-insns
12504 Specify growth that the early inliner can make. In effect it increases
12505 the amount of inlining for code having a large abstraction penalty.
12506
12507 @item max-early-inliner-iterations
12508 Limit of iterations of the early inliner. This basically bounds
12509 the number of nested indirect calls the early inliner can resolve.
12510 Deeper chains are still handled by late inlining.
12511
12512 @item comdat-sharing-probability
12513 Probability (in percent) that C++ inline function with comdat visibility
12514 are shared across multiple compilation units.
12515
12516 @item profile-func-internal-id
12517 A parameter to control whether to use function internal id in profile
12518 database lookup. If the value is 0, the compiler uses an id that
12519 is based on function assembler name and filename, which makes old profile
12520 data more tolerant to source changes such as function reordering etc.
12521
12522 @item min-vect-loop-bound
12523 The minimum number of iterations under which loops are not vectorized
12524 when @option{-ftree-vectorize} is used. The number of iterations after
12525 vectorization needs to be greater than the value specified by this option
12526 to allow vectorization.
12527
12528 @item gcse-cost-distance-ratio
12529 Scaling factor in calculation of maximum distance an expression
12530 can be moved by GCSE optimizations. This is currently supported only in the
12531 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
12532 is with simple expressions, i.e., the expressions that have cost
12533 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
12534 hoisting of simple expressions.
12535
12536 @item gcse-unrestricted-cost
12537 Cost, roughly measured as the cost of a single typical machine
12538 instruction, at which GCSE optimizations do not constrain
12539 the distance an expression can travel. This is currently
12540 supported only in the code hoisting pass. The lesser the cost,
12541 the more aggressive code hoisting is. Specifying 0
12542 allows all expressions to travel unrestricted distances.
12543
12544 @item max-hoist-depth
12545 The depth of search in the dominator tree for expressions to hoist.
12546 This is used to avoid quadratic behavior in hoisting algorithm.
12547 The value of 0 does not limit on the search, but may slow down compilation
12548 of huge functions.
12549
12550 @item max-tail-merge-comparisons
12551 The maximum amount of similar bbs to compare a bb with. This is used to
12552 avoid quadratic behavior in tree tail merging.
12553
12554 @item max-tail-merge-iterations
12555 The maximum amount of iterations of the pass over the function. This is used to
12556 limit compilation time in tree tail merging.
12557
12558 @item store-merging-allow-unaligned
12559 Allow the store merging pass to introduce unaligned stores if it is legal to
12560 do so.
12561
12562 @item max-stores-to-merge
12563 The maximum number of stores to attempt to merge into wider stores in the store
12564 merging pass.
12565
12566 @item max-unrolled-insns
12567 The maximum number of instructions that a loop may have to be unrolled.
12568 If a loop is unrolled, this parameter also determines how many times
12569 the loop code is unrolled.
12570
12571 @item max-average-unrolled-insns
12572 The maximum number of instructions biased by probabilities of their execution
12573 that a loop may have to be unrolled. If a loop is unrolled,
12574 this parameter also determines how many times the loop code is unrolled.
12575
12576 @item max-unroll-times
12577 The maximum number of unrollings of a single loop.
12578
12579 @item max-peeled-insns
12580 The maximum number of instructions that a loop may have to be peeled.
12581 If a loop is peeled, this parameter also determines how many times
12582 the loop code is peeled.
12583
12584 @item max-peel-times
12585 The maximum number of peelings of a single loop.
12586
12587 @item max-peel-branches
12588 The maximum number of branches on the hot path through the peeled sequence.
12589
12590 @item max-completely-peeled-insns
12591 The maximum number of insns of a completely peeled loop.
12592
12593 @item max-completely-peel-times
12594 The maximum number of iterations of a loop to be suitable for complete peeling.
12595
12596 @item max-completely-peel-loop-nest-depth
12597 The maximum depth of a loop nest suitable for complete peeling.
12598
12599 @item max-unswitch-insns
12600 The maximum number of insns of an unswitched loop.
12601
12602 @item max-unswitch-level
12603 The maximum number of branches unswitched in a single loop.
12604
12605 @item lim-expensive
12606 The minimum cost of an expensive expression in the loop invariant motion.
12607
12608 @item min-loop-cond-split-prob
12609 When FDO profile information is available, @option{min-loop-cond-split-prob}
12610 specifies minimum threshold for probability of semi-invariant condition
12611 statement to trigger loop split.
12612
12613 @item iv-consider-all-candidates-bound
12614 Bound on number of candidates for induction variables, below which
12615 all candidates are considered for each use in induction variable
12616 optimizations. If there are more candidates than this,
12617 only the most relevant ones are considered to avoid quadratic time complexity.
12618
12619 @item iv-max-considered-uses
12620 The induction variable optimizations give up on loops that contain more
12621 induction variable uses.
12622
12623 @item iv-always-prune-cand-set-bound
12624 If the number of candidates in the set is smaller than this value,
12625 always try to remove unnecessary ivs from the set
12626 when adding a new one.
12627
12628 @item avg-loop-niter
12629 Average number of iterations of a loop.
12630
12631 @item dse-max-object-size
12632 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12633 Larger values may result in larger compilation times.
12634
12635 @item dse-max-alias-queries-per-store
12636 Maximum number of queries into the alias oracle per store.
12637 Larger values result in larger compilation times and may result in more
12638 removed dead stores.
12639
12640 @item scev-max-expr-size
12641 Bound on size of expressions used in the scalar evolutions analyzer.
12642 Large expressions slow the analyzer.
12643
12644 @item scev-max-expr-complexity
12645 Bound on the complexity of the expressions in the scalar evolutions analyzer.
12646 Complex expressions slow the analyzer.
12647
12648 @item max-tree-if-conversion-phi-args
12649 Maximum number of arguments in a PHI supported by TREE if conversion
12650 unless the loop is marked with simd pragma.
12651
12652 @item vect-max-version-for-alignment-checks
12653 The maximum number of run-time checks that can be performed when
12654 doing loop versioning for alignment in the vectorizer.
12655
12656 @item vect-max-version-for-alias-checks
12657 The maximum number of run-time checks that can be performed when
12658 doing loop versioning for alias in the vectorizer.
12659
12660 @item vect-max-peeling-for-alignment
12661 The maximum number of loop peels to enhance access alignment
12662 for vectorizer. Value -1 means no limit.
12663
12664 @item max-iterations-to-track
12665 The maximum number of iterations of a loop the brute-force algorithm
12666 for analysis of the number of iterations of the loop tries to evaluate.
12667
12668 @item hot-bb-count-fraction
12669 The denominator n of fraction 1/n of the maximal execution count of a
12670 basic block in the entire program that a basic block needs to at least
12671 have in order to be considered hot. The default is 10000, which means
12672 that a basic block is considered hot if its execution count is greater
12673 than 1/10000 of the maximal execution count. 0 means that it is never
12674 considered hot. Used in non-LTO mode.
12675
12676 @item hot-bb-count-ws-permille
12677 The number of most executed permilles, ranging from 0 to 1000, of the
12678 profiled execution of the entire program to which the execution count
12679 of a basic block must be part of in order to be considered hot. The
12680 default is 990, which means that a basic block is considered hot if
12681 its execution count contributes to the upper 990 permilles, or 99.0%,
12682 of the profiled execution of the entire program. 0 means that it is
12683 never considered hot. Used in LTO mode.
12684
12685 @item hot-bb-frequency-fraction
12686 The denominator n of fraction 1/n of the execution frequency of the
12687 entry block of a function that a basic block of this function needs
12688 to at least have in order to be considered hot. The default is 1000,
12689 which means that a basic block is considered hot in a function if it
12690 is executed more frequently than 1/1000 of the frequency of the entry
12691 block of the function. 0 means that it is never considered hot.
12692
12693 @item unlikely-bb-count-fraction
12694 The denominator n of fraction 1/n of the number of profiled runs of
12695 the entire program below which the execution count of a basic block
12696 must be in order for the basic block to be considered unlikely executed.
12697 The default is 20, which means that a basic block is considered unlikely
12698 executed if it is executed in fewer than 1/20, or 5%, of the runs of
12699 the program. 0 means that it is always considered unlikely executed.
12700
12701 @item max-predicted-iterations
12702 The maximum number of loop iterations we predict statically. This is useful
12703 in cases where a function contains a single loop with known bound and
12704 another loop with unknown bound.
12705 The known number of iterations is predicted correctly, while
12706 the unknown number of iterations average to roughly 10. This means that the
12707 loop without bounds appears artificially cold relative to the other one.
12708
12709 @item builtin-expect-probability
12710 Control the probability of the expression having the specified value. This
12711 parameter takes a percentage (i.e.@: 0 ... 100) as input.
12712
12713 @item builtin-string-cmp-inline-length
12714 The maximum length of a constant string for a builtin string cmp call
12715 eligible for inlining.
12716
12717 @item align-threshold
12718
12719 Select fraction of the maximal frequency of executions of a basic block in
12720 a function to align the basic block.
12721
12722 @item align-loop-iterations
12723
12724 A loop expected to iterate at least the selected number of iterations is
12725 aligned.
12726
12727 @item tracer-dynamic-coverage
12728 @itemx tracer-dynamic-coverage-feedback
12729
12730 This value is used to limit superblock formation once the given percentage of
12731 executed instructions is covered. This limits unnecessary code size
12732 expansion.
12733
12734 The @option{tracer-dynamic-coverage-feedback} parameter
12735 is used only when profile
12736 feedback is available. The real profiles (as opposed to statically estimated
12737 ones) are much less balanced allowing the threshold to be larger value.
12738
12739 @item tracer-max-code-growth
12740 Stop tail duplication once code growth has reached given percentage. This is
12741 a rather artificial limit, as most of the duplicates are eliminated later in
12742 cross jumping, so it may be set to much higher values than is the desired code
12743 growth.
12744
12745 @item tracer-min-branch-ratio
12746
12747 Stop reverse growth when the reverse probability of best edge is less than this
12748 threshold (in percent).
12749
12750 @item tracer-min-branch-probability
12751 @itemx tracer-min-branch-probability-feedback
12752
12753 Stop forward growth if the best edge has probability lower than this
12754 threshold.
12755
12756 Similarly to @option{tracer-dynamic-coverage} two parameters are
12757 provided. @option{tracer-min-branch-probability-feedback} is used for
12758 compilation with profile feedback and @option{tracer-min-branch-probability}
12759 compilation without. The value for compilation with profile feedback
12760 needs to be more conservative (higher) in order to make tracer
12761 effective.
12762
12763 @item stack-clash-protection-guard-size
12764 Specify the size of the operating system provided stack guard as
12765 2 raised to @var{num} bytes. Higher values may reduce the
12766 number of explicit probes, but a value larger than the operating system
12767 provided guard will leave code vulnerable to stack clash style attacks.
12768
12769 @item stack-clash-protection-probe-interval
12770 Stack clash protection involves probing stack space as it is allocated. This
12771 param controls the maximum distance between probes into the stack as 2 raised
12772 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
12773 larger than the operating system provided guard will leave code vulnerable to
12774 stack clash style attacks.
12775
12776 @item max-cse-path-length
12777
12778 The maximum number of basic blocks on path that CSE considers.
12779
12780 @item max-cse-insns
12781 The maximum number of instructions CSE processes before flushing.
12782
12783 @item ggc-min-expand
12784
12785 GCC uses a garbage collector to manage its own memory allocation. This
12786 parameter specifies the minimum percentage by which the garbage
12787 collector's heap should be allowed to expand between collections.
12788 Tuning this may improve compilation speed; it has no effect on code
12789 generation.
12790
12791 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12792 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
12793 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
12794 GCC is not able to calculate RAM on a particular platform, the lower
12795 bound of 30% is used. Setting this parameter and
12796 @option{ggc-min-heapsize} to zero causes a full collection to occur at
12797 every opportunity. This is extremely slow, but can be useful for
12798 debugging.
12799
12800 @item ggc-min-heapsize
12801
12802 Minimum size of the garbage collector's heap before it begins bothering
12803 to collect garbage. The first collection occurs after the heap expands
12804 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
12805 tuning this may improve compilation speed, and has no effect on code
12806 generation.
12807
12808 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12809 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12810 with a lower bound of 4096 (four megabytes) and an upper bound of
12811 131072 (128 megabytes). If GCC is not able to calculate RAM on a
12812 particular platform, the lower bound is used. Setting this parameter
12813 very large effectively disables garbage collection. Setting this
12814 parameter and @option{ggc-min-expand} to zero causes a full collection
12815 to occur at every opportunity.
12816
12817 @item max-reload-search-insns
12818 The maximum number of instruction reload should look backward for equivalent
12819 register. Increasing values mean more aggressive optimization, making the
12820 compilation time increase with probably slightly better performance.
12821
12822 @item max-cselib-memory-locations
12823 The maximum number of memory locations cselib should take into account.
12824 Increasing values mean more aggressive optimization, making the compilation time
12825 increase with probably slightly better performance.
12826
12827 @item max-sched-ready-insns
12828 The maximum number of instructions ready to be issued the scheduler should
12829 consider at any given time during the first scheduling pass. Increasing
12830 values mean more thorough searches, making the compilation time increase
12831 with probably little benefit.
12832
12833 @item max-sched-region-blocks
12834 The maximum number of blocks in a region to be considered for
12835 interblock scheduling.
12836
12837 @item max-pipeline-region-blocks
12838 The maximum number of blocks in a region to be considered for
12839 pipelining in the selective scheduler.
12840
12841 @item max-sched-region-insns
12842 The maximum number of insns in a region to be considered for
12843 interblock scheduling.
12844
12845 @item max-pipeline-region-insns
12846 The maximum number of insns in a region to be considered for
12847 pipelining in the selective scheduler.
12848
12849 @item min-spec-prob
12850 The minimum probability (in percents) of reaching a source block
12851 for interblock speculative scheduling.
12852
12853 @item max-sched-extend-regions-iters
12854 The maximum number of iterations through CFG to extend regions.
12855 A value of 0 disables region extensions.
12856
12857 @item max-sched-insn-conflict-delay
12858 The maximum conflict delay for an insn to be considered for speculative motion.
12859
12860 @item sched-spec-prob-cutoff
12861 The minimal probability of speculation success (in percents), so that
12862 speculative insns are scheduled.
12863
12864 @item sched-state-edge-prob-cutoff
12865 The minimum probability an edge must have for the scheduler to save its
12866 state across it.
12867
12868 @item sched-mem-true-dep-cost
12869 Minimal distance (in CPU cycles) between store and load targeting same
12870 memory locations.
12871
12872 @item selsched-max-lookahead
12873 The maximum size of the lookahead window of selective scheduling. It is a
12874 depth of search for available instructions.
12875
12876 @item selsched-max-sched-times
12877 The maximum number of times that an instruction is scheduled during
12878 selective scheduling. This is the limit on the number of iterations
12879 through which the instruction may be pipelined.
12880
12881 @item selsched-insns-to-rename
12882 The maximum number of best instructions in the ready list that are considered
12883 for renaming in the selective scheduler.
12884
12885 @item sms-min-sc
12886 The minimum value of stage count that swing modulo scheduler
12887 generates.
12888
12889 @item max-last-value-rtl
12890 The maximum size measured as number of RTLs that can be recorded in an expression
12891 in combiner for a pseudo register as last known value of that register.
12892
12893 @item max-combine-insns
12894 The maximum number of instructions the RTL combiner tries to combine.
12895
12896 @item integer-share-limit
12897 Small integer constants can use a shared data structure, reducing the
12898 compiler's memory usage and increasing its speed. This sets the maximum
12899 value of a shared integer constant.
12900
12901 @item ssp-buffer-size
12902 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
12903 protection when @option{-fstack-protection} is used.
12904
12905 @item min-size-for-stack-sharing
12906 The minimum size of variables taking part in stack slot sharing when not
12907 optimizing.
12908
12909 @item max-jump-thread-duplication-stmts
12910 Maximum number of statements allowed in a block that needs to be
12911 duplicated when threading jumps.
12912
12913 @item max-fields-for-field-sensitive
12914 Maximum number of fields in a structure treated in
12915 a field sensitive manner during pointer analysis.
12916
12917 @item prefetch-latency
12918 Estimate on average number of instructions that are executed before
12919 prefetch finishes. The distance prefetched ahead is proportional
12920 to this constant. Increasing this number may also lead to less
12921 streams being prefetched (see @option{simultaneous-prefetches}).
12922
12923 @item simultaneous-prefetches
12924 Maximum number of prefetches that can run at the same time.
12925
12926 @item l1-cache-line-size
12927 The size of cache line in L1 data cache, in bytes.
12928
12929 @item l1-cache-size
12930 The size of L1 data cache, in kilobytes.
12931
12932 @item l2-cache-size
12933 The size of L2 data cache, in kilobytes.
12934
12935 @item prefetch-dynamic-strides
12936 Whether the loop array prefetch pass should issue software prefetch hints
12937 for strides that are non-constant. In some cases this may be
12938 beneficial, though the fact the stride is non-constant may make it
12939 hard to predict when there is clear benefit to issuing these hints.
12940
12941 Set to 1 if the prefetch hints should be issued for non-constant
12942 strides. Set to 0 if prefetch hints should be issued only for strides that
12943 are known to be constant and below @option{prefetch-minimum-stride}.
12944
12945 @item prefetch-minimum-stride
12946 Minimum constant stride, in bytes, to start using prefetch hints for. If
12947 the stride is less than this threshold, prefetch hints will not be issued.
12948
12949 This setting is useful for processors that have hardware prefetchers, in
12950 which case there may be conflicts between the hardware prefetchers and
12951 the software prefetchers. If the hardware prefetchers have a maximum
12952 stride they can handle, it should be used here to improve the use of
12953 software prefetchers.
12954
12955 A value of -1 means we don't have a threshold and therefore
12956 prefetch hints can be issued for any constant stride.
12957
12958 This setting is only useful for strides that are known and constant.
12959
12960 @item loop-interchange-max-num-stmts
12961 The maximum number of stmts in a loop to be interchanged.
12962
12963 @item loop-interchange-stride-ratio
12964 The minimum ratio between stride of two loops for interchange to be profitable.
12965
12966 @item min-insn-to-prefetch-ratio
12967 The minimum ratio between the number of instructions and the
12968 number of prefetches to enable prefetching in a loop.
12969
12970 @item prefetch-min-insn-to-mem-ratio
12971 The minimum ratio between the number of instructions and the
12972 number of memory references to enable prefetching in a loop.
12973
12974 @item use-canonical-types
12975 Whether the compiler should use the ``canonical'' type system.
12976 Should always be 1, which uses a more efficient internal
12977 mechanism for comparing types in C++ and Objective-C++. However, if
12978 bugs in the canonical type system are causing compilation failures,
12979 set this value to 0 to disable canonical types.
12980
12981 @item switch-conversion-max-branch-ratio
12982 Switch initialization conversion refuses to create arrays that are
12983 bigger than @option{switch-conversion-max-branch-ratio} times the number of
12984 branches in the switch.
12985
12986 @item max-partial-antic-length
12987 Maximum length of the partial antic set computed during the tree
12988 partial redundancy elimination optimization (@option{-ftree-pre}) when
12989 optimizing at @option{-O3} and above. For some sorts of source code
12990 the enhanced partial redundancy elimination optimization can run away,
12991 consuming all of the memory available on the host machine. This
12992 parameter sets a limit on the length of the sets that are computed,
12993 which prevents the runaway behavior. Setting a value of 0 for
12994 this parameter allows an unlimited set length.
12995
12996 @item rpo-vn-max-loop-depth
12997 Maximum loop depth that is value-numbered optimistically.
12998 When the limit hits the innermost
12999 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
13000 loop nest are value-numbered optimistically and the remaining ones not.
13001
13002 @item sccvn-max-alias-queries-per-access
13003 Maximum number of alias-oracle queries we perform when looking for
13004 redundancies for loads and stores. If this limit is hit the search
13005 is aborted and the load or store is not considered redundant. The
13006 number of queries is algorithmically limited to the number of
13007 stores on all paths from the load to the function entry.
13008
13009 @item ira-max-loops-num
13010 IRA uses regional register allocation by default. If a function
13011 contains more loops than the number given by this parameter, only at most
13012 the given number of the most frequently-executed loops form regions
13013 for regional register allocation.
13014
13015 @item ira-max-conflict-table-size
13016 Although IRA uses a sophisticated algorithm to compress the conflict
13017 table, the table can still require excessive amounts of memory for
13018 huge functions. If the conflict table for a function could be more
13019 than the size in MB given by this parameter, the register allocator
13020 instead uses a faster, simpler, and lower-quality
13021 algorithm that does not require building a pseudo-register conflict table.
13022
13023 @item ira-loop-reserved-regs
13024 IRA can be used to evaluate more accurate register pressure in loops
13025 for decisions to move loop invariants (see @option{-O3}). The number
13026 of available registers reserved for some other purposes is given
13027 by this parameter. Default of the parameter
13028 is the best found from numerous experiments.
13029
13030 @item lra-inheritance-ebb-probability-cutoff
13031 LRA tries to reuse values reloaded in registers in subsequent insns.
13032 This optimization is called inheritance. EBB is used as a region to
13033 do this optimization. The parameter defines a minimal fall-through
13034 edge probability in percentage used to add BB to inheritance EBB in
13035 LRA. The default value was chosen
13036 from numerous runs of SPEC2000 on x86-64.
13037
13038 @item loop-invariant-max-bbs-in-loop
13039 Loop invariant motion can be very expensive, both in compilation time and
13040 in amount of needed compile-time memory, with very large loops. Loops
13041 with more basic blocks than this parameter won't have loop invariant
13042 motion optimization performed on them.
13043
13044 @item loop-max-datarefs-for-datadeps
13045 Building data dependencies is expensive for very large loops. This
13046 parameter limits the number of data references in loops that are
13047 considered for data dependence analysis. These large loops are no
13048 handled by the optimizations using loop data dependencies.
13049
13050 @item max-vartrack-size
13051 Sets a maximum number of hash table slots to use during variable
13052 tracking dataflow analysis of any function. If this limit is exceeded
13053 with variable tracking at assignments enabled, analysis for that
13054 function is retried without it, after removing all debug insns from
13055 the function. If the limit is exceeded even without debug insns, var
13056 tracking analysis is completely disabled for the function. Setting
13057 the parameter to zero makes it unlimited.
13058
13059 @item max-vartrack-expr-depth
13060 Sets a maximum number of recursion levels when attempting to map
13061 variable names or debug temporaries to value expressions. This trades
13062 compilation time for more complete debug information. If this is set too
13063 low, value expressions that are available and could be represented in
13064 debug information may end up not being used; setting this higher may
13065 enable the compiler to find more complex debug expressions, but compile
13066 time and memory use may grow.
13067
13068 @item max-debug-marker-count
13069 Sets a threshold on the number of debug markers (e.g.@: begin stmt
13070 markers) to avoid complexity explosion at inlining or expanding to RTL.
13071 If a function has more such gimple stmts than the set limit, such stmts
13072 will be dropped from the inlined copy of a function, and from its RTL
13073 expansion.
13074
13075 @item min-nondebug-insn-uid
13076 Use uids starting at this parameter for nondebug insns. The range below
13077 the parameter is reserved exclusively for debug insns created by
13078 @option{-fvar-tracking-assignments}, but debug insns may get
13079 (non-overlapping) uids above it if the reserved range is exhausted.
13080
13081 @item ipa-sra-ptr-growth-factor
13082 IPA-SRA replaces a pointer to an aggregate with one or more new
13083 parameters only when their cumulative size is less or equal to
13084 @option{ipa-sra-ptr-growth-factor} times the size of the original
13085 pointer parameter.
13086
13087 @item ipa-sra-max-replacements
13088 Maximum pieces of an aggregate that IPA-SRA tracks. As a
13089 consequence, it is also the maximum number of replacements of a formal
13090 parameter.
13091
13092 @item sra-max-scalarization-size-Ospeed
13093 @itemx sra-max-scalarization-size-Osize
13094 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
13095 replace scalar parts of aggregates with uses of independent scalar
13096 variables. These parameters control the maximum size, in storage units,
13097 of aggregate which is considered for replacement when compiling for
13098 speed
13099 (@option{sra-max-scalarization-size-Ospeed}) or size
13100 (@option{sra-max-scalarization-size-Osize}) respectively.
13101
13102 @item sra-max-propagations
13103 The maximum number of artificial accesses that Scalar Replacement of
13104 Aggregates (SRA) will track, per one local variable, in order to
13105 facilitate copy propagation.
13106
13107 @item tm-max-aggregate-size
13108 When making copies of thread-local variables in a transaction, this
13109 parameter specifies the size in bytes after which variables are
13110 saved with the logging functions as opposed to save/restore code
13111 sequence pairs. This option only applies when using
13112 @option{-fgnu-tm}.
13113
13114 @item graphite-max-nb-scop-params
13115 To avoid exponential effects in the Graphite loop transforms, the
13116 number of parameters in a Static Control Part (SCoP) is bounded.
13117 A value of zero can be used to lift
13118 the bound. A variable whose value is unknown at compilation time and
13119 defined outside a SCoP is a parameter of the SCoP.
13120
13121 @item loop-block-tile-size
13122 Loop blocking or strip mining transforms, enabled with
13123 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
13124 loop in the loop nest by a given number of iterations. The strip
13125 length can be changed using the @option{loop-block-tile-size}
13126 parameter.
13127
13128 @item ipa-cp-value-list-size
13129 IPA-CP attempts to track all possible values and types passed to a function's
13130 parameter in order to propagate them and perform devirtualization.
13131 @option{ipa-cp-value-list-size} is the maximum number of values and types it
13132 stores per one formal parameter of a function.
13133
13134 @item ipa-cp-eval-threshold
13135 IPA-CP calculates its own score of cloning profitability heuristics
13136 and performs those cloning opportunities with scores that exceed
13137 @option{ipa-cp-eval-threshold}.
13138
13139 @item ipa-cp-max-recursive-depth
13140 Maximum depth of recursive cloning for self-recursive function.
13141
13142 @item ipa-cp-min-recursive-probability
13143 Recursive cloning only when the probability of call being executed exceeds
13144 the parameter.
13145
13146 @item ipa-cp-recursion-penalty
13147 Percentage penalty the recursive functions will receive when they
13148 are evaluated for cloning.
13149
13150 @item ipa-cp-single-call-penalty
13151 Percentage penalty functions containing a single call to another
13152 function will receive when they are evaluated for cloning.
13153
13154 @item ipa-max-agg-items
13155 IPA-CP is also capable to propagate a number of scalar values passed
13156 in an aggregate. @option{ipa-max-agg-items} controls the maximum
13157 number of such values per one parameter.
13158
13159 @item ipa-cp-loop-hint-bonus
13160 When IPA-CP determines that a cloning candidate would make the number
13161 of iterations of a loop known, it adds a bonus of
13162 @option{ipa-cp-loop-hint-bonus} to the profitability score of
13163 the candidate.
13164
13165 @item ipa-max-aa-steps
13166 During its analysis of function bodies, IPA-CP employs alias analysis
13167 in order to track values pointed to by function parameters. In order
13168 not spend too much time analyzing huge functions, it gives up and
13169 consider all memory clobbered after examining
13170 @option{ipa-max-aa-steps} statements modifying memory.
13171
13172 @item ipa-max-switch-predicate-bounds
13173 Maximal number of boundary endpoints of case ranges of switch statement.
13174 For switch exceeding this limit, IPA-CP will not construct cloning cost
13175 predicate, which is used to estimate cloning benefit, for default case
13176 of the switch statement.
13177
13178 @item ipa-max-param-expr-ops
13179 IPA-CP will analyze conditional statement that references some function
13180 parameter to estimate benefit for cloning upon certain constant value.
13181 But if number of operations in a parameter expression exceeds
13182 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
13183 one, and is not handled by IPA analysis.
13184
13185 @item lto-partitions
13186 Specify desired number of partitions produced during WHOPR compilation.
13187 The number of partitions should exceed the number of CPUs used for compilation.
13188
13189 @item lto-min-partition
13190 Size of minimal partition for WHOPR (in estimated instructions).
13191 This prevents expenses of splitting very small programs into too many
13192 partitions.
13193
13194 @item lto-max-partition
13195 Size of max partition for WHOPR (in estimated instructions).
13196 to provide an upper bound for individual size of partition.
13197 Meant to be used only with balanced partitioning.
13198
13199 @item lto-max-streaming-parallelism
13200 Maximal number of parallel processes used for LTO streaming.
13201
13202 @item cxx-max-namespaces-for-diagnostic-help
13203 The maximum number of namespaces to consult for suggestions when C++
13204 name lookup fails for an identifier.
13205
13206 @item sink-frequency-threshold
13207 The maximum relative execution frequency (in percents) of the target block
13208 relative to a statement's original block to allow statement sinking of a
13209 statement. Larger numbers result in more aggressive statement sinking.
13210 A small positive adjustment is applied for
13211 statements with memory operands as those are even more profitable so sink.
13212
13213 @item max-stores-to-sink
13214 The maximum number of conditional store pairs that can be sunk. Set to 0
13215 if either vectorization (@option{-ftree-vectorize}) or if-conversion
13216 (@option{-ftree-loop-if-convert}) is disabled.
13217
13218 @item case-values-threshold
13219 The smallest number of different values for which it is best to use a
13220 jump-table instead of a tree of conditional branches. If the value is
13221 0, use the default for the machine.
13222
13223 @item jump-table-max-growth-ratio-for-size
13224 The maximum code size growth ratio when expanding
13225 into a jump table (in percent). The parameter is used when
13226 optimizing for size.
13227
13228 @item jump-table-max-growth-ratio-for-speed
13229 The maximum code size growth ratio when expanding
13230 into a jump table (in percent). The parameter is used when
13231 optimizing for speed.
13232
13233 @item tree-reassoc-width
13234 Set the maximum number of instructions executed in parallel in
13235 reassociated tree. This parameter overrides target dependent
13236 heuristics used by default if has non zero value.
13237
13238 @item sched-pressure-algorithm
13239 Choose between the two available implementations of
13240 @option{-fsched-pressure}. Algorithm 1 is the original implementation
13241 and is the more likely to prevent instructions from being reordered.
13242 Algorithm 2 was designed to be a compromise between the relatively
13243 conservative approach taken by algorithm 1 and the rather aggressive
13244 approach taken by the default scheduler. It relies more heavily on
13245 having a regular register file and accurate register pressure classes.
13246 See @file{haifa-sched.c} in the GCC sources for more details.
13247
13248 The default choice depends on the target.
13249
13250 @item max-slsr-cand-scan
13251 Set the maximum number of existing candidates that are considered when
13252 seeking a basis for a new straight-line strength reduction candidate.
13253
13254 @item asan-globals
13255 Enable buffer overflow detection for global objects. This kind
13256 of protection is enabled by default if you are using
13257 @option{-fsanitize=address} option.
13258 To disable global objects protection use @option{--param asan-globals=0}.
13259
13260 @item asan-stack
13261 Enable buffer overflow detection for stack objects. This kind of
13262 protection is enabled by default when using @option{-fsanitize=address}.
13263 To disable stack protection use @option{--param asan-stack=0} option.
13264
13265 @item asan-instrument-reads
13266 Enable buffer overflow detection for memory reads. This kind of
13267 protection is enabled by default when using @option{-fsanitize=address}.
13268 To disable memory reads protection use
13269 @option{--param asan-instrument-reads=0}.
13270
13271 @item asan-instrument-writes
13272 Enable buffer overflow detection for memory writes. This kind of
13273 protection is enabled by default when using @option{-fsanitize=address}.
13274 To disable memory writes protection use
13275 @option{--param asan-instrument-writes=0} option.
13276
13277 @item asan-memintrin
13278 Enable detection for built-in functions. This kind of protection
13279 is enabled by default when using @option{-fsanitize=address}.
13280 To disable built-in functions protection use
13281 @option{--param asan-memintrin=0}.
13282
13283 @item asan-use-after-return
13284 Enable detection of use-after-return. This kind of protection
13285 is enabled by default when using the @option{-fsanitize=address} option.
13286 To disable it use @option{--param asan-use-after-return=0}.
13287
13288 Note: By default the check is disabled at run time. To enable it,
13289 add @code{detect_stack_use_after_return=1} to the environment variable
13290 @env{ASAN_OPTIONS}.
13291
13292 @item asan-instrumentation-with-call-threshold
13293 If number of memory accesses in function being instrumented
13294 is greater or equal to this number, use callbacks instead of inline checks.
13295 E.g. to disable inline code use
13296 @option{--param asan-instrumentation-with-call-threshold=0}.
13297
13298 @item use-after-scope-direct-emission-threshold
13299 If the size of a local variable in bytes is smaller or equal to this
13300 number, directly poison (or unpoison) shadow memory instead of using
13301 run-time callbacks.
13302
13303 @item max-fsm-thread-path-insns
13304 Maximum number of instructions to copy when duplicating blocks on a
13305 finite state automaton jump thread path.
13306
13307 @item max-fsm-thread-length
13308 Maximum number of basic blocks on a finite state automaton jump thread
13309 path.
13310
13311 @item max-fsm-thread-paths
13312 Maximum number of new jump thread paths to create for a finite state
13313 automaton.
13314
13315 @item parloops-chunk-size
13316 Chunk size of omp schedule for loops parallelized by parloops.
13317
13318 @item parloops-schedule
13319 Schedule type of omp schedule for loops parallelized by parloops (static,
13320 dynamic, guided, auto, runtime).
13321
13322 @item parloops-min-per-thread
13323 The minimum number of iterations per thread of an innermost parallelized
13324 loop for which the parallelized variant is preferred over the single threaded
13325 one. Note that for a parallelized loop nest the
13326 minimum number of iterations of the outermost loop per thread is two.
13327
13328 @item max-ssa-name-query-depth
13329 Maximum depth of recursion when querying properties of SSA names in things
13330 like fold routines. One level of recursion corresponds to following a
13331 use-def chain.
13332
13333 @item hsa-gen-debug-stores
13334 Enable emission of special debug stores within HSA kernels which are
13335 then read and reported by libgomp plugin. Generation of these stores
13336 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
13337 enable it.
13338
13339 @item max-speculative-devirt-maydefs
13340 The maximum number of may-defs we analyze when looking for a must-def
13341 specifying the dynamic type of an object that invokes a virtual call
13342 we may be able to devirtualize speculatively.
13343
13344 @item max-vrp-switch-assertions
13345 The maximum number of assertions to add along the default edge of a switch
13346 statement during VRP.
13347
13348 @item unroll-jam-min-percent
13349 The minimum percentage of memory references that must be optimized
13350 away for the unroll-and-jam transformation to be considered profitable.
13351
13352 @item unroll-jam-max-unroll
13353 The maximum number of times the outer loop should be unrolled by
13354 the unroll-and-jam transformation.
13355
13356 @item max-rtl-if-conversion-unpredictable-cost
13357 Maximum permissible cost for the sequence that would be generated
13358 by the RTL if-conversion pass for a branch that is considered unpredictable.
13359
13360 @item max-variable-expansions-in-unroller
13361 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
13362 of times that an individual variable will be expanded during loop unrolling.
13363
13364 @item tracer-min-branch-probability-feedback
13365 Stop forward growth if the probability of best edge is less than
13366 this threshold (in percent). Used when profile feedback is available.
13367
13368 @item partial-inlining-entry-probability
13369 Maximum probability of the entry BB of split region
13370 (in percent relative to entry BB of the function)
13371 to make partial inlining happen.
13372
13373 @item max-tracked-strlens
13374 Maximum number of strings for which strlen optimization pass will
13375 track string lengths.
13376
13377 @item gcse-after-reload-partial-fraction
13378 The threshold ratio for performing partial redundancy
13379 elimination after reload.
13380
13381 @item gcse-after-reload-critical-fraction
13382 The threshold ratio of critical edges execution count that
13383 permit performing redundancy elimination after reload.
13384
13385 @item max-loop-header-insns
13386 The maximum number of insns in loop header duplicated
13387 by the copy loop headers pass.
13388
13389 @item vect-epilogues-nomask
13390 Enable loop epilogue vectorization using smaller vector size.
13391
13392 @item slp-max-insns-in-bb
13393 Maximum number of instructions in basic block to be
13394 considered for SLP vectorization.
13395
13396 @item avoid-fma-max-bits
13397 Maximum number of bits for which we avoid creating FMAs.
13398
13399 @item sms-loop-average-count-threshold
13400 A threshold on the average loop count considered by the swing modulo scheduler.
13401
13402 @item sms-dfa-history
13403 The number of cycles the swing modulo scheduler considers when checking
13404 conflicts using DFA.
13405
13406 @item max-inline-insns-recursive-auto
13407 The maximum number of instructions non-inline function
13408 can grow to via recursive inlining.
13409
13410 @item graphite-allow-codegen-errors
13411 Whether codegen errors should be ICEs when @option{-fchecking}.
13412
13413 @item sms-max-ii-factor
13414 A factor for tuning the upper bound that swing modulo scheduler
13415 uses for scheduling a loop.
13416
13417 @item lra-max-considered-reload-pseudos
13418 The max number of reload pseudos which are considered during
13419 spilling a non-reload pseudo.
13420
13421 @item max-pow-sqrt-depth
13422 Maximum depth of sqrt chains to use when synthesizing exponentiation
13423 by a real constant.
13424
13425 @item max-dse-active-local-stores
13426 Maximum number of active local stores in RTL dead store elimination.
13427
13428 @item asan-instrument-allocas
13429 Enable asan allocas/VLAs protection.
13430
13431 @item max-iterations-computation-cost
13432 Bound on the cost of an expression to compute the number of iterations.
13433
13434 @item max-isl-operations
13435 Maximum number of isl operations, 0 means unlimited.
13436
13437 @item graphite-max-arrays-per-scop
13438 Maximum number of arrays per scop.
13439
13440 @item max-vartrack-reverse-op-size
13441 Max. size of loc list for which reverse ops should be added.
13442
13443 @item tracer-dynamic-coverage-feedback
13444 The percentage of function, weighted by execution frequency,
13445 that must be covered by trace formation.
13446 Used when profile feedback is available.
13447
13448 @item max-inline-recursive-depth-auto
13449 The maximum depth of recursive inlining for non-inline functions.
13450
13451 @item fsm-scale-path-stmts
13452 Scale factor to apply to the number of statements in a threading path
13453 when comparing to the number of (scaled) blocks.
13454
13455 @item fsm-maximum-phi-arguments
13456 Maximum number of arguments a PHI may have before the FSM threader
13457 will not try to thread through its block.
13458
13459 @item uninit-control-dep-attempts
13460 Maximum number of nested calls to search for control dependencies
13461 during uninitialized variable analysis.
13462
13463 @item sra-max-scalarization-size-Osize
13464 Maximum size, in storage units, of an aggregate
13465 which should be considered for scalarization when compiling for size.
13466
13467 @item fsm-scale-path-blocks
13468 Scale factor to apply to the number of blocks in a threading path
13469 when comparing to the number of (scaled) statements.
13470
13471 @item sched-autopref-queue-depth
13472 Hardware autoprefetcher scheduler model control flag.
13473 Number of lookahead cycles the model looks into; at '
13474 ' only enable instruction sorting heuristic.
13475
13476 @item loop-versioning-max-inner-insns
13477 The maximum number of instructions that an inner loop can have
13478 before the loop versioning pass considers it too big to copy.
13479
13480 @item loop-versioning-max-outer-insns
13481 The maximum number of instructions that an outer loop can have
13482 before the loop versioning pass considers it too big to copy,
13483 discounting any instructions in inner loops that directly benefit
13484 from versioning.
13485
13486 @item ssa-name-def-chain-limit
13487 The maximum number of SSA_NAME assignments to follow in determining
13488 a property of a variable such as its value. This limits the number
13489 of iterations or recursive calls GCC performs when optimizing certain
13490 statements or when determining their validity prior to issuing
13491 diagnostics.
13492
13493 @item store-merging-max-size
13494 Maximum size of a single store merging region in bytes.
13495
13496 @item hash-table-verification-limit
13497 The number of elements for which hash table verification is done
13498 for each searched element.
13499
13500 @item max-find-base-term-values
13501 Maximum number of VALUEs handled during a single find_base_term call.
13502
13503 @item analyzer-max-enodes-per-program-point
13504 The maximum number of exploded nodes per program point within
13505 the analyzer, before terminating analysis of that point.
13506
13507 @item analyzer-min-snodes-for-call-summary
13508 The minimum number of supernodes within a function for the
13509 analyzer to consider summarizing its effects at call sites.
13510
13511 @item analyzer-max-recursion-depth
13512 The maximum number of times a callsite can appear in a call stack
13513 within the analyzer, before terminating analysis of a call that would
13514 recurse deeper.
13515
13516 @item gimple-fe-computed-hot-bb-threshold
13517 The number of executions of a basic block which is considered hot.
13518 The parameter is used only in GIMPLE FE.
13519
13520 @item analyzer-bb-explosion-factor
13521 The maximum number of 'after supernode' exploded nodes within the analyzer
13522 per supernode, before terminating analysis.
13523
13524 @end table
13525
13526 The following choices of @var{name} are available on AArch64 targets:
13527
13528 @table @gcctabopt
13529 @item aarch64-sve-compare-costs
13530 When vectorizing for SVE, consider using ``unpacked'' vectors for
13531 smaller elements and use the cost model to pick the cheapest approach.
13532 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13533
13534 Using unpacked vectors includes storing smaller elements in larger
13535 containers and accessing elements with extending loads and truncating
13536 stores.
13537
13538 @item aarch64-float-recp-precision
13539 The number of Newton iterations for calculating the reciprocal for float type.
13540 The precision of division is proportional to this param when division
13541 approximation is enabled. The default value is 1.
13542
13543 @item aarch64-double-recp-precision
13544 The number of Newton iterations for calculating the reciprocal for double type.
13545 The precision of division is propotional to this param when division
13546 approximation is enabled. The default value is 2.
13547
13548 @end table
13549
13550 @end table
13551
13552 @node Instrumentation Options
13553 @section Program Instrumentation Options
13554 @cindex instrumentation options
13555 @cindex program instrumentation options
13556 @cindex run-time error checking options
13557 @cindex profiling options
13558 @cindex options, program instrumentation
13559 @cindex options, run-time error checking
13560 @cindex options, profiling
13561
13562 GCC supports a number of command-line options that control adding
13563 run-time instrumentation to the code it normally generates.
13564 For example, one purpose of instrumentation is collect profiling
13565 statistics for use in finding program hot spots, code coverage
13566 analysis, or profile-guided optimizations.
13567 Another class of program instrumentation is adding run-time checking
13568 to detect programming errors like invalid pointer
13569 dereferences or out-of-bounds array accesses, as well as deliberately
13570 hostile attacks such as stack smashing or C++ vtable hijacking.
13571 There is also a general hook which can be used to implement other
13572 forms of tracing or function-level instrumentation for debug or
13573 program analysis purposes.
13574
13575 @table @gcctabopt
13576 @cindex @command{prof}
13577 @cindex @command{gprof}
13578 @item -p
13579 @itemx -pg
13580 @opindex p
13581 @opindex pg
13582 Generate extra code to write profile information suitable for the
13583 analysis program @command{prof} (for @option{-p}) or @command{gprof}
13584 (for @option{-pg}). You must use this option when compiling
13585 the source files you want data about, and you must also use it when
13586 linking.
13587
13588 You can use the function attribute @code{no_instrument_function} to
13589 suppress profiling of individual functions when compiling with these options.
13590 @xref{Common Function Attributes}.
13591
13592 @item -fprofile-arcs
13593 @opindex fprofile-arcs
13594 Add code so that program flow @dfn{arcs} are instrumented. During
13595 execution the program records how many times each branch and call is
13596 executed and how many times it is taken or returns. On targets that support
13597 constructors with priority support, profiling properly handles constructors,
13598 destructors and C++ constructors (and destructors) of classes which are used
13599 as a type of a global variable.
13600
13601 When the compiled
13602 program exits it saves this data to a file called
13603 @file{@var{auxname}.gcda} for each source file. The data may be used for
13604 profile-directed optimizations (@option{-fbranch-probabilities}), or for
13605 test coverage analysis (@option{-ftest-coverage}). Each object file's
13606 @var{auxname} is generated from the name of the output file, if
13607 explicitly specified and it is not the final executable, otherwise it is
13608 the basename of the source file. In both cases any suffix is removed
13609 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13610 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13611 @xref{Cross-profiling}.
13612
13613 @cindex @command{gcov}
13614 @item --coverage
13615 @opindex coverage
13616
13617 This option is used to compile and link code instrumented for coverage
13618 analysis. The option is a synonym for @option{-fprofile-arcs}
13619 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13620 linking). See the documentation for those options for more details.
13621
13622 @itemize
13623
13624 @item
13625 Compile the source files with @option{-fprofile-arcs} plus optimization
13626 and code generation options. For test coverage analysis, use the
13627 additional @option{-ftest-coverage} option. You do not need to profile
13628 every source file in a program.
13629
13630 @item
13631 Compile the source files additionally with @option{-fprofile-abs-path}
13632 to create absolute path names in the @file{.gcno} files. This allows
13633 @command{gcov} to find the correct sources in projects where compilations
13634 occur with different working directories.
13635
13636 @item
13637 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13638 (the latter implies the former).
13639
13640 @item
13641 Run the program on a representative workload to generate the arc profile
13642 information. This may be repeated any number of times. You can run
13643 concurrent instances of your program, and provided that the file system
13644 supports locking, the data files will be correctly updated. Unless
13645 a strict ISO C dialect option is in effect, @code{fork} calls are
13646 detected and correctly handled without double counting.
13647
13648 @item
13649 For profile-directed optimizations, compile the source files again with
13650 the same optimization and code generation options plus
13651 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13652 Control Optimization}).
13653
13654 @item
13655 For test coverage analysis, use @command{gcov} to produce human readable
13656 information from the @file{.gcno} and @file{.gcda} files. Refer to the
13657 @command{gcov} documentation for further information.
13658
13659 @end itemize
13660
13661 With @option{-fprofile-arcs}, for each function of your program GCC
13662 creates a program flow graph, then finds a spanning tree for the graph.
13663 Only arcs that are not on the spanning tree have to be instrumented: the
13664 compiler adds code to count the number of times that these arcs are
13665 executed. When an arc is the only exit or only entrance to a block, the
13666 instrumentation code can be added to the block; otherwise, a new basic
13667 block must be created to hold the instrumentation code.
13668
13669 @need 2000
13670 @item -ftest-coverage
13671 @opindex ftest-coverage
13672 Produce a notes file that the @command{gcov} code-coverage utility
13673 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13674 show program coverage. Each source file's note file is called
13675 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
13676 above for a description of @var{auxname} and instructions on how to
13677 generate test coverage data. Coverage data matches the source files
13678 more closely if you do not optimize.
13679
13680 @item -fprofile-abs-path
13681 @opindex fprofile-abs-path
13682 Automatically convert relative source file names to absolute path names
13683 in the @file{.gcno} files. This allows @command{gcov} to find the correct
13684 sources in projects where compilations occur with different working
13685 directories.
13686
13687 @item -fprofile-dir=@var{path}
13688 @opindex fprofile-dir
13689
13690 Set the directory to search for the profile data files in to @var{path}.
13691 This option affects only the profile data generated by
13692 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13693 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13694 and its related options. Both absolute and relative paths can be used.
13695 By default, GCC uses the current directory as @var{path}, thus the
13696 profile data file appears in the same directory as the object file.
13697 In order to prevent the file name clashing, if the object file name is
13698 not an absolute path, we mangle the absolute path of the
13699 @file{@var{sourcename}.gcda} file and use it as the file name of a
13700 @file{.gcda} file. See similar option @option{-fprofile-note}.
13701
13702 When an executable is run in a massive parallel environment, it is recommended
13703 to save profile to different folders. That can be done with variables
13704 in @var{path} that are exported during run-time:
13705
13706 @table @gcctabopt
13707
13708 @item %p
13709 process ID.
13710
13711 @item %q@{VAR@}
13712 value of environment variable @var{VAR}
13713
13714 @end table
13715
13716 @item -fprofile-generate
13717 @itemx -fprofile-generate=@var{path}
13718 @opindex fprofile-generate
13719
13720 Enable options usually used for instrumenting application to produce
13721 profile useful for later recompilation with profile feedback based
13722 optimization. You must use @option{-fprofile-generate} both when
13723 compiling and when linking your program.
13724
13725 The following options are enabled:
13726 @option{-fprofile-arcs}, @option{-fprofile-values},
13727 @option{-finline-functions}, and @option{-fipa-bit-cp}.
13728
13729 If @var{path} is specified, GCC looks at the @var{path} to find
13730 the profile feedback data files. See @option{-fprofile-dir}.
13731
13732 To optimize the program based on the collected profile information, use
13733 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
13734
13735 @item -fprofile-note=@var{path}
13736 @opindex fprofile-note
13737
13738 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13739 location. If you combine the option with multiple source files,
13740 the @file{.gcno} file will be overwritten.
13741
13742 @item -fprofile-prefix-path=@var{path}
13743 @opindex fprofile-prefix-path
13744
13745 This option can be used in combination with
13746 @option{profile-generate=}@var{profile_dir} and
13747 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
13748 directory of built source tree. By default @var{profile_dir} will contain
13749 files with mangled absolute paths of all object files in the built project.
13750 This is not desirable when directory used to build the instrumented binary
13751 differs from the directory used to build the binary optimized with profile
13752 feedback because the profile data will not be found during the optimized build.
13753 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
13754 pointing to the base directory of the build can be used to strip the irrelevant
13755 part of the path and keep all file names relative to the main build directory.
13756
13757 @item -fprofile-update=@var{method}
13758 @opindex fprofile-update
13759
13760 Alter the update method for an application instrumented for profile
13761 feedback based optimization. The @var{method} argument should be one of
13762 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13763 The first one is useful for single-threaded applications,
13764 while the second one prevents profile corruption by emitting thread-safe code.
13765
13766 @strong{Warning:} When an application does not properly join all threads
13767 (or creates an detached thread), a profile file can be still corrupted.
13768
13769 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13770 when supported by a target, or to @samp{single} otherwise. The GCC driver
13771 automatically selects @samp{prefer-atomic} when @option{-pthread}
13772 is present in the command line.
13773
13774 @item -fprofile-filter-files=@var{regex}
13775 @opindex fprofile-filter-files
13776
13777 Instrument only functions from files where names match
13778 any regular expression (separated by a semi-colon).
13779
13780 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
13781 only @file{main.c} and all C files starting with 'module'.
13782
13783 @item -fprofile-exclude-files=@var{regex}
13784 @opindex fprofile-exclude-files
13785
13786 Instrument only functions from files where names do not match
13787 all the regular expressions (separated by a semi-colon).
13788
13789 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
13790 of all files that are located in @file{/usr/} folder.
13791
13792 @item -fprofile-reproducible
13793 @opindex fprofile-reproducible
13794 Control level of reproducibility of profile gathered by
13795 @code{-fprofile-generate}. This makes it possible to rebuild program
13796 with same outcome which is useful, for example, for distribution
13797 packages.
13798
13799 With @option{-fprofile-reproducibility=serial} the profile gathered by
13800 @option{-fprofile-generate} is reproducible provided the trained program
13801 behaves the same at each invocation of the train run, it is not
13802 multi-threaded and profile data streaming is always done in the same
13803 order. Note that profile streaming happens at the end of program run but
13804 also before @code{fork} function is invoked.
13805
13806 Note that it is quite common that execution counts of some part of
13807 programs depends, for example, on length of temporary file names or
13808 memory space randomization (that may affect hash-table collision rate).
13809 Such non-reproducible part of programs may be annotated by
13810 @code{no_instrument_function} function attribute. @code{gcov-dump} with
13811 @option{-l} can be used to dump gathered data and verify that they are
13812 indeed reproducible.
13813
13814 With @option{-fprofile-reproducibility=parallel-runs} collected profile
13815 stays reproducible regardless the order of streaming of the data into
13816 gcda files. This setting makes it possible to run multiple instances of
13817 instrumented program in parallel (such as with @code{make -j}). This
13818 reduces quality of gathered data, in particular of indirect call
13819 profiling.
13820
13821 @item -fsanitize=address
13822 @opindex fsanitize=address
13823 Enable AddressSanitizer, a fast memory error detector.
13824 Memory access instructions are instrumented to detect
13825 out-of-bounds and use-after-free bugs.
13826 The option enables @option{-fsanitize-address-use-after-scope}.
13827 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13828 more details. The run-time behavior can be influenced using the
13829 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
13830 the available options are shown at startup of the instrumented program. See
13831 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13832 for a list of supported options.
13833 The option cannot be combined with @option{-fsanitize=thread}.
13834
13835 @item -fsanitize=kernel-address
13836 @opindex fsanitize=kernel-address
13837 Enable AddressSanitizer for Linux kernel.
13838 See @uref{https://github.com/google/kasan/wiki} for more details.
13839
13840 @item -fsanitize=pointer-compare
13841 @opindex fsanitize=pointer-compare
13842 Instrument comparison operation (<, <=, >, >=) with pointer operands.
13843 The option must be combined with either @option{-fsanitize=kernel-address} or
13844 @option{-fsanitize=address}
13845 The option cannot be combined with @option{-fsanitize=thread}.
13846 Note: By default the check is disabled at run time. To enable it,
13847 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13848 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13849 invalid operation only when both pointers are non-null.
13850
13851 @item -fsanitize=pointer-subtract
13852 @opindex fsanitize=pointer-subtract
13853 Instrument subtraction with pointer operands.
13854 The option must be combined with either @option{-fsanitize=kernel-address} or
13855 @option{-fsanitize=address}
13856 The option cannot be combined with @option{-fsanitize=thread}.
13857 Note: By default the check is disabled at run time. To enable it,
13858 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13859 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13860 invalid operation only when both pointers are non-null.
13861
13862 @item -fsanitize=thread
13863 @opindex fsanitize=thread
13864 Enable ThreadSanitizer, a fast data race detector.
13865 Memory access instructions are instrumented to detect
13866 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13867 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13868 environment variable; see
13869 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13870 supported options.
13871 The option cannot be combined with @option{-fsanitize=address},
13872 @option{-fsanitize=leak}.
13873
13874 Note that sanitized atomic builtins cannot throw exceptions when
13875 operating on invalid memory addresses with non-call exceptions
13876 (@option{-fnon-call-exceptions}).
13877
13878 @item -fsanitize=leak
13879 @opindex fsanitize=leak
13880 Enable LeakSanitizer, a memory leak detector.
13881 This option only matters for linking of executables and
13882 the executable is linked against a library that overrides @code{malloc}
13883 and other allocator functions. See
13884 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13885 details. The run-time behavior can be influenced using the
13886 @env{LSAN_OPTIONS} environment variable.
13887 The option cannot be combined with @option{-fsanitize=thread}.
13888
13889 @item -fsanitize=undefined
13890 @opindex fsanitize=undefined
13891 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
13892 Various computations are instrumented to detect undefined behavior
13893 at runtime. Current suboptions are:
13894
13895 @table @gcctabopt
13896
13897 @item -fsanitize=shift
13898 @opindex fsanitize=shift
13899 This option enables checking that the result of a shift operation is
13900 not undefined. Note that what exactly is considered undefined differs
13901 slightly between C and C++, as well as between ISO C90 and C99, etc.
13902 This option has two suboptions, @option{-fsanitize=shift-base} and
13903 @option{-fsanitize=shift-exponent}.
13904
13905 @item -fsanitize=shift-exponent
13906 @opindex fsanitize=shift-exponent
13907 This option enables checking that the second argument of a shift operation
13908 is not negative and is smaller than the precision of the promoted first
13909 argument.
13910
13911 @item -fsanitize=shift-base
13912 @opindex fsanitize=shift-base
13913 If the second argument of a shift operation is within range, check that the
13914 result of a shift operation is not undefined. Note that what exactly is
13915 considered undefined differs slightly between C and C++, as well as between
13916 ISO C90 and C99, etc.
13917
13918 @item -fsanitize=integer-divide-by-zero
13919 @opindex fsanitize=integer-divide-by-zero
13920 Detect integer division by zero as well as @code{INT_MIN / -1} division.
13921
13922 @item -fsanitize=unreachable
13923 @opindex fsanitize=unreachable
13924 With this option, the compiler turns the @code{__builtin_unreachable}
13925 call into a diagnostics message call instead. When reaching the
13926 @code{__builtin_unreachable} call, the behavior is undefined.
13927
13928 @item -fsanitize=vla-bound
13929 @opindex fsanitize=vla-bound
13930 This option instructs the compiler to check that the size of a variable
13931 length array is positive.
13932
13933 @item -fsanitize=null
13934 @opindex fsanitize=null
13935 This option enables pointer checking. Particularly, the application
13936 built with this option turned on will issue an error message when it
13937 tries to dereference a NULL pointer, or if a reference (possibly an
13938 rvalue reference) is bound to a NULL pointer, or if a method is invoked
13939 on an object pointed by a NULL pointer.
13940
13941 @item -fsanitize=return
13942 @opindex fsanitize=return
13943 This option enables return statement checking. Programs
13944 built with this option turned on will issue an error message
13945 when the end of a non-void function is reached without actually
13946 returning a value. This option works in C++ only.
13947
13948 @item -fsanitize=signed-integer-overflow
13949 @opindex fsanitize=signed-integer-overflow
13950 This option enables signed integer overflow checking. We check that
13951 the result of @code{+}, @code{*}, and both unary and binary @code{-}
13952 does not overflow in the signed arithmetics. Note, integer promotion
13953 rules must be taken into account. That is, the following is not an
13954 overflow:
13955 @smallexample
13956 signed char a = SCHAR_MAX;
13957 a++;
13958 @end smallexample
13959
13960 @item -fsanitize=bounds
13961 @opindex fsanitize=bounds
13962 This option enables instrumentation of array bounds. Various out of bounds
13963 accesses are detected. Flexible array members, flexible array member-like
13964 arrays, and initializers of variables with static storage are not instrumented.
13965
13966 @item -fsanitize=bounds-strict
13967 @opindex fsanitize=bounds-strict
13968 This option enables strict instrumentation of array bounds. Most out of bounds
13969 accesses are detected, including flexible array members and flexible array
13970 member-like arrays. Initializers of variables with static storage are not
13971 instrumented.
13972
13973 @item -fsanitize=alignment
13974 @opindex fsanitize=alignment
13975
13976 This option enables checking of alignment of pointers when they are
13977 dereferenced, or when a reference is bound to insufficiently aligned target,
13978 or when a method or constructor is invoked on insufficiently aligned object.
13979
13980 @item -fsanitize=object-size
13981 @opindex fsanitize=object-size
13982 This option enables instrumentation of memory references using the
13983 @code{__builtin_object_size} function. Various out of bounds pointer
13984 accesses are detected.
13985
13986 @item -fsanitize=float-divide-by-zero
13987 @opindex fsanitize=float-divide-by-zero
13988 Detect floating-point division by zero. Unlike other similar options,
13989 @option{-fsanitize=float-divide-by-zero} is not enabled by
13990 @option{-fsanitize=undefined}, since floating-point division by zero can
13991 be a legitimate way of obtaining infinities and NaNs.
13992
13993 @item -fsanitize=float-cast-overflow
13994 @opindex fsanitize=float-cast-overflow
13995 This option enables floating-point type to integer conversion checking.
13996 We check that the result of the conversion does not overflow.
13997 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
13998 not enabled by @option{-fsanitize=undefined}.
13999 This option does not work well with @code{FE_INVALID} exceptions enabled.
14000
14001 @item -fsanitize=nonnull-attribute
14002 @opindex fsanitize=nonnull-attribute
14003
14004 This option enables instrumentation of calls, checking whether null values
14005 are not passed to arguments marked as requiring a non-null value by the
14006 @code{nonnull} function attribute.
14007
14008 @item -fsanitize=returns-nonnull-attribute
14009 @opindex fsanitize=returns-nonnull-attribute
14010
14011 This option enables instrumentation of return statements in functions
14012 marked with @code{returns_nonnull} function attribute, to detect returning
14013 of null values from such functions.
14014
14015 @item -fsanitize=bool
14016 @opindex fsanitize=bool
14017
14018 This option enables instrumentation of loads from bool. If a value other
14019 than 0/1 is loaded, a run-time error is issued.
14020
14021 @item -fsanitize=enum
14022 @opindex fsanitize=enum
14023
14024 This option enables instrumentation of loads from an enum type. If
14025 a value outside the range of values for the enum type is loaded,
14026 a run-time error is issued.
14027
14028 @item -fsanitize=vptr
14029 @opindex fsanitize=vptr
14030
14031 This option enables instrumentation of C++ member function calls, member
14032 accesses and some conversions between pointers to base and derived classes,
14033 to verify the referenced object has the correct dynamic type.
14034
14035 @item -fsanitize=pointer-overflow
14036 @opindex fsanitize=pointer-overflow
14037
14038 This option enables instrumentation of pointer arithmetics. If the pointer
14039 arithmetics overflows, a run-time error is issued.
14040
14041 @item -fsanitize=builtin
14042 @opindex fsanitize=builtin
14043
14044 This option enables instrumentation of arguments to selected builtin
14045 functions. If an invalid value is passed to such arguments, a run-time
14046 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
14047 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
14048 by this option.
14049
14050 @end table
14051
14052 While @option{-ftrapv} causes traps for signed overflows to be emitted,
14053 @option{-fsanitize=undefined} gives a diagnostic message.
14054 This currently works only for the C family of languages.
14055
14056 @item -fno-sanitize=all
14057 @opindex fno-sanitize=all
14058
14059 This option disables all previously enabled sanitizers.
14060 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
14061 together.
14062
14063 @item -fasan-shadow-offset=@var{number}
14064 @opindex fasan-shadow-offset
14065 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
14066 It is useful for experimenting with different shadow memory layouts in
14067 Kernel AddressSanitizer.
14068
14069 @item -fsanitize-sections=@var{s1},@var{s2},...
14070 @opindex fsanitize-sections
14071 Sanitize global variables in selected user-defined sections. @var{si} may
14072 contain wildcards.
14073
14074 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
14075 @opindex fsanitize-recover
14076 @opindex fno-sanitize-recover
14077 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
14078 mentioned in comma-separated list of @var{opts}. Enabling this option
14079 for a sanitizer component causes it to attempt to continue
14080 running the program as if no error happened. This means multiple
14081 runtime errors can be reported in a single program run, and the exit
14082 code of the program may indicate success even when errors
14083 have been reported. The @option{-fno-sanitize-recover=} option
14084 can be used to alter
14085 this behavior: only the first detected error is reported
14086 and program then exits with a non-zero exit code.
14087
14088 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
14089 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
14090 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
14091 @option{-fsanitize=bounds-strict},
14092 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
14093 For these sanitizers error recovery is turned on by default,
14094 except @option{-fsanitize=address}, for which this feature is experimental.
14095 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
14096 accepted, the former enables recovery for all sanitizers that support it,
14097 the latter disables recovery for all sanitizers that support it.
14098
14099 Even if a recovery mode is turned on the compiler side, it needs to be also
14100 enabled on the runtime library side, otherwise the failures are still fatal.
14101 The runtime library defaults to @code{halt_on_error=0} for
14102 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
14103 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
14104 setting the @code{halt_on_error} flag in the corresponding environment variable.
14105
14106 Syntax without an explicit @var{opts} parameter is deprecated. It is
14107 equivalent to specifying an @var{opts} list of:
14108
14109 @smallexample
14110 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
14111 @end smallexample
14112
14113 @item -fsanitize-address-use-after-scope
14114 @opindex fsanitize-address-use-after-scope
14115 Enable sanitization of local variables to detect use-after-scope bugs.
14116 The option sets @option{-fstack-reuse} to @samp{none}.
14117
14118 @item -fsanitize-undefined-trap-on-error
14119 @opindex fsanitize-undefined-trap-on-error
14120 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
14121 report undefined behavior using @code{__builtin_trap} rather than
14122 a @code{libubsan} library routine. The advantage of this is that the
14123 @code{libubsan} library is not needed and is not linked in, so this
14124 is usable even in freestanding environments.
14125
14126 @item -fsanitize-coverage=trace-pc
14127 @opindex fsanitize-coverage=trace-pc
14128 Enable coverage-guided fuzzing code instrumentation.
14129 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
14130
14131 @item -fsanitize-coverage=trace-cmp
14132 @opindex fsanitize-coverage=trace-cmp
14133 Enable dataflow guided fuzzing code instrumentation.
14134 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
14135 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
14136 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
14137 variable or @code{__sanitizer_cov_trace_const_cmp1},
14138 @code{__sanitizer_cov_trace_const_cmp2},
14139 @code{__sanitizer_cov_trace_const_cmp4} or
14140 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
14141 operand constant, @code{__sanitizer_cov_trace_cmpf} or
14142 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
14143 @code{__sanitizer_cov_trace_switch} for switch statements.
14144
14145 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
14146 @opindex fcf-protection
14147 Enable code instrumentation of control-flow transfers to increase
14148 program security by checking that target addresses of control-flow
14149 transfer instructions (such as indirect function call, function return,
14150 indirect jump) are valid. This prevents diverting the flow of control
14151 to an unexpected target. This is intended to protect against such
14152 threats as Return-oriented Programming (ROP), and similarly
14153 call/jmp-oriented programming (COP/JOP).
14154
14155 The value @code{branch} tells the compiler to implement checking of
14156 validity of control-flow transfer at the point of indirect branch
14157 instructions, i.e.@: call/jmp instructions. The value @code{return}
14158 implements checking of validity at the point of returning from a
14159 function. The value @code{full} is an alias for specifying both
14160 @code{branch} and @code{return}. The value @code{none} turns off
14161 instrumentation.
14162
14163 The macro @code{__CET__} is defined when @option{-fcf-protection} is
14164 used. The first bit of @code{__CET__} is set to 1 for the value
14165 @code{branch} and the second bit of @code{__CET__} is set to 1 for
14166 the @code{return}.
14167
14168 You can also use the @code{nocf_check} attribute to identify
14169 which functions and calls should be skipped from instrumentation
14170 (@pxref{Function Attributes}).
14171
14172 Currently the x86 GNU/Linux target provides an implementation based
14173 on Intel Control-flow Enforcement Technology (CET).
14174
14175 @item -fstack-protector
14176 @opindex fstack-protector
14177 Emit extra code to check for buffer overflows, such as stack smashing
14178 attacks. This is done by adding a guard variable to functions with
14179 vulnerable objects. This includes functions that call @code{alloca}, and
14180 functions with buffers larger than or equal to 8 bytes. The guards are
14181 initialized when a function is entered and then checked when the function
14182 exits. If a guard check fails, an error message is printed and the program
14183 exits. Only variables that are actually allocated on the stack are
14184 considered, optimized away variables or variables allocated in registers
14185 don't count.
14186
14187 @item -fstack-protector-all
14188 @opindex fstack-protector-all
14189 Like @option{-fstack-protector} except that all functions are protected.
14190
14191 @item -fstack-protector-strong
14192 @opindex fstack-protector-strong
14193 Like @option{-fstack-protector} but includes additional functions to
14194 be protected --- those that have local array definitions, or have
14195 references to local frame addresses. Only variables that are actually
14196 allocated on the stack are considered, optimized away variables or variables
14197 allocated in registers don't count.
14198
14199 @item -fstack-protector-explicit
14200 @opindex fstack-protector-explicit
14201 Like @option{-fstack-protector} but only protects those functions which
14202 have the @code{stack_protect} attribute.
14203
14204 @item -fstack-check
14205 @opindex fstack-check
14206 Generate code to verify that you do not go beyond the boundary of the
14207 stack. You should specify this flag if you are running in an
14208 environment with multiple threads, but you only rarely need to specify it in
14209 a single-threaded environment since stack overflow is automatically
14210 detected on nearly all systems if there is only one stack.
14211
14212 Note that this switch does not actually cause checking to be done; the
14213 operating system or the language runtime must do that. The switch causes
14214 generation of code to ensure that they see the stack being extended.
14215
14216 You can additionally specify a string parameter: @samp{no} means no
14217 checking, @samp{generic} means force the use of old-style checking,
14218 @samp{specific} means use the best checking method and is equivalent
14219 to bare @option{-fstack-check}.
14220
14221 Old-style checking is a generic mechanism that requires no specific
14222 target support in the compiler but comes with the following drawbacks:
14223
14224 @enumerate
14225 @item
14226 Modified allocation strategy for large objects: they are always
14227 allocated dynamically if their size exceeds a fixed threshold. Note this
14228 may change the semantics of some code.
14229
14230 @item
14231 Fixed limit on the size of the static frame of functions: when it is
14232 topped by a particular function, stack checking is not reliable and
14233 a warning is issued by the compiler.
14234
14235 @item
14236 Inefficiency: because of both the modified allocation strategy and the
14237 generic implementation, code performance is hampered.
14238 @end enumerate
14239
14240 Note that old-style stack checking is also the fallback method for
14241 @samp{specific} if no target support has been added in the compiler.
14242
14243 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
14244 and stack overflows. @samp{specific} is an excellent choice when compiling
14245 Ada code. It is not generally sufficient to protect against stack-clash
14246 attacks. To protect against those you want @samp{-fstack-clash-protection}.
14247
14248 @item -fstack-clash-protection
14249 @opindex fstack-clash-protection
14250 Generate code to prevent stack clash style attacks. When this option is
14251 enabled, the compiler will only allocate one page of stack space at a time
14252 and each page is accessed immediately after allocation. Thus, it prevents
14253 allocations from jumping over any stack guard page provided by the
14254 operating system.
14255
14256 Most targets do not fully support stack clash protection. However, on
14257 those targets @option{-fstack-clash-protection} will protect dynamic stack
14258 allocations. @option{-fstack-clash-protection} may also provide limited
14259 protection for static stack allocations if the target supports
14260 @option{-fstack-check=specific}.
14261
14262 @item -fstack-limit-register=@var{reg}
14263 @itemx -fstack-limit-symbol=@var{sym}
14264 @itemx -fno-stack-limit
14265 @opindex fstack-limit-register
14266 @opindex fstack-limit-symbol
14267 @opindex fno-stack-limit
14268 Generate code to ensure that the stack does not grow beyond a certain value,
14269 either the value of a register or the address of a symbol. If a larger
14270 stack is required, a signal is raised at run time. For most targets,
14271 the signal is raised before the stack overruns the boundary, so
14272 it is possible to catch the signal without taking special precautions.
14273
14274 For instance, if the stack starts at absolute address @samp{0x80000000}
14275 and grows downwards, you can use the flags
14276 @option{-fstack-limit-symbol=__stack_limit} and
14277 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
14278 of 128KB@. Note that this may only work with the GNU linker.
14279
14280 You can locally override stack limit checking by using the
14281 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
14282
14283 @item -fsplit-stack
14284 @opindex fsplit-stack
14285 Generate code to automatically split the stack before it overflows.
14286 The resulting program has a discontiguous stack which can only
14287 overflow if the program is unable to allocate any more memory. This
14288 is most useful when running threaded programs, as it is no longer
14289 necessary to calculate a good stack size to use for each thread. This
14290 is currently only implemented for the x86 targets running
14291 GNU/Linux.
14292
14293 When code compiled with @option{-fsplit-stack} calls code compiled
14294 without @option{-fsplit-stack}, there may not be much stack space
14295 available for the latter code to run. If compiling all code,
14296 including library code, with @option{-fsplit-stack} is not an option,
14297 then the linker can fix up these calls so that the code compiled
14298 without @option{-fsplit-stack} always has a large stack. Support for
14299 this is implemented in the gold linker in GNU binutils release 2.21
14300 and later.
14301
14302 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
14303 @opindex fvtable-verify
14304 This option is only available when compiling C++ code.
14305 It turns on (or off, if using @option{-fvtable-verify=none}) the security
14306 feature that verifies at run time, for every virtual call, that
14307 the vtable pointer through which the call is made is valid for the type of
14308 the object, and has not been corrupted or overwritten. If an invalid vtable
14309 pointer is detected at run time, an error is reported and execution of the
14310 program is immediately halted.
14311
14312 This option causes run-time data structures to be built at program startup,
14313 which are used for verifying the vtable pointers.
14314 The options @samp{std} and @samp{preinit}
14315 control the timing of when these data structures are built. In both cases the
14316 data structures are built before execution reaches @code{main}. Using
14317 @option{-fvtable-verify=std} causes the data structures to be built after
14318 shared libraries have been loaded and initialized.
14319 @option{-fvtable-verify=preinit} causes them to be built before shared
14320 libraries have been loaded and initialized.
14321
14322 If this option appears multiple times in the command line with different
14323 values specified, @samp{none} takes highest priority over both @samp{std} and
14324 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
14325
14326 @item -fvtv-debug
14327 @opindex fvtv-debug
14328 When used in conjunction with @option{-fvtable-verify=std} or
14329 @option{-fvtable-verify=preinit}, causes debug versions of the
14330 runtime functions for the vtable verification feature to be called.
14331 This flag also causes the compiler to log information about which
14332 vtable pointers it finds for each class.
14333 This information is written to a file named @file{vtv_set_ptr_data.log}
14334 in the directory named by the environment variable @env{VTV_LOGS_DIR}
14335 if that is defined or the current working directory otherwise.
14336
14337 Note: This feature @emph{appends} data to the log file. If you want a fresh log
14338 file, be sure to delete any existing one.
14339
14340 @item -fvtv-counts
14341 @opindex fvtv-counts
14342 This is a debugging flag. When used in conjunction with
14343 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
14344 causes the compiler to keep track of the total number of virtual calls
14345 it encounters and the number of verifications it inserts. It also
14346 counts the number of calls to certain run-time library functions
14347 that it inserts and logs this information for each compilation unit.
14348 The compiler writes this information to a file named
14349 @file{vtv_count_data.log} in the directory named by the environment
14350 variable @env{VTV_LOGS_DIR} if that is defined or the current working
14351 directory otherwise. It also counts the size of the vtable pointer sets
14352 for each class, and writes this information to @file{vtv_class_set_sizes.log}
14353 in the same directory.
14354
14355 Note: This feature @emph{appends} data to the log files. To get fresh log
14356 files, be sure to delete any existing ones.
14357
14358 @item -finstrument-functions
14359 @opindex finstrument-functions
14360 Generate instrumentation calls for entry and exit to functions. Just
14361 after function entry and just before function exit, the following
14362 profiling functions are called with the address of the current
14363 function and its call site. (On some platforms,
14364 @code{__builtin_return_address} does not work beyond the current
14365 function, so the call site information may not be available to the
14366 profiling functions otherwise.)
14367
14368 @smallexample
14369 void __cyg_profile_func_enter (void *this_fn,
14370 void *call_site);
14371 void __cyg_profile_func_exit (void *this_fn,
14372 void *call_site);
14373 @end smallexample
14374
14375 The first argument is the address of the start of the current function,
14376 which may be looked up exactly in the symbol table.
14377
14378 This instrumentation is also done for functions expanded inline in other
14379 functions. The profiling calls indicate where, conceptually, the
14380 inline function is entered and exited. This means that addressable
14381 versions of such functions must be available. If all your uses of a
14382 function are expanded inline, this may mean an additional expansion of
14383 code size. If you use @code{extern inline} in your C code, an
14384 addressable version of such functions must be provided. (This is
14385 normally the case anyway, but if you get lucky and the optimizer always
14386 expands the functions inline, you might have gotten away without
14387 providing static copies.)
14388
14389 A function may be given the attribute @code{no_instrument_function}, in
14390 which case this instrumentation is not done. This can be used, for
14391 example, for the profiling functions listed above, high-priority
14392 interrupt routines, and any functions from which the profiling functions
14393 cannot safely be called (perhaps signal handlers, if the profiling
14394 routines generate output or allocate memory).
14395 @xref{Common Function Attributes}.
14396
14397 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14398 @opindex finstrument-functions-exclude-file-list
14399
14400 Set the list of functions that are excluded from instrumentation (see
14401 the description of @option{-finstrument-functions}). If the file that
14402 contains a function definition matches with one of @var{file}, then
14403 that function is not instrumented. The match is done on substrings:
14404 if the @var{file} parameter is a substring of the file name, it is
14405 considered to be a match.
14406
14407 For example:
14408
14409 @smallexample
14410 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14411 @end smallexample
14412
14413 @noindent
14414 excludes any inline function defined in files whose pathnames
14415 contain @file{/bits/stl} or @file{include/sys}.
14416
14417 If, for some reason, you want to include letter @samp{,} in one of
14418 @var{sym}, write @samp{\,}. For example,
14419 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
14420 (note the single quote surrounding the option).
14421
14422 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14423 @opindex finstrument-functions-exclude-function-list
14424
14425 This is similar to @option{-finstrument-functions-exclude-file-list},
14426 but this option sets the list of function names to be excluded from
14427 instrumentation. The function name to be matched is its user-visible
14428 name, such as @code{vector<int> blah(const vector<int> &)}, not the
14429 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
14430 match is done on substrings: if the @var{sym} parameter is a substring
14431 of the function name, it is considered to be a match. For C99 and C++
14432 extended identifiers, the function name must be given in UTF-8, not
14433 using universal character names.
14434
14435 @item -fpatchable-function-entry=@var{N}[,@var{M}]
14436 @opindex fpatchable-function-entry
14437 Generate @var{N} NOPs right at the beginning
14438 of each function, with the function entry point before the @var{M}th NOP.
14439 If @var{M} is omitted, it defaults to @code{0} so the
14440 function entry points to the address just at the first NOP.
14441 The NOP instructions reserve extra space which can be used to patch in
14442 any desired instrumentation at run time, provided that the code segment
14443 is writable. The amount of space is controllable indirectly via
14444 the number of NOPs; the NOP instruction used corresponds to the instruction
14445 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
14446 is target-specific and may also depend on the architecture variant and/or
14447 other compilation options.
14448
14449 For run-time identification, the starting addresses of these areas,
14450 which correspond to their respective function entries minus @var{M},
14451 are additionally collected in the @code{__patchable_function_entries}
14452 section of the resulting binary.
14453
14454 Note that the value of @code{__attribute__ ((patchable_function_entry
14455 (N,M)))} takes precedence over command-line option
14456 @option{-fpatchable-function-entry=N,M}. This can be used to increase
14457 the area size or to remove it completely on a single function.
14458 If @code{N=0}, no pad location is recorded.
14459
14460 The NOP instructions are inserted at---and maybe before, depending on
14461 @var{M}---the function entry address, even before the prologue.
14462
14463 The maximum value of @var{N} and @var{M} is 65535.
14464 @end table
14465
14466
14467 @node Preprocessor Options
14468 @section Options Controlling the Preprocessor
14469 @cindex preprocessor options
14470 @cindex options, preprocessor
14471
14472 These options control the C preprocessor, which is run on each C source
14473 file before actual compilation.
14474
14475 If you use the @option{-E} option, nothing is done except preprocessing.
14476 Some of these options make sense only together with @option{-E} because
14477 they cause the preprocessor output to be unsuitable for actual
14478 compilation.
14479
14480 In addition to the options listed here, there are a number of options
14481 to control search paths for include files documented in
14482 @ref{Directory Options}.
14483 Options to control preprocessor diagnostics are listed in
14484 @ref{Warning Options}.
14485
14486 @table @gcctabopt
14487 @include cppopts.texi
14488
14489 @item -Wp,@var{option}
14490 @opindex Wp
14491 You can use @option{-Wp,@var{option}} to bypass the compiler driver
14492 and pass @var{option} directly through to the preprocessor. If
14493 @var{option} contains commas, it is split into multiple options at the
14494 commas. However, many options are modified, translated or interpreted
14495 by the compiler driver before being passed to the preprocessor, and
14496 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
14497 interface is undocumented and subject to change, so whenever possible
14498 you should avoid using @option{-Wp} and let the driver handle the
14499 options instead.
14500
14501 @item -Xpreprocessor @var{option}
14502 @opindex Xpreprocessor
14503 Pass @var{option} as an option to the preprocessor. You can use this to
14504 supply system-specific preprocessor options that GCC does not
14505 recognize.
14506
14507 If you want to pass an option that takes an argument, you must use
14508 @option{-Xpreprocessor} twice, once for the option and once for the argument.
14509
14510 @item -no-integrated-cpp
14511 @opindex no-integrated-cpp
14512 Perform preprocessing as a separate pass before compilation.
14513 By default, GCC performs preprocessing as an integrated part of
14514 input tokenization and parsing.
14515 If this option is provided, the appropriate language front end
14516 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14517 and Objective-C, respectively) is instead invoked twice,
14518 once for preprocessing only and once for actual compilation
14519 of the preprocessed input.
14520 This option may be useful in conjunction with the @option{-B} or
14521 @option{-wrapper} options to specify an alternate preprocessor or
14522 perform additional processing of the program source between
14523 normal preprocessing and compilation.
14524
14525 @item -flarge-source-files
14526 @opindex flarge-source-files
14527 Adjust GCC to expect large source files, at the expense of slower
14528 compilation and higher memory usage.
14529
14530 Specifically, GCC normally tracks both column numbers and line numbers
14531 within source files and it normally prints both of these numbers in
14532 diagnostics. However, once it has processed a certain number of source
14533 lines, it stops tracking column numbers and only tracks line numbers.
14534 This means that diagnostics for later lines do not include column numbers.
14535 It also means that options like @option{-Wmisleading-indentation} cease to work
14536 at that point, although the compiler prints a note if this happens.
14537 Passing @option{-flarge-source-files} significantly increases the number
14538 of source lines that GCC can process before it stops tracking columns.
14539
14540 @end table
14541
14542 @node Assembler Options
14543 @section Passing Options to the Assembler
14544
14545 @c prevent bad page break with this line
14546 You can pass options to the assembler.
14547
14548 @table @gcctabopt
14549 @item -Wa,@var{option}
14550 @opindex Wa
14551 Pass @var{option} as an option to the assembler. If @var{option}
14552 contains commas, it is split into multiple options at the commas.
14553
14554 @item -Xassembler @var{option}
14555 @opindex Xassembler
14556 Pass @var{option} as an option to the assembler. You can use this to
14557 supply system-specific assembler options that GCC does not
14558 recognize.
14559
14560 If you want to pass an option that takes an argument, you must use
14561 @option{-Xassembler} twice, once for the option and once for the argument.
14562
14563 @end table
14564
14565 @node Link Options
14566 @section Options for Linking
14567 @cindex link options
14568 @cindex options, linking
14569
14570 These options come into play when the compiler links object files into
14571 an executable output file. They are meaningless if the compiler is
14572 not doing a link step.
14573
14574 @table @gcctabopt
14575 @cindex file names
14576 @item @var{object-file-name}
14577 A file name that does not end in a special recognized suffix is
14578 considered to name an object file or library. (Object files are
14579 distinguished from libraries by the linker according to the file
14580 contents.) If linking is done, these object files are used as input
14581 to the linker.
14582
14583 @item -c
14584 @itemx -S
14585 @itemx -E
14586 @opindex c
14587 @opindex S
14588 @opindex E
14589 If any of these options is used, then the linker is not run, and
14590 object file names should not be used as arguments. @xref{Overall
14591 Options}.
14592
14593 @item -flinker-output=@var{type}
14594 @opindex flinker-output
14595 This option controls code generation of the link-time optimizer. By
14596 default the linker output is automatically determined by the linker
14597 plugin. For debugging the compiler and if incremental linking with a
14598 non-LTO object file is desired, it may be useful to control the type
14599 manually.
14600
14601 If @var{type} is @samp{exec}, code generation produces a static
14602 binary. In this case @option{-fpic} and @option{-fpie} are both
14603 disabled.
14604
14605 If @var{type} is @samp{dyn}, code generation produces a shared
14606 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
14607 but not enabled automatically. This allows to build shared libraries
14608 without position-independent code on architectures where this is
14609 possible, i.e.@: on x86.
14610
14611 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14612 executable. This results in similar optimizations as @samp{exec}
14613 except that @option{-fpie} is not disabled if specified at compilation
14614 time.
14615
14616 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14617 done. The sections containing intermediate code for link-time optimization are
14618 merged, pre-optimized, and output to the resulting object file. In addition, if
14619 @option{-ffat-lto-objects} is specified, binary code is produced for future
14620 non-LTO linking. The object file produced by incremental linking is smaller
14621 than a static library produced from the same object files. At link time the
14622 result of incremental linking also loads faster than a static
14623 library assuming that the majority of objects in the library are used.
14624
14625 Finally @samp{nolto-rel} configures the compiler for incremental linking where
14626 code generation is forced, a final binary is produced, and the intermediate
14627 code for later link-time optimization is stripped. When multiple object files
14628 are linked together the resulting code is better optimized than with
14629 link-time optimizations disabled (for example, cross-module inlining
14630 happens), but most of benefits of whole program optimizations are lost.
14631
14632 During the incremental link (by @option{-r}) the linker plugin defaults to
14633 @option{rel}. With current interfaces to GNU Binutils it is however not
14634 possible to incrementally link LTO objects and non-LTO objects into a single
14635 mixed object file. If any of object files in incremental link cannot
14636 be used for link-time optimization, the linker plugin issues a warning and
14637 uses @samp{nolto-rel}. To maintain whole program optimization, it is
14638 recommended to link such objects into static library instead. Alternatively it
14639 is possible to use H.J. Lu's binutils with support for mixed objects.
14640
14641 @item -fuse-ld=bfd
14642 @opindex fuse-ld=bfd
14643 Use the @command{bfd} linker instead of the default linker.
14644
14645 @item -fuse-ld=gold
14646 @opindex fuse-ld=gold
14647 Use the @command{gold} linker instead of the default linker.
14648
14649 @item -fuse-ld=lld
14650 @opindex fuse-ld=lld
14651 Use the LLVM @command{lld} linker instead of the default linker.
14652
14653 @cindex Libraries
14654 @item -l@var{library}
14655 @itemx -l @var{library}
14656 @opindex l
14657 Search the library named @var{library} when linking. (The second
14658 alternative with the library as a separate argument is only for
14659 POSIX compliance and is not recommended.)
14660
14661 The @option{-l} option is passed directly to the linker by GCC. Refer
14662 to your linker documentation for exact details. The general
14663 description below applies to the GNU linker.
14664
14665 The linker searches a standard list of directories for the library.
14666 The directories searched include several standard system directories
14667 plus any that you specify with @option{-L}.
14668
14669 Static libraries are archives of object files, and have file names
14670 like @file{lib@var{library}.a}. Some targets also support shared
14671 libraries, which typically have names like @file{lib@var{library}.so}.
14672 If both static and shared libraries are found, the linker gives
14673 preference to linking with the shared library unless the
14674 @option{-static} option is used.
14675
14676 It makes a difference where in the command you write this option; the
14677 linker searches and processes libraries and object files in the order they
14678 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14679 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
14680 to functions in @samp{z}, those functions may not be loaded.
14681
14682 @item -lobjc
14683 @opindex lobjc
14684 You need this special case of the @option{-l} option in order to
14685 link an Objective-C or Objective-C++ program.
14686
14687 @item -nostartfiles
14688 @opindex nostartfiles
14689 Do not use the standard system startup files when linking.
14690 The standard system libraries are used normally, unless @option{-nostdlib},
14691 @option{-nolibc}, or @option{-nodefaultlibs} is used.
14692
14693 @item -nodefaultlibs
14694 @opindex nodefaultlibs
14695 Do not use the standard system libraries when linking.
14696 Only the libraries you specify are passed to the linker, and options
14697 specifying linkage of the system libraries, such as @option{-static-libgcc}
14698 or @option{-shared-libgcc}, are ignored.
14699 The standard startup files are used normally, unless @option{-nostartfiles}
14700 is used.
14701
14702 The compiler may generate calls to @code{memcmp},
14703 @code{memset}, @code{memcpy} and @code{memmove}.
14704 These entries are usually resolved by entries in
14705 libc. These entry points should be supplied through some other
14706 mechanism when this option is specified.
14707
14708 @item -nolibc
14709 @opindex nolibc
14710 Do not use the C library or system libraries tightly coupled with it when
14711 linking. Still link with the startup files, @file{libgcc} or toolchain
14712 provided language support libraries such as @file{libgnat}, @file{libgfortran}
14713 or @file{libstdc++} unless options preventing their inclusion are used as
14714 well. This typically removes @option{-lc} from the link command line, as well
14715 as system libraries that normally go with it and become meaningless when
14716 absence of a C library is assumed, for example @option{-lpthread} or
14717 @option{-lm} in some configurations. This is intended for bare-board
14718 targets when there is indeed no C library available.
14719
14720 @item -nostdlib
14721 @opindex nostdlib
14722 Do not use the standard system startup files or libraries when linking.
14723 No startup files and only the libraries you specify are passed to
14724 the linker, and options specifying linkage of the system libraries, such as
14725 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14726
14727 The compiler may generate calls to @code{memcmp}, @code{memset},
14728 @code{memcpy} and @code{memmove}.
14729 These entries are usually resolved by entries in
14730 libc. These entry points should be supplied through some other
14731 mechanism when this option is specified.
14732
14733 @cindex @option{-lgcc}, use with @option{-nostdlib}
14734 @cindex @option{-nostdlib} and unresolved references
14735 @cindex unresolved references and @option{-nostdlib}
14736 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14737 @cindex @option{-nodefaultlibs} and unresolved references
14738 @cindex unresolved references and @option{-nodefaultlibs}
14739 One of the standard libraries bypassed by @option{-nostdlib} and
14740 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14741 which GCC uses to overcome shortcomings of particular machines, or special
14742 needs for some languages.
14743 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14744 Collection (GCC) Internals},
14745 for more discussion of @file{libgcc.a}.)
14746 In most cases, you need @file{libgcc.a} even when you want to avoid
14747 other standard libraries. In other words, when you specify @option{-nostdlib}
14748 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14749 This ensures that you have no unresolved references to internal GCC
14750 library subroutines.
14751 (An example of such an internal subroutine is @code{__main}, used to ensure C++
14752 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14753 GNU Compiler Collection (GCC) Internals}.)
14754
14755 @item -e @var{entry}
14756 @itemx --entry=@var{entry}
14757 @opindex e
14758 @opindex entry
14759
14760 Specify that the program entry point is @var{entry}. The argument is
14761 interpreted by the linker; the GNU linker accepts either a symbol name
14762 or an address.
14763
14764 @item -pie
14765 @opindex pie
14766 Produce a dynamically linked position independent executable on targets
14767 that support it. For predictable results, you must also specify the same
14768 set of options used for compilation (@option{-fpie}, @option{-fPIE},
14769 or model suboptions) when you specify this linker option.
14770
14771 @item -no-pie
14772 @opindex no-pie
14773 Don't produce a dynamically linked position independent executable.
14774
14775 @item -static-pie
14776 @opindex static-pie
14777 Produce a static position independent executable on targets that support
14778 it. A static position independent executable is similar to a static
14779 executable, but can be loaded at any address without a dynamic linker.
14780 For predictable results, you must also specify the same set of options
14781 used for compilation (@option{-fpie}, @option{-fPIE}, or model
14782 suboptions) when you specify this linker option.
14783
14784 @item -pthread
14785 @opindex pthread
14786 Link with the POSIX threads library. This option is supported on
14787 GNU/Linux targets, most other Unix derivatives, and also on
14788 x86 Cygwin and MinGW targets. On some targets this option also sets
14789 flags for the preprocessor, so it should be used consistently for both
14790 compilation and linking.
14791
14792 @item -r
14793 @opindex r
14794 Produce a relocatable object as output. This is also known as partial
14795 linking.
14796
14797 @item -rdynamic
14798 @opindex rdynamic
14799 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14800 that support it. This instructs the linker to add all symbols, not
14801 only used ones, to the dynamic symbol table. This option is needed
14802 for some uses of @code{dlopen} or to allow obtaining backtraces
14803 from within a program.
14804
14805 @item -s
14806 @opindex s
14807 Remove all symbol table and relocation information from the executable.
14808
14809 @item -static
14810 @opindex static
14811 On systems that support dynamic linking, this overrides @option{-pie}
14812 and prevents linking with the shared libraries. On other systems, this
14813 option has no effect.
14814
14815 @item -shared
14816 @opindex shared
14817 Produce a shared object which can then be linked with other objects to
14818 form an executable. Not all systems support this option. For predictable
14819 results, you must also specify the same set of options used for compilation
14820 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
14821 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14822 needs to build supplementary stub code for constructors to work. On
14823 multi-libbed systems, @samp{gcc -shared} must select the correct support
14824 libraries to link against. Failing to supply the correct flags may lead
14825 to subtle defects. Supplying them in cases where they are not necessary
14826 is innocuous.}
14827
14828 @item -shared-libgcc
14829 @itemx -static-libgcc
14830 @opindex shared-libgcc
14831 @opindex static-libgcc
14832 On systems that provide @file{libgcc} as a shared library, these options
14833 force the use of either the shared or static version, respectively.
14834 If no shared version of @file{libgcc} was built when the compiler was
14835 configured, these options have no effect.
14836
14837 There are several situations in which an application should use the
14838 shared @file{libgcc} instead of the static version. The most common
14839 of these is when the application wishes to throw and catch exceptions
14840 across different shared libraries. In that case, each of the libraries
14841 as well as the application itself should use the shared @file{libgcc}.
14842
14843 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14844 whenever you build a shared library or a main executable, because C++
14845 programs typically use exceptions, so this is the right thing to do.
14846
14847 If, instead, you use the GCC driver to create shared libraries, you may
14848 find that they are not always linked with the shared @file{libgcc}.
14849 If GCC finds, at its configuration time, that you have a non-GNU linker
14850 or a GNU linker that does not support option @option{--eh-frame-hdr},
14851 it links the shared version of @file{libgcc} into shared libraries
14852 by default. Otherwise, it takes advantage of the linker and optimizes
14853 away the linking with the shared version of @file{libgcc}, linking with
14854 the static version of libgcc by default. This allows exceptions to
14855 propagate through such shared libraries, without incurring relocation
14856 costs at library load time.
14857
14858 However, if a library or main executable is supposed to throw or catch
14859 exceptions, you must link it using the G++ driver, or using the option
14860 @option{-shared-libgcc}, such that it is linked with the shared
14861 @file{libgcc}.
14862
14863 @item -static-libasan
14864 @opindex static-libasan
14865 When the @option{-fsanitize=address} option is used to link a program,
14866 the GCC driver automatically links against @option{libasan}. If
14867 @file{libasan} is available as a shared library, and the @option{-static}
14868 option is not used, then this links against the shared version of
14869 @file{libasan}. The @option{-static-libasan} option directs the GCC
14870 driver to link @file{libasan} statically, without necessarily linking
14871 other libraries statically.
14872
14873 @item -static-libtsan
14874 @opindex static-libtsan
14875 When the @option{-fsanitize=thread} option is used to link a program,
14876 the GCC driver automatically links against @option{libtsan}. If
14877 @file{libtsan} is available as a shared library, and the @option{-static}
14878 option is not used, then this links against the shared version of
14879 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
14880 driver to link @file{libtsan} statically, without necessarily linking
14881 other libraries statically.
14882
14883 @item -static-liblsan
14884 @opindex static-liblsan
14885 When the @option{-fsanitize=leak} option is used to link a program,
14886 the GCC driver automatically links against @option{liblsan}. If
14887 @file{liblsan} is available as a shared library, and the @option{-static}
14888 option is not used, then this links against the shared version of
14889 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
14890 driver to link @file{liblsan} statically, without necessarily linking
14891 other libraries statically.
14892
14893 @item -static-libubsan
14894 @opindex static-libubsan
14895 When the @option{-fsanitize=undefined} option is used to link a program,
14896 the GCC driver automatically links against @option{libubsan}. If
14897 @file{libubsan} is available as a shared library, and the @option{-static}
14898 option is not used, then this links against the shared version of
14899 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
14900 driver to link @file{libubsan} statically, without necessarily linking
14901 other libraries statically.
14902
14903 @item -static-libstdc++
14904 @opindex static-libstdc++
14905 When the @command{g++} program is used to link a C++ program, it
14906 normally automatically links against @option{libstdc++}. If
14907 @file{libstdc++} is available as a shared library, and the
14908 @option{-static} option is not used, then this links against the
14909 shared version of @file{libstdc++}. That is normally fine. However, it
14910 is sometimes useful to freeze the version of @file{libstdc++} used by
14911 the program without going all the way to a fully static link. The
14912 @option{-static-libstdc++} option directs the @command{g++} driver to
14913 link @file{libstdc++} statically, without necessarily linking other
14914 libraries statically.
14915
14916 @item -symbolic
14917 @opindex symbolic
14918 Bind references to global symbols when building a shared object. Warn
14919 about any unresolved references (unless overridden by the link editor
14920 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
14921 this option.
14922
14923 @item -T @var{script}
14924 @opindex T
14925 @cindex linker script
14926 Use @var{script} as the linker script. This option is supported by most
14927 systems using the GNU linker. On some targets, such as bare-board
14928 targets without an operating system, the @option{-T} option may be required
14929 when linking to avoid references to undefined symbols.
14930
14931 @item -Xlinker @var{option}
14932 @opindex Xlinker
14933 Pass @var{option} as an option to the linker. You can use this to
14934 supply system-specific linker options that GCC does not recognize.
14935
14936 If you want to pass an option that takes a separate argument, you must use
14937 @option{-Xlinker} twice, once for the option and once for the argument.
14938 For example, to pass @option{-assert definitions}, you must write
14939 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
14940 @option{-Xlinker "-assert definitions"}, because this passes the entire
14941 string as a single argument, which is not what the linker expects.
14942
14943 When using the GNU linker, it is usually more convenient to pass
14944 arguments to linker options using the @option{@var{option}=@var{value}}
14945 syntax than as separate arguments. For example, you can specify
14946 @option{-Xlinker -Map=output.map} rather than
14947 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
14948 this syntax for command-line options.
14949
14950 @item -Wl,@var{option}
14951 @opindex Wl
14952 Pass @var{option} as an option to the linker. If @var{option} contains
14953 commas, it is split into multiple options at the commas. You can use this
14954 syntax to pass an argument to the option.
14955 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
14956 linker. When using the GNU linker, you can also get the same effect with
14957 @option{-Wl,-Map=output.map}.
14958
14959 @item -u @var{symbol}
14960 @opindex u
14961 Pretend the symbol @var{symbol} is undefined, to force linking of
14962 library modules to define it. You can use @option{-u} multiple times with
14963 different symbols to force loading of additional library modules.
14964
14965 @item -z @var{keyword}
14966 @opindex z
14967 @option{-z} is passed directly on to the linker along with the keyword
14968 @var{keyword}. See the section in the documentation of your linker for
14969 permitted values and their meanings.
14970 @end table
14971
14972 @node Directory Options
14973 @section Options for Directory Search
14974 @cindex directory options
14975 @cindex options, directory search
14976 @cindex search path
14977
14978 These options specify directories to search for header files, for
14979 libraries and for parts of the compiler:
14980
14981 @table @gcctabopt
14982 @include cppdiropts.texi
14983
14984 @item -iplugindir=@var{dir}
14985 @opindex iplugindir=
14986 Set the directory to search for plugins that are passed
14987 by @option{-fplugin=@var{name}} instead of
14988 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
14989 to be used by the user, but only passed by the driver.
14990
14991 @item -L@var{dir}
14992 @opindex L
14993 Add directory @var{dir} to the list of directories to be searched
14994 for @option{-l}.
14995
14996 @item -B@var{prefix}
14997 @opindex B
14998 This option specifies where to find the executables, libraries,
14999 include files, and data files of the compiler itself.
15000
15001 The compiler driver program runs one or more of the subprograms
15002 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
15003 @var{prefix} as a prefix for each program it tries to run, both with and
15004 without @samp{@var{machine}/@var{version}/} for the corresponding target
15005 machine and compiler version.
15006
15007 For each subprogram to be run, the compiler driver first tries the
15008 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
15009 is not specified, the driver tries two standard prefixes,
15010 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
15011 those results in a file name that is found, the unmodified program
15012 name is searched for using the directories specified in your
15013 @env{PATH} environment variable.
15014
15015 The compiler checks to see if the path provided by @option{-B}
15016 refers to a directory, and if necessary it adds a directory
15017 separator character at the end of the path.
15018
15019 @option{-B} prefixes that effectively specify directory names also apply
15020 to libraries in the linker, because the compiler translates these
15021 options into @option{-L} options for the linker. They also apply to
15022 include files in the preprocessor, because the compiler translates these
15023 options into @option{-isystem} options for the preprocessor. In this case,
15024 the compiler appends @samp{include} to the prefix.
15025
15026 The runtime support file @file{libgcc.a} can also be searched for using
15027 the @option{-B} prefix, if needed. If it is not found there, the two
15028 standard prefixes above are tried, and that is all. The file is left
15029 out of the link if it is not found by those means.
15030
15031 Another way to specify a prefix much like the @option{-B} prefix is to use
15032 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
15033 Variables}.
15034
15035 As a special kludge, if the path provided by @option{-B} is
15036 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
15037 9, then it is replaced by @file{[dir/]include}. This is to help
15038 with boot-strapping the compiler.
15039
15040 @item -no-canonical-prefixes
15041 @opindex no-canonical-prefixes
15042 Do not expand any symbolic links, resolve references to @samp{/../}
15043 or @samp{/./}, or make the path absolute when generating a relative
15044 prefix.
15045
15046 @item --sysroot=@var{dir}
15047 @opindex sysroot
15048 Use @var{dir} as the logical root directory for headers and libraries.
15049 For example, if the compiler normally searches for headers in
15050 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
15051 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
15052
15053 If you use both this option and the @option{-isysroot} option, then
15054 the @option{--sysroot} option applies to libraries, but the
15055 @option{-isysroot} option applies to header files.
15056
15057 The GNU linker (beginning with version 2.16) has the necessary support
15058 for this option. If your linker does not support this option, the
15059 header file aspect of @option{--sysroot} still works, but the
15060 library aspect does not.
15061
15062 @item --no-sysroot-suffix
15063 @opindex no-sysroot-suffix
15064 For some targets, a suffix is added to the root directory specified
15065 with @option{--sysroot}, depending on the other options used, so that
15066 headers may for example be found in
15067 @file{@var{dir}/@var{suffix}/usr/include} instead of
15068 @file{@var{dir}/usr/include}. This option disables the addition of
15069 such a suffix.
15070
15071 @end table
15072
15073 @node Code Gen Options
15074 @section Options for Code Generation Conventions
15075 @cindex code generation conventions
15076 @cindex options, code generation
15077 @cindex run-time options
15078
15079 These machine-independent options control the interface conventions
15080 used in code generation.
15081
15082 Most of them have both positive and negative forms; the negative form
15083 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
15084 one of the forms is listed---the one that is not the default. You
15085 can figure out the other form by either removing @samp{no-} or adding
15086 it.
15087
15088 @table @gcctabopt
15089 @item -fstack-reuse=@var{reuse-level}
15090 @opindex fstack_reuse
15091 This option controls stack space reuse for user declared local/auto variables
15092 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
15093 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
15094 local variables and temporaries, @samp{named_vars} enables the reuse only for
15095 user defined local variables with names, and @samp{none} disables stack reuse
15096 completely. The default value is @samp{all}. The option is needed when the
15097 program extends the lifetime of a scoped local variable or a compiler generated
15098 temporary beyond the end point defined by the language. When a lifetime of
15099 a variable ends, and if the variable lives in memory, the optimizing compiler
15100 has the freedom to reuse its stack space with other temporaries or scoped
15101 local variables whose live range does not overlap with it. Legacy code extending
15102 local lifetime is likely to break with the stack reuse optimization.
15103
15104 For example,
15105
15106 @smallexample
15107 int *p;
15108 @{
15109 int local1;
15110
15111 p = &local1;
15112 local1 = 10;
15113 ....
15114 @}
15115 @{
15116 int local2;
15117 local2 = 20;
15118 ...
15119 @}
15120
15121 if (*p == 10) // out of scope use of local1
15122 @{
15123
15124 @}
15125 @end smallexample
15126
15127 Another example:
15128 @smallexample
15129
15130 struct A
15131 @{
15132 A(int k) : i(k), j(k) @{ @}
15133 int i;
15134 int j;
15135 @};
15136
15137 A *ap;
15138
15139 void foo(const A& ar)
15140 @{
15141 ap = &ar;
15142 @}
15143
15144 void bar()
15145 @{
15146 foo(A(10)); // temp object's lifetime ends when foo returns
15147
15148 @{
15149 A a(20);
15150 ....
15151 @}
15152 ap->i+= 10; // ap references out of scope temp whose space
15153 // is reused with a. What is the value of ap->i?
15154 @}
15155
15156 @end smallexample
15157
15158 The lifetime of a compiler generated temporary is well defined by the C++
15159 standard. When a lifetime of a temporary ends, and if the temporary lives
15160 in memory, the optimizing compiler has the freedom to reuse its stack
15161 space with other temporaries or scoped local variables whose live range
15162 does not overlap with it. However some of the legacy code relies on
15163 the behavior of older compilers in which temporaries' stack space is
15164 not reused, the aggressive stack reuse can lead to runtime errors. This
15165 option is used to control the temporary stack reuse optimization.
15166
15167 @item -ftrapv
15168 @opindex ftrapv
15169 This option generates traps for signed overflow on addition, subtraction,
15170 multiplication operations.
15171 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
15172 @option{-ftrapv} @option{-fwrapv} on the command-line results in
15173 @option{-fwrapv} being effective. Note that only active options override, so
15174 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
15175 results in @option{-ftrapv} being effective.
15176
15177 @item -fwrapv
15178 @opindex fwrapv
15179 This option instructs the compiler to assume that signed arithmetic
15180 overflow of addition, subtraction and multiplication wraps around
15181 using twos-complement representation. This flag enables some optimizations
15182 and disables others.
15183 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
15184 @option{-ftrapv} @option{-fwrapv} on the command-line results in
15185 @option{-fwrapv} being effective. Note that only active options override, so
15186 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
15187 results in @option{-ftrapv} being effective.
15188
15189 @item -fwrapv-pointer
15190 @opindex fwrapv-pointer
15191 This option instructs the compiler to assume that pointer arithmetic
15192 overflow on addition and subtraction wraps around using twos-complement
15193 representation. This flag disables some optimizations which assume
15194 pointer overflow is invalid.
15195
15196 @item -fstrict-overflow
15197 @opindex fstrict-overflow
15198 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
15199 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
15200
15201 @item -fexceptions
15202 @opindex fexceptions
15203 Enable exception handling. Generates extra code needed to propagate
15204 exceptions. For some targets, this implies GCC generates frame
15205 unwind information for all functions, which can produce significant data
15206 size overhead, although it does not affect execution. If you do not
15207 specify this option, GCC enables it by default for languages like
15208 C++ that normally require exception handling, and disables it for
15209 languages like C that do not normally require it. However, you may need
15210 to enable this option when compiling C code that needs to interoperate
15211 properly with exception handlers written in C++. You may also wish to
15212 disable this option if you are compiling older C++ programs that don't
15213 use exception handling.
15214
15215 @item -fnon-call-exceptions
15216 @opindex fnon-call-exceptions
15217 Generate code that allows trapping instructions to throw exceptions.
15218 Note that this requires platform-specific runtime support that does
15219 not exist everywhere. Moreover, it only allows @emph{trapping}
15220 instructions to throw exceptions, i.e.@: memory references or floating-point
15221 instructions. It does not allow exceptions to be thrown from
15222 arbitrary signal handlers such as @code{SIGALRM}.
15223
15224 @item -fdelete-dead-exceptions
15225 @opindex fdelete-dead-exceptions
15226 Consider that instructions that may throw exceptions but don't otherwise
15227 contribute to the execution of the program can be optimized away.
15228 This option is enabled by default for the Ada front end, as permitted by
15229 the Ada language specification.
15230 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
15231
15232 @item -funwind-tables
15233 @opindex funwind-tables
15234 Similar to @option{-fexceptions}, except that it just generates any needed
15235 static data, but does not affect the generated code in any other way.
15236 You normally do not need to enable this option; instead, a language processor
15237 that needs this handling enables it on your behalf.
15238
15239 @item -fasynchronous-unwind-tables
15240 @opindex fasynchronous-unwind-tables
15241 Generate unwind table in DWARF format, if supported by target machine. The
15242 table is exact at each instruction boundary, so it can be used for stack
15243 unwinding from asynchronous events (such as debugger or garbage collector).
15244
15245 @item -fno-gnu-unique
15246 @opindex fno-gnu-unique
15247 @opindex fgnu-unique
15248 On systems with recent GNU assembler and C library, the C++ compiler
15249 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
15250 of template static data members and static local variables in inline
15251 functions are unique even in the presence of @code{RTLD_LOCAL}; this
15252 is necessary to avoid problems with a library used by two different
15253 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
15254 therefore disagreeing with the other one about the binding of the
15255 symbol. But this causes @code{dlclose} to be ignored for affected
15256 DSOs; if your program relies on reinitialization of a DSO via
15257 @code{dlclose} and @code{dlopen}, you can use
15258 @option{-fno-gnu-unique}.
15259
15260 @item -fpcc-struct-return
15261 @opindex fpcc-struct-return
15262 Return ``short'' @code{struct} and @code{union} values in memory like
15263 longer ones, rather than in registers. This convention is less
15264 efficient, but it has the advantage of allowing intercallability between
15265 GCC-compiled files and files compiled with other compilers, particularly
15266 the Portable C Compiler (pcc).
15267
15268 The precise convention for returning structures in memory depends
15269 on the target configuration macros.
15270
15271 Short structures and unions are those whose size and alignment match
15272 that of some integer type.
15273
15274 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
15275 switch is not binary compatible with code compiled with the
15276 @option{-freg-struct-return} switch.
15277 Use it to conform to a non-default application binary interface.
15278
15279 @item -freg-struct-return
15280 @opindex freg-struct-return
15281 Return @code{struct} and @code{union} values in registers when possible.
15282 This is more efficient for small structures than
15283 @option{-fpcc-struct-return}.
15284
15285 If you specify neither @option{-fpcc-struct-return} nor
15286 @option{-freg-struct-return}, GCC defaults to whichever convention is
15287 standard for the target. If there is no standard convention, GCC
15288 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
15289 the principal compiler. In those cases, we can choose the standard, and
15290 we chose the more efficient register return alternative.
15291
15292 @strong{Warning:} code compiled with the @option{-freg-struct-return}
15293 switch is not binary compatible with code compiled with the
15294 @option{-fpcc-struct-return} switch.
15295 Use it to conform to a non-default application binary interface.
15296
15297 @item -fshort-enums
15298 @opindex fshort-enums
15299 Allocate to an @code{enum} type only as many bytes as it needs for the
15300 declared range of possible values. Specifically, the @code{enum} type
15301 is equivalent to the smallest integer type that has enough room.
15302
15303 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
15304 code that is not binary compatible with code generated without that switch.
15305 Use it to conform to a non-default application binary interface.
15306
15307 @item -fshort-wchar
15308 @opindex fshort-wchar
15309 Override the underlying type for @code{wchar_t} to be @code{short
15310 unsigned int} instead of the default for the target. This option is
15311 useful for building programs to run under WINE@.
15312
15313 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
15314 code that is not binary compatible with code generated without that switch.
15315 Use it to conform to a non-default application binary interface.
15316
15317 @item -fcommon
15318 @opindex fcommon
15319 @opindex fno-common
15320 @cindex tentative definitions
15321 In C code, this option controls the placement of global variables
15322 defined without an initializer, known as @dfn{tentative definitions}
15323 in the C standard. Tentative definitions are distinct from declarations
15324 of a variable with the @code{extern} keyword, which do not allocate storage.
15325
15326 The default is @option{-fno-common}, which specifies that the compiler places
15327 uninitialized global variables in the BSS section of the object file.
15328 This inhibits the merging of tentative definitions by the linker so you get a
15329 multiple-definition error if the same variable is accidentally defined in more
15330 than one compilation unit.
15331
15332 The @option{-fcommon} places uninitialized global variables in a common block.
15333 This allows the linker to resolve all tentative definitions of the same variable
15334 in different compilation units to the same object, or to a non-tentative
15335 definition. This behavior is inconsistent with C++, and on many targets implies
15336 a speed and code size penalty on global variable references. It is mainly
15337 useful to enable legacy code to link without errors.
15338
15339 @item -fno-ident
15340 @opindex fno-ident
15341 @opindex fident
15342 Ignore the @code{#ident} directive.
15343
15344 @item -finhibit-size-directive
15345 @opindex finhibit-size-directive
15346 Don't output a @code{.size} assembler directive, or anything else that
15347 would cause trouble if the function is split in the middle, and the
15348 two halves are placed at locations far apart in memory. This option is
15349 used when compiling @file{crtstuff.c}; you should not need to use it
15350 for anything else.
15351
15352 @item -fverbose-asm
15353 @opindex fverbose-asm
15354 Put extra commentary information in the generated assembly code to
15355 make it more readable. This option is generally only of use to those
15356 who actually need to read the generated assembly code (perhaps while
15357 debugging the compiler itself).
15358
15359 @option{-fno-verbose-asm}, the default, causes the
15360 extra information to be omitted and is useful when comparing two assembler
15361 files.
15362
15363 The added comments include:
15364
15365 @itemize @bullet
15366
15367 @item
15368 information on the compiler version and command-line options,
15369
15370 @item
15371 the source code lines associated with the assembly instructions,
15372 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15373
15374 @item
15375 hints on which high-level expressions correspond to
15376 the various assembly instruction operands.
15377
15378 @end itemize
15379
15380 For example, given this C source file:
15381
15382 @smallexample
15383 int test (int n)
15384 @{
15385 int i;
15386 int total = 0;
15387
15388 for (i = 0; i < n; i++)
15389 total += i * i;
15390
15391 return total;
15392 @}
15393 @end smallexample
15394
15395 compiling to (x86_64) assembly via @option{-S} and emitting the result
15396 direct to stdout via @option{-o} @option{-}
15397
15398 @smallexample
15399 gcc -S test.c -fverbose-asm -Os -o -
15400 @end smallexample
15401
15402 gives output similar to this:
15403
15404 @smallexample
15405 .file "test.c"
15406 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15407 [...snip...]
15408 # options passed:
15409 [...snip...]
15410
15411 .text
15412 .globl test
15413 .type test, @@function
15414 test:
15415 .LFB0:
15416 .cfi_startproc
15417 # test.c:4: int total = 0;
15418 xorl %eax, %eax # <retval>
15419 # test.c:6: for (i = 0; i < n; i++)
15420 xorl %edx, %edx # i
15421 .L2:
15422 # test.c:6: for (i = 0; i < n; i++)
15423 cmpl %edi, %edx # n, i
15424 jge .L5 #,
15425 # test.c:7: total += i * i;
15426 movl %edx, %ecx # i, tmp92
15427 imull %edx, %ecx # i, tmp92
15428 # test.c:6: for (i = 0; i < n; i++)
15429 incl %edx # i
15430 # test.c:7: total += i * i;
15431 addl %ecx, %eax # tmp92, <retval>
15432 jmp .L2 #
15433 .L5:
15434 # test.c:10: @}
15435 ret
15436 .cfi_endproc
15437 .LFE0:
15438 .size test, .-test
15439 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15440 .section .note.GNU-stack,"",@@progbits
15441 @end smallexample
15442
15443 The comments are intended for humans rather than machines and hence the
15444 precise format of the comments is subject to change.
15445
15446 @item -frecord-gcc-switches
15447 @opindex frecord-gcc-switches
15448 This switch causes the command line used to invoke the
15449 compiler to be recorded into the object file that is being created.
15450 This switch is only implemented on some targets and the exact format
15451 of the recording is target and binary file format dependent, but it
15452 usually takes the form of a section containing ASCII text. This
15453 switch is related to the @option{-fverbose-asm} switch, but that
15454 switch only records information in the assembler output file as
15455 comments, so it never reaches the object file.
15456 See also @option{-grecord-gcc-switches} for another
15457 way of storing compiler options into the object file.
15458
15459 @item -fpic
15460 @opindex fpic
15461 @cindex global offset table
15462 @cindex PIC
15463 Generate position-independent code (PIC) suitable for use in a shared
15464 library, if supported for the target machine. Such code accesses all
15465 constant addresses through a global offset table (GOT)@. The dynamic
15466 loader resolves the GOT entries when the program starts (the dynamic
15467 loader is not part of GCC; it is part of the operating system). If
15468 the GOT size for the linked executable exceeds a machine-specific
15469 maximum size, you get an error message from the linker indicating that
15470 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15471 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
15472 on the m68k and RS/6000. The x86 has no such limit.)
15473
15474 Position-independent code requires special support, and therefore works
15475 only on certain machines. For the x86, GCC supports PIC for System V
15476 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
15477 position-independent.
15478
15479 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15480 are defined to 1.
15481
15482 @item -fPIC
15483 @opindex fPIC
15484 If supported for the target machine, emit position-independent code,
15485 suitable for dynamic linking and avoiding any limit on the size of the
15486 global offset table. This option makes a difference on AArch64, m68k,
15487 PowerPC and SPARC@.
15488
15489 Position-independent code requires special support, and therefore works
15490 only on certain machines.
15491
15492 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15493 are defined to 2.
15494
15495 @item -fpie
15496 @itemx -fPIE
15497 @opindex fpie
15498 @opindex fPIE
15499 These options are similar to @option{-fpic} and @option{-fPIC}, but the
15500 generated position-independent code can be only linked into executables.
15501 Usually these options are used to compile code that will be linked using
15502 the @option{-pie} GCC option.
15503
15504 @option{-fpie} and @option{-fPIE} both define the macros
15505 @code{__pie__} and @code{__PIE__}. The macros have the value 1
15506 for @option{-fpie} and 2 for @option{-fPIE}.
15507
15508 @item -fno-plt
15509 @opindex fno-plt
15510 @opindex fplt
15511 Do not use the PLT for external function calls in position-independent code.
15512 Instead, load the callee address at call sites from the GOT and branch to it.
15513 This leads to more efficient code by eliminating PLT stubs and exposing
15514 GOT loads to optimizations. On architectures such as 32-bit x86 where
15515 PLT stubs expect the GOT pointer in a specific register, this gives more
15516 register allocation freedom to the compiler.
15517 Lazy binding requires use of the PLT;
15518 with @option{-fno-plt} all external symbols are resolved at load time.
15519
15520 Alternatively, the function attribute @code{noplt} can be used to avoid calls
15521 through the PLT for specific external functions.
15522
15523 In position-dependent code, a few targets also convert calls to
15524 functions that are marked to not use the PLT to use the GOT instead.
15525
15526 @item -fno-jump-tables
15527 @opindex fno-jump-tables
15528 @opindex fjump-tables
15529 Do not use jump tables for switch statements even where it would be
15530 more efficient than other code generation strategies. This option is
15531 of use in conjunction with @option{-fpic} or @option{-fPIC} for
15532 building code that forms part of a dynamic linker and cannot
15533 reference the address of a jump table. On some targets, jump tables
15534 do not require a GOT and this option is not needed.
15535
15536 @item -ffixed-@var{reg}
15537 @opindex ffixed
15538 Treat the register named @var{reg} as a fixed register; generated code
15539 should never refer to it (except perhaps as a stack pointer, frame
15540 pointer or in some other fixed role).
15541
15542 @var{reg} must be the name of a register. The register names accepted
15543 are machine-specific and are defined in the @code{REGISTER_NAMES}
15544 macro in the machine description macro file.
15545
15546 This flag does not have a negative form, because it specifies a
15547 three-way choice.
15548
15549 @item -fcall-used-@var{reg}
15550 @opindex fcall-used
15551 Treat the register named @var{reg} as an allocable register that is
15552 clobbered by function calls. It may be allocated for temporaries or
15553 variables that do not live across a call. Functions compiled this way
15554 do not save and restore the register @var{reg}.
15555
15556 It is an error to use this flag with the frame pointer or stack pointer.
15557 Use of this flag for other registers that have fixed pervasive roles in
15558 the machine's execution model produces disastrous results.
15559
15560 This flag does not have a negative form, because it specifies a
15561 three-way choice.
15562
15563 @item -fcall-saved-@var{reg}
15564 @opindex fcall-saved
15565 Treat the register named @var{reg} as an allocable register saved by
15566 functions. It may be allocated even for temporaries or variables that
15567 live across a call. Functions compiled this way save and restore
15568 the register @var{reg} if they use it.
15569
15570 It is an error to use this flag with the frame pointer or stack pointer.
15571 Use of this flag for other registers that have fixed pervasive roles in
15572 the machine's execution model produces disastrous results.
15573
15574 A different sort of disaster results from the use of this flag for
15575 a register in which function values may be returned.
15576
15577 This flag does not have a negative form, because it specifies a
15578 three-way choice.
15579
15580 @item -fpack-struct[=@var{n}]
15581 @opindex fpack-struct
15582 Without a value specified, pack all structure members together without
15583 holes. When a value is specified (which must be a small power of two), pack
15584 structure members according to this value, representing the maximum
15585 alignment (that is, objects with default alignment requirements larger than
15586 this are output potentially unaligned at the next fitting location.
15587
15588 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15589 code that is not binary compatible with code generated without that switch.
15590 Additionally, it makes the code suboptimal.
15591 Use it to conform to a non-default application binary interface.
15592
15593 @item -fleading-underscore
15594 @opindex fleading-underscore
15595 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15596 change the way C symbols are represented in the object file. One use
15597 is to help link with legacy assembly code.
15598
15599 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15600 generate code that is not binary compatible with code generated without that
15601 switch. Use it to conform to a non-default application binary interface.
15602 Not all targets provide complete support for this switch.
15603
15604 @item -ftls-model=@var{model}
15605 @opindex ftls-model
15606 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15607 The @var{model} argument should be one of @samp{global-dynamic},
15608 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15609 Note that the choice is subject to optimization: the compiler may use
15610 a more efficient model for symbols not visible outside of the translation
15611 unit, or if @option{-fpic} is not given on the command line.
15612
15613 The default without @option{-fpic} is @samp{initial-exec}; with
15614 @option{-fpic} the default is @samp{global-dynamic}.
15615
15616 @item -ftrampolines
15617 @opindex ftrampolines
15618 For targets that normally need trampolines for nested functions, always
15619 generate them instead of using descriptors. Otherwise, for targets that
15620 do not need them, like for example HP-PA or IA-64, do nothing.
15621
15622 A trampoline is a small piece of code that is created at run time on the
15623 stack when the address of a nested function is taken, and is used to call
15624 the nested function indirectly. Therefore, it requires the stack to be
15625 made executable in order for the program to work properly.
15626
15627 @option{-fno-trampolines} is enabled by default on a language by language
15628 basis to let the compiler avoid generating them, if it computes that this
15629 is safe, and replace them with descriptors. Descriptors are made up of data
15630 only, but the generated code must be prepared to deal with them. As of this
15631 writing, @option{-fno-trampolines} is enabled by default only for Ada.
15632
15633 Moreover, code compiled with @option{-ftrampolines} and code compiled with
15634 @option{-fno-trampolines} are not binary compatible if nested functions are
15635 present. This option must therefore be used on a program-wide basis and be
15636 manipulated with extreme care.
15637
15638 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15639 @opindex fvisibility
15640 Set the default ELF image symbol visibility to the specified option---all
15641 symbols are marked with this unless overridden within the code.
15642 Using this feature can very substantially improve linking and
15643 load times of shared object libraries, produce more optimized
15644 code, provide near-perfect API export and prevent symbol clashes.
15645 It is @strong{strongly} recommended that you use this in any shared objects
15646 you distribute.
15647
15648 Despite the nomenclature, @samp{default} always means public; i.e.,
15649 available to be linked against from outside the shared object.
15650 @samp{protected} and @samp{internal} are pretty useless in real-world
15651 usage so the only other commonly used option is @samp{hidden}.
15652 The default if @option{-fvisibility} isn't specified is
15653 @samp{default}, i.e., make every symbol public.
15654
15655 A good explanation of the benefits offered by ensuring ELF
15656 symbols have the correct visibility is given by ``How To Write
15657 Shared Libraries'' by Ulrich Drepper (which can be found at
15658 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15659 solution made possible by this option to marking things hidden when
15660 the default is public is to make the default hidden and mark things
15661 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15662 and @code{__attribute__ ((visibility("default")))} instead of
15663 @code{__declspec(dllexport)} you get almost identical semantics with
15664 identical syntax. This is a great boon to those working with
15665 cross-platform projects.
15666
15667 For those adding visibility support to existing code, you may find
15668 @code{#pragma GCC visibility} of use. This works by you enclosing
15669 the declarations you wish to set visibility for with (for example)
15670 @code{#pragma GCC visibility push(hidden)} and
15671 @code{#pragma GCC visibility pop}.
15672 Bear in mind that symbol visibility should be viewed @strong{as
15673 part of the API interface contract} and thus all new code should
15674 always specify visibility when it is not the default; i.e., declarations
15675 only for use within the local DSO should @strong{always} be marked explicitly
15676 as hidden as so to avoid PLT indirection overheads---making this
15677 abundantly clear also aids readability and self-documentation of the code.
15678 Note that due to ISO C++ specification requirements, @code{operator new} and
15679 @code{operator delete} must always be of default visibility.
15680
15681 Be aware that headers from outside your project, in particular system
15682 headers and headers from any other library you use, may not be
15683 expecting to be compiled with visibility other than the default. You
15684 may need to explicitly say @code{#pragma GCC visibility push(default)}
15685 before including any such headers.
15686
15687 @code{extern} declarations are not affected by @option{-fvisibility}, so
15688 a lot of code can be recompiled with @option{-fvisibility=hidden} with
15689 no modifications. However, this means that calls to @code{extern}
15690 functions with no explicit visibility use the PLT, so it is more
15691 effective to use @code{__attribute ((visibility))} and/or
15692 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
15693 declarations should be treated as hidden.
15694
15695 Note that @option{-fvisibility} does affect C++ vague linkage
15696 entities. This means that, for instance, an exception class that is
15697 be thrown between DSOs must be explicitly marked with default
15698 visibility so that the @samp{type_info} nodes are unified between
15699 the DSOs.
15700
15701 An overview of these techniques, their benefits and how to use them
15702 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15703
15704 @item -fstrict-volatile-bitfields
15705 @opindex fstrict-volatile-bitfields
15706 This option should be used if accesses to volatile bit-fields (or other
15707 structure fields, although the compiler usually honors those types
15708 anyway) should use a single access of the width of the
15709 field's type, aligned to a natural alignment if possible. For
15710 example, targets with memory-mapped peripheral registers might require
15711 all such accesses to be 16 bits wide; with this flag you can
15712 declare all peripheral bit-fields as @code{unsigned short} (assuming short
15713 is 16 bits on these targets) to force GCC to use 16-bit accesses
15714 instead of, perhaps, a more efficient 32-bit access.
15715
15716 If this option is disabled, the compiler uses the most efficient
15717 instruction. In the previous example, that might be a 32-bit load
15718 instruction, even though that accesses bytes that do not contain
15719 any portion of the bit-field, or memory-mapped registers unrelated to
15720 the one being updated.
15721
15722 In some cases, such as when the @code{packed} attribute is applied to a
15723 structure field, it may not be possible to access the field with a single
15724 read or write that is correctly aligned for the target machine. In this
15725 case GCC falls back to generating multiple accesses rather than code that
15726 will fault or truncate the result at run time.
15727
15728 Note: Due to restrictions of the C/C++11 memory model, write accesses are
15729 not allowed to touch non bit-field members. It is therefore recommended
15730 to define all bits of the field's type as bit-field members.
15731
15732 The default value of this option is determined by the application binary
15733 interface for the target processor.
15734
15735 @item -fsync-libcalls
15736 @opindex fsync-libcalls
15737 This option controls whether any out-of-line instance of the @code{__sync}
15738 family of functions may be used to implement the C++11 @code{__atomic}
15739 family of functions.
15740
15741 The default value of this option is enabled, thus the only useful form
15742 of the option is @option{-fno-sync-libcalls}. This option is used in
15743 the implementation of the @file{libatomic} runtime library.
15744
15745 @end table
15746
15747 @node Developer Options
15748 @section GCC Developer Options
15749 @cindex developer options
15750 @cindex debugging GCC
15751 @cindex debug dump options
15752 @cindex dump options
15753 @cindex compilation statistics
15754
15755 This section describes command-line options that are primarily of
15756 interest to GCC developers, including options to support compiler
15757 testing and investigation of compiler bugs and compile-time
15758 performance problems. This includes options that produce debug dumps
15759 at various points in the compilation; that print statistics such as
15760 memory use and execution time; and that print information about GCC's
15761 configuration, such as where it searches for libraries. You should
15762 rarely need to use any of these options for ordinary compilation and
15763 linking tasks.
15764
15765 Many developer options that cause GCC to dump output to a file take an
15766 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15767 or @samp{-} to dump to standard output, and @samp{stderr} for standard
15768 error.
15769
15770 If @samp{=@var{filename}} is omitted, a default dump file name is
15771 constructed by concatenating the base dump file name, a pass number,
15772 phase letter, and pass name. The base dump file name is the name of
15773 output file produced by the compiler if explicitly specified and not
15774 an executable; otherwise it is the source file name.
15775 The pass number is determined by the order passes are registered with
15776 the compiler's pass manager.
15777 This is generally the same as the order of execution, but passes
15778 registered by plugins, target-specific passes, or passes that are
15779 otherwise registered late are numbered higher than the pass named
15780 @samp{final}, even if they are executed earlier. The phase letter is
15781 one of @samp{i} (inter-procedural analysis), @samp{l}
15782 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
15783 The files are created in the directory of the output file.
15784
15785 @table @gcctabopt
15786
15787 @item -fcallgraph-info
15788 @itemx -fcallgraph-info=@var{MARKERS}
15789 @opindex fcallgraph-info
15790 Makes the compiler output callgraph information for the program, on a
15791 per-object-file basis. The information is generated in the common VCG
15792 format. It can be decorated with additional, per-node and/or per-edge
15793 information, if a list of comma-separated markers is additionally
15794 specified. When the @code{su} marker is specified, the callgraph is
15795 decorated with stack usage information; it is equivalent to
15796 @option{-fstack-usage}. When the @code{da} marker is specified, the
15797 callgraph is decorated with information about dynamically allocated
15798 objects.
15799
15800 When compiling with @option{-flto}, no callgraph information is output
15801 along with the object file. At LTO link time, @option{-fcallgraph-info}
15802 may generate multiple callgraph information files next to intermediate
15803 LTO output files.
15804
15805 @item -d@var{letters}
15806 @itemx -fdump-rtl-@var{pass}
15807 @itemx -fdump-rtl-@var{pass}=@var{filename}
15808 @opindex d
15809 @opindex fdump-rtl-@var{pass}
15810 Says to make debugging dumps during compilation at times specified by
15811 @var{letters}. This is used for debugging the RTL-based passes of the
15812 compiler.
15813
15814 Some @option{-d@var{letters}} switches have different meaning when
15815 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
15816 for information about preprocessor-specific dump options.
15817
15818 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15819 @option{-d} option @var{letters}. Here are the possible
15820 letters for use in @var{pass} and @var{letters}, and their meanings:
15821
15822 @table @gcctabopt
15823
15824 @item -fdump-rtl-alignments
15825 @opindex fdump-rtl-alignments
15826 Dump after branch alignments have been computed.
15827
15828 @item -fdump-rtl-asmcons
15829 @opindex fdump-rtl-asmcons
15830 Dump after fixing rtl statements that have unsatisfied in/out constraints.
15831
15832 @item -fdump-rtl-auto_inc_dec
15833 @opindex fdump-rtl-auto_inc_dec
15834 Dump after auto-inc-dec discovery. This pass is only run on
15835 architectures that have auto inc or auto dec instructions.
15836
15837 @item -fdump-rtl-barriers
15838 @opindex fdump-rtl-barriers
15839 Dump after cleaning up the barrier instructions.
15840
15841 @item -fdump-rtl-bbpart
15842 @opindex fdump-rtl-bbpart
15843 Dump after partitioning hot and cold basic blocks.
15844
15845 @item -fdump-rtl-bbro
15846 @opindex fdump-rtl-bbro
15847 Dump after block reordering.
15848
15849 @item -fdump-rtl-btl1
15850 @itemx -fdump-rtl-btl2
15851 @opindex fdump-rtl-btl2
15852 @opindex fdump-rtl-btl2
15853 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15854 after the two branch
15855 target load optimization passes.
15856
15857 @item -fdump-rtl-bypass
15858 @opindex fdump-rtl-bypass
15859 Dump after jump bypassing and control flow optimizations.
15860
15861 @item -fdump-rtl-combine
15862 @opindex fdump-rtl-combine
15863 Dump after the RTL instruction combination pass.
15864
15865 @item -fdump-rtl-compgotos
15866 @opindex fdump-rtl-compgotos
15867 Dump after duplicating the computed gotos.
15868
15869 @item -fdump-rtl-ce1
15870 @itemx -fdump-rtl-ce2
15871 @itemx -fdump-rtl-ce3
15872 @opindex fdump-rtl-ce1
15873 @opindex fdump-rtl-ce2
15874 @opindex fdump-rtl-ce3
15875 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15876 @option{-fdump-rtl-ce3} enable dumping after the three
15877 if conversion passes.
15878
15879 @item -fdump-rtl-cprop_hardreg
15880 @opindex fdump-rtl-cprop_hardreg
15881 Dump after hard register copy propagation.
15882
15883 @item -fdump-rtl-csa
15884 @opindex fdump-rtl-csa
15885 Dump after combining stack adjustments.
15886
15887 @item -fdump-rtl-cse1
15888 @itemx -fdump-rtl-cse2
15889 @opindex fdump-rtl-cse1
15890 @opindex fdump-rtl-cse2
15891 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
15892 the two common subexpression elimination passes.
15893
15894 @item -fdump-rtl-dce
15895 @opindex fdump-rtl-dce
15896 Dump after the standalone dead code elimination passes.
15897
15898 @item -fdump-rtl-dbr
15899 @opindex fdump-rtl-dbr
15900 Dump after delayed branch scheduling.
15901
15902 @item -fdump-rtl-dce1
15903 @itemx -fdump-rtl-dce2
15904 @opindex fdump-rtl-dce1
15905 @opindex fdump-rtl-dce2
15906 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
15907 the two dead store elimination passes.
15908
15909 @item -fdump-rtl-eh
15910 @opindex fdump-rtl-eh
15911 Dump after finalization of EH handling code.
15912
15913 @item -fdump-rtl-eh_ranges
15914 @opindex fdump-rtl-eh_ranges
15915 Dump after conversion of EH handling range regions.
15916
15917 @item -fdump-rtl-expand
15918 @opindex fdump-rtl-expand
15919 Dump after RTL generation.
15920
15921 @item -fdump-rtl-fwprop1
15922 @itemx -fdump-rtl-fwprop2
15923 @opindex fdump-rtl-fwprop1
15924 @opindex fdump-rtl-fwprop2
15925 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
15926 dumping after the two forward propagation passes.
15927
15928 @item -fdump-rtl-gcse1
15929 @itemx -fdump-rtl-gcse2
15930 @opindex fdump-rtl-gcse1
15931 @opindex fdump-rtl-gcse2
15932 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
15933 after global common subexpression elimination.
15934
15935 @item -fdump-rtl-init-regs
15936 @opindex fdump-rtl-init-regs
15937 Dump after the initialization of the registers.
15938
15939 @item -fdump-rtl-initvals
15940 @opindex fdump-rtl-initvals
15941 Dump after the computation of the initial value sets.
15942
15943 @item -fdump-rtl-into_cfglayout
15944 @opindex fdump-rtl-into_cfglayout
15945 Dump after converting to cfglayout mode.
15946
15947 @item -fdump-rtl-ira
15948 @opindex fdump-rtl-ira
15949 Dump after iterated register allocation.
15950
15951 @item -fdump-rtl-jump
15952 @opindex fdump-rtl-jump
15953 Dump after the second jump optimization.
15954
15955 @item -fdump-rtl-loop2
15956 @opindex fdump-rtl-loop2
15957 @option{-fdump-rtl-loop2} enables dumping after the rtl
15958 loop optimization passes.
15959
15960 @item -fdump-rtl-mach
15961 @opindex fdump-rtl-mach
15962 Dump after performing the machine dependent reorganization pass, if that
15963 pass exists.
15964
15965 @item -fdump-rtl-mode_sw
15966 @opindex fdump-rtl-mode_sw
15967 Dump after removing redundant mode switches.
15968
15969 @item -fdump-rtl-rnreg
15970 @opindex fdump-rtl-rnreg
15971 Dump after register renumbering.
15972
15973 @item -fdump-rtl-outof_cfglayout
15974 @opindex fdump-rtl-outof_cfglayout
15975 Dump after converting from cfglayout mode.
15976
15977 @item -fdump-rtl-peephole2
15978 @opindex fdump-rtl-peephole2
15979 Dump after the peephole pass.
15980
15981 @item -fdump-rtl-postreload
15982 @opindex fdump-rtl-postreload
15983 Dump after post-reload optimizations.
15984
15985 @item -fdump-rtl-pro_and_epilogue
15986 @opindex fdump-rtl-pro_and_epilogue
15987 Dump after generating the function prologues and epilogues.
15988
15989 @item -fdump-rtl-sched1
15990 @itemx -fdump-rtl-sched2
15991 @opindex fdump-rtl-sched1
15992 @opindex fdump-rtl-sched2
15993 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
15994 after the basic block scheduling passes.
15995
15996 @item -fdump-rtl-ree
15997 @opindex fdump-rtl-ree
15998 Dump after sign/zero extension elimination.
15999
16000 @item -fdump-rtl-seqabstr
16001 @opindex fdump-rtl-seqabstr
16002 Dump after common sequence discovery.
16003
16004 @item -fdump-rtl-shorten
16005 @opindex fdump-rtl-shorten
16006 Dump after shortening branches.
16007
16008 @item -fdump-rtl-sibling
16009 @opindex fdump-rtl-sibling
16010 Dump after sibling call optimizations.
16011
16012 @item -fdump-rtl-split1
16013 @itemx -fdump-rtl-split2
16014 @itemx -fdump-rtl-split3
16015 @itemx -fdump-rtl-split4
16016 @itemx -fdump-rtl-split5
16017 @opindex fdump-rtl-split1
16018 @opindex fdump-rtl-split2
16019 @opindex fdump-rtl-split3
16020 @opindex fdump-rtl-split4
16021 @opindex fdump-rtl-split5
16022 These options enable dumping after five rounds of
16023 instruction splitting.
16024
16025 @item -fdump-rtl-sms
16026 @opindex fdump-rtl-sms
16027 Dump after modulo scheduling. This pass is only run on some
16028 architectures.
16029
16030 @item -fdump-rtl-stack
16031 @opindex fdump-rtl-stack
16032 Dump after conversion from GCC's ``flat register file'' registers to the
16033 x87's stack-like registers. This pass is only run on x86 variants.
16034
16035 @item -fdump-rtl-subreg1
16036 @itemx -fdump-rtl-subreg2
16037 @opindex fdump-rtl-subreg1
16038 @opindex fdump-rtl-subreg2
16039 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
16040 the two subreg expansion passes.
16041
16042 @item -fdump-rtl-unshare
16043 @opindex fdump-rtl-unshare
16044 Dump after all rtl has been unshared.
16045
16046 @item -fdump-rtl-vartrack
16047 @opindex fdump-rtl-vartrack
16048 Dump after variable tracking.
16049
16050 @item -fdump-rtl-vregs
16051 @opindex fdump-rtl-vregs
16052 Dump after converting virtual registers to hard registers.
16053
16054 @item -fdump-rtl-web
16055 @opindex fdump-rtl-web
16056 Dump after live range splitting.
16057
16058 @item -fdump-rtl-regclass
16059 @itemx -fdump-rtl-subregs_of_mode_init
16060 @itemx -fdump-rtl-subregs_of_mode_finish
16061 @itemx -fdump-rtl-dfinit
16062 @itemx -fdump-rtl-dfinish
16063 @opindex fdump-rtl-regclass
16064 @opindex fdump-rtl-subregs_of_mode_init
16065 @opindex fdump-rtl-subregs_of_mode_finish
16066 @opindex fdump-rtl-dfinit
16067 @opindex fdump-rtl-dfinish
16068 These dumps are defined but always produce empty files.
16069
16070 @item -da
16071 @itemx -fdump-rtl-all
16072 @opindex da
16073 @opindex fdump-rtl-all
16074 Produce all the dumps listed above.
16075
16076 @item -dA
16077 @opindex dA
16078 Annotate the assembler output with miscellaneous debugging information.
16079
16080 @item -dD
16081 @opindex dD
16082 Dump all macro definitions, at the end of preprocessing, in addition to
16083 normal output.
16084
16085 @item -dH
16086 @opindex dH
16087 Produce a core dump whenever an error occurs.
16088
16089 @item -dp
16090 @opindex dp
16091 Annotate the assembler output with a comment indicating which
16092 pattern and alternative is used. The length and cost of each instruction are
16093 also printed.
16094
16095 @item -dP
16096 @opindex dP
16097 Dump the RTL in the assembler output as a comment before each instruction.
16098 Also turns on @option{-dp} annotation.
16099
16100 @item -dx
16101 @opindex dx
16102 Just generate RTL for a function instead of compiling it. Usually used
16103 with @option{-fdump-rtl-expand}.
16104 @end table
16105
16106 @item -fdump-debug
16107 @opindex fdump-debug
16108 Dump debugging information generated during the debug
16109 generation phase.
16110
16111 @item -fdump-earlydebug
16112 @opindex fdump-earlydebug
16113 Dump debugging information generated during the early debug
16114 generation phase.
16115
16116 @item -fdump-noaddr
16117 @opindex fdump-noaddr
16118 When doing debugging dumps, suppress address output. This makes it more
16119 feasible to use diff on debugging dumps for compiler invocations with
16120 different compiler binaries and/or different
16121 text / bss / data / heap / stack / dso start locations.
16122
16123 @item -freport-bug
16124 @opindex freport-bug
16125 Collect and dump debug information into a temporary file if an
16126 internal compiler error (ICE) occurs.
16127
16128 @item -fdump-unnumbered
16129 @opindex fdump-unnumbered
16130 When doing debugging dumps, suppress instruction numbers and address output.
16131 This makes it more feasible to use diff on debugging dumps for compiler
16132 invocations with different options, in particular with and without
16133 @option{-g}.
16134
16135 @item -fdump-unnumbered-links
16136 @opindex fdump-unnumbered-links
16137 When doing debugging dumps (see @option{-d} option above), suppress
16138 instruction numbers for the links to the previous and next instructions
16139 in a sequence.
16140
16141 @item -fdump-ipa-@var{switch}
16142 @itemx -fdump-ipa-@var{switch}-@var{options}
16143 @opindex fdump-ipa
16144 Control the dumping at various stages of inter-procedural analysis
16145 language tree to a file. The file name is generated by appending a
16146 switch specific suffix to the source file name, and the file is created
16147 in the same directory as the output file. The following dumps are
16148 possible:
16149
16150 @table @samp
16151 @item all
16152 Enables all inter-procedural analysis dumps.
16153
16154 @item cgraph
16155 Dumps information about call-graph optimization, unused function removal,
16156 and inlining decisions.
16157
16158 @item inline
16159 Dump after function inlining.
16160
16161 @end table
16162
16163 Additionally, the options @option{-optimized}, @option{-missed},
16164 @option{-note}, and @option{-all} can be provided, with the same meaning
16165 as for @option{-fopt-info}, defaulting to @option{-optimized}.
16166
16167 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
16168 information on callsites that were inlined, along with callsites
16169 that were not inlined.
16170
16171 By default, the dump will contain messages about successful
16172 optimizations (equivalent to @option{-optimized}) together with
16173 low-level details about the analysis.
16174
16175 @item -fdump-lang-all
16176 @itemx -fdump-lang-@var{switch}
16177 @itemx -fdump-lang-@var{switch}-@var{options}
16178 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
16179 @opindex fdump-lang-all
16180 @opindex fdump-lang
16181 Control the dumping of language-specific information. The @var{options}
16182 and @var{filename} portions behave as described in the
16183 @option{-fdump-tree} option. The following @var{switch} values are
16184 accepted:
16185
16186 @table @samp
16187 @item all
16188
16189 Enable all language-specific dumps.
16190
16191 @item class
16192 Dump class hierarchy information. Virtual table information is emitted
16193 unless '@option{slim}' is specified. This option is applicable to C++ only.
16194
16195 @item raw
16196 Dump the raw internal tree data. This option is applicable to C++ only.
16197
16198 @end table
16199
16200 @item -fdump-passes
16201 @opindex fdump-passes
16202 Print on @file{stderr} the list of optimization passes that are turned
16203 on and off by the current command-line options.
16204
16205 @item -fdump-statistics-@var{option}
16206 @opindex fdump-statistics
16207 Enable and control dumping of pass statistics in a separate file. The
16208 file name is generated by appending a suffix ending in
16209 @samp{.statistics} to the source file name, and the file is created in
16210 the same directory as the output file. If the @samp{-@var{option}}
16211 form is used, @samp{-stats} causes counters to be summed over the
16212 whole compilation unit while @samp{-details} dumps every event as
16213 the passes generate them. The default with no option is to sum
16214 counters for each function compiled.
16215
16216 @item -fdump-tree-all
16217 @itemx -fdump-tree-@var{switch}
16218 @itemx -fdump-tree-@var{switch}-@var{options}
16219 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
16220 @opindex fdump-tree-all
16221 @opindex fdump-tree
16222 Control the dumping at various stages of processing the intermediate
16223 language tree to a file. If the @samp{-@var{options}}
16224 form is used, @var{options} is a list of @samp{-} separated options
16225 which control the details of the dump. Not all options are applicable
16226 to all dumps; those that are not meaningful are ignored. The
16227 following options are available
16228
16229 @table @samp
16230 @item address
16231 Print the address of each node. Usually this is not meaningful as it
16232 changes according to the environment and source file. Its primary use
16233 is for tying up a dump file with a debug environment.
16234 @item asmname
16235 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
16236 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
16237 use working backward from mangled names in the assembly file.
16238 @item slim
16239 When dumping front-end intermediate representations, inhibit dumping
16240 of members of a scope or body of a function merely because that scope
16241 has been reached. Only dump such items when they are directly reachable
16242 by some other path.
16243
16244 When dumping pretty-printed trees, this option inhibits dumping the
16245 bodies of control structures.
16246
16247 When dumping RTL, print the RTL in slim (condensed) form instead of
16248 the default LISP-like representation.
16249 @item raw
16250 Print a raw representation of the tree. By default, trees are
16251 pretty-printed into a C-like representation.
16252 @item details
16253 Enable more detailed dumps (not honored by every dump option). Also
16254 include information from the optimization passes.
16255 @item stats
16256 Enable dumping various statistics about the pass (not honored by every dump
16257 option).
16258 @item blocks
16259 Enable showing basic block boundaries (disabled in raw dumps).
16260 @item graph
16261 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
16262 dump a representation of the control flow graph suitable for viewing with
16263 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
16264 the file is pretty-printed as a subgraph, so that GraphViz can render them
16265 all in a single plot.
16266
16267 This option currently only works for RTL dumps, and the RTL is always
16268 dumped in slim form.
16269 @item vops
16270 Enable showing virtual operands for every statement.
16271 @item lineno
16272 Enable showing line numbers for statements.
16273 @item uid
16274 Enable showing the unique ID (@code{DECL_UID}) for each variable.
16275 @item verbose
16276 Enable showing the tree dump for each statement.
16277 @item eh
16278 Enable showing the EH region number holding each statement.
16279 @item scev
16280 Enable showing scalar evolution analysis details.
16281 @item optimized
16282 Enable showing optimization information (only available in certain
16283 passes).
16284 @item missed
16285 Enable showing missed optimization information (only available in certain
16286 passes).
16287 @item note
16288 Enable other detailed optimization information (only available in
16289 certain passes).
16290 @item all
16291 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
16292 and @option{lineno}.
16293 @item optall
16294 Turn on all optimization options, i.e., @option{optimized},
16295 @option{missed}, and @option{note}.
16296 @end table
16297
16298 To determine what tree dumps are available or find the dump for a pass
16299 of interest follow the steps below.
16300
16301 @enumerate
16302 @item
16303 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
16304 look for a code that corresponds to the pass you are interested in.
16305 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
16306 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
16307 The number at the end distinguishes distinct invocations of the same pass.
16308 @item
16309 To enable the creation of the dump file, append the pass code to
16310 the @option{-fdump-} option prefix and invoke GCC with it. For example,
16311 to enable the dump from the Early Value Range Propagation pass, invoke
16312 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
16313 specify the name of the dump file. If you don't specify one, GCC
16314 creates as described below.
16315 @item
16316 Find the pass dump in a file whose name is composed of three components
16317 separated by a period: the name of the source file GCC was invoked to
16318 compile, a numeric suffix indicating the pass number followed by the
16319 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
16320 and finally the pass code. For example, the Early VRP pass dump might
16321 be in a file named @file{myfile.c.038t.evrp} in the current working
16322 directory. Note that the numeric codes are not stable and may change
16323 from one version of GCC to another.
16324 @end enumerate
16325
16326 @item -fopt-info
16327 @itemx -fopt-info-@var{options}
16328 @itemx -fopt-info-@var{options}=@var{filename}
16329 @opindex fopt-info
16330 Controls optimization dumps from various optimization passes. If the
16331 @samp{-@var{options}} form is used, @var{options} is a list of
16332 @samp{-} separated option keywords to select the dump details and
16333 optimizations.
16334
16335 The @var{options} can be divided into three groups:
16336 @enumerate
16337 @item
16338 options describing what kinds of messages should be emitted,
16339 @item
16340 options describing the verbosity of the dump, and
16341 @item
16342 options describing which optimizations should be included.
16343 @end enumerate
16344 The options from each group can be freely mixed as they are
16345 non-overlapping. However, in case of any conflicts,
16346 the later options override the earlier options on the command
16347 line.
16348
16349 The following options control which kinds of messages should be emitted:
16350
16351 @table @samp
16352 @item optimized
16353 Print information when an optimization is successfully applied. It is
16354 up to a pass to decide which information is relevant. For example, the
16355 vectorizer passes print the source location of loops which are
16356 successfully vectorized.
16357 @item missed
16358 Print information about missed optimizations. Individual passes
16359 control which information to include in the output.
16360 @item note
16361 Print verbose information about optimizations, such as certain
16362 transformations, more detailed messages about decisions etc.
16363 @item all
16364 Print detailed optimization information. This includes
16365 @samp{optimized}, @samp{missed}, and @samp{note}.
16366 @end table
16367
16368 The following option controls the dump verbosity:
16369
16370 @table @samp
16371 @item internals
16372 By default, only ``high-level'' messages are emitted. This option enables
16373 additional, more detailed, messages, which are likely to only be of interest
16374 to GCC developers.
16375 @end table
16376
16377 One or more of the following option keywords can be used to describe a
16378 group of optimizations:
16379
16380 @table @samp
16381 @item ipa
16382 Enable dumps from all interprocedural optimizations.
16383 @item loop
16384 Enable dumps from all loop optimizations.
16385 @item inline
16386 Enable dumps from all inlining optimizations.
16387 @item omp
16388 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
16389 @item vec
16390 Enable dumps from all vectorization optimizations.
16391 @item optall
16392 Enable dumps from all optimizations. This is a superset of
16393 the optimization groups listed above.
16394 @end table
16395
16396 If @var{options} is
16397 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
16398 about successful optimizations from all the passes, omitting messages
16399 that are treated as ``internals''.
16400
16401 If the @var{filename} is provided, then the dumps from all the
16402 applicable optimizations are concatenated into the @var{filename}.
16403 Otherwise the dump is output onto @file{stderr}. Though multiple
16404 @option{-fopt-info} options are accepted, only one of them can include
16405 a @var{filename}. If other filenames are provided then all but the
16406 first such option are ignored.
16407
16408 Note that the output @var{filename} is overwritten
16409 in case of multiple translation units. If a combined output from
16410 multiple translation units is desired, @file{stderr} should be used
16411 instead.
16412
16413 In the following example, the optimization info is output to
16414 @file{stderr}:
16415
16416 @smallexample
16417 gcc -O3 -fopt-info
16418 @end smallexample
16419
16420 This example:
16421 @smallexample
16422 gcc -O3 -fopt-info-missed=missed.all
16423 @end smallexample
16424
16425 @noindent
16426 outputs missed optimization report from all the passes into
16427 @file{missed.all}, and this one:
16428
16429 @smallexample
16430 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16431 @end smallexample
16432
16433 @noindent
16434 prints information about missed optimization opportunities from
16435 vectorization passes on @file{stderr}.
16436 Note that @option{-fopt-info-vec-missed} is equivalent to
16437 @option{-fopt-info-missed-vec}. The order of the optimization group
16438 names and message types listed after @option{-fopt-info} does not matter.
16439
16440 As another example,
16441 @smallexample
16442 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16443 @end smallexample
16444
16445 @noindent
16446 outputs information about missed optimizations as well as
16447 optimized locations from all the inlining passes into
16448 @file{inline.txt}.
16449
16450 Finally, consider:
16451
16452 @smallexample
16453 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16454 @end smallexample
16455
16456 @noindent
16457 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
16458 in conflict since only one output file is allowed. In this case, only
16459 the first option takes effect and the subsequent options are
16460 ignored. Thus only @file{vec.miss} is produced which contains
16461 dumps from the vectorizer about missed opportunities.
16462
16463 @item -fsave-optimization-record
16464 @opindex fsave-optimization-record
16465 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
16466 were performed, for those optimizations that support @option{-fopt-info}.
16467
16468 This option is experimental and the format of the data within the
16469 compressed JSON file is subject to change.
16470
16471 It is roughly equivalent to a machine-readable version of
16472 @option{-fopt-info-all}, as a collection of messages with source file,
16473 line number and column number, with the following additional data for
16474 each message:
16475
16476 @itemize @bullet
16477
16478 @item
16479 the execution count of the code being optimized, along with metadata about
16480 whether this was from actual profile data, or just an estimate, allowing
16481 consumers to prioritize messages by code hotness,
16482
16483 @item
16484 the function name of the code being optimized, where applicable,
16485
16486 @item
16487 the ``inlining chain'' for the code being optimized, so that when
16488 a function is inlined into several different places (which might
16489 themselves be inlined), the reader can distinguish between the copies,
16490
16491 @item
16492 objects identifying those parts of the message that refer to expressions,
16493 statements or symbol-table nodes, which of these categories they are, and,
16494 when available, their source code location,
16495
16496 @item
16497 the GCC pass that emitted the message, and
16498
16499 @item
16500 the location in GCC's own code from which the message was emitted
16501
16502 @end itemize
16503
16504 Additionally, some messages are logically nested within other
16505 messages, reflecting implementation details of the optimization
16506 passes.
16507
16508 @item -fsched-verbose=@var{n}
16509 @opindex fsched-verbose
16510 On targets that use instruction scheduling, this option controls the
16511 amount of debugging output the scheduler prints to the dump files.
16512
16513 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16514 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16515 For @var{n} greater than one, it also output basic block probabilities,
16516 detailed ready list information and unit/insn info. For @var{n} greater
16517 than two, it includes RTL at abort point, control-flow and regions info.
16518 And for @var{n} over four, @option{-fsched-verbose} also includes
16519 dependence info.
16520
16521
16522
16523 @item -fenable-@var{kind}-@var{pass}
16524 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16525 @opindex fdisable-
16526 @opindex fenable-
16527
16528 This is a set of options that are used to explicitly disable/enable
16529 optimization passes. These options are intended for use for debugging GCC.
16530 Compiler users should use regular options for enabling/disabling
16531 passes instead.
16532
16533 @table @gcctabopt
16534
16535 @item -fdisable-ipa-@var{pass}
16536 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16537 statically invoked in the compiler multiple times, the pass name should be
16538 appended with a sequential number starting from 1.
16539
16540 @item -fdisable-rtl-@var{pass}
16541 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
16542 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
16543 statically invoked in the compiler multiple times, the pass name should be
16544 appended with a sequential number starting from 1. @var{range-list} is a
16545 comma-separated list of function ranges or assembler names. Each range is a number
16546 pair separated by a colon. The range is inclusive in both ends. If the range
16547 is trivial, the number pair can be simplified as a single number. If the
16548 function's call graph node's @var{uid} falls within one of the specified ranges,
16549 the @var{pass} is disabled for that function. The @var{uid} is shown in the
16550 function header of a dump file, and the pass names can be dumped by using
16551 option @option{-fdump-passes}.
16552
16553 @item -fdisable-tree-@var{pass}
16554 @itemx -fdisable-tree-@var{pass}=@var{range-list}
16555 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
16556 option arguments.
16557
16558 @item -fenable-ipa-@var{pass}
16559 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16560 statically invoked in the compiler multiple times, the pass name should be
16561 appended with a sequential number starting from 1.
16562
16563 @item -fenable-rtl-@var{pass}
16564 @itemx -fenable-rtl-@var{pass}=@var{range-list}
16565 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
16566 description and examples.
16567
16568 @item -fenable-tree-@var{pass}
16569 @itemx -fenable-tree-@var{pass}=@var{range-list}
16570 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
16571 of option arguments.
16572
16573 @end table
16574
16575 Here are some examples showing uses of these options.
16576
16577 @smallexample
16578
16579 # disable ccp1 for all functions
16580 -fdisable-tree-ccp1
16581 # disable complete unroll for function whose cgraph node uid is 1
16582 -fenable-tree-cunroll=1
16583 # disable gcse2 for functions at the following ranges [1,1],
16584 # [300,400], and [400,1000]
16585 # disable gcse2 for functions foo and foo2
16586 -fdisable-rtl-gcse2=foo,foo2
16587 # disable early inlining
16588 -fdisable-tree-einline
16589 # disable ipa inlining
16590 -fdisable-ipa-inline
16591 # enable tree full unroll
16592 -fenable-tree-unroll
16593
16594 @end smallexample
16595
16596 @item -fchecking
16597 @itemx -fchecking=@var{n}
16598 @opindex fchecking
16599 @opindex fno-checking
16600 Enable internal consistency checking. The default depends on
16601 the compiler configuration. @option{-fchecking=2} enables further
16602 internal consistency checking that might affect code generation.
16603
16604 @item -frandom-seed=@var{string}
16605 @opindex frandom-seed
16606 This option provides a seed that GCC uses in place of
16607 random numbers in generating certain symbol names
16608 that have to be different in every compiled file. It is also used to
16609 place unique stamps in coverage data files and the object files that
16610 produce them. You can use the @option{-frandom-seed} option to produce
16611 reproducibly identical object files.
16612
16613 The @var{string} can either be a number (decimal, octal or hex) or an
16614 arbitrary string (in which case it's converted to a number by
16615 computing CRC32).
16616
16617 The @var{string} should be different for every file you compile.
16618
16619 @item -save-temps
16620 @opindex save-temps
16621 Store the usual ``temporary'' intermediate files permanently; name them
16622 as auxiliary output files, as specified described under
16623 @option{-dumpbase} and @option{-dumpdir}.
16624
16625 When used in combination with the @option{-x} command-line option,
16626 @option{-save-temps} is sensible enough to avoid overwriting an
16627 input source file with the same extension as an intermediate file.
16628 The corresponding intermediate file may be obtained by renaming the
16629 source file before using @option{-save-temps}.
16630
16631 @item -save-temps=cwd
16632 @opindex save-temps=cwd
16633 Equivalent to @option{-save-temps -dumpdir ./}.
16634
16635 @item -save-temps=obj
16636 @opindex save-temps=obj
16637 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
16638 @file{outdir/} is the directory of the output file specified after the
16639 @option{-o} option, including any directory separators. If the
16640 @option{-o} option is not used, the @option{-save-temps=obj} switch
16641 behaves like @option{-save-temps=cwd}.
16642
16643 @item -time@r{[}=@var{file}@r{]}
16644 @opindex time
16645 Report the CPU time taken by each subprocess in the compilation
16646 sequence. For C source files, this is the compiler proper and assembler
16647 (plus the linker if linking is done).
16648
16649 Without the specification of an output file, the output looks like this:
16650
16651 @smallexample
16652 # cc1 0.12 0.01
16653 # as 0.00 0.01
16654 @end smallexample
16655
16656 The first number on each line is the ``user time'', that is time spent
16657 executing the program itself. The second number is ``system time'',
16658 time spent executing operating system routines on behalf of the program.
16659 Both numbers are in seconds.
16660
16661 With the specification of an output file, the output is appended to the
16662 named file, and it looks like this:
16663
16664 @smallexample
16665 0.12 0.01 cc1 @var{options}
16666 0.00 0.01 as @var{options}
16667 @end smallexample
16668
16669 The ``user time'' and the ``system time'' are moved before the program
16670 name, and the options passed to the program are displayed, so that one
16671 can later tell what file was being compiled, and with which options.
16672
16673 @item -fdump-final-insns@r{[}=@var{file}@r{]}
16674 @opindex fdump-final-insns
16675 Dump the final internal representation (RTL) to @var{file}. If the
16676 optional argument is omitted (or if @var{file} is @code{.}), the name
16677 of the dump file is determined by appending @code{.gkd} to the
16678 dump base name, see @option{-dumpbase}.
16679
16680 @item -fcompare-debug@r{[}=@var{opts}@r{]}
16681 @opindex fcompare-debug
16682 @opindex fno-compare-debug
16683 If no error occurs during compilation, run the compiler a second time,
16684 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16685 passed to the second compilation. Dump the final internal
16686 representation in both compilations, and print an error if they differ.
16687
16688 If the equal sign is omitted, the default @option{-gtoggle} is used.
16689
16690 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16691 and nonzero, implicitly enables @option{-fcompare-debug}. If
16692 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16693 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16694 is used.
16695
16696 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
16697 is equivalent to @option{-fno-compare-debug}, which disables the dumping
16698 of the final representation and the second compilation, preventing even
16699 @env{GCC_COMPARE_DEBUG} from taking effect.
16700
16701 To verify full coverage during @option{-fcompare-debug} testing, set
16702 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16703 which GCC rejects as an invalid option in any actual compilation
16704 (rather than preprocessing, assembly or linking). To get just a
16705 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16706 not overridden} will do.
16707
16708 @item -fcompare-debug-second
16709 @opindex fcompare-debug-second
16710 This option is implicitly passed to the compiler for the second
16711 compilation requested by @option{-fcompare-debug}, along with options to
16712 silence warnings, and omitting other options that would cause the compiler
16713 to produce output to files or to standard output as a side effect. Dump
16714 files and preserved temporary files are renamed so as to contain the
16715 @code{.gk} additional extension during the second compilation, to avoid
16716 overwriting those generated by the first.
16717
16718 When this option is passed to the compiler driver, it causes the
16719 @emph{first} compilation to be skipped, which makes it useful for little
16720 other than debugging the compiler proper.
16721
16722 @item -gtoggle
16723 @opindex gtoggle
16724 Turn off generation of debug info, if leaving out this option
16725 generates it, or turn it on at level 2 otherwise. The position of this
16726 argument in the command line does not matter; it takes effect after all
16727 other options are processed, and it does so only once, no matter how
16728 many times it is given. This is mainly intended to be used with
16729 @option{-fcompare-debug}.
16730
16731 @item -fvar-tracking-assignments-toggle
16732 @opindex fvar-tracking-assignments-toggle
16733 @opindex fno-var-tracking-assignments-toggle
16734 Toggle @option{-fvar-tracking-assignments}, in the same way that
16735 @option{-gtoggle} toggles @option{-g}.
16736
16737 @item -Q
16738 @opindex Q
16739 Makes the compiler print out each function name as it is compiled, and
16740 print some statistics about each pass when it finishes.
16741
16742 @item -ftime-report
16743 @opindex ftime-report
16744 Makes the compiler print some statistics about the time consumed by each
16745 pass when it finishes.
16746
16747 @item -ftime-report-details
16748 @opindex ftime-report-details
16749 Record the time consumed by infrastructure parts separately for each pass.
16750
16751 @item -fira-verbose=@var{n}
16752 @opindex fira-verbose
16753 Control the verbosity of the dump file for the integrated register allocator.
16754 The default value is 5. If the value @var{n} is greater or equal to 10,
16755 the dump output is sent to stderr using the same format as @var{n} minus 10.
16756
16757 @item -flto-report
16758 @opindex flto-report
16759 Prints a report with internal details on the workings of the link-time
16760 optimizer. The contents of this report vary from version to version.
16761 It is meant to be useful to GCC developers when processing object
16762 files in LTO mode (via @option{-flto}).
16763
16764 Disabled by default.
16765
16766 @item -flto-report-wpa
16767 @opindex flto-report-wpa
16768 Like @option{-flto-report}, but only print for the WPA phase of link-time
16769 optimization.
16770
16771 @item -fmem-report
16772 @opindex fmem-report
16773 Makes the compiler print some statistics about permanent memory
16774 allocation when it finishes.
16775
16776 @item -fmem-report-wpa
16777 @opindex fmem-report-wpa
16778 Makes the compiler print some statistics about permanent memory
16779 allocation for the WPA phase only.
16780
16781 @item -fpre-ipa-mem-report
16782 @opindex fpre-ipa-mem-report
16783 @item -fpost-ipa-mem-report
16784 @opindex fpost-ipa-mem-report
16785 Makes the compiler print some statistics about permanent memory
16786 allocation before or after interprocedural optimization.
16787
16788 @item -fprofile-report
16789 @opindex fprofile-report
16790 Makes the compiler print some statistics about consistency of the
16791 (estimated) profile and effect of individual passes.
16792
16793 @item -fstack-usage
16794 @opindex fstack-usage
16795 Makes the compiler output stack usage information for the program, on a
16796 per-function basis. The filename for the dump is made by appending
16797 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
16798 the output file, if explicitly specified and it is not an executable,
16799 otherwise it is the basename of the source file. An entry is made up
16800 of three fields:
16801
16802 @itemize
16803 @item
16804 The name of the function.
16805 @item
16806 A number of bytes.
16807 @item
16808 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16809 @end itemize
16810
16811 The qualifier @code{static} means that the function manipulates the stack
16812 statically: a fixed number of bytes are allocated for the frame on function
16813 entry and released on function exit; no stack adjustments are otherwise made
16814 in the function. The second field is this fixed number of bytes.
16815
16816 The qualifier @code{dynamic} means that the function manipulates the stack
16817 dynamically: in addition to the static allocation described above, stack
16818 adjustments are made in the body of the function, for example to push/pop
16819 arguments around function calls. If the qualifier @code{bounded} is also
16820 present, the amount of these adjustments is bounded at compile time and
16821 the second field is an upper bound of the total amount of stack used by
16822 the function. If it is not present, the amount of these adjustments is
16823 not bounded at compile time and the second field only represents the
16824 bounded part.
16825
16826 @item -fstats
16827 @opindex fstats
16828 Emit statistics about front-end processing at the end of the compilation.
16829 This option is supported only by the C++ front end, and
16830 the information is generally only useful to the G++ development team.
16831
16832 @item -fdbg-cnt-list
16833 @opindex fdbg-cnt-list
16834 Print the name and the counter upper bound for all debug counters.
16835
16836
16837 @item -fdbg-cnt=@var{counter-value-list}
16838 @opindex fdbg-cnt
16839 Set the internal debug counter lower and upper bound. @var{counter-value-list}
16840 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16841 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16842 the name of the counter and list of closed intervals.
16843 The @var{lower_bound} is optional and is zero
16844 initialized if not set.
16845 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16846 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16847 eleventh invocation.
16848 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16849
16850 @item -print-file-name=@var{library}
16851 @opindex print-file-name
16852 Print the full absolute name of the library file @var{library} that
16853 would be used when linking---and don't do anything else. With this
16854 option, GCC does not compile or link anything; it just prints the
16855 file name.
16856
16857 @item -print-multi-directory
16858 @opindex print-multi-directory
16859 Print the directory name corresponding to the multilib selected by any
16860 other switches present in the command line. This directory is supposed
16861 to exist in @env{GCC_EXEC_PREFIX}.
16862
16863 @item -print-multi-lib
16864 @opindex print-multi-lib
16865 Print the mapping from multilib directory names to compiler switches
16866 that enable them. The directory name is separated from the switches by
16867 @samp{;}, and each switch starts with an @samp{@@} instead of the
16868 @samp{-}, without spaces between multiple switches. This is supposed to
16869 ease shell processing.
16870
16871 @item -print-multi-os-directory
16872 @opindex print-multi-os-directory
16873 Print the path to OS libraries for the selected
16874 multilib, relative to some @file{lib} subdirectory. If OS libraries are
16875 present in the @file{lib} subdirectory and no multilibs are used, this is
16876 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16877 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16878 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16879 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16880
16881 @item -print-multiarch
16882 @opindex print-multiarch
16883 Print the path to OS libraries for the selected multiarch,
16884 relative to some @file{lib} subdirectory.
16885
16886 @item -print-prog-name=@var{program}
16887 @opindex print-prog-name
16888 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
16889
16890 @item -print-libgcc-file-name
16891 @opindex print-libgcc-file-name
16892 Same as @option{-print-file-name=libgcc.a}.
16893
16894 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
16895 but you do want to link with @file{libgcc.a}. You can do:
16896
16897 @smallexample
16898 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
16899 @end smallexample
16900
16901 @item -print-search-dirs
16902 @opindex print-search-dirs
16903 Print the name of the configured installation directory and a list of
16904 program and library directories @command{gcc} searches---and don't do anything else.
16905
16906 This is useful when @command{gcc} prints the error message
16907 @samp{installation problem, cannot exec cpp0: No such file or directory}.
16908 To resolve this you either need to put @file{cpp0} and the other compiler
16909 components where @command{gcc} expects to find them, or you can set the environment
16910 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
16911 Don't forget the trailing @samp{/}.
16912 @xref{Environment Variables}.
16913
16914 @item -print-sysroot
16915 @opindex print-sysroot
16916 Print the target sysroot directory that is used during
16917 compilation. This is the target sysroot specified either at configure
16918 time or using the @option{--sysroot} option, possibly with an extra
16919 suffix that depends on compilation options. If no target sysroot is
16920 specified, the option prints nothing.
16921
16922 @item -print-sysroot-headers-suffix
16923 @opindex print-sysroot-headers-suffix
16924 Print the suffix added to the target sysroot when searching for
16925 headers, or give an error if the compiler is not configured with such
16926 a suffix---and don't do anything else.
16927
16928 @item -dumpmachine
16929 @opindex dumpmachine
16930 Print the compiler's target machine (for example,
16931 @samp{i686-pc-linux-gnu})---and don't do anything else.
16932
16933 @item -dumpversion
16934 @opindex dumpversion
16935 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
16936 anything else. This is the compiler version used in filesystem paths and
16937 specs. Depending on how the compiler has been configured it can be just
16938 a single number (major version), two numbers separated by a dot (major and
16939 minor version) or three numbers separated by dots (major, minor and patchlevel
16940 version).
16941
16942 @item -dumpfullversion
16943 @opindex dumpfullversion
16944 Print the full compiler version---and don't do anything else. The output is
16945 always three numbers separated by dots, major, minor and patchlevel version.
16946
16947 @item -dumpspecs
16948 @opindex dumpspecs
16949 Print the compiler's built-in specs---and don't do anything else. (This
16950 is used when GCC itself is being built.) @xref{Spec Files}.
16951 @end table
16952
16953 @node Submodel Options
16954 @section Machine-Dependent Options
16955 @cindex submodel options
16956 @cindex specifying hardware config
16957 @cindex hardware models and configurations, specifying
16958 @cindex target-dependent options
16959 @cindex machine-dependent options
16960
16961 Each target machine supported by GCC can have its own options---for
16962 example, to allow you to compile for a particular processor variant or
16963 ABI, or to control optimizations specific to that machine. By
16964 convention, the names of machine-specific options start with
16965 @samp{-m}.
16966
16967 Some configurations of the compiler also support additional target-specific
16968 options, usually for compatibility with other compilers on the same
16969 platform.
16970
16971 @c This list is ordered alphanumerically by subsection name.
16972 @c It should be the same order and spelling as these options are listed
16973 @c in Machine Dependent Options
16974
16975 @menu
16976 * AArch64 Options::
16977 * Adapteva Epiphany Options::
16978 * AMD GCN Options::
16979 * ARC Options::
16980 * ARM Options::
16981 * AVR Options::
16982 * Blackfin Options::
16983 * C6X Options::
16984 * CRIS Options::
16985 * CR16 Options::
16986 * C-SKY Options::
16987 * Darwin Options::
16988 * DEC Alpha Options::
16989 * eBPF Options::
16990 * FR30 Options::
16991 * FT32 Options::
16992 * FRV Options::
16993 * GNU/Linux Options::
16994 * H8/300 Options::
16995 * HPPA Options::
16996 * IA-64 Options::
16997 * LM32 Options::
16998 * M32C Options::
16999 * M32R/D Options::
17000 * M680x0 Options::
17001 * MCore Options::
17002 * MeP Options::
17003 * MicroBlaze Options::
17004 * MIPS Options::
17005 * MMIX Options::
17006 * MN10300 Options::
17007 * Moxie Options::
17008 * MSP430 Options::
17009 * NDS32 Options::
17010 * Nios II Options::
17011 * Nvidia PTX Options::
17012 * OpenRISC Options::
17013 * PDP-11 Options::
17014 * picoChip Options::
17015 * PowerPC Options::
17016 * PRU Options::
17017 * RISC-V Options::
17018 * RL78 Options::
17019 * RS/6000 and PowerPC Options::
17020 * RX Options::
17021 * S/390 and zSeries Options::
17022 * Score Options::
17023 * SH Options::
17024 * Solaris 2 Options::
17025 * SPARC Options::
17026 * System V Options::
17027 * TILE-Gx Options::
17028 * TILEPro Options::
17029 * V850 Options::
17030 * VAX Options::
17031 * Visium Options::
17032 * VMS Options::
17033 * VxWorks Options::
17034 * x86 Options::
17035 * x86 Windows Options::
17036 * Xstormy16 Options::
17037 * Xtensa Options::
17038 * zSeries Options::
17039 @end menu
17040
17041 @node AArch64 Options
17042 @subsection AArch64 Options
17043 @cindex AArch64 Options
17044
17045 These options are defined for AArch64 implementations:
17046
17047 @table @gcctabopt
17048
17049 @item -mabi=@var{name}
17050 @opindex mabi
17051 Generate code for the specified data model. Permissible values
17052 are @samp{ilp32} for SysV-like data model where int, long int and pointers
17053 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
17054 but long int and pointers are 64 bits.
17055
17056 The default depends on the specific target configuration. Note that
17057 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
17058 entire program with the same ABI, and link with a compatible set of libraries.
17059
17060 @item -mbig-endian
17061 @opindex mbig-endian
17062 Generate big-endian code. This is the default when GCC is configured for an
17063 @samp{aarch64_be-*-*} target.
17064
17065 @item -mgeneral-regs-only
17066 @opindex mgeneral-regs-only
17067 Generate code which uses only the general-purpose registers. This will prevent
17068 the compiler from using floating-point and Advanced SIMD registers but will not
17069 impose any restrictions on the assembler.
17070
17071 @item -mlittle-endian
17072 @opindex mlittle-endian
17073 Generate little-endian code. This is the default when GCC is configured for an
17074 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
17075
17076 @item -mcmodel=tiny
17077 @opindex mcmodel=tiny
17078 Generate code for the tiny code model. The program and its statically defined
17079 symbols must be within 1MB of each other. Programs can be statically or
17080 dynamically linked.
17081
17082 @item -mcmodel=small
17083 @opindex mcmodel=small
17084 Generate code for the small code model. The program and its statically defined
17085 symbols must be within 4GB of each other. Programs can be statically or
17086 dynamically linked. This is the default code model.
17087
17088 @item -mcmodel=large
17089 @opindex mcmodel=large
17090 Generate code for the large code model. This makes no assumptions about
17091 addresses and sizes of sections. Programs can be statically linked only. The
17092 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
17093 @option{-fpic} and @option{-fPIC}.
17094
17095 @item -mstrict-align
17096 @itemx -mno-strict-align
17097 @opindex mstrict-align
17098 @opindex mno-strict-align
17099 Avoid or allow generating memory accesses that may not be aligned on a natural
17100 object boundary as described in the architecture specification.
17101
17102 @item -momit-leaf-frame-pointer
17103 @itemx -mno-omit-leaf-frame-pointer
17104 @opindex momit-leaf-frame-pointer
17105 @opindex mno-omit-leaf-frame-pointer
17106 Omit or keep the frame pointer in leaf functions. The former behavior is the
17107 default.
17108
17109 @item -mstack-protector-guard=@var{guard}
17110 @itemx -mstack-protector-guard-reg=@var{reg}
17111 @itemx -mstack-protector-guard-offset=@var{offset}
17112 @opindex mstack-protector-guard
17113 @opindex mstack-protector-guard-reg
17114 @opindex mstack-protector-guard-offset
17115 Generate stack protection code using canary at @var{guard}. Supported
17116 locations are @samp{global} for a global canary or @samp{sysreg} for a
17117 canary in an appropriate system register.
17118
17119 With the latter choice the options
17120 @option{-mstack-protector-guard-reg=@var{reg}} and
17121 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
17122 which system register to use as base register for reading the canary,
17123 and from what offset from that base register. There is no default
17124 register or offset as this is entirely for use within the Linux
17125 kernel.
17126
17127 @item -mstack-protector-guard=@var{guard}
17128 @itemx -mstack-protector-guard-reg=@var{reg}
17129 @itemx -mstack-protector-guard-offset=@var{offset}
17130 @opindex mstack-protector-guard
17131 @opindex mstack-protector-guard-reg
17132 @opindex mstack-protector-guard-offset
17133 Generate stack protection code using canary at @var{guard}. Supported
17134 locations are @samp{global} for a global canary or @samp{sysreg} for a
17135 canary in an appropriate system register.
17136
17137 With the latter choice the options
17138 @option{-mstack-protector-guard-reg=@var{reg}} and
17139 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
17140 which system register to use as base register for reading the canary,
17141 and from what offset from that base register. There is no default
17142 register or offset as this is entirely for use within the Linux
17143 kernel.
17144
17145 @item -mtls-dialect=desc
17146 @opindex mtls-dialect=desc
17147 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
17148 of TLS variables. This is the default.
17149
17150 @item -mtls-dialect=traditional
17151 @opindex mtls-dialect=traditional
17152 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
17153 of TLS variables.
17154
17155 @item -mtls-size=@var{size}
17156 @opindex mtls-size
17157 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
17158 This option requires binutils 2.26 or newer.
17159
17160 @item -mfix-cortex-a53-835769
17161 @itemx -mno-fix-cortex-a53-835769
17162 @opindex mfix-cortex-a53-835769
17163 @opindex mno-fix-cortex-a53-835769
17164 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
17165 This involves inserting a NOP instruction between memory instructions and
17166 64-bit integer multiply-accumulate instructions.
17167
17168 @item -mfix-cortex-a53-843419
17169 @itemx -mno-fix-cortex-a53-843419
17170 @opindex mfix-cortex-a53-843419
17171 @opindex mno-fix-cortex-a53-843419
17172 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
17173 This erratum workaround is made at link time and this will only pass the
17174 corresponding flag to the linker.
17175
17176 @item -mlow-precision-recip-sqrt
17177 @itemx -mno-low-precision-recip-sqrt
17178 @opindex mlow-precision-recip-sqrt
17179 @opindex mno-low-precision-recip-sqrt
17180 Enable or disable the reciprocal square root approximation.
17181 This option only has an effect if @option{-ffast-math} or
17182 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
17183 precision of reciprocal square root results to about 16 bits for
17184 single precision and to 32 bits for double precision.
17185
17186 @item -mlow-precision-sqrt
17187 @itemx -mno-low-precision-sqrt
17188 @opindex mlow-precision-sqrt
17189 @opindex mno-low-precision-sqrt
17190 Enable or disable the square root approximation.
17191 This option only has an effect if @option{-ffast-math} or
17192 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
17193 precision of square root results to about 16 bits for
17194 single precision and to 32 bits for double precision.
17195 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
17196
17197 @item -mlow-precision-div
17198 @itemx -mno-low-precision-div
17199 @opindex mlow-precision-div
17200 @opindex mno-low-precision-div
17201 Enable or disable the division approximation.
17202 This option only has an effect if @option{-ffast-math} or
17203 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
17204 precision of division results to about 16 bits for
17205 single precision and to 32 bits for double precision.
17206
17207 @item -mtrack-speculation
17208 @itemx -mno-track-speculation
17209 Enable or disable generation of additional code to track speculative
17210 execution through conditional branches. The tracking state can then
17211 be used by the compiler when expanding calls to
17212 @code{__builtin_speculation_safe_copy} to permit a more efficient code
17213 sequence to be generated.
17214
17215 @item -moutline-atomics
17216 @itemx -mno-outline-atomics
17217 Enable or disable calls to out-of-line helpers to implement atomic operations.
17218 These helpers will, at runtime, determine if the LSE instructions from
17219 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
17220 instructions that are present in the base ARMv8.0 ISA.
17221
17222 This option is only applicable when compiling for the base ARMv8.0
17223 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
17224 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
17225 used directly. The same applies when using @option{-mcpu=} when the
17226 selected cpu supports the @samp{lse} feature.
17227 This option is on by default.
17228
17229 @item -march=@var{name}
17230 @opindex march
17231 Specify the name of the target architecture and, optionally, one or
17232 more feature modifiers. This option has the form
17233 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
17234
17235 The table below summarizes the permissible values for @var{arch}
17236 and the features that they enable by default:
17237
17238 @multitable @columnfractions 0.20 0.20 0.60
17239 @headitem @var{arch} value @tab Architecture @tab Includes by default
17240 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
17241 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
17242 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
17243 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
17244 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
17245 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
17246 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
17247 @end multitable
17248
17249 The value @samp{native} is available on native AArch64 GNU/Linux and
17250 causes the compiler to pick the architecture of the host system. This
17251 option has no effect if the compiler is unable to recognize the
17252 architecture of the host system,
17253
17254 The permissible values for @var{feature} are listed in the sub-section
17255 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
17256 Feature Modifiers}. Where conflicting feature modifiers are
17257 specified, the right-most feature is used.
17258
17259 GCC uses @var{name} to determine what kind of instructions it can emit
17260 when generating assembly code. If @option{-march} is specified
17261 without either of @option{-mtune} or @option{-mcpu} also being
17262 specified, the code is tuned to perform well across a range of target
17263 processors implementing the target architecture.
17264
17265 @item -mtune=@var{name}
17266 @opindex mtune
17267 Specify the name of the target processor for which GCC should tune the
17268 performance of the code. Permissible values for this option are:
17269 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17270 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17271 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17272 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
17273 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
17274 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
17275 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
17276 @samp{octeontx81}, @samp{octeontx83},
17277 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
17278 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
17279 @samp{octeontx2f95mm}
17280 @samp{thunderx}, @samp{thunderxt88},
17281 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
17282 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110},
17283 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17284 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17285 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
17286 @samp{native}.
17287
17288 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17289 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17290 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
17291 should tune for a big.LITTLE system.
17292
17293 Additionally on native AArch64 GNU/Linux systems the value
17294 @samp{native} tunes performance to the host system. This option has no effect
17295 if the compiler is unable to recognize the processor of the host system.
17296
17297 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
17298 are specified, the code is tuned to perform well across a range
17299 of target processors.
17300
17301 This option cannot be suffixed by feature modifiers.
17302
17303 @item -mcpu=@var{name}
17304 @opindex mcpu
17305 Specify the name of the target processor, optionally suffixed by one
17306 or more feature modifiers. This option has the form
17307 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
17308 the permissible values for @var{cpu} are the same as those available
17309 for @option{-mtune}. The permissible values for @var{feature} are
17310 documented in the sub-section on
17311 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
17312 Feature Modifiers}. Where conflicting feature modifiers are
17313 specified, the right-most feature is used.
17314
17315 GCC uses @var{name} to determine what kind of instructions it can emit when
17316 generating assembly code (as if by @option{-march}) and to determine
17317 the target processor for which to tune for performance (as if
17318 by @option{-mtune}). Where this option is used in conjunction
17319 with @option{-march} or @option{-mtune}, those options take precedence
17320 over the appropriate part of this option.
17321
17322 @item -moverride=@var{string}
17323 @opindex moverride
17324 Override tuning decisions made by the back-end in response to a
17325 @option{-mtune=} switch. The syntax, semantics, and accepted values
17326 for @var{string} in this option are not guaranteed to be consistent
17327 across releases.
17328
17329 This option is only intended to be useful when developing GCC.
17330
17331 @item -mverbose-cost-dump
17332 @opindex mverbose-cost-dump
17333 Enable verbose cost model dumping in the debug dump files. This option is
17334 provided for use in debugging the compiler.
17335
17336 @item -mpc-relative-literal-loads
17337 @itemx -mno-pc-relative-literal-loads
17338 @opindex mpc-relative-literal-loads
17339 @opindex mno-pc-relative-literal-loads
17340 Enable or disable PC-relative literal loads. With this option literal pools are
17341 accessed using a single instruction and emitted after each function. This
17342 limits the maximum size of functions to 1MB. This is enabled by default for
17343 @option{-mcmodel=tiny}.
17344
17345 @item -msign-return-address=@var{scope}
17346 @opindex msign-return-address
17347 Select the function scope on which return address signing will be applied.
17348 Permissible values are @samp{none}, which disables return address signing,
17349 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
17350 functions, and @samp{all}, which enables pointer signing for all functions. The
17351 default value is @samp{none}. This option has been deprecated by
17352 -mbranch-protection.
17353
17354 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
17355 @opindex mbranch-protection
17356 Select the branch protection features to use.
17357 @samp{none} is the default and turns off all types of branch protection.
17358 @samp{standard} turns on all types of branch protection features. If a feature
17359 has additional tuning options, then @samp{standard} sets it to its standard
17360 level.
17361 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
17362 level: signing functions that save the return address to memory (non-leaf
17363 functions will practically always do this) using the a-key. The optional
17364 argument @samp{leaf} can be used to extend the signing to include leaf
17365 functions. The optional argument @samp{b-key} can be used to sign the functions
17366 with the B-key instead of the A-key.
17367 @samp{bti} turns on branch target identification mechanism.
17368
17369 @item -msve-vector-bits=@var{bits}
17370 @opindex msve-vector-bits
17371 Specify the number of bits in an SVE vector register. This option only has
17372 an effect when SVE is enabled.
17373
17374 GCC supports two forms of SVE code generation: ``vector-length
17375 agnostic'' output that works with any size of vector register and
17376 ``vector-length specific'' output that allows GCC to make assumptions
17377 about the vector length when it is useful for optimization reasons.
17378 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
17379 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
17380 Specifying @samp{scalable} selects vector-length agnostic
17381 output. At present @samp{-msve-vector-bits=128} also generates vector-length
17382 agnostic output for big-endian targets. All other values generate
17383 vector-length specific code. The behavior of these values may change
17384 in future releases and no value except @samp{scalable} should be
17385 relied on for producing code that is portable across different
17386 hardware SVE vector lengths.
17387
17388 The default is @samp{-msve-vector-bits=scalable}, which produces
17389 vector-length agnostic code.
17390 @end table
17391
17392 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
17393 @anchor{aarch64-feature-modifiers}
17394 @cindex @option{-march} feature modifiers
17395 @cindex @option{-mcpu} feature modifiers
17396 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
17397 the following and their inverses @option{no@var{feature}}:
17398
17399 @table @samp
17400 @item crc
17401 Enable CRC extension. This is on by default for
17402 @option{-march=armv8.1-a}.
17403 @item crypto
17404 Enable Crypto extension. This also enables Advanced SIMD and floating-point
17405 instructions.
17406 @item fp
17407 Enable floating-point instructions. This is on by default for all possible
17408 values for options @option{-march} and @option{-mcpu}.
17409 @item simd
17410 Enable Advanced SIMD instructions. This also enables floating-point
17411 instructions. This is on by default for all possible values for options
17412 @option{-march} and @option{-mcpu}.
17413 @item sve
17414 Enable Scalable Vector Extension instructions. This also enables Advanced
17415 SIMD and floating-point instructions.
17416 @item lse
17417 Enable Large System Extension instructions. This is on by default for
17418 @option{-march=armv8.1-a}.
17419 @item rdma
17420 Enable Round Double Multiply Accumulate instructions. This is on by default
17421 for @option{-march=armv8.1-a}.
17422 @item fp16
17423 Enable FP16 extension. This also enables floating-point instructions.
17424 @item fp16fml
17425 Enable FP16 fmla extension. This also enables FP16 extensions and
17426 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.
17427
17428 @item rcpc
17429 Enable the RcPc extension. This does not change code generation from GCC,
17430 but is passed on to the assembler, enabling inline asm statements to use
17431 instructions from the RcPc extension.
17432 @item dotprod
17433 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17434 @item aes
17435 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
17436 SIMD instructions.
17437 @item sha2
17438 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
17439 @item sha3
17440 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
17441 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
17442 @item sm4
17443 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
17444 Use of this option with architectures prior to Armv8.2-A is not supported.
17445 @item profile
17446 Enable the Statistical Profiling extension. This option is only to enable the
17447 extension at the assembler level and does not affect code generation.
17448 @item rng
17449 Enable the Armv8.5-a Random Number instructions. This option is only to
17450 enable the extension at the assembler level and does not affect code
17451 generation.
17452 @item memtag
17453 Enable the Armv8.5-a Memory Tagging Extensions.
17454 Use of this option with architectures prior to Armv8.5-A is not supported.
17455 @item sb
17456 Enable the Armv8-a Speculation Barrier instruction. This option is only to
17457 enable the extension at the assembler level and does not affect code
17458 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17459 @item ssbs
17460 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
17461 is only to enable the extension at the assembler level and does not affect code
17462 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17463 @item predres
17464 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17465 This option is only to enable the extension at the assembler level and does
17466 not affect code generation. This option is enabled by default for
17467 @option{-march=armv8.5-a}.
17468 @item sve2
17469 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
17470 instructions.
17471 @item sve2-bitperm
17472 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
17473 @item sve2-sm4
17474 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17475 @item sve2-aes
17476 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17477 @item sve2-sha3
17478 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
17479 @item tme
17480 Enable the Transactional Memory Extension.
17481 @item i8mm
17482 Enable 8-bit Integer Matrix Multiply instructions. This also enables
17483 Advanced SIMD and floating-point instructions. This option is enabled by
17484 default for @option{-march=armv8.6-a}. Use of this option with architectures
17485 prior to Armv8.2-A is not supported.
17486 @item f32mm
17487 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
17488 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17489 not supported.
17490 @item f64mm
17491 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
17492 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17493 not supported.
17494 @item bf16
17495 Enable brain half-precision floating-point instructions. This also enables
17496 Advanced SIMD and floating-point instructions. This option is enabled by
17497 default for @option{-march=armv8.6-a}. Use of this option with architectures
17498 prior to Armv8.2-A is not supported.
17499
17500 @end table
17501
17502 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17503 which implies @option{fp}.
17504 Conversely, @option{nofp} implies @option{nosimd}, which implies
17505 @option{nocrypto}, @option{noaes} and @option{nosha2}.
17506
17507 @node Adapteva Epiphany Options
17508 @subsection Adapteva Epiphany Options
17509
17510 These @samp{-m} options are defined for Adapteva Epiphany:
17511
17512 @table @gcctabopt
17513 @item -mhalf-reg-file
17514 @opindex mhalf-reg-file
17515 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17516 That allows code to run on hardware variants that lack these registers.
17517
17518 @item -mprefer-short-insn-regs
17519 @opindex mprefer-short-insn-regs
17520 Preferentially allocate registers that allow short instruction generation.
17521 This can result in increased instruction count, so this may either reduce or
17522 increase overall code size.
17523
17524 @item -mbranch-cost=@var{num}
17525 @opindex mbranch-cost
17526 Set the cost of branches to roughly @var{num} ``simple'' instructions.
17527 This cost is only a heuristic and is not guaranteed to produce
17528 consistent results across releases.
17529
17530 @item -mcmove
17531 @opindex mcmove
17532 Enable the generation of conditional moves.
17533
17534 @item -mnops=@var{num}
17535 @opindex mnops
17536 Emit @var{num} NOPs before every other generated instruction.
17537
17538 @item -mno-soft-cmpsf
17539 @opindex mno-soft-cmpsf
17540 @opindex msoft-cmpsf
17541 For single-precision floating-point comparisons, emit an @code{fsub} instruction
17542 and test the flags. This is faster than a software comparison, but can
17543 get incorrect results in the presence of NaNs, or when two different small
17544 numbers are compared such that their difference is calculated as zero.
17545 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17546 software comparisons.
17547
17548 @item -mstack-offset=@var{num}
17549 @opindex mstack-offset
17550 Set the offset between the top of the stack and the stack pointer.
17551 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17552 can be used by leaf functions without stack allocation.
17553 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17554 Note also that this option changes the ABI; compiling a program with a
17555 different stack offset than the libraries have been compiled with
17556 generally does not work.
17557 This option can be useful if you want to evaluate if a different stack
17558 offset would give you better code, but to actually use a different stack
17559 offset to build working programs, it is recommended to configure the
17560 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17561
17562 @item -mno-round-nearest
17563 @opindex mno-round-nearest
17564 @opindex mround-nearest
17565 Make the scheduler assume that the rounding mode has been set to
17566 truncating. The default is @option{-mround-nearest}.
17567
17568 @item -mlong-calls
17569 @opindex mlong-calls
17570 If not otherwise specified by an attribute, assume all calls might be beyond
17571 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17572 function address into a register before performing a (otherwise direct) call.
17573 This is the default.
17574
17575 @item -mshort-calls
17576 @opindex short-calls
17577 If not otherwise specified by an attribute, assume all direct calls are
17578 in the range of the @code{b} / @code{bl} instructions, so use these instructions
17579 for direct calls. The default is @option{-mlong-calls}.
17580
17581 @item -msmall16
17582 @opindex msmall16
17583 Assume addresses can be loaded as 16-bit unsigned values. This does not
17584 apply to function addresses for which @option{-mlong-calls} semantics
17585 are in effect.
17586
17587 @item -mfp-mode=@var{mode}
17588 @opindex mfp-mode
17589 Set the prevailing mode of the floating-point unit.
17590 This determines the floating-point mode that is provided and expected
17591 at function call and return time. Making this mode match the mode you
17592 predominantly need at function start can make your programs smaller and
17593 faster by avoiding unnecessary mode switches.
17594
17595 @var{mode} can be set to one the following values:
17596
17597 @table @samp
17598 @item caller
17599 Any mode at function entry is valid, and retained or restored when
17600 the function returns, and when it calls other functions.
17601 This mode is useful for compiling libraries or other compilation units
17602 you might want to incorporate into different programs with different
17603 prevailing FPU modes, and the convenience of being able to use a single
17604 object file outweighs the size and speed overhead for any extra
17605 mode switching that might be needed, compared with what would be needed
17606 with a more specific choice of prevailing FPU mode.
17607
17608 @item truncate
17609 This is the mode used for floating-point calculations with
17610 truncating (i.e.@: round towards zero) rounding mode. That includes
17611 conversion from floating point to integer.
17612
17613 @item round-nearest
17614 This is the mode used for floating-point calculations with
17615 round-to-nearest-or-even rounding mode.
17616
17617 @item int
17618 This is the mode used to perform integer calculations in the FPU, e.g.@:
17619 integer multiply, or integer multiply-and-accumulate.
17620 @end table
17621
17622 The default is @option{-mfp-mode=caller}
17623
17624 @item -mno-split-lohi
17625 @itemx -mno-postinc
17626 @itemx -mno-postmodify
17627 @opindex mno-split-lohi
17628 @opindex msplit-lohi
17629 @opindex mno-postinc
17630 @opindex mpostinc
17631 @opindex mno-postmodify
17632 @opindex mpostmodify
17633 Code generation tweaks that disable, respectively, splitting of 32-bit
17634 loads, generation of post-increment addresses, and generation of
17635 post-modify addresses. The defaults are @option{msplit-lohi},
17636 @option{-mpost-inc}, and @option{-mpost-modify}.
17637
17638 @item -mnovect-double
17639 @opindex mno-vect-double
17640 @opindex mvect-double
17641 Change the preferred SIMD mode to SImode. The default is
17642 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
17643
17644 @item -max-vect-align=@var{num}
17645 @opindex max-vect-align
17646 The maximum alignment for SIMD vector mode types.
17647 @var{num} may be 4 or 8. The default is 8.
17648 Note that this is an ABI change, even though many library function
17649 interfaces are unaffected if they don't use SIMD vector modes
17650 in places that affect size and/or alignment of relevant types.
17651
17652 @item -msplit-vecmove-early
17653 @opindex msplit-vecmove-early
17654 Split vector moves into single word moves before reload. In theory this
17655 can give better register allocation, but so far the reverse seems to be
17656 generally the case.
17657
17658 @item -m1reg-@var{reg}
17659 @opindex m1reg-
17660 Specify a register to hold the constant @minus{}1, which makes loading small negative
17661 constants and certain bitmasks faster.
17662 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17663 which specify use of that register as a fixed register,
17664 and @samp{none}, which means that no register is used for this
17665 purpose. The default is @option{-m1reg-none}.
17666
17667 @end table
17668
17669 @node AMD GCN Options
17670 @subsection AMD GCN Options
17671 @cindex AMD GCN Options
17672
17673 These options are defined specifically for the AMD GCN port.
17674
17675 @table @gcctabopt
17676
17677 @item -march=@var{gpu}
17678 @opindex march
17679 @itemx -mtune=@var{gpu}
17680 @opindex mtune
17681 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17682 are
17683
17684 @table @samp
17685 @opindex fiji
17686 @item fiji
17687 Compile for GCN3 Fiji devices (gfx803).
17688
17689 @item gfx900
17690 Compile for GCN5 Vega 10 devices (gfx900).
17691
17692 @item gfx906
17693 Compile for GCN5 Vega 20 devices (gfx906).
17694
17695 @end table
17696
17697 @item -mstack-size=@var{bytes}
17698 @opindex mstack-size
17699 Specify how many @var{bytes} of stack space will be requested for each GPU
17700 thread (wave-front). Beware that there may be many threads and limited memory
17701 available. The size of the stack allocation may also have an impact on
17702 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
17703 1MB otherwise.
17704
17705 @end table
17706
17707 @node ARC Options
17708 @subsection ARC Options
17709 @cindex ARC options
17710
17711 The following options control the architecture variant for which code
17712 is being compiled:
17713
17714 @c architecture variants
17715 @table @gcctabopt
17716
17717 @item -mbarrel-shifter
17718 @opindex mbarrel-shifter
17719 Generate instructions supported by barrel shifter. This is the default
17720 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17721
17722 @item -mjli-always
17723 @opindex mjli-alawys
17724 Force to call a function using jli_s instruction. This option is
17725 valid only for ARCv2 architecture.
17726
17727 @item -mcpu=@var{cpu}
17728 @opindex mcpu
17729 Set architecture type, register usage, and instruction scheduling
17730 parameters for @var{cpu}. There are also shortcut alias options
17731 available for backward compatibility and convenience. Supported
17732 values for @var{cpu} are
17733
17734 @table @samp
17735 @opindex mA6
17736 @opindex mARC600
17737 @item arc600
17738 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
17739
17740 @item arc601
17741 @opindex mARC601
17742 Compile for ARC601. Alias: @option{-mARC601}.
17743
17744 @item arc700
17745 @opindex mA7
17746 @opindex mARC700
17747 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
17748 This is the default when configured with @option{--with-cpu=arc700}@.
17749
17750 @item arcem
17751 Compile for ARC EM.
17752
17753 @item archs
17754 Compile for ARC HS.
17755
17756 @item em
17757 Compile for ARC EM CPU with no hardware extensions.
17758
17759 @item em4
17760 Compile for ARC EM4 CPU.
17761
17762 @item em4_dmips
17763 Compile for ARC EM4 DMIPS CPU.
17764
17765 @item em4_fpus
17766 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17767 extension.
17768
17769 @item em4_fpuda
17770 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17771 double assist instructions.
17772
17773 @item hs
17774 Compile for ARC HS CPU with no hardware extensions except the atomic
17775 instructions.
17776
17777 @item hs34
17778 Compile for ARC HS34 CPU.
17779
17780 @item hs38
17781 Compile for ARC HS38 CPU.
17782
17783 @item hs38_linux
17784 Compile for ARC HS38 CPU with all hardware extensions on.
17785
17786 @item arc600_norm
17787 Compile for ARC 600 CPU with @code{norm} instructions enabled.
17788
17789 @item arc600_mul32x16
17790 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
17791 instructions enabled.
17792
17793 @item arc600_mul64
17794 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
17795 instructions enabled.
17796
17797 @item arc601_norm
17798 Compile for ARC 601 CPU with @code{norm} instructions enabled.
17799
17800 @item arc601_mul32x16
17801 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17802 instructions enabled.
17803
17804 @item arc601_mul64
17805 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17806 instructions enabled.
17807
17808 @item nps400
17809 Compile for ARC 700 on NPS400 chip.
17810
17811 @item em_mini
17812 Compile for ARC EM minimalist configuration featuring reduced register
17813 set.
17814
17815 @end table
17816
17817 @item -mdpfp
17818 @opindex mdpfp
17819 @itemx -mdpfp-compact
17820 @opindex mdpfp-compact
17821 Generate double-precision FPX instructions, tuned for the compact
17822 implementation.
17823
17824 @item -mdpfp-fast
17825 @opindex mdpfp-fast
17826 Generate double-precision FPX instructions, tuned for the fast
17827 implementation.
17828
17829 @item -mno-dpfp-lrsr
17830 @opindex mno-dpfp-lrsr
17831 Disable @code{lr} and @code{sr} instructions from using FPX extension
17832 aux registers.
17833
17834 @item -mea
17835 @opindex mea
17836 Generate extended arithmetic instructions. Currently only
17837 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17838 supported. Only valid for @option{-mcpu=ARC700}.
17839
17840 @item -mno-mpy
17841 @opindex mno-mpy
17842 @opindex mmpy
17843 Do not generate @code{mpy}-family instructions for ARC700. This option is
17844 deprecated.
17845
17846 @item -mmul32x16
17847 @opindex mmul32x16
17848 Generate 32x16-bit multiply and multiply-accumulate instructions.
17849
17850 @item -mmul64
17851 @opindex mmul64
17852 Generate @code{mul64} and @code{mulu64} instructions.
17853 Only valid for @option{-mcpu=ARC600}.
17854
17855 @item -mnorm
17856 @opindex mnorm
17857 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
17858 is in effect.
17859
17860 @item -mspfp
17861 @opindex mspfp
17862 @itemx -mspfp-compact
17863 @opindex mspfp-compact
17864 Generate single-precision FPX instructions, tuned for the compact
17865 implementation.
17866
17867 @item -mspfp-fast
17868 @opindex mspfp-fast
17869 Generate single-precision FPX instructions, tuned for the fast
17870 implementation.
17871
17872 @item -msimd
17873 @opindex msimd
17874 Enable generation of ARC SIMD instructions via target-specific
17875 builtins. Only valid for @option{-mcpu=ARC700}.
17876
17877 @item -msoft-float
17878 @opindex msoft-float
17879 This option ignored; it is provided for compatibility purposes only.
17880 Software floating-point code is emitted by default, and this default
17881 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17882 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
17883 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17884
17885 @item -mswap
17886 @opindex mswap
17887 Generate @code{swap} instructions.
17888
17889 @item -matomic
17890 @opindex matomic
17891 This enables use of the locked load/store conditional extension to implement
17892 atomic memory built-in functions. Not available for ARC 6xx or ARC
17893 EM cores.
17894
17895 @item -mdiv-rem
17896 @opindex mdiv-rem
17897 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
17898
17899 @item -mcode-density
17900 @opindex mcode-density
17901 Enable code density instructions for ARC EM.
17902 This option is on by default for ARC HS.
17903
17904 @item -mll64
17905 @opindex mll64
17906 Enable double load/store operations for ARC HS cores.
17907
17908 @item -mtp-regno=@var{regno}
17909 @opindex mtp-regno
17910 Specify thread pointer register number.
17911
17912 @item -mmpy-option=@var{multo}
17913 @opindex mmpy-option
17914 Compile ARCv2 code with a multiplier design option. You can specify
17915 the option using either a string or numeric value for @var{multo}.
17916 @samp{wlh1} is the default value. The recognized values are:
17917
17918 @table @samp
17919 @item 0
17920 @itemx none
17921 No multiplier available.
17922
17923 @item 1
17924 @itemx w
17925 16x16 multiplier, fully pipelined.
17926 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
17927
17928 @item 2
17929 @itemx wlh1
17930 32x32 multiplier, fully
17931 pipelined (1 stage). The following instructions are additionally
17932 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17933
17934 @item 3
17935 @itemx wlh2
17936 32x32 multiplier, fully pipelined
17937 (2 stages). The following instructions are additionally enabled: @code{mpy},
17938 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17939
17940 @item 4
17941 @itemx wlh3
17942 Two 16x16 multipliers, blocking,
17943 sequential. The following instructions are additionally enabled: @code{mpy},
17944 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17945
17946 @item 5
17947 @itemx wlh4
17948 One 16x16 multiplier, blocking,
17949 sequential. The following instructions are additionally enabled: @code{mpy},
17950 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17951
17952 @item 6
17953 @itemx wlh5
17954 One 32x4 multiplier, blocking,
17955 sequential. The following instructions are additionally enabled: @code{mpy},
17956 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17957
17958 @item 7
17959 @itemx plus_dmpy
17960 ARC HS SIMD support.
17961
17962 @item 8
17963 @itemx plus_macd
17964 ARC HS SIMD support.
17965
17966 @item 9
17967 @itemx plus_qmacw
17968 ARC HS SIMD support.
17969
17970 @end table
17971
17972 This option is only available for ARCv2 cores@.
17973
17974 @item -mfpu=@var{fpu}
17975 @opindex mfpu
17976 Enables support for specific floating-point hardware extensions for ARCv2
17977 cores. Supported values for @var{fpu} are:
17978
17979 @table @samp
17980
17981 @item fpus
17982 Enables support for single-precision floating-point hardware
17983 extensions@.
17984
17985 @item fpud
17986 Enables support for double-precision floating-point hardware
17987 extensions. The single-precision floating-point extension is also
17988 enabled. Not available for ARC EM@.
17989
17990 @item fpuda
17991 Enables support for double-precision floating-point hardware
17992 extensions using double-precision assist instructions. The single-precision
17993 floating-point extension is also enabled. This option is
17994 only available for ARC EM@.
17995
17996 @item fpuda_div
17997 Enables support for double-precision floating-point hardware
17998 extensions using double-precision assist instructions.
17999 The single-precision floating-point, square-root, and divide
18000 extensions are also enabled. This option is
18001 only available for ARC EM@.
18002
18003 @item fpuda_fma
18004 Enables support for double-precision floating-point hardware
18005 extensions using double-precision assist instructions.
18006 The single-precision floating-point and fused multiply and add
18007 hardware extensions are also enabled. This option is
18008 only available for ARC EM@.
18009
18010 @item fpuda_all
18011 Enables support for double-precision floating-point hardware
18012 extensions using double-precision assist instructions.
18013 All single-precision floating-point hardware extensions are also
18014 enabled. This option is only available for ARC EM@.
18015
18016 @item fpus_div
18017 Enables support for single-precision floating-point, square-root and divide
18018 hardware extensions@.
18019
18020 @item fpud_div
18021 Enables support for double-precision floating-point, square-root and divide
18022 hardware extensions. This option
18023 includes option @samp{fpus_div}. Not available for ARC EM@.
18024
18025 @item fpus_fma
18026 Enables support for single-precision floating-point and
18027 fused multiply and add hardware extensions@.
18028
18029 @item fpud_fma
18030 Enables support for double-precision floating-point and
18031 fused multiply and add hardware extensions. This option
18032 includes option @samp{fpus_fma}. Not available for ARC EM@.
18033
18034 @item fpus_all
18035 Enables support for all single-precision floating-point hardware
18036 extensions@.
18037
18038 @item fpud_all
18039 Enables support for all single- and double-precision floating-point
18040 hardware extensions. Not available for ARC EM@.
18041
18042 @end table
18043
18044 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
18045 @opindex mirq-ctrl-saved
18046 Specifies general-purposes registers that the processor automatically
18047 saves/restores on interrupt entry and exit. @var{register-range} is
18048 specified as two registers separated by a dash. The register range
18049 always starts with @code{r0}, the upper limit is @code{fp} register.
18050 @var{blink} and @var{lp_count} are optional. This option is only
18051 valid for ARC EM and ARC HS cores.
18052
18053 @item -mrgf-banked-regs=@var{number}
18054 @opindex mrgf-banked-regs
18055 Specifies the number of registers replicated in second register bank
18056 on entry to fast interrupt. Fast interrupts are interrupts with the
18057 highest priority level P0. These interrupts save only PC and STATUS32
18058 registers to avoid memory transactions during interrupt entry and exit
18059 sequences. Use this option when you are using fast interrupts in an
18060 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
18061
18062 @item -mlpc-width=@var{width}
18063 @opindex mlpc-width
18064 Specify the width of the @code{lp_count} register. Valid values for
18065 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
18066 fixed to 32 bits. If the width is less than 32, the compiler does not
18067 attempt to transform loops in your program to use the zero-delay loop
18068 mechanism unless it is known that the @code{lp_count} register can
18069 hold the required loop-counter value. Depending on the width
18070 specified, the compiler and run-time library might continue to use the
18071 loop mechanism for various needs. This option defines macro
18072 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
18073
18074 @item -mrf16
18075 @opindex mrf16
18076 This option instructs the compiler to generate code for a 16-entry
18077 register file. This option defines the @code{__ARC_RF16__}
18078 preprocessor macro.
18079
18080 @item -mbranch-index
18081 @opindex mbranch-index
18082 Enable use of @code{bi} or @code{bih} instructions to implement jump
18083 tables.
18084
18085 @end table
18086
18087 The following options are passed through to the assembler, and also
18088 define preprocessor macro symbols.
18089
18090 @c Flags used by the assembler, but for which we define preprocessor
18091 @c macro symbols as well.
18092 @table @gcctabopt
18093 @item -mdsp-packa
18094 @opindex mdsp-packa
18095 Passed down to the assembler to enable the DSP Pack A extensions.
18096 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
18097 deprecated.
18098
18099 @item -mdvbf
18100 @opindex mdvbf
18101 Passed down to the assembler to enable the dual Viterbi butterfly
18102 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
18103 option is deprecated.
18104
18105 @c ARC700 4.10 extension instruction
18106 @item -mlock
18107 @opindex mlock
18108 Passed down to the assembler to enable the locked load/store
18109 conditional extension. Also sets the preprocessor symbol
18110 @code{__Xlock}.
18111
18112 @item -mmac-d16
18113 @opindex mmac-d16
18114 Passed down to the assembler. Also sets the preprocessor symbol
18115 @code{__Xxmac_d16}. This option is deprecated.
18116
18117 @item -mmac-24
18118 @opindex mmac-24
18119 Passed down to the assembler. Also sets the preprocessor symbol
18120 @code{__Xxmac_24}. This option is deprecated.
18121
18122 @c ARC700 4.10 extension instruction
18123 @item -mrtsc
18124 @opindex mrtsc
18125 Passed down to the assembler to enable the 64-bit time-stamp counter
18126 extension instruction. Also sets the preprocessor symbol
18127 @code{__Xrtsc}. This option is deprecated.
18128
18129 @c ARC700 4.10 extension instruction
18130 @item -mswape
18131 @opindex mswape
18132 Passed down to the assembler to enable the swap byte ordering
18133 extension instruction. Also sets the preprocessor symbol
18134 @code{__Xswape}.
18135
18136 @item -mtelephony
18137 @opindex mtelephony
18138 Passed down to the assembler to enable dual- and single-operand
18139 instructions for telephony. Also sets the preprocessor symbol
18140 @code{__Xtelephony}. This option is deprecated.
18141
18142 @item -mxy
18143 @opindex mxy
18144 Passed down to the assembler to enable the XY memory extension. Also
18145 sets the preprocessor symbol @code{__Xxy}.
18146
18147 @end table
18148
18149 The following options control how the assembly code is annotated:
18150
18151 @c Assembly annotation options
18152 @table @gcctabopt
18153 @item -misize
18154 @opindex misize
18155 Annotate assembler instructions with estimated addresses.
18156
18157 @item -mannotate-align
18158 @opindex mannotate-align
18159 Explain what alignment considerations lead to the decision to make an
18160 instruction short or long.
18161
18162 @end table
18163
18164 The following options are passed through to the linker:
18165
18166 @c options passed through to the linker
18167 @table @gcctabopt
18168 @item -marclinux
18169 @opindex marclinux
18170 Passed through to the linker, to specify use of the @code{arclinux} emulation.
18171 This option is enabled by default in tool chains built for
18172 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
18173 when profiling is not requested.
18174
18175 @item -marclinux_prof
18176 @opindex marclinux_prof
18177 Passed through to the linker, to specify use of the
18178 @code{arclinux_prof} emulation. This option is enabled by default in
18179 tool chains built for @w{@code{arc-linux-uclibc}} and
18180 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
18181
18182 @end table
18183
18184 The following options control the semantics of generated code:
18185
18186 @c semantically relevant code generation options
18187 @table @gcctabopt
18188 @item -mlong-calls
18189 @opindex mlong-calls
18190 Generate calls as register indirect calls, thus providing access
18191 to the full 32-bit address range.
18192
18193 @item -mmedium-calls
18194 @opindex mmedium-calls
18195 Don't use less than 25-bit addressing range for calls, which is the
18196 offset available for an unconditional branch-and-link
18197 instruction. Conditional execution of function calls is suppressed, to
18198 allow use of the 25-bit range, rather than the 21-bit range with
18199 conditional branch-and-link. This is the default for tool chains built
18200 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
18201
18202 @item -G @var{num}
18203 @opindex G
18204 Put definitions of externally-visible data in a small data section if
18205 that data is no bigger than @var{num} bytes. The default value of
18206 @var{num} is 4 for any ARC configuration, or 8 when we have double
18207 load/store operations.
18208
18209 @item -mno-sdata
18210 @opindex mno-sdata
18211 @opindex msdata
18212 Do not generate sdata references. This is the default for tool chains
18213 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
18214 targets.
18215
18216 @item -mvolatile-cache
18217 @opindex mvolatile-cache
18218 Use ordinarily cached memory accesses for volatile references. This is the
18219 default.
18220
18221 @item -mno-volatile-cache
18222 @opindex mno-volatile-cache
18223 @opindex mvolatile-cache
18224 Enable cache bypass for volatile references.
18225
18226 @end table
18227
18228 The following options fine tune code generation:
18229 @c code generation tuning options
18230 @table @gcctabopt
18231 @item -malign-call
18232 @opindex malign-call
18233 Do alignment optimizations for call instructions.
18234
18235 @item -mauto-modify-reg
18236 @opindex mauto-modify-reg
18237 Enable the use of pre/post modify with register displacement.
18238
18239 @item -mbbit-peephole
18240 @opindex mbbit-peephole
18241 Enable bbit peephole2.
18242
18243 @item -mno-brcc
18244 @opindex mno-brcc
18245 This option disables a target-specific pass in @file{arc_reorg} to
18246 generate compare-and-branch (@code{br@var{cc}}) instructions.
18247 It has no effect on
18248 generation of these instructions driven by the combiner pass.
18249
18250 @item -mcase-vector-pcrel
18251 @opindex mcase-vector-pcrel
18252 Use PC-relative switch case tables to enable case table shortening.
18253 This is the default for @option{-Os}.
18254
18255 @item -mcompact-casesi
18256 @opindex mcompact-casesi
18257 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
18258 and only available for ARCv1 cores. This option is deprecated.
18259
18260 @item -mno-cond-exec
18261 @opindex mno-cond-exec
18262 Disable the ARCompact-specific pass to generate conditional
18263 execution instructions.
18264
18265 Due to delay slot scheduling and interactions between operand numbers,
18266 literal sizes, instruction lengths, and the support for conditional execution,
18267 the target-independent pass to generate conditional execution is often lacking,
18268 so the ARC port has kept a special pass around that tries to find more
18269 conditional execution generation opportunities after register allocation,
18270 branch shortening, and delay slot scheduling have been done. This pass
18271 generally, but not always, improves performance and code size, at the cost of
18272 extra compilation time, which is why there is an option to switch it off.
18273 If you have a problem with call instructions exceeding their allowable
18274 offset range because they are conditionalized, you should consider using
18275 @option{-mmedium-calls} instead.
18276
18277 @item -mearly-cbranchsi
18278 @opindex mearly-cbranchsi
18279 Enable pre-reload use of the @code{cbranchsi} pattern.
18280
18281 @item -mexpand-adddi
18282 @opindex mexpand-adddi
18283 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
18284 @code{add.f}, @code{adc} etc. This option is deprecated.
18285
18286 @item -mindexed-loads
18287 @opindex mindexed-loads
18288 Enable the use of indexed loads. This can be problematic because some
18289 optimizers then assume that indexed stores exist, which is not
18290 the case.
18291
18292 @item -mlra
18293 @opindex mlra
18294 Enable Local Register Allocation. This is still experimental for ARC,
18295 so by default the compiler uses standard reload
18296 (i.e.@: @option{-mno-lra}).
18297
18298 @item -mlra-priority-none
18299 @opindex mlra-priority-none
18300 Don't indicate any priority for target registers.
18301
18302 @item -mlra-priority-compact
18303 @opindex mlra-priority-compact
18304 Indicate target register priority for r0..r3 / r12..r15.
18305
18306 @item -mlra-priority-noncompact
18307 @opindex mlra-priority-noncompact
18308 Reduce target register priority for r0..r3 / r12..r15.
18309
18310 @item -mmillicode
18311 @opindex mmillicode
18312 When optimizing for size (using @option{-Os}), prologues and epilogues
18313 that have to save or restore a large number of registers are often
18314 shortened by using call to a special function in libgcc; this is
18315 referred to as a @emph{millicode} call. As these calls can pose
18316 performance issues, and/or cause linking issues when linking in a
18317 nonstandard way, this option is provided to turn on or off millicode
18318 call generation.
18319
18320 @item -mcode-density-frame
18321 @opindex mcode-density-frame
18322 This option enable the compiler to emit @code{enter} and @code{leave}
18323 instructions. These instructions are only valid for CPUs with
18324 code-density feature.
18325
18326 @item -mmixed-code
18327 @opindex mmixed-code
18328 Tweak register allocation to help 16-bit instruction generation.
18329 This generally has the effect of decreasing the average instruction size
18330 while increasing the instruction count.
18331
18332 @item -mq-class
18333 @opindex mq-class
18334 Ths option is deprecated. Enable @samp{q} instruction alternatives.
18335 This is the default for @option{-Os}.
18336
18337 @item -mRcq
18338 @opindex mRcq
18339 Enable @samp{Rcq} constraint handling.
18340 Most short code generation depends on this.
18341 This is the default.
18342
18343 @item -mRcw
18344 @opindex mRcw
18345 Enable @samp{Rcw} constraint handling.
18346 Most ccfsm condexec mostly depends on this.
18347 This is the default.
18348
18349 @item -msize-level=@var{level}
18350 @opindex msize-level
18351 Fine-tune size optimization with regards to instruction lengths and alignment.
18352 The recognized values for @var{level} are:
18353 @table @samp
18354 @item 0
18355 No size optimization. This level is deprecated and treated like @samp{1}.
18356
18357 @item 1
18358 Short instructions are used opportunistically.
18359
18360 @item 2
18361 In addition, alignment of loops and of code after barriers are dropped.
18362
18363 @item 3
18364 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
18365
18366 @end table
18367
18368 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
18369 the behavior when this is not set is equivalent to level @samp{1}.
18370
18371 @item -mtune=@var{cpu}
18372 @opindex mtune
18373 Set instruction scheduling parameters for @var{cpu}, overriding any implied
18374 by @option{-mcpu=}.
18375
18376 Supported values for @var{cpu} are
18377
18378 @table @samp
18379 @item ARC600
18380 Tune for ARC600 CPU.
18381
18382 @item ARC601
18383 Tune for ARC601 CPU.
18384
18385 @item ARC700
18386 Tune for ARC700 CPU with standard multiplier block.
18387
18388 @item ARC700-xmac
18389 Tune for ARC700 CPU with XMAC block.
18390
18391 @item ARC725D
18392 Tune for ARC725D CPU.
18393
18394 @item ARC750D
18395 Tune for ARC750D CPU.
18396
18397 @end table
18398
18399 @item -mmultcost=@var{num}
18400 @opindex mmultcost
18401 Cost to assume for a multiply instruction, with @samp{4} being equal to a
18402 normal instruction.
18403
18404 @item -munalign-prob-threshold=@var{probability}
18405 @opindex munalign-prob-threshold
18406 Set probability threshold for unaligning branches.
18407 When tuning for @samp{ARC700} and optimizing for speed, branches without
18408 filled delay slot are preferably emitted unaligned and long, unless
18409 profiling indicates that the probability for the branch to be taken
18410 is below @var{probability}. @xref{Cross-profiling}.
18411 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
18412
18413 @end table
18414
18415 The following options are maintained for backward compatibility, but
18416 are now deprecated and will be removed in a future release:
18417
18418 @c Deprecated options
18419 @table @gcctabopt
18420
18421 @item -margonaut
18422 @opindex margonaut
18423 Obsolete FPX.
18424
18425 @item -mbig-endian
18426 @opindex mbig-endian
18427 @itemx -EB
18428 @opindex EB
18429 Compile code for big-endian targets. Use of these options is now
18430 deprecated. Big-endian code is supported by configuring GCC to build
18431 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
18432 for which big endian is the default.
18433
18434 @item -mlittle-endian
18435 @opindex mlittle-endian
18436 @itemx -EL
18437 @opindex EL
18438 Compile code for little-endian targets. Use of these options is now
18439 deprecated. Little-endian code is supported by configuring GCC to build
18440 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
18441 for which little endian is the default.
18442
18443 @item -mbarrel_shifter
18444 @opindex mbarrel_shifter
18445 Replaced by @option{-mbarrel-shifter}.
18446
18447 @item -mdpfp_compact
18448 @opindex mdpfp_compact
18449 Replaced by @option{-mdpfp-compact}.
18450
18451 @item -mdpfp_fast
18452 @opindex mdpfp_fast
18453 Replaced by @option{-mdpfp-fast}.
18454
18455 @item -mdsp_packa
18456 @opindex mdsp_packa
18457 Replaced by @option{-mdsp-packa}.
18458
18459 @item -mEA
18460 @opindex mEA
18461 Replaced by @option{-mea}.
18462
18463 @item -mmac_24
18464 @opindex mmac_24
18465 Replaced by @option{-mmac-24}.
18466
18467 @item -mmac_d16
18468 @opindex mmac_d16
18469 Replaced by @option{-mmac-d16}.
18470
18471 @item -mspfp_compact
18472 @opindex mspfp_compact
18473 Replaced by @option{-mspfp-compact}.
18474
18475 @item -mspfp_fast
18476 @opindex mspfp_fast
18477 Replaced by @option{-mspfp-fast}.
18478
18479 @item -mtune=@var{cpu}
18480 @opindex mtune
18481 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18482 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18483 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18484
18485 @item -multcost=@var{num}
18486 @opindex multcost
18487 Replaced by @option{-mmultcost}.
18488
18489 @end table
18490
18491 @node ARM Options
18492 @subsection ARM Options
18493 @cindex ARM options
18494
18495 These @samp{-m} options are defined for the ARM port:
18496
18497 @table @gcctabopt
18498 @item -mabi=@var{name}
18499 @opindex mabi
18500 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
18501 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18502
18503 @item -mapcs-frame
18504 @opindex mapcs-frame
18505 Generate a stack frame that is compliant with the ARM Procedure Call
18506 Standard for all functions, even if this is not strictly necessary for
18507 correct execution of the code. Specifying @option{-fomit-frame-pointer}
18508 with this option causes the stack frames not to be generated for
18509 leaf functions. The default is @option{-mno-apcs-frame}.
18510 This option is deprecated.
18511
18512 @item -mapcs
18513 @opindex mapcs
18514 This is a synonym for @option{-mapcs-frame} and is deprecated.
18515
18516 @ignore
18517 @c not currently implemented
18518 @item -mapcs-stack-check
18519 @opindex mapcs-stack-check
18520 Generate code to check the amount of stack space available upon entry to
18521 every function (that actually uses some stack space). If there is
18522 insufficient space available then either the function
18523 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18524 called, depending upon the amount of stack space required. The runtime
18525 system is required to provide these functions. The default is
18526 @option{-mno-apcs-stack-check}, since this produces smaller code.
18527
18528 @c not currently implemented
18529 @item -mapcs-reentrant
18530 @opindex mapcs-reentrant
18531 Generate reentrant, position-independent code. The default is
18532 @option{-mno-apcs-reentrant}.
18533 @end ignore
18534
18535 @item -mthumb-interwork
18536 @opindex mthumb-interwork
18537 Generate code that supports calling between the ARM and Thumb
18538 instruction sets. Without this option, on pre-v5 architectures, the
18539 two instruction sets cannot be reliably used inside one program. The
18540 default is @option{-mno-thumb-interwork}, since slightly larger code
18541 is generated when @option{-mthumb-interwork} is specified. In AAPCS
18542 configurations this option is meaningless.
18543
18544 @item -mno-sched-prolog
18545 @opindex mno-sched-prolog
18546 @opindex msched-prolog
18547 Prevent the reordering of instructions in the function prologue, or the
18548 merging of those instruction with the instructions in the function's
18549 body. This means that all functions start with a recognizable set
18550 of instructions (or in fact one of a choice from a small set of
18551 different function prologues), and this information can be used to
18552 locate the start of functions inside an executable piece of code. The
18553 default is @option{-msched-prolog}.
18554
18555 @item -mfloat-abi=@var{name}
18556 @opindex mfloat-abi
18557 Specifies which floating-point ABI to use. Permissible values
18558 are: @samp{soft}, @samp{softfp} and @samp{hard}.
18559
18560 Specifying @samp{soft} causes GCC to generate output containing
18561 library calls for floating-point operations.
18562 @samp{softfp} allows the generation of code using hardware floating-point
18563 instructions, but still uses the soft-float calling conventions.
18564 @samp{hard} allows generation of floating-point instructions
18565 and uses FPU-specific calling conventions.
18566
18567 The default depends on the specific target configuration. Note that
18568 the hard-float and soft-float ABIs are not link-compatible; you must
18569 compile your entire program with the same ABI, and link with a
18570 compatible set of libraries.
18571
18572 @item -mgeneral-regs-only
18573 @opindex mgeneral-regs-only
18574 Generate code which uses only the general-purpose registers. This will prevent
18575 the compiler from using floating-point and Advanced SIMD registers but will not
18576 impose any restrictions on the assembler.
18577
18578 @item -mlittle-endian
18579 @opindex mlittle-endian
18580 Generate code for a processor running in little-endian mode. This is
18581 the default for all standard configurations.
18582
18583 @item -mbig-endian
18584 @opindex mbig-endian
18585 Generate code for a processor running in big-endian mode; the default is
18586 to compile code for a little-endian processor.
18587
18588 @item -mbe8
18589 @itemx -mbe32
18590 @opindex mbe8
18591 When linking a big-endian image select between BE8 and BE32 formats.
18592 The option has no effect for little-endian images and is ignored. The
18593 default is dependent on the selected target architecture. For ARMv6
18594 and later architectures the default is BE8, for older architectures
18595 the default is BE32. BE32 format has been deprecated by ARM.
18596
18597 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
18598 @opindex march
18599 This specifies the name of the target ARM architecture. GCC uses this
18600 name to determine what kind of instructions it can emit when generating
18601 assembly code. This option can be used in conjunction with or instead
18602 of the @option{-mcpu=} option.
18603
18604 Permissible names are:
18605 @samp{armv4t},
18606 @samp{armv5t}, @samp{armv5te},
18607 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18608 @samp{armv6z}, @samp{armv6zk},
18609 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
18610 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18611 @samp{armv8.4-a},
18612 @samp{armv8.5-a},
18613 @samp{armv8.6-a},
18614 @samp{armv7-r},
18615 @samp{armv8-r},
18616 @samp{armv6-m}, @samp{armv6s-m},
18617 @samp{armv7-m}, @samp{armv7e-m},
18618 @samp{armv8-m.base}, @samp{armv8-m.main},
18619 @samp{armv8.1-m.main},
18620 @samp{iwmmxt} and @samp{iwmmxt2}.
18621
18622 Additionally, the following architectures, which lack support for the
18623 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18624
18625 Many of the architectures support extensions. These can be added by
18626 appending @samp{+@var{extension}} to the architecture name. Extension
18627 options are processed in order and capabilities accumulate. An extension
18628 will also enable any necessary base extensions
18629 upon which it depends. For example, the @samp{+crypto} extension
18630 will always enable the @samp{+simd} extension. The exception to the
18631 additive construction is for extensions that are prefixed with
18632 @samp{+no@dots{}}: these extensions disable the specified option and
18633 any other extensions that may depend on the presence of that
18634 extension.
18635
18636 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18637 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18638 entirely disabled by the @samp{+nofp} option that follows it.
18639
18640 Most extension names are generically named, but have an effect that is
18641 dependent upon the architecture to which it is applied. For example,
18642 the @samp{+simd} option can be applied to both @samp{armv7-a} and
18643 @samp{armv8-a} architectures, but will enable the original ARMv7-A
18644 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18645 variant for @samp{armv8-a}.
18646
18647 The table below lists the supported extensions for each architecture.
18648 Architectures not mentioned do not support any extensions.
18649
18650 @table @samp
18651 @item armv5te
18652 @itemx armv6
18653 @itemx armv6j
18654 @itemx armv6k
18655 @itemx armv6kz
18656 @itemx armv6t2
18657 @itemx armv6z
18658 @itemx armv6zk
18659 @table @samp
18660 @item +fp
18661 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
18662 used as an alias for this extension.
18663
18664 @item +nofp
18665 Disable the floating-point instructions.
18666 @end table
18667
18668 @item armv7
18669 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18670 @table @samp
18671 @item +fp
18672 The VFPv3 floating-point instructions, with 16 double-precision
18673 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18674 for this extension. Note that floating-point is not supported by the
18675 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18676 ARMv7-R architectures.
18677
18678 @item +nofp
18679 Disable the floating-point instructions.
18680 @end table
18681
18682 @item armv7-a
18683 @table @samp
18684 @item +mp
18685 The multiprocessing extension.
18686
18687 @item +sec
18688 The security extension.
18689
18690 @item +fp
18691 The VFPv3 floating-point instructions, with 16 double-precision
18692 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18693 for this extension.
18694
18695 @item +simd
18696 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18697 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18698 for this extension.
18699
18700 @item +vfpv3
18701 The VFPv3 floating-point instructions, with 32 double-precision
18702 registers.
18703
18704 @item +vfpv3-d16-fp16
18705 The VFPv3 floating-point instructions, with 16 double-precision
18706 registers and the half-precision floating-point conversion operations.
18707
18708 @item +vfpv3-fp16
18709 The VFPv3 floating-point instructions, with 32 double-precision
18710 registers and the half-precision floating-point conversion operations.
18711
18712 @item +vfpv4-d16
18713 The VFPv4 floating-point instructions, with 16 double-precision
18714 registers.
18715
18716 @item +vfpv4
18717 The VFPv4 floating-point instructions, with 32 double-precision
18718 registers.
18719
18720 @item +neon-fp16
18721 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18722 the half-precision floating-point conversion operations.
18723
18724 @item +neon-vfpv4
18725 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18726
18727 @item +nosimd
18728 Disable the Advanced SIMD instructions (does not disable floating point).
18729
18730 @item +nofp
18731 Disable the floating-point and Advanced SIMD instructions.
18732 @end table
18733
18734 @item armv7ve
18735 The extended version of the ARMv7-A architecture with support for
18736 virtualization.
18737 @table @samp
18738 @item +fp
18739 The VFPv4 floating-point instructions, with 16 double-precision registers.
18740 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18741
18742 @item +simd
18743 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
18744 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18745
18746 @item +vfpv3-d16
18747 The VFPv3 floating-point instructions, with 16 double-precision
18748 registers.
18749
18750 @item +vfpv3
18751 The VFPv3 floating-point instructions, with 32 double-precision
18752 registers.
18753
18754 @item +vfpv3-d16-fp16
18755 The VFPv3 floating-point instructions, with 16 double-precision
18756 registers and the half-precision floating-point conversion operations.
18757
18758 @item +vfpv3-fp16
18759 The VFPv3 floating-point instructions, with 32 double-precision
18760 registers and the half-precision floating-point conversion operations.
18761
18762 @item +vfpv4-d16
18763 The VFPv4 floating-point instructions, with 16 double-precision
18764 registers.
18765
18766 @item +vfpv4
18767 The VFPv4 floating-point instructions, with 32 double-precision
18768 registers.
18769
18770 @item +neon
18771 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18772 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18773
18774 @item +neon-fp16
18775 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18776 the half-precision floating-point conversion operations.
18777
18778 @item +nosimd
18779 Disable the Advanced SIMD instructions (does not disable floating point).
18780
18781 @item +nofp
18782 Disable the floating-point and Advanced SIMD instructions.
18783 @end table
18784
18785 @item armv8-a
18786 @table @samp
18787 @item +crc
18788 The Cyclic Redundancy Check (CRC) instructions.
18789 @item +simd
18790 The ARMv8-A Advanced SIMD and floating-point instructions.
18791 @item +crypto
18792 The cryptographic instructions.
18793 @item +nocrypto
18794 Disable the cryptographic instructions.
18795 @item +nofp
18796 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18797 @item +sb
18798 Speculation Barrier Instruction.
18799 @item +predres
18800 Execution and Data Prediction Restriction Instructions.
18801 @end table
18802
18803 @item armv8.1-a
18804 @table @samp
18805 @item +simd
18806 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18807
18808 @item +crypto
18809 The cryptographic instructions. This also enables the Advanced SIMD and
18810 floating-point instructions.
18811
18812 @item +nocrypto
18813 Disable the cryptographic instructions.
18814
18815 @item +nofp
18816 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18817
18818 @item +sb
18819 Speculation Barrier Instruction.
18820
18821 @item +predres
18822 Execution and Data Prediction Restriction Instructions.
18823 @end table
18824
18825 @item armv8.2-a
18826 @itemx armv8.3-a
18827 @table @samp
18828 @item +fp16
18829 The half-precision floating-point data processing instructions.
18830 This also enables the Advanced SIMD and floating-point instructions.
18831
18832 @item +fp16fml
18833 The half-precision floating-point fmla extension. This also enables
18834 the half-precision floating-point extension and Advanced SIMD and
18835 floating-point instructions.
18836
18837 @item +simd
18838 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18839
18840 @item +crypto
18841 The cryptographic instructions. This also enables the Advanced SIMD and
18842 floating-point instructions.
18843
18844 @item +dotprod
18845 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
18846
18847 @item +nocrypto
18848 Disable the cryptographic extension.
18849
18850 @item +nofp
18851 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18852
18853 @item +sb
18854 Speculation Barrier Instruction.
18855
18856 @item +predres
18857 Execution and Data Prediction Restriction Instructions.
18858
18859 @item +i8mm
18860 8-bit Integer Matrix Multiply instructions.
18861 This also enables Advanced SIMD and floating-point instructions.
18862
18863 @item +bf16
18864 Brain half-precision floating-point instructions.
18865 This also enables Advanced SIMD and floating-point instructions.
18866 @end table
18867
18868 @item armv8.4-a
18869 @table @samp
18870 @item +fp16
18871 The half-precision floating-point data processing instructions.
18872 This also enables the Advanced SIMD and floating-point instructions as well
18873 as the Dot Product extension and the half-precision floating-point fmla
18874 extension.
18875
18876 @item +simd
18877 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18878 Dot Product extension.
18879
18880 @item +crypto
18881 The cryptographic instructions. This also enables the Advanced SIMD and
18882 floating-point instructions as well as the Dot Product extension.
18883
18884 @item +nocrypto
18885 Disable the cryptographic extension.
18886
18887 @item +nofp
18888 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18889
18890 @item +sb
18891 Speculation Barrier Instruction.
18892
18893 @item +predres
18894 Execution and Data Prediction Restriction Instructions.
18895
18896 @item +i8mm
18897 8-bit Integer Matrix Multiply instructions.
18898 This also enables Advanced SIMD and floating-point instructions.
18899
18900 @item +bf16
18901 Brain half-precision floating-point instructions.
18902 This also enables Advanced SIMD and floating-point instructions.
18903 @end table
18904
18905 @item armv8.5-a
18906 @table @samp
18907 @item +fp16
18908 The half-precision floating-point data processing instructions.
18909 This also enables the Advanced SIMD and floating-point instructions as well
18910 as the Dot Product extension and the half-precision floating-point fmla
18911 extension.
18912
18913 @item +simd
18914 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18915 Dot Product extension.
18916
18917 @item +crypto
18918 The cryptographic instructions. This also enables the Advanced SIMD and
18919 floating-point instructions as well as the Dot Product extension.
18920
18921 @item +nocrypto
18922 Disable the cryptographic extension.
18923
18924 @item +nofp
18925 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18926
18927 @item +i8mm
18928 8-bit Integer Matrix Multiply instructions.
18929 This also enables Advanced SIMD and floating-point instructions.
18930
18931 @item +bf16
18932 Brain half-precision floating-point instructions.
18933 This also enables Advanced SIMD and floating-point instructions.
18934 @end table
18935
18936 @item armv8.6-a
18937 @table @samp
18938 @item +fp16
18939 The half-precision floating-point data processing instructions.
18940 This also enables the Advanced SIMD and floating-point instructions as well
18941 as the Dot Product extension and the half-precision floating-point fmla
18942 extension.
18943
18944 @item +simd
18945 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18946 Dot Product extension.
18947
18948 @item +crypto
18949 The cryptographic instructions. This also enables the Advanced SIMD and
18950 floating-point instructions as well as the Dot Product extension.
18951
18952 @item +nocrypto
18953 Disable the cryptographic extension.
18954
18955 @item +nofp
18956 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18957
18958 @item +i8mm
18959 8-bit Integer Matrix Multiply instructions.
18960 This also enables Advanced SIMD and floating-point instructions.
18961
18962 @item +bf16
18963 Brain half-precision floating-point instructions.
18964 This also enables Advanced SIMD and floating-point instructions.
18965 @end table
18966
18967 @item armv7-r
18968 @table @samp
18969 @item +fp.sp
18970 The single-precision VFPv3 floating-point instructions. The extension
18971 @samp{+vfpv3xd} can be used as an alias for this extension.
18972
18973 @item +fp
18974 The VFPv3 floating-point instructions with 16 double-precision registers.
18975 The extension +vfpv3-d16 can be used as an alias for this extension.
18976
18977 @item +vfpv3xd-d16-fp16
18978 The single-precision VFPv3 floating-point instructions with 16 double-precision
18979 registers and the half-precision floating-point conversion operations.
18980
18981 @item +vfpv3-d16-fp16
18982 The VFPv3 floating-point instructions with 16 double-precision
18983 registers and the half-precision floating-point conversion operations.
18984
18985 @item +nofp
18986 Disable the floating-point extension.
18987
18988 @item +idiv
18989 The ARM-state integer division instructions.
18990
18991 @item +noidiv
18992 Disable the ARM-state integer division extension.
18993 @end table
18994
18995 @item armv7e-m
18996 @table @samp
18997 @item +fp
18998 The single-precision VFPv4 floating-point instructions.
18999
19000 @item +fpv5
19001 The single-precision FPv5 floating-point instructions.
19002
19003 @item +fp.dp
19004 The single- and double-precision FPv5 floating-point instructions.
19005
19006 @item +nofp
19007 Disable the floating-point extensions.
19008 @end table
19009
19010 @item armv8.1-m.main
19011 @table @samp
19012
19013 @item +dsp
19014 The DSP instructions.
19015
19016 @item +mve
19017 The M-Profile Vector Extension (MVE) integer instructions.
19018
19019 @item +mve.fp
19020 The M-Profile Vector Extension (MVE) integer and single precision
19021 floating-point instructions.
19022
19023 @item +fp
19024 The single-precision floating-point instructions.
19025
19026 @item +fp.dp
19027 The single- and double-precision floating-point instructions.
19028
19029 @item +nofp
19030 Disable the floating-point extension.
19031
19032 @item +cdecp0, +cdecp1, ... , +cdecp7
19033 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
19034 to the numbers given in the options in the range 0 to 7.
19035 @end table
19036
19037 @item armv8-m.main
19038 @table @samp
19039 @item +dsp
19040 The DSP instructions.
19041
19042 @item +nodsp
19043 Disable the DSP extension.
19044
19045 @item +fp
19046 The single-precision floating-point instructions.
19047
19048 @item +fp.dp
19049 The single- and double-precision floating-point instructions.
19050
19051 @item +nofp
19052 Disable the floating-point extension.
19053
19054 @item +cdecp0, +cdecp1, ... , +cdecp7
19055 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
19056 to the numbers given in the options in the range 0 to 7.
19057 @end table
19058
19059 @item armv8-r
19060 @table @samp
19061 @item +crc
19062 The Cyclic Redundancy Check (CRC) instructions.
19063 @item +fp.sp
19064 The single-precision FPv5 floating-point instructions.
19065 @item +simd
19066 The ARMv8-A Advanced SIMD and floating-point instructions.
19067 @item +crypto
19068 The cryptographic instructions.
19069 @item +nocrypto
19070 Disable the cryptographic instructions.
19071 @item +nofp
19072 Disable the floating-point, Advanced SIMD and cryptographic instructions.
19073 @end table
19074
19075 @end table
19076
19077 @option{-march=native} causes the compiler to auto-detect the architecture
19078 of the build computer. At present, this feature is only supported on
19079 GNU/Linux, and not all architectures are recognized. If the auto-detect
19080 is unsuccessful the option has no effect.
19081
19082 @item -mtune=@var{name}
19083 @opindex mtune
19084 This option specifies the name of the target ARM processor for
19085 which GCC should tune the performance of the code.
19086 For some ARM implementations better performance can be obtained by using
19087 this option.
19088 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
19089 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
19090 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
19091 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
19092 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
19093 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
19094 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
19095 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
19096 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
19097 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
19098 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
19099 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
19100 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
19101 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
19102 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
19103 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
19104 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
19105 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
19106 @samp{cortex-m35p}, @samp{cortex-m55},
19107 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
19108 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
19109 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
19110 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
19111 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
19112
19113 Additionally, this option can specify that GCC should tune the performance
19114 of the code for a big.LITTLE system. Permissible names are:
19115 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
19116 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
19117 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
19118 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
19119
19120 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
19121 performance for a blend of processors within architecture @var{arch}.
19122 The aim is to generate code that run well on the current most popular
19123 processors, balancing between optimizations that benefit some CPUs in the
19124 range, and avoiding performance pitfalls of other CPUs. The effects of
19125 this option may change in future GCC versions as CPU models come and go.
19126
19127 @option{-mtune} permits the same extension options as @option{-mcpu}, but
19128 the extension options do not affect the tuning of the generated code.
19129
19130 @option{-mtune=native} causes the compiler to auto-detect the CPU
19131 of the build computer. At present, this feature is only supported on
19132 GNU/Linux, and not all architectures are recognized. If the auto-detect is
19133 unsuccessful the option has no effect.
19134
19135 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
19136 @opindex mcpu
19137 This specifies the name of the target ARM processor. GCC uses this name
19138 to derive the name of the target ARM architecture (as if specified
19139 by @option{-march}) and the ARM processor type for which to tune for
19140 performance (as if specified by @option{-mtune}). Where this option
19141 is used in conjunction with @option{-march} or @option{-mtune},
19142 those options take precedence over the appropriate part of this option.
19143
19144 Many of the supported CPUs implement optional architectural
19145 extensions. Where this is so the architectural extensions are
19146 normally enabled by default. If implementations that lack the
19147 extension exist, then the extension syntax can be used to disable
19148 those extensions that have been omitted. For floating-point and
19149 Advanced SIMD (Neon) instructions, the settings of the options
19150 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
19151 floating-point and Advanced SIMD instructions will only be used if
19152 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
19153 @option{-mfpu} other than @samp{auto} will override the available
19154 floating-point and SIMD extension instructions.
19155
19156 For example, @samp{cortex-a9} can be found in three major
19157 configurations: integer only, with just a floating-point unit or with
19158 floating-point and Advanced SIMD. The default is to enable all the
19159 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
19160 be used to disable just the SIMD or both the SIMD and floating-point
19161 instructions respectively.
19162
19163 Permissible names for this option are the same as those for
19164 @option{-mtune}.
19165
19166 The following extension options are common to the listed CPUs:
19167
19168 @table @samp
19169 @item +nodsp
19170 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
19171
19172 @item +nofp
19173 Disables the floating-point instructions on @samp{arm9e},
19174 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
19175 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
19176 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
19177 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
19178 Disables the floating-point and SIMD instructions on
19179 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
19180 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
19181 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
19182 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
19183 @samp{cortex-a53} and @samp{cortex-a55}.
19184
19185 @item +nofp.dp
19186 Disables the double-precision component of the floating-point instructions
19187 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
19188 @samp{cortex-m7}.
19189
19190 @item +nosimd
19191 Disables the SIMD (but not floating-point) instructions on
19192 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
19193 and @samp{cortex-a9}.
19194
19195 @item +crypto
19196 Enables the cryptographic instructions on @samp{cortex-a32},
19197 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
19198 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
19199 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
19200 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
19201 @samp{cortex-a75.cortex-a55}.
19202 @end table
19203
19204 Additionally the @samp{generic-armv7-a} pseudo target defaults to
19205 VFPv3 with 16 double-precision registers. It supports the following
19206 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
19207 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
19208 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
19209 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
19210 the extensions to @option{-march=armv7-a}.
19211
19212 @option{-mcpu=generic-@var{arch}} is also permissible, and is
19213 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
19214 See @option{-mtune} for more information.
19215
19216 @option{-mcpu=native} causes the compiler to auto-detect the CPU
19217 of the build computer. At present, this feature is only supported on
19218 GNU/Linux, and not all architectures are recognized. If the auto-detect
19219 is unsuccessful the option has no effect.
19220
19221 @item -mfpu=@var{name}
19222 @opindex mfpu
19223 This specifies what floating-point hardware (or hardware emulation) is
19224 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
19225 @samp{vfpv3},
19226 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
19227 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
19228 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
19229 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
19230 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
19231 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
19232 is an alias for @samp{vfpv2}.
19233
19234 The setting @samp{auto} is the default and is special. It causes the
19235 compiler to select the floating-point and Advanced SIMD instructions
19236 based on the settings of @option{-mcpu} and @option{-march}.
19237
19238 If the selected floating-point hardware includes the NEON extension
19239 (e.g.@: @option{-mfpu=neon}), note that floating-point
19240 operations are not generated by GCC's auto-vectorization pass unless
19241 @option{-funsafe-math-optimizations} is also specified. This is
19242 because NEON hardware does not fully implement the IEEE 754 standard for
19243 floating-point arithmetic (in particular denormal values are treated as
19244 zero), so the use of NEON instructions may lead to a loss of precision.
19245
19246 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}).
19247
19248 @item -mfp16-format=@var{name}
19249 @opindex mfp16-format
19250 Specify the format of the @code{__fp16} half-precision floating-point type.
19251 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
19252 the default is @samp{none}, in which case the @code{__fp16} type is not
19253 defined. @xref{Half-Precision}, for more information.
19254
19255 @item -mstructure-size-boundary=@var{n}
19256 @opindex mstructure-size-boundary
19257 The sizes of all structures and unions are rounded up to a multiple
19258 of the number of bits set by this option. Permissible values are 8, 32
19259 and 64. The default value varies for different toolchains. For the COFF
19260 targeted toolchain the default value is 8. A value of 64 is only allowed
19261 if the underlying ABI supports it.
19262
19263 Specifying a larger number can produce faster, more efficient code, but
19264 can also increase the size of the program. Different values are potentially
19265 incompatible. Code compiled with one value cannot necessarily expect to
19266 work with code or libraries compiled with another value, if they exchange
19267 information using structures or unions.
19268
19269 This option is deprecated.
19270
19271 @item -mabort-on-noreturn
19272 @opindex mabort-on-noreturn
19273 Generate a call to the function @code{abort} at the end of a
19274 @code{noreturn} function. It is executed if the function tries to
19275 return.
19276
19277 @item -mlong-calls
19278 @itemx -mno-long-calls
19279 @opindex mlong-calls
19280 @opindex mno-long-calls
19281 Tells the compiler to perform function calls by first loading the
19282 address of the function into a register and then performing a subroutine
19283 call on this register. This switch is needed if the target function
19284 lies outside of the 64-megabyte addressing range of the offset-based
19285 version of subroutine call instruction.
19286
19287 Even if this switch is enabled, not all function calls are turned
19288 into long calls. The heuristic is that static functions, functions
19289 that have the @code{short_call} attribute, functions that are inside
19290 the scope of a @code{#pragma no_long_calls} directive, and functions whose
19291 definitions have already been compiled within the current compilation
19292 unit are not turned into long calls. The exceptions to this rule are
19293 that weak function definitions, functions with the @code{long_call}
19294 attribute or the @code{section} attribute, and functions that are within
19295 the scope of a @code{#pragma long_calls} directive are always
19296 turned into long calls.
19297
19298 This feature is not enabled by default. Specifying
19299 @option{-mno-long-calls} restores the default behavior, as does
19300 placing the function calls within the scope of a @code{#pragma
19301 long_calls_off} directive. Note these switches have no effect on how
19302 the compiler generates code to handle function calls via function
19303 pointers.
19304
19305 @item -msingle-pic-base
19306 @opindex msingle-pic-base
19307 Treat the register used for PIC addressing as read-only, rather than
19308 loading it in the prologue for each function. The runtime system is
19309 responsible for initializing this register with an appropriate value
19310 before execution begins.
19311
19312 @item -mpic-register=@var{reg}
19313 @opindex mpic-register
19314 Specify the register to be used for PIC addressing.
19315 For standard PIC base case, the default is any suitable register
19316 determined by compiler. For single PIC base case, the default is
19317 @samp{R9} if target is EABI based or stack-checking is enabled,
19318 otherwise the default is @samp{R10}.
19319
19320 @item -mpic-data-is-text-relative
19321 @opindex mpic-data-is-text-relative
19322 Assume that the displacement between the text and data segments is fixed
19323 at static link time. This permits using PC-relative addressing
19324 operations to access data known to be in the data segment. For
19325 non-VxWorks RTP targets, this option is enabled by default. When
19326 disabled on such targets, it will enable @option{-msingle-pic-base} by
19327 default.
19328
19329 @item -mpoke-function-name
19330 @opindex mpoke-function-name
19331 Write the name of each function into the text section, directly
19332 preceding the function prologue. The generated code is similar to this:
19333
19334 @smallexample
19335 t0
19336 .ascii "arm_poke_function_name", 0
19337 .align
19338 t1
19339 .word 0xff000000 + (t1 - t0)
19340 arm_poke_function_name
19341 mov ip, sp
19342 stmfd sp!, @{fp, ip, lr, pc@}
19343 sub fp, ip, #4
19344 @end smallexample
19345
19346 When performing a stack backtrace, code can inspect the value of
19347 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
19348 location @code{pc - 12} and the top 8 bits are set, then we know that
19349 there is a function name embedded immediately preceding this location
19350 and has length @code{((pc[-3]) & 0xff000000)}.
19351
19352 @item -mthumb
19353 @itemx -marm
19354 @opindex marm
19355 @opindex mthumb
19356
19357 Select between generating code that executes in ARM and Thumb
19358 states. The default for most configurations is to generate code
19359 that executes in ARM state, but the default can be changed by
19360 configuring GCC with the @option{--with-mode=}@var{state}
19361 configure option.
19362
19363 You can also override the ARM and Thumb mode for each function
19364 by using the @code{target("thumb")} and @code{target("arm")} function attributes
19365 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
19366
19367 @item -mflip-thumb
19368 @opindex mflip-thumb
19369 Switch ARM/Thumb modes on alternating functions.
19370 This option is provided for regression testing of mixed Thumb/ARM code
19371 generation, and is not intended for ordinary use in compiling code.
19372
19373 @item -mtpcs-frame
19374 @opindex mtpcs-frame
19375 Generate a stack frame that is compliant with the Thumb Procedure Call
19376 Standard for all non-leaf functions. (A leaf function is one that does
19377 not call any other functions.) The default is @option{-mno-tpcs-frame}.
19378
19379 @item -mtpcs-leaf-frame
19380 @opindex mtpcs-leaf-frame
19381 Generate a stack frame that is compliant with the Thumb Procedure Call
19382 Standard for all leaf functions. (A leaf function is one that does
19383 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
19384
19385 @item -mcallee-super-interworking
19386 @opindex mcallee-super-interworking
19387 Gives all externally visible functions in the file being compiled an ARM
19388 instruction set header which switches to Thumb mode before executing the
19389 rest of the function. This allows these functions to be called from
19390 non-interworking code. This option is not valid in AAPCS configurations
19391 because interworking is enabled by default.
19392
19393 @item -mcaller-super-interworking
19394 @opindex mcaller-super-interworking
19395 Allows calls via function pointers (including virtual functions) to
19396 execute correctly regardless of whether the target code has been
19397 compiled for interworking or not. There is a small overhead in the cost
19398 of executing a function pointer if this option is enabled. This option
19399 is not valid in AAPCS configurations because interworking is enabled
19400 by default.
19401
19402 @item -mtp=@var{name}
19403 @opindex mtp
19404 Specify the access model for the thread local storage pointer. The valid
19405 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
19406 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
19407 (supported in the arm6k architecture), and @samp{auto}, which uses the
19408 best available method for the selected processor. The default setting is
19409 @samp{auto}.
19410
19411 @item -mtls-dialect=@var{dialect}
19412 @opindex mtls-dialect
19413 Specify the dialect to use for accessing thread local storage. Two
19414 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
19415 @samp{gnu} dialect selects the original GNU scheme for supporting
19416 local and global dynamic TLS models. The @samp{gnu2} dialect
19417 selects the GNU descriptor scheme, which provides better performance
19418 for shared libraries. The GNU descriptor scheme is compatible with
19419 the original scheme, but does require new assembler, linker and
19420 library support. Initial and local exec TLS models are unaffected by
19421 this option and always use the original scheme.
19422
19423 @item -mword-relocations
19424 @opindex mword-relocations
19425 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
19426 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
19427 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
19428 is specified. This option conflicts with @option{-mslow-flash-data}.
19429
19430 @item -mfix-cortex-m3-ldrd
19431 @opindex mfix-cortex-m3-ldrd
19432 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
19433 with overlapping destination and base registers are used. This option avoids
19434 generating these instructions. This option is enabled by default when
19435 @option{-mcpu=cortex-m3} is specified.
19436
19437 @item -munaligned-access
19438 @itemx -mno-unaligned-access
19439 @opindex munaligned-access
19440 @opindex mno-unaligned-access
19441 Enables (or disables) reading and writing of 16- and 32- bit values
19442 from addresses that are not 16- or 32- bit aligned. By default
19443 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19444 ARMv8-M Baseline architectures, and enabled for all other
19445 architectures. If unaligned access is not enabled then words in packed
19446 data structures are accessed a byte at a time.
19447
19448 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
19449 generated object file to either true or false, depending upon the
19450 setting of this option. If unaligned access is enabled then the
19451 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
19452 defined.
19453
19454 @item -mneon-for-64bits
19455 @opindex mneon-for-64bits
19456 This option is deprecated and has no effect.
19457
19458 @item -mslow-flash-data
19459 @opindex mslow-flash-data
19460 Assume loading data from flash is slower than fetching instruction.
19461 Therefore literal load is minimized for better performance.
19462 This option is only supported when compiling for ARMv7 M-profile and
19463 off by default. It conflicts with @option{-mword-relocations}.
19464
19465 @item -masm-syntax-unified
19466 @opindex masm-syntax-unified
19467 Assume inline assembler is using unified asm syntax. The default is
19468 currently off which implies divided syntax. This option has no impact
19469 on Thumb2. However, this may change in future releases of GCC.
19470 Divided syntax should be considered deprecated.
19471
19472 @item -mrestrict-it
19473 @opindex mrestrict-it
19474 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19475 IT blocks can only contain a single 16-bit instruction from a select
19476 set of instructions. This option is on by default for ARMv8-A Thumb mode.
19477
19478 @item -mprint-tune-info
19479 @opindex mprint-tune-info
19480 Print CPU tuning information as comment in assembler file. This is
19481 an option used only for regression testing of the compiler and not
19482 intended for ordinary use in compiling code. This option is disabled
19483 by default.
19484
19485 @item -mverbose-cost-dump
19486 @opindex mverbose-cost-dump
19487 Enable verbose cost model dumping in the debug dump files. This option is
19488 provided for use in debugging the compiler.
19489
19490 @item -mpure-code
19491 @opindex mpure-code
19492 Do not allow constant data to be placed in code sections.
19493 Additionally, when compiling for ELF object format give all text sections the
19494 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
19495 is only available when generating non-pic code for M-profile targets.
19496
19497 @item -mcmse
19498 @opindex mcmse
19499 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19500 Development Tools Engineering Specification", which can be found on
19501 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
19502
19503 @item -mfdpic
19504 @itemx -mno-fdpic
19505 @opindex mfdpic
19506 @opindex mno-fdpic
19507 Select the FDPIC ABI, which uses 64-bit function descriptors to
19508 represent pointers to functions. When the compiler is configured for
19509 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19510 and implies @option{-fPIE} if none of the PIC/PIE-related options is
19511 provided. On other targets, it only enables the FDPIC-specific code
19512 generation features, and the user should explicitly provide the
19513 PIC/PIE-related options as needed.
19514
19515 Note that static linking is not supported because it would still
19516 involve the dynamic linker when the program self-relocates. If such
19517 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19518
19519 The opposite @option{-mno-fdpic} option is useful (and required) to
19520 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19521 toolchain as the one used to build the userland programs.
19522
19523 @end table
19524
19525 @node AVR Options
19526 @subsection AVR Options
19527 @cindex AVR Options
19528
19529 These options are defined for AVR implementations:
19530
19531 @table @gcctabopt
19532 @item -mmcu=@var{mcu}
19533 @opindex mmcu
19534 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19535
19536 The default for this option is@tie{}@samp{avr2}.
19537
19538 GCC supports the following AVR devices and ISAs:
19539
19540 @include avr-mmcu.texi
19541
19542 @item -mabsdata
19543 @opindex mabsdata
19544
19545 Assume that all data in static storage can be accessed by LDS / STS
19546 instructions. This option has only an effect on reduced Tiny devices like
19547 ATtiny40. See also the @code{absdata}
19548 @ref{AVR Variable Attributes,variable attribute}.
19549
19550 @item -maccumulate-args
19551 @opindex maccumulate-args
19552 Accumulate outgoing function arguments and acquire/release the needed
19553 stack space for outgoing function arguments once in function
19554 prologue/epilogue. Without this option, outgoing arguments are pushed
19555 before calling a function and popped afterwards.
19556
19557 Popping the arguments after the function call can be expensive on
19558 AVR so that accumulating the stack space might lead to smaller
19559 executables because arguments need not be removed from the
19560 stack after such a function call.
19561
19562 This option can lead to reduced code size for functions that perform
19563 several calls to functions that get their arguments on the stack like
19564 calls to printf-like functions.
19565
19566 @item -mbranch-cost=@var{cost}
19567 @opindex mbranch-cost
19568 Set the branch costs for conditional branch instructions to
19569 @var{cost}. Reasonable values for @var{cost} are small, non-negative
19570 integers. The default branch cost is 0.
19571
19572 @item -mcall-prologues
19573 @opindex mcall-prologues
19574 Functions prologues/epilogues are expanded as calls to appropriate
19575 subroutines. Code size is smaller.
19576
19577 @item -mdouble=@var{bits}
19578 @itemx -mlong-double=@var{bits}
19579 @opindex mdouble
19580 @opindex mlong-double
19581 Set the size (in bits) of the @code{double} or @code{long double} type,
19582 respectively. Possible values for @var{bits} are 32 and 64.
19583 Whether or not a specific value for @var{bits} is allowed depends on
19584 the @code{--with-double=} and @code{--with-long-double=}
19585 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19586 and the same applies for the default values of the options.
19587
19588 @item -mgas-isr-prologues
19589 @opindex mgas-isr-prologues
19590 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19591 instruction supported by GNU Binutils.
19592 If this option is on, the feature can still be disabled for individual
19593 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19594 function attribute. This feature is activated per default
19595 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19596 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19597
19598 @item -mint8
19599 @opindex mint8
19600 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
19601 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19602 and @code{long long} is 4 bytes. Please note that this option does not
19603 conform to the C standards, but it results in smaller code
19604 size.
19605
19606 @item -mmain-is-OS_task
19607 @opindex mmain-is-OS_task
19608 Do not save registers in @code{main}. The effect is the same like
19609 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19610 to @code{main}. It is activated per default if optimization is on.
19611
19612 @item -mn-flash=@var{num}
19613 @opindex mn-flash
19614 Assume that the flash memory has a size of
19615 @var{num} times 64@tie{}KiB.
19616
19617 @item -mno-interrupts
19618 @opindex mno-interrupts
19619 Generated code is not compatible with hardware interrupts.
19620 Code size is smaller.
19621
19622 @item -mrelax
19623 @opindex mrelax
19624 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19625 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19626 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19627 the assembler's command line and the @option{--relax} option to the
19628 linker's command line.
19629
19630 Jump relaxing is performed by the linker because jump offsets are not
19631 known before code is located. Therefore, the assembler code generated by the
19632 compiler is the same, but the instructions in the executable may
19633 differ from instructions in the assembler code.
19634
19635 Relaxing must be turned on if linker stubs are needed, see the
19636 section on @code{EIND} and linker stubs below.
19637
19638 @item -mrmw
19639 @opindex mrmw
19640 Assume that the device supports the Read-Modify-Write
19641 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19642
19643 @item -mshort-calls
19644 @opindex mshort-calls
19645
19646 Assume that @code{RJMP} and @code{RCALL} can target the whole
19647 program memory.
19648
19649 This option is used internally for multilib selection. It is
19650 not an optimization option, and you don't need to set it by hand.
19651
19652 @item -msp8
19653 @opindex msp8
19654 Treat the stack pointer register as an 8-bit register,
19655 i.e.@: assume the high byte of the stack pointer is zero.
19656 In general, you don't need to set this option by hand.
19657
19658 This option is used internally by the compiler to select and
19659 build multilibs for architectures @code{avr2} and @code{avr25}.
19660 These architectures mix devices with and without @code{SPH}.
19661 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19662 the compiler driver adds or removes this option from the compiler
19663 proper's command line, because the compiler then knows if the device
19664 or architecture has an 8-bit stack pointer and thus no @code{SPH}
19665 register or not.
19666
19667 @item -mstrict-X
19668 @opindex mstrict-X
19669 Use address register @code{X} in a way proposed by the hardware. This means
19670 that @code{X} is only used in indirect, post-increment or
19671 pre-decrement addressing.
19672
19673 Without this option, the @code{X} register may be used in the same way
19674 as @code{Y} or @code{Z} which then is emulated by additional
19675 instructions.
19676 For example, loading a value with @code{X+const} addressing with a
19677 small non-negative @code{const < 64} to a register @var{Rn} is
19678 performed as
19679
19680 @example
19681 adiw r26, const ; X += const
19682 ld @var{Rn}, X ; @var{Rn} = *X
19683 sbiw r26, const ; X -= const
19684 @end example
19685
19686 @item -mtiny-stack
19687 @opindex mtiny-stack
19688 Only change the lower 8@tie{}bits of the stack pointer.
19689
19690 @item -mfract-convert-truncate
19691 @opindex mfract-convert-truncate
19692 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19693
19694 @item -nodevicelib
19695 @opindex nodevicelib
19696 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19697
19698 @item -nodevicespecs
19699 @opindex nodevicespecs
19700 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19701 command line. The user takes responsibility for supplying the sub-processes
19702 like compiler proper, assembler and linker with appropriate command line
19703 options. This means that the user has to supply her private device specs
19704 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
19705 more need for option @option{-mmcu=@var{mcu}}.
19706
19707 This option can also serve as a replacement for the older way of
19708 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19709 which contains a folder named @code{device-specs} which contains a specs file named
19710 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19711
19712 @item -Waddr-space-convert
19713 @opindex Waddr-space-convert
19714 @opindex Wno-addr-space-convert
19715 Warn about conversions between address spaces in the case where the
19716 resulting address space is not contained in the incoming address space.
19717
19718 @item -Wmisspelled-isr
19719 @opindex Wmisspelled-isr
19720 @opindex Wno-misspelled-isr
19721 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19722 Enabled by default.
19723 @end table
19724
19725 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19726 @cindex @code{EIND}
19727 Pointers in the implementation are 16@tie{}bits wide.
19728 The address of a function or label is represented as word address so
19729 that indirect jumps and calls can target any code address in the
19730 range of 64@tie{}Ki words.
19731
19732 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19733 bytes of program memory space, there is a special function register called
19734 @code{EIND} that serves as most significant part of the target address
19735 when @code{EICALL} or @code{EIJMP} instructions are used.
19736
19737 Indirect jumps and calls on these devices are handled as follows by
19738 the compiler and are subject to some limitations:
19739
19740 @itemize @bullet
19741
19742 @item
19743 The compiler never sets @code{EIND}.
19744
19745 @item
19746 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19747 instructions or might read @code{EIND} directly in order to emulate an
19748 indirect call/jump by means of a @code{RET} instruction.
19749
19750 @item
19751 The compiler assumes that @code{EIND} never changes during the startup
19752 code or during the application. In particular, @code{EIND} is not
19753 saved/restored in function or interrupt service routine
19754 prologue/epilogue.
19755
19756 @item
19757 For indirect calls to functions and computed goto, the linker
19758 generates @emph{stubs}. Stubs are jump pads sometimes also called
19759 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19760 The stub contains a direct jump to the desired address.
19761
19762 @item
19763 Linker relaxation must be turned on so that the linker generates
19764 the stubs correctly in all situations. See the compiler option
19765 @option{-mrelax} and the linker option @option{--relax}.
19766 There are corner cases where the linker is supposed to generate stubs
19767 but aborts without relaxation and without a helpful error message.
19768
19769 @item
19770 The default linker script is arranged for code with @code{EIND = 0}.
19771 If code is supposed to work for a setup with @code{EIND != 0}, a custom
19772 linker script has to be used in order to place the sections whose
19773 name start with @code{.trampolines} into the segment where @code{EIND}
19774 points to.
19775
19776 @item
19777 The startup code from libgcc never sets @code{EIND}.
19778 Notice that startup code is a blend of code from libgcc and AVR-LibC.
19779 For the impact of AVR-LibC on @code{EIND}, see the
19780 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19781
19782 @item
19783 It is legitimate for user-specific startup code to set up @code{EIND}
19784 early, for example by means of initialization code located in
19785 section @code{.init3}. Such code runs prior to general startup code
19786 that initializes RAM and calls constructors, but after the bit
19787 of startup code from AVR-LibC that sets @code{EIND} to the segment
19788 where the vector table is located.
19789 @example
19790 #include <avr/io.h>
19791
19792 static void
19793 __attribute__((section(".init3"),naked,used,no_instrument_function))
19794 init3_set_eind (void)
19795 @{
19796 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19797 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19798 @}
19799 @end example
19800
19801 @noindent
19802 The @code{__trampolines_start} symbol is defined in the linker script.
19803
19804 @item
19805 Stubs are generated automatically by the linker if
19806 the following two conditions are met:
19807 @itemize @minus
19808
19809 @item The address of a label is taken by means of the @code{gs} modifier
19810 (short for @emph{generate stubs}) like so:
19811 @example
19812 LDI r24, lo8(gs(@var{func}))
19813 LDI r25, hi8(gs(@var{func}))
19814 @end example
19815 @item The final location of that label is in a code segment
19816 @emph{outside} the segment where the stubs are located.
19817 @end itemize
19818
19819 @item
19820 The compiler emits such @code{gs} modifiers for code labels in the
19821 following situations:
19822 @itemize @minus
19823 @item Taking address of a function or code label.
19824 @item Computed goto.
19825 @item If prologue-save function is used, see @option{-mcall-prologues}
19826 command-line option.
19827 @item Switch/case dispatch tables. If you do not want such dispatch
19828 tables you can specify the @option{-fno-jump-tables} command-line option.
19829 @item C and C++ constructors/destructors called during startup/shutdown.
19830 @item If the tools hit a @code{gs()} modifier explained above.
19831 @end itemize
19832
19833 @item
19834 Jumping to non-symbolic addresses like so is @emph{not} supported:
19835
19836 @example
19837 int main (void)
19838 @{
19839 /* Call function at word address 0x2 */
19840 return ((int(*)(void)) 0x2)();
19841 @}
19842 @end example
19843
19844 Instead, a stub has to be set up, i.e.@: the function has to be called
19845 through a symbol (@code{func_4} in the example):
19846
19847 @example
19848 int main (void)
19849 @{
19850 extern int func_4 (void);
19851
19852 /* Call function at byte address 0x4 */
19853 return func_4();
19854 @}
19855 @end example
19856
19857 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19858 Alternatively, @code{func_4} can be defined in the linker script.
19859 @end itemize
19860
19861 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19862 @cindex @code{RAMPD}
19863 @cindex @code{RAMPX}
19864 @cindex @code{RAMPY}
19865 @cindex @code{RAMPZ}
19866 Some AVR devices support memories larger than the 64@tie{}KiB range
19867 that can be accessed with 16-bit pointers. To access memory locations
19868 outside this 64@tie{}KiB range, the content of a @code{RAMP}
19869 register is used as high part of the address:
19870 The @code{X}, @code{Y}, @code{Z} address register is concatenated
19871 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19872 register, respectively, to get a wide address. Similarly,
19873 @code{RAMPD} is used together with direct addressing.
19874
19875 @itemize
19876 @item
19877 The startup code initializes the @code{RAMP} special function
19878 registers with zero.
19879
19880 @item
19881 If a @ref{AVR Named Address Spaces,named address space} other than
19882 generic or @code{__flash} is used, then @code{RAMPZ} is set
19883 as needed before the operation.
19884
19885 @item
19886 If the device supports RAM larger than 64@tie{}KiB and the compiler
19887 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
19888 is reset to zero after the operation.
19889
19890 @item
19891 If the device comes with a specific @code{RAMP} register, the ISR
19892 prologue/epilogue saves/restores that SFR and initializes it with
19893 zero in case the ISR code might (implicitly) use it.
19894
19895 @item
19896 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
19897 If you use inline assembler to read from locations outside the
19898 16-bit address range and change one of the @code{RAMP} registers,
19899 you must reset it to zero after the access.
19900
19901 @end itemize
19902
19903 @subsubsection AVR Built-in Macros
19904
19905 GCC defines several built-in macros so that the user code can test
19906 for the presence or absence of features. Almost any of the following
19907 built-in macros are deduced from device capabilities and thus
19908 triggered by the @option{-mmcu=} command-line option.
19909
19910 For even more AVR-specific built-in macros see
19911 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
19912
19913 @table @code
19914
19915 @item __AVR_ARCH__
19916 Build-in macro that resolves to a decimal number that identifies the
19917 architecture and depends on the @option{-mmcu=@var{mcu}} option.
19918 Possible values are:
19919
19920 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
19921 @code{4}, @code{5}, @code{51}, @code{6}
19922
19923 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
19924 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
19925
19926 respectively and
19927
19928 @code{100},
19929 @code{102}, @code{103}, @code{104},
19930 @code{105}, @code{106}, @code{107}
19931
19932 for @var{mcu}=@code{avrtiny},
19933 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
19934 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
19935 If @var{mcu} specifies a device, this built-in macro is set
19936 accordingly. For example, with @option{-mmcu=atmega8} the macro is
19937 defined to @code{4}.
19938
19939 @item __AVR_@var{Device}__
19940 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
19941 the device's name. For example, @option{-mmcu=atmega8} defines the
19942 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
19943 @code{__AVR_ATtiny261A__}, etc.
19944
19945 The built-in macros' names follow
19946 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
19947 the device name as from the AVR user manual. The difference between
19948 @var{Device} in the built-in macro and @var{device} in
19949 @option{-mmcu=@var{device}} is that the latter is always lowercase.
19950
19951 If @var{device} is not a device but only a core architecture like
19952 @samp{avr51}, this macro is not defined.
19953
19954 @item __AVR_DEVICE_NAME__
19955 Setting @option{-mmcu=@var{device}} defines this built-in macro to
19956 the device's name. For example, with @option{-mmcu=atmega8} the macro
19957 is defined to @code{atmega8}.
19958
19959 If @var{device} is not a device but only a core architecture like
19960 @samp{avr51}, this macro is not defined.
19961
19962 @item __AVR_XMEGA__
19963 The device / architecture belongs to the XMEGA family of devices.
19964
19965 @item __AVR_HAVE_ELPM__
19966 The device has the @code{ELPM} instruction.
19967
19968 @item __AVR_HAVE_ELPMX__
19969 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
19970 R@var{n},Z+} instructions.
19971
19972 @item __AVR_HAVE_MOVW__
19973 The device has the @code{MOVW} instruction to perform 16-bit
19974 register-register moves.
19975
19976 @item __AVR_HAVE_LPMX__
19977 The device has the @code{LPM R@var{n},Z} and
19978 @code{LPM R@var{n},Z+} instructions.
19979
19980 @item __AVR_HAVE_MUL__
19981 The device has a hardware multiplier.
19982
19983 @item __AVR_HAVE_JMP_CALL__
19984 The device has the @code{JMP} and @code{CALL} instructions.
19985 This is the case for devices with more than 8@tie{}KiB of program
19986 memory.
19987
19988 @item __AVR_HAVE_EIJMP_EICALL__
19989 @itemx __AVR_3_BYTE_PC__
19990 The device has the @code{EIJMP} and @code{EICALL} instructions.
19991 This is the case for devices with more than 128@tie{}KiB of program memory.
19992 This also means that the program counter
19993 (PC) is 3@tie{}bytes wide.
19994
19995 @item __AVR_2_BYTE_PC__
19996 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
19997 with up to 128@tie{}KiB of program memory.
19998
19999 @item __AVR_HAVE_8BIT_SP__
20000 @itemx __AVR_HAVE_16BIT_SP__
20001 The stack pointer (SP) register is treated as 8-bit respectively
20002 16-bit register by the compiler.
20003 The definition of these macros is affected by @option{-mtiny-stack}.
20004
20005 @item __AVR_HAVE_SPH__
20006 @itemx __AVR_SP8__
20007 The device has the SPH (high part of stack pointer) special function
20008 register or has an 8-bit stack pointer, respectively.
20009 The definition of these macros is affected by @option{-mmcu=} and
20010 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
20011 by @option{-msp8}.
20012
20013 @item __AVR_HAVE_RAMPD__
20014 @itemx __AVR_HAVE_RAMPX__
20015 @itemx __AVR_HAVE_RAMPY__
20016 @itemx __AVR_HAVE_RAMPZ__
20017 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
20018 @code{RAMPZ} special function register, respectively.
20019
20020 @item __NO_INTERRUPTS__
20021 This macro reflects the @option{-mno-interrupts} command-line option.
20022
20023 @item __AVR_ERRATA_SKIP__
20024 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
20025 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
20026 instructions because of a hardware erratum. Skip instructions are
20027 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
20028 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
20029 set.
20030
20031 @item __AVR_ISA_RMW__
20032 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
20033
20034 @item __AVR_SFR_OFFSET__=@var{offset}
20035 Instructions that can address I/O special function registers directly
20036 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
20037 address as if addressed by an instruction to access RAM like @code{LD}
20038 or @code{STS}. This offset depends on the device architecture and has
20039 to be subtracted from the RAM address in order to get the
20040 respective I/O@tie{}address.
20041
20042 @item __AVR_SHORT_CALLS__
20043 The @option{-mshort-calls} command line option is set.
20044
20045 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
20046 Some devices support reading from flash memory by means of @code{LD*}
20047 instructions. The flash memory is seen in the data address space
20048 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
20049 is not defined, this feature is not available. If defined,
20050 the address space is linear and there is no need to put
20051 @code{.rodata} into RAM. This is handled by the default linker
20052 description file, and is currently available for
20053 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
20054 there is no need to use address spaces like @code{__flash} or
20055 features like attribute @code{progmem} and @code{pgm_read_*}.
20056
20057 @item __WITH_AVRLIBC__
20058 The compiler is configured to be used together with AVR-Libc.
20059 See the @option{--with-avrlibc} configure option.
20060
20061 @item __HAVE_DOUBLE_MULTILIB__
20062 Defined if @option{-mdouble=} acts as a multilib option.
20063
20064 @item __HAVE_DOUBLE32__
20065 @itemx __HAVE_DOUBLE64__
20066 Defined if the compiler supports 32-bit double resp. 64-bit double.
20067 The actual layout is specified by option @option{-mdouble=}.
20068
20069 @item __DEFAULT_DOUBLE__
20070 The size in bits of @code{double} if @option{-mdouble=} is not set.
20071 To test the layout of @code{double} in a program, use the built-in
20072 macro @code{__SIZEOF_DOUBLE__}.
20073
20074 @item __HAVE_LONG_DOUBLE32__
20075 @itemx __HAVE_LONG_DOUBLE64__
20076 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
20077 @itemx __DEFAULT_LONG_DOUBLE__
20078 Same as above, but for @code{long double} instead of @code{double}.
20079
20080 @item __WITH_DOUBLE_COMPARISON__
20081 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
20082 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
20083 and is defined to @code{2} or @code{3}.
20084
20085 @item __WITH_LIBF7_LIBGCC__
20086 @itemx __WITH_LIBF7_MATH__
20087 @itemx __WITH_LIBF7_MATH_SYMBOLS__
20088 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
20089 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
20090
20091 @end table
20092
20093 @node Blackfin Options
20094 @subsection Blackfin Options
20095 @cindex Blackfin Options
20096
20097 @table @gcctabopt
20098 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
20099 @opindex mcpu=
20100 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
20101 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
20102 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
20103 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
20104 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
20105 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
20106 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
20107 @samp{bf561}, @samp{bf592}.
20108
20109 The optional @var{sirevision} specifies the silicon revision of the target
20110 Blackfin processor. Any workarounds available for the targeted silicon revision
20111 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
20112 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
20113 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
20114 hexadecimal digits representing the major and minor numbers in the silicon
20115 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
20116 is not defined. If @var{sirevision} is @samp{any}, the
20117 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
20118 If this optional @var{sirevision} is not used, GCC assumes the latest known
20119 silicon revision of the targeted Blackfin processor.
20120
20121 GCC defines a preprocessor macro for the specified @var{cpu}.
20122 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
20123 provided by libgloss to be linked in if @option{-msim} is not given.
20124
20125 Without this option, @samp{bf532} is used as the processor by default.
20126
20127 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
20128 only the preprocessor macro is defined.
20129
20130 @item -msim
20131 @opindex msim
20132 Specifies that the program will be run on the simulator. This causes
20133 the simulator BSP provided by libgloss to be linked in. This option
20134 has effect only for @samp{bfin-elf} toolchain.
20135 Certain other options, such as @option{-mid-shared-library} and
20136 @option{-mfdpic}, imply @option{-msim}.
20137
20138 @item -momit-leaf-frame-pointer
20139 @opindex momit-leaf-frame-pointer
20140 Don't keep the frame pointer in a register for leaf functions. This
20141 avoids the instructions to save, set up and restore frame pointers and
20142 makes an extra register available in leaf functions.
20143
20144 @item -mspecld-anomaly
20145 @opindex mspecld-anomaly
20146 When enabled, the compiler ensures that the generated code does not
20147 contain speculative loads after jump instructions. If this option is used,
20148 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
20149
20150 @item -mno-specld-anomaly
20151 @opindex mno-specld-anomaly
20152 @opindex mspecld-anomaly
20153 Don't generate extra code to prevent speculative loads from occurring.
20154
20155 @item -mcsync-anomaly
20156 @opindex mcsync-anomaly
20157 When enabled, the compiler ensures that the generated code does not
20158 contain CSYNC or SSYNC instructions too soon after conditional branches.
20159 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
20160
20161 @item -mno-csync-anomaly
20162 @opindex mno-csync-anomaly
20163 @opindex mcsync-anomaly
20164 Don't generate extra code to prevent CSYNC or SSYNC instructions from
20165 occurring too soon after a conditional branch.
20166
20167 @item -mlow64k
20168 @opindex mlow64k
20169 When enabled, the compiler is free to take advantage of the knowledge that
20170 the entire program fits into the low 64k of memory.
20171
20172 @item -mno-low64k
20173 @opindex mno-low64k
20174 Assume that the program is arbitrarily large. This is the default.
20175
20176 @item -mstack-check-l1
20177 @opindex mstack-check-l1
20178 Do stack checking using information placed into L1 scratchpad memory by the
20179 uClinux kernel.
20180
20181 @item -mid-shared-library
20182 @opindex mid-shared-library
20183 Generate code that supports shared libraries via the library ID method.
20184 This allows for execute in place and shared libraries in an environment
20185 without virtual memory management. This option implies @option{-fPIC}.
20186 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20187
20188 @item -mno-id-shared-library
20189 @opindex mno-id-shared-library
20190 @opindex mid-shared-library
20191 Generate code that doesn't assume ID-based shared libraries are being used.
20192 This is the default.
20193
20194 @item -mleaf-id-shared-library
20195 @opindex mleaf-id-shared-library
20196 Generate code that supports shared libraries via the library ID method,
20197 but assumes that this library or executable won't link against any other
20198 ID shared libraries. That allows the compiler to use faster code for jumps
20199 and calls.
20200
20201 @item -mno-leaf-id-shared-library
20202 @opindex mno-leaf-id-shared-library
20203 @opindex mleaf-id-shared-library
20204 Do not assume that the code being compiled won't link against any ID shared
20205 libraries. Slower code is generated for jump and call insns.
20206
20207 @item -mshared-library-id=n
20208 @opindex mshared-library-id
20209 Specifies the identification number of the ID-based shared library being
20210 compiled. Specifying a value of 0 generates more compact code; specifying
20211 other values forces the allocation of that number to the current
20212 library but is no more space- or time-efficient than omitting this option.
20213
20214 @item -msep-data
20215 @opindex msep-data
20216 Generate code that allows the data segment to be located in a different
20217 area of memory from the text segment. This allows for execute in place in
20218 an environment without virtual memory management by eliminating relocations
20219 against the text section.
20220
20221 @item -mno-sep-data
20222 @opindex mno-sep-data
20223 @opindex msep-data
20224 Generate code that assumes that the data segment follows the text segment.
20225 This is the default.
20226
20227 @item -mlong-calls
20228 @itemx -mno-long-calls
20229 @opindex mlong-calls
20230 @opindex mno-long-calls
20231 Tells the compiler to perform function calls by first loading the
20232 address of the function into a register and then performing a subroutine
20233 call on this register. This switch is needed if the target function
20234 lies outside of the 24-bit addressing range of the offset-based
20235 version of subroutine call instruction.
20236
20237 This feature is not enabled by default. Specifying
20238 @option{-mno-long-calls} restores the default behavior. Note these
20239 switches have no effect on how the compiler generates code to handle
20240 function calls via function pointers.
20241
20242 @item -mfast-fp
20243 @opindex mfast-fp
20244 Link with the fast floating-point library. This library relaxes some of
20245 the IEEE floating-point standard's rules for checking inputs against
20246 Not-a-Number (NAN), in the interest of performance.
20247
20248 @item -minline-plt
20249 @opindex minline-plt
20250 Enable inlining of PLT entries in function calls to functions that are
20251 not known to bind locally. It has no effect without @option{-mfdpic}.
20252
20253 @item -mmulticore
20254 @opindex mmulticore
20255 Build a standalone application for multicore Blackfin processors.
20256 This option causes proper start files and link scripts supporting
20257 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
20258 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
20259
20260 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
20261 selects the one-application-per-core programming model. Without
20262 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
20263 programming model is used. In this model, the main function of Core B
20264 should be named as @code{coreb_main}.
20265
20266 If this option is not used, the single-core application programming
20267 model is used.
20268
20269 @item -mcorea
20270 @opindex mcorea
20271 Build a standalone application for Core A of BF561 when using
20272 the one-application-per-core programming model. Proper start files
20273 and link scripts are used to support Core A, and the macro
20274 @code{__BFIN_COREA} is defined.
20275 This option can only be used in conjunction with @option{-mmulticore}.
20276
20277 @item -mcoreb
20278 @opindex mcoreb
20279 Build a standalone application for Core B of BF561 when using
20280 the one-application-per-core programming model. Proper start files
20281 and link scripts are used to support Core B, and the macro
20282 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
20283 should be used instead of @code{main}.
20284 This option can only be used in conjunction with @option{-mmulticore}.
20285
20286 @item -msdram
20287 @opindex msdram
20288 Build a standalone application for SDRAM. Proper start files and
20289 link scripts are used to put the application into SDRAM, and the macro
20290 @code{__BFIN_SDRAM} is defined.
20291 The loader should initialize SDRAM before loading the application.
20292
20293 @item -micplb
20294 @opindex micplb
20295 Assume that ICPLBs are enabled at run time. This has an effect on certain
20296 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
20297 are enabled; for standalone applications the default is off.
20298 @end table
20299
20300 @node C6X Options
20301 @subsection C6X Options
20302 @cindex C6X Options
20303
20304 @table @gcctabopt
20305 @item -march=@var{name}
20306 @opindex march
20307 This specifies the name of the target architecture. GCC uses this
20308 name to determine what kind of instructions it can emit when generating
20309 assembly code. Permissible names are: @samp{c62x},
20310 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
20311
20312 @item -mbig-endian
20313 @opindex mbig-endian
20314 Generate code for a big-endian target.
20315
20316 @item -mlittle-endian
20317 @opindex mlittle-endian
20318 Generate code for a little-endian target. This is the default.
20319
20320 @item -msim
20321 @opindex msim
20322 Choose startup files and linker script suitable for the simulator.
20323
20324 @item -msdata=default
20325 @opindex msdata=default
20326 Put small global and static data in the @code{.neardata} section,
20327 which is pointed to by register @code{B14}. Put small uninitialized
20328 global and static data in the @code{.bss} section, which is adjacent
20329 to the @code{.neardata} section. Put small read-only data into the
20330 @code{.rodata} section. The corresponding sections used for large
20331 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
20332
20333 @item -msdata=all
20334 @opindex msdata=all
20335 Put all data, not just small objects, into the sections reserved for
20336 small data, and use addressing relative to the @code{B14} register to
20337 access them.
20338
20339 @item -msdata=none
20340 @opindex msdata=none
20341 Make no use of the sections reserved for small data, and use absolute
20342 addresses to access all data. Put all initialized global and static
20343 data in the @code{.fardata} section, and all uninitialized data in the
20344 @code{.far} section. Put all constant data into the @code{.const}
20345 section.
20346 @end table
20347
20348 @node CRIS Options
20349 @subsection CRIS Options
20350 @cindex CRIS Options
20351
20352 These options are defined specifically for the CRIS ports.
20353
20354 @table @gcctabopt
20355 @item -march=@var{architecture-type}
20356 @itemx -mcpu=@var{architecture-type}
20357 @opindex march
20358 @opindex mcpu
20359 Generate code for the specified architecture. The choices for
20360 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
20361 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
20362 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
20363 @samp{v10}.
20364
20365 @item -mtune=@var{architecture-type}
20366 @opindex mtune
20367 Tune to @var{architecture-type} everything applicable about the generated
20368 code, except for the ABI and the set of available instructions. The
20369 choices for @var{architecture-type} are the same as for
20370 @option{-march=@var{architecture-type}}.
20371
20372 @item -mmax-stack-frame=@var{n}
20373 @opindex mmax-stack-frame
20374 Warn when the stack frame of a function exceeds @var{n} bytes.
20375
20376 @item -metrax4
20377 @itemx -metrax100
20378 @opindex metrax4
20379 @opindex metrax100
20380 The options @option{-metrax4} and @option{-metrax100} are synonyms for
20381 @option{-march=v3} and @option{-march=v8} respectively.
20382
20383 @item -mmul-bug-workaround
20384 @itemx -mno-mul-bug-workaround
20385 @opindex mmul-bug-workaround
20386 @opindex mno-mul-bug-workaround
20387 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
20388 models where it applies. This option is active by default.
20389
20390 @item -mpdebug
20391 @opindex mpdebug
20392 Enable CRIS-specific verbose debug-related information in the assembly
20393 code. This option also has the effect of turning off the @samp{#NO_APP}
20394 formatted-code indicator to the assembler at the beginning of the
20395 assembly file.
20396
20397 @item -mcc-init
20398 @opindex mcc-init
20399 Do not use condition-code results from previous instruction; always emit
20400 compare and test instructions before use of condition codes.
20401
20402 @item -mno-side-effects
20403 @opindex mno-side-effects
20404 @opindex mside-effects
20405 Do not emit instructions with side effects in addressing modes other than
20406 post-increment.
20407
20408 @item -mstack-align
20409 @itemx -mno-stack-align
20410 @itemx -mdata-align
20411 @itemx -mno-data-align
20412 @itemx -mconst-align
20413 @itemx -mno-const-align
20414 @opindex mstack-align
20415 @opindex mno-stack-align
20416 @opindex mdata-align
20417 @opindex mno-data-align
20418 @opindex mconst-align
20419 @opindex mno-const-align
20420 These options (@samp{no-} options) arrange (eliminate arrangements) for the
20421 stack frame, individual data and constants to be aligned for the maximum
20422 single data access size for the chosen CPU model. The default is to
20423 arrange for 32-bit alignment. ABI details such as structure layout are
20424 not affected by these options.
20425
20426 @item -m32-bit
20427 @itemx -m16-bit
20428 @itemx -m8-bit
20429 @opindex m32-bit
20430 @opindex m16-bit
20431 @opindex m8-bit
20432 Similar to the stack- data- and const-align options above, these options
20433 arrange for stack frame, writable data and constants to all be 32-bit,
20434 16-bit or 8-bit aligned. The default is 32-bit alignment.
20435
20436 @item -mno-prologue-epilogue
20437 @itemx -mprologue-epilogue
20438 @opindex mno-prologue-epilogue
20439 @opindex mprologue-epilogue
20440 With @option{-mno-prologue-epilogue}, the normal function prologue and
20441 epilogue which set up the stack frame are omitted and no return
20442 instructions or return sequences are generated in the code. Use this
20443 option only together with visual inspection of the compiled code: no
20444 warnings or errors are generated when call-saved registers must be saved,
20445 or storage for local variables needs to be allocated.
20446
20447 @item -mno-gotplt
20448 @itemx -mgotplt
20449 @opindex mno-gotplt
20450 @opindex mgotplt
20451 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
20452 instruction sequences that load addresses for functions from the PLT part
20453 of the GOT rather than (traditional on other architectures) calls to the
20454 PLT@. The default is @option{-mgotplt}.
20455
20456 @item -melf
20457 @opindex melf
20458 Legacy no-op option only recognized with the cris-axis-elf and
20459 cris-axis-linux-gnu targets.
20460
20461 @item -mlinux
20462 @opindex mlinux
20463 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20464
20465 @item -sim
20466 @opindex sim
20467 This option, recognized for the cris-axis-elf, arranges
20468 to link with input-output functions from a simulator library. Code,
20469 initialized data and zero-initialized data are allocated consecutively.
20470
20471 @item -sim2
20472 @opindex sim2
20473 Like @option{-sim}, but pass linker options to locate initialized data at
20474 0x40000000 and zero-initialized data at 0x80000000.
20475 @end table
20476
20477 @node CR16 Options
20478 @subsection CR16 Options
20479 @cindex CR16 Options
20480
20481 These options are defined specifically for the CR16 ports.
20482
20483 @table @gcctabopt
20484
20485 @item -mmac
20486 @opindex mmac
20487 Enable the use of multiply-accumulate instructions. Disabled by default.
20488
20489 @item -mcr16cplus
20490 @itemx -mcr16c
20491 @opindex mcr16cplus
20492 @opindex mcr16c
20493 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
20494 is default.
20495
20496 @item -msim
20497 @opindex msim
20498 Links the library libsim.a which is in compatible with simulator. Applicable
20499 to ELF compiler only.
20500
20501 @item -mint32
20502 @opindex mint32
20503 Choose integer type as 32-bit wide.
20504
20505 @item -mbit-ops
20506 @opindex mbit-ops
20507 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20508
20509 @item -mdata-model=@var{model}
20510 @opindex mdata-model
20511 Choose a data model. The choices for @var{model} are @samp{near},
20512 @samp{far} or @samp{medium}. @samp{medium} is default.
20513 However, @samp{far} is not valid with @option{-mcr16c}, as the
20514 CR16C architecture does not support the far data model.
20515 @end table
20516
20517 @node C-SKY Options
20518 @subsection C-SKY Options
20519 @cindex C-SKY Options
20520
20521 GCC supports these options when compiling for C-SKY V2 processors.
20522
20523 @table @gcctabopt
20524
20525 @item -march=@var{arch}
20526 @opindex march=
20527 Specify the C-SKY target architecture. Valid values for @var{arch} are:
20528 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20529 The default is @samp{ck810}.
20530
20531 @item -mcpu=@var{cpu}
20532 @opindex mcpu=
20533 Specify the C-SKY target processor. Valid values for @var{cpu} are:
20534 @samp{ck801}, @samp{ck801t},
20535 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
20536 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20537 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20538 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20539 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20540 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20541 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20542 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20543 @samp{ck803eftr1}, @samp{ck803efhtr1},
20544 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20545 @samp{ck803sef}, @samp{ck803seft},
20546 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20547 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20548 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20549 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20550
20551 @item -mbig-endian
20552 @opindex mbig-endian
20553 @itemx -EB
20554 @opindex EB
20555 @itemx -mlittle-endian
20556 @opindex mlittle-endian
20557 @itemx -EL
20558 @opindex EL
20559
20560 Select big- or little-endian code. The default is little-endian.
20561
20562 @item -mhard-float
20563 @opindex mhard-float
20564 @itemx -msoft-float
20565 @opindex msoft-float
20566
20567 Select hardware or software floating-point implementations.
20568 The default is soft float.
20569
20570 @item -mdouble-float
20571 @itemx -mno-double-float
20572 @opindex mdouble-float
20573 When @option{-mhard-float} is in effect, enable generation of
20574 double-precision float instructions. This is the default except
20575 when compiling for CK803.
20576
20577 @item -mfdivdu
20578 @itemx -mno-fdivdu
20579 @opindex mfdivdu
20580 When @option{-mhard-float} is in effect, enable generation of
20581 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20582 This is the default except when compiling for CK803.
20583
20584 @item -mfpu=@var{fpu}
20585 @opindex mfpu=
20586 Select the floating-point processor. This option can only be used with
20587 @option{-mhard-float}.
20588 Values for @var{fpu} are
20589 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20590 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20591 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20592
20593 @item -melrw
20594 @itemx -mno-elrw
20595 @opindex melrw
20596 Enable the extended @code{lrw} instruction. This option defaults to on
20597 for CK801 and off otherwise.
20598
20599 @item -mistack
20600 @itemx -mno-istack
20601 @opindex mistack
20602 Enable interrupt stack instructions; the default is off.
20603
20604 The @option{-mistack} option is required to handle the
20605 @code{interrupt} and @code{isr} function attributes
20606 (@pxref{C-SKY Function Attributes}).
20607
20608 @item -mmp
20609 @opindex mmp
20610 Enable multiprocessor instructions; the default is off.
20611
20612 @item -mcp
20613 @opindex mcp
20614 Enable coprocessor instructions; the default is off.
20615
20616 @item -mcache
20617 @opindex mcache
20618 Enable coprocessor instructions; the default is off.
20619
20620 @item -msecurity
20621 @opindex msecurity
20622 Enable C-SKY security instructions; the default is off.
20623
20624 @item -mtrust
20625 @opindex mtrust
20626 Enable C-SKY trust instructions; the default is off.
20627
20628 @item -mdsp
20629 @opindex mdsp
20630 @itemx -medsp
20631 @opindex medsp
20632 @itemx -mvdsp
20633 @opindex mvdsp
20634 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20635 All of these options default to off.
20636
20637 @item -mdiv
20638 @itemx -mno-div
20639 @opindex mdiv
20640 Generate divide instructions. Default is off.
20641
20642 @item -msmart
20643 @itemx -mno-smart
20644 @opindex msmart
20645 Generate code for Smart Mode, using only registers numbered 0-7 to allow
20646 use of 16-bit instructions. This option is ignored for CK801 where this
20647 is the required behavior, and it defaults to on for CK802.
20648 For other targets, the default is off.
20649
20650 @item -mhigh-registers
20651 @itemx -mno-high-registers
20652 @opindex mhigh-registers
20653 Generate code using the high registers numbered 16-31. This option
20654 is not supported on CK801, CK802, or CK803, and is enabled by default
20655 for other processors.
20656
20657 @item -manchor
20658 @itemx -mno-anchor
20659 @opindex manchor
20660 Generate code using global anchor symbol addresses.
20661
20662 @item -mpushpop
20663 @itemx -mno-pushpop
20664 @opindex mpushpop
20665 Generate code using @code{push} and @code{pop} instructions. This option
20666 defaults to on.
20667
20668 @item -mmultiple-stld
20669 @itemx -mstm
20670 @itemx -mno-multiple-stld
20671 @itemx -mno-stm
20672 @opindex mmultiple-stld
20673 Generate code using @code{stm} and @code{ldm} instructions. This option
20674 isn't supported on CK801 but is enabled by default on other processors.
20675
20676 @item -mconstpool
20677 @itemx -mno-constpool
20678 @opindex mconstpool
20679 Create constant pools in the compiler instead of deferring it to the
20680 assembler. This option is the default and required for correct code
20681 generation on CK801 and CK802, and is optional on other processors.
20682
20683 @item -mstack-size
20684 @item -mno-stack-size
20685 @opindex mstack-size
20686 Emit @code{.stack_size} directives for each function in the assembly
20687 output. This option defaults to off.
20688
20689 @item -mccrt
20690 @itemx -mno-ccrt
20691 @opindex mccrt
20692 Generate code for the C-SKY compiler runtime instead of libgcc. This
20693 option defaults to off.
20694
20695 @item -mbranch-cost=@var{n}
20696 @opindex mbranch-cost=
20697 Set the branch costs to roughly @code{n} instructions. The default is 1.
20698
20699 @item -msched-prolog
20700 @itemx -mno-sched-prolog
20701 @opindex msched-prolog
20702 Permit scheduling of function prologue and epilogue sequences. Using
20703 this option can result in code that is not compliant with the C-SKY V2 ABI
20704 prologue requirements and that cannot be debugged or backtraced.
20705 It is disabled by default.
20706
20707 @end table
20708
20709 @node Darwin Options
20710 @subsection Darwin Options
20711 @cindex Darwin options
20712
20713 These options are defined for all architectures running the Darwin operating
20714 system.
20715
20716 FSF GCC on Darwin does not create ``fat'' object files; it creates
20717 an object file for the single architecture that GCC was built to
20718 target. Apple's GCC on Darwin does create ``fat'' files if multiple
20719 @option{-arch} options are used; it does so by running the compiler or
20720 linker multiple times and joining the results together with
20721 @file{lipo}.
20722
20723 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20724 @samp{i686}) is determined by the flags that specify the ISA
20725 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
20726 @option{-force_cpusubtype_ALL} option can be used to override this.
20727
20728 The Darwin tools vary in their behavior when presented with an ISA
20729 mismatch. The assembler, @file{as}, only permits instructions to
20730 be used that are valid for the subtype of the file it is generating,
20731 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20732 The linker for shared libraries, @file{/usr/bin/libtool}, fails
20733 and prints an error if asked to create a shared library with a less
20734 restrictive subtype than its input files (for instance, trying to put
20735 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
20736 for executables, @command{ld}, quietly gives the executable the most
20737 restrictive subtype of any of its input files.
20738
20739 @table @gcctabopt
20740 @item -F@var{dir}
20741 @opindex F
20742 Add the framework directory @var{dir} to the head of the list of
20743 directories to be searched for header files. These directories are
20744 interleaved with those specified by @option{-I} options and are
20745 scanned in a left-to-right order.
20746
20747 A framework directory is a directory with frameworks in it. A
20748 framework is a directory with a @file{Headers} and/or
20749 @file{PrivateHeaders} directory contained directly in it that ends
20750 in @file{.framework}. The name of a framework is the name of this
20751 directory excluding the @file{.framework}. Headers associated with
20752 the framework are found in one of those two directories, with
20753 @file{Headers} being searched first. A subframework is a framework
20754 directory that is in a framework's @file{Frameworks} directory.
20755 Includes of subframework headers can only appear in a header of a
20756 framework that contains the subframework, or in a sibling subframework
20757 header. Two subframeworks are siblings if they occur in the same
20758 framework. A subframework should not have the same name as a
20759 framework; a warning is issued if this is violated. Currently a
20760 subframework cannot have subframeworks; in the future, the mechanism
20761 may be extended to support this. The standard frameworks can be found
20762 in @file{/System/Library/Frameworks} and
20763 @file{/Library/Frameworks}. An example include looks like
20764 @code{#include <Framework/header.h>}, where @file{Framework} denotes
20765 the name of the framework and @file{header.h} is found in the
20766 @file{PrivateHeaders} or @file{Headers} directory.
20767
20768 @item -iframework@var{dir}
20769 @opindex iframework
20770 Like @option{-F} except the directory is a treated as a system
20771 directory. The main difference between this @option{-iframework} and
20772 @option{-F} is that with @option{-iframework} the compiler does not
20773 warn about constructs contained within header files found via
20774 @var{dir}. This option is valid only for the C family of languages.
20775
20776 @item -gused
20777 @opindex gused
20778 Emit debugging information for symbols that are used. For stabs
20779 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20780 This is by default ON@.
20781
20782 @item -gfull
20783 @opindex gfull
20784 Emit debugging information for all symbols and types.
20785
20786 @item -mmacosx-version-min=@var{version}
20787 The earliest version of MacOS X that this executable will run on
20788 is @var{version}. Typical values of @var{version} include @code{10.1},
20789 @code{10.2}, and @code{10.3.9}.
20790
20791 If the compiler was built to use the system's headers by default,
20792 then the default for this option is the system version on which the
20793 compiler is running, otherwise the default is to make choices that
20794 are compatible with as many systems and code bases as possible.
20795
20796 @item -mkernel
20797 @opindex mkernel
20798 Enable kernel development mode. The @option{-mkernel} option sets
20799 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20800 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20801 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20802 applicable. This mode also sets @option{-mno-altivec},
20803 @option{-msoft-float}, @option{-fno-builtin} and
20804 @option{-mlong-branch} for PowerPC targets.
20805
20806 @item -mone-byte-bool
20807 @opindex mone-byte-bool
20808 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20809 By default @code{sizeof(bool)} is @code{4} when compiling for
20810 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20811 option has no effect on x86.
20812
20813 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20814 to generate code that is not binary compatible with code generated
20815 without that switch. Using this switch may require recompiling all
20816 other modules in a program, including system libraries. Use this
20817 switch to conform to a non-default data model.
20818
20819 @item -mfix-and-continue
20820 @itemx -ffix-and-continue
20821 @itemx -findirect-data
20822 @opindex mfix-and-continue
20823 @opindex ffix-and-continue
20824 @opindex findirect-data
20825 Generate code suitable for fast turnaround development, such as to
20826 allow GDB to dynamically load @file{.o} files into already-running
20827 programs. @option{-findirect-data} and @option{-ffix-and-continue}
20828 are provided for backwards compatibility.
20829
20830 @item -all_load
20831 @opindex all_load
20832 Loads all members of static archive libraries.
20833 See man ld(1) for more information.
20834
20835 @item -arch_errors_fatal
20836 @opindex arch_errors_fatal
20837 Cause the errors having to do with files that have the wrong architecture
20838 to be fatal.
20839
20840 @item -bind_at_load
20841 @opindex bind_at_load
20842 Causes the output file to be marked such that the dynamic linker will
20843 bind all undefined references when the file is loaded or launched.
20844
20845 @item -bundle
20846 @opindex bundle
20847 Produce a Mach-o bundle format file.
20848 See man ld(1) for more information.
20849
20850 @item -bundle_loader @var{executable}
20851 @opindex bundle_loader
20852 This option specifies the @var{executable} that will load the build
20853 output file being linked. See man ld(1) for more information.
20854
20855 @item -dynamiclib
20856 @opindex dynamiclib
20857 When passed this option, GCC produces a dynamic library instead of
20858 an executable when linking, using the Darwin @file{libtool} command.
20859
20860 @item -force_cpusubtype_ALL
20861 @opindex force_cpusubtype_ALL
20862 This causes GCC's output file to have the @samp{ALL} subtype, instead of
20863 one controlled by the @option{-mcpu} or @option{-march} option.
20864
20865 @item -allowable_client @var{client_name}
20866 @itemx -client_name
20867 @itemx -compatibility_version
20868 @itemx -current_version
20869 @itemx -dead_strip
20870 @itemx -dependency-file
20871 @itemx -dylib_file
20872 @itemx -dylinker_install_name
20873 @itemx -dynamic
20874 @itemx -exported_symbols_list
20875 @itemx -filelist
20876 @need 800
20877 @itemx -flat_namespace
20878 @itemx -force_flat_namespace
20879 @itemx -headerpad_max_install_names
20880 @itemx -image_base
20881 @itemx -init
20882 @itemx -install_name
20883 @itemx -keep_private_externs
20884 @itemx -multi_module
20885 @itemx -multiply_defined
20886 @itemx -multiply_defined_unused
20887 @need 800
20888 @itemx -noall_load
20889 @itemx -no_dead_strip_inits_and_terms
20890 @itemx -nofixprebinding
20891 @itemx -nomultidefs
20892 @itemx -noprebind
20893 @itemx -noseglinkedit
20894 @itemx -pagezero_size
20895 @itemx -prebind
20896 @itemx -prebind_all_twolevel_modules
20897 @itemx -private_bundle
20898 @need 800
20899 @itemx -read_only_relocs
20900 @itemx -sectalign
20901 @itemx -sectobjectsymbols
20902 @itemx -whyload
20903 @itemx -seg1addr
20904 @itemx -sectcreate
20905 @itemx -sectobjectsymbols
20906 @itemx -sectorder
20907 @itemx -segaddr
20908 @itemx -segs_read_only_addr
20909 @need 800
20910 @itemx -segs_read_write_addr
20911 @itemx -seg_addr_table
20912 @itemx -seg_addr_table_filename
20913 @itemx -seglinkedit
20914 @itemx -segprot
20915 @itemx -segs_read_only_addr
20916 @itemx -segs_read_write_addr
20917 @itemx -single_module
20918 @itemx -static
20919 @itemx -sub_library
20920 @need 800
20921 @itemx -sub_umbrella
20922 @itemx -twolevel_namespace
20923 @itemx -umbrella
20924 @itemx -undefined
20925 @itemx -unexported_symbols_list
20926 @itemx -weak_reference_mismatches
20927 @itemx -whatsloaded
20928 @opindex allowable_client
20929 @opindex client_name
20930 @opindex compatibility_version
20931 @opindex current_version
20932 @opindex dead_strip
20933 @opindex dependency-file
20934 @opindex dylib_file
20935 @opindex dylinker_install_name
20936 @opindex dynamic
20937 @opindex exported_symbols_list
20938 @opindex filelist
20939 @opindex flat_namespace
20940 @opindex force_flat_namespace
20941 @opindex headerpad_max_install_names
20942 @opindex image_base
20943 @opindex init
20944 @opindex install_name
20945 @opindex keep_private_externs
20946 @opindex multi_module
20947 @opindex multiply_defined
20948 @opindex multiply_defined_unused
20949 @opindex noall_load
20950 @opindex no_dead_strip_inits_and_terms
20951 @opindex nofixprebinding
20952 @opindex nomultidefs
20953 @opindex noprebind
20954 @opindex noseglinkedit
20955 @opindex pagezero_size
20956 @opindex prebind
20957 @opindex prebind_all_twolevel_modules
20958 @opindex private_bundle
20959 @opindex read_only_relocs
20960 @opindex sectalign
20961 @opindex sectobjectsymbols
20962 @opindex whyload
20963 @opindex seg1addr
20964 @opindex sectcreate
20965 @opindex sectobjectsymbols
20966 @opindex sectorder
20967 @opindex segaddr
20968 @opindex segs_read_only_addr
20969 @opindex segs_read_write_addr
20970 @opindex seg_addr_table
20971 @opindex seg_addr_table_filename
20972 @opindex seglinkedit
20973 @opindex segprot
20974 @opindex segs_read_only_addr
20975 @opindex segs_read_write_addr
20976 @opindex single_module
20977 @opindex static
20978 @opindex sub_library
20979 @opindex sub_umbrella
20980 @opindex twolevel_namespace
20981 @opindex umbrella
20982 @opindex undefined
20983 @opindex unexported_symbols_list
20984 @opindex weak_reference_mismatches
20985 @opindex whatsloaded
20986 These options are passed to the Darwin linker. The Darwin linker man page
20987 describes them in detail.
20988 @end table
20989
20990 @node DEC Alpha Options
20991 @subsection DEC Alpha Options
20992
20993 These @samp{-m} options are defined for the DEC Alpha implementations:
20994
20995 @table @gcctabopt
20996 @item -mno-soft-float
20997 @itemx -msoft-float
20998 @opindex mno-soft-float
20999 @opindex msoft-float
21000 Use (do not use) the hardware floating-point instructions for
21001 floating-point operations. When @option{-msoft-float} is specified,
21002 functions in @file{libgcc.a} are used to perform floating-point
21003 operations. Unless they are replaced by routines that emulate the
21004 floating-point operations, or compiled in such a way as to call such
21005 emulations routines, these routines issue floating-point
21006 operations. If you are compiling for an Alpha without floating-point
21007 operations, you must ensure that the library is built so as not to call
21008 them.
21009
21010 Note that Alpha implementations without floating-point operations are
21011 required to have floating-point registers.
21012
21013 @item -mfp-reg
21014 @itemx -mno-fp-regs
21015 @opindex mfp-reg
21016 @opindex mno-fp-regs
21017 Generate code that uses (does not use) the floating-point register set.
21018 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
21019 register set is not used, floating-point operands are passed in integer
21020 registers as if they were integers and floating-point results are passed
21021 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
21022 so any function with a floating-point argument or return value called by code
21023 compiled with @option{-mno-fp-regs} must also be compiled with that
21024 option.
21025
21026 A typical use of this option is building a kernel that does not use,
21027 and hence need not save and restore, any floating-point registers.
21028
21029 @item -mieee
21030 @opindex mieee
21031 The Alpha architecture implements floating-point hardware optimized for
21032 maximum performance. It is mostly compliant with the IEEE floating-point
21033 standard. However, for full compliance, software assistance is
21034 required. This option generates code fully IEEE-compliant code
21035 @emph{except} that the @var{inexact-flag} is not maintained (see below).
21036 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
21037 defined during compilation. The resulting code is less efficient but is
21038 able to correctly support denormalized numbers and exceptional IEEE
21039 values such as not-a-number and plus/minus infinity. Other Alpha
21040 compilers call this option @option{-ieee_with_no_inexact}.
21041
21042 @item -mieee-with-inexact
21043 @opindex mieee-with-inexact
21044 This is like @option{-mieee} except the generated code also maintains
21045 the IEEE @var{inexact-flag}. Turning on this option causes the
21046 generated code to implement fully-compliant IEEE math. In addition to
21047 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
21048 macro. On some Alpha implementations the resulting code may execute
21049 significantly slower than the code generated by default. Since there is
21050 very little code that depends on the @var{inexact-flag}, you should
21051 normally not specify this option. Other Alpha compilers call this
21052 option @option{-ieee_with_inexact}.
21053
21054 @item -mfp-trap-mode=@var{trap-mode}
21055 @opindex mfp-trap-mode
21056 This option controls what floating-point related traps are enabled.
21057 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
21058 The trap mode can be set to one of four values:
21059
21060 @table @samp
21061 @item n
21062 This is the default (normal) setting. The only traps that are enabled
21063 are the ones that cannot be disabled in software (e.g., division by zero
21064 trap).
21065
21066 @item u
21067 In addition to the traps enabled by @samp{n}, underflow traps are enabled
21068 as well.
21069
21070 @item su
21071 Like @samp{u}, but the instructions are marked to be safe for software
21072 completion (see Alpha architecture manual for details).
21073
21074 @item sui
21075 Like @samp{su}, but inexact traps are enabled as well.
21076 @end table
21077
21078 @item -mfp-rounding-mode=@var{rounding-mode}
21079 @opindex mfp-rounding-mode
21080 Selects the IEEE rounding mode. Other Alpha compilers call this option
21081 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
21082 of:
21083
21084 @table @samp
21085 @item n
21086 Normal IEEE rounding mode. Floating-point numbers are rounded towards
21087 the nearest machine number or towards the even machine number in case
21088 of a tie.
21089
21090 @item m
21091 Round towards minus infinity.
21092
21093 @item c
21094 Chopped rounding mode. Floating-point numbers are rounded towards zero.
21095
21096 @item d
21097 Dynamic rounding mode. A field in the floating-point control register
21098 (@var{fpcr}, see Alpha architecture reference manual) controls the
21099 rounding mode in effect. The C library initializes this register for
21100 rounding towards plus infinity. Thus, unless your program modifies the
21101 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
21102 @end table
21103
21104 @item -mtrap-precision=@var{trap-precision}
21105 @opindex mtrap-precision
21106 In the Alpha architecture, floating-point traps are imprecise. This
21107 means without software assistance it is impossible to recover from a
21108 floating trap and program execution normally needs to be terminated.
21109 GCC can generate code that can assist operating system trap handlers
21110 in determining the exact location that caused a floating-point trap.
21111 Depending on the requirements of an application, different levels of
21112 precisions can be selected:
21113
21114 @table @samp
21115 @item p
21116 Program precision. This option is the default and means a trap handler
21117 can only identify which program caused a floating-point exception.
21118
21119 @item f
21120 Function precision. The trap handler can determine the function that
21121 caused a floating-point exception.
21122
21123 @item i
21124 Instruction precision. The trap handler can determine the exact
21125 instruction that caused a floating-point exception.
21126 @end table
21127
21128 Other Alpha compilers provide the equivalent options called
21129 @option{-scope_safe} and @option{-resumption_safe}.
21130
21131 @item -mieee-conformant
21132 @opindex mieee-conformant
21133 This option marks the generated code as IEEE conformant. You must not
21134 use this option unless you also specify @option{-mtrap-precision=i} and either
21135 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
21136 is to emit the line @samp{.eflag 48} in the function prologue of the
21137 generated assembly file.
21138
21139 @item -mbuild-constants
21140 @opindex mbuild-constants
21141 Normally GCC examines a 32- or 64-bit integer constant to
21142 see if it can construct it from smaller constants in two or three
21143 instructions. If it cannot, it outputs the constant as a literal and
21144 generates code to load it from the data segment at run time.
21145
21146 Use this option to require GCC to construct @emph{all} integer constants
21147 using code, even if it takes more instructions (the maximum is six).
21148
21149 You typically use this option to build a shared library dynamic
21150 loader. Itself a shared library, it must relocate itself in memory
21151 before it can find the variables and constants in its own data segment.
21152
21153 @item -mbwx
21154 @itemx -mno-bwx
21155 @itemx -mcix
21156 @itemx -mno-cix
21157 @itemx -mfix
21158 @itemx -mno-fix
21159 @itemx -mmax
21160 @itemx -mno-max
21161 @opindex mbwx
21162 @opindex mno-bwx
21163 @opindex mcix
21164 @opindex mno-cix
21165 @opindex mfix
21166 @opindex mno-fix
21167 @opindex mmax
21168 @opindex mno-max
21169 Indicate whether GCC should generate code to use the optional BWX,
21170 CIX, FIX and MAX instruction sets. The default is to use the instruction
21171 sets supported by the CPU type specified via @option{-mcpu=} option or that
21172 of the CPU on which GCC was built if none is specified.
21173
21174 @item -mfloat-vax
21175 @itemx -mfloat-ieee
21176 @opindex mfloat-vax
21177 @opindex mfloat-ieee
21178 Generate code that uses (does not use) VAX F and G floating-point
21179 arithmetic instead of IEEE single and double precision.
21180
21181 @item -mexplicit-relocs
21182 @itemx -mno-explicit-relocs
21183 @opindex mexplicit-relocs
21184 @opindex mno-explicit-relocs
21185 Older Alpha assemblers provided no way to generate symbol relocations
21186 except via assembler macros. Use of these macros does not allow
21187 optimal instruction scheduling. GNU binutils as of version 2.12
21188 supports a new syntax that allows the compiler to explicitly mark
21189 which relocations should apply to which instructions. This option
21190 is mostly useful for debugging, as GCC detects the capabilities of
21191 the assembler when it is built and sets the default accordingly.
21192
21193 @item -msmall-data
21194 @itemx -mlarge-data
21195 @opindex msmall-data
21196 @opindex mlarge-data
21197 When @option{-mexplicit-relocs} is in effect, static data is
21198 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
21199 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
21200 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
21201 16-bit relocations off of the @code{$gp} register. This limits the
21202 size of the small data area to 64KB, but allows the variables to be
21203 directly accessed via a single instruction.
21204
21205 The default is @option{-mlarge-data}. With this option the data area
21206 is limited to just below 2GB@. Programs that require more than 2GB of
21207 data must use @code{malloc} or @code{mmap} to allocate the data in the
21208 heap instead of in the program's data segment.
21209
21210 When generating code for shared libraries, @option{-fpic} implies
21211 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
21212
21213 @item -msmall-text
21214 @itemx -mlarge-text
21215 @opindex msmall-text
21216 @opindex mlarge-text
21217 When @option{-msmall-text} is used, the compiler assumes that the
21218 code of the entire program (or shared library) fits in 4MB, and is
21219 thus reachable with a branch instruction. When @option{-msmall-data}
21220 is used, the compiler can assume that all local symbols share the
21221 same @code{$gp} value, and thus reduce the number of instructions
21222 required for a function call from 4 to 1.
21223
21224 The default is @option{-mlarge-text}.
21225
21226 @item -mcpu=@var{cpu_type}
21227 @opindex mcpu
21228 Set the instruction set and instruction scheduling parameters for
21229 machine type @var{cpu_type}. You can specify either the @samp{EV}
21230 style name or the corresponding chip number. GCC supports scheduling
21231 parameters for the EV4, EV5 and EV6 family of processors and
21232 chooses the default values for the instruction set from the processor
21233 you specify. If you do not specify a processor type, GCC defaults
21234 to the processor on which the compiler was built.
21235
21236 Supported values for @var{cpu_type} are
21237
21238 @table @samp
21239 @item ev4
21240 @itemx ev45
21241 @itemx 21064
21242 Schedules as an EV4 and has no instruction set extensions.
21243
21244 @item ev5
21245 @itemx 21164
21246 Schedules as an EV5 and has no instruction set extensions.
21247
21248 @item ev56
21249 @itemx 21164a
21250 Schedules as an EV5 and supports the BWX extension.
21251
21252 @item pca56
21253 @itemx 21164pc
21254 @itemx 21164PC
21255 Schedules as an EV5 and supports the BWX and MAX extensions.
21256
21257 @item ev6
21258 @itemx 21264
21259 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
21260
21261 @item ev67
21262 @itemx 21264a
21263 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
21264 @end table
21265
21266 Native toolchains also support the value @samp{native},
21267 which selects the best architecture option for the host processor.
21268 @option{-mcpu=native} has no effect if GCC does not recognize
21269 the processor.
21270
21271 @item -mtune=@var{cpu_type}
21272 @opindex mtune
21273 Set only the instruction scheduling parameters for machine type
21274 @var{cpu_type}. The instruction set is not changed.
21275
21276 Native toolchains also support the value @samp{native},
21277 which selects the best architecture option for the host processor.
21278 @option{-mtune=native} has no effect if GCC does not recognize
21279 the processor.
21280
21281 @item -mmemory-latency=@var{time}
21282 @opindex mmemory-latency
21283 Sets the latency the scheduler should assume for typical memory
21284 references as seen by the application. This number is highly
21285 dependent on the memory access patterns used by the application
21286 and the size of the external cache on the machine.
21287
21288 Valid options for @var{time} are
21289
21290 @table @samp
21291 @item @var{number}
21292 A decimal number representing clock cycles.
21293
21294 @item L1
21295 @itemx L2
21296 @itemx L3
21297 @itemx main
21298 The compiler contains estimates of the number of clock cycles for
21299 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21300 (also called Dcache, Scache, and Bcache), as well as to main memory.
21301 Note that L3 is only valid for EV5.
21302
21303 @end table
21304 @end table
21305
21306 @node eBPF Options
21307 @subsection eBPF Options
21308 @cindex eBPF Options
21309
21310 @table @gcctabopt
21311 @item -mframe-limit=@var{bytes}
21312 This specifies the hard limit for frame sizes, in bytes. Currently,
21313 the value that can be specified should be less than or equal to
21314 @samp{32767}. Defaults to whatever limit is imposed by the version of
21315 the Linux kernel targeted.
21316
21317 @item -mkernel=@var{version}
21318 @opindex mkernel
21319 This specifies the minimum version of the kernel that will run the
21320 compiled program. GCC uses this version to determine which
21321 instructions to use, what kernel helpers to allow, etc. Currently,
21322 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
21323 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
21324 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
21325 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
21326 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
21327 @samp{5.2}, @samp{latest} and @samp{native}.
21328
21329 @item -mbig-endian
21330 @opindex mbig-endian
21331 Generate code for a big-endian target.
21332
21333 @item -mlittle-endian
21334 @opindex mlittle-endian
21335 Generate code for a little-endian target. This is the default.
21336
21337 @item -mxbpf
21338 Generate code for an expanded version of BPF, which relaxes some of
21339 the restrictions imposed by the BPF architecture:
21340 @itemize @minus
21341 @item Save and restore callee-saved registers at function entry and
21342 exit, respectively.
21343 @end itemize
21344 @end table
21345
21346 @node FR30 Options
21347 @subsection FR30 Options
21348 @cindex FR30 Options
21349
21350 These options are defined specifically for the FR30 port.
21351
21352 @table @gcctabopt
21353
21354 @item -msmall-model
21355 @opindex msmall-model
21356 Use the small address space model. This can produce smaller code, but
21357 it does assume that all symbolic values and addresses fit into a
21358 20-bit range.
21359
21360 @item -mno-lsim
21361 @opindex mno-lsim
21362 Assume that runtime support has been provided and so there is no need
21363 to include the simulator library (@file{libsim.a}) on the linker
21364 command line.
21365
21366 @end table
21367
21368 @node FT32 Options
21369 @subsection FT32 Options
21370 @cindex FT32 Options
21371
21372 These options are defined specifically for the FT32 port.
21373
21374 @table @gcctabopt
21375
21376 @item -msim
21377 @opindex msim
21378 Specifies that the program will be run on the simulator. This causes
21379 an alternate runtime startup and library to be linked.
21380 You must not use this option when generating programs that will run on
21381 real hardware; you must provide your own runtime library for whatever
21382 I/O functions are needed.
21383
21384 @item -mlra
21385 @opindex mlra
21386 Enable Local Register Allocation. This is still experimental for FT32,
21387 so by default the compiler uses standard reload.
21388
21389 @item -mnodiv
21390 @opindex mnodiv
21391 Do not use div and mod instructions.
21392
21393 @item -mft32b
21394 @opindex mft32b
21395 Enable use of the extended instructions of the FT32B processor.
21396
21397 @item -mcompress
21398 @opindex mcompress
21399 Compress all code using the Ft32B code compression scheme.
21400
21401 @item -mnopm
21402 @opindex mnopm
21403 Do not generate code that reads program memory.
21404
21405 @end table
21406
21407 @node FRV Options
21408 @subsection FRV Options
21409 @cindex FRV Options
21410
21411 @table @gcctabopt
21412 @item -mgpr-32
21413 @opindex mgpr-32
21414
21415 Only use the first 32 general-purpose registers.
21416
21417 @item -mgpr-64
21418 @opindex mgpr-64
21419
21420 Use all 64 general-purpose registers.
21421
21422 @item -mfpr-32
21423 @opindex mfpr-32
21424
21425 Use only the first 32 floating-point registers.
21426
21427 @item -mfpr-64
21428 @opindex mfpr-64
21429
21430 Use all 64 floating-point registers.
21431
21432 @item -mhard-float
21433 @opindex mhard-float
21434
21435 Use hardware instructions for floating-point operations.
21436
21437 @item -msoft-float
21438 @opindex msoft-float
21439
21440 Use library routines for floating-point operations.
21441
21442 @item -malloc-cc
21443 @opindex malloc-cc
21444
21445 Dynamically allocate condition code registers.
21446
21447 @item -mfixed-cc
21448 @opindex mfixed-cc
21449
21450 Do not try to dynamically allocate condition code registers, only
21451 use @code{icc0} and @code{fcc0}.
21452
21453 @item -mdword
21454 @opindex mdword
21455
21456 Change ABI to use double word insns.
21457
21458 @item -mno-dword
21459 @opindex mno-dword
21460 @opindex mdword
21461
21462 Do not use double word instructions.
21463
21464 @item -mdouble
21465 @opindex mdouble
21466
21467 Use floating-point double instructions.
21468
21469 @item -mno-double
21470 @opindex mno-double
21471
21472 Do not use floating-point double instructions.
21473
21474 @item -mmedia
21475 @opindex mmedia
21476
21477 Use media instructions.
21478
21479 @item -mno-media
21480 @opindex mno-media
21481
21482 Do not use media instructions.
21483
21484 @item -mmuladd
21485 @opindex mmuladd
21486
21487 Use multiply and add/subtract instructions.
21488
21489 @item -mno-muladd
21490 @opindex mno-muladd
21491
21492 Do not use multiply and add/subtract instructions.
21493
21494 @item -mfdpic
21495 @opindex mfdpic
21496
21497 Select the FDPIC ABI, which uses function descriptors to represent
21498 pointers to functions. Without any PIC/PIE-related options, it
21499 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
21500 assumes GOT entries and small data are within a 12-bit range from the
21501 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21502 are computed with 32 bits.
21503 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21504
21505 @item -minline-plt
21506 @opindex minline-plt
21507
21508 Enable inlining of PLT entries in function calls to functions that are
21509 not known to bind locally. It has no effect without @option{-mfdpic}.
21510 It's enabled by default if optimizing for speed and compiling for
21511 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21512 optimization option such as @option{-O3} or above is present in the
21513 command line.
21514
21515 @item -mTLS
21516 @opindex mTLS
21517
21518 Assume a large TLS segment when generating thread-local code.
21519
21520 @item -mtls
21521 @opindex mtls
21522
21523 Do not assume a large TLS segment when generating thread-local code.
21524
21525 @item -mgprel-ro
21526 @opindex mgprel-ro
21527
21528 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21529 that is known to be in read-only sections. It's enabled by default,
21530 except for @option{-fpic} or @option{-fpie}: even though it may help
21531 make the global offset table smaller, it trades 1 instruction for 4.
21532 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21533 one of which may be shared by multiple symbols, and it avoids the need
21534 for a GOT entry for the referenced symbol, so it's more likely to be a
21535 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
21536
21537 @item -multilib-library-pic
21538 @opindex multilib-library-pic
21539
21540 Link with the (library, not FD) pic libraries. It's implied by
21541 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
21542 @option{-fpic} without @option{-mfdpic}. You should never have to use
21543 it explicitly.
21544
21545 @item -mlinked-fp
21546 @opindex mlinked-fp
21547
21548 Follow the EABI requirement of always creating a frame pointer whenever
21549 a stack frame is allocated. This option is enabled by default and can
21550 be disabled with @option{-mno-linked-fp}.
21551
21552 @item -mlong-calls
21553 @opindex mlong-calls
21554
21555 Use indirect addressing to call functions outside the current
21556 compilation unit. This allows the functions to be placed anywhere
21557 within the 32-bit address space.
21558
21559 @item -malign-labels
21560 @opindex malign-labels
21561
21562 Try to align labels to an 8-byte boundary by inserting NOPs into the
21563 previous packet. This option only has an effect when VLIW packing
21564 is enabled. It doesn't create new packets; it merely adds NOPs to
21565 existing ones.
21566
21567 @item -mlibrary-pic
21568 @opindex mlibrary-pic
21569
21570 Generate position-independent EABI code.
21571
21572 @item -macc-4
21573 @opindex macc-4
21574
21575 Use only the first four media accumulator registers.
21576
21577 @item -macc-8
21578 @opindex macc-8
21579
21580 Use all eight media accumulator registers.
21581
21582 @item -mpack
21583 @opindex mpack
21584
21585 Pack VLIW instructions.
21586
21587 @item -mno-pack
21588 @opindex mno-pack
21589
21590 Do not pack VLIW instructions.
21591
21592 @item -mno-eflags
21593 @opindex mno-eflags
21594
21595 Do not mark ABI switches in e_flags.
21596
21597 @item -mcond-move
21598 @opindex mcond-move
21599
21600 Enable the use of conditional-move instructions (default).
21601
21602 This switch is mainly for debugging the compiler and will likely be removed
21603 in a future version.
21604
21605 @item -mno-cond-move
21606 @opindex mno-cond-move
21607
21608 Disable the use of conditional-move instructions.
21609
21610 This switch is mainly for debugging the compiler and will likely be removed
21611 in a future version.
21612
21613 @item -mscc
21614 @opindex mscc
21615
21616 Enable the use of conditional set instructions (default).
21617
21618 This switch is mainly for debugging the compiler and will likely be removed
21619 in a future version.
21620
21621 @item -mno-scc
21622 @opindex mno-scc
21623
21624 Disable the use of conditional set instructions.
21625
21626 This switch is mainly for debugging the compiler and will likely be removed
21627 in a future version.
21628
21629 @item -mcond-exec
21630 @opindex mcond-exec
21631
21632 Enable the use of conditional execution (default).
21633
21634 This switch is mainly for debugging the compiler and will likely be removed
21635 in a future version.
21636
21637 @item -mno-cond-exec
21638 @opindex mno-cond-exec
21639
21640 Disable the use of conditional execution.
21641
21642 This switch is mainly for debugging the compiler and will likely be removed
21643 in a future version.
21644
21645 @item -mvliw-branch
21646 @opindex mvliw-branch
21647
21648 Run a pass to pack branches into VLIW instructions (default).
21649
21650 This switch is mainly for debugging the compiler and will likely be removed
21651 in a future version.
21652
21653 @item -mno-vliw-branch
21654 @opindex mno-vliw-branch
21655
21656 Do not run a pass to pack branches into VLIW instructions.
21657
21658 This switch is mainly for debugging the compiler and will likely be removed
21659 in a future version.
21660
21661 @item -mmulti-cond-exec
21662 @opindex mmulti-cond-exec
21663
21664 Enable optimization of @code{&&} and @code{||} in conditional execution
21665 (default).
21666
21667 This switch is mainly for debugging the compiler and will likely be removed
21668 in a future version.
21669
21670 @item -mno-multi-cond-exec
21671 @opindex mno-multi-cond-exec
21672
21673 Disable optimization of @code{&&} and @code{||} in conditional execution.
21674
21675 This switch is mainly for debugging the compiler and will likely be removed
21676 in a future version.
21677
21678 @item -mnested-cond-exec
21679 @opindex mnested-cond-exec
21680
21681 Enable nested conditional execution optimizations (default).
21682
21683 This switch is mainly for debugging the compiler and will likely be removed
21684 in a future version.
21685
21686 @item -mno-nested-cond-exec
21687 @opindex mno-nested-cond-exec
21688
21689 Disable nested conditional execution optimizations.
21690
21691 This switch is mainly for debugging the compiler and will likely be removed
21692 in a future version.
21693
21694 @item -moptimize-membar
21695 @opindex moptimize-membar
21696
21697 This switch removes redundant @code{membar} instructions from the
21698 compiler-generated code. It is enabled by default.
21699
21700 @item -mno-optimize-membar
21701 @opindex mno-optimize-membar
21702 @opindex moptimize-membar
21703
21704 This switch disables the automatic removal of redundant @code{membar}
21705 instructions from the generated code.
21706
21707 @item -mtomcat-stats
21708 @opindex mtomcat-stats
21709
21710 Cause gas to print out tomcat statistics.
21711
21712 @item -mcpu=@var{cpu}
21713 @opindex mcpu
21714
21715 Select the processor type for which to generate code. Possible values are
21716 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21717 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21718
21719 @end table
21720
21721 @node GNU/Linux Options
21722 @subsection GNU/Linux Options
21723
21724 These @samp{-m} options are defined for GNU/Linux targets:
21725
21726 @table @gcctabopt
21727 @item -mglibc
21728 @opindex mglibc
21729 Use the GNU C library. This is the default except
21730 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21731 @samp{*-*-linux-*android*} targets.
21732
21733 @item -muclibc
21734 @opindex muclibc
21735 Use uClibc C library. This is the default on
21736 @samp{*-*-linux-*uclibc*} targets.
21737
21738 @item -mmusl
21739 @opindex mmusl
21740 Use the musl C library. This is the default on
21741 @samp{*-*-linux-*musl*} targets.
21742
21743 @item -mbionic
21744 @opindex mbionic
21745 Use Bionic C library. This is the default on
21746 @samp{*-*-linux-*android*} targets.
21747
21748 @item -mandroid
21749 @opindex mandroid
21750 Compile code compatible with Android platform. This is the default on
21751 @samp{*-*-linux-*android*} targets.
21752
21753 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21754 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
21755 this option makes the GCC driver pass Android-specific options to the linker.
21756 Finally, this option causes the preprocessor macro @code{__ANDROID__}
21757 to be defined.
21758
21759 @item -tno-android-cc
21760 @opindex tno-android-cc
21761 Disable compilation effects of @option{-mandroid}, i.e., do not enable
21762 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21763 @option{-fno-rtti} by default.
21764
21765 @item -tno-android-ld
21766 @opindex tno-android-ld
21767 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21768 linking options to the linker.
21769
21770 @end table
21771
21772 @node H8/300 Options
21773 @subsection H8/300 Options
21774
21775 These @samp{-m} options are defined for the H8/300 implementations:
21776
21777 @table @gcctabopt
21778 @item -mrelax
21779 @opindex mrelax
21780 Shorten some address references at link time, when possible; uses the
21781 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
21782 ld, Using ld}, for a fuller description.
21783
21784 @item -mh
21785 @opindex mh
21786 Generate code for the H8/300H@.
21787
21788 @item -ms
21789 @opindex ms
21790 Generate code for the H8S@.
21791
21792 @item -mn
21793 @opindex mn
21794 Generate code for the H8S and H8/300H in the normal mode. This switch
21795 must be used either with @option{-mh} or @option{-ms}.
21796
21797 @item -ms2600
21798 @opindex ms2600
21799 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
21800
21801 @item -mexr
21802 @opindex mexr
21803 Extended registers are stored on stack before execution of function
21804 with monitor attribute. Default option is @option{-mexr}.
21805 This option is valid only for H8S targets.
21806
21807 @item -mno-exr
21808 @opindex mno-exr
21809 @opindex mexr
21810 Extended registers are not stored on stack before execution of function
21811 with monitor attribute. Default option is @option{-mno-exr}.
21812 This option is valid only for H8S targets.
21813
21814 @item -mint32
21815 @opindex mint32
21816 Make @code{int} data 32 bits by default.
21817
21818 @item -malign-300
21819 @opindex malign-300
21820 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21821 The default for the H8/300H and H8S is to align longs and floats on
21822 4-byte boundaries.
21823 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
21824 This option has no effect on the H8/300.
21825 @end table
21826
21827 @node HPPA Options
21828 @subsection HPPA Options
21829 @cindex HPPA Options
21830
21831 These @samp{-m} options are defined for the HPPA family of computers:
21832
21833 @table @gcctabopt
21834 @item -march=@var{architecture-type}
21835 @opindex march
21836 Generate code for the specified architecture. The choices for
21837 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
21838 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
21839 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21840 architecture option for your machine. Code compiled for lower numbered
21841 architectures runs on higher numbered architectures, but not the
21842 other way around.
21843
21844 @item -mpa-risc-1-0
21845 @itemx -mpa-risc-1-1
21846 @itemx -mpa-risc-2-0
21847 @opindex mpa-risc-1-0
21848 @opindex mpa-risc-1-1
21849 @opindex mpa-risc-2-0
21850 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21851
21852 @item -mcaller-copies
21853 @opindex mcaller-copies
21854 The caller copies function arguments passed by hidden reference. This
21855 option should be used with care as it is not compatible with the default
21856 32-bit runtime. However, only aggregates larger than eight bytes are
21857 passed by hidden reference and the option provides better compatibility
21858 with OpenMP.
21859
21860 @item -mjump-in-delay
21861 @opindex mjump-in-delay
21862 This option is ignored and provided for compatibility purposes only.
21863
21864 @item -mdisable-fpregs
21865 @opindex mdisable-fpregs
21866 Prevent floating-point registers from being used in any manner. This is
21867 necessary for compiling kernels that perform lazy context switching of
21868 floating-point registers. If you use this option and attempt to perform
21869 floating-point operations, the compiler aborts.
21870
21871 @item -mdisable-indexing
21872 @opindex mdisable-indexing
21873 Prevent the compiler from using indexing address modes. This avoids some
21874 rather obscure problems when compiling MIG generated code under MACH@.
21875
21876 @item -mno-space-regs
21877 @opindex mno-space-regs
21878 @opindex mspace-regs
21879 Generate code that assumes the target has no space registers. This allows
21880 GCC to generate faster indirect calls and use unscaled index address modes.
21881
21882 Such code is suitable for level 0 PA systems and kernels.
21883
21884 @item -mfast-indirect-calls
21885 @opindex mfast-indirect-calls
21886 Generate code that assumes calls never cross space boundaries. This
21887 allows GCC to emit code that performs faster indirect calls.
21888
21889 This option does not work in the presence of shared libraries or nested
21890 functions.
21891
21892 @item -mfixed-range=@var{register-range}
21893 @opindex mfixed-range
21894 Generate code treating the given register range as fixed registers.
21895 A fixed register is one that the register allocator cannot use. This is
21896 useful when compiling kernel code. A register range is specified as
21897 two registers separated by a dash. Multiple register ranges can be
21898 specified separated by a comma.
21899
21900 @item -mlong-load-store
21901 @opindex mlong-load-store
21902 Generate 3-instruction load and store sequences as sometimes required by
21903 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
21904 the HP compilers.
21905
21906 @item -mportable-runtime
21907 @opindex mportable-runtime
21908 Use the portable calling conventions proposed by HP for ELF systems.
21909
21910 @item -mgas
21911 @opindex mgas
21912 Enable the use of assembler directives only GAS understands.
21913
21914 @item -mschedule=@var{cpu-type}
21915 @opindex mschedule
21916 Schedule code according to the constraints for the machine type
21917 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
21918 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
21919 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
21920 proper scheduling option for your machine. The default scheduling is
21921 @samp{8000}.
21922
21923 @item -mlinker-opt
21924 @opindex mlinker-opt
21925 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
21926 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
21927 linkers in which they give bogus error messages when linking some programs.
21928
21929 @item -msoft-float
21930 @opindex msoft-float
21931 Generate output containing library calls for floating point.
21932 @strong{Warning:} the requisite libraries are not available for all HPPA
21933 targets. Normally the facilities of the machine's usual C compiler are
21934 used, but this cannot be done directly in cross-compilation. You must make
21935 your own arrangements to provide suitable library functions for
21936 cross-compilation.
21937
21938 @option{-msoft-float} changes the calling convention in the output file;
21939 therefore, it is only useful if you compile @emph{all} of a program with
21940 this option. In particular, you need to compile @file{libgcc.a}, the
21941 library that comes with GCC, with @option{-msoft-float} in order for
21942 this to work.
21943
21944 @item -msio
21945 @opindex msio
21946 Generate the predefine, @code{_SIO}, for server IO@. The default is
21947 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
21948 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
21949 options are available under HP-UX and HI-UX@.
21950
21951 @item -mgnu-ld
21952 @opindex mgnu-ld
21953 Use options specific to GNU @command{ld}.
21954 This passes @option{-shared} to @command{ld} when
21955 building a shared library. It is the default when GCC is configured,
21956 explicitly or implicitly, with the GNU linker. This option does not
21957 affect which @command{ld} is called; it only changes what parameters
21958 are passed to that @command{ld}.
21959 The @command{ld} that is called is determined by the
21960 @option{--with-ld} configure option, GCC's program search path, and
21961 finally by the user's @env{PATH}. The linker used by GCC can be printed
21962 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
21963 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21964
21965 @item -mhp-ld
21966 @opindex mhp-ld
21967 Use options specific to HP @command{ld}.
21968 This passes @option{-b} to @command{ld} when building
21969 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
21970 links. It is the default when GCC is configured, explicitly or
21971 implicitly, with the HP linker. This option does not affect
21972 which @command{ld} is called; it only changes what parameters are passed to that
21973 @command{ld}.
21974 The @command{ld} that is called is determined by the @option{--with-ld}
21975 configure option, GCC's program search path, and finally by the user's
21976 @env{PATH}. The linker used by GCC can be printed using @samp{which
21977 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
21978 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21979
21980 @item -mlong-calls
21981 @opindex mno-long-calls
21982 @opindex mlong-calls
21983 Generate code that uses long call sequences. This ensures that a call
21984 is always able to reach linker generated stubs. The default is to generate
21985 long calls only when the distance from the call site to the beginning
21986 of the function or translation unit, as the case may be, exceeds a
21987 predefined limit set by the branch type being used. The limits for
21988 normal calls are 7,600,000 and 240,000 bytes, respectively for the
21989 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
21990 240,000 bytes.
21991
21992 Distances are measured from the beginning of functions when using the
21993 @option{-ffunction-sections} option, or when using the @option{-mgas}
21994 and @option{-mno-portable-runtime} options together under HP-UX with
21995 the SOM linker.
21996
21997 It is normally not desirable to use this option as it degrades
21998 performance. However, it may be useful in large applications,
21999 particularly when partial linking is used to build the application.
22000
22001 The types of long calls used depends on the capabilities of the
22002 assembler and linker, and the type of code being generated. The
22003 impact on systems that support long absolute calls, and long pic
22004 symbol-difference or pc-relative calls should be relatively small.
22005 However, an indirect call is used on 32-bit ELF systems in pic code
22006 and it is quite long.
22007
22008 @item -munix=@var{unix-std}
22009 @opindex march
22010 Generate compiler predefines and select a startfile for the specified
22011 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
22012 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
22013 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
22014 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
22015 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
22016 and later.
22017
22018 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
22019 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
22020 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
22021 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
22022 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
22023 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
22024
22025 It is @emph{important} to note that this option changes the interfaces
22026 for various library routines. It also affects the operational behavior
22027 of the C library. Thus, @emph{extreme} care is needed in using this
22028 option.
22029
22030 Library code that is intended to operate with more than one UNIX
22031 standard must test, set and restore the variable @code{__xpg4_extended_mask}
22032 as appropriate. Most GNU software doesn't provide this capability.
22033
22034 @item -nolibdld
22035 @opindex nolibdld
22036 Suppress the generation of link options to search libdld.sl when the
22037 @option{-static} option is specified on HP-UX 10 and later.
22038
22039 @item -static
22040 @opindex static
22041 The HP-UX implementation of setlocale in libc has a dependency on
22042 libdld.sl. There isn't an archive version of libdld.sl. Thus,
22043 when the @option{-static} option is specified, special link options
22044 are needed to resolve this dependency.
22045
22046 On HP-UX 10 and later, the GCC driver adds the necessary options to
22047 link with libdld.sl when the @option{-static} option is specified.
22048 This causes the resulting binary to be dynamic. On the 64-bit port,
22049 the linkers generate dynamic binaries by default in any case. The
22050 @option{-nolibdld} option can be used to prevent the GCC driver from
22051 adding these link options.
22052
22053 @item -threads
22054 @opindex threads
22055 Add support for multithreading with the @dfn{dce thread} library
22056 under HP-UX@. This option sets flags for both the preprocessor and
22057 linker.
22058 @end table
22059
22060 @node IA-64 Options
22061 @subsection IA-64 Options
22062 @cindex IA-64 Options
22063
22064 These are the @samp{-m} options defined for the Intel IA-64 architecture.
22065
22066 @table @gcctabopt
22067 @item -mbig-endian
22068 @opindex mbig-endian
22069 Generate code for a big-endian target. This is the default for HP-UX@.
22070
22071 @item -mlittle-endian
22072 @opindex mlittle-endian
22073 Generate code for a little-endian target. This is the default for AIX5
22074 and GNU/Linux.
22075
22076 @item -mgnu-as
22077 @itemx -mno-gnu-as
22078 @opindex mgnu-as
22079 @opindex mno-gnu-as
22080 Generate (or don't) code for the GNU assembler. This is the default.
22081 @c Also, this is the default if the configure option @option{--with-gnu-as}
22082 @c is used.
22083
22084 @item -mgnu-ld
22085 @itemx -mno-gnu-ld
22086 @opindex mgnu-ld
22087 @opindex mno-gnu-ld
22088 Generate (or don't) code for the GNU linker. This is the default.
22089 @c Also, this is the default if the configure option @option{--with-gnu-ld}
22090 @c is used.
22091
22092 @item -mno-pic
22093 @opindex mno-pic
22094 Generate code that does not use a global pointer register. The result
22095 is not position independent code, and violates the IA-64 ABI@.
22096
22097 @item -mvolatile-asm-stop
22098 @itemx -mno-volatile-asm-stop
22099 @opindex mvolatile-asm-stop
22100 @opindex mno-volatile-asm-stop
22101 Generate (or don't) a stop bit immediately before and after volatile asm
22102 statements.
22103
22104 @item -mregister-names
22105 @itemx -mno-register-names
22106 @opindex mregister-names
22107 @opindex mno-register-names
22108 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
22109 the stacked registers. This may make assembler output more readable.
22110
22111 @item -mno-sdata
22112 @itemx -msdata
22113 @opindex mno-sdata
22114 @opindex msdata
22115 Disable (or enable) optimizations that use the small data section. This may
22116 be useful for working around optimizer bugs.
22117
22118 @item -mconstant-gp
22119 @opindex mconstant-gp
22120 Generate code that uses a single constant global pointer value. This is
22121 useful when compiling kernel code.
22122
22123 @item -mauto-pic
22124 @opindex mauto-pic
22125 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
22126 This is useful when compiling firmware code.
22127
22128 @item -minline-float-divide-min-latency
22129 @opindex minline-float-divide-min-latency
22130 Generate code for inline divides of floating-point values
22131 using the minimum latency algorithm.
22132
22133 @item -minline-float-divide-max-throughput
22134 @opindex minline-float-divide-max-throughput
22135 Generate code for inline divides of floating-point values
22136 using the maximum throughput algorithm.
22137
22138 @item -mno-inline-float-divide
22139 @opindex mno-inline-float-divide
22140 Do not generate inline code for divides of floating-point values.
22141
22142 @item -minline-int-divide-min-latency
22143 @opindex minline-int-divide-min-latency
22144 Generate code for inline divides of integer values
22145 using the minimum latency algorithm.
22146
22147 @item -minline-int-divide-max-throughput
22148 @opindex minline-int-divide-max-throughput
22149 Generate code for inline divides of integer values
22150 using the maximum throughput algorithm.
22151
22152 @item -mno-inline-int-divide
22153 @opindex mno-inline-int-divide
22154 @opindex minline-int-divide
22155 Do not generate inline code for divides of integer values.
22156
22157 @item -minline-sqrt-min-latency
22158 @opindex minline-sqrt-min-latency
22159 Generate code for inline square roots
22160 using the minimum latency algorithm.
22161
22162 @item -minline-sqrt-max-throughput
22163 @opindex minline-sqrt-max-throughput
22164 Generate code for inline square roots
22165 using the maximum throughput algorithm.
22166
22167 @item -mno-inline-sqrt
22168 @opindex mno-inline-sqrt
22169 Do not generate inline code for @code{sqrt}.
22170
22171 @item -mfused-madd
22172 @itemx -mno-fused-madd
22173 @opindex mfused-madd
22174 @opindex mno-fused-madd
22175 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
22176 instructions. The default is to use these instructions.
22177
22178 @item -mno-dwarf2-asm
22179 @itemx -mdwarf2-asm
22180 @opindex mno-dwarf2-asm
22181 @opindex mdwarf2-asm
22182 Don't (or do) generate assembler code for the DWARF line number debugging
22183 info. This may be useful when not using the GNU assembler.
22184
22185 @item -mearly-stop-bits
22186 @itemx -mno-early-stop-bits
22187 @opindex mearly-stop-bits
22188 @opindex mno-early-stop-bits
22189 Allow stop bits to be placed earlier than immediately preceding the
22190 instruction that triggered the stop bit. This can improve instruction
22191 scheduling, but does not always do so.
22192
22193 @item -mfixed-range=@var{register-range}
22194 @opindex mfixed-range
22195 Generate code treating the given register range as fixed registers.
22196 A fixed register is one that the register allocator cannot use. This is
22197 useful when compiling kernel code. A register range is specified as
22198 two registers separated by a dash. Multiple register ranges can be
22199 specified separated by a comma.
22200
22201 @item -mtls-size=@var{tls-size}
22202 @opindex mtls-size
22203 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
22204 64.
22205
22206 @item -mtune=@var{cpu-type}
22207 @opindex mtune
22208 Tune the instruction scheduling for a particular CPU, Valid values are
22209 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
22210 and @samp{mckinley}.
22211
22212 @item -milp32
22213 @itemx -mlp64
22214 @opindex milp32
22215 @opindex mlp64
22216 Generate code for a 32-bit or 64-bit environment.
22217 The 32-bit environment sets int, long and pointer to 32 bits.
22218 The 64-bit environment sets int to 32 bits and long and pointer
22219 to 64 bits. These are HP-UX specific flags.
22220
22221 @item -mno-sched-br-data-spec
22222 @itemx -msched-br-data-spec
22223 @opindex mno-sched-br-data-spec
22224 @opindex msched-br-data-spec
22225 (Dis/En)able data speculative scheduling before reload.
22226 This results in generation of @code{ld.a} instructions and
22227 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
22228 The default setting is disabled.
22229
22230 @item -msched-ar-data-spec
22231 @itemx -mno-sched-ar-data-spec
22232 @opindex msched-ar-data-spec
22233 @opindex mno-sched-ar-data-spec
22234 (En/Dis)able data speculative scheduling after reload.
22235 This results in generation of @code{ld.a} instructions and
22236 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
22237 The default setting is enabled.
22238
22239 @item -mno-sched-control-spec
22240 @itemx -msched-control-spec
22241 @opindex mno-sched-control-spec
22242 @opindex msched-control-spec
22243 (Dis/En)able control speculative scheduling. This feature is
22244 available only during region scheduling (i.e.@: before reload).
22245 This results in generation of the @code{ld.s} instructions and
22246 the corresponding check instructions @code{chk.s}.
22247 The default setting is disabled.
22248
22249 @item -msched-br-in-data-spec
22250 @itemx -mno-sched-br-in-data-spec
22251 @opindex msched-br-in-data-spec
22252 @opindex mno-sched-br-in-data-spec
22253 (En/Dis)able speculative scheduling of the instructions that
22254 are dependent on the data speculative loads before reload.
22255 This is effective only with @option{-msched-br-data-spec} enabled.
22256 The default setting is enabled.
22257
22258 @item -msched-ar-in-data-spec
22259 @itemx -mno-sched-ar-in-data-spec
22260 @opindex msched-ar-in-data-spec
22261 @opindex mno-sched-ar-in-data-spec
22262 (En/Dis)able speculative scheduling of the instructions that
22263 are dependent on the data speculative loads after reload.
22264 This is effective only with @option{-msched-ar-data-spec} enabled.
22265 The default setting is enabled.
22266
22267 @item -msched-in-control-spec
22268 @itemx -mno-sched-in-control-spec
22269 @opindex msched-in-control-spec
22270 @opindex mno-sched-in-control-spec
22271 (En/Dis)able speculative scheduling of the instructions that
22272 are dependent on the control speculative loads.
22273 This is effective only with @option{-msched-control-spec} enabled.
22274 The default setting is enabled.
22275
22276 @item -mno-sched-prefer-non-data-spec-insns
22277 @itemx -msched-prefer-non-data-spec-insns
22278 @opindex mno-sched-prefer-non-data-spec-insns
22279 @opindex msched-prefer-non-data-spec-insns
22280 If enabled, data-speculative instructions are chosen for schedule
22281 only if there are no other choices at the moment. This makes
22282 the use of the data speculation much more conservative.
22283 The default setting is disabled.
22284
22285 @item -mno-sched-prefer-non-control-spec-insns
22286 @itemx -msched-prefer-non-control-spec-insns
22287 @opindex mno-sched-prefer-non-control-spec-insns
22288 @opindex msched-prefer-non-control-spec-insns
22289 If enabled, control-speculative instructions are chosen for schedule
22290 only if there are no other choices at the moment. This makes
22291 the use of the control speculation much more conservative.
22292 The default setting is disabled.
22293
22294 @item -mno-sched-count-spec-in-critical-path
22295 @itemx -msched-count-spec-in-critical-path
22296 @opindex mno-sched-count-spec-in-critical-path
22297 @opindex msched-count-spec-in-critical-path
22298 If enabled, speculative dependencies are considered during
22299 computation of the instructions priorities. This makes the use of the
22300 speculation a bit more conservative.
22301 The default setting is disabled.
22302
22303 @item -msched-spec-ldc
22304 @opindex msched-spec-ldc
22305 Use a simple data speculation check. This option is on by default.
22306
22307 @item -msched-control-spec-ldc
22308 @opindex msched-spec-ldc
22309 Use a simple check for control speculation. This option is on by default.
22310
22311 @item -msched-stop-bits-after-every-cycle
22312 @opindex msched-stop-bits-after-every-cycle
22313 Place a stop bit after every cycle when scheduling. This option is on
22314 by default.
22315
22316 @item -msched-fp-mem-deps-zero-cost
22317 @opindex msched-fp-mem-deps-zero-cost
22318 Assume that floating-point stores and loads are not likely to cause a conflict
22319 when placed into the same instruction group. This option is disabled by
22320 default.
22321
22322 @item -msel-sched-dont-check-control-spec
22323 @opindex msel-sched-dont-check-control-spec
22324 Generate checks for control speculation in selective scheduling.
22325 This flag is disabled by default.
22326
22327 @item -msched-max-memory-insns=@var{max-insns}
22328 @opindex msched-max-memory-insns
22329 Limit on the number of memory insns per instruction group, giving lower
22330 priority to subsequent memory insns attempting to schedule in the same
22331 instruction group. Frequently useful to prevent cache bank conflicts.
22332 The default value is 1.
22333
22334 @item -msched-max-memory-insns-hard-limit
22335 @opindex msched-max-memory-insns-hard-limit
22336 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
22337 disallowing more than that number in an instruction group.
22338 Otherwise, the limit is ``soft'', meaning that non-memory operations
22339 are preferred when the limit is reached, but memory operations may still
22340 be scheduled.
22341
22342 @end table
22343
22344 @node LM32 Options
22345 @subsection LM32 Options
22346 @cindex LM32 options
22347
22348 These @option{-m} options are defined for the LatticeMico32 architecture:
22349
22350 @table @gcctabopt
22351 @item -mbarrel-shift-enabled
22352 @opindex mbarrel-shift-enabled
22353 Enable barrel-shift instructions.
22354
22355 @item -mdivide-enabled
22356 @opindex mdivide-enabled
22357 Enable divide and modulus instructions.
22358
22359 @item -mmultiply-enabled
22360 @opindex multiply-enabled
22361 Enable multiply instructions.
22362
22363 @item -msign-extend-enabled
22364 @opindex msign-extend-enabled
22365 Enable sign extend instructions.
22366
22367 @item -muser-enabled
22368 @opindex muser-enabled
22369 Enable user-defined instructions.
22370
22371 @end table
22372
22373 @node M32C Options
22374 @subsection M32C Options
22375 @cindex M32C options
22376
22377 @table @gcctabopt
22378 @item -mcpu=@var{name}
22379 @opindex mcpu=
22380 Select the CPU for which code is generated. @var{name} may be one of
22381 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
22382 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
22383 the M32C/80 series.
22384
22385 @item -msim
22386 @opindex msim
22387 Specifies that the program will be run on the simulator. This causes
22388 an alternate runtime library to be linked in which supports, for
22389 example, file I/O@. You must not use this option when generating
22390 programs that will run on real hardware; you must provide your own
22391 runtime library for whatever I/O functions are needed.
22392
22393 @item -memregs=@var{number}
22394 @opindex memregs=
22395 Specifies the number of memory-based pseudo-registers GCC uses
22396 during code generation. These pseudo-registers are used like real
22397 registers, so there is a tradeoff between GCC's ability to fit the
22398 code into available registers, and the performance penalty of using
22399 memory instead of registers. Note that all modules in a program must
22400 be compiled with the same value for this option. Because of that, you
22401 must not use this option with GCC's default runtime libraries.
22402
22403 @end table
22404
22405 @node M32R/D Options
22406 @subsection M32R/D Options
22407 @cindex M32R/D options
22408
22409 These @option{-m} options are defined for Renesas M32R/D architectures:
22410
22411 @table @gcctabopt
22412 @item -m32r2
22413 @opindex m32r2
22414 Generate code for the M32R/2@.
22415
22416 @item -m32rx
22417 @opindex m32rx
22418 Generate code for the M32R/X@.
22419
22420 @item -m32r
22421 @opindex m32r
22422 Generate code for the M32R@. This is the default.
22423
22424 @item -mmodel=small
22425 @opindex mmodel=small
22426 Assume all objects live in the lower 16MB of memory (so that their addresses
22427 can be loaded with the @code{ld24} instruction), and assume all subroutines
22428 are reachable with the @code{bl} instruction.
22429 This is the default.
22430
22431 The addressability of a particular object can be set with the
22432 @code{model} attribute.
22433
22434 @item -mmodel=medium
22435 @opindex mmodel=medium
22436 Assume objects may be anywhere in the 32-bit address space (the compiler
22437 generates @code{seth/add3} instructions to load their addresses), and
22438 assume all subroutines are reachable with the @code{bl} instruction.
22439
22440 @item -mmodel=large
22441 @opindex mmodel=large
22442 Assume objects may be anywhere in the 32-bit address space (the compiler
22443 generates @code{seth/add3} instructions to load their addresses), and
22444 assume subroutines may not be reachable with the @code{bl} instruction
22445 (the compiler generates the much slower @code{seth/add3/jl}
22446 instruction sequence).
22447
22448 @item -msdata=none
22449 @opindex msdata=none
22450 Disable use of the small data area. Variables are put into
22451 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
22452 @code{section} attribute has been specified).
22453 This is the default.
22454
22455 The small data area consists of sections @code{.sdata} and @code{.sbss}.
22456 Objects may be explicitly put in the small data area with the
22457 @code{section} attribute using one of these sections.
22458
22459 @item -msdata=sdata
22460 @opindex msdata=sdata
22461 Put small global and static data in the small data area, but do not
22462 generate special code to reference them.
22463
22464 @item -msdata=use
22465 @opindex msdata=use
22466 Put small global and static data in the small data area, and generate
22467 special instructions to reference them.
22468
22469 @item -G @var{num}
22470 @opindex G
22471 @cindex smaller data references
22472 Put global and static objects less than or equal to @var{num} bytes
22473 into the small data or BSS sections instead of the normal data or BSS
22474 sections. The default value of @var{num} is 8.
22475 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22476 for this option to have any effect.
22477
22478 All modules should be compiled with the same @option{-G @var{num}} value.
22479 Compiling with different values of @var{num} may or may not work; if it
22480 doesn't the linker gives an error message---incorrect code is not
22481 generated.
22482
22483 @item -mdebug
22484 @opindex mdebug
22485 Makes the M32R-specific code in the compiler display some statistics
22486 that might help in debugging programs.
22487
22488 @item -malign-loops
22489 @opindex malign-loops
22490 Align all loops to a 32-byte boundary.
22491
22492 @item -mno-align-loops
22493 @opindex mno-align-loops
22494 Do not enforce a 32-byte alignment for loops. This is the default.
22495
22496 @item -missue-rate=@var{number}
22497 @opindex missue-rate=@var{number}
22498 Issue @var{number} instructions per cycle. @var{number} can only be 1
22499 or 2.
22500
22501 @item -mbranch-cost=@var{number}
22502 @opindex mbranch-cost=@var{number}
22503 @var{number} can only be 1 or 2. If it is 1 then branches are
22504 preferred over conditional code, if it is 2, then the opposite applies.
22505
22506 @item -mflush-trap=@var{number}
22507 @opindex mflush-trap=@var{number}
22508 Specifies the trap number to use to flush the cache. The default is
22509 12. Valid numbers are between 0 and 15 inclusive.
22510
22511 @item -mno-flush-trap
22512 @opindex mno-flush-trap
22513 Specifies that the cache cannot be flushed by using a trap.
22514
22515 @item -mflush-func=@var{name}
22516 @opindex mflush-func=@var{name}
22517 Specifies the name of the operating system function to call to flush
22518 the cache. The default is @samp{_flush_cache}, but a function call
22519 is only used if a trap is not available.
22520
22521 @item -mno-flush-func
22522 @opindex mno-flush-func
22523 Indicates that there is no OS function for flushing the cache.
22524
22525 @end table
22526
22527 @node M680x0 Options
22528 @subsection M680x0 Options
22529 @cindex M680x0 options
22530
22531 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22532 The default settings depend on which architecture was selected when
22533 the compiler was configured; the defaults for the most common choices
22534 are given below.
22535
22536 @table @gcctabopt
22537 @item -march=@var{arch}
22538 @opindex march
22539 Generate code for a specific M680x0 or ColdFire instruction set
22540 architecture. Permissible values of @var{arch} for M680x0
22541 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22542 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
22543 architectures are selected according to Freescale's ISA classification
22544 and the permissible values are: @samp{isaa}, @samp{isaaplus},
22545 @samp{isab} and @samp{isac}.
22546
22547 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22548 code for a ColdFire target. The @var{arch} in this macro is one of the
22549 @option{-march} arguments given above.
22550
22551 When used together, @option{-march} and @option{-mtune} select code
22552 that runs on a family of similar processors but that is optimized
22553 for a particular microarchitecture.
22554
22555 @item -mcpu=@var{cpu}
22556 @opindex mcpu
22557 Generate code for a specific M680x0 or ColdFire processor.
22558 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22559 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22560 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
22561 below, which also classifies the CPUs into families:
22562
22563 @multitable @columnfractions 0.20 0.80
22564 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22565 @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}
22566 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22567 @item @samp{5206e} @tab @samp{5206e}
22568 @item @samp{5208} @tab @samp{5207} @samp{5208}
22569 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22570 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22571 @item @samp{5216} @tab @samp{5214} @samp{5216}
22572 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22573 @item @samp{5225} @tab @samp{5224} @samp{5225}
22574 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22575 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22576 @item @samp{5249} @tab @samp{5249}
22577 @item @samp{5250} @tab @samp{5250}
22578 @item @samp{5271} @tab @samp{5270} @samp{5271}
22579 @item @samp{5272} @tab @samp{5272}
22580 @item @samp{5275} @tab @samp{5274} @samp{5275}
22581 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22582 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22583 @item @samp{5307} @tab @samp{5307}
22584 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22585 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22586 @item @samp{5407} @tab @samp{5407}
22587 @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}
22588 @end multitable
22589
22590 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22591 @var{arch} is compatible with @var{cpu}. Other combinations of
22592 @option{-mcpu} and @option{-march} are rejected.
22593
22594 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22595 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
22596 where the value of @var{family} is given by the table above.
22597
22598 @item -mtune=@var{tune}
22599 @opindex mtune
22600 Tune the code for a particular microarchitecture within the
22601 constraints set by @option{-march} and @option{-mcpu}.
22602 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22603 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22604 and @samp{cpu32}. The ColdFire microarchitectures
22605 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22606
22607 You can also use @option{-mtune=68020-40} for code that needs
22608 to run relatively well on 68020, 68030 and 68040 targets.
22609 @option{-mtune=68020-60} is similar but includes 68060 targets
22610 as well. These two options select the same tuning decisions as
22611 @option{-m68020-40} and @option{-m68020-60} respectively.
22612
22613 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22614 when tuning for 680x0 architecture @var{arch}. It also defines
22615 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22616 option is used. If GCC is tuning for a range of architectures,
22617 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22618 it defines the macros for every architecture in the range.
22619
22620 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22621 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22622 of the arguments given above.
22623
22624 @item -m68000
22625 @itemx -mc68000
22626 @opindex m68000
22627 @opindex mc68000
22628 Generate output for a 68000. This is the default
22629 when the compiler is configured for 68000-based systems.
22630 It is equivalent to @option{-march=68000}.
22631
22632 Use this option for microcontrollers with a 68000 or EC000 core,
22633 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22634
22635 @item -m68010
22636 @opindex m68010
22637 Generate output for a 68010. This is the default
22638 when the compiler is configured for 68010-based systems.
22639 It is equivalent to @option{-march=68010}.
22640
22641 @item -m68020
22642 @itemx -mc68020
22643 @opindex m68020
22644 @opindex mc68020
22645 Generate output for a 68020. This is the default
22646 when the compiler is configured for 68020-based systems.
22647 It is equivalent to @option{-march=68020}.
22648
22649 @item -m68030
22650 @opindex m68030
22651 Generate output for a 68030. This is the default when the compiler is
22652 configured for 68030-based systems. It is equivalent to
22653 @option{-march=68030}.
22654
22655 @item -m68040
22656 @opindex m68040
22657 Generate output for a 68040. This is the default when the compiler is
22658 configured for 68040-based systems. It is equivalent to
22659 @option{-march=68040}.
22660
22661 This option inhibits the use of 68881/68882 instructions that have to be
22662 emulated by software on the 68040. Use this option if your 68040 does not
22663 have code to emulate those instructions.
22664
22665 @item -m68060
22666 @opindex m68060
22667 Generate output for a 68060. This is the default when the compiler is
22668 configured for 68060-based systems. It is equivalent to
22669 @option{-march=68060}.
22670
22671 This option inhibits the use of 68020 and 68881/68882 instructions that
22672 have to be emulated by software on the 68060. Use this option if your 68060
22673 does not have code to emulate those instructions.
22674
22675 @item -mcpu32
22676 @opindex mcpu32
22677 Generate output for a CPU32. This is the default
22678 when the compiler is configured for CPU32-based systems.
22679 It is equivalent to @option{-march=cpu32}.
22680
22681 Use this option for microcontrollers with a
22682 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
22683 68336, 68340, 68341, 68349 and 68360.
22684
22685 @item -m5200
22686 @opindex m5200
22687 Generate output for a 520X ColdFire CPU@. This is the default
22688 when the compiler is configured for 520X-based systems.
22689 It is equivalent to @option{-mcpu=5206}, and is now deprecated
22690 in favor of that option.
22691
22692 Use this option for microcontroller with a 5200 core, including
22693 the MCF5202, MCF5203, MCF5204 and MCF5206.
22694
22695 @item -m5206e
22696 @opindex m5206e
22697 Generate output for a 5206e ColdFire CPU@. The option is now
22698 deprecated in favor of the equivalent @option{-mcpu=5206e}.
22699
22700 @item -m528x
22701 @opindex m528x
22702 Generate output for a member of the ColdFire 528X family.
22703 The option is now deprecated in favor of the equivalent
22704 @option{-mcpu=528x}.
22705
22706 @item -m5307
22707 @opindex m5307
22708 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
22709 in favor of the equivalent @option{-mcpu=5307}.
22710
22711 @item -m5407
22712 @opindex m5407
22713 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
22714 in favor of the equivalent @option{-mcpu=5407}.
22715
22716 @item -mcfv4e
22717 @opindex mcfv4e
22718 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22719 This includes use of hardware floating-point instructions.
22720 The option is equivalent to @option{-mcpu=547x}, and is now
22721 deprecated in favor of that option.
22722
22723 @item -m68020-40
22724 @opindex m68020-40
22725 Generate output for a 68040, without using any of the new instructions.
22726 This results in code that can run relatively efficiently on either a
22727 68020/68881 or a 68030 or a 68040. The generated code does use the
22728 68881 instructions that are emulated on the 68040.
22729
22730 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22731
22732 @item -m68020-60
22733 @opindex m68020-60
22734 Generate output for a 68060, without using any of the new instructions.
22735 This results in code that can run relatively efficiently on either a
22736 68020/68881 or a 68030 or a 68040. The generated code does use the
22737 68881 instructions that are emulated on the 68060.
22738
22739 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22740
22741 @item -mhard-float
22742 @itemx -m68881
22743 @opindex mhard-float
22744 @opindex m68881
22745 Generate floating-point instructions. This is the default for 68020
22746 and above, and for ColdFire devices that have an FPU@. It defines the
22747 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22748 on ColdFire targets.
22749
22750 @item -msoft-float
22751 @opindex msoft-float
22752 Do not generate floating-point instructions; use library calls instead.
22753 This is the default for 68000, 68010, and 68832 targets. It is also
22754 the default for ColdFire devices that have no FPU.
22755
22756 @item -mdiv
22757 @itemx -mno-div
22758 @opindex mdiv
22759 @opindex mno-div
22760 Generate (do not generate) ColdFire hardware divide and remainder
22761 instructions. If @option{-march} is used without @option{-mcpu},
22762 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22763 architectures. Otherwise, the default is taken from the target CPU
22764 (either the default CPU, or the one specified by @option{-mcpu}). For
22765 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22766 @option{-mcpu=5206e}.
22767
22768 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22769
22770 @item -mshort
22771 @opindex mshort
22772 Consider type @code{int} to be 16 bits wide, like @code{short int}.
22773 Additionally, parameters passed on the stack are also aligned to a
22774 16-bit boundary even on targets whose API mandates promotion to 32-bit.
22775
22776 @item -mno-short
22777 @opindex mno-short
22778 Do not consider type @code{int} to be 16 bits wide. This is the default.
22779
22780 @item -mnobitfield
22781 @itemx -mno-bitfield
22782 @opindex mnobitfield
22783 @opindex mno-bitfield
22784 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
22785 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22786
22787 @item -mbitfield
22788 @opindex mbitfield
22789 Do use the bit-field instructions. The @option{-m68020} option implies
22790 @option{-mbitfield}. This is the default if you use a configuration
22791 designed for a 68020.
22792
22793 @item -mrtd
22794 @opindex mrtd
22795 Use a different function-calling convention, in which functions
22796 that take a fixed number of arguments return with the @code{rtd}
22797 instruction, which pops their arguments while returning. This
22798 saves one instruction in the caller since there is no need to pop
22799 the arguments there.
22800
22801 This calling convention is incompatible with the one normally
22802 used on Unix, so you cannot use it if you need to call libraries
22803 compiled with the Unix compiler.
22804
22805 Also, you must provide function prototypes for all functions that
22806 take variable numbers of arguments (including @code{printf});
22807 otherwise incorrect code is generated for calls to those
22808 functions.
22809
22810 In addition, seriously incorrect code results if you call a
22811 function with too many arguments. (Normally, extra arguments are
22812 harmlessly ignored.)
22813
22814 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
22815 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22816
22817 The default is @option{-mno-rtd}.
22818
22819 @item -malign-int
22820 @itemx -mno-align-int
22821 @opindex malign-int
22822 @opindex mno-align-int
22823 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22824 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
22825 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22826 Aligning variables on 32-bit boundaries produces code that runs somewhat
22827 faster on processors with 32-bit busses at the expense of more memory.
22828
22829 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
22830 aligns structures containing the above types differently than
22831 most published application binary interface specifications for the m68k.
22832
22833 @opindex mpcrel
22834 Use the pc-relative addressing mode of the 68000 directly, instead of
22835 using a global offset table. At present, this option implies @option{-fpic},
22836 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
22837 not presently supported with @option{-mpcrel}, though this could be supported for
22838 68020 and higher processors.
22839
22840 @item -mno-strict-align
22841 @itemx -mstrict-align
22842 @opindex mno-strict-align
22843 @opindex mstrict-align
22844 Do not (do) assume that unaligned memory references are handled by
22845 the system.
22846
22847 @item -msep-data
22848 Generate code that allows the data segment to be located in a different
22849 area of memory from the text segment. This allows for execute-in-place in
22850 an environment without virtual memory management. This option implies
22851 @option{-fPIC}.
22852
22853 @item -mno-sep-data
22854 Generate code that assumes that the data segment follows the text segment.
22855 This is the default.
22856
22857 @item -mid-shared-library
22858 Generate code that supports shared libraries via the library ID method.
22859 This allows for execute-in-place and shared libraries in an environment
22860 without virtual memory management. This option implies @option{-fPIC}.
22861
22862 @item -mno-id-shared-library
22863 Generate code that doesn't assume ID-based shared libraries are being used.
22864 This is the default.
22865
22866 @item -mshared-library-id=n
22867 Specifies the identification number of the ID-based shared library being
22868 compiled. Specifying a value of 0 generates more compact code; specifying
22869 other values forces the allocation of that number to the current
22870 library, but is no more space- or time-efficient than omitting this option.
22871
22872 @item -mxgot
22873 @itemx -mno-xgot
22874 @opindex mxgot
22875 @opindex mno-xgot
22876 When generating position-independent code for ColdFire, generate code
22877 that works if the GOT has more than 8192 entries. This code is
22878 larger and slower than code generated without this option. On M680x0
22879 processors, this option is not needed; @option{-fPIC} suffices.
22880
22881 GCC normally uses a single instruction to load values from the GOT@.
22882 While this is relatively efficient, it only works if the GOT
22883 is smaller than about 64k. Anything larger causes the linker
22884 to report an error such as:
22885
22886 @cindex relocation truncated to fit (ColdFire)
22887 @smallexample
22888 relocation truncated to fit: R_68K_GOT16O foobar
22889 @end smallexample
22890
22891 If this happens, you should recompile your code with @option{-mxgot}.
22892 It should then work with very large GOTs. However, code generated with
22893 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
22894 the value of a global symbol.
22895
22896 Note that some linkers, including newer versions of the GNU linker,
22897 can create multiple GOTs and sort GOT entries. If you have such a linker,
22898 you should only need to use @option{-mxgot} when compiling a single
22899 object file that accesses more than 8192 GOT entries. Very few do.
22900
22901 These options have no effect unless GCC is generating
22902 position-independent code.
22903
22904 @item -mlong-jump-table-offsets
22905 @opindex mlong-jump-table-offsets
22906 Use 32-bit offsets in @code{switch} tables. The default is to use
22907 16-bit offsets.
22908
22909 @end table
22910
22911 @node MCore Options
22912 @subsection MCore Options
22913 @cindex MCore options
22914
22915 These are the @samp{-m} options defined for the Motorola M*Core
22916 processors.
22917
22918 @table @gcctabopt
22919
22920 @item -mhardlit
22921 @itemx -mno-hardlit
22922 @opindex mhardlit
22923 @opindex mno-hardlit
22924 Inline constants into the code stream if it can be done in two
22925 instructions or less.
22926
22927 @item -mdiv
22928 @itemx -mno-div
22929 @opindex mdiv
22930 @opindex mno-div
22931 Use the divide instruction. (Enabled by default).
22932
22933 @item -mrelax-immediate
22934 @itemx -mno-relax-immediate
22935 @opindex mrelax-immediate
22936 @opindex mno-relax-immediate
22937 Allow arbitrary-sized immediates in bit operations.
22938
22939 @item -mwide-bitfields
22940 @itemx -mno-wide-bitfields
22941 @opindex mwide-bitfields
22942 @opindex mno-wide-bitfields
22943 Always treat bit-fields as @code{int}-sized.
22944
22945 @item -m4byte-functions
22946 @itemx -mno-4byte-functions
22947 @opindex m4byte-functions
22948 @opindex mno-4byte-functions
22949 Force all functions to be aligned to a 4-byte boundary.
22950
22951 @item -mcallgraph-data
22952 @itemx -mno-callgraph-data
22953 @opindex mcallgraph-data
22954 @opindex mno-callgraph-data
22955 Emit callgraph information.
22956
22957 @item -mslow-bytes
22958 @itemx -mno-slow-bytes
22959 @opindex mslow-bytes
22960 @opindex mno-slow-bytes
22961 Prefer word access when reading byte quantities.
22962
22963 @item -mlittle-endian
22964 @itemx -mbig-endian
22965 @opindex mlittle-endian
22966 @opindex mbig-endian
22967 Generate code for a little-endian target.
22968
22969 @item -m210
22970 @itemx -m340
22971 @opindex m210
22972 @opindex m340
22973 Generate code for the 210 processor.
22974
22975 @item -mno-lsim
22976 @opindex mno-lsim
22977 Assume that runtime support has been provided and so omit the
22978 simulator library (@file{libsim.a)} from the linker command line.
22979
22980 @item -mstack-increment=@var{size}
22981 @opindex mstack-increment
22982 Set the maximum amount for a single stack increment operation. Large
22983 values can increase the speed of programs that contain functions
22984 that need a large amount of stack space, but they can also trigger a
22985 segmentation fault if the stack is extended too much. The default
22986 value is 0x1000.
22987
22988 @end table
22989
22990 @node MeP Options
22991 @subsection MeP Options
22992 @cindex MeP options
22993
22994 @table @gcctabopt
22995
22996 @item -mabsdiff
22997 @opindex mabsdiff
22998 Enables the @code{abs} instruction, which is the absolute difference
22999 between two registers.
23000
23001 @item -mall-opts
23002 @opindex mall-opts
23003 Enables all the optional instructions---average, multiply, divide, bit
23004 operations, leading zero, absolute difference, min/max, clip, and
23005 saturation.
23006
23007
23008 @item -maverage
23009 @opindex maverage
23010 Enables the @code{ave} instruction, which computes the average of two
23011 registers.
23012
23013 @item -mbased=@var{n}
23014 @opindex mbased=
23015 Variables of size @var{n} bytes or smaller are placed in the
23016 @code{.based} section by default. Based variables use the @code{$tp}
23017 register as a base register, and there is a 128-byte limit to the
23018 @code{.based} section.
23019
23020 @item -mbitops
23021 @opindex mbitops
23022 Enables the bit operation instructions---bit test (@code{btstm}), set
23023 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
23024 test-and-set (@code{tas}).
23025
23026 @item -mc=@var{name}
23027 @opindex mc=
23028 Selects which section constant data is placed in. @var{name} may
23029 be @samp{tiny}, @samp{near}, or @samp{far}.
23030
23031 @item -mclip
23032 @opindex mclip
23033 Enables the @code{clip} instruction. Note that @option{-mclip} is not
23034 useful unless you also provide @option{-mminmax}.
23035
23036 @item -mconfig=@var{name}
23037 @opindex mconfig=
23038 Selects one of the built-in core configurations. Each MeP chip has
23039 one or more modules in it; each module has a core CPU and a variety of
23040 coprocessors, optional instructions, and peripherals. The
23041 @code{MeP-Integrator} tool, not part of GCC, provides these
23042 configurations through this option; using this option is the same as
23043 using all the corresponding command-line options. The default
23044 configuration is @samp{default}.
23045
23046 @item -mcop
23047 @opindex mcop
23048 Enables the coprocessor instructions. By default, this is a 32-bit
23049 coprocessor. Note that the coprocessor is normally enabled via the
23050 @option{-mconfig=} option.
23051
23052 @item -mcop32
23053 @opindex mcop32
23054 Enables the 32-bit coprocessor's instructions.
23055
23056 @item -mcop64
23057 @opindex mcop64
23058 Enables the 64-bit coprocessor's instructions.
23059
23060 @item -mivc2
23061 @opindex mivc2
23062 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
23063
23064 @item -mdc
23065 @opindex mdc
23066 Causes constant variables to be placed in the @code{.near} section.
23067
23068 @item -mdiv
23069 @opindex mdiv
23070 Enables the @code{div} and @code{divu} instructions.
23071
23072 @item -meb
23073 @opindex meb
23074 Generate big-endian code.
23075
23076 @item -mel
23077 @opindex mel
23078 Generate little-endian code.
23079
23080 @item -mio-volatile
23081 @opindex mio-volatile
23082 Tells the compiler that any variable marked with the @code{io}
23083 attribute is to be considered volatile.
23084
23085 @item -ml
23086 @opindex ml
23087 Causes variables to be assigned to the @code{.far} section by default.
23088
23089 @item -mleadz
23090 @opindex mleadz
23091 Enables the @code{leadz} (leading zero) instruction.
23092
23093 @item -mm
23094 @opindex mm
23095 Causes variables to be assigned to the @code{.near} section by default.
23096
23097 @item -mminmax
23098 @opindex mminmax
23099 Enables the @code{min} and @code{max} instructions.
23100
23101 @item -mmult
23102 @opindex mmult
23103 Enables the multiplication and multiply-accumulate instructions.
23104
23105 @item -mno-opts
23106 @opindex mno-opts
23107 Disables all the optional instructions enabled by @option{-mall-opts}.
23108
23109 @item -mrepeat
23110 @opindex mrepeat
23111 Enables the @code{repeat} and @code{erepeat} instructions, used for
23112 low-overhead looping.
23113
23114 @item -ms
23115 @opindex ms
23116 Causes all variables to default to the @code{.tiny} section. Note
23117 that there is a 65536-byte limit to this section. Accesses to these
23118 variables use the @code{%gp} base register.
23119
23120 @item -msatur
23121 @opindex msatur
23122 Enables the saturation instructions. Note that the compiler does not
23123 currently generate these itself, but this option is included for
23124 compatibility with other tools, like @code{as}.
23125
23126 @item -msdram
23127 @opindex msdram
23128 Link the SDRAM-based runtime instead of the default ROM-based runtime.
23129
23130 @item -msim
23131 @opindex msim
23132 Link the simulator run-time libraries.
23133
23134 @item -msimnovec
23135 @opindex msimnovec
23136 Link the simulator runtime libraries, excluding built-in support
23137 for reset and exception vectors and tables.
23138
23139 @item -mtf
23140 @opindex mtf
23141 Causes all functions to default to the @code{.far} section. Without
23142 this option, functions default to the @code{.near} section.
23143
23144 @item -mtiny=@var{n}
23145 @opindex mtiny=
23146 Variables that are @var{n} bytes or smaller are allocated to the
23147 @code{.tiny} section. These variables use the @code{$gp} base
23148 register. The default for this option is 4, but note that there's a
23149 65536-byte limit to the @code{.tiny} section.
23150
23151 @end table
23152
23153 @node MicroBlaze Options
23154 @subsection MicroBlaze Options
23155 @cindex MicroBlaze Options
23156
23157 @table @gcctabopt
23158
23159 @item -msoft-float
23160 @opindex msoft-float
23161 Use software emulation for floating point (default).
23162
23163 @item -mhard-float
23164 @opindex mhard-float
23165 Use hardware floating-point instructions.
23166
23167 @item -mmemcpy
23168 @opindex mmemcpy
23169 Do not optimize block moves, use @code{memcpy}.
23170
23171 @item -mno-clearbss
23172 @opindex mno-clearbss
23173 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
23174
23175 @item -mcpu=@var{cpu-type}
23176 @opindex mcpu=
23177 Use features of, and schedule code for, the given CPU.
23178 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
23179 where @var{X} is a major version, @var{YY} is the minor version, and
23180 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
23181 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
23182
23183 @item -mxl-soft-mul
23184 @opindex mxl-soft-mul
23185 Use software multiply emulation (default).
23186
23187 @item -mxl-soft-div
23188 @opindex mxl-soft-div
23189 Use software emulation for divides (default).
23190
23191 @item -mxl-barrel-shift
23192 @opindex mxl-barrel-shift
23193 Use the hardware barrel shifter.
23194
23195 @item -mxl-pattern-compare
23196 @opindex mxl-pattern-compare
23197 Use pattern compare instructions.
23198
23199 @item -msmall-divides
23200 @opindex msmall-divides
23201 Use table lookup optimization for small signed integer divisions.
23202
23203 @item -mxl-stack-check
23204 @opindex mxl-stack-check
23205 This option is deprecated. Use @option{-fstack-check} instead.
23206
23207 @item -mxl-gp-opt
23208 @opindex mxl-gp-opt
23209 Use GP-relative @code{.sdata}/@code{.sbss} sections.
23210
23211 @item -mxl-multiply-high
23212 @opindex mxl-multiply-high
23213 Use multiply high instructions for high part of 32x32 multiply.
23214
23215 @item -mxl-float-convert
23216 @opindex mxl-float-convert
23217 Use hardware floating-point conversion instructions.
23218
23219 @item -mxl-float-sqrt
23220 @opindex mxl-float-sqrt
23221 Use hardware floating-point square root instruction.
23222
23223 @item -mbig-endian
23224 @opindex mbig-endian
23225 Generate code for a big-endian target.
23226
23227 @item -mlittle-endian
23228 @opindex mlittle-endian
23229 Generate code for a little-endian target.
23230
23231 @item -mxl-reorder
23232 @opindex mxl-reorder
23233 Use reorder instructions (swap and byte reversed load/store).
23234
23235 @item -mxl-mode-@var{app-model}
23236 Select application model @var{app-model}. Valid models are
23237 @table @samp
23238 @item executable
23239 normal executable (default), uses startup code @file{crt0.o}.
23240
23241 @item -mpic-data-is-text-relative
23242 @opindex mpic-data-is-text-relative
23243 Assume that the displacement between the text and data segments is fixed
23244 at static link time. This allows data to be referenced by offset from start of
23245 text address instead of GOT since PC-relative addressing is not supported.
23246
23247 @item xmdstub
23248 for use with Xilinx Microprocessor Debugger (XMD) based
23249 software intrusive debug agent called xmdstub. This uses startup file
23250 @file{crt1.o} and sets the start address of the program to 0x800.
23251
23252 @item bootstrap
23253 for applications that are loaded using a bootloader.
23254 This model uses startup file @file{crt2.o} which does not contain a processor
23255 reset vector handler. This is suitable for transferring control on a
23256 processor reset to the bootloader rather than the application.
23257
23258 @item novectors
23259 for applications that do not require any of the
23260 MicroBlaze vectors. This option may be useful for applications running
23261 within a monitoring application. This model uses @file{crt3.o} as a startup file.
23262 @end table
23263
23264 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
23265 @option{-mxl-mode-@var{app-model}}.
23266
23267 @end table
23268
23269 @node MIPS Options
23270 @subsection MIPS Options
23271 @cindex MIPS options
23272
23273 @table @gcctabopt
23274
23275 @item -EB
23276 @opindex EB
23277 Generate big-endian code.
23278
23279 @item -EL
23280 @opindex EL
23281 Generate little-endian code. This is the default for @samp{mips*el-*-*}
23282 configurations.
23283
23284 @item -march=@var{arch}
23285 @opindex march
23286 Generate code that runs on @var{arch}, which can be the name of a
23287 generic MIPS ISA, or the name of a particular processor.
23288 The ISA names are:
23289 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
23290 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
23291 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
23292 @samp{mips64r5} and @samp{mips64r6}.
23293 The processor names are:
23294 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
23295 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
23296 @samp{5kc}, @samp{5kf},
23297 @samp{20kc},
23298 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
23299 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
23300 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
23301 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
23302 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
23303 @samp{i6400}, @samp{i6500},
23304 @samp{interaptiv},
23305 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
23306 @samp{gs464e}, @samp{gs264e},
23307 @samp{m4k},
23308 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
23309 @samp{m5100}, @samp{m5101},
23310 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
23311 @samp{orion},
23312 @samp{p5600}, @samp{p6600},
23313 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
23314 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
23315 @samp{r6000}, @samp{r8000},
23316 @samp{rm7000}, @samp{rm9000},
23317 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
23318 @samp{sb1},
23319 @samp{sr71000},
23320 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
23321 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
23322 @samp{xlr} and @samp{xlp}.
23323 The special value @samp{from-abi} selects the
23324 most compatible architecture for the selected ABI (that is,
23325 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
23326
23327 The native Linux/GNU toolchain also supports the value @samp{native},
23328 which selects the best architecture option for the host processor.
23329 @option{-march=native} has no effect if GCC does not recognize
23330 the processor.
23331
23332 In processor names, a final @samp{000} can be abbreviated as @samp{k}
23333 (for example, @option{-march=r2k}). Prefixes are optional, and
23334 @samp{vr} may be written @samp{r}.
23335
23336 Names of the form @samp{@var{n}f2_1} refer to processors with
23337 FPUs clocked at half the rate of the core, names of the form
23338 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
23339 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
23340 processors with FPUs clocked a ratio of 3:2 with respect to the core.
23341 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
23342 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
23343 accepted as synonyms for @samp{@var{n}f1_1}.
23344
23345 GCC defines two macros based on the value of this option. The first
23346 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
23347 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
23348 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
23349 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
23350 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
23351
23352 Note that the @code{_MIPS_ARCH} macro uses the processor names given
23353 above. In other words, it has the full prefix and does not
23354 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
23355 the macro names the resolved architecture (either @code{"mips1"} or
23356 @code{"mips3"}). It names the default architecture when no
23357 @option{-march} option is given.
23358
23359 @item -mtune=@var{arch}
23360 @opindex mtune
23361 Optimize for @var{arch}. Among other things, this option controls
23362 the way instructions are scheduled, and the perceived cost of arithmetic
23363 operations. The list of @var{arch} values is the same as for
23364 @option{-march}.
23365
23366 When this option is not used, GCC optimizes for the processor
23367 specified by @option{-march}. By using @option{-march} and
23368 @option{-mtune} together, it is possible to generate code that
23369 runs on a family of processors, but optimize the code for one
23370 particular member of that family.
23371
23372 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
23373 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
23374 @option{-march} ones described above.
23375
23376 @item -mips1
23377 @opindex mips1
23378 Equivalent to @option{-march=mips1}.
23379
23380 @item -mips2
23381 @opindex mips2
23382 Equivalent to @option{-march=mips2}.
23383
23384 @item -mips3
23385 @opindex mips3
23386 Equivalent to @option{-march=mips3}.
23387
23388 @item -mips4
23389 @opindex mips4
23390 Equivalent to @option{-march=mips4}.
23391
23392 @item -mips32
23393 @opindex mips32
23394 Equivalent to @option{-march=mips32}.
23395
23396 @item -mips32r3
23397 @opindex mips32r3
23398 Equivalent to @option{-march=mips32r3}.
23399
23400 @item -mips32r5
23401 @opindex mips32r5
23402 Equivalent to @option{-march=mips32r5}.
23403
23404 @item -mips32r6
23405 @opindex mips32r6
23406 Equivalent to @option{-march=mips32r6}.
23407
23408 @item -mips64
23409 @opindex mips64
23410 Equivalent to @option{-march=mips64}.
23411
23412 @item -mips64r2
23413 @opindex mips64r2
23414 Equivalent to @option{-march=mips64r2}.
23415
23416 @item -mips64r3
23417 @opindex mips64r3
23418 Equivalent to @option{-march=mips64r3}.
23419
23420 @item -mips64r5
23421 @opindex mips64r5
23422 Equivalent to @option{-march=mips64r5}.
23423
23424 @item -mips64r6
23425 @opindex mips64r6
23426 Equivalent to @option{-march=mips64r6}.
23427
23428 @item -mips16
23429 @itemx -mno-mips16
23430 @opindex mips16
23431 @opindex mno-mips16
23432 Generate (do not generate) MIPS16 code. If GCC is targeting a
23433 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
23434
23435 MIPS16 code generation can also be controlled on a per-function basis
23436 by means of @code{mips16} and @code{nomips16} attributes.
23437 @xref{Function Attributes}, for more information.
23438
23439 @item -mflip-mips16
23440 @opindex mflip-mips16
23441 Generate MIPS16 code on alternating functions. This option is provided
23442 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
23443 not intended for ordinary use in compiling user code.
23444
23445 @item -minterlink-compressed
23446 @itemx -mno-interlink-compressed
23447 @opindex minterlink-compressed
23448 @opindex mno-interlink-compressed
23449 Require (do not require) that code using the standard (uncompressed) MIPS ISA
23450 be link-compatible with MIPS16 and microMIPS code, and vice versa.
23451
23452 For example, code using the standard ISA encoding cannot jump directly
23453 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
23454 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
23455 knows that the target of the jump is not compressed.
23456
23457 @item -minterlink-mips16
23458 @itemx -mno-interlink-mips16
23459 @opindex minterlink-mips16
23460 @opindex mno-interlink-mips16
23461 Aliases of @option{-minterlink-compressed} and
23462 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
23463 and are retained for backwards compatibility.
23464
23465 @item -mabi=32
23466 @itemx -mabi=o64
23467 @itemx -mabi=n32
23468 @itemx -mabi=64
23469 @itemx -mabi=eabi
23470 @opindex mabi=32
23471 @opindex mabi=o64
23472 @opindex mabi=n32
23473 @opindex mabi=64
23474 @opindex mabi=eabi
23475 Generate code for the given ABI@.
23476
23477 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23478 generates 64-bit code when you select a 64-bit architecture, but you
23479 can use @option{-mgp32} to get 32-bit code instead.
23480
23481 For information about the O64 ABI, see
23482 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23483
23484 GCC supports a variant of the o32 ABI in which floating-point registers
23485 are 64 rather than 32 bits wide. You can select this combination with
23486 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
23487 and @code{mfhc1} instructions and is therefore only supported for
23488 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23489
23490 The register assignments for arguments and return values remain the
23491 same, but each scalar value is passed in a single 64-bit register
23492 rather than a pair of 32-bit registers. For example, scalar
23493 floating-point values are returned in @samp{$f0} only, not a
23494 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
23495 remains the same in that the even-numbered double-precision registers
23496 are saved.
23497
23498 Two additional variants of the o32 ABI are supported to enable
23499 a transition from 32-bit to 64-bit registers. These are FPXX
23500 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23501 The FPXX extension mandates that all code must execute correctly
23502 when run using 32-bit or 64-bit registers. The code can be interlinked
23503 with either FP32 or FP64, but not both.
23504 The FP64A extension is similar to the FP64 extension but forbids the
23505 use of odd-numbered single-precision registers. This can be used
23506 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23507 processors and allows both FP32 and FP64A code to interlink and
23508 run in the same process without changing FPU modes.
23509
23510 @item -mabicalls
23511 @itemx -mno-abicalls
23512 @opindex mabicalls
23513 @opindex mno-abicalls
23514 Generate (do not generate) code that is suitable for SVR4-style
23515 dynamic objects. @option{-mabicalls} is the default for SVR4-based
23516 systems.
23517
23518 @item -mshared
23519 @itemx -mno-shared
23520 Generate (do not generate) code that is fully position-independent,
23521 and that can therefore be linked into shared libraries. This option
23522 only affects @option{-mabicalls}.
23523
23524 All @option{-mabicalls} code has traditionally been position-independent,
23525 regardless of options like @option{-fPIC} and @option{-fpic}. However,
23526 as an extension, the GNU toolchain allows executables to use absolute
23527 accesses for locally-binding symbols. It can also use shorter GP
23528 initialization sequences and generate direct calls to locally-defined
23529 functions. This mode is selected by @option{-mno-shared}.
23530
23531 @option{-mno-shared} depends on binutils 2.16 or higher and generates
23532 objects that can only be linked by the GNU linker. However, the option
23533 does not affect the ABI of the final executable; it only affects the ABI
23534 of relocatable objects. Using @option{-mno-shared} generally makes
23535 executables both smaller and quicker.
23536
23537 @option{-mshared} is the default.
23538
23539 @item -mplt
23540 @itemx -mno-plt
23541 @opindex mplt
23542 @opindex mno-plt
23543 Assume (do not assume) that the static and dynamic linkers
23544 support PLTs and copy relocations. This option only affects
23545 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
23546 has no effect without @option{-msym32}.
23547
23548 You can make @option{-mplt} the default by configuring
23549 GCC with @option{--with-mips-plt}. The default is
23550 @option{-mno-plt} otherwise.
23551
23552 @item -mxgot
23553 @itemx -mno-xgot
23554 @opindex mxgot
23555 @opindex mno-xgot
23556 Lift (do not lift) the usual restrictions on the size of the global
23557 offset table.
23558
23559 GCC normally uses a single instruction to load values from the GOT@.
23560 While this is relatively efficient, it only works if the GOT
23561 is smaller than about 64k. Anything larger causes the linker
23562 to report an error such as:
23563
23564 @cindex relocation truncated to fit (MIPS)
23565 @smallexample
23566 relocation truncated to fit: R_MIPS_GOT16 foobar
23567 @end smallexample
23568
23569 If this happens, you should recompile your code with @option{-mxgot}.
23570 This works with very large GOTs, although the code is also
23571 less efficient, since it takes three instructions to fetch the
23572 value of a global symbol.
23573
23574 Note that some linkers can create multiple GOTs. If you have such a
23575 linker, you should only need to use @option{-mxgot} when a single object
23576 file accesses more than 64k's worth of GOT entries. Very few do.
23577
23578 These options have no effect unless GCC is generating position
23579 independent code.
23580
23581 @item -mgp32
23582 @opindex mgp32
23583 Assume that general-purpose registers are 32 bits wide.
23584
23585 @item -mgp64
23586 @opindex mgp64
23587 Assume that general-purpose registers are 64 bits wide.
23588
23589 @item -mfp32
23590 @opindex mfp32
23591 Assume that floating-point registers are 32 bits wide.
23592
23593 @item -mfp64
23594 @opindex mfp64
23595 Assume that floating-point registers are 64 bits wide.
23596
23597 @item -mfpxx
23598 @opindex mfpxx
23599 Do not assume the width of floating-point registers.
23600
23601 @item -mhard-float
23602 @opindex mhard-float
23603 Use floating-point coprocessor instructions.
23604
23605 @item -msoft-float
23606 @opindex msoft-float
23607 Do not use floating-point coprocessor instructions. Implement
23608 floating-point calculations using library calls instead.
23609
23610 @item -mno-float
23611 @opindex mno-float
23612 Equivalent to @option{-msoft-float}, but additionally asserts that the
23613 program being compiled does not perform any floating-point operations.
23614 This option is presently supported only by some bare-metal MIPS
23615 configurations, where it may select a special set of libraries
23616 that lack all floating-point support (including, for example, the
23617 floating-point @code{printf} formats).
23618 If code compiled with @option{-mno-float} accidentally contains
23619 floating-point operations, it is likely to suffer a link-time
23620 or run-time failure.
23621
23622 @item -msingle-float
23623 @opindex msingle-float
23624 Assume that the floating-point coprocessor only supports single-precision
23625 operations.
23626
23627 @item -mdouble-float
23628 @opindex mdouble-float
23629 Assume that the floating-point coprocessor supports double-precision
23630 operations. This is the default.
23631
23632 @item -modd-spreg
23633 @itemx -mno-odd-spreg
23634 @opindex modd-spreg
23635 @opindex mno-odd-spreg
23636 Enable the use of odd-numbered single-precision floating-point registers
23637 for the o32 ABI. This is the default for processors that are known to
23638 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23639 is set by default.
23640
23641 @item -mabs=2008
23642 @itemx -mabs=legacy
23643 @opindex mabs=2008
23644 @opindex mabs=legacy
23645 These options control the treatment of the special not-a-number (NaN)
23646 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23647 @code{neg.@i{fmt}} machine instructions.
23648
23649 By default or when @option{-mabs=legacy} is used the legacy
23650 treatment is selected. In this case these instructions are considered
23651 arithmetic and avoided where correct operation is required and the
23652 input operand might be a NaN. A longer sequence of instructions that
23653 manipulate the sign bit of floating-point datum manually is used
23654 instead unless the @option{-ffinite-math-only} option has also been
23655 specified.
23656
23657 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
23658 this case these instructions are considered non-arithmetic and therefore
23659 operating correctly in all cases, including in particular where the
23660 input operand is a NaN. These instructions are therefore always used
23661 for the respective operations.
23662
23663 @item -mnan=2008
23664 @itemx -mnan=legacy
23665 @opindex mnan=2008
23666 @opindex mnan=legacy
23667 These options control the encoding of the special not-a-number (NaN)
23668 IEEE 754 floating-point data.
23669
23670 The @option{-mnan=legacy} option selects the legacy encoding. In this
23671 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23672 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23673 by the first bit of their trailing significand field being 1.
23674
23675 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
23676 this case qNaNs are denoted by the first bit of their trailing
23677 significand field being 1, whereas sNaNs are denoted by the first bit of
23678 their trailing significand field being 0.
23679
23680 The default is @option{-mnan=legacy} unless GCC has been configured with
23681 @option{--with-nan=2008}.
23682
23683 @item -mllsc
23684 @itemx -mno-llsc
23685 @opindex mllsc
23686 @opindex mno-llsc
23687 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23688 implement atomic memory built-in functions. When neither option is
23689 specified, GCC uses the instructions if the target architecture
23690 supports them.
23691
23692 @option{-mllsc} is useful if the runtime environment can emulate the
23693 instructions and @option{-mno-llsc} can be useful when compiling for
23694 nonstandard ISAs. You can make either option the default by
23695 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23696 respectively. @option{--with-llsc} is the default for some
23697 configurations; see the installation documentation for details.
23698
23699 @item -mdsp
23700 @itemx -mno-dsp
23701 @opindex mdsp
23702 @opindex mno-dsp
23703 Use (do not use) revision 1 of the MIPS DSP ASE@.
23704 @xref{MIPS DSP Built-in Functions}. This option defines the
23705 preprocessor macro @code{__mips_dsp}. It also defines
23706 @code{__mips_dsp_rev} to 1.
23707
23708 @item -mdspr2
23709 @itemx -mno-dspr2
23710 @opindex mdspr2
23711 @opindex mno-dspr2
23712 Use (do not use) revision 2 of the MIPS DSP ASE@.
23713 @xref{MIPS DSP Built-in Functions}. This option defines the
23714 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23715 It also defines @code{__mips_dsp_rev} to 2.
23716
23717 @item -msmartmips
23718 @itemx -mno-smartmips
23719 @opindex msmartmips
23720 @opindex mno-smartmips
23721 Use (do not use) the MIPS SmartMIPS ASE.
23722
23723 @item -mpaired-single
23724 @itemx -mno-paired-single
23725 @opindex mpaired-single
23726 @opindex mno-paired-single
23727 Use (do not use) paired-single floating-point instructions.
23728 @xref{MIPS Paired-Single Support}. This option requires
23729 hardware floating-point support to be enabled.
23730
23731 @item -mdmx
23732 @itemx -mno-mdmx
23733 @opindex mdmx
23734 @opindex mno-mdmx
23735 Use (do not use) MIPS Digital Media Extension instructions.
23736 This option can only be used when generating 64-bit code and requires
23737 hardware floating-point support to be enabled.
23738
23739 @item -mips3d
23740 @itemx -mno-mips3d
23741 @opindex mips3d
23742 @opindex mno-mips3d
23743 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
23744 The option @option{-mips3d} implies @option{-mpaired-single}.
23745
23746 @item -mmicromips
23747 @itemx -mno-micromips
23748 @opindex mmicromips
23749 @opindex mno-mmicromips
23750 Generate (do not generate) microMIPS code.
23751
23752 MicroMIPS code generation can also be controlled on a per-function basis
23753 by means of @code{micromips} and @code{nomicromips} attributes.
23754 @xref{Function Attributes}, for more information.
23755
23756 @item -mmt
23757 @itemx -mno-mt
23758 @opindex mmt
23759 @opindex mno-mt
23760 Use (do not use) MT Multithreading instructions.
23761
23762 @item -mmcu
23763 @itemx -mno-mcu
23764 @opindex mmcu
23765 @opindex mno-mcu
23766 Use (do not use) the MIPS MCU ASE instructions.
23767
23768 @item -meva
23769 @itemx -mno-eva
23770 @opindex meva
23771 @opindex mno-eva
23772 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23773
23774 @item -mvirt
23775 @itemx -mno-virt
23776 @opindex mvirt
23777 @opindex mno-virt
23778 Use (do not use) the MIPS Virtualization (VZ) instructions.
23779
23780 @item -mxpa
23781 @itemx -mno-xpa
23782 @opindex mxpa
23783 @opindex mno-xpa
23784 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23785
23786 @item -mcrc
23787 @itemx -mno-crc
23788 @opindex mcrc
23789 @opindex mno-crc
23790 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23791
23792 @item -mginv
23793 @itemx -mno-ginv
23794 @opindex mginv
23795 @opindex mno-ginv
23796 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23797
23798 @item -mloongson-mmi
23799 @itemx -mno-loongson-mmi
23800 @opindex mloongson-mmi
23801 @opindex mno-loongson-mmi
23802 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23803
23804 @item -mloongson-ext
23805 @itemx -mno-loongson-ext
23806 @opindex mloongson-ext
23807 @opindex mno-loongson-ext
23808 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23809
23810 @item -mloongson-ext2
23811 @itemx -mno-loongson-ext2
23812 @opindex mloongson-ext2
23813 @opindex mno-loongson-ext2
23814 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23815
23816 @item -mlong64
23817 @opindex mlong64
23818 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
23819 an explanation of the default and the way that the pointer size is
23820 determined.
23821
23822 @item -mlong32
23823 @opindex mlong32
23824 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23825
23826 The default size of @code{int}s, @code{long}s and pointers depends on
23827 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
23828 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
23829 32-bit @code{long}s. Pointers are the same size as @code{long}s,
23830 or the same size as integer registers, whichever is smaller.
23831
23832 @item -msym32
23833 @itemx -mno-sym32
23834 @opindex msym32
23835 @opindex mno-sym32
23836 Assume (do not assume) that all symbols have 32-bit values, regardless
23837 of the selected ABI@. This option is useful in combination with
23838 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23839 to generate shorter and faster references to symbolic addresses.
23840
23841 @item -G @var{num}
23842 @opindex G
23843 Put definitions of externally-visible data in a small data section
23844 if that data is no bigger than @var{num} bytes. GCC can then generate
23845 more efficient accesses to the data; see @option{-mgpopt} for details.
23846
23847 The default @option{-G} option depends on the configuration.
23848
23849 @item -mlocal-sdata
23850 @itemx -mno-local-sdata
23851 @opindex mlocal-sdata
23852 @opindex mno-local-sdata
23853 Extend (do not extend) the @option{-G} behavior to local data too,
23854 such as to static variables in C@. @option{-mlocal-sdata} is the
23855 default for all configurations.
23856
23857 If the linker complains that an application is using too much small data,
23858 you might want to try rebuilding the less performance-critical parts with
23859 @option{-mno-local-sdata}. You might also want to build large
23860 libraries with @option{-mno-local-sdata}, so that the libraries leave
23861 more room for the main program.
23862
23863 @item -mextern-sdata
23864 @itemx -mno-extern-sdata
23865 @opindex mextern-sdata
23866 @opindex mno-extern-sdata
23867 Assume (do not assume) that externally-defined data is in
23868 a small data section if the size of that data is within the @option{-G} limit.
23869 @option{-mextern-sdata} is the default for all configurations.
23870
23871 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
23872 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
23873 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
23874 is placed in a small data section. If @var{Var} is defined by another
23875 module, you must either compile that module with a high-enough
23876 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
23877 definition. If @var{Var} is common, you must link the application
23878 with a high-enough @option{-G} setting.
23879
23880 The easiest way of satisfying these restrictions is to compile
23881 and link every module with the same @option{-G} option. However,
23882 you may wish to build a library that supports several different
23883 small data limits. You can do this by compiling the library with
23884 the highest supported @option{-G} setting and additionally using
23885 @option{-mno-extern-sdata} to stop the library from making assumptions
23886 about externally-defined data.
23887
23888 @item -mgpopt
23889 @itemx -mno-gpopt
23890 @opindex mgpopt
23891 @opindex mno-gpopt
23892 Use (do not use) GP-relative accesses for symbols that are known to be
23893 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
23894 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
23895 configurations.
23896
23897 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
23898 might not hold the value of @code{_gp}. For example, if the code is
23899 part of a library that might be used in a boot monitor, programs that
23900 call boot monitor routines pass an unknown value in @code{$gp}.
23901 (In such situations, the boot monitor itself is usually compiled
23902 with @option{-G0}.)
23903
23904 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
23905 @option{-mno-extern-sdata}.
23906
23907 @item -membedded-data
23908 @itemx -mno-embedded-data
23909 @opindex membedded-data
23910 @opindex mno-embedded-data
23911 Allocate variables to the read-only data section first if possible, then
23912 next in the small data section if possible, otherwise in data. This gives
23913 slightly slower code than the default, but reduces the amount of RAM required
23914 when executing, and thus may be preferred for some embedded systems.
23915
23916 @item -muninit-const-in-rodata
23917 @itemx -mno-uninit-const-in-rodata
23918 @opindex muninit-const-in-rodata
23919 @opindex mno-uninit-const-in-rodata
23920 Put uninitialized @code{const} variables in the read-only data section.
23921 This option is only meaningful in conjunction with @option{-membedded-data}.
23922
23923 @item -mcode-readable=@var{setting}
23924 @opindex mcode-readable
23925 Specify whether GCC may generate code that reads from executable sections.
23926 There are three possible settings:
23927
23928 @table @gcctabopt
23929 @item -mcode-readable=yes
23930 Instructions may freely access executable sections. This is the
23931 default setting.
23932
23933 @item -mcode-readable=pcrel
23934 MIPS16 PC-relative load instructions can access executable sections,
23935 but other instructions must not do so. This option is useful on 4KSc
23936 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
23937 It is also useful on processors that can be configured to have a dual
23938 instruction/data SRAM interface and that, like the M4K, automatically
23939 redirect PC-relative loads to the instruction RAM.
23940
23941 @item -mcode-readable=no
23942 Instructions must not access executable sections. This option can be
23943 useful on targets that are configured to have a dual instruction/data
23944 SRAM interface but that (unlike the M4K) do not automatically redirect
23945 PC-relative loads to the instruction RAM.
23946 @end table
23947
23948 @item -msplit-addresses
23949 @itemx -mno-split-addresses
23950 @opindex msplit-addresses
23951 @opindex mno-split-addresses
23952 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
23953 relocation operators. This option has been superseded by
23954 @option{-mexplicit-relocs} but is retained for backwards compatibility.
23955
23956 @item -mexplicit-relocs
23957 @itemx -mno-explicit-relocs
23958 @opindex mexplicit-relocs
23959 @opindex mno-explicit-relocs
23960 Use (do not use) assembler relocation operators when dealing with symbolic
23961 addresses. The alternative, selected by @option{-mno-explicit-relocs},
23962 is to use assembler macros instead.
23963
23964 @option{-mexplicit-relocs} is the default if GCC was configured
23965 to use an assembler that supports relocation operators.
23966
23967 @item -mcheck-zero-division
23968 @itemx -mno-check-zero-division
23969 @opindex mcheck-zero-division
23970 @opindex mno-check-zero-division
23971 Trap (do not trap) on integer division by zero.
23972
23973 The default is @option{-mcheck-zero-division}.
23974
23975 @item -mdivide-traps
23976 @itemx -mdivide-breaks
23977 @opindex mdivide-traps
23978 @opindex mdivide-breaks
23979 MIPS systems check for division by zero by generating either a
23980 conditional trap or a break instruction. Using traps results in
23981 smaller code, but is only supported on MIPS II and later. Also, some
23982 versions of the Linux kernel have a bug that prevents trap from
23983 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
23984 allow conditional traps on architectures that support them and
23985 @option{-mdivide-breaks} to force the use of breaks.
23986
23987 The default is usually @option{-mdivide-traps}, but this can be
23988 overridden at configure time using @option{--with-divide=breaks}.
23989 Divide-by-zero checks can be completely disabled using
23990 @option{-mno-check-zero-division}.
23991
23992 @item -mload-store-pairs
23993 @itemx -mno-load-store-pairs
23994 @opindex mload-store-pairs
23995 @opindex mno-load-store-pairs
23996 Enable (disable) an optimization that pairs consecutive load or store
23997 instructions to enable load/store bonding. This option is enabled by
23998 default but only takes effect when the selected architecture is known
23999 to support bonding.
24000
24001 @item -mmemcpy
24002 @itemx -mno-memcpy
24003 @opindex mmemcpy
24004 @opindex mno-memcpy
24005 Force (do not force) the use of @code{memcpy} for non-trivial block
24006 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
24007 most constant-sized copies.
24008
24009 @item -mlong-calls
24010 @itemx -mno-long-calls
24011 @opindex mlong-calls
24012 @opindex mno-long-calls
24013 Disable (do not disable) use of the @code{jal} instruction. Calling
24014 functions using @code{jal} is more efficient but requires the caller
24015 and callee to be in the same 256 megabyte segment.
24016
24017 This option has no effect on abicalls code. The default is
24018 @option{-mno-long-calls}.
24019
24020 @item -mmad
24021 @itemx -mno-mad
24022 @opindex mmad
24023 @opindex mno-mad
24024 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
24025 instructions, as provided by the R4650 ISA@.
24026
24027 @item -mimadd
24028 @itemx -mno-imadd
24029 @opindex mimadd
24030 @opindex mno-imadd
24031 Enable (disable) use of the @code{madd} and @code{msub} integer
24032 instructions. The default is @option{-mimadd} on architectures
24033 that support @code{madd} and @code{msub} except for the 74k
24034 architecture where it was found to generate slower code.
24035
24036 @item -mfused-madd
24037 @itemx -mno-fused-madd
24038 @opindex mfused-madd
24039 @opindex mno-fused-madd
24040 Enable (disable) use of the floating-point multiply-accumulate
24041 instructions, when they are available. The default is
24042 @option{-mfused-madd}.
24043
24044 On the R8000 CPU when multiply-accumulate instructions are used,
24045 the intermediate product is calculated to infinite precision
24046 and is not subject to the FCSR Flush to Zero bit. This may be
24047 undesirable in some circumstances. On other processors the result
24048 is numerically identical to the equivalent computation using
24049 separate multiply, add, subtract and negate instructions.
24050
24051 @item -nocpp
24052 @opindex nocpp
24053 Tell the MIPS assembler to not run its preprocessor over user
24054 assembler files (with a @samp{.s} suffix) when assembling them.
24055
24056 @item -mfix-24k
24057 @itemx -mno-fix-24k
24058 @opindex mfix-24k
24059 @opindex mno-fix-24k
24060 Work around the 24K E48 (lost data on stores during refill) errata.
24061 The workarounds are implemented by the assembler rather than by GCC@.
24062
24063 @item -mfix-r4000
24064 @itemx -mno-fix-r4000
24065 @opindex mfix-r4000
24066 @opindex mno-fix-r4000
24067 Work around certain R4000 CPU errata:
24068 @itemize @minus
24069 @item
24070 A double-word or a variable shift may give an incorrect result if executed
24071 immediately after starting an integer division.
24072 @item
24073 A double-word or a variable shift may give an incorrect result if executed
24074 while an integer multiplication is in progress.
24075 @item
24076 An integer division may give an incorrect result if started in a delay slot
24077 of a taken branch or a jump.
24078 @end itemize
24079
24080 @item -mfix-r4400
24081 @itemx -mno-fix-r4400
24082 @opindex mfix-r4400
24083 @opindex mno-fix-r4400
24084 Work around certain R4400 CPU errata:
24085 @itemize @minus
24086 @item
24087 A double-word or a variable shift may give an incorrect result if executed
24088 immediately after starting an integer division.
24089 @end itemize
24090
24091 @item -mfix-r10000
24092 @itemx -mno-fix-r10000
24093 @opindex mfix-r10000
24094 @opindex mno-fix-r10000
24095 Work around certain R10000 errata:
24096 @itemize @minus
24097 @item
24098 @code{ll}/@code{sc} sequences may not behave atomically on revisions
24099 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
24100 @end itemize
24101
24102 This option can only be used if the target architecture supports
24103 branch-likely instructions. @option{-mfix-r10000} is the default when
24104 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
24105 otherwise.
24106
24107 @item -mfix-r5900
24108 @itemx -mno-fix-r5900
24109 @opindex mfix-r5900
24110 Do not attempt to schedule the preceding instruction into the delay slot
24111 of a branch instruction placed at the end of a short loop of six
24112 instructions or fewer and always schedule a @code{nop} instruction there
24113 instead. The short loop bug under certain conditions causes loops to
24114 execute only once or twice, due to a hardware bug in the R5900 chip. The
24115 workaround is implemented by the assembler rather than by GCC@.
24116
24117 @item -mfix-rm7000
24118 @itemx -mno-fix-rm7000
24119 @opindex mfix-rm7000
24120 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
24121 workarounds are implemented by the assembler rather than by GCC@.
24122
24123 @item -mfix-vr4120
24124 @itemx -mno-fix-vr4120
24125 @opindex mfix-vr4120
24126 Work around certain VR4120 errata:
24127 @itemize @minus
24128 @item
24129 @code{dmultu} does not always produce the correct result.
24130 @item
24131 @code{div} and @code{ddiv} do not always produce the correct result if one
24132 of the operands is negative.
24133 @end itemize
24134 The workarounds for the division errata rely on special functions in
24135 @file{libgcc.a}. At present, these functions are only provided by
24136 the @code{mips64vr*-elf} configurations.
24137
24138 Other VR4120 errata require a NOP to be inserted between certain pairs of
24139 instructions. These errata are handled by the assembler, not by GCC itself.
24140
24141 @item -mfix-vr4130
24142 @opindex mfix-vr4130
24143 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
24144 workarounds are implemented by the assembler rather than by GCC,
24145 although GCC avoids using @code{mflo} and @code{mfhi} if the
24146 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
24147 instructions are available instead.
24148
24149 @item -mfix-sb1
24150 @itemx -mno-fix-sb1
24151 @opindex mfix-sb1
24152 Work around certain SB-1 CPU core errata.
24153 (This flag currently works around the SB-1 revision 2
24154 ``F1'' and ``F2'' floating-point errata.)
24155
24156 @item -mr10k-cache-barrier=@var{setting}
24157 @opindex mr10k-cache-barrier
24158 Specify whether GCC should insert cache barriers to avoid the
24159 side effects of speculation on R10K processors.
24160
24161 In common with many processors, the R10K tries to predict the outcome
24162 of a conditional branch and speculatively executes instructions from
24163 the ``taken'' branch. It later aborts these instructions if the
24164 predicted outcome is wrong. However, on the R10K, even aborted
24165 instructions can have side effects.
24166
24167 This problem only affects kernel stores and, depending on the system,
24168 kernel loads. As an example, a speculatively-executed store may load
24169 the target memory into cache and mark the cache line as dirty, even if
24170 the store itself is later aborted. If a DMA operation writes to the
24171 same area of memory before the ``dirty'' line is flushed, the cached
24172 data overwrites the DMA-ed data. See the R10K processor manual
24173 for a full description, including other potential problems.
24174
24175 One workaround is to insert cache barrier instructions before every memory
24176 access that might be speculatively executed and that might have side
24177 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
24178 controls GCC's implementation of this workaround. It assumes that
24179 aborted accesses to any byte in the following regions does not have
24180 side effects:
24181
24182 @enumerate
24183 @item
24184 the memory occupied by the current function's stack frame;
24185
24186 @item
24187 the memory occupied by an incoming stack argument;
24188
24189 @item
24190 the memory occupied by an object with a link-time-constant address.
24191 @end enumerate
24192
24193 It is the kernel's responsibility to ensure that speculative
24194 accesses to these regions are indeed safe.
24195
24196 If the input program contains a function declaration such as:
24197
24198 @smallexample
24199 void foo (void);
24200 @end smallexample
24201
24202 then the implementation of @code{foo} must allow @code{j foo} and
24203 @code{jal foo} to be executed speculatively. GCC honors this
24204 restriction for functions it compiles itself. It expects non-GCC
24205 functions (such as hand-written assembly code) to do the same.
24206
24207 The option has three forms:
24208
24209 @table @gcctabopt
24210 @item -mr10k-cache-barrier=load-store
24211 Insert a cache barrier before a load or store that might be
24212 speculatively executed and that might have side effects even
24213 if aborted.
24214
24215 @item -mr10k-cache-barrier=store
24216 Insert a cache barrier before a store that might be speculatively
24217 executed and that might have side effects even if aborted.
24218
24219 @item -mr10k-cache-barrier=none
24220 Disable the insertion of cache barriers. This is the default setting.
24221 @end table
24222
24223 @item -mflush-func=@var{func}
24224 @itemx -mno-flush-func
24225 @opindex mflush-func
24226 Specifies the function to call to flush the I and D caches, or to not
24227 call any such function. If called, the function must take the same
24228 arguments as the common @code{_flush_func}, that is, the address of the
24229 memory range for which the cache is being flushed, the size of the
24230 memory range, and the number 3 (to flush both caches). The default
24231 depends on the target GCC was configured for, but commonly is either
24232 @code{_flush_func} or @code{__cpu_flush}.
24233
24234 @item mbranch-cost=@var{num}
24235 @opindex mbranch-cost
24236 Set the cost of branches to roughly @var{num} ``simple'' instructions.
24237 This cost is only a heuristic and is not guaranteed to produce
24238 consistent results across releases. A zero cost redundantly selects
24239 the default, which is based on the @option{-mtune} setting.
24240
24241 @item -mbranch-likely
24242 @itemx -mno-branch-likely
24243 @opindex mbranch-likely
24244 @opindex mno-branch-likely
24245 Enable or disable use of Branch Likely instructions, regardless of the
24246 default for the selected architecture. By default, Branch Likely
24247 instructions may be generated if they are supported by the selected
24248 architecture. An exception is for the MIPS32 and MIPS64 architectures
24249 and processors that implement those architectures; for those, Branch
24250 Likely instructions are not be generated by default because the MIPS32
24251 and MIPS64 architectures specifically deprecate their use.
24252
24253 @item -mcompact-branches=never
24254 @itemx -mcompact-branches=optimal
24255 @itemx -mcompact-branches=always
24256 @opindex mcompact-branches=never
24257 @opindex mcompact-branches=optimal
24258 @opindex mcompact-branches=always
24259 These options control which form of branches will be generated. The
24260 default is @option{-mcompact-branches=optimal}.
24261
24262 The @option{-mcompact-branches=never} option ensures that compact branch
24263 instructions will never be generated.
24264
24265 The @option{-mcompact-branches=always} option ensures that a compact
24266 branch instruction will be generated if available. If a compact branch
24267 instruction is not available, a delay slot form of the branch will be
24268 used instead.
24269
24270 This option is supported from MIPS Release 6 onwards.
24271
24272 The @option{-mcompact-branches=optimal} option will cause a delay slot
24273 branch to be used if one is available in the current ISA and the delay
24274 slot is successfully filled. If the delay slot is not filled, a compact
24275 branch will be chosen if one is available.
24276
24277 @item -mfp-exceptions
24278 @itemx -mno-fp-exceptions
24279 @opindex mfp-exceptions
24280 Specifies whether FP exceptions are enabled. This affects how
24281 FP instructions are scheduled for some processors.
24282 The default is that FP exceptions are
24283 enabled.
24284
24285 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
24286 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
24287 FP pipe.
24288
24289 @item -mvr4130-align
24290 @itemx -mno-vr4130-align
24291 @opindex mvr4130-align
24292 The VR4130 pipeline is two-way superscalar, but can only issue two
24293 instructions together if the first one is 8-byte aligned. When this
24294 option is enabled, GCC aligns pairs of instructions that it
24295 thinks should execute in parallel.
24296
24297 This option only has an effect when optimizing for the VR4130.
24298 It normally makes code faster, but at the expense of making it bigger.
24299 It is enabled by default at optimization level @option{-O3}.
24300
24301 @item -msynci
24302 @itemx -mno-synci
24303 @opindex msynci
24304 Enable (disable) generation of @code{synci} instructions on
24305 architectures that support it. The @code{synci} instructions (if
24306 enabled) are generated when @code{__builtin___clear_cache} is
24307 compiled.
24308
24309 This option defaults to @option{-mno-synci}, but the default can be
24310 overridden by configuring GCC with @option{--with-synci}.
24311
24312 When compiling code for single processor systems, it is generally safe
24313 to use @code{synci}. However, on many multi-core (SMP) systems, it
24314 does not invalidate the instruction caches on all cores and may lead
24315 to undefined behavior.
24316
24317 @item -mrelax-pic-calls
24318 @itemx -mno-relax-pic-calls
24319 @opindex mrelax-pic-calls
24320 Try to turn PIC calls that are normally dispatched via register
24321 @code{$25} into direct calls. This is only possible if the linker can
24322 resolve the destination at link time and if the destination is within
24323 range for a direct call.
24324
24325 @option{-mrelax-pic-calls} is the default if GCC was configured to use
24326 an assembler and a linker that support the @code{.reloc} assembly
24327 directive and @option{-mexplicit-relocs} is in effect. With
24328 @option{-mno-explicit-relocs}, this optimization can be performed by the
24329 assembler and the linker alone without help from the compiler.
24330
24331 @item -mmcount-ra-address
24332 @itemx -mno-mcount-ra-address
24333 @opindex mmcount-ra-address
24334 @opindex mno-mcount-ra-address
24335 Emit (do not emit) code that allows @code{_mcount} to modify the
24336 calling function's return address. When enabled, this option extends
24337 the usual @code{_mcount} interface with a new @var{ra-address}
24338 parameter, which has type @code{intptr_t *} and is passed in register
24339 @code{$12}. @code{_mcount} can then modify the return address by
24340 doing both of the following:
24341 @itemize
24342 @item
24343 Returning the new address in register @code{$31}.
24344 @item
24345 Storing the new address in @code{*@var{ra-address}},
24346 if @var{ra-address} is nonnull.
24347 @end itemize
24348
24349 The default is @option{-mno-mcount-ra-address}.
24350
24351 @item -mframe-header-opt
24352 @itemx -mno-frame-header-opt
24353 @opindex mframe-header-opt
24354 Enable (disable) frame header optimization in the o32 ABI. When using the
24355 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
24356 function to write out register arguments. When enabled, this optimization
24357 will suppress the allocation of the frame header if it can be determined that
24358 it is unused.
24359
24360 This optimization is off by default at all optimization levels.
24361
24362 @item -mlxc1-sxc1
24363 @itemx -mno-lxc1-sxc1
24364 @opindex mlxc1-sxc1
24365 When applicable, enable (disable) the generation of @code{lwxc1},
24366 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
24367
24368 @item -mmadd4
24369 @itemx -mno-madd4
24370 @opindex mmadd4
24371 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
24372 @code{madd.d} and related instructions. Enabled by default.
24373
24374 @end table
24375
24376 @node MMIX Options
24377 @subsection MMIX Options
24378 @cindex MMIX Options
24379
24380 These options are defined for the MMIX:
24381
24382 @table @gcctabopt
24383 @item -mlibfuncs
24384 @itemx -mno-libfuncs
24385 @opindex mlibfuncs
24386 @opindex mno-libfuncs
24387 Specify that intrinsic library functions are being compiled, passing all
24388 values in registers, no matter the size.
24389
24390 @item -mepsilon
24391 @itemx -mno-epsilon
24392 @opindex mepsilon
24393 @opindex mno-epsilon
24394 Generate floating-point comparison instructions that compare with respect
24395 to the @code{rE} epsilon register.
24396
24397 @item -mabi=mmixware
24398 @itemx -mabi=gnu
24399 @opindex mabi=mmixware
24400 @opindex mabi=gnu
24401 Generate code that passes function parameters and return values that (in
24402 the called function) are seen as registers @code{$0} and up, as opposed to
24403 the GNU ABI which uses global registers @code{$231} and up.
24404
24405 @item -mzero-extend
24406 @itemx -mno-zero-extend
24407 @opindex mzero-extend
24408 @opindex mno-zero-extend
24409 When reading data from memory in sizes shorter than 64 bits, use (do not
24410 use) zero-extending load instructions by default, rather than
24411 sign-extending ones.
24412
24413 @item -mknuthdiv
24414 @itemx -mno-knuthdiv
24415 @opindex mknuthdiv
24416 @opindex mno-knuthdiv
24417 Make the result of a division yielding a remainder have the same sign as
24418 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
24419 remainder follows the sign of the dividend. Both methods are
24420 arithmetically valid, the latter being almost exclusively used.
24421
24422 @item -mtoplevel-symbols
24423 @itemx -mno-toplevel-symbols
24424 @opindex mtoplevel-symbols
24425 @opindex mno-toplevel-symbols
24426 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
24427 code can be used with the @code{PREFIX} assembly directive.
24428
24429 @item -melf
24430 @opindex melf
24431 Generate an executable in the ELF format, rather than the default
24432 @samp{mmo} format used by the @command{mmix} simulator.
24433
24434 @item -mbranch-predict
24435 @itemx -mno-branch-predict
24436 @opindex mbranch-predict
24437 @opindex mno-branch-predict
24438 Use (do not use) the probable-branch instructions, when static branch
24439 prediction indicates a probable branch.
24440
24441 @item -mbase-addresses
24442 @itemx -mno-base-addresses
24443 @opindex mbase-addresses
24444 @opindex mno-base-addresses
24445 Generate (do not generate) code that uses @emph{base addresses}. Using a
24446 base address automatically generates a request (handled by the assembler
24447 and the linker) for a constant to be set up in a global register. The
24448 register is used for one or more base address requests within the range 0
24449 to 255 from the value held in the register. The generally leads to short
24450 and fast code, but the number of different data items that can be
24451 addressed is limited. This means that a program that uses lots of static
24452 data may require @option{-mno-base-addresses}.
24453
24454 @item -msingle-exit
24455 @itemx -mno-single-exit
24456 @opindex msingle-exit
24457 @opindex mno-single-exit
24458 Force (do not force) generated code to have a single exit point in each
24459 function.
24460 @end table
24461
24462 @node MN10300 Options
24463 @subsection MN10300 Options
24464 @cindex MN10300 options
24465
24466 These @option{-m} options are defined for Matsushita MN10300 architectures:
24467
24468 @table @gcctabopt
24469 @item -mmult-bug
24470 @opindex mmult-bug
24471 Generate code to avoid bugs in the multiply instructions for the MN10300
24472 processors. This is the default.
24473
24474 @item -mno-mult-bug
24475 @opindex mno-mult-bug
24476 Do not generate code to avoid bugs in the multiply instructions for the
24477 MN10300 processors.
24478
24479 @item -mam33
24480 @opindex mam33
24481 Generate code using features specific to the AM33 processor.
24482
24483 @item -mno-am33
24484 @opindex mno-am33
24485 Do not generate code using features specific to the AM33 processor. This
24486 is the default.
24487
24488 @item -mam33-2
24489 @opindex mam33-2
24490 Generate code using features specific to the AM33/2.0 processor.
24491
24492 @item -mam34
24493 @opindex mam34
24494 Generate code using features specific to the AM34 processor.
24495
24496 @item -mtune=@var{cpu-type}
24497 @opindex mtune
24498 Use the timing characteristics of the indicated CPU type when
24499 scheduling instructions. This does not change the targeted processor
24500 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
24501 @samp{am33-2} or @samp{am34}.
24502
24503 @item -mreturn-pointer-on-d0
24504 @opindex mreturn-pointer-on-d0
24505 When generating a function that returns a pointer, return the pointer
24506 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
24507 only in @code{a0}, and attempts to call such functions without a prototype
24508 result in errors. Note that this option is on by default; use
24509 @option{-mno-return-pointer-on-d0} to disable it.
24510
24511 @item -mno-crt0
24512 @opindex mno-crt0
24513 Do not link in the C run-time initialization object file.
24514
24515 @item -mrelax
24516 @opindex mrelax
24517 Indicate to the linker that it should perform a relaxation optimization pass
24518 to shorten branches, calls and absolute memory addresses. This option only
24519 has an effect when used on the command line for the final link step.
24520
24521 This option makes symbolic debugging impossible.
24522
24523 @item -mliw
24524 @opindex mliw
24525 Allow the compiler to generate @emph{Long Instruction Word}
24526 instructions if the target is the @samp{AM33} or later. This is the
24527 default. This option defines the preprocessor macro @code{__LIW__}.
24528
24529 @item -mno-liw
24530 @opindex mno-liw
24531 Do not allow the compiler to generate @emph{Long Instruction Word}
24532 instructions. This option defines the preprocessor macro
24533 @code{__NO_LIW__}.
24534
24535 @item -msetlb
24536 @opindex msetlb
24537 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24538 instructions if the target is the @samp{AM33} or later. This is the
24539 default. This option defines the preprocessor macro @code{__SETLB__}.
24540
24541 @item -mno-setlb
24542 @opindex mno-setlb
24543 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24544 instructions. This option defines the preprocessor macro
24545 @code{__NO_SETLB__}.
24546
24547 @end table
24548
24549 @node Moxie Options
24550 @subsection Moxie Options
24551 @cindex Moxie Options
24552
24553 @table @gcctabopt
24554
24555 @item -meb
24556 @opindex meb
24557 Generate big-endian code. This is the default for @samp{moxie-*-*}
24558 configurations.
24559
24560 @item -mel
24561 @opindex mel
24562 Generate little-endian code.
24563
24564 @item -mmul.x
24565 @opindex mmul.x
24566 Generate mul.x and umul.x instructions. This is the default for
24567 @samp{moxiebox-*-*} configurations.
24568
24569 @item -mno-crt0
24570 @opindex mno-crt0
24571 Do not link in the C run-time initialization object file.
24572
24573 @end table
24574
24575 @node MSP430 Options
24576 @subsection MSP430 Options
24577 @cindex MSP430 Options
24578
24579 These options are defined for the MSP430:
24580
24581 @table @gcctabopt
24582
24583 @item -masm-hex
24584 @opindex masm-hex
24585 Force assembly output to always use hex constants. Normally such
24586 constants are signed decimals, but this option is available for
24587 testsuite and/or aesthetic purposes.
24588
24589 @item -mmcu=
24590 @opindex mmcu=
24591 Select the MCU to target. This is used to create a C preprocessor
24592 symbol based upon the MCU name, converted to upper case and pre- and
24593 post-fixed with @samp{__}. This in turn is used by the
24594 @file{msp430.h} header file to select an MCU-specific supplementary
24595 header file.
24596
24597 The option also sets the ISA to use. If the MCU name is one that is
24598 known to only support the 430 ISA then that is selected, otherwise the
24599 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
24600 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
24601 name selects the 430X ISA.
24602
24603 In addition an MCU-specific linker script is added to the linker
24604 command line. The script's name is the name of the MCU with
24605 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24606 command line defines the C preprocessor symbol @code{__XXX__} and
24607 cause the linker to search for a script called @file{xxx.ld}.
24608
24609 The ISA and hardware multiply supported for the different MCUs is hard-coded
24610 into GCC. However, an external @samp{devices.csv} file can be used to
24611 extend device support beyond those that have been hard-coded.
24612
24613 GCC searches for the @samp{devices.csv} file using the following methods in the
24614 given precedence order, where the first method takes precendence over the
24615 second which takes precedence over the third.
24616
24617 @table @asis
24618 @item Include path specified with @code{-I} and @code{-L}
24619 @samp{devices.csv} will be searched for in each of the directories specified by
24620 include paths and linker library search paths.
24621 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24622 Define the value of the global environment variable
24623 @samp{MSP430_GCC_INCLUDE_DIR}
24624 to the full path to the directory containing devices.csv, and GCC will search
24625 this directory for devices.csv. If devices.csv is found, this directory will
24626 also be registered as an include path, and linker library path. Header files
24627 and linker scripts in this directory can therefore be used without manually
24628 specifying @code{-I} and @code{-L} on the command line.
24629 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
24630 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24631 toolchain root directory. This directory does not exist in a default
24632 installation, but if the user has created it and copied @samp{devices.csv}
24633 there, then the MCU data will be read. As above, this directory will
24634 also be registered as an include path, and linker library path.
24635
24636 @end table
24637 If none of the above search methods find @samp{devices.csv}, then the
24638 hard-coded MCU data is used.
24639
24640
24641 @item -mwarn-mcu
24642 @itemx -mno-warn-mcu
24643 @opindex mwarn-mcu
24644 @opindex mno-warn-mcu
24645 This option enables or disables warnings about conflicts between the
24646 MCU name specified by the @option{-mmcu} option and the ISA set by the
24647 @option{-mcpu} option and/or the hardware multiply support set by the
24648 @option{-mhwmult} option. It also toggles warnings about unrecognized
24649 MCU names. This option is on by default.
24650
24651 @item -mcpu=
24652 @opindex mcpu=
24653 Specifies the ISA to use. Accepted values are @samp{msp430},
24654 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
24655 @option{-mmcu=} option should be used to select the ISA.
24656
24657 @item -msim
24658 @opindex msim
24659 Link to the simulator runtime libraries and linker script. Overrides
24660 any scripts that would be selected by the @option{-mmcu=} option.
24661
24662 @item -mlarge
24663 @opindex mlarge
24664 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
24665
24666 @item -msmall
24667 @opindex msmall
24668 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24669
24670 @item -mrelax
24671 @opindex mrelax
24672 This option is passed to the assembler and linker, and allows the
24673 linker to perform certain optimizations that cannot be done until
24674 the final link.
24675
24676 @item mhwmult=
24677 @opindex mhwmult=
24678 Describes the type of hardware multiply supported by the target.
24679 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24680 for the original 16-bit-only multiply supported by early MCUs.
24681 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24682 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24683 A value of @samp{auto} can also be given. This tells GCC to deduce
24684 the hardware multiply support based upon the MCU name provided by the
24685 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
24686 the MCU name is not recognized then no hardware multiply support is
24687 assumed. @code{auto} is the default setting.
24688
24689 Hardware multiplies are normally performed by calling a library
24690 routine. This saves space in the generated code. When compiling at
24691 @option{-O3} or higher however the hardware multiplier is invoked
24692 inline. This makes for bigger, but faster code.
24693
24694 The hardware multiply routines disable interrupts whilst running and
24695 restore the previous interrupt state when they finish. This makes
24696 them safe to use inside interrupt handlers as well as in normal code.
24697
24698 @item -minrt
24699 @opindex minrt
24700 Enable the use of a minimum runtime environment - no static
24701 initializers or constructors. This is intended for memory-constrained
24702 devices. The compiler includes special symbols in some objects
24703 that tell the linker and runtime which code fragments are required.
24704
24705 @item -mtiny-printf
24706 @opindex mtiny-printf
24707 Enable reduced code size @code{printf} and @code{puts} library functions.
24708 The @samp{tiny} implementations of these functions are not reentrant, so
24709 must be used with caution in multi-threaded applications.
24710
24711 Support for streams has been removed and the string to be printed will
24712 always be sent to stdout via the @code{write} syscall. The string is not
24713 buffered before it is sent to write.
24714
24715 This option requires Newlib Nano IO, so GCC must be configured with
24716 @samp{--enable-newlib-nano-formatted-io}.
24717
24718 @item -mcode-region=
24719 @itemx -mdata-region=
24720 @opindex mcode-region
24721 @opindex mdata-region
24722 These options tell the compiler where to place functions and data that
24723 do not have one of the @code{lower}, @code{upper}, @code{either} or
24724 @code{section} attributes. Possible values are @code{lower},
24725 @code{upper}, @code{either} or @code{any}. The first three behave
24726 like the corresponding attribute. The fourth possible value -
24727 @code{any} - is the default. It leaves placement entirely up to the
24728 linker script and how it assigns the standard sections
24729 (@code{.text}, @code{.data}, etc) to the memory regions.
24730
24731 @item -msilicon-errata=
24732 @opindex msilicon-errata
24733 This option passes on a request to assembler to enable the fixes for
24734 the named silicon errata.
24735
24736 @item -msilicon-errata-warn=
24737 @opindex msilicon-errata-warn
24738 This option passes on a request to the assembler to enable warning
24739 messages when a silicon errata might need to be applied.
24740
24741 @item -mwarn-devices-csv
24742 @itemx -mno-warn-devices-csv
24743 @opindex mwarn-devices-csv
24744 @opindex mno-warn-devices-csv
24745 Warn if @samp{devices.csv} is not found or there are problem parsing it
24746 (default: on).
24747
24748 @end table
24749
24750 @node NDS32 Options
24751 @subsection NDS32 Options
24752 @cindex NDS32 Options
24753
24754 These options are defined for NDS32 implementations:
24755
24756 @table @gcctabopt
24757
24758 @item -mbig-endian
24759 @opindex mbig-endian
24760 Generate code in big-endian mode.
24761
24762 @item -mlittle-endian
24763 @opindex mlittle-endian
24764 Generate code in little-endian mode.
24765
24766 @item -mreduced-regs
24767 @opindex mreduced-regs
24768 Use reduced-set registers for register allocation.
24769
24770 @item -mfull-regs
24771 @opindex mfull-regs
24772 Use full-set registers for register allocation.
24773
24774 @item -mcmov
24775 @opindex mcmov
24776 Generate conditional move instructions.
24777
24778 @item -mno-cmov
24779 @opindex mno-cmov
24780 Do not generate conditional move instructions.
24781
24782 @item -mext-perf
24783 @opindex mext-perf
24784 Generate performance extension instructions.
24785
24786 @item -mno-ext-perf
24787 @opindex mno-ext-perf
24788 Do not generate performance extension instructions.
24789
24790 @item -mext-perf2
24791 @opindex mext-perf2
24792 Generate performance extension 2 instructions.
24793
24794 @item -mno-ext-perf2
24795 @opindex mno-ext-perf2
24796 Do not generate performance extension 2 instructions.
24797
24798 @item -mext-string
24799 @opindex mext-string
24800 Generate string extension instructions.
24801
24802 @item -mno-ext-string
24803 @opindex mno-ext-string
24804 Do not generate string extension instructions.
24805
24806 @item -mv3push
24807 @opindex mv3push
24808 Generate v3 push25/pop25 instructions.
24809
24810 @item -mno-v3push
24811 @opindex mno-v3push
24812 Do not generate v3 push25/pop25 instructions.
24813
24814 @item -m16-bit
24815 @opindex m16-bit
24816 Generate 16-bit instructions.
24817
24818 @item -mno-16-bit
24819 @opindex mno-16-bit
24820 Do not generate 16-bit instructions.
24821
24822 @item -misr-vector-size=@var{num}
24823 @opindex misr-vector-size
24824 Specify the size of each interrupt vector, which must be 4 or 16.
24825
24826 @item -mcache-block-size=@var{num}
24827 @opindex mcache-block-size
24828 Specify the size of each cache block,
24829 which must be a power of 2 between 4 and 512.
24830
24831 @item -march=@var{arch}
24832 @opindex march
24833 Specify the name of the target architecture.
24834
24835 @item -mcmodel=@var{code-model}
24836 @opindex mcmodel
24837 Set the code model to one of
24838 @table @asis
24839 @item @samp{small}
24840 All the data and read-only data segments must be within 512KB addressing space.
24841 The text segment must be within 16MB addressing space.
24842 @item @samp{medium}
24843 The data segment must be within 512KB while the read-only data segment can be
24844 within 4GB addressing space. The text segment should be still within 16MB
24845 addressing space.
24846 @item @samp{large}
24847 All the text and data segments can be within 4GB addressing space.
24848 @end table
24849
24850 @item -mctor-dtor
24851 @opindex mctor-dtor
24852 Enable constructor/destructor feature.
24853
24854 @item -mrelax
24855 @opindex mrelax
24856 Guide linker to relax instructions.
24857
24858 @end table
24859
24860 @node Nios II Options
24861 @subsection Nios II Options
24862 @cindex Nios II options
24863 @cindex Altera Nios II options
24864
24865 These are the options defined for the Altera Nios II processor.
24866
24867 @table @gcctabopt
24868
24869 @item -G @var{num}
24870 @opindex G
24871 @cindex smaller data references
24872 Put global and static objects less than or equal to @var{num} bytes
24873 into the small data or BSS sections instead of the normal data or BSS
24874 sections. The default value of @var{num} is 8.
24875
24876 @item -mgpopt=@var{option}
24877 @itemx -mgpopt
24878 @itemx -mno-gpopt
24879 @opindex mgpopt
24880 @opindex mno-gpopt
24881 Generate (do not generate) GP-relative accesses. The following
24882 @var{option} names are recognized:
24883
24884 @table @samp
24885
24886 @item none
24887 Do not generate GP-relative accesses.
24888
24889 @item local
24890 Generate GP-relative accesses for small data objects that are not
24891 external, weak, or uninitialized common symbols.
24892 Also use GP-relative addressing for objects that
24893 have been explicitly placed in a small data section via a @code{section}
24894 attribute.
24895
24896 @item global
24897 As for @samp{local}, but also generate GP-relative accesses for
24898 small data objects that are external, weak, or common. If you use this option,
24899 you must ensure that all parts of your program (including libraries) are
24900 compiled with the same @option{-G} setting.
24901
24902 @item data
24903 Generate GP-relative accesses for all data objects in the program. If you
24904 use this option, the entire data and BSS segments
24905 of your program must fit in 64K of memory and you must use an appropriate
24906 linker script to allocate them within the addressable range of the
24907 global pointer.
24908
24909 @item all
24910 Generate GP-relative addresses for function pointers as well as data
24911 pointers. If you use this option, the entire text, data, and BSS segments
24912 of your program must fit in 64K of memory and you must use an appropriate
24913 linker script to allocate them within the addressable range of the
24914 global pointer.
24915
24916 @end table
24917
24918 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
24919 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
24920
24921 The default is @option{-mgpopt} except when @option{-fpic} or
24922 @option{-fPIC} is specified to generate position-independent code.
24923 Note that the Nios II ABI does not permit GP-relative accesses from
24924 shared libraries.
24925
24926 You may need to specify @option{-mno-gpopt} explicitly when building
24927 programs that include large amounts of small data, including large
24928 GOT data sections. In this case, the 16-bit offset for GP-relative
24929 addressing may not be large enough to allow access to the entire
24930 small data section.
24931
24932 @item -mgprel-sec=@var{regexp}
24933 @opindex mgprel-sec
24934 This option specifies additional section names that can be accessed via
24935 GP-relative addressing. It is most useful in conjunction with
24936 @code{section} attributes on variable declarations
24937 (@pxref{Common Variable Attributes}) and a custom linker script.
24938 The @var{regexp} is a POSIX Extended Regular Expression.
24939
24940 This option does not affect the behavior of the @option{-G} option, and
24941 the specified sections are in addition to the standard @code{.sdata}
24942 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
24943
24944 @item -mr0rel-sec=@var{regexp}
24945 @opindex mr0rel-sec
24946 This option specifies names of sections that can be accessed via a
24947 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
24948 of the 32-bit address space. It is most useful in conjunction with
24949 @code{section} attributes on variable declarations
24950 (@pxref{Common Variable Attributes}) and a custom linker script.
24951 The @var{regexp} is a POSIX Extended Regular Expression.
24952
24953 In contrast to the use of GP-relative addressing for small data,
24954 zero-based addressing is never generated by default and there are no
24955 conventional section names used in standard linker scripts for sections
24956 in the low or high areas of memory.
24957
24958 @item -mel
24959 @itemx -meb
24960 @opindex mel
24961 @opindex meb
24962 Generate little-endian (default) or big-endian (experimental) code,
24963 respectively.
24964
24965 @item -march=@var{arch}
24966 @opindex march
24967 This specifies the name of the target Nios II architecture. GCC uses this
24968 name to determine what kind of instructions it can emit when generating
24969 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
24970
24971 The preprocessor macro @code{__nios2_arch__} is available to programs,
24972 with value 1 or 2, indicating the targeted ISA level.
24973
24974 @item -mbypass-cache
24975 @itemx -mno-bypass-cache
24976 @opindex mno-bypass-cache
24977 @opindex mbypass-cache
24978 Force all load and store instructions to always bypass cache by
24979 using I/O variants of the instructions. The default is not to
24980 bypass the cache.
24981
24982 @item -mno-cache-volatile
24983 @itemx -mcache-volatile
24984 @opindex mcache-volatile
24985 @opindex mno-cache-volatile
24986 Volatile memory access bypass the cache using the I/O variants of
24987 the load and store instructions. The default is not to bypass the cache.
24988
24989 @item -mno-fast-sw-div
24990 @itemx -mfast-sw-div
24991 @opindex mno-fast-sw-div
24992 @opindex mfast-sw-div
24993 Do not use table-based fast divide for small numbers. The default
24994 is to use the fast divide at @option{-O3} and above.
24995
24996 @item -mno-hw-mul
24997 @itemx -mhw-mul
24998 @itemx -mno-hw-mulx
24999 @itemx -mhw-mulx
25000 @itemx -mno-hw-div
25001 @itemx -mhw-div
25002 @opindex mno-hw-mul
25003 @opindex mhw-mul
25004 @opindex mno-hw-mulx
25005 @opindex mhw-mulx
25006 @opindex mno-hw-div
25007 @opindex mhw-div
25008 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
25009 instructions by the compiler. The default is to emit @code{mul}
25010 and not emit @code{div} and @code{mulx}.
25011
25012 @item -mbmx
25013 @itemx -mno-bmx
25014 @itemx -mcdx
25015 @itemx -mno-cdx
25016 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
25017 CDX (code density) instructions. Enabling these instructions also
25018 requires @option{-march=r2}. Since these instructions are optional
25019 extensions to the R2 architecture, the default is not to emit them.
25020
25021 @item -mcustom-@var{insn}=@var{N}
25022 @itemx -mno-custom-@var{insn}
25023 @opindex mcustom-@var{insn}
25024 @opindex mno-custom-@var{insn}
25025 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
25026 custom instruction with encoding @var{N} when generating code that uses
25027 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
25028 instruction 253 for single-precision floating-point add operations instead
25029 of the default behavior of using a library call.
25030
25031 The following values of @var{insn} are supported. Except as otherwise
25032 noted, floating-point operations are expected to be implemented with
25033 normal IEEE 754 semantics and correspond directly to the C operators or the
25034 equivalent GCC built-in functions (@pxref{Other Builtins}).
25035
25036 Single-precision floating point:
25037 @table @asis
25038
25039 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
25040 Binary arithmetic operations.
25041
25042 @item @samp{fnegs}
25043 Unary negation.
25044
25045 @item @samp{fabss}
25046 Unary absolute value.
25047
25048 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
25049 Comparison operations.
25050
25051 @item @samp{fmins}, @samp{fmaxs}
25052 Floating-point minimum and maximum. These instructions are only
25053 generated if @option{-ffinite-math-only} is specified.
25054
25055 @item @samp{fsqrts}
25056 Unary square root operation.
25057
25058 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
25059 Floating-point trigonometric and exponential functions. These instructions
25060 are only generated if @option{-funsafe-math-optimizations} is also specified.
25061
25062 @end table
25063
25064 Double-precision floating point:
25065 @table @asis
25066
25067 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
25068 Binary arithmetic operations.
25069
25070 @item @samp{fnegd}
25071 Unary negation.
25072
25073 @item @samp{fabsd}
25074 Unary absolute value.
25075
25076 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
25077 Comparison operations.
25078
25079 @item @samp{fmind}, @samp{fmaxd}
25080 Double-precision minimum and maximum. These instructions are only
25081 generated if @option{-ffinite-math-only} is specified.
25082
25083 @item @samp{fsqrtd}
25084 Unary square root operation.
25085
25086 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
25087 Double-precision trigonometric and exponential functions. These instructions
25088 are only generated if @option{-funsafe-math-optimizations} is also specified.
25089
25090 @end table
25091
25092 Conversions:
25093 @table @asis
25094 @item @samp{fextsd}
25095 Conversion from single precision to double precision.
25096
25097 @item @samp{ftruncds}
25098 Conversion from double precision to single precision.
25099
25100 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
25101 Conversion from floating point to signed or unsigned integer types, with
25102 truncation towards zero.
25103
25104 @item @samp{round}
25105 Conversion from single-precision floating point to signed integer,
25106 rounding to the nearest integer and ties away from zero.
25107 This corresponds to the @code{__builtin_lroundf} function when
25108 @option{-fno-math-errno} is used.
25109
25110 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
25111 Conversion from signed or unsigned integer types to floating-point types.
25112
25113 @end table
25114
25115 In addition, all of the following transfer instructions for internal
25116 registers X and Y must be provided to use any of the double-precision
25117 floating-point instructions. Custom instructions taking two
25118 double-precision source operands expect the first operand in the
25119 64-bit register X. The other operand (or only operand of a unary
25120 operation) is given to the custom arithmetic instruction with the
25121 least significant half in source register @var{src1} and the most
25122 significant half in @var{src2}. A custom instruction that returns a
25123 double-precision result returns the most significant 32 bits in the
25124 destination register and the other half in 32-bit register Y.
25125 GCC automatically generates the necessary code sequences to write
25126 register X and/or read register Y when double-precision floating-point
25127 instructions are used.
25128
25129 @table @asis
25130
25131 @item @samp{fwrx}
25132 Write @var{src1} into the least significant half of X and @var{src2} into
25133 the most significant half of X.
25134
25135 @item @samp{fwry}
25136 Write @var{src1} into Y.
25137
25138 @item @samp{frdxhi}, @samp{frdxlo}
25139 Read the most or least (respectively) significant half of X and store it in
25140 @var{dest}.
25141
25142 @item @samp{frdy}
25143 Read the value of Y and store it into @var{dest}.
25144 @end table
25145
25146 Note that you can gain more local control over generation of Nios II custom
25147 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
25148 and @code{target("no-custom-@var{insn}")} function attributes
25149 (@pxref{Function Attributes})
25150 or pragmas (@pxref{Function Specific Option Pragmas}).
25151
25152 @item -mcustom-fpu-cfg=@var{name}
25153 @opindex mcustom-fpu-cfg
25154
25155 This option enables a predefined, named set of custom instruction encodings
25156 (see @option{-mcustom-@var{insn}} above).
25157 Currently, the following sets are defined:
25158
25159 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
25160 @gccoptlist{-mcustom-fmuls=252 @gol
25161 -mcustom-fadds=253 @gol
25162 -mcustom-fsubs=254 @gol
25163 -fsingle-precision-constant}
25164
25165 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
25166 @gccoptlist{-mcustom-fmuls=252 @gol
25167 -mcustom-fadds=253 @gol
25168 -mcustom-fsubs=254 @gol
25169 -mcustom-fdivs=255 @gol
25170 -fsingle-precision-constant}
25171
25172 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
25173 @gccoptlist{-mcustom-floatus=243 @gol
25174 -mcustom-fixsi=244 @gol
25175 -mcustom-floatis=245 @gol
25176 -mcustom-fcmpgts=246 @gol
25177 -mcustom-fcmples=249 @gol
25178 -mcustom-fcmpeqs=250 @gol
25179 -mcustom-fcmpnes=251 @gol
25180 -mcustom-fmuls=252 @gol
25181 -mcustom-fadds=253 @gol
25182 -mcustom-fsubs=254 @gol
25183 -mcustom-fdivs=255 @gol
25184 -fsingle-precision-constant}
25185
25186 Custom instruction assignments given by individual
25187 @option{-mcustom-@var{insn}=} options override those given by
25188 @option{-mcustom-fpu-cfg=}, regardless of the
25189 order of the options on the command line.
25190
25191 Note that you can gain more local control over selection of a FPU
25192 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
25193 function attribute (@pxref{Function Attributes})
25194 or pragma (@pxref{Function Specific Option Pragmas}).
25195
25196 @end table
25197
25198 These additional @samp{-m} options are available for the Altera Nios II
25199 ELF (bare-metal) target:
25200
25201 @table @gcctabopt
25202
25203 @item -mhal
25204 @opindex mhal
25205 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
25206 startup and termination code, and is typically used in conjunction with
25207 @option{-msys-crt0=} to specify the location of the alternate startup code
25208 provided by the HAL BSP.
25209
25210 @item -msmallc
25211 @opindex msmallc
25212 Link with a limited version of the C library, @option{-lsmallc}, rather than
25213 Newlib.
25214
25215 @item -msys-crt0=@var{startfile}
25216 @opindex msys-crt0
25217 @var{startfile} is the file name of the startfile (crt0) to use
25218 when linking. This option is only useful in conjunction with @option{-mhal}.
25219
25220 @item -msys-lib=@var{systemlib}
25221 @opindex msys-lib
25222 @var{systemlib} is the library name of the library that provides
25223 low-level system calls required by the C library,
25224 e.g.@: @code{read} and @code{write}.
25225 This option is typically used to link with a library provided by a HAL BSP.
25226
25227 @end table
25228
25229 @node Nvidia PTX Options
25230 @subsection Nvidia PTX Options
25231 @cindex Nvidia PTX options
25232 @cindex nvptx options
25233
25234 These options are defined for Nvidia PTX:
25235
25236 @table @gcctabopt
25237
25238 @item -m32
25239 @itemx -m64
25240 @opindex m32
25241 @opindex m64
25242 Generate code for 32-bit or 64-bit ABI.
25243
25244 @item -misa=@var{ISA-string}
25245 @opindex march
25246 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
25247 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
25248 @samp{sm_35}. The default ISA is sm_30.
25249
25250 @item -mmainkernel
25251 @opindex mmainkernel
25252 Link in code for a __main kernel. This is for stand-alone instead of
25253 offloading execution.
25254
25255 @item -moptimize
25256 @opindex moptimize
25257 Apply partitioned execution optimizations. This is the default when any
25258 level of optimization is selected.
25259
25260 @item -msoft-stack
25261 @opindex msoft-stack
25262 Generate code that does not use @code{.local} memory
25263 directly for stack storage. Instead, a per-warp stack pointer is
25264 maintained explicitly. This enables variable-length stack allocation (with
25265 variable-length arrays or @code{alloca}), and when global memory is used for
25266 underlying storage, makes it possible to access automatic variables from other
25267 threads, or with atomic instructions. This code generation variant is used
25268 for OpenMP offloading, but the option is exposed on its own for the purpose
25269 of testing the compiler; to generate code suitable for linking into programs
25270 using OpenMP offloading, use option @option{-mgomp}.
25271
25272 @item -muniform-simt
25273 @opindex muniform-simt
25274 Switch to code generation variant that allows to execute all threads in each
25275 warp, while maintaining memory state and side effects as if only one thread
25276 in each warp was active outside of OpenMP SIMD regions. All atomic operations
25277 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
25278 current lane index equals the master lane index), and the register being
25279 assigned is copied via a shuffle instruction from the master lane. Outside of
25280 SIMD regions lane 0 is the master; inside, each thread sees itself as the
25281 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
25282 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
25283 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
25284 with current lane index to compute the master lane index.
25285
25286 @item -mgomp
25287 @opindex mgomp
25288 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
25289 @option{-muniform-simt} options, and selects corresponding multilib variant.
25290
25291 @end table
25292
25293 @node OpenRISC Options
25294 @subsection OpenRISC Options
25295 @cindex OpenRISC Options
25296
25297 These options are defined for OpenRISC:
25298
25299 @table @gcctabopt
25300
25301 @item -mboard=@var{name}
25302 @opindex mboard
25303 Configure a board specific runtime. This will be passed to the linker for
25304 newlib board library linking. The default is @code{or1ksim}.
25305
25306 @item -mnewlib
25307 @opindex mnewlib
25308 This option is ignored; it is for compatibility purposes only. This used to
25309 select linker and preprocessor options for use with newlib.
25310
25311 @item -msoft-div
25312 @itemx -mhard-div
25313 @opindex msoft-div
25314 @opindex mhard-div
25315 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
25316 This default is hardware divide.
25317
25318 @item -msoft-mul
25319 @itemx -mhard-mul
25320 @opindex msoft-mul
25321 @opindex mhard-mul
25322 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
25323 This default is hardware multiply.
25324
25325 @item -msoft-float
25326 @itemx -mhard-float
25327 @opindex msoft-float
25328 @opindex mhard-float
25329 Select software or hardware for floating point operations.
25330 The default is software.
25331
25332 @item -mdouble-float
25333 @opindex mdouble-float
25334 When @option{-mhard-float} is selected, enables generation of double-precision
25335 floating point instructions. By default functions from @file{libgcc} are used
25336 to perform double-precision floating point operations.
25337
25338 @item -munordered-float
25339 @opindex munordered-float
25340 When @option{-mhard-float} is selected, enables generation of unordered
25341 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
25342 functions from @file{libgcc} are used to perform unordered floating point
25343 compare and set flag operations.
25344
25345 @item -mcmov
25346 @opindex mcmov
25347 Enable generation of conditional move (@code{l.cmov}) instructions. By
25348 default the equivalent will be generated using set and branch.
25349
25350 @item -mror
25351 @opindex mror
25352 Enable generation of rotate right (@code{l.ror}) instructions. By default
25353 functions from @file{libgcc} are used to perform rotate right operations.
25354
25355 @item -mrori
25356 @opindex mrori
25357 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
25358 By default functions from @file{libgcc} are used to perform rotate right with
25359 immediate operations.
25360
25361 @item -msext
25362 @opindex msext
25363 Enable generation of sign extension (@code{l.ext*}) instructions. By default
25364 memory loads are used to perform sign extension.
25365
25366 @item -msfimm
25367 @opindex msfimm
25368 Enable generation of compare and set flag with immediate (@code{l.sf*i})
25369 instructions. By default extra instructions will be generated to store the
25370 immediate to a register first.
25371
25372 @item -mshftimm
25373 @opindex mshftimm
25374 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
25375 @code{l.slli}) instructions. By default extra instructions will be generated
25376 to store the immediate to a register first.
25377
25378
25379 @end table
25380
25381 @node PDP-11 Options
25382 @subsection PDP-11 Options
25383 @cindex PDP-11 Options
25384
25385 These options are defined for the PDP-11:
25386
25387 @table @gcctabopt
25388 @item -mfpu
25389 @opindex mfpu
25390 Use hardware FPP floating point. This is the default. (FIS floating
25391 point on the PDP-11/40 is not supported.) Implies -m45.
25392
25393 @item -msoft-float
25394 @opindex msoft-float
25395 Do not use hardware floating point.
25396
25397 @item -mac0
25398 @opindex mac0
25399 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
25400
25401 @item -mno-ac0
25402 @opindex mno-ac0
25403 Return floating-point results in memory. This is the default.
25404
25405 @item -m40
25406 @opindex m40
25407 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
25408
25409 @item -m45
25410 @opindex m45
25411 Generate code for a PDP-11/45. This is the default.
25412
25413 @item -m10
25414 @opindex m10
25415 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
25416
25417 @item -mint16
25418 @itemx -mno-int32
25419 @opindex mint16
25420 @opindex mno-int32
25421 Use 16-bit @code{int}. This is the default.
25422
25423 @item -mint32
25424 @itemx -mno-int16
25425 @opindex mint32
25426 @opindex mno-int16
25427 Use 32-bit @code{int}.
25428
25429 @item -msplit
25430 @opindex msplit
25431 Target has split instruction and data space. Implies -m45.
25432
25433 @item -munix-asm
25434 @opindex munix-asm
25435 Use Unix assembler syntax.
25436
25437 @item -mdec-asm
25438 @opindex mdec-asm
25439 Use DEC assembler syntax.
25440
25441 @item -mgnu-asm
25442 @opindex mgnu-asm
25443 Use GNU assembler syntax. This is the default.
25444
25445 @item -mlra
25446 @opindex mlra
25447 Use the new LRA register allocator. By default, the old ``reload''
25448 allocator is used.
25449 @end table
25450
25451 @node picoChip Options
25452 @subsection picoChip Options
25453 @cindex picoChip options
25454
25455 These @samp{-m} options are defined for picoChip implementations:
25456
25457 @table @gcctabopt
25458
25459 @item -mae=@var{ae_type}
25460 @opindex mcpu
25461 Set the instruction set, register set, and instruction scheduling
25462 parameters for array element type @var{ae_type}. Supported values
25463 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
25464
25465 @option{-mae=ANY} selects a completely generic AE type. Code
25466 generated with this option runs on any of the other AE types. The
25467 code is not as efficient as it would be if compiled for a specific
25468 AE type, and some types of operation (e.g., multiplication) do not
25469 work properly on all types of AE.
25470
25471 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
25472 for compiled code, and is the default.
25473
25474 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
25475 option may suffer from poor performance of byte (char) manipulation,
25476 since the DSP AE does not provide hardware support for byte load/stores.
25477
25478 @item -msymbol-as-address
25479 Enable the compiler to directly use a symbol name as an address in a
25480 load/store instruction, without first loading it into a
25481 register. Typically, the use of this option generates larger
25482 programs, which run faster than when the option isn't used. However, the
25483 results vary from program to program, so it is left as a user option,
25484 rather than being permanently enabled.
25485
25486 @item -mno-inefficient-warnings
25487 Disables warnings about the generation of inefficient code. These
25488 warnings can be generated, for example, when compiling code that
25489 performs byte-level memory operations on the MAC AE type. The MAC AE has
25490 no hardware support for byte-level memory operations, so all byte
25491 load/stores must be synthesized from word load/store operations. This is
25492 inefficient and a warning is generated to indicate
25493 that you should rewrite the code to avoid byte operations, or to target
25494 an AE type that has the necessary hardware support. This option disables
25495 these warnings.
25496
25497 @end table
25498
25499 @node PowerPC Options
25500 @subsection PowerPC Options
25501 @cindex PowerPC options
25502
25503 These are listed under @xref{RS/6000 and PowerPC Options}.
25504
25505 @node PRU Options
25506 @subsection PRU Options
25507 @cindex PRU Options
25508
25509 These command-line options are defined for PRU target:
25510
25511 @table @gcctabopt
25512 @item -minrt
25513 @opindex minrt
25514 Link with a minimum runtime environment, with no support for static
25515 initializers and constructors. Using this option can significantly reduce
25516 the size of the final ELF binary. Beware that the compiler could still
25517 generate code with static initializers and constructors. It is up to the
25518 programmer to ensure that the source program will not use those features.
25519
25520 @item -mmcu=@var{mcu}
25521 @opindex mmcu
25522 Specify the PRU MCU variant to use. Check Newlib for the exact list of
25523 supported MCUs.
25524
25525 @item -mno-relax
25526 @opindex mno-relax
25527 Make GCC pass the @option{--no-relax} command-line option to the linker
25528 instead of the @option{--relax} option.
25529
25530 @item -mloop
25531 @opindex mloop
25532 Allow (or do not allow) GCC to use the LOOP instruction.
25533
25534 @item -mabi=@var{variant}
25535 @opindex mabi
25536 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
25537 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25538 more naturally with certain GCC assumptions. These are the differences:
25539
25540 @table @samp
25541 @item Function Pointer Size
25542 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25543 supports only 32-bit data and code pointers.
25544
25545 @item Optional Return Value Pointer
25546 Function return values larger than 64 bits are passed by using a hidden
25547 pointer as the first argument of the function. TI ABI, though, mandates that
25548 the pointer can be NULL in case the caller is not using the returned value.
25549 GNU always passes and expects a valid return value pointer.
25550
25551 @end table
25552
25553 The current @option{-mabi=ti} implementation simply raises a compile error
25554 when any of the above code constructs is detected. As a consequence
25555 the standard C library cannot be built and it is omitted when linking with
25556 @option{-mabi=ti}.
25557
25558 Relaxation is a GNU feature and for safety reasons is disabled when using
25559 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
25560 instructions, so the GNU linker cannot adjust them when shortening adjacent
25561 LDI32 pseudo instructions.
25562
25563 @end table
25564
25565 @node RISC-V Options
25566 @subsection RISC-V Options
25567 @cindex RISC-V Options
25568
25569 These command-line options are defined for RISC-V targets:
25570
25571 @table @gcctabopt
25572 @item -mbranch-cost=@var{n}
25573 @opindex mbranch-cost
25574 Set the cost of branches to roughly @var{n} instructions.
25575
25576 @item -mplt
25577 @itemx -mno-plt
25578 @opindex plt
25579 When generating PIC code, do or don't allow the use of PLTs. Ignored for
25580 non-PIC. The default is @option{-mplt}.
25581
25582 @item -mabi=@var{ABI-string}
25583 @opindex mabi
25584 Specify integer and floating-point calling convention. @var{ABI-string}
25585 contains two parts: the size of integer types and the registers used for
25586 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
25587 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
25588 32-bit), and that floating-point values up to 64 bits wide are passed in F
25589 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25590 allows the compiler to generate code that uses the F and D extensions but only
25591 allows floating-point values up to 32 bits long to be passed in registers; or
25592 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25593 passed in registers.
25594
25595 The default for this argument is system dependent, users who want a specific
25596 calling convention should specify one explicitly. The valid calling
25597 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25598 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
25599 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25600 invalid because the ABI requires 64-bit values be passed in F registers, but F
25601 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
25602 only be used with the @samp{rv32e} architecture. This ABI is not well
25603 specified at present, and is subject to change.
25604
25605 @item -mfdiv
25606 @itemx -mno-fdiv
25607 @opindex mfdiv
25608 Do or don't use hardware floating-point divide and square root instructions.
25609 This requires the F or D extensions for floating-point registers. The default
25610 is to use them if the specified architecture has these instructions.
25611
25612 @item -mdiv
25613 @itemx -mno-div
25614 @opindex mdiv
25615 Do or don't use hardware instructions for integer division. This requires the
25616 M extension. The default is to use them if the specified architecture has
25617 these instructions.
25618
25619 @item -march=@var{ISA-string}
25620 @opindex march
25621 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
25622 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25623 @samp{rv32imaf}.
25624
25625 @item -mtune=@var{processor-string}
25626 @opindex mtune
25627 Optimize the output for the given processor, specified by microarchitecture
25628 name. Permissible values for this option are: @samp{rocket},
25629 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25630 and @samp{size}.
25631
25632 When @option{-mtune=} is not specified, the default is @samp{rocket}.
25633
25634 The @samp{size} choice is not intended for use by end-users. This is used
25635 when @option{-Os} is specified. It overrides the instruction cost info
25636 provided by @option{-mtune=}, but does not override the pipeline info. This
25637 helps reduce code size while still giving good performance.
25638
25639 @item -mpreferred-stack-boundary=@var{num}
25640 @opindex mpreferred-stack-boundary
25641 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25642 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25643 the default is 4 (16 bytes or 128-bits).
25644
25645 @strong{Warning:} If you use this switch, then you must build all modules with
25646 the same value, including any libraries. This includes the system libraries
25647 and startup modules.
25648
25649 @item -msmall-data-limit=@var{n}
25650 @opindex msmall-data-limit
25651 Put global and static data smaller than @var{n} bytes into a special section
25652 (on some targets).
25653
25654 @item -msave-restore
25655 @itemx -mno-save-restore
25656 @opindex msave-restore
25657 Do or don't use smaller but slower prologue and epilogue code that uses
25658 library function calls. The default is to use fast inline prologues and
25659 epilogues.
25660
25661 @item -mshorten-memrefs
25662 @itemx -mno-shorten-memrefs
25663 @opindex mshorten-memrefs
25664 Do or do not attempt to make more use of compressed load/store instructions by
25665 replacing a load/store of 'base register + large offset' with a new load/store
25666 of 'new base + small offset'. If the new base gets stored in a compressed
25667 register, then the new load/store can be compressed. Currently targets 32-bit
25668 integer load/stores only.
25669
25670 @item -mstrict-align
25671 @itemx -mno-strict-align
25672 @opindex mstrict-align
25673 Do not or do generate unaligned memory accesses. The default is set depending
25674 on whether the processor we are optimizing for supports fast unaligned access
25675 or not.
25676
25677 @item -mcmodel=medlow
25678 @opindex mcmodel=medlow
25679 Generate code for the medium-low code model. The program and its statically
25680 defined symbols must lie within a single 2 GiB address range and must lie
25681 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25682 statically or dynamically linked. This is the default code model.
25683
25684 @item -mcmodel=medany
25685 @opindex mcmodel=medany
25686 Generate code for the medium-any code model. The program and its statically
25687 defined symbols must be within any single 2 GiB address range. Programs can be
25688 statically or dynamically linked.
25689
25690 @item -mexplicit-relocs
25691 @itemx -mno-exlicit-relocs
25692 Use or do not use assembler relocation operators when dealing with symbolic
25693 addresses. The alternative is to use assembler macros instead, which may
25694 limit optimization.
25695
25696 @item -mrelax
25697 @itemx -mno-relax
25698 Take advantage of linker relaxations to reduce the number of instructions
25699 required to materialize symbol addresses. The default is to take advantage of
25700 linker relaxations.
25701
25702 @item -memit-attribute
25703 @itemx -mno-emit-attribute
25704 Emit (do not emit) RISC-V attribute to record extra information into ELF
25705 objects. This feature requires at least binutils 2.32.
25706
25707 @item -malign-data=@var{type}
25708 @opindex malign-data
25709 Control how GCC aligns variables and constants of array, structure, or union
25710 types. Supported values for @var{type} are @samp{xlen} which uses x register
25711 width as the alignment value, and @samp{natural} which uses natural alignment.
25712 @samp{xlen} is the default.
25713 @end table
25714
25715 @node RL78 Options
25716 @subsection RL78 Options
25717 @cindex RL78 Options
25718
25719 @table @gcctabopt
25720
25721 @item -msim
25722 @opindex msim
25723 Links in additional target libraries to support operation within a
25724 simulator.
25725
25726 @item -mmul=none
25727 @itemx -mmul=g10
25728 @itemx -mmul=g13
25729 @itemx -mmul=g14
25730 @itemx -mmul=rl78
25731 @opindex mmul
25732 Specifies the type of hardware multiplication and division support to
25733 be used. The simplest is @code{none}, which uses software for both
25734 multiplication and division. This is the default. The @code{g13}
25735 value is for the hardware multiply/divide peripheral found on the
25736 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
25737 the multiplication and division instructions supported by the RL78/G14
25738 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
25739 the value @code{mg10} is an alias for @code{none}.
25740
25741 In addition a C preprocessor macro is defined, based upon the setting
25742 of this option. Possible values are: @code{__RL78_MUL_NONE__},
25743 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25744
25745 @item -mcpu=g10
25746 @itemx -mcpu=g13
25747 @itemx -mcpu=g14
25748 @itemx -mcpu=rl78
25749 @opindex mcpu
25750 Specifies the RL78 core to target. The default is the G14 core, also
25751 known as an S3 core or just RL78. The G13 or S2 core does not have
25752 multiply or divide instructions, instead it uses a hardware peripheral
25753 for these operations. The G10 or S1 core does not have register
25754 banks, so it uses a different calling convention.
25755
25756 If this option is set it also selects the type of hardware multiply
25757 support to use, unless this is overridden by an explicit
25758 @option{-mmul=none} option on the command line. Thus specifying
25759 @option{-mcpu=g13} enables the use of the G13 hardware multiply
25760 peripheral and specifying @option{-mcpu=g10} disables the use of
25761 hardware multiplications altogether.
25762
25763 Note, although the RL78/G14 core is the default target, specifying
25764 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25765 change the behavior of the toolchain since it also enables G14
25766 hardware multiply support. If these options are not specified on the
25767 command line then software multiplication routines will be used even
25768 though the code targets the RL78 core. This is for backwards
25769 compatibility with older toolchains which did not have hardware
25770 multiply and divide support.
25771
25772 In addition a C preprocessor macro is defined, based upon the setting
25773 of this option. Possible values are: @code{__RL78_G10__},
25774 @code{__RL78_G13__} or @code{__RL78_G14__}.
25775
25776 @item -mg10
25777 @itemx -mg13
25778 @itemx -mg14
25779 @itemx -mrl78
25780 @opindex mg10
25781 @opindex mg13
25782 @opindex mg14
25783 @opindex mrl78
25784 These are aliases for the corresponding @option{-mcpu=} option. They
25785 are provided for backwards compatibility.
25786
25787 @item -mallregs
25788 @opindex mallregs
25789 Allow the compiler to use all of the available registers. By default
25790 registers @code{r24..r31} are reserved for use in interrupt handlers.
25791 With this option enabled these registers can be used in ordinary
25792 functions as well.
25793
25794 @item -m64bit-doubles
25795 @itemx -m32bit-doubles
25796 @opindex m64bit-doubles
25797 @opindex m32bit-doubles
25798 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25799 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25800 @option{-m32bit-doubles}.
25801
25802 @item -msave-mduc-in-interrupts
25803 @itemx -mno-save-mduc-in-interrupts
25804 @opindex msave-mduc-in-interrupts
25805 @opindex mno-save-mduc-in-interrupts
25806 Specifies that interrupt handler functions should preserve the
25807 MDUC registers. This is only necessary if normal code might use
25808 the MDUC registers, for example because it performs multiplication
25809 and division operations. The default is to ignore the MDUC registers
25810 as this makes the interrupt handlers faster. The target option -mg13
25811 needs to be passed for this to work as this feature is only available
25812 on the G13 target (S2 core). The MDUC registers will only be saved
25813 if the interrupt handler performs a multiplication or division
25814 operation or it calls another function.
25815
25816 @end table
25817
25818 @node RS/6000 and PowerPC Options
25819 @subsection IBM RS/6000 and PowerPC Options
25820 @cindex RS/6000 and PowerPC Options
25821 @cindex IBM RS/6000 and PowerPC Options
25822
25823 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25824 @table @gcctabopt
25825 @item -mpowerpc-gpopt
25826 @itemx -mno-powerpc-gpopt
25827 @itemx -mpowerpc-gfxopt
25828 @itemx -mno-powerpc-gfxopt
25829 @need 800
25830 @itemx -mpowerpc64
25831 @itemx -mno-powerpc64
25832 @itemx -mmfcrf
25833 @itemx -mno-mfcrf
25834 @itemx -mpopcntb
25835 @itemx -mno-popcntb
25836 @itemx -mpopcntd
25837 @itemx -mno-popcntd
25838 @itemx -mfprnd
25839 @itemx -mno-fprnd
25840 @need 800
25841 @itemx -mcmpb
25842 @itemx -mno-cmpb
25843 @itemx -mhard-dfp
25844 @itemx -mno-hard-dfp
25845 @opindex mpowerpc-gpopt
25846 @opindex mno-powerpc-gpopt
25847 @opindex mpowerpc-gfxopt
25848 @opindex mno-powerpc-gfxopt
25849 @opindex mpowerpc64
25850 @opindex mno-powerpc64
25851 @opindex mmfcrf
25852 @opindex mno-mfcrf
25853 @opindex mpopcntb
25854 @opindex mno-popcntb
25855 @opindex mpopcntd
25856 @opindex mno-popcntd
25857 @opindex mfprnd
25858 @opindex mno-fprnd
25859 @opindex mcmpb
25860 @opindex mno-cmpb
25861 @opindex mhard-dfp
25862 @opindex mno-hard-dfp
25863 You use these options to specify which instructions are available on the
25864 processor you are using. The default value of these options is
25865 determined when configuring GCC@. Specifying the
25866 @option{-mcpu=@var{cpu_type}} overrides the specification of these
25867 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
25868 rather than the options listed above.
25869
25870 Specifying @option{-mpowerpc-gpopt} allows
25871 GCC to use the optional PowerPC architecture instructions in the
25872 General Purpose group, including floating-point square root. Specifying
25873 @option{-mpowerpc-gfxopt} allows GCC to
25874 use the optional PowerPC architecture instructions in the Graphics
25875 group, including floating-point select.
25876
25877 The @option{-mmfcrf} option allows GCC to generate the move from
25878 condition register field instruction implemented on the POWER4
25879 processor and other processors that support the PowerPC V2.01
25880 architecture.
25881 The @option{-mpopcntb} option allows GCC to generate the popcount and
25882 double-precision FP reciprocal estimate instruction implemented on the
25883 POWER5 processor and other processors that support the PowerPC V2.02
25884 architecture.
25885 The @option{-mpopcntd} option allows GCC to generate the popcount
25886 instruction implemented on the POWER7 processor and other processors
25887 that support the PowerPC V2.06 architecture.
25888 The @option{-mfprnd} option allows GCC to generate the FP round to
25889 integer instructions implemented on the POWER5+ processor and other
25890 processors that support the PowerPC V2.03 architecture.
25891 The @option{-mcmpb} option allows GCC to generate the compare bytes
25892 instruction implemented on the POWER6 processor and other processors
25893 that support the PowerPC V2.05 architecture.
25894 The @option{-mhard-dfp} option allows GCC to generate the decimal
25895 floating-point instructions implemented on some POWER processors.
25896
25897 The @option{-mpowerpc64} option allows GCC to generate the additional
25898 64-bit instructions that are found in the full PowerPC64 architecture
25899 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25900 @option{-mno-powerpc64}.
25901
25902 @item -mcpu=@var{cpu_type}
25903 @opindex mcpu
25904 Set architecture type, register usage, and
25905 instruction scheduling parameters for machine type @var{cpu_type}.
25906 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
25907 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
25908 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
25909 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
25910 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
25911 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
25912 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
25913 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
25914 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
25915 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
25916 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
25917 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
25918
25919 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
25920 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
25921 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
25922 architecture machine types, with an appropriate, generic processor
25923 model assumed for scheduling purposes.
25924
25925 Specifying @samp{native} as cpu type detects and selects the
25926 architecture option that corresponds to the host processor of the
25927 system performing the compilation.
25928 @option{-mcpu=native} has no effect if GCC does not recognize the
25929 processor.
25930
25931 The other options specify a specific processor. Code generated under
25932 those options runs best on that processor, and may not run at all on
25933 others.
25934
25935 The @option{-mcpu} options automatically enable or disable the
25936 following options:
25937
25938 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
25939 -mpopcntb -mpopcntd -mpowerpc64 @gol
25940 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
25941 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
25942 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
25943 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
25944
25945 The particular options set for any particular CPU varies between
25946 compiler versions, depending on what setting seems to produce optimal
25947 code for that CPU; it doesn't necessarily reflect the actual hardware's
25948 capabilities. If you wish to set an individual option to a particular
25949 value, you may specify it after the @option{-mcpu} option, like
25950 @option{-mcpu=970 -mno-altivec}.
25951
25952 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
25953 not enabled or disabled by the @option{-mcpu} option at present because
25954 AIX does not have full support for these options. You may still
25955 enable or disable them individually if you're sure it'll work in your
25956 environment.
25957
25958 @item -mtune=@var{cpu_type}
25959 @opindex mtune
25960 Set the instruction scheduling parameters for machine type
25961 @var{cpu_type}, but do not set the architecture type or register usage,
25962 as @option{-mcpu=@var{cpu_type}} does. The same
25963 values for @var{cpu_type} are used for @option{-mtune} as for
25964 @option{-mcpu}. If both are specified, the code generated uses the
25965 architecture and registers set by @option{-mcpu}, but the
25966 scheduling parameters set by @option{-mtune}.
25967
25968 @item -mcmodel=small
25969 @opindex mcmodel=small
25970 Generate PowerPC64 code for the small model: The TOC is limited to
25971 64k.
25972
25973 @item -mcmodel=medium
25974 @opindex mcmodel=medium
25975 Generate PowerPC64 code for the medium model: The TOC and other static
25976 data may be up to a total of 4G in size. This is the default for 64-bit
25977 Linux.
25978
25979 @item -mcmodel=large
25980 @opindex mcmodel=large
25981 Generate PowerPC64 code for the large model: The TOC may be up to 4G
25982 in size. Other data and code is only limited by the 64-bit address
25983 space.
25984
25985 @item -maltivec
25986 @itemx -mno-altivec
25987 @opindex maltivec
25988 @opindex mno-altivec
25989 Generate code that uses (does not use) AltiVec instructions, and also
25990 enable the use of built-in functions that allow more direct access to
25991 the AltiVec instruction set. You may also need to set
25992 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
25993 enhancements.
25994
25995 When @option{-maltivec} is used, the element order for AltiVec intrinsics
25996 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
25997 match array element order corresponding to the endianness of the
25998 target. That is, element zero identifies the leftmost element in a
25999 vector register when targeting a big-endian platform, and identifies
26000 the rightmost element in a vector register when targeting a
26001 little-endian platform.
26002
26003 @item -mvrsave
26004 @itemx -mno-vrsave
26005 @opindex mvrsave
26006 @opindex mno-vrsave
26007 Generate VRSAVE instructions when generating AltiVec code.
26008
26009 @item -msecure-plt
26010 @opindex msecure-plt
26011 Generate code that allows @command{ld} and @command{ld.so}
26012 to build executables and shared
26013 libraries with non-executable @code{.plt} and @code{.got} sections.
26014 This is a PowerPC
26015 32-bit SYSV ABI option.
26016
26017 @item -mbss-plt
26018 @opindex mbss-plt
26019 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
26020 fills in, and
26021 requires @code{.plt} and @code{.got}
26022 sections that are both writable and executable.
26023 This is a PowerPC 32-bit SYSV ABI option.
26024
26025 @item -misel
26026 @itemx -mno-isel
26027 @opindex misel
26028 @opindex mno-isel
26029 This switch enables or disables the generation of ISEL instructions.
26030
26031 @item -mvsx
26032 @itemx -mno-vsx
26033 @opindex mvsx
26034 @opindex mno-vsx
26035 Generate code that uses (does not use) vector/scalar (VSX)
26036 instructions, and also enable the use of built-in functions that allow
26037 more direct access to the VSX instruction set.
26038
26039 @item -mcrypto
26040 @itemx -mno-crypto
26041 @opindex mcrypto
26042 @opindex mno-crypto
26043 Enable the use (disable) of the built-in functions that allow direct
26044 access to the cryptographic instructions that were added in version
26045 2.07 of the PowerPC ISA.
26046
26047 @item -mhtm
26048 @itemx -mno-htm
26049 @opindex mhtm
26050 @opindex mno-htm
26051 Enable (disable) the use of the built-in functions that allow direct
26052 access to the Hardware Transactional Memory (HTM) instructions that
26053 were added in version 2.07 of the PowerPC ISA.
26054
26055 @item -mpower8-fusion
26056 @itemx -mno-power8-fusion
26057 @opindex mpower8-fusion
26058 @opindex mno-power8-fusion
26059 Generate code that keeps (does not keeps) some integer operations
26060 adjacent so that the instructions can be fused together on power8 and
26061 later processors.
26062
26063 @item -mpower8-vector
26064 @itemx -mno-power8-vector
26065 @opindex mpower8-vector
26066 @opindex mno-power8-vector
26067 Generate code that uses (does not use) the vector and scalar
26068 instructions that were added in version 2.07 of the PowerPC ISA. Also
26069 enable the use of built-in functions that allow more direct access to
26070 the vector instructions.
26071
26072 @item -mquad-memory
26073 @itemx -mno-quad-memory
26074 @opindex mquad-memory
26075 @opindex mno-quad-memory
26076 Generate code that uses (does not use) the non-atomic quad word memory
26077 instructions. The @option{-mquad-memory} option requires use of
26078 64-bit mode.
26079
26080 @item -mquad-memory-atomic
26081 @itemx -mno-quad-memory-atomic
26082 @opindex mquad-memory-atomic
26083 @opindex mno-quad-memory-atomic
26084 Generate code that uses (does not use) the atomic quad word memory
26085 instructions. The @option{-mquad-memory-atomic} option requires use of
26086 64-bit mode.
26087
26088 @item -mfloat128
26089 @itemx -mno-float128
26090 @opindex mfloat128
26091 @opindex mno-float128
26092 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
26093 and use either software emulation for IEEE 128-bit floating point or
26094 hardware instructions.
26095
26096 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
26097 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
26098 use the IEEE 128-bit floating point support. The IEEE 128-bit
26099 floating point support only works on PowerPC Linux systems.
26100
26101 The default for @option{-mfloat128} is enabled on PowerPC Linux
26102 systems using the VSX instruction set, and disabled on other systems.
26103
26104 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
26105 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
26106 point support will also enable the generation of ISA 3.0 IEEE 128-bit
26107 floating point instructions. Otherwise, if you do not specify to
26108 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
26109 system, IEEE 128-bit floating point will be done with software
26110 emulation.
26111
26112 @item -mfloat128-hardware
26113 @itemx -mno-float128-hardware
26114 @opindex mfloat128-hardware
26115 @opindex mno-float128-hardware
26116 Enable/disable using ISA 3.0 hardware instructions to support the
26117 @var{__float128} data type.
26118
26119 The default for @option{-mfloat128-hardware} is enabled on PowerPC
26120 Linux systems using the ISA 3.0 instruction set, and disabled on other
26121 systems.
26122
26123 @item -m32
26124 @itemx -m64
26125 @opindex m32
26126 @opindex m64
26127 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
26128 targets (including GNU/Linux). The 32-bit environment sets int, long
26129 and pointer to 32 bits and generates code that runs on any PowerPC
26130 variant. The 64-bit environment sets int to 32 bits and long and
26131 pointer to 64 bits, and generates code for PowerPC64, as for
26132 @option{-mpowerpc64}.
26133
26134 @item -mfull-toc
26135 @itemx -mno-fp-in-toc
26136 @itemx -mno-sum-in-toc
26137 @itemx -mminimal-toc
26138 @opindex mfull-toc
26139 @opindex mno-fp-in-toc
26140 @opindex mno-sum-in-toc
26141 @opindex mminimal-toc
26142 Modify generation of the TOC (Table Of Contents), which is created for
26143 every executable file. The @option{-mfull-toc} option is selected by
26144 default. In that case, GCC allocates at least one TOC entry for
26145 each unique non-automatic variable reference in your program. GCC
26146 also places floating-point constants in the TOC@. However, only
26147 16,384 entries are available in the TOC@.
26148
26149 If you receive a linker error message that saying you have overflowed
26150 the available TOC space, you can reduce the amount of TOC space used
26151 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
26152 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
26153 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
26154 generate code to calculate the sum of an address and a constant at
26155 run time instead of putting that sum into the TOC@. You may specify one
26156 or both of these options. Each causes GCC to produce very slightly
26157 slower and larger code at the expense of conserving TOC space.
26158
26159 If you still run out of space in the TOC even when you specify both of
26160 these options, specify @option{-mminimal-toc} instead. This option causes
26161 GCC to make only one TOC entry for every file. When you specify this
26162 option, GCC produces code that is slower and larger but which
26163 uses extremely little TOC space. You may wish to use this option
26164 only on files that contain less frequently-executed code.
26165
26166 @item -maix64
26167 @itemx -maix32
26168 @opindex maix64
26169 @opindex maix32
26170 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
26171 @code{long} type, and the infrastructure needed to support them.
26172 Specifying @option{-maix64} implies @option{-mpowerpc64},
26173 while @option{-maix32} disables the 64-bit ABI and
26174 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
26175
26176 @item -mxl-compat
26177 @itemx -mno-xl-compat
26178 @opindex mxl-compat
26179 @opindex mno-xl-compat
26180 Produce code that conforms more closely to IBM XL compiler semantics
26181 when using AIX-compatible ABI@. Pass floating-point arguments to
26182 prototyped functions beyond the register save area (RSA) on the stack
26183 in addition to argument FPRs. Do not assume that most significant
26184 double in 128-bit long double value is properly rounded when comparing
26185 values and converting to double. Use XL symbol names for long double
26186 support routines.
26187
26188 The AIX calling convention was extended but not initially documented to
26189 handle an obscure K&R C case of calling a function that takes the
26190 address of its arguments with fewer arguments than declared. IBM XL
26191 compilers access floating-point arguments that do not fit in the
26192 RSA from the stack when a subroutine is compiled without
26193 optimization. Because always storing floating-point arguments on the
26194 stack is inefficient and rarely needed, this option is not enabled by
26195 default and only is necessary when calling subroutines compiled by IBM
26196 XL compilers without optimization.
26197
26198 @item -mpe
26199 @opindex mpe
26200 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
26201 application written to use message passing with special startup code to
26202 enable the application to run. The system must have PE installed in the
26203 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
26204 must be overridden with the @option{-specs=} option to specify the
26205 appropriate directory location. The Parallel Environment does not
26206 support threads, so the @option{-mpe} option and the @option{-pthread}
26207 option are incompatible.
26208
26209 @item -malign-natural
26210 @itemx -malign-power
26211 @opindex malign-natural
26212 @opindex malign-power
26213 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
26214 @option{-malign-natural} overrides the ABI-defined alignment of larger
26215 types, such as floating-point doubles, on their natural size-based boundary.
26216 The option @option{-malign-power} instructs GCC to follow the ABI-specified
26217 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
26218
26219 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
26220 is not supported.
26221
26222 @item -msoft-float
26223 @itemx -mhard-float
26224 @opindex msoft-float
26225 @opindex mhard-float
26226 Generate code that does not use (uses) the floating-point register set.
26227 Software floating-point emulation is provided if you use the
26228 @option{-msoft-float} option, and pass the option to GCC when linking.
26229
26230 @item -mmultiple
26231 @itemx -mno-multiple
26232 @opindex mmultiple
26233 @opindex mno-multiple
26234 Generate code that uses (does not use) the load multiple word
26235 instructions and the store multiple word instructions. These
26236 instructions are generated by default on POWER systems, and not
26237 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
26238 PowerPC systems, since those instructions do not work when the
26239 processor is in little-endian mode. The exceptions are PPC740 and
26240 PPC750 which permit these instructions in little-endian mode.
26241
26242 @item -mupdate
26243 @itemx -mno-update
26244 @opindex mupdate
26245 @opindex mno-update
26246 Generate code that uses (does not use) the load or store instructions
26247 that update the base register to the address of the calculated memory
26248 location. These instructions are generated by default. If you use
26249 @option{-mno-update}, there is a small window between the time that the
26250 stack pointer is updated and the address of the previous frame is
26251 stored, which means code that walks the stack frame across interrupts or
26252 signals may get corrupted data.
26253
26254 @item -mavoid-indexed-addresses
26255 @itemx -mno-avoid-indexed-addresses
26256 @opindex mavoid-indexed-addresses
26257 @opindex mno-avoid-indexed-addresses
26258 Generate code that tries to avoid (not avoid) the use of indexed load
26259 or store instructions. These instructions can incur a performance
26260 penalty on Power6 processors in certain situations, such as when
26261 stepping through large arrays that cross a 16M boundary. This option
26262 is enabled by default when targeting Power6 and disabled otherwise.
26263
26264 @item -mfused-madd
26265 @itemx -mno-fused-madd
26266 @opindex mfused-madd
26267 @opindex mno-fused-madd
26268 Generate code that uses (does not use) the floating-point multiply and
26269 accumulate instructions. These instructions are generated by default
26270 if hardware floating point is used. The machine-dependent
26271 @option{-mfused-madd} option is now mapped to the machine-independent
26272 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26273 mapped to @option{-ffp-contract=off}.
26274
26275 @item -mmulhw
26276 @itemx -mno-mulhw
26277 @opindex mmulhw
26278 @opindex mno-mulhw
26279 Generate code that uses (does not use) the half-word multiply and
26280 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
26281 These instructions are generated by default when targeting those
26282 processors.
26283
26284 @item -mdlmzb
26285 @itemx -mno-dlmzb
26286 @opindex mdlmzb
26287 @opindex mno-dlmzb
26288 Generate code that uses (does not use) the string-search @samp{dlmzb}
26289 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
26290 generated by default when targeting those processors.
26291
26292 @item -mno-bit-align
26293 @itemx -mbit-align
26294 @opindex mno-bit-align
26295 @opindex mbit-align
26296 On System V.4 and embedded PowerPC systems do not (do) force structures
26297 and unions that contain bit-fields to be aligned to the base type of the
26298 bit-field.
26299
26300 For example, by default a structure containing nothing but 8
26301 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
26302 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
26303 the structure is aligned to a 1-byte boundary and is 1 byte in
26304 size.
26305
26306 @item -mno-strict-align
26307 @itemx -mstrict-align
26308 @opindex mno-strict-align
26309 @opindex mstrict-align
26310 On System V.4 and embedded PowerPC systems do not (do) assume that
26311 unaligned memory references are handled by the system.
26312
26313 @item -mrelocatable
26314 @itemx -mno-relocatable
26315 @opindex mrelocatable
26316 @opindex mno-relocatable
26317 Generate code that allows (does not allow) a static executable to be
26318 relocated to a different address at run time. A simple embedded
26319 PowerPC system loader should relocate the entire contents of
26320 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
26321 a table of 32-bit addresses generated by this option. For this to
26322 work, all objects linked together must be compiled with
26323 @option{-mrelocatable} or @option{-mrelocatable-lib}.
26324 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
26325
26326 @item -mrelocatable-lib
26327 @itemx -mno-relocatable-lib
26328 @opindex mrelocatable-lib
26329 @opindex mno-relocatable-lib
26330 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
26331 @code{.fixup} section to allow static executables to be relocated at
26332 run time, but @option{-mrelocatable-lib} does not use the smaller stack
26333 alignment of @option{-mrelocatable}. Objects compiled with
26334 @option{-mrelocatable-lib} may be linked with objects compiled with
26335 any combination of the @option{-mrelocatable} options.
26336
26337 @item -mno-toc
26338 @itemx -mtoc
26339 @opindex mno-toc
26340 @opindex mtoc
26341 On System V.4 and embedded PowerPC systems do not (do) assume that
26342 register 2 contains a pointer to a global area pointing to the addresses
26343 used in the program.
26344
26345 @item -mlittle
26346 @itemx -mlittle-endian
26347 @opindex mlittle
26348 @opindex mlittle-endian
26349 On System V.4 and embedded PowerPC systems compile code for the
26350 processor in little-endian mode. The @option{-mlittle-endian} option is
26351 the same as @option{-mlittle}.
26352
26353 @item -mbig
26354 @itemx -mbig-endian
26355 @opindex mbig
26356 @opindex mbig-endian
26357 On System V.4 and embedded PowerPC systems compile code for the
26358 processor in big-endian mode. The @option{-mbig-endian} option is
26359 the same as @option{-mbig}.
26360
26361 @item -mdynamic-no-pic
26362 @opindex mdynamic-no-pic
26363 On Darwin and Mac OS X systems, compile code so that it is not
26364 relocatable, but that its external references are relocatable. The
26365 resulting code is suitable for applications, but not shared
26366 libraries.
26367
26368 @item -msingle-pic-base
26369 @opindex msingle-pic-base
26370 Treat the register used for PIC addressing as read-only, rather than
26371 loading it in the prologue for each function. The runtime system is
26372 responsible for initializing this register with an appropriate value
26373 before execution begins.
26374
26375 @item -mprioritize-restricted-insns=@var{priority}
26376 @opindex mprioritize-restricted-insns
26377 This option controls the priority that is assigned to
26378 dispatch-slot restricted instructions during the second scheduling
26379 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
26380 or @samp{2} to assign no, highest, or second-highest (respectively)
26381 priority to dispatch-slot restricted
26382 instructions.
26383
26384 @item -msched-costly-dep=@var{dependence_type}
26385 @opindex msched-costly-dep
26386 This option controls which dependences are considered costly
26387 by the target during instruction scheduling. The argument
26388 @var{dependence_type} takes one of the following values:
26389
26390 @table @asis
26391 @item @samp{no}
26392 No dependence is costly.
26393
26394 @item @samp{all}
26395 All dependences are costly.
26396
26397 @item @samp{true_store_to_load}
26398 A true dependence from store to load is costly.
26399
26400 @item @samp{store_to_load}
26401 Any dependence from store to load is costly.
26402
26403 @item @var{number}
26404 Any dependence for which the latency is greater than or equal to
26405 @var{number} is costly.
26406 @end table
26407
26408 @item -minsert-sched-nops=@var{scheme}
26409 @opindex minsert-sched-nops
26410 This option controls which NOP insertion scheme is used during
26411 the second scheduling pass. The argument @var{scheme} takes one of the
26412 following values:
26413
26414 @table @asis
26415 @item @samp{no}
26416 Don't insert NOPs.
26417
26418 @item @samp{pad}
26419 Pad with NOPs any dispatch group that has vacant issue slots,
26420 according to the scheduler's grouping.
26421
26422 @item @samp{regroup_exact}
26423 Insert NOPs to force costly dependent insns into
26424 separate groups. Insert exactly as many NOPs as needed to force an insn
26425 to a new group, according to the estimated processor grouping.
26426
26427 @item @var{number}
26428 Insert NOPs to force costly dependent insns into
26429 separate groups. Insert @var{number} NOPs to force an insn to a new group.
26430 @end table
26431
26432 @item -mcall-sysv
26433 @opindex mcall-sysv
26434 On System V.4 and embedded PowerPC systems compile code using calling
26435 conventions that adhere to the March 1995 draft of the System V
26436 Application Binary Interface, PowerPC processor supplement. This is the
26437 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
26438
26439 @item -mcall-sysv-eabi
26440 @itemx -mcall-eabi
26441 @opindex mcall-sysv-eabi
26442 @opindex mcall-eabi
26443 Specify both @option{-mcall-sysv} and @option{-meabi} options.
26444
26445 @item -mcall-sysv-noeabi
26446 @opindex mcall-sysv-noeabi
26447 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
26448
26449 @item -mcall-aixdesc
26450 @opindex m
26451 On System V.4 and embedded PowerPC systems compile code for the AIX
26452 operating system.
26453
26454 @item -mcall-linux
26455 @opindex mcall-linux
26456 On System V.4 and embedded PowerPC systems compile code for the
26457 Linux-based GNU system.
26458
26459 @item -mcall-freebsd
26460 @opindex mcall-freebsd
26461 On System V.4 and embedded PowerPC systems compile code for the
26462 FreeBSD operating system.
26463
26464 @item -mcall-netbsd
26465 @opindex mcall-netbsd
26466 On System V.4 and embedded PowerPC systems compile code for the
26467 NetBSD operating system.
26468
26469 @item -mcall-openbsd
26470 @opindex mcall-netbsd
26471 On System V.4 and embedded PowerPC systems compile code for the
26472 OpenBSD operating system.
26473
26474 @item -mtraceback=@var{traceback_type}
26475 @opindex mtraceback
26476 Select the type of traceback table. Valid values for @var{traceback_type}
26477 are @samp{full}, @samp{part}, and @samp{no}.
26478
26479 @item -maix-struct-return
26480 @opindex maix-struct-return
26481 Return all structures in memory (as specified by the AIX ABI)@.
26482
26483 @item -msvr4-struct-return
26484 @opindex msvr4-struct-return
26485 Return structures smaller than 8 bytes in registers (as specified by the
26486 SVR4 ABI)@.
26487
26488 @item -mabi=@var{abi-type}
26489 @opindex mabi
26490 Extend the current ABI with a particular extension, or remove such extension.
26491 Valid values are @samp{altivec}, @samp{no-altivec},
26492 @samp{ibmlongdouble}, @samp{ieeelongdouble},
26493 @samp{elfv1}, @samp{elfv2}@.
26494
26495 @item -mabi=ibmlongdouble
26496 @opindex mabi=ibmlongdouble
26497 Change the current ABI to use IBM extended-precision long double.
26498 This is not likely to work if your system defaults to using IEEE
26499 extended-precision long double. If you change the long double type
26500 from IEEE extended-precision, the compiler will issue a warning unless
26501 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26502 to be enabled.
26503
26504 @item -mabi=ieeelongdouble
26505 @opindex mabi=ieeelongdouble
26506 Change the current ABI to use IEEE extended-precision long double.
26507 This is not likely to work if your system defaults to using IBM
26508 extended-precision long double. If you change the long double type
26509 from IBM extended-precision, the compiler will issue a warning unless
26510 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26511 to be enabled.
26512
26513 @item -mabi=elfv1
26514 @opindex mabi=elfv1
26515 Change the current ABI to use the ELFv1 ABI.
26516 This is the default ABI for big-endian PowerPC 64-bit Linux.
26517 Overriding the default ABI requires special system support and is
26518 likely to fail in spectacular ways.
26519
26520 @item -mabi=elfv2
26521 @opindex mabi=elfv2
26522 Change the current ABI to use the ELFv2 ABI.
26523 This is the default ABI for little-endian PowerPC 64-bit Linux.
26524 Overriding the default ABI requires special system support and is
26525 likely to fail in spectacular ways.
26526
26527 @item -mgnu-attribute
26528 @itemx -mno-gnu-attribute
26529 @opindex mgnu-attribute
26530 @opindex mno-gnu-attribute
26531 Emit .gnu_attribute assembly directives to set tag/value pairs in a
26532 .gnu.attributes section that specify ABI variations in function
26533 parameters or return values.
26534
26535 @item -mprototype
26536 @itemx -mno-prototype
26537 @opindex mprototype
26538 @opindex mno-prototype
26539 On System V.4 and embedded PowerPC systems assume that all calls to
26540 variable argument functions are properly prototyped. Otherwise, the
26541 compiler must insert an instruction before every non-prototyped call to
26542 set or clear bit 6 of the condition code register (@code{CR}) to
26543 indicate whether floating-point values are passed in the floating-point
26544 registers in case the function takes variable arguments. With
26545 @option{-mprototype}, only calls to prototyped variable argument functions
26546 set or clear the bit.
26547
26548 @item -msim
26549 @opindex msim
26550 On embedded PowerPC systems, assume that the startup module is called
26551 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26552 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
26553 configurations.
26554
26555 @item -mmvme
26556 @opindex mmvme
26557 On embedded PowerPC systems, assume that the startup module is called
26558 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26559 @file{libc.a}.
26560
26561 @item -mads
26562 @opindex mads
26563 On embedded PowerPC systems, assume that the startup module is called
26564 @file{crt0.o} and the standard C libraries are @file{libads.a} and
26565 @file{libc.a}.
26566
26567 @item -myellowknife
26568 @opindex myellowknife
26569 On embedded PowerPC systems, assume that the startup module is called
26570 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
26571 @file{libc.a}.
26572
26573 @item -mvxworks
26574 @opindex mvxworks
26575 On System V.4 and embedded PowerPC systems, specify that you are
26576 compiling for a VxWorks system.
26577
26578 @item -memb
26579 @opindex memb
26580 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26581 header to indicate that @samp{eabi} extended relocations are used.
26582
26583 @item -meabi
26584 @itemx -mno-eabi
26585 @opindex meabi
26586 @opindex mno-eabi
26587 On System V.4 and embedded PowerPC systems do (do not) adhere to the
26588 Embedded Applications Binary Interface (EABI), which is a set of
26589 modifications to the System V.4 specifications. Selecting @option{-meabi}
26590 means that the stack is aligned to an 8-byte boundary, a function
26591 @code{__eabi} is called from @code{main} to set up the EABI
26592 environment, and the @option{-msdata} option can use both @code{r2} and
26593 @code{r13} to point to two separate small data areas. Selecting
26594 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26595 no EABI initialization function is called from @code{main}, and the
26596 @option{-msdata} option only uses @code{r13} to point to a single
26597 small data area. The @option{-meabi} option is on by default if you
26598 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26599
26600 @item -msdata=eabi
26601 @opindex msdata=eabi
26602 On System V.4 and embedded PowerPC systems, put small initialized
26603 @code{const} global and static data in the @code{.sdata2} section, which
26604 is pointed to by register @code{r2}. Put small initialized
26605 non-@code{const} global and static data in the @code{.sdata} section,
26606 which is pointed to by register @code{r13}. Put small uninitialized
26607 global and static data in the @code{.sbss} section, which is adjacent to
26608 the @code{.sdata} section. The @option{-msdata=eabi} option is
26609 incompatible with the @option{-mrelocatable} option. The
26610 @option{-msdata=eabi} option also sets the @option{-memb} option.
26611
26612 @item -msdata=sysv
26613 @opindex msdata=sysv
26614 On System V.4 and embedded PowerPC systems, put small global and static
26615 data in the @code{.sdata} section, which is pointed to by register
26616 @code{r13}. Put small uninitialized global and static data in the
26617 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
26618 The @option{-msdata=sysv} option is incompatible with the
26619 @option{-mrelocatable} option.
26620
26621 @item -msdata=default
26622 @itemx -msdata
26623 @opindex msdata=default
26624 @opindex msdata
26625 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26626 compile code the same as @option{-msdata=eabi}, otherwise compile code the
26627 same as @option{-msdata=sysv}.
26628
26629 @item -msdata=data
26630 @opindex msdata=data
26631 On System V.4 and embedded PowerPC systems, put small global
26632 data in the @code{.sdata} section. Put small uninitialized global
26633 data in the @code{.sbss} section. Do not use register @code{r13}
26634 to address small data however. This is the default behavior unless
26635 other @option{-msdata} options are used.
26636
26637 @item -msdata=none
26638 @itemx -mno-sdata
26639 @opindex msdata=none
26640 @opindex mno-sdata
26641 On embedded PowerPC systems, put all initialized global and static data
26642 in the @code{.data} section, and all uninitialized data in the
26643 @code{.bss} section.
26644
26645 @item -mreadonly-in-sdata
26646 @opindex mreadonly-in-sdata
26647 @opindex mno-readonly-in-sdata
26648 Put read-only objects in the @code{.sdata} section as well. This is the
26649 default.
26650
26651 @item -mblock-move-inline-limit=@var{num}
26652 @opindex mblock-move-inline-limit
26653 Inline all block moves (such as calls to @code{memcpy} or structure
26654 copies) less than or equal to @var{num} bytes. The minimum value for
26655 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26656 targets. The default value is target-specific.
26657
26658 @item -mblock-compare-inline-limit=@var{num}
26659 @opindex mblock-compare-inline-limit
26660 Generate non-looping inline code for all block compares (such as calls
26661 to @code{memcmp} or structure compares) less than or equal to @var{num}
26662 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26663 block compare is disabled. The default value is target-specific.
26664
26665 @item -mblock-compare-inline-loop-limit=@var{num}
26666 @opindex mblock-compare-inline-loop-limit
26667 Generate an inline expansion using loop code for all block compares that
26668 are less than or equal to @var{num} bytes, but greater than the limit
26669 for non-loop inline block compare expansion. If the block length is not
26670 constant, at most @var{num} bytes will be compared before @code{memcmp}
26671 is called to compare the remainder of the block. The default value is
26672 target-specific.
26673
26674 @item -mstring-compare-inline-limit=@var{num}
26675 @opindex mstring-compare-inline-limit
26676 Compare at most @var{num} string bytes with inline code.
26677 If the difference or end of string is not found at the
26678 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26679 take care of the rest of the comparison. The default is 64 bytes.
26680
26681 @item -G @var{num}
26682 @opindex G
26683 @cindex smaller data references (PowerPC)
26684 @cindex .sdata/.sdata2 references (PowerPC)
26685 On embedded PowerPC systems, put global and static items less than or
26686 equal to @var{num} bytes into the small data or BSS sections instead of
26687 the normal data or BSS section. By default, @var{num} is 8. The
26688 @option{-G @var{num}} switch is also passed to the linker.
26689 All modules should be compiled with the same @option{-G @var{num}} value.
26690
26691 @item -mregnames
26692 @itemx -mno-regnames
26693 @opindex mregnames
26694 @opindex mno-regnames
26695 On System V.4 and embedded PowerPC systems do (do not) emit register
26696 names in the assembly language output using symbolic forms.
26697
26698 @item -mlongcall
26699 @itemx -mno-longcall
26700 @opindex mlongcall
26701 @opindex mno-longcall
26702 By default assume that all calls are far away so that a longer and more
26703 expensive calling sequence is required. This is required for calls
26704 farther than 32 megabytes (33,554,432 bytes) from the current location.
26705 A short call is generated if the compiler knows
26706 the call cannot be that far away. This setting can be overridden by
26707 the @code{shortcall} function attribute, or by @code{#pragma
26708 longcall(0)}.
26709
26710 Some linkers are capable of detecting out-of-range calls and generating
26711 glue code on the fly. On these systems, long calls are unnecessary and
26712 generate slower code. As of this writing, the AIX linker can do this,
26713 as can the GNU linker for PowerPC/64. It is planned to add this feature
26714 to the GNU linker for 32-bit PowerPC systems as well.
26715
26716 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26717 GCC can generate long calls using an inline PLT call sequence (see
26718 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
26719 ELFv1 (big-endian) do not support inline PLT calls.
26720
26721 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26722 callee, L42}, plus a @dfn{branch island} (glue code). The two target
26723 addresses represent the callee and the branch island. The
26724 Darwin/PPC linker prefers the first address and generates a @code{bl
26725 callee} if the PPC @code{bl} instruction reaches the callee directly;
26726 otherwise, the linker generates @code{bl L42} to call the branch
26727 island. The branch island is appended to the body of the
26728 calling function; it computes the full 32-bit address of the callee
26729 and jumps to it.
26730
26731 On Mach-O (Darwin) systems, this option directs the compiler emit to
26732 the glue for every direct call, and the Darwin linker decides whether
26733 to use or discard it.
26734
26735 In the future, GCC may ignore all longcall specifications
26736 when the linker is known to generate glue.
26737
26738 @item -mpltseq
26739 @itemx -mno-pltseq
26740 @opindex mpltseq
26741 @opindex mno-pltseq
26742 Implement (do not implement) -fno-plt and long calls using an inline
26743 PLT call sequence that supports lazy linking and long calls to
26744 functions in dlopen'd shared libraries. Inline PLT calls are only
26745 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26746 linkers, and are enabled by default if the support is detected when
26747 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26748 configured with @option{--enable-secureplt}. @option{-mpltseq} code
26749 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26750 linked together.
26751
26752 @item -mtls-markers
26753 @itemx -mno-tls-markers
26754 @opindex mtls-markers
26755 @opindex mno-tls-markers
26756 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26757 specifying the function argument. The relocation allows the linker to
26758 reliably associate function call with argument setup instructions for
26759 TLS optimization, which in turn allows GCC to better schedule the
26760 sequence.
26761
26762 @item -mrecip
26763 @itemx -mno-recip
26764 @opindex mrecip
26765 This option enables use of the reciprocal estimate and
26766 reciprocal square root estimate instructions with additional
26767 Newton-Raphson steps to increase precision instead of doing a divide or
26768 square root and divide for floating-point arguments. You should use
26769 the @option{-ffast-math} option when using @option{-mrecip} (or at
26770 least @option{-funsafe-math-optimizations},
26771 @option{-ffinite-math-only}, @option{-freciprocal-math} and
26772 @option{-fno-trapping-math}). Note that while the throughput of the
26773 sequence is generally higher than the throughput of the non-reciprocal
26774 instruction, the precision of the sequence can be decreased by up to 2
26775 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26776 roots.
26777
26778 @item -mrecip=@var{opt}
26779 @opindex mrecip=opt
26780 This option controls which reciprocal estimate instructions
26781 may be used. @var{opt} is a comma-separated list of options, which may
26782 be preceded by a @code{!} to invert the option:
26783
26784 @table @samp
26785
26786 @item all
26787 Enable all estimate instructions.
26788
26789 @item default
26790 Enable the default instructions, equivalent to @option{-mrecip}.
26791
26792 @item none
26793 Disable all estimate instructions, equivalent to @option{-mno-recip}.
26794
26795 @item div
26796 Enable the reciprocal approximation instructions for both
26797 single and double precision.
26798
26799 @item divf
26800 Enable the single-precision reciprocal approximation instructions.
26801
26802 @item divd
26803 Enable the double-precision reciprocal approximation instructions.
26804
26805 @item rsqrt
26806 Enable the reciprocal square root approximation instructions for both
26807 single and double precision.
26808
26809 @item rsqrtf
26810 Enable the single-precision reciprocal square root approximation instructions.
26811
26812 @item rsqrtd
26813 Enable the double-precision reciprocal square root approximation instructions.
26814
26815 @end table
26816
26817 So, for example, @option{-mrecip=all,!rsqrtd} enables
26818 all of the reciprocal estimate instructions, except for the
26819 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26820 which handle the double-precision reciprocal square root calculations.
26821
26822 @item -mrecip-precision
26823 @itemx -mno-recip-precision
26824 @opindex mrecip-precision
26825 Assume (do not assume) that the reciprocal estimate instructions
26826 provide higher-precision estimates than is mandated by the PowerPC
26827 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26828 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26829 The double-precision square root estimate instructions are not generated by
26830 default on low-precision machines, since they do not provide an
26831 estimate that converges after three steps.
26832
26833 @item -mveclibabi=@var{type}
26834 @opindex mveclibabi
26835 Specifies the ABI type to use for vectorizing intrinsics using an
26836 external library. The only type supported at present is @samp{mass},
26837 which specifies to use IBM's Mathematical Acceleration Subsystem
26838 (MASS) libraries for vectorizing intrinsics using external libraries.
26839 GCC currently emits calls to @code{acosd2}, @code{acosf4},
26840 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
26841 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
26842 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
26843 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
26844 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
26845 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
26846 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
26847 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
26848 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
26849 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
26850 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
26851 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
26852 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
26853 for power7. Both @option{-ftree-vectorize} and
26854 @option{-funsafe-math-optimizations} must also be enabled. The MASS
26855 libraries must be specified at link time.
26856
26857 @item -mfriz
26858 @itemx -mno-friz
26859 @opindex mfriz
26860 Generate (do not generate) the @code{friz} instruction when the
26861 @option{-funsafe-math-optimizations} option is used to optimize
26862 rounding of floating-point values to 64-bit integer and back to floating
26863 point. The @code{friz} instruction does not return the same value if
26864 the floating-point number is too large to fit in an integer.
26865
26866 @item -mpointers-to-nested-functions
26867 @itemx -mno-pointers-to-nested-functions
26868 @opindex mpointers-to-nested-functions
26869 Generate (do not generate) code to load up the static chain register
26870 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
26871 systems where a function pointer points to a 3-word descriptor giving
26872 the function address, TOC value to be loaded in register @code{r2}, and
26873 static chain value to be loaded in register @code{r11}. The
26874 @option{-mpointers-to-nested-functions} is on by default. You cannot
26875 call through pointers to nested functions or pointers
26876 to functions compiled in other languages that use the static chain if
26877 you use @option{-mno-pointers-to-nested-functions}.
26878
26879 @item -msave-toc-indirect
26880 @itemx -mno-save-toc-indirect
26881 @opindex msave-toc-indirect
26882 Generate (do not generate) code to save the TOC value in the reserved
26883 stack location in the function prologue if the function calls through
26884 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
26885 saved in the prologue, it is saved just before the call through the
26886 pointer. The @option{-mno-save-toc-indirect} option is the default.
26887
26888 @item -mcompat-align-parm
26889 @itemx -mno-compat-align-parm
26890 @opindex mcompat-align-parm
26891 Generate (do not generate) code to pass structure parameters with a
26892 maximum alignment of 64 bits, for compatibility with older versions
26893 of GCC.
26894
26895 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26896 structure parameter on a 128-bit boundary when that structure contained
26897 a member requiring 128-bit alignment. This is corrected in more
26898 recent versions of GCC. This option may be used to generate code
26899 that is compatible with functions compiled with older versions of
26900 GCC.
26901
26902 The @option{-mno-compat-align-parm} option is the default.
26903
26904 @item -mstack-protector-guard=@var{guard}
26905 @itemx -mstack-protector-guard-reg=@var{reg}
26906 @itemx -mstack-protector-guard-offset=@var{offset}
26907 @itemx -mstack-protector-guard-symbol=@var{symbol}
26908 @opindex mstack-protector-guard
26909 @opindex mstack-protector-guard-reg
26910 @opindex mstack-protector-guard-offset
26911 @opindex mstack-protector-guard-symbol
26912 Generate stack protection code using canary at @var{guard}. Supported
26913 locations are @samp{global} for global canary or @samp{tls} for per-thread
26914 canary in the TLS block (the default with GNU libc version 2.4 or later).
26915
26916 With the latter choice the options
26917 @option{-mstack-protector-guard-reg=@var{reg}} and
26918 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26919 which register to use as base register for reading the canary, and from what
26920 offset from that base register. The default for those is as specified in the
26921 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
26922 the offset with a symbol reference to a canary in the TLS block.
26923
26924 @item -mpcrel
26925 @itemx -mno-pcrel
26926 @opindex mpcrel
26927 @opindex mno-pcrel
26928 Generate (do not generate) pc-relative addressing when the option
26929 @option{-mcpu=future} is used. The @option{-mpcrel} option requires
26930 that the medium code model (@option{-mcmodel=medium}) and prefixed
26931 addressing (@option{-mprefixed}) options are enabled.
26932
26933 @item -mprefixed
26934 @itemx -mno-prefixed
26935 @opindex mprefixed
26936 @opindex mno-prefixed
26937 Generate (do not generate) addressing modes using prefixed load and
26938 store instructions when the option @option{-mcpu=future} is used.
26939 @end table
26940
26941 @node RX Options
26942 @subsection RX Options
26943 @cindex RX Options
26944
26945 These command-line options are defined for RX targets:
26946
26947 @table @gcctabopt
26948 @item -m64bit-doubles
26949 @itemx -m32bit-doubles
26950 @opindex m64bit-doubles
26951 @opindex m32bit-doubles
26952 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26953 or 32 bits (@option{-m32bit-doubles}) in size. The default is
26954 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
26955 works on 32-bit values, which is why the default is
26956 @option{-m32bit-doubles}.
26957
26958 @item -fpu
26959 @itemx -nofpu
26960 @opindex fpu
26961 @opindex nofpu
26962 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
26963 floating-point hardware. The default is enabled for the RX600
26964 series and disabled for the RX200 series.
26965
26966 Floating-point instructions are only generated for 32-bit floating-point
26967 values, however, so the FPU hardware is not used for doubles if the
26968 @option{-m64bit-doubles} option is used.
26969
26970 @emph{Note} If the @option{-fpu} option is enabled then
26971 @option{-funsafe-math-optimizations} is also enabled automatically.
26972 This is because the RX FPU instructions are themselves unsafe.
26973
26974 @item -mcpu=@var{name}
26975 @opindex mcpu
26976 Selects the type of RX CPU to be targeted. Currently three types are
26977 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
26978 the specific @samp{RX610} CPU. The default is @samp{RX600}.
26979
26980 The only difference between @samp{RX600} and @samp{RX610} is that the
26981 @samp{RX610} does not support the @code{MVTIPL} instruction.
26982
26983 The @samp{RX200} series does not have a hardware floating-point unit
26984 and so @option{-nofpu} is enabled by default when this type is
26985 selected.
26986
26987 @item -mbig-endian-data
26988 @itemx -mlittle-endian-data
26989 @opindex mbig-endian-data
26990 @opindex mlittle-endian-data
26991 Store data (but not code) in the big-endian format. The default is
26992 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
26993 format.
26994
26995 @item -msmall-data-limit=@var{N}
26996 @opindex msmall-data-limit
26997 Specifies the maximum size in bytes of global and static variables
26998 which can be placed into the small data area. Using the small data
26999 area can lead to smaller and faster code, but the size of area is
27000 limited and it is up to the programmer to ensure that the area does
27001 not overflow. Also when the small data area is used one of the RX's
27002 registers (usually @code{r13}) is reserved for use pointing to this
27003 area, so it is no longer available for use by the compiler. This
27004 could result in slower and/or larger code if variables are pushed onto
27005 the stack instead of being held in this register.
27006
27007 Note, common variables (variables that have not been initialized) and
27008 constants are not placed into the small data area as they are assigned
27009 to other sections in the output executable.
27010
27011 The default value is zero, which disables this feature. Note, this
27012 feature is not enabled by default with higher optimization levels
27013 (@option{-O2} etc) because of the potentially detrimental effects of
27014 reserving a register. It is up to the programmer to experiment and
27015 discover whether this feature is of benefit to their program. See the
27016 description of the @option{-mpid} option for a description of how the
27017 actual register to hold the small data area pointer is chosen.
27018
27019 @item -msim
27020 @itemx -mno-sim
27021 @opindex msim
27022 @opindex mno-sim
27023 Use the simulator runtime. The default is to use the libgloss
27024 board-specific runtime.
27025
27026 @item -mas100-syntax
27027 @itemx -mno-as100-syntax
27028 @opindex mas100-syntax
27029 @opindex mno-as100-syntax
27030 When generating assembler output use a syntax that is compatible with
27031 Renesas's AS100 assembler. This syntax can also be handled by the GAS
27032 assembler, but it has some restrictions so it is not generated by default.
27033
27034 @item -mmax-constant-size=@var{N}
27035 @opindex mmax-constant-size
27036 Specifies the maximum size, in bytes, of a constant that can be used as
27037 an operand in a RX instruction. Although the RX instruction set does
27038 allow constants of up to 4 bytes in length to be used in instructions,
27039 a longer value equates to a longer instruction. Thus in some
27040 circumstances it can be beneficial to restrict the size of constants
27041 that are used in instructions. Constants that are too big are instead
27042 placed into a constant pool and referenced via register indirection.
27043
27044 The value @var{N} can be between 0 and 4. A value of 0 (the default)
27045 or 4 means that constants of any size are allowed.
27046
27047 @item -mrelax
27048 @opindex mrelax
27049 Enable linker relaxation. Linker relaxation is a process whereby the
27050 linker attempts to reduce the size of a program by finding shorter
27051 versions of various instructions. Disabled by default.
27052
27053 @item -mint-register=@var{N}
27054 @opindex mint-register
27055 Specify the number of registers to reserve for fast interrupt handler
27056 functions. The value @var{N} can be between 0 and 4. A value of 1
27057 means that register @code{r13} is reserved for the exclusive use
27058 of fast interrupt handlers. A value of 2 reserves @code{r13} and
27059 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
27060 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
27061 A value of 0, the default, does not reserve any registers.
27062
27063 @item -msave-acc-in-interrupts
27064 @opindex msave-acc-in-interrupts
27065 Specifies that interrupt handler functions should preserve the
27066 accumulator register. This is only necessary if normal code might use
27067 the accumulator register, for example because it performs 64-bit
27068 multiplications. The default is to ignore the accumulator as this
27069 makes the interrupt handlers faster.
27070
27071 @item -mpid
27072 @itemx -mno-pid
27073 @opindex mpid
27074 @opindex mno-pid
27075 Enables the generation of position independent data. When enabled any
27076 access to constant data is done via an offset from a base address
27077 held in a register. This allows the location of constant data to be
27078 determined at run time without requiring the executable to be
27079 relocated, which is a benefit to embedded applications with tight
27080 memory constraints. Data that can be modified is not affected by this
27081 option.
27082
27083 Note, using this feature reserves a register, usually @code{r13}, for
27084 the constant data base address. This can result in slower and/or
27085 larger code, especially in complicated functions.
27086
27087 The actual register chosen to hold the constant data base address
27088 depends upon whether the @option{-msmall-data-limit} and/or the
27089 @option{-mint-register} command-line options are enabled. Starting
27090 with register @code{r13} and proceeding downwards, registers are
27091 allocated first to satisfy the requirements of @option{-mint-register},
27092 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
27093 is possible for the small data area register to be @code{r8} if both
27094 @option{-mint-register=4} and @option{-mpid} are specified on the
27095 command line.
27096
27097 By default this feature is not enabled. The default can be restored
27098 via the @option{-mno-pid} command-line option.
27099
27100 @item -mno-warn-multiple-fast-interrupts
27101 @itemx -mwarn-multiple-fast-interrupts
27102 @opindex mno-warn-multiple-fast-interrupts
27103 @opindex mwarn-multiple-fast-interrupts
27104 Prevents GCC from issuing a warning message if it finds more than one
27105 fast interrupt handler when it is compiling a file. The default is to
27106 issue a warning for each extra fast interrupt handler found, as the RX
27107 only supports one such interrupt.
27108
27109 @item -mallow-string-insns
27110 @itemx -mno-allow-string-insns
27111 @opindex mallow-string-insns
27112 @opindex mno-allow-string-insns
27113 Enables or disables the use of the string manipulation instructions
27114 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
27115 @code{SWHILE} and also the @code{RMPA} instruction. These
27116 instructions may prefetch data, which is not safe to do if accessing
27117 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
27118 for more information).
27119
27120 The default is to allow these instructions, but it is not possible for
27121 GCC to reliably detect all circumstances where a string instruction
27122 might be used to access an I/O register, so their use cannot be
27123 disabled automatically. Instead it is reliant upon the programmer to
27124 use the @option{-mno-allow-string-insns} option if their program
27125 accesses I/O space.
27126
27127 When the instructions are enabled GCC defines the C preprocessor
27128 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
27129 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
27130
27131 @item -mjsr
27132 @itemx -mno-jsr
27133 @opindex mjsr
27134 @opindex mno-jsr
27135 Use only (or not only) @code{JSR} instructions to access functions.
27136 This option can be used when code size exceeds the range of @code{BSR}
27137 instructions. Note that @option{-mno-jsr} does not mean to not use
27138 @code{JSR} but instead means that any type of branch may be used.
27139 @end table
27140
27141 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
27142 has special significance to the RX port when used with the
27143 @code{interrupt} function attribute. This attribute indicates a
27144 function intended to process fast interrupts. GCC ensures
27145 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
27146 and/or @code{r13} and only provided that the normal use of the
27147 corresponding registers have been restricted via the
27148 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
27149 options.
27150
27151 @node S/390 and zSeries Options
27152 @subsection S/390 and zSeries Options
27153 @cindex S/390 and zSeries Options
27154
27155 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
27156
27157 @table @gcctabopt
27158 @item -mhard-float
27159 @itemx -msoft-float
27160 @opindex mhard-float
27161 @opindex msoft-float
27162 Use (do not use) the hardware floating-point instructions and registers
27163 for floating-point operations. When @option{-msoft-float} is specified,
27164 functions in @file{libgcc.a} are used to perform floating-point
27165 operations. When @option{-mhard-float} is specified, the compiler
27166 generates IEEE floating-point instructions. This is the default.
27167
27168 @item -mhard-dfp
27169 @itemx -mno-hard-dfp
27170 @opindex mhard-dfp
27171 @opindex mno-hard-dfp
27172 Use (do not use) the hardware decimal-floating-point instructions for
27173 decimal-floating-point operations. When @option{-mno-hard-dfp} is
27174 specified, functions in @file{libgcc.a} are used to perform
27175 decimal-floating-point operations. When @option{-mhard-dfp} is
27176 specified, the compiler generates decimal-floating-point hardware
27177 instructions. This is the default for @option{-march=z9-ec} or higher.
27178
27179 @item -mlong-double-64
27180 @itemx -mlong-double-128
27181 @opindex mlong-double-64
27182 @opindex mlong-double-128
27183 These switches control the size of @code{long double} type. A size
27184 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27185 type. This is the default.
27186
27187 @item -mbackchain
27188 @itemx -mno-backchain
27189 @opindex mbackchain
27190 @opindex mno-backchain
27191 Store (do not store) the address of the caller's frame as backchain pointer
27192 into the callee's stack frame.
27193 A backchain may be needed to allow debugging using tools that do not understand
27194 DWARF call frame information.
27195 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
27196 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
27197 the backchain is placed into the topmost word of the 96/160 byte register
27198 save area.
27199
27200 In general, code compiled with @option{-mbackchain} is call-compatible with
27201 code compiled with @option{-mmo-backchain}; however, use of the backchain
27202 for debugging purposes usually requires that the whole binary is built with
27203 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
27204 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
27205 to build a linux kernel use @option{-msoft-float}.
27206
27207 The default is to not maintain the backchain.
27208
27209 @item -mpacked-stack
27210 @itemx -mno-packed-stack
27211 @opindex mpacked-stack
27212 @opindex mno-packed-stack
27213 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
27214 specified, the compiler uses the all fields of the 96/160 byte register save
27215 area only for their default purpose; unused fields still take up stack space.
27216 When @option{-mpacked-stack} is specified, register save slots are densely
27217 packed at the top of the register save area; unused space is reused for other
27218 purposes, allowing for more efficient use of the available stack space.
27219 However, when @option{-mbackchain} is also in effect, the topmost word of
27220 the save area is always used to store the backchain, and the return address
27221 register is always saved two words below the backchain.
27222
27223 As long as the stack frame backchain is not used, code generated with
27224 @option{-mpacked-stack} is call-compatible with code generated with
27225 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
27226 S/390 or zSeries generated code that uses the stack frame backchain at run
27227 time, not just for debugging purposes. Such code is not call-compatible
27228 with code compiled with @option{-mpacked-stack}. Also, note that the
27229 combination of @option{-mbackchain},
27230 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
27231 to build a linux kernel use @option{-msoft-float}.
27232
27233 The default is to not use the packed stack layout.
27234
27235 @item -msmall-exec
27236 @itemx -mno-small-exec
27237 @opindex msmall-exec
27238 @opindex mno-small-exec
27239 Generate (or do not generate) code using the @code{bras} instruction
27240 to do subroutine calls.
27241 This only works reliably if the total executable size does not
27242 exceed 64k. The default is to use the @code{basr} instruction instead,
27243 which does not have this limitation.
27244
27245 @item -m64
27246 @itemx -m31
27247 @opindex m64
27248 @opindex m31
27249 When @option{-m31} is specified, generate code compliant to the
27250 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
27251 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
27252 particular to generate 64-bit instructions. For the @samp{s390}
27253 targets, the default is @option{-m31}, while the @samp{s390x}
27254 targets default to @option{-m64}.
27255
27256 @item -mzarch
27257 @itemx -mesa
27258 @opindex mzarch
27259 @opindex mesa
27260 When @option{-mzarch} is specified, generate code using the
27261 instructions available on z/Architecture.
27262 When @option{-mesa} is specified, generate code using the
27263 instructions available on ESA/390. Note that @option{-mesa} is
27264 not possible with @option{-m64}.
27265 When generating code compliant to the GNU/Linux for S/390 ABI,
27266 the default is @option{-mesa}. When generating code compliant
27267 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
27268
27269 @item -mhtm
27270 @itemx -mno-htm
27271 @opindex mhtm
27272 @opindex mno-htm
27273 The @option{-mhtm} option enables a set of builtins making use of
27274 instructions available with the transactional execution facility
27275 introduced with the IBM zEnterprise EC12 machine generation
27276 @ref{S/390 System z Built-in Functions}.
27277 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
27278
27279 @item -mvx
27280 @itemx -mno-vx
27281 @opindex mvx
27282 @opindex mno-vx
27283 When @option{-mvx} is specified, generate code using the instructions
27284 available with the vector extension facility introduced with the IBM
27285 z13 machine generation.
27286 This option changes the ABI for some vector type values with regard to
27287 alignment and calling conventions. In case vector type values are
27288 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
27289 command will be added to mark the resulting binary with the ABI used.
27290 @option{-mvx} is enabled by default when using @option{-march=z13}.
27291
27292 @item -mzvector
27293 @itemx -mno-zvector
27294 @opindex mzvector
27295 @opindex mno-zvector
27296 The @option{-mzvector} option enables vector language extensions and
27297 builtins using instructions available with the vector extension
27298 facility introduced with the IBM z13 machine generation.
27299 This option adds support for @samp{vector} to be used as a keyword to
27300 define vector type variables and arguments. @samp{vector} is only
27301 available when GNU extensions are enabled. It will not be expanded
27302 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
27303 In addition to the GCC low-level builtins @option{-mzvector} enables
27304 a set of builtins added for compatibility with AltiVec-style
27305 implementations like Power and Cell. In order to make use of these
27306 builtins the header file @file{vecintrin.h} needs to be included.
27307 @option{-mzvector} is disabled by default.
27308
27309 @item -mmvcle
27310 @itemx -mno-mvcle
27311 @opindex mmvcle
27312 @opindex mno-mvcle
27313 Generate (or do not generate) code using the @code{mvcle} instruction
27314 to perform block moves. When @option{-mno-mvcle} is specified,
27315 use a @code{mvc} loop instead. This is the default unless optimizing for
27316 size.
27317
27318 @item -mdebug
27319 @itemx -mno-debug
27320 @opindex mdebug
27321 @opindex mno-debug
27322 Print (or do not print) additional debug information when compiling.
27323 The default is to not print debug information.
27324
27325 @item -march=@var{cpu-type}
27326 @opindex march
27327 Generate code that runs on @var{cpu-type}, which is the name of a
27328 system representing a certain processor type. Possible values for
27329 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
27330 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
27331 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
27332 @samp{z14}/@samp{arch12}, and @samp{native}.
27333
27334 The default is @option{-march=z900}.
27335
27336 Specifying @samp{native} as cpu type can be used to select the best
27337 architecture option for the host processor.
27338 @option{-march=native} has no effect if GCC does not recognize the
27339 processor.
27340
27341 @item -mtune=@var{cpu-type}
27342 @opindex mtune
27343 Tune to @var{cpu-type} everything applicable about the generated code,
27344 except for the ABI and the set of available instructions.
27345 The list of @var{cpu-type} values is the same as for @option{-march}.
27346 The default is the value used for @option{-march}.
27347
27348 @item -mtpf-trace
27349 @itemx -mno-tpf-trace
27350 @opindex mtpf-trace
27351 @opindex mno-tpf-trace
27352 Generate code that adds (does not add) in TPF OS specific branches to trace
27353 routines in the operating system. This option is off by default, even
27354 when compiling for the TPF OS@.
27355
27356 @item -mtpf-trace-skip
27357 @itemx -mno-tpf-trace-skip
27358 @opindex mtpf-trace-skip
27359 @opindex mno-tpf-trace-skip
27360 Generate code that changes (does not change) the default branch
27361 targets enabled by @option{-mtpf-trace} to point to specialized trace
27362 routines providing the ability of selectively skipping function trace
27363 entries for the TPF OS. This option is off by default, even when
27364 compiling for the TPF OS and specifying @option{-mtpf-trace}.
27365
27366 @item -mfused-madd
27367 @itemx -mno-fused-madd
27368 @opindex mfused-madd
27369 @opindex mno-fused-madd
27370 Generate code that uses (does not use) the floating-point multiply and
27371 accumulate instructions. These instructions are generated by default if
27372 hardware floating point is used.
27373
27374 @item -mwarn-framesize=@var{framesize}
27375 @opindex mwarn-framesize
27376 Emit a warning if the current function exceeds the given frame size. Because
27377 this is a compile-time check it doesn't need to be a real problem when the program
27378 runs. It is intended to identify functions that most probably cause
27379 a stack overflow. It is useful to be used in an environment with limited stack
27380 size e.g.@: the linux kernel.
27381
27382 @item -mwarn-dynamicstack
27383 @opindex mwarn-dynamicstack
27384 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
27385 arrays. This is generally a bad idea with a limited stack size.
27386
27387 @item -mstack-guard=@var{stack-guard}
27388 @itemx -mstack-size=@var{stack-size}
27389 @opindex mstack-guard
27390 @opindex mstack-size
27391 If these options are provided the S/390 back end emits additional instructions in
27392 the function prologue that trigger a trap if the stack size is @var{stack-guard}
27393 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
27394 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
27395 the frame size of the compiled function is chosen.
27396 These options are intended to be used to help debugging stack overflow problems.
27397 The additionally emitted code causes only little overhead and hence can also be
27398 used in production-like systems without greater performance degradation. The given
27399 values have to be exact powers of 2 and @var{stack-size} has to be greater than
27400 @var{stack-guard} without exceeding 64k.
27401 In order to be efficient the extra code makes the assumption that the stack starts
27402 at an address aligned to the value given by @var{stack-size}.
27403 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
27404
27405 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
27406 @opindex mhotpatch
27407 If the hotpatch option is enabled, a ``hot-patching'' function
27408 prologue is generated for all functions in the compilation unit.
27409 The funtion label is prepended with the given number of two-byte
27410 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
27411 the label, 2 * @var{post-halfwords} bytes are appended, using the
27412 largest NOP like instructions the architecture allows (maximum
27413 1000000).
27414
27415 If both arguments are zero, hotpatching is disabled.
27416
27417 This option can be overridden for individual functions with the
27418 @code{hotpatch} attribute.
27419 @end table
27420
27421 @node Score Options
27422 @subsection Score Options
27423 @cindex Score Options
27424
27425 These options are defined for Score implementations:
27426
27427 @table @gcctabopt
27428 @item -meb
27429 @opindex meb
27430 Compile code for big-endian mode. This is the default.
27431
27432 @item -mel
27433 @opindex mel
27434 Compile code for little-endian mode.
27435
27436 @item -mnhwloop
27437 @opindex mnhwloop
27438 Disable generation of @code{bcnz} instructions.
27439
27440 @item -muls
27441 @opindex muls
27442 Enable generation of unaligned load and store instructions.
27443
27444 @item -mmac
27445 @opindex mmac
27446 Enable the use of multiply-accumulate instructions. Disabled by default.
27447
27448 @item -mscore5
27449 @opindex mscore5
27450 Specify the SCORE5 as the target architecture.
27451
27452 @item -mscore5u
27453 @opindex mscore5u
27454 Specify the SCORE5U of the target architecture.
27455
27456 @item -mscore7
27457 @opindex mscore7
27458 Specify the SCORE7 as the target architecture. This is the default.
27459
27460 @item -mscore7d
27461 @opindex mscore7d
27462 Specify the SCORE7D as the target architecture.
27463 @end table
27464
27465 @node SH Options
27466 @subsection SH Options
27467
27468 These @samp{-m} options are defined for the SH implementations:
27469
27470 @table @gcctabopt
27471 @item -m1
27472 @opindex m1
27473 Generate code for the SH1.
27474
27475 @item -m2
27476 @opindex m2
27477 Generate code for the SH2.
27478
27479 @item -m2e
27480 Generate code for the SH2e.
27481
27482 @item -m2a-nofpu
27483 @opindex m2a-nofpu
27484 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
27485 that the floating-point unit is not used.
27486
27487 @item -m2a-single-only
27488 @opindex m2a-single-only
27489 Generate code for the SH2a-FPU, in such a way that no double-precision
27490 floating-point operations are used.
27491
27492 @item -m2a-single
27493 @opindex m2a-single
27494 Generate code for the SH2a-FPU assuming the floating-point unit is in
27495 single-precision mode by default.
27496
27497 @item -m2a
27498 @opindex m2a
27499 Generate code for the SH2a-FPU assuming the floating-point unit is in
27500 double-precision mode by default.
27501
27502 @item -m3
27503 @opindex m3
27504 Generate code for the SH3.
27505
27506 @item -m3e
27507 @opindex m3e
27508 Generate code for the SH3e.
27509
27510 @item -m4-nofpu
27511 @opindex m4-nofpu
27512 Generate code for the SH4 without a floating-point unit.
27513
27514 @item -m4-single-only
27515 @opindex m4-single-only
27516 Generate code for the SH4 with a floating-point unit that only
27517 supports single-precision arithmetic.
27518
27519 @item -m4-single
27520 @opindex m4-single
27521 Generate code for the SH4 assuming the floating-point unit is in
27522 single-precision mode by default.
27523
27524 @item -m4
27525 @opindex m4
27526 Generate code for the SH4.
27527
27528 @item -m4-100
27529 @opindex m4-100
27530 Generate code for SH4-100.
27531
27532 @item -m4-100-nofpu
27533 @opindex m4-100-nofpu
27534 Generate code for SH4-100 in such a way that the
27535 floating-point unit is not used.
27536
27537 @item -m4-100-single
27538 @opindex m4-100-single
27539 Generate code for SH4-100 assuming the floating-point unit is in
27540 single-precision mode by default.
27541
27542 @item -m4-100-single-only
27543 @opindex m4-100-single-only
27544 Generate code for SH4-100 in such a way that no double-precision
27545 floating-point operations are used.
27546
27547 @item -m4-200
27548 @opindex m4-200
27549 Generate code for SH4-200.
27550
27551 @item -m4-200-nofpu
27552 @opindex m4-200-nofpu
27553 Generate code for SH4-200 without in such a way that the
27554 floating-point unit is not used.
27555
27556 @item -m4-200-single
27557 @opindex m4-200-single
27558 Generate code for SH4-200 assuming the floating-point unit is in
27559 single-precision mode by default.
27560
27561 @item -m4-200-single-only
27562 @opindex m4-200-single-only
27563 Generate code for SH4-200 in such a way that no double-precision
27564 floating-point operations are used.
27565
27566 @item -m4-300
27567 @opindex m4-300
27568 Generate code for SH4-300.
27569
27570 @item -m4-300-nofpu
27571 @opindex m4-300-nofpu
27572 Generate code for SH4-300 without in such a way that the
27573 floating-point unit is not used.
27574
27575 @item -m4-300-single
27576 @opindex m4-300-single
27577 Generate code for SH4-300 in such a way that no double-precision
27578 floating-point operations are used.
27579
27580 @item -m4-300-single-only
27581 @opindex m4-300-single-only
27582 Generate code for SH4-300 in such a way that no double-precision
27583 floating-point operations are used.
27584
27585 @item -m4-340
27586 @opindex m4-340
27587 Generate code for SH4-340 (no MMU, no FPU).
27588
27589 @item -m4-500
27590 @opindex m4-500
27591 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
27592 assembler.
27593
27594 @item -m4a-nofpu
27595 @opindex m4a-nofpu
27596 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27597 floating-point unit is not used.
27598
27599 @item -m4a-single-only
27600 @opindex m4a-single-only
27601 Generate code for the SH4a, in such a way that no double-precision
27602 floating-point operations are used.
27603
27604 @item -m4a-single
27605 @opindex m4a-single
27606 Generate code for the SH4a assuming the floating-point unit is in
27607 single-precision mode by default.
27608
27609 @item -m4a
27610 @opindex m4a
27611 Generate code for the SH4a.
27612
27613 @item -m4al
27614 @opindex m4al
27615 Same as @option{-m4a-nofpu}, except that it implicitly passes
27616 @option{-dsp} to the assembler. GCC doesn't generate any DSP
27617 instructions at the moment.
27618
27619 @item -mb
27620 @opindex mb
27621 Compile code for the processor in big-endian mode.
27622
27623 @item -ml
27624 @opindex ml
27625 Compile code for the processor in little-endian mode.
27626
27627 @item -mdalign
27628 @opindex mdalign
27629 Align doubles at 64-bit boundaries. Note that this changes the calling
27630 conventions, and thus some functions from the standard C library do
27631 not work unless you recompile it first with @option{-mdalign}.
27632
27633 @item -mrelax
27634 @opindex mrelax
27635 Shorten some address references at link time, when possible; uses the
27636 linker option @option{-relax}.
27637
27638 @item -mbigtable
27639 @opindex mbigtable
27640 Use 32-bit offsets in @code{switch} tables. The default is to use
27641 16-bit offsets.
27642
27643 @item -mbitops
27644 @opindex mbitops
27645 Enable the use of bit manipulation instructions on SH2A.
27646
27647 @item -mfmovd
27648 @opindex mfmovd
27649 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
27650 alignment constraints.
27651
27652 @item -mrenesas
27653 @opindex mrenesas
27654 Comply with the calling conventions defined by Renesas.
27655
27656 @item -mno-renesas
27657 @opindex mno-renesas
27658 Comply with the calling conventions defined for GCC before the Renesas
27659 conventions were available. This option is the default for all
27660 targets of the SH toolchain.
27661
27662 @item -mnomacsave
27663 @opindex mnomacsave
27664 Mark the @code{MAC} register as call-clobbered, even if
27665 @option{-mrenesas} is given.
27666
27667 @item -mieee
27668 @itemx -mno-ieee
27669 @opindex mieee
27670 @opindex mno-ieee
27671 Control the IEEE compliance of floating-point comparisons, which affects the
27672 handling of cases where the result of a comparison is unordered. By default
27673 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
27674 enabled @option{-mno-ieee} is implicitly set, which results in faster
27675 floating-point greater-equal and less-equal comparisons. The implicit settings
27676 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27677
27678 @item -minline-ic_invalidate
27679 @opindex minline-ic_invalidate
27680 Inline code to invalidate instruction cache entries after setting up
27681 nested function trampolines.
27682 This option has no effect if @option{-musermode} is in effect and the selected
27683 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27684 instruction.
27685 If the selected code generation option does not allow the use of the @code{icbi}
27686 instruction, and @option{-musermode} is not in effect, the inlined code
27687 manipulates the instruction cache address array directly with an associative
27688 write. This not only requires privileged mode at run time, but it also
27689 fails if the cache line had been mapped via the TLB and has become unmapped.
27690
27691 @item -misize
27692 @opindex misize
27693 Dump instruction size and location in the assembly code.
27694
27695 @item -mpadstruct
27696 @opindex mpadstruct
27697 This option is deprecated. It pads structures to multiple of 4 bytes,
27698 which is incompatible with the SH ABI@.
27699
27700 @item -matomic-model=@var{model}
27701 @opindex matomic-model=@var{model}
27702 Sets the model of atomic operations and additional parameters as a comma
27703 separated list. For details on the atomic built-in functions see
27704 @ref{__atomic Builtins}. The following models and parameters are supported:
27705
27706 @table @samp
27707
27708 @item none
27709 Disable compiler generated atomic sequences and emit library calls for atomic
27710 operations. This is the default if the target is not @code{sh*-*-linux*}.
27711
27712 @item soft-gusa
27713 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27714 built-in functions. The generated atomic sequences require additional support
27715 from the interrupt/exception handling code of the system and are only suitable
27716 for SH3* and SH4* single-core systems. This option is enabled by default when
27717 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
27718 this option also partially utilizes the hardware atomic instructions
27719 @code{movli.l} and @code{movco.l} to create more efficient code, unless
27720 @samp{strict} is specified.
27721
27722 @item soft-tcb
27723 Generate software atomic sequences that use a variable in the thread control
27724 block. This is a variation of the gUSA sequences which can also be used on
27725 SH1* and SH2* targets. The generated atomic sequences require additional
27726 support from the interrupt/exception handling code of the system and are only
27727 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
27728 parameter has to be specified as well.
27729
27730 @item soft-imask
27731 Generate software atomic sequences that temporarily disable interrupts by
27732 setting @code{SR.IMASK = 1111}. This model works only when the program runs
27733 in privileged mode and is only suitable for single-core systems. Additional
27734 support from the interrupt/exception handling code of the system is not
27735 required. This model is enabled by default when the target is
27736 @code{sh*-*-linux*} and SH1* or SH2*.
27737
27738 @item hard-llcs
27739 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27740 instructions only. This is only available on SH4A and is suitable for
27741 multi-core systems. Since the hardware instructions support only 32 bit atomic
27742 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27743 Code compiled with this option is also compatible with other software
27744 atomic model interrupt/exception handling systems if executed on an SH4A
27745 system. Additional support from the interrupt/exception handling code of the
27746 system is not required for this model.
27747
27748 @item gbr-offset=
27749 This parameter specifies the offset in bytes of the variable in the thread
27750 control block structure that should be used by the generated atomic sequences
27751 when the @samp{soft-tcb} model has been selected. For other models this
27752 parameter is ignored. The specified value must be an integer multiple of four
27753 and in the range 0-1020.
27754
27755 @item strict
27756 This parameter prevents mixed usage of multiple atomic models, even if they
27757 are compatible, and makes the compiler generate atomic sequences of the
27758 specified model only.
27759
27760 @end table
27761
27762 @item -mtas
27763 @opindex mtas
27764 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27765 Notice that depending on the particular hardware and software configuration
27766 this can degrade overall performance due to the operand cache line flushes
27767 that are implied by the @code{tas.b} instruction. On multi-core SH4A
27768 processors the @code{tas.b} instruction must be used with caution since it
27769 can result in data corruption for certain cache configurations.
27770
27771 @item -mprefergot
27772 @opindex mprefergot
27773 When generating position-independent code, emit function calls using
27774 the Global Offset Table instead of the Procedure Linkage Table.
27775
27776 @item -musermode
27777 @itemx -mno-usermode
27778 @opindex musermode
27779 @opindex mno-usermode
27780 Don't allow (allow) the compiler generating privileged mode code. Specifying
27781 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27782 inlined code would not work in user mode. @option{-musermode} is the default
27783 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
27784 @option{-musermode} has no effect, since there is no user mode.
27785
27786 @item -multcost=@var{number}
27787 @opindex multcost=@var{number}
27788 Set the cost to assume for a multiply insn.
27789
27790 @item -mdiv=@var{strategy}
27791 @opindex mdiv=@var{strategy}
27792 Set the division strategy to be used for integer division operations.
27793 @var{strategy} can be one of:
27794
27795 @table @samp
27796
27797 @item call-div1
27798 Calls a library function that uses the single-step division instruction
27799 @code{div1} to perform the operation. Division by zero calculates an
27800 unspecified result and does not trap. This is the default except for SH4,
27801 SH2A and SHcompact.
27802
27803 @item call-fp
27804 Calls a library function that performs the operation in double precision
27805 floating point. Division by zero causes a floating-point exception. This is
27806 the default for SHcompact with FPU. Specifying this for targets that do not
27807 have a double precision FPU defaults to @code{call-div1}.
27808
27809 @item call-table
27810 Calls a library function that uses a lookup table for small divisors and
27811 the @code{div1} instruction with case distinction for larger divisors. Division
27812 by zero calculates an unspecified result and does not trap. This is the default
27813 for SH4. Specifying this for targets that do not have dynamic shift
27814 instructions defaults to @code{call-div1}.
27815
27816 @end table
27817
27818 When a division strategy has not been specified the default strategy is
27819 selected based on the current target. For SH2A the default strategy is to
27820 use the @code{divs} and @code{divu} instructions instead of library function
27821 calls.
27822
27823 @item -maccumulate-outgoing-args
27824 @opindex maccumulate-outgoing-args
27825 Reserve space once for outgoing arguments in the function prologue rather
27826 than around each call. Generally beneficial for performance and size. Also
27827 needed for unwinding to avoid changing the stack frame around conditional code.
27828
27829 @item -mdivsi3_libfunc=@var{name}
27830 @opindex mdivsi3_libfunc=@var{name}
27831 Set the name of the library function used for 32-bit signed division to
27832 @var{name}.
27833 This only affects the name used in the @samp{call} division strategies, and
27834 the compiler still expects the same sets of input/output/clobbered registers as
27835 if this option were not present.
27836
27837 @item -mfixed-range=@var{register-range}
27838 @opindex mfixed-range
27839 Generate code treating the given register range as fixed registers.
27840 A fixed register is one that the register allocator cannot use. This is
27841 useful when compiling kernel code. A register range is specified as
27842 two registers separated by a dash. Multiple register ranges can be
27843 specified separated by a comma.
27844
27845 @item -mbranch-cost=@var{num}
27846 @opindex mbranch-cost=@var{num}
27847 Assume @var{num} to be the cost for a branch instruction. Higher numbers
27848 make the compiler try to generate more branch-free code if possible.
27849 If not specified the value is selected depending on the processor type that
27850 is being compiled for.
27851
27852 @item -mzdcbranch
27853 @itemx -mno-zdcbranch
27854 @opindex mzdcbranch
27855 @opindex mno-zdcbranch
27856 Assume (do not assume) that zero displacement conditional branch instructions
27857 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
27858 compiler prefers zero displacement branch code sequences. This is
27859 enabled by default when generating code for SH4 and SH4A. It can be explicitly
27860 disabled by specifying @option{-mno-zdcbranch}.
27861
27862 @item -mcbranch-force-delay-slot
27863 @opindex mcbranch-force-delay-slot
27864 Force the usage of delay slots for conditional branches, which stuffs the delay
27865 slot with a @code{nop} if a suitable instruction cannot be found. By default
27866 this option is disabled. It can be enabled to work around hardware bugs as
27867 found in the original SH7055.
27868
27869 @item -mfused-madd
27870 @itemx -mno-fused-madd
27871 @opindex mfused-madd
27872 @opindex mno-fused-madd
27873 Generate code that uses (does not use) the floating-point multiply and
27874 accumulate instructions. These instructions are generated by default
27875 if hardware floating point is used. The machine-dependent
27876 @option{-mfused-madd} option is now mapped to the machine-independent
27877 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27878 mapped to @option{-ffp-contract=off}.
27879
27880 @item -mfsca
27881 @itemx -mno-fsca
27882 @opindex mfsca
27883 @opindex mno-fsca
27884 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
27885 and cosine approximations. The option @option{-mfsca} must be used in
27886 combination with @option{-funsafe-math-optimizations}. It is enabled by default
27887 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
27888 approximations even if @option{-funsafe-math-optimizations} is in effect.
27889
27890 @item -mfsrra
27891 @itemx -mno-fsrra
27892 @opindex mfsrra
27893 @opindex mno-fsrra
27894 Allow or disallow the compiler to emit the @code{fsrra} instruction for
27895 reciprocal square root approximations. The option @option{-mfsrra} must be used
27896 in combination with @option{-funsafe-math-optimizations} and
27897 @option{-ffinite-math-only}. It is enabled by default when generating code for
27898 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
27899 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
27900 in effect.
27901
27902 @item -mpretend-cmove
27903 @opindex mpretend-cmove
27904 Prefer zero-displacement conditional branches for conditional move instruction
27905 patterns. This can result in faster code on the SH4 processor.
27906
27907 @item -mfdpic
27908 @opindex fdpic
27909 Generate code using the FDPIC ABI.
27910
27911 @end table
27912
27913 @node Solaris 2 Options
27914 @subsection Solaris 2 Options
27915 @cindex Solaris 2 options
27916
27917 These @samp{-m} options are supported on Solaris 2:
27918
27919 @table @gcctabopt
27920 @item -mclear-hwcap
27921 @opindex mclear-hwcap
27922 @option{-mclear-hwcap} tells the compiler to remove the hardware
27923 capabilities generated by the Solaris assembler. This is only necessary
27924 when object files use ISA extensions not supported by the current
27925 machine, but check at runtime whether or not to use them.
27926
27927 @item -mimpure-text
27928 @opindex mimpure-text
27929 @option{-mimpure-text}, used in addition to @option{-shared}, tells
27930 the compiler to not pass @option{-z text} to the linker when linking a
27931 shared object. Using this option, you can link position-dependent
27932 code into a shared object.
27933
27934 @option{-mimpure-text} suppresses the ``relocations remain against
27935 allocatable but non-writable sections'' linker error message.
27936 However, the necessary relocations trigger copy-on-write, and the
27937 shared object is not actually shared across processes. Instead of
27938 using @option{-mimpure-text}, you should compile all source code with
27939 @option{-fpic} or @option{-fPIC}.
27940
27941 @end table
27942
27943 These switches are supported in addition to the above on Solaris 2:
27944
27945 @table @gcctabopt
27946 @item -pthreads
27947 @opindex pthreads
27948 This is a synonym for @option{-pthread}.
27949 @end table
27950
27951 @node SPARC Options
27952 @subsection SPARC Options
27953 @cindex SPARC options
27954
27955 These @samp{-m} options are supported on the SPARC:
27956
27957 @table @gcctabopt
27958 @item -mno-app-regs
27959 @itemx -mapp-regs
27960 @opindex mno-app-regs
27961 @opindex mapp-regs
27962 Specify @option{-mapp-regs} to generate output using the global registers
27963 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
27964 global register 1, each global register 2 through 4 is then treated as an
27965 allocable register that is clobbered by function calls. This is the default.
27966
27967 To be fully SVR4 ABI-compliant at the cost of some performance loss,
27968 specify @option{-mno-app-regs}. You should compile libraries and system
27969 software with this option.
27970
27971 @item -mflat
27972 @itemx -mno-flat
27973 @opindex mflat
27974 @opindex mno-flat
27975 With @option{-mflat}, the compiler does not generate save/restore instructions
27976 and uses a ``flat'' or single register window model. This model is compatible
27977 with the regular register window model. The local registers and the input
27978 registers (0--5) are still treated as ``call-saved'' registers and are
27979 saved on the stack as needed.
27980
27981 With @option{-mno-flat} (the default), the compiler generates save/restore
27982 instructions (except for leaf functions). This is the normal operating mode.
27983
27984 @item -mfpu
27985 @itemx -mhard-float
27986 @opindex mfpu
27987 @opindex mhard-float
27988 Generate output containing floating-point instructions. This is the
27989 default.
27990
27991 @item -mno-fpu
27992 @itemx -msoft-float
27993 @opindex mno-fpu
27994 @opindex msoft-float
27995 Generate output containing library calls for floating point.
27996 @strong{Warning:} the requisite libraries are not available for all SPARC
27997 targets. Normally the facilities of the machine's usual C compiler are
27998 used, but this cannot be done directly in cross-compilation. You must make
27999 your own arrangements to provide suitable library functions for
28000 cross-compilation. The embedded targets @samp{sparc-*-aout} and
28001 @samp{sparclite-*-*} do provide software floating-point support.
28002
28003 @option{-msoft-float} changes the calling convention in the output file;
28004 therefore, it is only useful if you compile @emph{all} of a program with
28005 this option. In particular, you need to compile @file{libgcc.a}, the
28006 library that comes with GCC, with @option{-msoft-float} in order for
28007 this to work.
28008
28009 @item -mhard-quad-float
28010 @opindex mhard-quad-float
28011 Generate output containing quad-word (long double) floating-point
28012 instructions.
28013
28014 @item -msoft-quad-float
28015 @opindex msoft-quad-float
28016 Generate output containing library calls for quad-word (long double)
28017 floating-point instructions. The functions called are those specified
28018 in the SPARC ABI@. This is the default.
28019
28020 As of this writing, there are no SPARC implementations that have hardware
28021 support for the quad-word floating-point instructions. They all invoke
28022 a trap handler for one of these instructions, and then the trap handler
28023 emulates the effect of the instruction. Because of the trap handler overhead,
28024 this is much slower than calling the ABI library routines. Thus the
28025 @option{-msoft-quad-float} option is the default.
28026
28027 @item -mno-unaligned-doubles
28028 @itemx -munaligned-doubles
28029 @opindex mno-unaligned-doubles
28030 @opindex munaligned-doubles
28031 Assume that doubles have 8-byte alignment. This is the default.
28032
28033 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
28034 alignment only if they are contained in another type, or if they have an
28035 absolute address. Otherwise, it assumes they have 4-byte alignment.
28036 Specifying this option avoids some rare compatibility problems with code
28037 generated by other compilers. It is not the default because it results
28038 in a performance loss, especially for floating-point code.
28039
28040 @item -muser-mode
28041 @itemx -mno-user-mode
28042 @opindex muser-mode
28043 @opindex mno-user-mode
28044 Do not generate code that can only run in supervisor mode. This is relevant
28045 only for the @code{casa} instruction emitted for the LEON3 processor. This
28046 is the default.
28047
28048 @item -mfaster-structs
28049 @itemx -mno-faster-structs
28050 @opindex mfaster-structs
28051 @opindex mno-faster-structs
28052 With @option{-mfaster-structs}, the compiler assumes that structures
28053 should have 8-byte alignment. This enables the use of pairs of
28054 @code{ldd} and @code{std} instructions for copies in structure
28055 assignment, in place of twice as many @code{ld} and @code{st} pairs.
28056 However, the use of this changed alignment directly violates the SPARC
28057 ABI@. Thus, it's intended only for use on targets where the developer
28058 acknowledges that their resulting code is not directly in line with
28059 the rules of the ABI@.
28060
28061 @item -mstd-struct-return
28062 @itemx -mno-std-struct-return
28063 @opindex mstd-struct-return
28064 @opindex mno-std-struct-return
28065 With @option{-mstd-struct-return}, the compiler generates checking code
28066 in functions returning structures or unions to detect size mismatches
28067 between the two sides of function calls, as per the 32-bit ABI@.
28068
28069 The default is @option{-mno-std-struct-return}. This option has no effect
28070 in 64-bit mode.
28071
28072 @item -mlra
28073 @itemx -mno-lra
28074 @opindex mlra
28075 @opindex mno-lra
28076 Enable Local Register Allocation. This is the default for SPARC since GCC 7
28077 so @option{-mno-lra} needs to be passed to get old Reload.
28078
28079 @item -mcpu=@var{cpu_type}
28080 @opindex mcpu
28081 Set the instruction set, register set, and instruction scheduling parameters
28082 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
28083 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
28084 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
28085 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
28086 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
28087 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
28088
28089 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
28090 which selects the best architecture option for the host processor.
28091 @option{-mcpu=native} has no effect if GCC does not recognize
28092 the processor.
28093
28094 Default instruction scheduling parameters are used for values that select
28095 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
28096 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
28097
28098 Here is a list of each supported architecture and their supported
28099 implementations.
28100
28101 @table @asis
28102 @item v7
28103 cypress, leon3v7
28104
28105 @item v8
28106 supersparc, hypersparc, leon, leon3
28107
28108 @item sparclite
28109 f930, f934, sparclite86x
28110
28111 @item sparclet
28112 tsc701
28113
28114 @item v9
28115 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
28116 niagara7, m8
28117 @end table
28118
28119 By default (unless configured otherwise), GCC generates code for the V7
28120 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
28121 additionally optimizes it for the Cypress CY7C602 chip, as used in the
28122 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
28123 SPARCStation 1, 2, IPX etc.
28124
28125 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
28126 architecture. The only difference from V7 code is that the compiler emits
28127 the integer multiply and integer divide instructions which exist in SPARC-V8
28128 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
28129 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
28130 2000 series.
28131
28132 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
28133 the SPARC architecture. This adds the integer multiply, integer divide step
28134 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
28135 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
28136 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
28137 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
28138 MB86934 chip, which is the more recent SPARClite with FPU@.
28139
28140 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
28141 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
28142 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
28143 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
28144 optimizes it for the TEMIC SPARClet chip.
28145
28146 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
28147 architecture. This adds 64-bit integer and floating-point move instructions,
28148 3 additional floating-point condition code registers and conditional move
28149 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
28150 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
28151 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
28152 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
28153 @option{-mcpu=niagara}, the compiler additionally optimizes it for
28154 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
28155 additionally optimizes it for Sun UltraSPARC T2 chips. With
28156 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
28157 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
28158 additionally optimizes it for Sun UltraSPARC T4 chips. With
28159 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
28160 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
28161 additionally optimizes it for Oracle M8 chips.
28162
28163 @item -mtune=@var{cpu_type}
28164 @opindex mtune
28165 Set the instruction scheduling parameters for machine type
28166 @var{cpu_type}, but do not set the instruction set or register set that the
28167 option @option{-mcpu=@var{cpu_type}} does.
28168
28169 The same values for @option{-mcpu=@var{cpu_type}} can be used for
28170 @option{-mtune=@var{cpu_type}}, but the only useful values are those
28171 that select a particular CPU implementation. Those are
28172 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
28173 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
28174 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
28175 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
28176 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
28177 and GNU/Linux toolchains, @samp{native} can also be used.
28178
28179 @item -mv8plus
28180 @itemx -mno-v8plus
28181 @opindex mv8plus
28182 @opindex mno-v8plus
28183 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
28184 difference from the V8 ABI is that the global and out registers are
28185 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
28186 mode for all SPARC-V9 processors.
28187
28188 @item -mvis
28189 @itemx -mno-vis
28190 @opindex mvis
28191 @opindex mno-vis
28192 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
28193 Visual Instruction Set extensions. The default is @option{-mno-vis}.
28194
28195 @item -mvis2
28196 @itemx -mno-vis2
28197 @opindex mvis2
28198 @opindex mno-vis2
28199 With @option{-mvis2}, GCC generates code that takes advantage of
28200 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
28201 default is @option{-mvis2} when targeting a cpu that supports such
28202 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
28203 also sets @option{-mvis}.
28204
28205 @item -mvis3
28206 @itemx -mno-vis3
28207 @opindex mvis3
28208 @opindex mno-vis3
28209 With @option{-mvis3}, GCC generates code that takes advantage of
28210 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
28211 default is @option{-mvis3} when targeting a cpu that supports such
28212 instructions, such as niagara-3 and later. Setting @option{-mvis3}
28213 also sets @option{-mvis2} and @option{-mvis}.
28214
28215 @item -mvis4
28216 @itemx -mno-vis4
28217 @opindex mvis4
28218 @opindex mno-vis4
28219 With @option{-mvis4}, GCC generates code that takes advantage of
28220 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
28221 default is @option{-mvis4} when targeting a cpu that supports such
28222 instructions, such as niagara-7 and later. Setting @option{-mvis4}
28223 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
28224
28225 @item -mvis4b
28226 @itemx -mno-vis4b
28227 @opindex mvis4b
28228 @opindex mno-vis4b
28229 With @option{-mvis4b}, GCC generates code that takes advantage of
28230 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
28231 the additional VIS instructions introduced in the Oracle SPARC
28232 Architecture 2017. The default is @option{-mvis4b} when targeting a
28233 cpu that supports such instructions, such as m8 and later. Setting
28234 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
28235 @option{-mvis2} and @option{-mvis}.
28236
28237 @item -mcbcond
28238 @itemx -mno-cbcond
28239 @opindex mcbcond
28240 @opindex mno-cbcond
28241 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
28242 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
28243 when targeting a CPU that supports such instructions, such as Niagara-4 and
28244 later.
28245
28246 @item -mfmaf
28247 @itemx -mno-fmaf
28248 @opindex mfmaf
28249 @opindex mno-fmaf
28250 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
28251 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
28252 when targeting a CPU that supports such instructions, such as Niagara-3 and
28253 later.
28254
28255 @item -mfsmuld
28256 @itemx -mno-fsmuld
28257 @opindex mfsmuld
28258 @opindex mno-fsmuld
28259 With @option{-mfsmuld}, GCC generates code that takes advantage of the
28260 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
28261 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
28262 or V9 with FPU except @option{-mcpu=leon}.
28263
28264 @item -mpopc
28265 @itemx -mno-popc
28266 @opindex mpopc
28267 @opindex mno-popc
28268 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
28269 Population Count instruction. The default is @option{-mpopc}
28270 when targeting a CPU that supports such an instruction, such as Niagara-2 and
28271 later.
28272
28273 @item -msubxc
28274 @itemx -mno-subxc
28275 @opindex msubxc
28276 @opindex mno-subxc
28277 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
28278 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
28279 when targeting a CPU that supports such an instruction, such as Niagara-7 and
28280 later.
28281
28282 @item -mfix-at697f
28283 @opindex mfix-at697f
28284 Enable the documented workaround for the single erratum of the Atmel AT697F
28285 processor (which corresponds to erratum #13 of the AT697E processor).
28286
28287 @item -mfix-ut699
28288 @opindex mfix-ut699
28289 Enable the documented workarounds for the floating-point errata and the data
28290 cache nullify errata of the UT699 processor.
28291
28292 @item -mfix-ut700
28293 @opindex mfix-ut700
28294 Enable the documented workaround for the back-to-back store errata of
28295 the UT699E/UT700 processor.
28296
28297 @item -mfix-gr712rc
28298 @opindex mfix-gr712rc
28299 Enable the documented workaround for the back-to-back store errata of
28300 the GR712RC processor.
28301 @end table
28302
28303 These @samp{-m} options are supported in addition to the above
28304 on SPARC-V9 processors in 64-bit environments:
28305
28306 @table @gcctabopt
28307 @item -m32
28308 @itemx -m64
28309 @opindex m32
28310 @opindex m64
28311 Generate code for a 32-bit or 64-bit environment.
28312 The 32-bit environment sets int, long and pointer to 32 bits.
28313 The 64-bit environment sets int to 32 bits and long and pointer
28314 to 64 bits.
28315
28316 @item -mcmodel=@var{which}
28317 @opindex mcmodel
28318 Set the code model to one of
28319
28320 @table @samp
28321 @item medlow
28322 The Medium/Low code model: 64-bit addresses, programs
28323 must be linked in the low 32 bits of memory. Programs can be statically
28324 or dynamically linked.
28325
28326 @item medmid
28327 The Medium/Middle code model: 64-bit addresses, programs
28328 must be linked in the low 44 bits of memory, the text and data segments must
28329 be less than 2GB in size and the data segment must be located within 2GB of
28330 the text segment.
28331
28332 @item medany
28333 The Medium/Anywhere code model: 64-bit addresses, programs
28334 may be linked anywhere in memory, the text and data segments must be less
28335 than 2GB in size and the data segment must be located within 2GB of the
28336 text segment.
28337
28338 @item embmedany
28339 The Medium/Anywhere code model for embedded systems:
28340 64-bit addresses, the text and data segments must be less than 2GB in
28341 size, both starting anywhere in memory (determined at link time). The
28342 global register %g4 points to the base of the data segment. Programs
28343 are statically linked and PIC is not supported.
28344 @end table
28345
28346 @item -mmemory-model=@var{mem-model}
28347 @opindex mmemory-model
28348 Set the memory model in force on the processor to one of
28349
28350 @table @samp
28351 @item default
28352 The default memory model for the processor and operating system.
28353
28354 @item rmo
28355 Relaxed Memory Order
28356
28357 @item pso
28358 Partial Store Order
28359
28360 @item tso
28361 Total Store Order
28362
28363 @item sc
28364 Sequential Consistency
28365 @end table
28366
28367 These memory models are formally defined in Appendix D of the SPARC-V9
28368 architecture manual, as set in the processor's @code{PSTATE.MM} field.
28369
28370 @item -mstack-bias
28371 @itemx -mno-stack-bias
28372 @opindex mstack-bias
28373 @opindex mno-stack-bias
28374 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
28375 frame pointer if present, are offset by @minus{}2047 which must be added back
28376 when making stack frame references. This is the default in 64-bit mode.
28377 Otherwise, assume no such offset is present.
28378 @end table
28379
28380 @node System V Options
28381 @subsection Options for System V
28382
28383 These additional options are available on System V Release 4 for
28384 compatibility with other compilers on those systems:
28385
28386 @table @gcctabopt
28387 @item -G
28388 @opindex G
28389 Create a shared object.
28390 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
28391
28392 @item -Qy
28393 @opindex Qy
28394 Identify the versions of each tool used by the compiler, in a
28395 @code{.ident} assembler directive in the output.
28396
28397 @item -Qn
28398 @opindex Qn
28399 Refrain from adding @code{.ident} directives to the output file (this is
28400 the default).
28401
28402 @item -YP,@var{dirs}
28403 @opindex YP
28404 Search the directories @var{dirs}, and no others, for libraries
28405 specified with @option{-l}.
28406
28407 @item -Ym,@var{dir}
28408 @opindex Ym
28409 Look in the directory @var{dir} to find the M4 preprocessor.
28410 The assembler uses this option.
28411 @c This is supposed to go with a -Yd for predefined M4 macro files, but
28412 @c the generic assembler that comes with Solaris takes just -Ym.
28413 @end table
28414
28415 @node TILE-Gx Options
28416 @subsection TILE-Gx Options
28417 @cindex TILE-Gx options
28418
28419 These @samp{-m} options are supported on the TILE-Gx:
28420
28421 @table @gcctabopt
28422 @item -mcmodel=small
28423 @opindex mcmodel=small
28424 Generate code for the small model. The distance for direct calls is
28425 limited to 500M in either direction. PC-relative addresses are 32
28426 bits. Absolute addresses support the full address range.
28427
28428 @item -mcmodel=large
28429 @opindex mcmodel=large
28430 Generate code for the large model. There is no limitation on call
28431 distance, pc-relative addresses, or absolute addresses.
28432
28433 @item -mcpu=@var{name}
28434 @opindex mcpu
28435 Selects the type of CPU to be targeted. Currently the only supported
28436 type is @samp{tilegx}.
28437
28438 @item -m32
28439 @itemx -m64
28440 @opindex m32
28441 @opindex m64
28442 Generate code for a 32-bit or 64-bit environment. The 32-bit
28443 environment sets int, long, and pointer to 32 bits. The 64-bit
28444 environment sets int to 32 bits and long and pointer to 64 bits.
28445
28446 @item -mbig-endian
28447 @itemx -mlittle-endian
28448 @opindex mbig-endian
28449 @opindex mlittle-endian
28450 Generate code in big/little endian mode, respectively.
28451 @end table
28452
28453 @node TILEPro Options
28454 @subsection TILEPro Options
28455 @cindex TILEPro options
28456
28457 These @samp{-m} options are supported on the TILEPro:
28458
28459 @table @gcctabopt
28460 @item -mcpu=@var{name}
28461 @opindex mcpu
28462 Selects the type of CPU to be targeted. Currently the only supported
28463 type is @samp{tilepro}.
28464
28465 @item -m32
28466 @opindex m32
28467 Generate code for a 32-bit environment, which sets int, long, and
28468 pointer to 32 bits. This is the only supported behavior so the flag
28469 is essentially ignored.
28470 @end table
28471
28472 @node V850 Options
28473 @subsection V850 Options
28474 @cindex V850 Options
28475
28476 These @samp{-m} options are defined for V850 implementations:
28477
28478 @table @gcctabopt
28479 @item -mlong-calls
28480 @itemx -mno-long-calls
28481 @opindex mlong-calls
28482 @opindex mno-long-calls
28483 Treat all calls as being far away (near). If calls are assumed to be
28484 far away, the compiler always loads the function's address into a
28485 register, and calls indirect through the pointer.
28486
28487 @item -mno-ep
28488 @itemx -mep
28489 @opindex mno-ep
28490 @opindex mep
28491 Do not optimize (do optimize) basic blocks that use the same index
28492 pointer 4 or more times to copy pointer into the @code{ep} register, and
28493 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
28494 option is on by default if you optimize.
28495
28496 @item -mno-prolog-function
28497 @itemx -mprolog-function
28498 @opindex mno-prolog-function
28499 @opindex mprolog-function
28500 Do not use (do use) external functions to save and restore registers
28501 at the prologue and epilogue of a function. The external functions
28502 are slower, but use less code space if more than one function saves
28503 the same number of registers. The @option{-mprolog-function} option
28504 is on by default if you optimize.
28505
28506 @item -mspace
28507 @opindex mspace
28508 Try to make the code as small as possible. At present, this just turns
28509 on the @option{-mep} and @option{-mprolog-function} options.
28510
28511 @item -mtda=@var{n}
28512 @opindex mtda
28513 Put static or global variables whose size is @var{n} bytes or less into
28514 the tiny data area that register @code{ep} points to. The tiny data
28515 area can hold up to 256 bytes in total (128 bytes for byte references).
28516
28517 @item -msda=@var{n}
28518 @opindex msda
28519 Put static or global variables whose size is @var{n} bytes or less into
28520 the small data area that register @code{gp} points to. The small data
28521 area can hold up to 64 kilobytes.
28522
28523 @item -mzda=@var{n}
28524 @opindex mzda
28525 Put static or global variables whose size is @var{n} bytes or less into
28526 the first 32 kilobytes of memory.
28527
28528 @item -mv850
28529 @opindex mv850
28530 Specify that the target processor is the V850.
28531
28532 @item -mv850e3v5
28533 @opindex mv850e3v5
28534 Specify that the target processor is the V850E3V5. The preprocessor
28535 constant @code{__v850e3v5__} is defined if this option is used.
28536
28537 @item -mv850e2v4
28538 @opindex mv850e2v4
28539 Specify that the target processor is the V850E3V5. This is an alias for
28540 the @option{-mv850e3v5} option.
28541
28542 @item -mv850e2v3
28543 @opindex mv850e2v3
28544 Specify that the target processor is the V850E2V3. The preprocessor
28545 constant @code{__v850e2v3__} is defined if this option is used.
28546
28547 @item -mv850e2
28548 @opindex mv850e2
28549 Specify that the target processor is the V850E2. The preprocessor
28550 constant @code{__v850e2__} is defined if this option is used.
28551
28552 @item -mv850e1
28553 @opindex mv850e1
28554 Specify that the target processor is the V850E1. The preprocessor
28555 constants @code{__v850e1__} and @code{__v850e__} are defined if
28556 this option is used.
28557
28558 @item -mv850es
28559 @opindex mv850es
28560 Specify that the target processor is the V850ES. This is an alias for
28561 the @option{-mv850e1} option.
28562
28563 @item -mv850e
28564 @opindex mv850e
28565 Specify that the target processor is the V850E@. The preprocessor
28566 constant @code{__v850e__} is defined if this option is used.
28567
28568 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28569 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28570 are defined then a default target processor is chosen and the
28571 relevant @samp{__v850*__} preprocessor constant is defined.
28572
28573 The preprocessor constants @code{__v850} and @code{__v851__} are always
28574 defined, regardless of which processor variant is the target.
28575
28576 @item -mdisable-callt
28577 @itemx -mno-disable-callt
28578 @opindex mdisable-callt
28579 @opindex mno-disable-callt
28580 This option suppresses generation of the @code{CALLT} instruction for the
28581 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28582 architecture.
28583
28584 This option is enabled by default when the RH850 ABI is
28585 in use (see @option{-mrh850-abi}), and disabled by default when the
28586 GCC ABI is in use. If @code{CALLT} instructions are being generated
28587 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28588
28589 @item -mrelax
28590 @itemx -mno-relax
28591 @opindex mrelax
28592 @opindex mno-relax
28593 Pass on (or do not pass on) the @option{-mrelax} command-line option
28594 to the assembler.
28595
28596 @item -mlong-jumps
28597 @itemx -mno-long-jumps
28598 @opindex mlong-jumps
28599 @opindex mno-long-jumps
28600 Disable (or re-enable) the generation of PC-relative jump instructions.
28601
28602 @item -msoft-float
28603 @itemx -mhard-float
28604 @opindex msoft-float
28605 @opindex mhard-float
28606 Disable (or re-enable) the generation of hardware floating point
28607 instructions. This option is only significant when the target
28608 architecture is @samp{V850E2V3} or higher. If hardware floating point
28609 instructions are being generated then the C preprocessor symbol
28610 @code{__FPU_OK__} is defined, otherwise the symbol
28611 @code{__NO_FPU__} is defined.
28612
28613 @item -mloop
28614 @opindex mloop
28615 Enables the use of the e3v5 LOOP instruction. The use of this
28616 instruction is not enabled by default when the e3v5 architecture is
28617 selected because its use is still experimental.
28618
28619 @item -mrh850-abi
28620 @itemx -mghs
28621 @opindex mrh850-abi
28622 @opindex mghs
28623 Enables support for the RH850 version of the V850 ABI. This is the
28624 default. With this version of the ABI the following rules apply:
28625
28626 @itemize
28627 @item
28628 Integer sized structures and unions are returned via a memory pointer
28629 rather than a register.
28630
28631 @item
28632 Large structures and unions (more than 8 bytes in size) are passed by
28633 value.
28634
28635 @item
28636 Functions are aligned to 16-bit boundaries.
28637
28638 @item
28639 The @option{-m8byte-align} command-line option is supported.
28640
28641 @item
28642 The @option{-mdisable-callt} command-line option is enabled by
28643 default. The @option{-mno-disable-callt} command-line option is not
28644 supported.
28645 @end itemize
28646
28647 When this version of the ABI is enabled the C preprocessor symbol
28648 @code{__V850_RH850_ABI__} is defined.
28649
28650 @item -mgcc-abi
28651 @opindex mgcc-abi
28652 Enables support for the old GCC version of the V850 ABI. With this
28653 version of the ABI the following rules apply:
28654
28655 @itemize
28656 @item
28657 Integer sized structures and unions are returned in register @code{r10}.
28658
28659 @item
28660 Large structures and unions (more than 8 bytes in size) are passed by
28661 reference.
28662
28663 @item
28664 Functions are aligned to 32-bit boundaries, unless optimizing for
28665 size.
28666
28667 @item
28668 The @option{-m8byte-align} command-line option is not supported.
28669
28670 @item
28671 The @option{-mdisable-callt} command-line option is supported but not
28672 enabled by default.
28673 @end itemize
28674
28675 When this version of the ABI is enabled the C preprocessor symbol
28676 @code{__V850_GCC_ABI__} is defined.
28677
28678 @item -m8byte-align
28679 @itemx -mno-8byte-align
28680 @opindex m8byte-align
28681 @opindex mno-8byte-align
28682 Enables support for @code{double} and @code{long long} types to be
28683 aligned on 8-byte boundaries. The default is to restrict the
28684 alignment of all objects to at most 4-bytes. When
28685 @option{-m8byte-align} is in effect the C preprocessor symbol
28686 @code{__V850_8BYTE_ALIGN__} is defined.
28687
28688 @item -mbig-switch
28689 @opindex mbig-switch
28690 Generate code suitable for big switch tables. Use this option only if
28691 the assembler/linker complain about out of range branches within a switch
28692 table.
28693
28694 @item -mapp-regs
28695 @opindex mapp-regs
28696 This option causes r2 and r5 to be used in the code generated by
28697 the compiler. This setting is the default.
28698
28699 @item -mno-app-regs
28700 @opindex mno-app-regs
28701 This option causes r2 and r5 to be treated as fixed registers.
28702
28703 @end table
28704
28705 @node VAX Options
28706 @subsection VAX Options
28707 @cindex VAX options
28708
28709 These @samp{-m} options are defined for the VAX:
28710
28711 @table @gcctabopt
28712 @item -munix
28713 @opindex munix
28714 Do not output certain jump instructions (@code{aobleq} and so on)
28715 that the Unix assembler for the VAX cannot handle across long
28716 ranges.
28717
28718 @item -mgnu
28719 @opindex mgnu
28720 Do output those jump instructions, on the assumption that the
28721 GNU assembler is being used.
28722
28723 @item -mg
28724 @opindex mg
28725 Output code for G-format floating-point numbers instead of D-format.
28726 @end table
28727
28728 @node Visium Options
28729 @subsection Visium Options
28730 @cindex Visium options
28731
28732 @table @gcctabopt
28733
28734 @item -mdebug
28735 @opindex mdebug
28736 A program which performs file I/O and is destined to run on an MCM target
28737 should be linked with this option. It causes the libraries libc.a and
28738 libdebug.a to be linked. The program should be run on the target under
28739 the control of the GDB remote debugging stub.
28740
28741 @item -msim
28742 @opindex msim
28743 A program which performs file I/O and is destined to run on the simulator
28744 should be linked with option. This causes libraries libc.a and libsim.a to
28745 be linked.
28746
28747 @item -mfpu
28748 @itemx -mhard-float
28749 @opindex mfpu
28750 @opindex mhard-float
28751 Generate code containing floating-point instructions. This is the
28752 default.
28753
28754 @item -mno-fpu
28755 @itemx -msoft-float
28756 @opindex mno-fpu
28757 @opindex msoft-float
28758 Generate code containing library calls for floating-point.
28759
28760 @option{-msoft-float} changes the calling convention in the output file;
28761 therefore, it is only useful if you compile @emph{all} of a program with
28762 this option. In particular, you need to compile @file{libgcc.a}, the
28763 library that comes with GCC, with @option{-msoft-float} in order for
28764 this to work.
28765
28766 @item -mcpu=@var{cpu_type}
28767 @opindex mcpu
28768 Set the instruction set, register set, and instruction scheduling parameters
28769 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
28770 @samp{mcm}, @samp{gr5} and @samp{gr6}.
28771
28772 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28773
28774 By default (unless configured otherwise), GCC generates code for the GR5
28775 variant of the Visium architecture.
28776
28777 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28778 architecture. The only difference from GR5 code is that the compiler will
28779 generate block move instructions.
28780
28781 @item -mtune=@var{cpu_type}
28782 @opindex mtune
28783 Set the instruction scheduling parameters for machine type @var{cpu_type},
28784 but do not set the instruction set or register set that the option
28785 @option{-mcpu=@var{cpu_type}} would.
28786
28787 @item -msv-mode
28788 @opindex msv-mode
28789 Generate code for the supervisor mode, where there are no restrictions on
28790 the access to general registers. This is the default.
28791
28792 @item -muser-mode
28793 @opindex muser-mode
28794 Generate code for the user mode, where the access to some general registers
28795 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28796 mode; on the GR6, only registers r29 to r31 are affected.
28797 @end table
28798
28799 @node VMS Options
28800 @subsection VMS Options
28801
28802 These @samp{-m} options are defined for the VMS implementations:
28803
28804 @table @gcctabopt
28805 @item -mvms-return-codes
28806 @opindex mvms-return-codes
28807 Return VMS condition codes from @code{main}. The default is to return POSIX-style
28808 condition (e.g.@: error) codes.
28809
28810 @item -mdebug-main=@var{prefix}
28811 @opindex mdebug-main=@var{prefix}
28812 Flag the first routine whose name starts with @var{prefix} as the main
28813 routine for the debugger.
28814
28815 @item -mmalloc64
28816 @opindex mmalloc64
28817 Default to 64-bit memory allocation routines.
28818
28819 @item -mpointer-size=@var{size}
28820 @opindex mpointer-size=@var{size}
28821 Set the default size of pointers. Possible options for @var{size} are
28822 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28823 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28824 The later option disables @code{pragma pointer_size}.
28825 @end table
28826
28827 @node VxWorks Options
28828 @subsection VxWorks Options
28829 @cindex VxWorks Options
28830
28831 The options in this section are defined for all VxWorks targets.
28832 Options specific to the target hardware are listed with the other
28833 options for that target.
28834
28835 @table @gcctabopt
28836 @item -mrtp
28837 @opindex mrtp
28838 GCC can generate code for both VxWorks kernels and real time processes
28839 (RTPs). This option switches from the former to the latter. It also
28840 defines the preprocessor macro @code{__RTP__}.
28841
28842 @item -non-static
28843 @opindex non-static
28844 Link an RTP executable against shared libraries rather than static
28845 libraries. The options @option{-static} and @option{-shared} can
28846 also be used for RTPs (@pxref{Link Options}); @option{-static}
28847 is the default.
28848
28849 @item -Bstatic
28850 @itemx -Bdynamic
28851 @opindex Bstatic
28852 @opindex Bdynamic
28853 These options are passed down to the linker. They are defined for
28854 compatibility with Diab.
28855
28856 @item -Xbind-lazy
28857 @opindex Xbind-lazy
28858 Enable lazy binding of function calls. This option is equivalent to
28859 @option{-Wl,-z,now} and is defined for compatibility with Diab.
28860
28861 @item -Xbind-now
28862 @opindex Xbind-now
28863 Disable lazy binding of function calls. This option is the default and
28864 is defined for compatibility with Diab.
28865 @end table
28866
28867 @node x86 Options
28868 @subsection x86 Options
28869 @cindex x86 Options
28870
28871 These @samp{-m} options are defined for the x86 family of computers.
28872
28873 @table @gcctabopt
28874
28875 @item -march=@var{cpu-type}
28876 @opindex march
28877 Generate instructions for the machine type @var{cpu-type}. In contrast to
28878 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
28879 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
28880 to generate code that may not run at all on processors other than the one
28881 indicated. Specifying @option{-march=@var{cpu-type}} implies
28882 @option{-mtune=@var{cpu-type}}.
28883
28884 The choices for @var{cpu-type} are:
28885
28886 @table @samp
28887 @item native
28888 This selects the CPU to generate code for at compilation time by determining
28889 the processor type of the compiling machine. Using @option{-march=native}
28890 enables all instruction subsets supported by the local machine (hence
28891 the result might not run on different machines). Using @option{-mtune=native}
28892 produces code optimized for the local machine under the constraints
28893 of the selected instruction set.
28894
28895 @item x86-64
28896 A generic CPU with 64-bit extensions.
28897
28898 @item i386
28899 Original Intel i386 CPU@.
28900
28901 @item i486
28902 Intel i486 CPU@. (No scheduling is implemented for this chip.)
28903
28904 @item i586
28905 @itemx pentium
28906 Intel Pentium CPU with no MMX support.
28907
28908 @item lakemont
28909 Intel Lakemont MCU, based on Intel Pentium CPU.
28910
28911 @item pentium-mmx
28912 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
28913
28914 @item pentiumpro
28915 Intel Pentium Pro CPU@.
28916
28917 @item i686
28918 When used with @option{-march}, the Pentium Pro
28919 instruction set is used, so the code runs on all i686 family chips.
28920 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
28921
28922 @item pentium2
28923 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
28924 support.
28925
28926 @item pentium3
28927 @itemx pentium3m
28928 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
28929 set support.
28930
28931 @item pentium-m
28932 Intel Pentium M; low-power version of Intel Pentium III CPU
28933 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
28934
28935 @item pentium4
28936 @itemx pentium4m
28937 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
28938
28939 @item prescott
28940 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
28941 set support.
28942
28943 @item nocona
28944 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
28945 SSE2 and SSE3 instruction set support.
28946
28947 @item core2
28948 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
28949 instruction set support.
28950
28951 @item nehalem
28952 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28953 SSE4.1, SSE4.2 and POPCNT instruction set support.
28954
28955 @item westmere
28956 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28957 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
28958
28959 @item sandybridge
28960 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28961 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
28962
28963 @item ivybridge
28964 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28965 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
28966 instruction set support.
28967
28968 @item haswell
28969 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28970 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28971 BMI, BMI2 and F16C instruction set support.
28972
28973 @item broadwell
28974 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28975 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28976 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
28977
28978 @item skylake
28979 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28980 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28981 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
28982 XSAVES instruction set support.
28983
28984 @item bonnell
28985 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
28986 instruction set support.
28987
28988 @item silvermont
28989 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28990 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
28991
28992 @item goldmont
28993 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28994 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
28995 instruction set support.
28996
28997 @item goldmont-plus
28998 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28999 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
29000 PTWRITE, RDPID, SGX and UMIP instruction set support.
29001
29002 @item tremont
29003 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29004 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
29005 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
29006
29007 @item knl
29008 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29009 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29010 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
29011 AVX512CD instruction set support.
29012
29013 @item knm
29014 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29015 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29016 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
29017 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
29018
29019 @item skylake-avx512
29020 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
29021 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
29022 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
29023 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
29024
29025 @item cannonlake
29026 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
29027 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
29028 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
29029 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
29030 AVX512IFMA, SHA and UMIP instruction set support.
29031
29032 @item icelake-client
29033 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
29034 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
29035 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
29036 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
29037 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
29038 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
29039
29040 @item icelake-server
29041 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
29042 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
29043 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
29044 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
29045 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
29046 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
29047 set support.
29048
29049 @item cascadelake
29050 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29051 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
29052 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
29053 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
29054
29055 @item cooperlake
29056 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29057 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
29058 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
29059 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
29060 set support.
29061
29062 @item tigerlake
29063 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
29064 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
29065 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
29066 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
29067 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
29068 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
29069 set support.
29070
29071 @item k6
29072 AMD K6 CPU with MMX instruction set support.
29073
29074 @item k6-2
29075 @itemx k6-3
29076 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
29077
29078 @item athlon
29079 @itemx athlon-tbird
29080 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
29081 support.
29082
29083 @item athlon-4
29084 @itemx athlon-xp
29085 @itemx athlon-mp
29086 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
29087 instruction set support.
29088
29089 @item k8
29090 @itemx opteron
29091 @itemx athlon64
29092 @itemx athlon-fx
29093 Processors based on the AMD K8 core with x86-64 instruction set support,
29094 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
29095 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
29096 instruction set extensions.)
29097
29098 @item k8-sse3
29099 @itemx opteron-sse3
29100 @itemx athlon64-sse3
29101 Improved versions of AMD K8 cores with SSE3 instruction set support.
29102
29103 @item amdfam10
29104 @itemx barcelona
29105 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
29106 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
29107 instruction set extensions.)
29108
29109 @item bdver1
29110 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
29111 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
29112 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
29113
29114 @item bdver2
29115 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
29116 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
29117 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
29118 extensions.)
29119
29120 @item bdver3
29121 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
29122 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
29123 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
29124 64-bit instruction set extensions.)
29125
29126 @item bdver4
29127 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
29128 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
29129 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
29130 SSE4.2, ABM and 64-bit instruction set extensions.)
29131
29132 @item znver1
29133 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
29134 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
29135 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
29136 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
29137 instruction set extensions.)
29138
29139 @item znver2
29140 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
29141 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
29142 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
29143 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
29144 WBNOINVD, and 64-bit instruction set extensions.)
29145
29146 @item btver1
29147 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
29148 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
29149 instruction set extensions.)
29150
29151 @item btver2
29152 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
29153 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
29154 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
29155
29156 @item winchip-c6
29157 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
29158 set support.
29159
29160 @item winchip2
29161 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
29162 instruction set support.
29163
29164 @item c3
29165 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
29166 (No scheduling is implemented for this chip.)
29167
29168 @item c3-2
29169 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
29170 (No scheduling is implemented for this chip.)
29171
29172 @item c7
29173 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
29174 (No scheduling is implemented for this chip.)
29175
29176 @item samuel-2
29177 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
29178 (No scheduling is implemented for this chip.)
29179
29180 @item nehemiah
29181 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
29182 (No scheduling is implemented for this chip.)
29183
29184 @item esther
29185 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
29186 (No scheduling is implemented for this chip.)
29187
29188 @item eden-x2
29189 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
29190 (No scheduling is implemented for this chip.)
29191
29192 @item eden-x4
29193 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
29194 AVX and AVX2 instruction set support.
29195 (No scheduling is implemented for this chip.)
29196
29197 @item nano
29198 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
29199 instruction set support.
29200 (No scheduling is implemented for this chip.)
29201
29202 @item nano-1000
29203 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
29204 instruction set support.
29205 (No scheduling is implemented for this chip.)
29206
29207 @item nano-2000
29208 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
29209 instruction set support.
29210 (No scheduling is implemented for this chip.)
29211
29212 @item nano-3000
29213 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29214 instruction set support.
29215 (No scheduling is implemented for this chip.)
29216
29217 @item nano-x2
29218 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29219 instruction set support.
29220 (No scheduling is implemented for this chip.)
29221
29222 @item nano-x4
29223 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29224 instruction set support.
29225 (No scheduling is implemented for this chip.)
29226
29227 @item geode
29228 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
29229 @end table
29230
29231 @item -mtune=@var{cpu-type}
29232 @opindex mtune
29233 Tune to @var{cpu-type} everything applicable about the generated code, except
29234 for the ABI and the set of available instructions.
29235 While picking a specific @var{cpu-type} schedules things appropriately
29236 for that particular chip, the compiler does not generate any code that
29237 cannot run on the default machine type unless you use a
29238 @option{-march=@var{cpu-type}} option.
29239 For example, if GCC is configured for i686-pc-linux-gnu
29240 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
29241 but still runs on i686 machines.
29242
29243 The choices for @var{cpu-type} are the same as for @option{-march}.
29244 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
29245
29246 @table @samp
29247 @item generic
29248 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
29249 If you know the CPU on which your code will run, then you should use
29250 the corresponding @option{-mtune} or @option{-march} option instead of
29251 @option{-mtune=generic}. But, if you do not know exactly what CPU users
29252 of your application will have, then you should use this option.
29253
29254 As new processors are deployed in the marketplace, the behavior of this
29255 option will change. Therefore, if you upgrade to a newer version of
29256 GCC, code generation controlled by this option will change to reflect
29257 the processors
29258 that are most common at the time that version of GCC is released.
29259
29260 There is no @option{-march=generic} option because @option{-march}
29261 indicates the instruction set the compiler can use, and there is no
29262 generic instruction set applicable to all processors. In contrast,
29263 @option{-mtune} indicates the processor (or, in this case, collection of
29264 processors) for which the code is optimized.
29265
29266 @item intel
29267 Produce code optimized for the most current Intel processors, which are
29268 Haswell and Silvermont for this version of GCC. If you know the CPU
29269 on which your code will run, then you should use the corresponding
29270 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
29271 But, if you want your application performs better on both Haswell and
29272 Silvermont, then you should use this option.
29273
29274 As new Intel processors are deployed in the marketplace, the behavior of
29275 this option will change. Therefore, if you upgrade to a newer version of
29276 GCC, code generation controlled by this option will change to reflect
29277 the most current Intel processors at the time that version of GCC is
29278 released.
29279
29280 There is no @option{-march=intel} option because @option{-march} indicates
29281 the instruction set the compiler can use, and there is no common
29282 instruction set applicable to all processors. In contrast,
29283 @option{-mtune} indicates the processor (or, in this case, collection of
29284 processors) for which the code is optimized.
29285 @end table
29286
29287 @item -mcpu=@var{cpu-type}
29288 @opindex mcpu
29289 A deprecated synonym for @option{-mtune}.
29290
29291 @item -mfpmath=@var{unit}
29292 @opindex mfpmath
29293 Generate floating-point arithmetic for selected unit @var{unit}. The choices
29294 for @var{unit} are:
29295
29296 @table @samp
29297 @item 387
29298 Use the standard 387 floating-point coprocessor present on the majority of chips and
29299 emulated otherwise. Code compiled with this option runs almost everywhere.
29300 The temporary results are computed in 80-bit precision instead of the precision
29301 specified by the type, resulting in slightly different results compared to most
29302 of other chips. See @option{-ffloat-store} for more detailed description.
29303
29304 This is the default choice for non-Darwin x86-32 targets.
29305
29306 @item sse
29307 Use scalar floating-point instructions present in the SSE instruction set.
29308 This instruction set is supported by Pentium III and newer chips,
29309 and in the AMD line
29310 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
29311 instruction set supports only single-precision arithmetic, thus the double and
29312 extended-precision arithmetic are still done using 387. A later version, present
29313 only in Pentium 4 and AMD x86-64 chips, supports double-precision
29314 arithmetic too.
29315
29316 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
29317 or @option{-msse2} switches to enable SSE extensions and make this option
29318 effective. For the x86-64 compiler, these extensions are enabled by default.
29319
29320 The resulting code should be considerably faster in the majority of cases and avoid
29321 the numerical instability problems of 387 code, but may break some existing
29322 code that expects temporaries to be 80 bits.
29323
29324 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
29325 and the default choice for x86-32 targets with the SSE2 instruction set
29326 when @option{-ffast-math} is enabled.
29327
29328 @item sse,387
29329 @itemx sse+387
29330 @itemx both
29331 Attempt to utilize both instruction sets at once. This effectively doubles the
29332 amount of available registers, and on chips with separate execution units for
29333 387 and SSE the execution resources too. Use this option with care, as it is
29334 still experimental, because the GCC register allocator does not model separate
29335 functional units well, resulting in unstable performance.
29336 @end table
29337
29338 @item -masm=@var{dialect}
29339 @opindex masm=@var{dialect}
29340 Output assembly instructions using selected @var{dialect}. Also affects
29341 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
29342 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
29343 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
29344 not support @samp{intel}.
29345
29346 @item -mieee-fp
29347 @itemx -mno-ieee-fp
29348 @opindex mieee-fp
29349 @opindex mno-ieee-fp
29350 Control whether or not the compiler uses IEEE floating-point
29351 comparisons. These correctly handle the case where the result of a
29352 comparison is unordered.
29353
29354 @item -m80387
29355 @itemx -mhard-float
29356 @opindex 80387
29357 @opindex mhard-float
29358 Generate output containing 80387 instructions for floating point.
29359
29360 @item -mno-80387
29361 @itemx -msoft-float
29362 @opindex no-80387
29363 @opindex msoft-float
29364 Generate output containing library calls for floating point.
29365
29366 @strong{Warning:} the requisite libraries are not part of GCC@.
29367 Normally the facilities of the machine's usual C compiler are used, but
29368 this cannot be done directly in cross-compilation. You must make your
29369 own arrangements to provide suitable library functions for
29370 cross-compilation.
29371
29372 On machines where a function returns floating-point results in the 80387
29373 register stack, some floating-point opcodes may be emitted even if
29374 @option{-msoft-float} is used.
29375
29376 @item -mno-fp-ret-in-387
29377 @opindex mno-fp-ret-in-387
29378 @opindex mfp-ret-in-387
29379 Do not use the FPU registers for return values of functions.
29380
29381 The usual calling convention has functions return values of types
29382 @code{float} and @code{double} in an FPU register, even if there
29383 is no FPU@. The idea is that the operating system should emulate
29384 an FPU@.
29385
29386 The option @option{-mno-fp-ret-in-387} causes such values to be returned
29387 in ordinary CPU registers instead.
29388
29389 @item -mno-fancy-math-387
29390 @opindex mno-fancy-math-387
29391 @opindex mfancy-math-387
29392 Some 387 emulators do not support the @code{sin}, @code{cos} and
29393 @code{sqrt} instructions for the 387. Specify this option to avoid
29394 generating those instructions.
29395 This option is overridden when @option{-march}
29396 indicates that the target CPU always has an FPU and so the
29397 instruction does not need emulation. These
29398 instructions are not generated unless you also use the
29399 @option{-funsafe-math-optimizations} switch.
29400
29401 @item -malign-double
29402 @itemx -mno-align-double
29403 @opindex malign-double
29404 @opindex mno-align-double
29405 Control whether GCC aligns @code{double}, @code{long double}, and
29406 @code{long long} variables on a two-word boundary or a one-word
29407 boundary. Aligning @code{double} variables on a two-word boundary
29408 produces code that runs somewhat faster on a Pentium at the
29409 expense of more memory.
29410
29411 On x86-64, @option{-malign-double} is enabled by default.
29412
29413 @strong{Warning:} if you use the @option{-malign-double} switch,
29414 structures containing the above types are aligned differently than
29415 the published application binary interface specifications for the x86-32
29416 and are not binary compatible with structures in code compiled
29417 without that switch.
29418
29419 @item -m96bit-long-double
29420 @itemx -m128bit-long-double
29421 @opindex m96bit-long-double
29422 @opindex m128bit-long-double
29423 These switches control the size of @code{long double} type. The x86-32
29424 application binary interface specifies the size to be 96 bits,
29425 so @option{-m96bit-long-double} is the default in 32-bit mode.
29426
29427 Modern architectures (Pentium and newer) prefer @code{long double}
29428 to be aligned to an 8- or 16-byte boundary. In arrays or structures
29429 conforming to the ABI, this is not possible. So specifying
29430 @option{-m128bit-long-double} aligns @code{long double}
29431 to a 16-byte boundary by padding the @code{long double} with an additional
29432 32-bit zero.
29433
29434 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
29435 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
29436
29437 Notice that neither of these options enable any extra precision over the x87
29438 standard of 80 bits for a @code{long double}.
29439
29440 @strong{Warning:} if you override the default value for your target ABI, this
29441 changes the size of
29442 structures and arrays containing @code{long double} variables,
29443 as well as modifying the function calling convention for functions taking
29444 @code{long double}. Hence they are not binary-compatible
29445 with code compiled without that switch.
29446
29447 @item -mlong-double-64
29448 @itemx -mlong-double-80
29449 @itemx -mlong-double-128
29450 @opindex mlong-double-64
29451 @opindex mlong-double-80
29452 @opindex mlong-double-128
29453 These switches control the size of @code{long double} type. A size
29454 of 64 bits makes the @code{long double} type equivalent to the @code{double}
29455 type. This is the default for 32-bit Bionic C library. A size
29456 of 128 bits makes the @code{long double} type equivalent to the
29457 @code{__float128} type. This is the default for 64-bit Bionic C library.
29458
29459 @strong{Warning:} if you override the default value for your target ABI, this
29460 changes the size of
29461 structures and arrays containing @code{long double} variables,
29462 as well as modifying the function calling convention for functions taking
29463 @code{long double}. Hence they are not binary-compatible
29464 with code compiled without that switch.
29465
29466 @item -malign-data=@var{type}
29467 @opindex malign-data
29468 Control how GCC aligns variables. Supported values for @var{type} are
29469 @samp{compat} uses increased alignment value compatible uses GCC 4.8
29470 and earlier, @samp{abi} uses alignment value as specified by the
29471 psABI, and @samp{cacheline} uses increased alignment value to match
29472 the cache line size. @samp{compat} is the default.
29473
29474 @item -mlarge-data-threshold=@var{threshold}
29475 @opindex mlarge-data-threshold
29476 When @option{-mcmodel=medium} is specified, data objects larger than
29477 @var{threshold} are placed in the large data section. This value must be the
29478 same across all objects linked into the binary, and defaults to 65535.
29479
29480 @item -mrtd
29481 @opindex mrtd
29482 Use a different function-calling convention, in which functions that
29483 take a fixed number of arguments return with the @code{ret @var{num}}
29484 instruction, which pops their arguments while returning. This saves one
29485 instruction in the caller since there is no need to pop the arguments
29486 there.
29487
29488 You can specify that an individual function is called with this calling
29489 sequence with the function attribute @code{stdcall}. You can also
29490 override the @option{-mrtd} option by using the function attribute
29491 @code{cdecl}. @xref{Function Attributes}.
29492
29493 @strong{Warning:} this calling convention is incompatible with the one
29494 normally used on Unix, so you cannot use it if you need to call
29495 libraries compiled with the Unix compiler.
29496
29497 Also, you must provide function prototypes for all functions that
29498 take variable numbers of arguments (including @code{printf});
29499 otherwise incorrect code is generated for calls to those
29500 functions.
29501
29502 In addition, seriously incorrect code results if you call a
29503 function with too many arguments. (Normally, extra arguments are
29504 harmlessly ignored.)
29505
29506 @item -mregparm=@var{num}
29507 @opindex mregparm
29508 Control how many registers are used to pass integer arguments. By
29509 default, no registers are used to pass arguments, and at most 3
29510 registers can be used. You can control this behavior for a specific
29511 function by using the function attribute @code{regparm}.
29512 @xref{Function Attributes}.
29513
29514 @strong{Warning:} if you use this switch, and
29515 @var{num} is nonzero, then you must build all modules with the same
29516 value, including any libraries. This includes the system libraries and
29517 startup modules.
29518
29519 @item -msseregparm
29520 @opindex msseregparm
29521 Use SSE register passing conventions for float and double arguments
29522 and return values. You can control this behavior for a specific
29523 function by using the function attribute @code{sseregparm}.
29524 @xref{Function Attributes}.
29525
29526 @strong{Warning:} if you use this switch then you must build all
29527 modules with the same value, including any libraries. This includes
29528 the system libraries and startup modules.
29529
29530 @item -mvect8-ret-in-mem
29531 @opindex mvect8-ret-in-mem
29532 Return 8-byte vectors in memory instead of MMX registers. This is the
29533 default on VxWorks to match the ABI of the Sun Studio compilers until
29534 version 12. @emph{Only} use this option if you need to remain
29535 compatible with existing code produced by those previous compiler
29536 versions or older versions of GCC@.
29537
29538 @item -mpc32
29539 @itemx -mpc64
29540 @itemx -mpc80
29541 @opindex mpc32
29542 @opindex mpc64
29543 @opindex mpc80
29544
29545 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
29546 is specified, the significands of results of floating-point operations are
29547 rounded to 24 bits (single precision); @option{-mpc64} rounds the
29548 significands of results of floating-point operations to 53 bits (double
29549 precision) and @option{-mpc80} rounds the significands of results of
29550 floating-point operations to 64 bits (extended double precision), which is
29551 the default. When this option is used, floating-point operations in higher
29552 precisions are not available to the programmer without setting the FPU
29553 control word explicitly.
29554
29555 Setting the rounding of floating-point operations to less than the default
29556 80 bits can speed some programs by 2% or more. Note that some mathematical
29557 libraries assume that extended-precision (80-bit) floating-point operations
29558 are enabled by default; routines in such libraries could suffer significant
29559 loss of accuracy, typically through so-called ``catastrophic cancellation'',
29560 when this option is used to set the precision to less than extended precision.
29561
29562 @item -mstackrealign
29563 @opindex mstackrealign
29564 Realign the stack at entry. On the x86, the @option{-mstackrealign}
29565 option generates an alternate prologue and epilogue that realigns the
29566 run-time stack if necessary. This supports mixing legacy codes that keep
29567 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
29568 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
29569 applicable to individual functions.
29570
29571 @item -mpreferred-stack-boundary=@var{num}
29572 @opindex mpreferred-stack-boundary
29573 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29574 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
29575 the default is 4 (16 bytes or 128 bits).
29576
29577 @strong{Warning:} When generating code for the x86-64 architecture with
29578 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29579 used to keep the stack boundary aligned to 8 byte boundary. Since
29580 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29581 intended to be used in controlled environment where stack space is
29582 important limitation. This option leads to wrong code when functions
29583 compiled with 16 byte stack alignment (such as functions from a standard
29584 library) are called with misaligned stack. In this case, SSE
29585 instructions may lead to misaligned memory access traps. In addition,
29586 variable arguments are handled incorrectly for 16 byte aligned
29587 objects (including x87 long double and __int128), leading to wrong
29588 results. You must build all modules with
29589 @option{-mpreferred-stack-boundary=3}, including any libraries. This
29590 includes the system libraries and startup modules.
29591
29592 @item -mincoming-stack-boundary=@var{num}
29593 @opindex mincoming-stack-boundary
29594 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29595 boundary. If @option{-mincoming-stack-boundary} is not specified,
29596 the one specified by @option{-mpreferred-stack-boundary} is used.
29597
29598 On Pentium and Pentium Pro, @code{double} and @code{long double} values
29599 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29600 suffer significant run time performance penalties. On Pentium III, the
29601 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29602 properly if it is not 16-byte aligned.
29603
29604 To ensure proper alignment of this values on the stack, the stack boundary
29605 must be as aligned as that required by any value stored on the stack.
29606 Further, every function must be generated such that it keeps the stack
29607 aligned. Thus calling a function compiled with a higher preferred
29608 stack boundary from a function compiled with a lower preferred stack
29609 boundary most likely misaligns the stack. It is recommended that
29610 libraries that use callbacks always use the default setting.
29611
29612 This extra alignment does consume extra stack space, and generally
29613 increases code size. Code that is sensitive to stack space usage, such
29614 as embedded systems and operating system kernels, may want to reduce the
29615 preferred alignment to @option{-mpreferred-stack-boundary=2}.
29616
29617 @need 200
29618 @item -mmmx
29619 @opindex mmmx
29620 @need 200
29621 @itemx -msse
29622 @opindex msse
29623 @need 200
29624 @itemx -msse2
29625 @opindex msse2
29626 @need 200
29627 @itemx -msse3
29628 @opindex msse3
29629 @need 200
29630 @itemx -mssse3
29631 @opindex mssse3
29632 @need 200
29633 @itemx -msse4
29634 @opindex msse4
29635 @need 200
29636 @itemx -msse4a
29637 @opindex msse4a
29638 @need 200
29639 @itemx -msse4.1
29640 @opindex msse4.1
29641 @need 200
29642 @itemx -msse4.2
29643 @opindex msse4.2
29644 @need 200
29645 @itemx -mavx
29646 @opindex mavx
29647 @need 200
29648 @itemx -mavx2
29649 @opindex mavx2
29650 @need 200
29651 @itemx -mavx512f
29652 @opindex mavx512f
29653 @need 200
29654 @itemx -mavx512pf
29655 @opindex mavx512pf
29656 @need 200
29657 @itemx -mavx512er
29658 @opindex mavx512er
29659 @need 200
29660 @itemx -mavx512cd
29661 @opindex mavx512cd
29662 @need 200
29663 @itemx -mavx512vl
29664 @opindex mavx512vl
29665 @need 200
29666 @itemx -mavx512bw
29667 @opindex mavx512bw
29668 @need 200
29669 @itemx -mavx512dq
29670 @opindex mavx512dq
29671 @need 200
29672 @itemx -mavx512ifma
29673 @opindex mavx512ifma
29674 @need 200
29675 @itemx -mavx512vbmi
29676 @opindex mavx512vbmi
29677 @need 200
29678 @itemx -msha
29679 @opindex msha
29680 @need 200
29681 @itemx -maes
29682 @opindex maes
29683 @need 200
29684 @itemx -mpclmul
29685 @opindex mpclmul
29686 @need 200
29687 @itemx -mclflushopt
29688 @opindex mclflushopt
29689 @need 200
29690 @itemx -mclwb
29691 @opindex mclwb
29692 @need 200
29693 @itemx -mfsgsbase
29694 @opindex mfsgsbase
29695 @need 200
29696 @itemx -mptwrite
29697 @opindex mptwrite
29698 @need 200
29699 @itemx -mrdrnd
29700 @opindex mrdrnd
29701 @need 200
29702 @itemx -mf16c
29703 @opindex mf16c
29704 @need 200
29705 @itemx -mfma
29706 @opindex mfma
29707 @need 200
29708 @itemx -mpconfig
29709 @opindex mpconfig
29710 @need 200
29711 @itemx -mwbnoinvd
29712 @opindex mwbnoinvd
29713 @need 200
29714 @itemx -mfma4
29715 @opindex mfma4
29716 @need 200
29717 @itemx -mprfchw
29718 @opindex mprfchw
29719 @need 200
29720 @itemx -mrdpid
29721 @opindex mrdpid
29722 @need 200
29723 @itemx -mprefetchwt1
29724 @opindex mprefetchwt1
29725 @need 200
29726 @itemx -mrdseed
29727 @opindex mrdseed
29728 @need 200
29729 @itemx -msgx
29730 @opindex msgx
29731 @need 200
29732 @itemx -mxop
29733 @opindex mxop
29734 @need 200
29735 @itemx -mlwp
29736 @opindex mlwp
29737 @need 200
29738 @itemx -m3dnow
29739 @opindex m3dnow
29740 @need 200
29741 @itemx -m3dnowa
29742 @opindex m3dnowa
29743 @need 200
29744 @itemx -mpopcnt
29745 @opindex mpopcnt
29746 @need 200
29747 @itemx -mabm
29748 @opindex mabm
29749 @need 200
29750 @itemx -madx
29751 @opindex madx
29752 @need 200
29753 @itemx -mbmi
29754 @opindex mbmi
29755 @need 200
29756 @itemx -mbmi2
29757 @opindex mbmi2
29758 @need 200
29759 @itemx -mlzcnt
29760 @opindex mlzcnt
29761 @need 200
29762 @itemx -mfxsr
29763 @opindex mfxsr
29764 @need 200
29765 @itemx -mxsave
29766 @opindex mxsave
29767 @need 200
29768 @itemx -mxsaveopt
29769 @opindex mxsaveopt
29770 @need 200
29771 @itemx -mxsavec
29772 @opindex mxsavec
29773 @need 200
29774 @itemx -mxsaves
29775 @opindex mxsaves
29776 @need 200
29777 @itemx -mrtm
29778 @opindex mrtm
29779 @need 200
29780 @itemx -mhle
29781 @opindex mhle
29782 @need 200
29783 @itemx -mtbm
29784 @opindex mtbm
29785 @need 200
29786 @itemx -mmwaitx
29787 @opindex mmwaitx
29788 @need 200
29789 @itemx -mclzero
29790 @opindex mclzero
29791 @need 200
29792 @itemx -mpku
29793 @opindex mpku
29794 @need 200
29795 @itemx -mavx512vbmi2
29796 @opindex mavx512vbmi2
29797 @need 200
29798 @itemx -mavx512bf16
29799 @opindex mavx512bf16
29800 @need 200
29801 @itemx -mgfni
29802 @opindex mgfni
29803 @need 200
29804 @itemx -mvaes
29805 @opindex mvaes
29806 @need 200
29807 @itemx -mwaitpkg
29808 @opindex mwaitpkg
29809 @need 200
29810 @itemx -mvpclmulqdq
29811 @opindex mvpclmulqdq
29812 @need 200
29813 @itemx -mavx512bitalg
29814 @opindex mavx512bitalg
29815 @need 200
29816 @itemx -mmovdiri
29817 @opindex mmovdiri
29818 @need 200
29819 @itemx -mmovdir64b
29820 @opindex mmovdir64b
29821 @need 200
29822 @itemx -menqcmd
29823 @opindex menqcmd
29824 @need 200
29825 @itemx -mtsxldtrk
29826 @opindex mtsxldtrk
29827 @need 200
29828 @itemx -mavx512vpopcntdq
29829 @opindex mavx512vpopcntdq
29830 @need 200
29831 @itemx -mavx512vp2intersect
29832 @opindex mavx512vp2intersect
29833 @need 200
29834 @itemx -mavx5124fmaps
29835 @opindex mavx5124fmaps
29836 @need 200
29837 @itemx -mavx512vnni
29838 @opindex mavx512vnni
29839 @need 200
29840 @itemx -mavx5124vnniw
29841 @opindex mavx5124vnniw
29842 @need 200
29843 @itemx -mcldemote
29844 @opindex mcldemote
29845 @need 200
29846 @itemx -mserialize
29847 @opindex mserialize
29848 These switches enable the use of instructions in the MMX, SSE,
29849 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
29850 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
29851 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
29852 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
29853 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
29854 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
29855 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
29856 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE
29857 or CLDEMOTE extended instruction sets. Each has a corresponding
29858 @option{-mno-} option to disable use of these instructions.
29859
29860 These extensions are also available as built-in functions: see
29861 @ref{x86 Built-in Functions}, for details of the functions enabled and
29862 disabled by these switches.
29863
29864 To generate SSE/SSE2 instructions automatically from floating-point
29865 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
29866
29867 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
29868 generates new AVX instructions or AVX equivalence for all SSEx instructions
29869 when needed.
29870
29871 These options enable GCC to use these extended instructions in
29872 generated code, even without @option{-mfpmath=sse}. Applications that
29873 perform run-time CPU detection must compile separate files for each
29874 supported architecture, using the appropriate flags. In particular,
29875 the file containing the CPU detection code should be compiled without
29876 these options.
29877
29878 @item -mdump-tune-features
29879 @opindex mdump-tune-features
29880 This option instructs GCC to dump the names of the x86 performance
29881 tuning features and default settings. The names can be used in
29882 @option{-mtune-ctrl=@var{feature-list}}.
29883
29884 @item -mtune-ctrl=@var{feature-list}
29885 @opindex mtune-ctrl=@var{feature-list}
29886 This option is used to do fine grain control of x86 code generation features.
29887 @var{feature-list} is a comma separated list of @var{feature} names. See also
29888 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
29889 on if it is not preceded with @samp{^}, otherwise, it is turned off.
29890 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
29891 developers. Using it may lead to code paths not covered by testing and can
29892 potentially result in compiler ICEs or runtime errors.
29893
29894 @item -mno-default
29895 @opindex mno-default
29896 This option instructs GCC to turn off all tunable features. See also
29897 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
29898
29899 @item -mcld
29900 @opindex mcld
29901 This option instructs GCC to emit a @code{cld} instruction in the prologue
29902 of functions that use string instructions. String instructions depend on
29903 the DF flag to select between autoincrement or autodecrement mode. While the
29904 ABI specifies the DF flag to be cleared on function entry, some operating
29905 systems violate this specification by not clearing the DF flag in their
29906 exception dispatchers. The exception handler can be invoked with the DF flag
29907 set, which leads to wrong direction mode when string instructions are used.
29908 This option can be enabled by default on 32-bit x86 targets by configuring
29909 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
29910 instructions can be suppressed with the @option{-mno-cld} compiler option
29911 in this case.
29912
29913 @item -mvzeroupper
29914 @opindex mvzeroupper
29915 This option instructs GCC to emit a @code{vzeroupper} instruction
29916 before a transfer of control flow out of the function to minimize
29917 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
29918 intrinsics.
29919
29920 @item -mprefer-avx128
29921 @opindex mprefer-avx128
29922 This option instructs GCC to use 128-bit AVX instructions instead of
29923 256-bit AVX instructions in the auto-vectorizer.
29924
29925 @item -mprefer-vector-width=@var{opt}
29926 @opindex mprefer-vector-width
29927 This option instructs GCC to use @var{opt}-bit vector width in instructions
29928 instead of default on the selected platform.
29929
29930 @table @samp
29931 @item none
29932 No extra limitations applied to GCC other than defined by the selected platform.
29933
29934 @item 128
29935 Prefer 128-bit vector width for instructions.
29936
29937 @item 256
29938 Prefer 256-bit vector width for instructions.
29939
29940 @item 512
29941 Prefer 512-bit vector width for instructions.
29942 @end table
29943
29944 @item -mcx16
29945 @opindex mcx16
29946 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
29947 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
29948 objects. This is useful for atomic updates of data structures exceeding one
29949 machine word in size. The compiler uses this instruction to implement
29950 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
29951 128-bit integers, a library call is always used.
29952
29953 @item -msahf
29954 @opindex msahf
29955 This option enables generation of @code{SAHF} instructions in 64-bit code.
29956 Early Intel Pentium 4 CPUs with Intel 64 support,
29957 prior to the introduction of Pentium 4 G1 step in December 2005,
29958 lacked the @code{LAHF} and @code{SAHF} instructions
29959 which are supported by AMD64.
29960 These are load and store instructions, respectively, for certain status flags.
29961 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
29962 @code{drem}, and @code{remainder} built-in functions;
29963 see @ref{Other Builtins} for details.
29964
29965 @item -mmovbe
29966 @opindex mmovbe
29967 This option enables use of the @code{movbe} instruction to implement
29968 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
29969
29970 @item -mshstk
29971 @opindex mshstk
29972 The @option{-mshstk} option enables shadow stack built-in functions
29973 from x86 Control-flow Enforcement Technology (CET).
29974
29975 @item -mcrc32
29976 @opindex mcrc32
29977 This option enables built-in functions @code{__builtin_ia32_crc32qi},
29978 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
29979 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
29980
29981 @item -mrecip
29982 @opindex mrecip
29983 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
29984 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
29985 with an additional Newton-Raphson step
29986 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
29987 (and their vectorized
29988 variants) for single-precision floating-point arguments. These instructions
29989 are generated only when @option{-funsafe-math-optimizations} is enabled
29990 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
29991 Note that while the throughput of the sequence is higher than the throughput
29992 of the non-reciprocal instruction, the precision of the sequence can be
29993 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
29994
29995 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
29996 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
29997 combination), and doesn't need @option{-mrecip}.
29998
29999 Also note that GCC emits the above sequence with additional Newton-Raphson step
30000 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
30001 already with @option{-ffast-math} (or the above option combination), and
30002 doesn't need @option{-mrecip}.
30003
30004 @item -mrecip=@var{opt}
30005 @opindex mrecip=opt
30006 This option controls which reciprocal estimate instructions
30007 may be used. @var{opt} is a comma-separated list of options, which may
30008 be preceded by a @samp{!} to invert the option:
30009
30010 @table @samp
30011 @item all
30012 Enable all estimate instructions.
30013
30014 @item default
30015 Enable the default instructions, equivalent to @option{-mrecip}.
30016
30017 @item none
30018 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30019
30020 @item div
30021 Enable the approximation for scalar division.
30022
30023 @item vec-div
30024 Enable the approximation for vectorized division.
30025
30026 @item sqrt
30027 Enable the approximation for scalar square root.
30028
30029 @item vec-sqrt
30030 Enable the approximation for vectorized square root.
30031 @end table
30032
30033 So, for example, @option{-mrecip=all,!sqrt} enables
30034 all of the reciprocal approximations, except for square root.
30035
30036 @item -mveclibabi=@var{type}
30037 @opindex mveclibabi
30038 Specifies the ABI type to use for vectorizing intrinsics using an
30039 external library. Supported values for @var{type} are @samp{svml}
30040 for the Intel short
30041 vector math library and @samp{acml} for the AMD math core library.
30042 To use this option, both @option{-ftree-vectorize} and
30043 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
30044 ABI-compatible library must be specified at link time.
30045
30046 GCC currently emits calls to @code{vmldExp2},
30047 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
30048 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
30049 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
30050 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
30051 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
30052 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
30053 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
30054 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
30055 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
30056 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
30057 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
30058 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
30059 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
30060 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
30061 when @option{-mveclibabi=acml} is used.
30062
30063 @item -mabi=@var{name}
30064 @opindex mabi
30065 Generate code for the specified calling convention. Permissible values
30066 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
30067 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
30068 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
30069 You can control this behavior for specific functions by
30070 using the function attributes @code{ms_abi} and @code{sysv_abi}.
30071 @xref{Function Attributes}.
30072
30073 @item -mforce-indirect-call
30074 @opindex mforce-indirect-call
30075 Force all calls to functions to be indirect. This is useful
30076 when using Intel Processor Trace where it generates more precise timing
30077 information for function calls.
30078
30079 @item -mmanual-endbr
30080 @opindex mmanual-endbr
30081 Insert ENDBR instruction at function entry only via the @code{cf_check}
30082 function attribute. This is useful when used with the option
30083 @option{-fcf-protection=branch} to control ENDBR insertion at the
30084 function entry.
30085
30086 @item -mcall-ms2sysv-xlogues
30087 @opindex mcall-ms2sysv-xlogues
30088 @opindex mno-call-ms2sysv-xlogues
30089 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
30090 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
30091 default, the code for saving and restoring these registers is emitted inline,
30092 resulting in fairly lengthy prologues and epilogues. Using
30093 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
30094 use stubs in the static portion of libgcc to perform these saves and restores,
30095 thus reducing function size at the cost of a few extra instructions.
30096
30097 @item -mtls-dialect=@var{type}
30098 @opindex mtls-dialect
30099 Generate code to access thread-local storage using the @samp{gnu} or
30100 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
30101 @samp{gnu2} is more efficient, but it may add compile- and run-time
30102 requirements that cannot be satisfied on all systems.
30103
30104 @item -mpush-args
30105 @itemx -mno-push-args
30106 @opindex mpush-args
30107 @opindex mno-push-args
30108 Use PUSH operations to store outgoing parameters. This method is shorter
30109 and usually equally fast as method using SUB/MOV operations and is enabled
30110 by default. In some cases disabling it may improve performance because of
30111 improved scheduling and reduced dependencies.
30112
30113 @item -maccumulate-outgoing-args
30114 @opindex maccumulate-outgoing-args
30115 If enabled, the maximum amount of space required for outgoing arguments is
30116 computed in the function prologue. This is faster on most modern CPUs
30117 because of reduced dependencies, improved scheduling and reduced stack usage
30118 when the preferred stack boundary is not equal to 2. The drawback is a notable
30119 increase in code size. This switch implies @option{-mno-push-args}.
30120
30121 @item -mthreads
30122 @opindex mthreads
30123 Support thread-safe exception handling on MinGW. Programs that rely
30124 on thread-safe exception handling must compile and link all code with the
30125 @option{-mthreads} option. When compiling, @option{-mthreads} defines
30126 @option{-D_MT}; when linking, it links in a special thread helper library
30127 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
30128
30129 @item -mms-bitfields
30130 @itemx -mno-ms-bitfields
30131 @opindex mms-bitfields
30132 @opindex mno-ms-bitfields
30133
30134 Enable/disable bit-field layout compatible with the native Microsoft
30135 Windows compiler.
30136
30137 If @code{packed} is used on a structure, or if bit-fields are used,
30138 it may be that the Microsoft ABI lays out the structure differently
30139 than the way GCC normally does. Particularly when moving packed
30140 data between functions compiled with GCC and the native Microsoft compiler
30141 (either via function call or as data in a file), it may be necessary to access
30142 either format.
30143
30144 This option is enabled by default for Microsoft Windows
30145 targets. This behavior can also be controlled locally by use of variable
30146 or type attributes. For more information, see @ref{x86 Variable Attributes}
30147 and @ref{x86 Type Attributes}.
30148
30149 The Microsoft structure layout algorithm is fairly simple with the exception
30150 of the bit-field packing.
30151 The padding and alignment of members of structures and whether a bit-field
30152 can straddle a storage-unit boundary are determine by these rules:
30153
30154 @enumerate
30155 @item Structure members are stored sequentially in the order in which they are
30156 declared: the first member has the lowest memory address and the last member
30157 the highest.
30158
30159 @item Every data object has an alignment requirement. The alignment requirement
30160 for all data except structures, unions, and arrays is either the size of the
30161 object or the current packing size (specified with either the
30162 @code{aligned} attribute or the @code{pack} pragma),
30163 whichever is less. For structures, unions, and arrays,
30164 the alignment requirement is the largest alignment requirement of its members.
30165 Every object is allocated an offset so that:
30166
30167 @smallexample
30168 offset % alignment_requirement == 0
30169 @end smallexample
30170
30171 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
30172 unit if the integral types are the same size and if the next bit-field fits
30173 into the current allocation unit without crossing the boundary imposed by the
30174 common alignment requirements of the bit-fields.
30175 @end enumerate
30176
30177 MSVC interprets zero-length bit-fields in the following ways:
30178
30179 @enumerate
30180 @item If a zero-length bit-field is inserted between two bit-fields that
30181 are normally coalesced, the bit-fields are not coalesced.
30182
30183 For example:
30184
30185 @smallexample
30186 struct
30187 @{
30188 unsigned long bf_1 : 12;
30189 unsigned long : 0;
30190 unsigned long bf_2 : 12;
30191 @} t1;
30192 @end smallexample
30193
30194 @noindent
30195 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
30196 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
30197
30198 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
30199 alignment of the zero-length bit-field is greater than the member that follows it,
30200 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
30201
30202 For example:
30203
30204 @smallexample
30205 struct
30206 @{
30207 char foo : 4;
30208 short : 0;
30209 char bar;
30210 @} t2;
30211
30212 struct
30213 @{
30214 char foo : 4;
30215 short : 0;
30216 double bar;
30217 @} t3;
30218 @end smallexample
30219
30220 @noindent
30221 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
30222 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
30223 bit-field does not affect the alignment of @code{bar} or, as a result, the size
30224 of the structure.
30225
30226 Taking this into account, it is important to note the following:
30227
30228 @enumerate
30229 @item If a zero-length bit-field follows a normal bit-field, the type of the
30230 zero-length bit-field may affect the alignment of the structure as whole. For
30231 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
30232 normal bit-field, and is of type short.
30233
30234 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
30235 still affect the alignment of the structure:
30236
30237 @smallexample
30238 struct
30239 @{
30240 char foo : 6;
30241 long : 0;
30242 @} t4;
30243 @end smallexample
30244
30245 @noindent
30246 Here, @code{t4} takes up 4 bytes.
30247 @end enumerate
30248
30249 @item Zero-length bit-fields following non-bit-field members are ignored:
30250
30251 @smallexample
30252 struct
30253 @{
30254 char foo;
30255 long : 0;
30256 char bar;
30257 @} t5;
30258 @end smallexample
30259
30260 @noindent
30261 Here, @code{t5} takes up 2 bytes.
30262 @end enumerate
30263
30264
30265 @item -mno-align-stringops
30266 @opindex mno-align-stringops
30267 @opindex malign-stringops
30268 Do not align the destination of inlined string operations. This switch reduces
30269 code size and improves performance in case the destination is already aligned,
30270 but GCC doesn't know about it.
30271
30272 @item -minline-all-stringops
30273 @opindex minline-all-stringops
30274 By default GCC inlines string operations only when the destination is
30275 known to be aligned to least a 4-byte boundary.
30276 This enables more inlining and increases code
30277 size, but may improve performance of code that depends on fast
30278 @code{memcpy} and @code{memset} for short lengths.
30279 The option enables inline expansion of @code{strlen} for all
30280 pointer alignments.
30281
30282 @item -minline-stringops-dynamically
30283 @opindex minline-stringops-dynamically
30284 For string operations of unknown size, use run-time checks with
30285 inline code for small blocks and a library call for large blocks.
30286
30287 @item -mstringop-strategy=@var{alg}
30288 @opindex mstringop-strategy=@var{alg}
30289 Override the internal decision heuristic for the particular algorithm to use
30290 for inlining string operations. The allowed values for @var{alg} are:
30291
30292 @table @samp
30293 @item rep_byte
30294 @itemx rep_4byte
30295 @itemx rep_8byte
30296 Expand using i386 @code{rep} prefix of the specified size.
30297
30298 @item byte_loop
30299 @itemx loop
30300 @itemx unrolled_loop
30301 Expand into an inline loop.
30302
30303 @item libcall
30304 Always use a library call.
30305 @end table
30306
30307 @item -mmemcpy-strategy=@var{strategy}
30308 @opindex mmemcpy-strategy=@var{strategy}
30309 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
30310 should be inlined and what inline algorithm to use when the expected size
30311 of the copy operation is known. @var{strategy}
30312 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
30313 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
30314 the max byte size with which inline algorithm @var{alg} is allowed. For the last
30315 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
30316 in the list must be specified in increasing order. The minimal byte size for
30317 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
30318 preceding range.
30319
30320 @item -mmemset-strategy=@var{strategy}
30321 @opindex mmemset-strategy=@var{strategy}
30322 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
30323 @code{__builtin_memset} expansion.
30324
30325 @item -momit-leaf-frame-pointer
30326 @opindex momit-leaf-frame-pointer
30327 Don't keep the frame pointer in a register for leaf functions. This
30328 avoids the instructions to save, set up, and restore frame pointers and
30329 makes an extra register available in leaf functions. The option
30330 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
30331 which might make debugging harder.
30332
30333 @item -mtls-direct-seg-refs
30334 @itemx -mno-tls-direct-seg-refs
30335 @opindex mtls-direct-seg-refs
30336 Controls whether TLS variables may be accessed with offsets from the
30337 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
30338 or whether the thread base pointer must be added. Whether or not this
30339 is valid depends on the operating system, and whether it maps the
30340 segment to cover the entire TLS area.
30341
30342 For systems that use the GNU C Library, the default is on.
30343
30344 @item -msse2avx
30345 @itemx -mno-sse2avx
30346 @opindex msse2avx
30347 Specify that the assembler should encode SSE instructions with VEX
30348 prefix. The option @option{-mavx} turns this on by default.
30349
30350 @item -mfentry
30351 @itemx -mno-fentry
30352 @opindex mfentry
30353 If profiling is active (@option{-pg}), put the profiling
30354 counter call before the prologue.
30355 Note: On x86 architectures the attribute @code{ms_hook_prologue}
30356 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
30357
30358 @item -mrecord-mcount
30359 @itemx -mno-record-mcount
30360 @opindex mrecord-mcount
30361 If profiling is active (@option{-pg}), generate a __mcount_loc section
30362 that contains pointers to each profiling call. This is useful for
30363 automatically patching and out calls.
30364
30365 @item -mnop-mcount
30366 @itemx -mno-nop-mcount
30367 @opindex mnop-mcount
30368 If profiling is active (@option{-pg}), generate the calls to
30369 the profiling functions as NOPs. This is useful when they
30370 should be patched in later dynamically. This is likely only
30371 useful together with @option{-mrecord-mcount}.
30372
30373 @item -minstrument-return=@var{type}
30374 @opindex minstrument-return
30375 Instrument function exit in -pg -mfentry instrumented functions with
30376 call to specified function. This only instruments true returns ending
30377 with ret, but not sibling calls ending with jump. Valid types
30378 are @var{none} to not instrument, @var{call} to generate a call to __return__,
30379 or @var{nop5} to generate a 5 byte nop.
30380
30381 @item -mrecord-return
30382 @itemx -mno-record-return
30383 @opindex mrecord-return
30384 Generate a __return_loc section pointing to all return instrumentation code.
30385
30386 @item -mfentry-name=@var{name}
30387 @opindex mfentry-name
30388 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
30389
30390 @item -mfentry-section=@var{name}
30391 @opindex mfentry-section
30392 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
30393
30394 @item -mskip-rax-setup
30395 @itemx -mno-skip-rax-setup
30396 @opindex mskip-rax-setup
30397 When generating code for the x86-64 architecture with SSE extensions
30398 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
30399 register when there are no variable arguments passed in vector registers.
30400
30401 @strong{Warning:} Since RAX register is used to avoid unnecessarily
30402 saving vector registers on stack when passing variable arguments, the
30403 impacts of this option are callees may waste some stack space,
30404 misbehave or jump to a random location. GCC 4.4 or newer don't have
30405 those issues, regardless the RAX register value.
30406
30407 @item -m8bit-idiv
30408 @itemx -mno-8bit-idiv
30409 @opindex m8bit-idiv
30410 On some processors, like Intel Atom, 8-bit unsigned integer divide is
30411 much faster than 32-bit/64-bit integer divide. This option generates a
30412 run-time check. If both dividend and divisor are within range of 0
30413 to 255, 8-bit unsigned integer divide is used instead of
30414 32-bit/64-bit integer divide.
30415
30416 @item -mavx256-split-unaligned-load
30417 @itemx -mavx256-split-unaligned-store
30418 @opindex mavx256-split-unaligned-load
30419 @opindex mavx256-split-unaligned-store
30420 Split 32-byte AVX unaligned load and store.
30421
30422 @item -mstack-protector-guard=@var{guard}
30423 @itemx -mstack-protector-guard-reg=@var{reg}
30424 @itemx -mstack-protector-guard-offset=@var{offset}
30425 @opindex mstack-protector-guard
30426 @opindex mstack-protector-guard-reg
30427 @opindex mstack-protector-guard-offset
30428 Generate stack protection code using canary at @var{guard}. Supported
30429 locations are @samp{global} for global canary or @samp{tls} for per-thread
30430 canary in the TLS block (the default). This option has effect only when
30431 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
30432
30433 With the latter choice the options
30434 @option{-mstack-protector-guard-reg=@var{reg}} and
30435 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30436 which segment register (@code{%fs} or @code{%gs}) to use as base register
30437 for reading the canary, and from what offset from that base register.
30438 The default for those is as specified in the relevant ABI.
30439
30440 @item -mgeneral-regs-only
30441 @opindex mgeneral-regs-only
30442 Generate code that uses only the general-purpose registers. This
30443 prevents the compiler from using floating-point, vector, mask and bound
30444 registers.
30445
30446 @item -mindirect-branch=@var{choice}
30447 @opindex mindirect-branch
30448 Convert indirect call and jump with @var{choice}. The default is
30449 @samp{keep}, which keeps indirect call and jump unmodified.
30450 @samp{thunk} converts indirect call and jump to call and return thunk.
30451 @samp{thunk-inline} converts indirect call and jump to inlined call
30452 and return thunk. @samp{thunk-extern} converts indirect call and jump
30453 to external call and return thunk provided in a separate object file.
30454 You can control this behavior for a specific function by using the
30455 function attribute @code{indirect_branch}. @xref{Function Attributes}.
30456
30457 Note that @option{-mcmodel=large} is incompatible with
30458 @option{-mindirect-branch=thunk} and
30459 @option{-mindirect-branch=thunk-extern} since the thunk function may
30460 not be reachable in the large code model.
30461
30462 Note that @option{-mindirect-branch=thunk-extern} is compatible with
30463 @option{-fcf-protection=branch} since the external thunk can be made
30464 to enable control-flow check.
30465
30466 @item -mfunction-return=@var{choice}
30467 @opindex mfunction-return
30468 Convert function return with @var{choice}. The default is @samp{keep},
30469 which keeps function return unmodified. @samp{thunk} converts function
30470 return to call and return thunk. @samp{thunk-inline} converts function
30471 return to inlined call and return thunk. @samp{thunk-extern} converts
30472 function return to external call and return thunk provided in a separate
30473 object file. You can control this behavior for a specific function by
30474 using the function attribute @code{function_return}.
30475 @xref{Function Attributes}.
30476
30477 Note that @option{-mindirect-return=thunk-extern} is compatible with
30478 @option{-fcf-protection=branch} since the external thunk can be made
30479 to enable control-flow check.
30480
30481 Note that @option{-mcmodel=large} is incompatible with
30482 @option{-mfunction-return=thunk} and
30483 @option{-mfunction-return=thunk-extern} since the thunk function may
30484 not be reachable in the large code model.
30485
30486
30487 @item -mindirect-branch-register
30488 @opindex mindirect-branch-register
30489 Force indirect call and jump via register.
30490
30491 @end table
30492
30493 These @samp{-m} switches are supported in addition to the above
30494 on x86-64 processors in 64-bit environments.
30495
30496 @table @gcctabopt
30497 @item -m32
30498 @itemx -m64
30499 @itemx -mx32
30500 @itemx -m16
30501 @itemx -miamcu
30502 @opindex m32
30503 @opindex m64
30504 @opindex mx32
30505 @opindex m16
30506 @opindex miamcu
30507 Generate code for a 16-bit, 32-bit or 64-bit environment.
30508 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30509 to 32 bits, and
30510 generates code that runs on any i386 system.
30511
30512 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30513 types to 64 bits, and generates code for the x86-64 architecture.
30514 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30515 and @option{-mdynamic-no-pic} options.
30516
30517 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30518 to 32 bits, and
30519 generates code for the x86-64 architecture.
30520
30521 The @option{-m16} option is the same as @option{-m32}, except for that
30522 it outputs the @code{.code16gcc} assembly directive at the beginning of
30523 the assembly output so that the binary can run in 16-bit mode.
30524
30525 The @option{-miamcu} option generates code which conforms to Intel MCU
30526 psABI. It requires the @option{-m32} option to be turned on.
30527
30528 @item -mno-red-zone
30529 @opindex mno-red-zone
30530 @opindex mred-zone
30531 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
30532 by the x86-64 ABI; it is a 128-byte area beyond the location of the
30533 stack pointer that is not modified by signal or interrupt handlers
30534 and therefore can be used for temporary data without adjusting the stack
30535 pointer. The flag @option{-mno-red-zone} disables this red zone.
30536
30537 @item -mcmodel=small
30538 @opindex mcmodel=small
30539 Generate code for the small code model: the program and its symbols must
30540 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
30541 Programs can be statically or dynamically linked. This is the default
30542 code model.
30543
30544 @item -mcmodel=kernel
30545 @opindex mcmodel=kernel
30546 Generate code for the kernel code model. The kernel runs in the
30547 negative 2 GB of the address space.
30548 This model has to be used for Linux kernel code.
30549
30550 @item -mcmodel=medium
30551 @opindex mcmodel=medium
30552 Generate code for the medium model: the program is linked in the lower 2
30553 GB of the address space. Small symbols are also placed there. Symbols
30554 with sizes larger than @option{-mlarge-data-threshold} are put into
30555 large data or BSS sections and can be located above 2GB. Programs can
30556 be statically or dynamically linked.
30557
30558 @item -mcmodel=large
30559 @opindex mcmodel=large
30560 Generate code for the large model. This model makes no assumptions
30561 about addresses and sizes of sections.
30562
30563 @item -maddress-mode=long
30564 @opindex maddress-mode=long
30565 Generate code for long address mode. This is only supported for 64-bit
30566 and x32 environments. It is the default address mode for 64-bit
30567 environments.
30568
30569 @item -maddress-mode=short
30570 @opindex maddress-mode=short
30571 Generate code for short address mode. This is only supported for 32-bit
30572 and x32 environments. It is the default address mode for 32-bit and
30573 x32 environments.
30574 @end table
30575
30576 @node x86 Windows Options
30577 @subsection x86 Windows Options
30578 @cindex x86 Windows Options
30579 @cindex Windows Options for x86
30580
30581 These additional options are available for Microsoft Windows targets:
30582
30583 @table @gcctabopt
30584 @item -mconsole
30585 @opindex mconsole
30586 This option
30587 specifies that a console application is to be generated, by
30588 instructing the linker to set the PE header subsystem type
30589 required for console applications.
30590 This option is available for Cygwin and MinGW targets and is
30591 enabled by default on those targets.
30592
30593 @item -mdll
30594 @opindex mdll
30595 This option is available for Cygwin and MinGW targets. It
30596 specifies that a DLL---a dynamic link library---is to be
30597 generated, enabling the selection of the required runtime
30598 startup object and entry point.
30599
30600 @item -mnop-fun-dllimport
30601 @opindex mnop-fun-dllimport
30602 This option is available for Cygwin and MinGW targets. It
30603 specifies that the @code{dllimport} attribute should be ignored.
30604
30605 @item -mthread
30606 @opindex mthread
30607 This option is available for MinGW targets. It specifies
30608 that MinGW-specific thread support is to be used.
30609
30610 @item -municode
30611 @opindex municode
30612 This option is available for MinGW-w64 targets. It causes
30613 the @code{UNICODE} preprocessor macro to be predefined, and
30614 chooses Unicode-capable runtime startup code.
30615
30616 @item -mwin32
30617 @opindex mwin32
30618 This option is available for Cygwin and MinGW targets. It
30619 specifies that the typical Microsoft Windows predefined macros are to
30620 be set in the pre-processor, but does not influence the choice
30621 of runtime library/startup code.
30622
30623 @item -mwindows
30624 @opindex mwindows
30625 This option is available for Cygwin and MinGW targets. It
30626 specifies that a GUI application is to be generated by
30627 instructing the linker to set the PE header subsystem type
30628 appropriately.
30629
30630 @item -fno-set-stack-executable
30631 @opindex fno-set-stack-executable
30632 @opindex fset-stack-executable
30633 This option is available for MinGW targets. It specifies that
30634 the executable flag for the stack used by nested functions isn't
30635 set. This is necessary for binaries running in kernel mode of
30636 Microsoft Windows, as there the User32 API, which is used to set executable
30637 privileges, isn't available.
30638
30639 @item -fwritable-relocated-rdata
30640 @opindex fno-writable-relocated-rdata
30641 @opindex fwritable-relocated-rdata
30642 This option is available for MinGW and Cygwin targets. It specifies
30643 that relocated-data in read-only section is put into the @code{.data}
30644 section. This is a necessary for older runtimes not supporting
30645 modification of @code{.rdata} sections for pseudo-relocation.
30646
30647 @item -mpe-aligned-commons
30648 @opindex mpe-aligned-commons
30649 This option is available for Cygwin and MinGW targets. It
30650 specifies that the GNU extension to the PE file format that
30651 permits the correct alignment of COMMON variables should be
30652 used when generating code. It is enabled by default if
30653 GCC detects that the target assembler found during configuration
30654 supports the feature.
30655 @end table
30656
30657 See also under @ref{x86 Options} for standard options.
30658
30659 @node Xstormy16 Options
30660 @subsection Xstormy16 Options
30661 @cindex Xstormy16 Options
30662
30663 These options are defined for Xstormy16:
30664
30665 @table @gcctabopt
30666 @item -msim
30667 @opindex msim
30668 Choose startup files and linker script suitable for the simulator.
30669 @end table
30670
30671 @node Xtensa Options
30672 @subsection Xtensa Options
30673 @cindex Xtensa Options
30674
30675 These options are supported for Xtensa targets:
30676
30677 @table @gcctabopt
30678 @item -mconst16
30679 @itemx -mno-const16
30680 @opindex mconst16
30681 @opindex mno-const16
30682 Enable or disable use of @code{CONST16} instructions for loading
30683 constant values. The @code{CONST16} instruction is currently not a
30684 standard option from Tensilica. When enabled, @code{CONST16}
30685 instructions are always used in place of the standard @code{L32R}
30686 instructions. The use of @code{CONST16} is enabled by default only if
30687 the @code{L32R} instruction is not available.
30688
30689 @item -mfused-madd
30690 @itemx -mno-fused-madd
30691 @opindex mfused-madd
30692 @opindex mno-fused-madd
30693 Enable or disable use of fused multiply/add and multiply/subtract
30694 instructions in the floating-point option. This has no effect if the
30695 floating-point option is not also enabled. Disabling fused multiply/add
30696 and multiply/subtract instructions forces the compiler to use separate
30697 instructions for the multiply and add/subtract operations. This may be
30698 desirable in some cases where strict IEEE 754-compliant results are
30699 required: the fused multiply add/subtract instructions do not round the
30700 intermediate result, thereby producing results with @emph{more} bits of
30701 precision than specified by the IEEE standard. Disabling fused multiply
30702 add/subtract instructions also ensures that the program output is not
30703 sensitive to the compiler's ability to combine multiply and add/subtract
30704 operations.
30705
30706 @item -mserialize-volatile
30707 @itemx -mno-serialize-volatile
30708 @opindex mserialize-volatile
30709 @opindex mno-serialize-volatile
30710 When this option is enabled, GCC inserts @code{MEMW} instructions before
30711 @code{volatile} memory references to guarantee sequential consistency.
30712 The default is @option{-mserialize-volatile}. Use
30713 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30714
30715 @item -mforce-no-pic
30716 @opindex mforce-no-pic
30717 For targets, like GNU/Linux, where all user-mode Xtensa code must be
30718 position-independent code (PIC), this option disables PIC for compiling
30719 kernel code.
30720
30721 @item -mtext-section-literals
30722 @itemx -mno-text-section-literals
30723 @opindex mtext-section-literals
30724 @opindex mno-text-section-literals
30725 These options control the treatment of literal pools. The default is
30726 @option{-mno-text-section-literals}, which places literals in a separate
30727 section in the output file. This allows the literal pool to be placed
30728 in a data RAM/ROM, and it also allows the linker to combine literal
30729 pools from separate object files to remove redundant literals and
30730 improve code size. With @option{-mtext-section-literals}, the literals
30731 are interspersed in the text section in order to keep them as close as
30732 possible to their references. This may be necessary for large assembly
30733 files. Literals for each function are placed right before that function.
30734
30735 @item -mauto-litpools
30736 @itemx -mno-auto-litpools
30737 @opindex mauto-litpools
30738 @opindex mno-auto-litpools
30739 These options control the treatment of literal pools. The default is
30740 @option{-mno-auto-litpools}, which places literals in a separate
30741 section in the output file unless @option{-mtext-section-literals} is
30742 used. With @option{-mauto-litpools} the literals are interspersed in
30743 the text section by the assembler. Compiler does not produce explicit
30744 @code{.literal} directives and loads literals into registers with
30745 @code{MOVI} instructions instead of @code{L32R} to let the assembler
30746 do relaxation and place literals as necessary. This option allows
30747 assembler to create several literal pools per function and assemble
30748 very big functions, which may not be possible with
30749 @option{-mtext-section-literals}.
30750
30751 @item -mtarget-align
30752 @itemx -mno-target-align
30753 @opindex mtarget-align
30754 @opindex mno-target-align
30755 When this option is enabled, GCC instructs the assembler to
30756 automatically align instructions to reduce branch penalties at the
30757 expense of some code density. The assembler attempts to widen density
30758 instructions to align branch targets and the instructions following call
30759 instructions. If there are not enough preceding safe density
30760 instructions to align a target, no widening is performed. The
30761 default is @option{-mtarget-align}. These options do not affect the
30762 treatment of auto-aligned instructions like @code{LOOP}, which the
30763 assembler always aligns, either by widening density instructions or
30764 by inserting NOP instructions.
30765
30766 @item -mlongcalls
30767 @itemx -mno-longcalls
30768 @opindex mlongcalls
30769 @opindex mno-longcalls
30770 When this option is enabled, GCC instructs the assembler to translate
30771 direct calls to indirect calls unless it can determine that the target
30772 of a direct call is in the range allowed by the call instruction. This
30773 translation typically occurs for calls to functions in other source
30774 files. Specifically, the assembler translates a direct @code{CALL}
30775 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30776 The default is @option{-mno-longcalls}. This option should be used in
30777 programs where the call target can potentially be out of range. This
30778 option is implemented in the assembler, not the compiler, so the
30779 assembly code generated by GCC still shows direct call
30780 instructions---look at the disassembled object code to see the actual
30781 instructions. Note that the assembler uses an indirect call for
30782 every cross-file call, not just those that really are out of range.
30783 @end table
30784
30785 @node zSeries Options
30786 @subsection zSeries Options
30787 @cindex zSeries options
30788
30789 These are listed under @xref{S/390 and zSeries Options}.
30790
30791
30792 @c man end
30793
30794 @node Spec Files
30795 @section Specifying Subprocesses and the Switches to Pass to Them
30796 @cindex Spec Files
30797
30798 @command{gcc} is a driver program. It performs its job by invoking a
30799 sequence of other programs to do the work of compiling, assembling and
30800 linking. GCC interprets its command-line parameters and uses these to
30801 deduce which programs it should invoke, and which command-line options
30802 it ought to place on their command lines. This behavior is controlled
30803 by @dfn{spec strings}. In most cases there is one spec string for each
30804 program that GCC can invoke, but a few programs have multiple spec
30805 strings to control their behavior. The spec strings built into GCC can
30806 be overridden by using the @option{-specs=} command-line switch to specify
30807 a spec file.
30808
30809 @dfn{Spec files} are plain-text files that are used to construct spec
30810 strings. They consist of a sequence of directives separated by blank
30811 lines. The type of directive is determined by the first non-whitespace
30812 character on the line, which can be one of the following:
30813
30814 @table @code
30815 @item %@var{command}
30816 Issues a @var{command} to the spec file processor. The commands that can
30817 appear here are:
30818
30819 @table @code
30820 @item %include <@var{file}>
30821 @cindex @code{%include}
30822 Search for @var{file} and insert its text at the current point in the
30823 specs file.
30824
30825 @item %include_noerr <@var{file}>
30826 @cindex @code{%include_noerr}
30827 Just like @samp{%include}, but do not generate an error message if the include
30828 file cannot be found.
30829
30830 @item %rename @var{old_name} @var{new_name}
30831 @cindex @code{%rename}
30832 Rename the spec string @var{old_name} to @var{new_name}.
30833
30834 @end table
30835
30836 @item *[@var{spec_name}]:
30837 This tells the compiler to create, override or delete the named spec
30838 string. All lines after this directive up to the next directive or
30839 blank line are considered to be the text for the spec string. If this
30840 results in an empty string then the spec is deleted. (Or, if the
30841 spec did not exist, then nothing happens.) Otherwise, if the spec
30842 does not currently exist a new spec is created. If the spec does
30843 exist then its contents are overridden by the text of this
30844 directive, unless the first character of that text is the @samp{+}
30845 character, in which case the text is appended to the spec.
30846
30847 @item [@var{suffix}]:
30848 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
30849 and up to the next directive or blank line are considered to make up the
30850 spec string for the indicated suffix. When the compiler encounters an
30851 input file with the named suffix, it processes the spec string in
30852 order to work out how to compile that file. For example:
30853
30854 @smallexample
30855 .ZZ:
30856 z-compile -input %i
30857 @end smallexample
30858
30859 This says that any input file whose name ends in @samp{.ZZ} should be
30860 passed to the program @samp{z-compile}, which should be invoked with the
30861 command-line switch @option{-input} and with the result of performing the
30862 @samp{%i} substitution. (See below.)
30863
30864 As an alternative to providing a spec string, the text following a
30865 suffix directive can be one of the following:
30866
30867 @table @code
30868 @item @@@var{language}
30869 This says that the suffix is an alias for a known @var{language}. This is
30870 similar to using the @option{-x} command-line switch to GCC to specify a
30871 language explicitly. For example:
30872
30873 @smallexample
30874 .ZZ:
30875 @@c++
30876 @end smallexample
30877
30878 Says that .ZZ files are, in fact, C++ source files.
30879
30880 @item #@var{name}
30881 This causes an error messages saying:
30882
30883 @smallexample
30884 @var{name} compiler not installed on this system.
30885 @end smallexample
30886 @end table
30887
30888 GCC already has an extensive list of suffixes built into it.
30889 This directive adds an entry to the end of the list of suffixes, but
30890 since the list is searched from the end backwards, it is effectively
30891 possible to override earlier entries using this technique.
30892
30893 @end table
30894
30895 GCC has the following spec strings built into it. Spec files can
30896 override these strings or create their own. Note that individual
30897 targets can also add their own spec strings to this list.
30898
30899 @smallexample
30900 asm Options to pass to the assembler
30901 asm_final Options to pass to the assembler post-processor
30902 cpp Options to pass to the C preprocessor
30903 cc1 Options to pass to the C compiler
30904 cc1plus Options to pass to the C++ compiler
30905 endfile Object files to include at the end of the link
30906 link Options to pass to the linker
30907 lib Libraries to include on the command line to the linker
30908 libgcc Decides which GCC support library to pass to the linker
30909 linker Sets the name of the linker
30910 predefines Defines to be passed to the C preprocessor
30911 signed_char Defines to pass to CPP to say whether @code{char} is signed
30912 by default
30913 startfile Object files to include at the start of the link
30914 @end smallexample
30915
30916 Here is a small example of a spec file:
30917
30918 @smallexample
30919 %rename lib old_lib
30920
30921 *lib:
30922 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
30923 @end smallexample
30924
30925 This example renames the spec called @samp{lib} to @samp{old_lib} and
30926 then overrides the previous definition of @samp{lib} with a new one.
30927 The new definition adds in some extra command-line options before
30928 including the text of the old definition.
30929
30930 @dfn{Spec strings} are a list of command-line options to be passed to their
30931 corresponding program. In addition, the spec strings can contain
30932 @samp{%}-prefixed sequences to substitute variable text or to
30933 conditionally insert text into the command line. Using these constructs
30934 it is possible to generate quite complex command lines.
30935
30936 Here is a table of all defined @samp{%}-sequences for spec
30937 strings. Note that spaces are not generated automatically around the
30938 results of expanding these sequences. Therefore you can concatenate them
30939 together or combine them with constant text in a single argument.
30940
30941 @table @code
30942 @item %%
30943 Substitute one @samp{%} into the program name or argument.
30944
30945 @item %"
30946 Substitute an empty argument.
30947
30948 @item %i
30949 Substitute the name of the input file being processed.
30950
30951 @item %b
30952 Substitute the basename for outputs related with the input file being
30953 processed. This is often the substring up to (and not including) the
30954 last period and not including the directory but, unless %w is active, it
30955 expands to the basename for auxiliary outputs, which may be influenced
30956 by an explicit output name, and by various other options that control
30957 how auxiliary outputs are named.
30958
30959 @item %B
30960 This is the same as @samp{%b}, but include the file suffix (text after
30961 the last period). Without %w, it expands to the basename for dump
30962 outputs.
30963
30964 @item %d
30965 Marks the argument containing or following the @samp{%d} as a
30966 temporary file name, so that that file is deleted if GCC exits
30967 successfully. Unlike @samp{%g}, this contributes no text to the
30968 argument.
30969
30970 @item %g@var{suffix}
30971 Substitute a file name that has suffix @var{suffix} and is chosen
30972 once per compilation, and mark the argument in the same way as
30973 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
30974 name is now chosen in a way that is hard to predict even when previously
30975 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
30976 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
30977 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
30978 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
30979 was simply substituted with a file name chosen once per compilation,
30980 without regard to any appended suffix (which was therefore treated
30981 just like ordinary text), making such attacks more likely to succeed.
30982
30983 @item %u@var{suffix}
30984 Like @samp{%g}, but generates a new temporary file name
30985 each time it appears instead of once per compilation.
30986
30987 @item %U@var{suffix}
30988 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
30989 new one if there is no such last file name. In the absence of any
30990 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
30991 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
30992 involves the generation of two distinct file names, one
30993 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
30994 simply substituted with a file name chosen for the previous @samp{%u},
30995 without regard to any appended suffix.
30996
30997 @item %j@var{suffix}
30998 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
30999 writable, and if @option{-save-temps} is not used;
31000 otherwise, substitute the name
31001 of a temporary file, just like @samp{%u}. This temporary file is not
31002 meant for communication between processes, but rather as a junk
31003 disposal mechanism.
31004
31005 @item %|@var{suffix}
31006 @itemx %m@var{suffix}
31007 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
31008 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
31009 all. These are the two most common ways to instruct a program that it
31010 should read from standard input or write to standard output. If you
31011 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
31012 construct: see for example @file{gcc/fortran/lang-specs.h}.
31013
31014 @item %.@var{SUFFIX}
31015 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
31016 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
31017 terminated by the next space or %.
31018
31019 @item %w
31020 Marks the argument containing or following the @samp{%w} as the
31021 designated output file of this compilation. This puts the argument
31022 into the sequence of arguments that @samp{%o} substitutes.
31023
31024 @item %o
31025 Substitutes the names of all the output files, with spaces
31026 automatically placed around them. You should write spaces
31027 around the @samp{%o} as well or the results are undefined.
31028 @samp{%o} is for use in the specs for running the linker.
31029 Input files whose names have no recognized suffix are not compiled
31030 at all, but they are included among the output files, so they are
31031 linked.
31032
31033 @item %O
31034 Substitutes the suffix for object files. Note that this is
31035 handled specially when it immediately follows @samp{%g, %u, or %U},
31036 because of the need for those to form complete file names. The
31037 handling is such that @samp{%O} is treated exactly as if it had already
31038 been substituted, except that @samp{%g, %u, and %U} do not currently
31039 support additional @var{suffix} characters following @samp{%O} as they do
31040 following, for example, @samp{.o}.
31041
31042 @item %p
31043 Substitutes the standard macro predefinitions for the
31044 current target machine. Use this when running @command{cpp}.
31045
31046 @item %P
31047 Like @samp{%p}, but puts @samp{__} before and after the name of each
31048 predefined macro, except for macros that start with @samp{__} or with
31049 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
31050 C@.
31051
31052 @item %I
31053 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
31054 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
31055 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
31056 and @option{-imultilib} as necessary.
31057
31058 @item %s
31059 Current argument is the name of a library or startup file of some sort.
31060 Search for that file in a standard list of directories and substitute
31061 the full name found. The current working directory is included in the
31062 list of directories scanned.
31063
31064 @item %T
31065 Current argument is the name of a linker script. Search for that file
31066 in the current list of directories to scan for libraries. If the file
31067 is located insert a @option{--script} option into the command line
31068 followed by the full path name found. If the file is not found then
31069 generate an error message. Note: the current working directory is not
31070 searched.
31071
31072 @item %e@var{str}
31073 Print @var{str} as an error message. @var{str} is terminated by a newline.
31074 Use this when inconsistent options are detected.
31075
31076 @item %(@var{name})
31077 Substitute the contents of spec string @var{name} at this point.
31078
31079 @item %x@{@var{option}@}
31080 Accumulate an option for @samp{%X}.
31081
31082 @item %X
31083 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
31084 spec string.
31085
31086 @item %Y
31087 Output the accumulated assembler options specified by @option{-Wa}.
31088
31089 @item %Z
31090 Output the accumulated preprocessor options specified by @option{-Wp}.
31091
31092 @item %a
31093 Process the @code{asm} spec. This is used to compute the
31094 switches to be passed to the assembler.
31095
31096 @item %A
31097 Process the @code{asm_final} spec. This is a spec string for
31098 passing switches to an assembler post-processor, if such a program is
31099 needed.
31100
31101 @item %l
31102 Process the @code{link} spec. This is the spec for computing the
31103 command line passed to the linker. Typically it makes use of the
31104 @samp{%L %G %S %D and %E} sequences.
31105
31106 @item %D
31107 Dump out a @option{-L} option for each directory that GCC believes might
31108 contain startup files. If the target supports multilibs then the
31109 current multilib directory is prepended to each of these paths.
31110
31111 @item %L
31112 Process the @code{lib} spec. This is a spec string for deciding which
31113 libraries are included on the command line to the linker.
31114
31115 @item %G
31116 Process the @code{libgcc} spec. This is a spec string for deciding
31117 which GCC support library is included on the command line to the linker.
31118
31119 @item %S
31120 Process the @code{startfile} spec. This is a spec for deciding which
31121 object files are the first ones passed to the linker. Typically
31122 this might be a file named @file{crt0.o}.
31123
31124 @item %E
31125 Process the @code{endfile} spec. This is a spec string that specifies
31126 the last object files that are passed to the linker.
31127
31128 @item %C
31129 Process the @code{cpp} spec. This is used to construct the arguments
31130 to be passed to the C preprocessor.
31131
31132 @item %1
31133 Process the @code{cc1} spec. This is used to construct the options to be
31134 passed to the actual C compiler (@command{cc1}).
31135
31136 @item %2
31137 Process the @code{cc1plus} spec. This is used to construct the options to be
31138 passed to the actual C++ compiler (@command{cc1plus}).
31139
31140 @item %*
31141 Substitute the variable part of a matched option. See below.
31142 Note that each comma in the substituted string is replaced by
31143 a single space.
31144
31145 @item %<S
31146 Remove all occurrences of @code{-S} from the command line. Note---this
31147 command is position dependent. @samp{%} commands in the spec string
31148 before this one see @code{-S}, @samp{%} commands in the spec string
31149 after this one do not.
31150
31151 @item %:@var{function}(@var{args})
31152 Call the named function @var{function}, passing it @var{args}.
31153 @var{args} is first processed as a nested spec string, then split
31154 into an argument vector in the usual fashion. The function returns
31155 a string which is processed as if it had appeared literally as part
31156 of the current spec.
31157
31158 The following built-in spec functions are provided:
31159
31160 @table @code
31161 @item @code{getenv}
31162 The @code{getenv} spec function takes two arguments: an environment
31163 variable name and a string. If the environment variable is not
31164 defined, a fatal error is issued. Otherwise, the return value is the
31165 value of the environment variable concatenated with the string. For
31166 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
31167
31168 @smallexample
31169 %:getenv(TOPDIR /include)
31170 @end smallexample
31171
31172 expands to @file{/path/to/top/include}.
31173
31174 @item @code{if-exists}
31175 The @code{if-exists} spec function takes one argument, an absolute
31176 pathname to a file. If the file exists, @code{if-exists} returns the
31177 pathname. Here is a small example of its usage:
31178
31179 @smallexample
31180 *startfile:
31181 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
31182 @end smallexample
31183
31184 @item @code{if-exists-else}
31185 The @code{if-exists-else} spec function is similar to the @code{if-exists}
31186 spec function, except that it takes two arguments. The first argument is
31187 an absolute pathname to a file. If the file exists, @code{if-exists-else}
31188 returns the pathname. If it does not exist, it returns the second argument.
31189 This way, @code{if-exists-else} can be used to select one file or another,
31190 based on the existence of the first. Here is a small example of its usage:
31191
31192 @smallexample
31193 *startfile:
31194 crt0%O%s %:if-exists(crti%O%s) \
31195 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
31196 @end smallexample
31197
31198 @item @code{replace-outfile}
31199 The @code{replace-outfile} spec function takes two arguments. It looks for the
31200 first argument in the outfiles array and replaces it with the second argument. Here
31201 is a small example of its usage:
31202
31203 @smallexample
31204 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
31205 @end smallexample
31206
31207 @item @code{remove-outfile}
31208 The @code{remove-outfile} spec function takes one argument. It looks for the
31209 first argument in the outfiles array and removes it. Here is a small example
31210 its usage:
31211
31212 @smallexample
31213 %:remove-outfile(-lm)
31214 @end smallexample
31215
31216 @item @code{pass-through-libs}
31217 The @code{pass-through-libs} spec function takes any number of arguments. It
31218 finds any @option{-l} options and any non-options ending in @file{.a} (which it
31219 assumes are the names of linker input library archive files) and returns a
31220 result containing all the found arguments each prepended by
31221 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
31222 intended to be passed to the LTO linker plugin.
31223
31224 @smallexample
31225 %:pass-through-libs(%G %L %G)
31226 @end smallexample
31227
31228 @item @code{print-asm-header}
31229 The @code{print-asm-header} function takes no arguments and simply
31230 prints a banner like:
31231
31232 @smallexample
31233 Assembler options
31234 =================
31235
31236 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
31237 @end smallexample
31238
31239 It is used to separate compiler options from assembler options
31240 in the @option{--target-help} output.
31241 @end table
31242
31243 @item %@{S@}
31244 Substitutes the @code{-S} switch, if that switch is given to GCC@.
31245 If that switch is not specified, this substitutes nothing. Note that
31246 the leading dash is omitted when specifying this option, and it is
31247 automatically inserted if the substitution is performed. Thus the spec
31248 string @samp{%@{foo@}} matches the command-line option @option{-foo}
31249 and outputs the command-line option @option{-foo}.
31250
31251 @item %W@{S@}
31252 Like %@{@code{S}@} but mark last argument supplied within as a file to be
31253 deleted on failure.
31254
31255 @item %@{S*@}
31256 Substitutes all the switches specified to GCC whose names start
31257 with @code{-S}, but which also take an argument. This is used for
31258 switches like @option{-o}, @option{-D}, @option{-I}, etc.
31259 GCC considers @option{-o foo} as being
31260 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
31261 text, including the space. Thus two arguments are generated.
31262
31263 @item %@{S*&T*@}
31264 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
31265 (the order of @code{S} and @code{T} in the spec is not significant).
31266 There can be any number of ampersand-separated variables; for each the
31267 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
31268
31269 @item %@{S:X@}
31270 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
31271
31272 @item %@{!S:X@}
31273 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
31274
31275 @item %@{S*:X@}
31276 Substitutes @code{X} if one or more switches whose names start with
31277 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
31278 once, no matter how many such switches appeared. However, if @code{%*}
31279 appears somewhere in @code{X}, then @code{X} is substituted once
31280 for each matching switch, with the @code{%*} replaced by the part of
31281 that switch matching the @code{*}.
31282
31283 If @code{%*} appears as the last part of a spec sequence then a space
31284 is added after the end of the last substitution. If there is more
31285 text in the sequence, however, then a space is not generated. This
31286 allows the @code{%*} substitution to be used as part of a larger
31287 string. For example, a spec string like this:
31288
31289 @smallexample
31290 %@{mcu=*:--script=%*/memory.ld@}
31291 @end smallexample
31292
31293 @noindent
31294 when matching an option like @option{-mcu=newchip} produces:
31295
31296 @smallexample
31297 --script=newchip/memory.ld
31298 @end smallexample
31299
31300 @item %@{.S:X@}
31301 Substitutes @code{X}, if processing a file with suffix @code{S}.
31302
31303 @item %@{!.S:X@}
31304 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
31305
31306 @item %@{,S:X@}
31307 Substitutes @code{X}, if processing a file for language @code{S}.
31308
31309 @item %@{!,S:X@}
31310 Substitutes @code{X}, if not processing a file for language @code{S}.
31311
31312 @item %@{S|P:X@}
31313 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
31314 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
31315 @code{*} sequences as well, although they have a stronger binding than
31316 the @samp{|}. If @code{%*} appears in @code{X}, all of the
31317 alternatives must be starred, and only the first matching alternative
31318 is substituted.
31319
31320 For example, a spec string like this:
31321
31322 @smallexample
31323 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
31324 @end smallexample
31325
31326 @noindent
31327 outputs the following command-line options from the following input
31328 command-line options:
31329
31330 @smallexample
31331 fred.c -foo -baz
31332 jim.d -bar -boggle
31333 -d fred.c -foo -baz -boggle
31334 -d jim.d -bar -baz -boggle
31335 @end smallexample
31336
31337 @item %@{S:X; T:Y; :D@}
31338
31339 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
31340 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
31341 be as many clauses as you need. This may be combined with @code{.},
31342 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
31343
31344
31345 @end table
31346
31347 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
31348 or similar construct can use a backslash to ignore the special meaning
31349 of the character following it, thus allowing literal matching of a
31350 character that is otherwise specially treated. For example,
31351 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
31352 @option{-std=iso9899:1999} option is given.
31353
31354 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
31355 construct may contain other nested @samp{%} constructs or spaces, or
31356 even newlines. They are processed as usual, as described above.
31357 Trailing white space in @code{X} is ignored. White space may also
31358 appear anywhere on the left side of the colon in these constructs,
31359 except between @code{.} or @code{*} and the corresponding word.
31360
31361 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
31362 handled specifically in these constructs. If another value of
31363 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
31364 @option{-W} switch is found later in the command line, the earlier
31365 switch value is ignored, except with @{@code{S}*@} where @code{S} is
31366 just one letter, which passes all matching options.
31367
31368 The character @samp{|} at the beginning of the predicate text is used to
31369 indicate that a command should be piped to the following command, but
31370 only if @option{-pipe} is specified.
31371
31372 It is built into GCC which switches take arguments and which do not.
31373 (You might think it would be useful to generalize this to allow each
31374 compiler's spec to say which switches take arguments. But this cannot
31375 be done in a consistent fashion. GCC cannot even decide which input
31376 files have been specified without knowing which switches take arguments,
31377 and it must know which input files to compile in order to tell which
31378 compilers to run).
31379
31380 GCC also knows implicitly that arguments starting in @option{-l} are to be
31381 treated as compiler output files, and passed to the linker in their
31382 proper position among the other output files.
31383
31384 @node Environment Variables
31385 @section Environment Variables Affecting GCC
31386 @cindex environment variables
31387
31388 @c man begin ENVIRONMENT
31389 This section describes several environment variables that affect how GCC
31390 operates. Some of them work by specifying directories or prefixes to use
31391 when searching for various kinds of files. Some are used to specify other
31392 aspects of the compilation environment.
31393
31394 Note that you can also specify places to search using options such as
31395 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
31396 take precedence over places specified using environment variables, which
31397 in turn take precedence over those specified by the configuration of GCC@.
31398 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
31399 GNU Compiler Collection (GCC) Internals}.
31400
31401 @table @env
31402 @item LANG
31403 @itemx LC_CTYPE
31404 @c @itemx LC_COLLATE
31405 @itemx LC_MESSAGES
31406 @c @itemx LC_MONETARY
31407 @c @itemx LC_NUMERIC
31408 @c @itemx LC_TIME
31409 @itemx LC_ALL
31410 @findex LANG
31411 @findex LC_CTYPE
31412 @c @findex LC_COLLATE
31413 @findex LC_MESSAGES
31414 @c @findex LC_MONETARY
31415 @c @findex LC_NUMERIC
31416 @c @findex LC_TIME
31417 @findex LC_ALL
31418 @cindex locale
31419 These environment variables control the way that GCC uses
31420 localization information which allows GCC to work with different
31421 national conventions. GCC inspects the locale categories
31422 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
31423 so. These locale categories can be set to any value supported by your
31424 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
31425 Kingdom encoded in UTF-8.
31426
31427 The @env{LC_CTYPE} environment variable specifies character
31428 classification. GCC uses it to determine the character boundaries in
31429 a string; this is needed for some multibyte encodings that contain quote
31430 and escape characters that are otherwise interpreted as a string
31431 end or escape.
31432
31433 The @env{LC_MESSAGES} environment variable specifies the language to
31434 use in diagnostic messages.
31435
31436 If the @env{LC_ALL} environment variable is set, it overrides the value
31437 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
31438 and @env{LC_MESSAGES} default to the value of the @env{LANG}
31439 environment variable. If none of these variables are set, GCC
31440 defaults to traditional C English behavior.
31441
31442 @item TMPDIR
31443 @findex TMPDIR
31444 If @env{TMPDIR} is set, it specifies the directory to use for temporary
31445 files. GCC uses temporary files to hold the output of one stage of
31446 compilation which is to be used as input to the next stage: for example,
31447 the output of the preprocessor, which is the input to the compiler
31448 proper.
31449
31450 @item GCC_COMPARE_DEBUG
31451 @findex GCC_COMPARE_DEBUG
31452 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
31453 @option{-fcompare-debug} to the compiler driver. See the documentation
31454 of this option for more details.
31455
31456 @item GCC_EXEC_PREFIX
31457 @findex GCC_EXEC_PREFIX
31458 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
31459 names of the subprograms executed by the compiler. No slash is added
31460 when this prefix is combined with the name of a subprogram, but you can
31461 specify a prefix that ends with a slash if you wish.
31462
31463 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
31464 an appropriate prefix to use based on the pathname it is invoked with.
31465
31466 If GCC cannot find the subprogram using the specified prefix, it
31467 tries looking in the usual places for the subprogram.
31468
31469 The default value of @env{GCC_EXEC_PREFIX} is
31470 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
31471 the installed compiler. In many cases @var{prefix} is the value
31472 of @code{prefix} when you ran the @file{configure} script.
31473
31474 Other prefixes specified with @option{-B} take precedence over this prefix.
31475
31476 This prefix is also used for finding files such as @file{crt0.o} that are
31477 used for linking.
31478
31479 In addition, the prefix is used in an unusual way in finding the
31480 directories to search for header files. For each of the standard
31481 directories whose name normally begins with @samp{/usr/local/lib/gcc}
31482 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
31483 replacing that beginning with the specified prefix to produce an
31484 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
31485 @file{foo/bar} just before it searches the standard directory
31486 @file{/usr/local/lib/bar}.
31487 If a standard directory begins with the configured
31488 @var{prefix} then the value of @var{prefix} is replaced by
31489 @env{GCC_EXEC_PREFIX} when looking for header files.
31490
31491 @item COMPILER_PATH
31492 @findex COMPILER_PATH
31493 The value of @env{COMPILER_PATH} is a colon-separated list of
31494 directories, much like @env{PATH}. GCC tries the directories thus
31495 specified when searching for subprograms, if it cannot find the
31496 subprograms using @env{GCC_EXEC_PREFIX}.
31497
31498 @item LIBRARY_PATH
31499 @findex LIBRARY_PATH
31500 The value of @env{LIBRARY_PATH} is a colon-separated list of
31501 directories, much like @env{PATH}. When configured as a native compiler,
31502 GCC tries the directories thus specified when searching for special
31503 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
31504 using GCC also uses these directories when searching for ordinary
31505 libraries for the @option{-l} option (but directories specified with
31506 @option{-L} come first).
31507
31508 @item LANG
31509 @findex LANG
31510 @cindex locale definition
31511 This variable is used to pass locale information to the compiler. One way in
31512 which this information is used is to determine the character set to be used
31513 when character literals, string literals and comments are parsed in C and C++.
31514 When the compiler is configured to allow multibyte characters,
31515 the following values for @env{LANG} are recognized:
31516
31517 @table @samp
31518 @item C-JIS
31519 Recognize JIS characters.
31520 @item C-SJIS
31521 Recognize SJIS characters.
31522 @item C-EUCJP
31523 Recognize EUCJP characters.
31524 @end table
31525
31526 If @env{LANG} is not defined, or if it has some other value, then the
31527 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31528 recognize and translate multibyte characters.
31529 @end table
31530
31531 @noindent
31532 Some additional environment variables affect the behavior of the
31533 preprocessor.
31534
31535 @include cppenv.texi
31536
31537 @c man end
31538
31539 @node Precompiled Headers
31540 @section Using Precompiled Headers
31541 @cindex precompiled headers
31542 @cindex speed of compilation
31543
31544 Often large projects have many header files that are included in every
31545 source file. The time the compiler takes to process these header files
31546 over and over again can account for nearly all of the time required to
31547 build the project. To make builds faster, GCC allows you to
31548 @dfn{precompile} a header file.
31549
31550 To create a precompiled header file, simply compile it as you would any
31551 other file, if necessary using the @option{-x} option to make the driver
31552 treat it as a C or C++ header file. You may want to use a
31553 tool like @command{make} to keep the precompiled header up-to-date when
31554 the headers it contains change.
31555
31556 A precompiled header file is searched for when @code{#include} is
31557 seen in the compilation. As it searches for the included file
31558 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31559 compiler looks for a precompiled header in each directory just before it
31560 looks for the include file in that directory. The name searched for is
31561 the name specified in the @code{#include} with @samp{.gch} appended. If
31562 the precompiled header file cannot be used, it is ignored.
31563
31564 For instance, if you have @code{#include "all.h"}, and you have
31565 @file{all.h.gch} in the same directory as @file{all.h}, then the
31566 precompiled header file is used if possible, and the original
31567 header is used otherwise.
31568
31569 Alternatively, you might decide to put the precompiled header file in a
31570 directory and use @option{-I} to ensure that directory is searched
31571 before (or instead of) the directory containing the original header.
31572 Then, if you want to check that the precompiled header file is always
31573 used, you can put a file of the same name as the original header in this
31574 directory containing an @code{#error} command.
31575
31576 This also works with @option{-include}. So yet another way to use
31577 precompiled headers, good for projects not designed with precompiled
31578 header files in mind, is to simply take most of the header files used by
31579 a project, include them from another header file, precompile that header
31580 file, and @option{-include} the precompiled header. If the header files
31581 have guards against multiple inclusion, they are skipped because
31582 they've already been included (in the precompiled header).
31583
31584 If you need to precompile the same header file for different
31585 languages, targets, or compiler options, you can instead make a
31586 @emph{directory} named like @file{all.h.gch}, and put each precompiled
31587 header in the directory, perhaps using @option{-o}. It doesn't matter
31588 what you call the files in the directory; every precompiled header in
31589 the directory is considered. The first precompiled header
31590 encountered in the directory that is valid for this compilation is
31591 used; they're searched in no particular order.
31592
31593 There are many other possibilities, limited only by your imagination,
31594 good sense, and the constraints of your build system.
31595
31596 A precompiled header file can be used only when these conditions apply:
31597
31598 @itemize
31599 @item
31600 Only one precompiled header can be used in a particular compilation.
31601
31602 @item
31603 A precompiled header cannot be used once the first C token is seen. You
31604 can have preprocessor directives before a precompiled header; you cannot
31605 include a precompiled header from inside another header.
31606
31607 @item
31608 The precompiled header file must be produced for the same language as
31609 the current compilation. You cannot use a C precompiled header for a C++
31610 compilation.
31611
31612 @item
31613 The precompiled header file must have been produced by the same compiler
31614 binary as the current compilation is using.
31615
31616 @item
31617 Any macros defined before the precompiled header is included must
31618 either be defined in the same way as when the precompiled header was
31619 generated, or must not affect the precompiled header, which usually
31620 means that they don't appear in the precompiled header at all.
31621
31622 The @option{-D} option is one way to define a macro before a
31623 precompiled header is included; using a @code{#define} can also do it.
31624 There are also some options that define macros implicitly, like
31625 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31626 defined this way.
31627
31628 @item If debugging information is output when using the precompiled
31629 header, using @option{-g} or similar, the same kind of debugging information
31630 must have been output when building the precompiled header. However,
31631 a precompiled header built using @option{-g} can be used in a compilation
31632 when no debugging information is being output.
31633
31634 @item The same @option{-m} options must generally be used when building
31635 and using the precompiled header. @xref{Submodel Options},
31636 for any cases where this rule is relaxed.
31637
31638 @item Each of the following options must be the same when building and using
31639 the precompiled header:
31640
31641 @gccoptlist{-fexceptions}
31642
31643 @item
31644 Some other command-line options starting with @option{-f},
31645 @option{-p}, or @option{-O} must be defined in the same way as when
31646 the precompiled header was generated. At present, it's not clear
31647 which options are safe to change and which are not; the safest choice
31648 is to use exactly the same options when generating and using the
31649 precompiled header. The following are known to be safe:
31650
31651 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
31652 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
31653 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
31654 -pedantic-errors}
31655
31656 @item Address space layout randomization (ASLR) can lead to not binary identical
31657 PCH files. If you rely on stable PCH file contents disable ASLR when generating
31658 PCH files.
31659
31660 @end itemize
31661
31662 For all of these except the last, the compiler automatically
31663 ignores the precompiled header if the conditions aren't met. If you
31664 find an option combination that doesn't work and doesn't cause the
31665 precompiled header to be ignored, please consider filing a bug report,
31666 see @ref{Bugs}.
31667
31668 If you do use differing options when generating and using the
31669 precompiled header, the actual behavior is a mixture of the
31670 behavior for the options. For instance, if you use @option{-g} to
31671 generate the precompiled header but not when using it, you may or may
31672 not get debugging information for routines in the precompiled header.