add a new option -flarge-source-files.
[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} -x @var{language} @gol
189 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
190 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
191 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
192 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
193 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
194
195 @item C Language Options
196 @xref{C Dialect Options,,Options Controlling C Dialect}.
197 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
198 -fpermitted-flt-eval-methods=@var{standard} @gol
199 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
200 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
201 -fhosted -ffreestanding @gol
202 -fopenacc -fopenacc-dim=@var{geom} @gol
203 -fopenmp -fopenmp-simd @gol
204 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
205 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
206 -fsigned-bitfields -fsigned-char @gol
207 -funsigned-bitfields -funsigned-char}
208
209 @item C++ Language Options
210 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
211 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
212 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
213 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
214 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
215 -fno-elide-constructors @gol
216 -fno-enforce-eh-specs @gol
217 -fno-gnu-keywords @gol
218 -fno-implicit-templates @gol
219 -fno-implicit-inline-templates @gol
220 -fno-implement-inlines -fms-extensions @gol
221 -fnew-inheriting-ctors @gol
222 -fnew-ttp-matching @gol
223 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
224 -fno-optional-diags -fpermissive @gol
225 -fno-pretty-templates @gol
226 -fno-rtti -fsized-deallocation @gol
227 -ftemplate-backtrace-limit=@var{n} @gol
228 -ftemplate-depth=@var{n} @gol
229 -fno-threadsafe-statics -fuse-cxa-atexit @gol
230 -fno-weak -nostdinc++ @gol
231 -fvisibility-inlines-hidden @gol
232 -fvisibility-ms-compat @gol
233 -fext-numeric-literals @gol
234 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
235 -Wno-class-conversion -Wclass-memaccess @gol
236 -Wcomma-subscript -Wconditionally-supported @gol
237 -Wno-conversion-null -Wctor-dtor-privacy -Wno-delete-incomplete @gol
238 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
239 -Weffc++ -Wextra-semi -Wno-inaccessible-base @gol
240 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
241 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-tags @gol
242 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
243 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
244 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
245 -Wredundant-move -Wredundant-tags @gol
246 -Wreorder -Wregister @gol
247 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
248 -Wno-non-template-friend -Wold-style-cast @gol
249 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
250 -Wsized-deallocation -Wsuggest-final-methods @gol
251 -Wsuggest-final-types -Wsuggest-override @gol
252 -Wno-terminate -Wuseless-cast -Wvirtual-inheritance @gol
253 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
254
255 @item Objective-C and Objective-C++ Language Options
256 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
257 Objective-C and Objective-C++ Dialects}.
258 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
259 -fgnu-runtime -fnext-runtime @gol
260 -fno-nil-receivers @gol
261 -fobjc-abi-version=@var{n} @gol
262 -fobjc-call-cxx-cdtors @gol
263 -fobjc-direct-dispatch @gol
264 -fobjc-exceptions @gol
265 -fobjc-gc @gol
266 -fobjc-nilcheck @gol
267 -fobjc-std=objc1 @gol
268 -fno-local-ivars @gol
269 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
270 -freplace-objc-classes @gol
271 -fzero-link @gol
272 -gen-decls @gol
273 -Wassign-intercept -Wno-property-assign-default @gol
274 -Wno-protocol -Wselector @gol
275 -Wstrict-selector-match @gol
276 -Wundeclared-selector}
277
278 @item Diagnostic Message Formatting Options
279 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
280 @gccoptlist{-fmessage-length=@var{n} @gol
281 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
282 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
283 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
284 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
285 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
286 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
287 -fno-diagnostics-show-cwe @gol
288 -fdiagnostics-minimum-margin-width=@var{width} @gol
289 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
290 -fdiagnostics-show-template-tree -fno-elide-type @gol
291 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
292 -fdiagnostics-show-path-depths @gol
293 -fno-show-column}
294
295 @item Warning Options
296 @xref{Warning Options,,Options to Request or Suppress Warnings}.
297 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
298 -pedantic-errors @gol
299 -w -Wextra -Wall -Wabi=@var{n} @gol
300 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
301 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
302 -Walloca -Walloca-larger-than=@var{byte-size} @gol
303 -Wno-aggressive-loop-optimizations @gol
304 -Warith-conversion @gol
305 -Warray-bounds -Warray-bounds=@var{n} @gol
306 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
307 -Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
308 -Wno-builtin-declaration-mismatch @gol
309 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
310 -Wc11-c2x-compat @gol
311 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
312 -Wc++20-compat @gol
313 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
314 -Wchar-subscripts @gol
315 -Wclobbered -Wcomment @gol
316 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
317 -Wdangling-else -Wdate-time @gol
318 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
319 -Wdisabled-optimization @gol
320 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
321 -Wno-div-by-zero -Wdouble-promotion @gol
322 -Wduplicated-branches -Wduplicated-cond @gol
323 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
324 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
325 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
326 -Wno-format-contains-nul -Wno-format-extra-args @gol
327 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
328 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
329 -Wformat-y2k -Wframe-address @gol
330 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
331 -Wno-hsa -Wno-if-not-aligned -Wno-ignored-attributes @gol
332 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
333 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
334 -Wno-implicit-function-declaration -Wno-implicit-int @gol
335 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
336 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
337 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
338 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
339 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
340 -Wmemset-elt-size -Wmemset-transposed-args @gol
341 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
342 -Wmissing-field-initializers -Wmissing-format-attribute @gol
343 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
344 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
345 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
346 -Wnull-dereference -Wno-odr -Wopenmp-simd @gol
347 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
348 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
349 -Wparentheses -Wno-pedantic-ms-format @gol
350 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
351 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
352 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
353 -Wno-scalar-storage-order -Wsequence-point @gol
354 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
355 -Wno-shadow-ivar @gol
356 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
357 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
358 -Wsign-compare -Wsign-conversion @gol
359 -Wno-sizeof-array-argument @gol
360 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
361 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
362 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
363 -Wstring-compare @gol
364 -Wstringop-overflow=@var{n} -Wno-stringop-truncation @gol
365 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
366 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
367 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
368 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
369 -Wtype-limits -Wundef @gol
370 -Wuninitialized -Wunknown-pragmas @gol
371 -Wunsuffixed-float-constants -Wunused @gol
372 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
373 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
374 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
375 -Wunused-macros @gol
376 -Wunused-parameter -Wno-unused-result @gol
377 -Wunused-value -Wunused-variable @gol
378 -Wno-varargs -Wvariadic-macros @gol
379 -Wvector-operation-performance @gol
380 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
381 -Wvolatile-register-var -Wwrite-strings @gol
382 -Wzero-length-bounds}
383
384 @item Static Analyzer Options
385 @gccoptlist{
386 -fanalyzer @gol
387 -fanalyzer-call-summaries @gol
388 -fanalyzer-checker=@var{name} @gol
389 -fanalyzer-fine-grained @gol
390 -fanalyzer-state-merge @gol
391 -fanalyzer-state-purge @gol
392 -fanalyzer-transitivity @gol
393 -fanalyzer-verbose-edges @gol
394 -fanalyzer-verbose-state-changes @gol
395 -fanalyzer-verbosity=@var{level} @gol
396 -fdump-analyzer @gol
397 -fdump-analyzer-stderr @gol
398 -fdump-analyzer-callgraph @gol
399 -fdump-analyzer-exploded-graph @gol
400 -fdump-analyzer-exploded-nodes @gol
401 -fdump-analyzer-exploded-nodes-2 @gol
402 -fdump-analyzer-exploded-nodes-3 @gol
403 -fdump-analyzer-state-purge @gol
404 -fdump-analyzer-supergraph @gol
405 -Wno-analyzer-double-fclose @gol
406 -Wno-analyzer-double-free @gol
407 -Wno-analyzer-exposure-through-output-file @gol
408 -Wno-analyzer-file-leak @gol
409 -Wno-analyzer-free-of-non-heap @gol
410 -Wno-analyzer-malloc-leak @gol
411 -Wno-analyzer-null-argument @gol
412 -Wno-analyzer-null-dereference @gol
413 -Wno-analyzer-possible-null-argument @gol
414 -Wno-analyzer-possible-null-dereference @gol
415 -Wno-analyzer-stale-setjmp-buffer @gol
416 -Wno-analyzer-tainted-array-index @gol
417 -Wanalyzer-too-complex @gol
418 -Wno-analyzer-unsafe-call-within-signal-handler @gol
419 -Wno-analyzer-use-after-free @gol
420 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
421 -Wno-analyzer-use-of-uninitialized-value @gol
422 }
423
424 @item C and Objective-C-only Warning Options
425 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
426 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
427 -Wold-style-declaration -Wold-style-definition @gol
428 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
429 -Wdeclaration-after-statement -Wpointer-sign}
430
431 @item Debugging Options
432 @xref{Debugging Options,,Options for Debugging Your Program}.
433 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
434 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
435 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
436 -gas-loc-support -gno-as-loc-support @gol
437 -gas-locview-support -gno-as-locview-support @gol
438 -gcolumn-info -gno-column-info @gol
439 -gstatement-frontiers -gno-statement-frontiers @gol
440 -gvariable-location-views -gno-variable-location-views @gol
441 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
442 -ginline-points -gno-inline-points @gol
443 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
444 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
445 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
446 -fno-eliminate-unused-debug-types @gol
447 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
448 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
449 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
450 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
451 -fvar-tracking -fvar-tracking-assignments}
452
453 @item Optimization Options
454 @xref{Optimize Options,,Options that Control Optimization}.
455 @gccoptlist{-faggressive-loop-optimizations @gol
456 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
457 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
458 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
459 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
460 -fno-allocation-dce -fallow-store-data-races @gol
461 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
462 -fauto-inc-dec -fbranch-probabilities @gol
463 -fcaller-saves @gol
464 -fcombine-stack-adjustments -fconserve-stack @gol
465 -fcompare-elim -fcprop-registers -fcrossjumping @gol
466 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
467 -fcx-limited-range @gol
468 -fdata-sections -fdce -fdelayed-branch @gol
469 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
470 -fdevirtualize-at-ltrans -fdse @gol
471 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
472 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
473 -ffinite-loops @gol
474 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
475 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
476 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
477 -fif-conversion2 -findirect-inlining @gol
478 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
479 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
480 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
481 -fipa-reference -fipa-reference-addressable @gol
482 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
483 -flive-patching=@var{level} @gol
484 -fira-region=@var{region} -fira-hoist-pressure @gol
485 -fira-loop-pressure -fno-ira-share-save-slots @gol
486 -fno-ira-share-spill-slots @gol
487 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
488 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
489 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
490 -floop-block -floop-interchange -floop-strip-mine @gol
491 -floop-unroll-and-jam -floop-nest-optimize @gol
492 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
493 -flto-partition=@var{alg} -fmerge-all-constants @gol
494 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
495 -fmove-loop-invariants -fno-branch-count-reg @gol
496 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
497 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
498 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
499 -fno-sched-spec -fno-signed-zeros @gol
500 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
501 -fomit-frame-pointer -foptimize-sibling-calls @gol
502 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
503 -fprefetch-loop-arrays @gol
504 -fprofile-correction @gol
505 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
506 -fprofile-values -fprofile-reorder-functions @gol
507 -freciprocal-math -free -frename-registers -freorder-blocks @gol
508 -freorder-blocks-algorithm=@var{algorithm} @gol
509 -freorder-blocks-and-partition -freorder-functions @gol
510 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
511 -frounding-math -fsave-optimization-record @gol
512 -fsched2-use-superblocks -fsched-pressure @gol
513 -fsched-spec-load -fsched-spec-load-dangerous @gol
514 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
515 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
516 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
517 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
518 -fschedule-fusion @gol
519 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
520 -fselective-scheduling -fselective-scheduling2 @gol
521 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
522 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
523 -fsignaling-nans @gol
524 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
525 -fsplit-paths @gol
526 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
527 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
528 -fthread-jumps -ftracer -ftree-bit-ccp @gol
529 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
530 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
531 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
532 -ftree-loop-if-convert -ftree-loop-im @gol
533 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
534 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
535 -ftree-loop-vectorize @gol
536 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
537 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
538 -ftree-switch-conversion -ftree-tail-merge @gol
539 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
540 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
541 -funsafe-math-optimizations -funswitch-loops @gol
542 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
543 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
544 --param @var{name}=@var{value}
545 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
546
547 @item Program Instrumentation Options
548 @xref{Instrumentation Options,,Program Instrumentation Options}.
549 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
550 -fprofile-abs-path @gol
551 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
552 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
553 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
554 -fprofile-exclude-files=@var{regex} -fprofile-reproducibility @gol
555 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
556 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
557 -fsanitize-undefined-trap-on-error -fbounds-check @gol
558 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
559 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
560 -fstack-protector-explicit -fstack-check @gol
561 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
562 -fno-stack-limit -fsplit-stack @gol
563 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
564 -fvtv-counts -fvtv-debug @gol
565 -finstrument-functions @gol
566 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
567 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
568
569 @item Preprocessor Options
570 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
571 @gccoptlist{-A@var{question}=@var{answer} @gol
572 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
573 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
574 -dD -dI -dM -dN -dU @gol
575 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
576 -fexec-charset=@var{charset} -fextended-identifiers @gol
577 -finput-charset=@var{charset} -flarge-source-files @gol
578 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
579 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
580 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
581 -fwide-exec-charset=@var{charset} -fworking-directory @gol
582 -H -imacros @var{file} -include @var{file} @gol
583 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
584 -no-integrated-cpp -P -pthread -remap @gol
585 -traditional -traditional-cpp -trigraphs @gol
586 -U@var{macro} -undef @gol
587 -Wp,@var{option} -Xpreprocessor @var{option}}
588
589 @item Assembler Options
590 @xref{Assembler Options,,Passing Options to the Assembler}.
591 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
592
593 @item Linker Options
594 @xref{Link Options,,Options for Linking}.
595 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
596 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
597 -e @var{entry} --entry=@var{entry} @gol
598 -pie -pthread -r -rdynamic @gol
599 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
600 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
601 -shared -shared-libgcc -symbolic @gol
602 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
603 -u @var{symbol} -z @var{keyword}}
604
605 @item Directory Options
606 @xref{Directory Options,,Options for Directory Search}.
607 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
608 -idirafter @var{dir} @gol
609 -imacros @var{file} -imultilib @var{dir} @gol
610 -iplugindir=@var{dir} -iprefix @var{file} @gol
611 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
612 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
613 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
614 -nostdinc -nostdinc++ --sysroot=@var{dir}}
615
616 @item Code Generation Options
617 @xref{Code Gen Options,,Options for Code Generation Conventions}.
618 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
619 -ffixed-@var{reg} -fexceptions @gol
620 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
621 -fasynchronous-unwind-tables @gol
622 -fno-gnu-unique @gol
623 -finhibit-size-directive -fcommon -fno-ident @gol
624 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
625 -fno-jump-tables @gol
626 -frecord-gcc-switches @gol
627 -freg-struct-return -fshort-enums -fshort-wchar @gol
628 -fverbose-asm -fpack-struct[=@var{n}] @gol
629 -fleading-underscore -ftls-model=@var{model} @gol
630 -fstack-reuse=@var{reuse_level} @gol
631 -ftrampolines -ftrapv -fwrapv @gol
632 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
633 -fstrict-volatile-bitfields -fsync-libcalls}
634
635 @item Developer Options
636 @xref{Developer Options,,GCC Developer Options}.
637 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
638 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
639 -fchecking -fchecking=@var{n}
640 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
641 -fdisable-ipa-@var{pass_name} @gol
642 -fdisable-rtl-@var{pass_name} @gol
643 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
644 -fdisable-tree-@var{pass_name} @gol
645 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
646 -fdump-debug -fdump-earlydebug @gol
647 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
648 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
649 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
650 -fdump-lang-all @gol
651 -fdump-lang-@var{switch} @gol
652 -fdump-lang-@var{switch}-@var{options} @gol
653 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
654 -fdump-passes @gol
655 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
656 -fdump-statistics @gol
657 -fdump-tree-all @gol
658 -fdump-tree-@var{switch} @gol
659 -fdump-tree-@var{switch}-@var{options} @gol
660 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
661 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
662 -fenable-@var{kind}-@var{pass} @gol
663 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
664 -fira-verbose=@var{n} @gol
665 -flto-report -flto-report-wpa -fmem-report-wpa @gol
666 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
667 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
668 -fprofile-report @gol
669 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
670 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
671 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
672 -fvar-tracking-assignments-toggle -gtoggle @gol
673 -print-file-name=@var{library} -print-libgcc-file-name @gol
674 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
675 -print-prog-name=@var{program} -print-search-dirs -Q @gol
676 -print-sysroot -print-sysroot-headers-suffix @gol
677 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
678
679 @item Machine-Dependent Options
680 @xref{Submodel Options,,Machine-Dependent Options}.
681 @c This list is ordered alphanumerically by subsection name.
682 @c Try and put the significant identifier (CPU or system) first,
683 @c so users have a clue at guessing where the ones they want will be.
684
685 @emph{AArch64 Options}
686 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
687 -mgeneral-regs-only @gol
688 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
689 -mstrict-align -mno-strict-align @gol
690 -momit-leaf-frame-pointer @gol
691 -mtls-dialect=desc -mtls-dialect=traditional @gol
692 -mtls-size=@var{size} @gol
693 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
694 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
695 -mpc-relative-literal-loads @gol
696 -msign-return-address=@var{scope} @gol
697 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
698 +@var{b-key}]|@var{bti} @gol
699 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
700 -moverride=@var{string} -mverbose-cost-dump @gol
701 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
702 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
703 -moutline-atomics }
704
705 @emph{Adapteva Epiphany Options}
706 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
707 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
708 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
709 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
710 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
711 -msplit-vecmove-early -m1reg-@var{reg}}
712
713 @emph{AMD GCN Options}
714 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
715
716 @emph{ARC Options}
717 @gccoptlist{-mbarrel-shifter -mjli-always @gol
718 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
719 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
720 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
721 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
722 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
723 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
724 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
725 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
726 -mvolatile-cache -mtp-regno=@var{regno} @gol
727 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
728 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
729 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
730 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
731 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
732 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
733 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
734 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
735
736 @emph{ARM Options}
737 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
738 -mabi=@var{name} @gol
739 -mapcs-stack-check -mno-apcs-stack-check @gol
740 -mapcs-reentrant -mno-apcs-reentrant @gol
741 -mgeneral-regs-only @gol
742 -msched-prolog -mno-sched-prolog @gol
743 -mlittle-endian -mbig-endian @gol
744 -mbe8 -mbe32 @gol
745 -mfloat-abi=@var{name} @gol
746 -mfp16-format=@var{name}
747 -mthumb-interwork -mno-thumb-interwork @gol
748 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
749 -mtune=@var{name} -mprint-tune-info @gol
750 -mstructure-size-boundary=@var{n} @gol
751 -mabort-on-noreturn @gol
752 -mlong-calls -mno-long-calls @gol
753 -msingle-pic-base -mno-single-pic-base @gol
754 -mpic-register=@var{reg} @gol
755 -mnop-fun-dllimport @gol
756 -mpoke-function-name @gol
757 -mthumb -marm -mflip-thumb @gol
758 -mtpcs-frame -mtpcs-leaf-frame @gol
759 -mcaller-super-interworking -mcallee-super-interworking @gol
760 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
761 -mword-relocations @gol
762 -mfix-cortex-m3-ldrd @gol
763 -munaligned-access @gol
764 -mneon-for-64bits @gol
765 -mslow-flash-data @gol
766 -masm-syntax-unified @gol
767 -mrestrict-it @gol
768 -mverbose-cost-dump @gol
769 -mpure-code @gol
770 -mcmse @gol
771 -mfdpic}
772
773 @emph{AVR Options}
774 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
775 -mbranch-cost=@var{cost} @gol
776 -mcall-prologues -mgas-isr-prologues -mint8 @gol
777 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
778 -mn_flash=@var{size} -mno-interrupts @gol
779 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
780 -mfract-convert-truncate @gol
781 -mshort-calls -nodevicelib -nodevicespecs @gol
782 -Waddr-space-convert -Wmisspelled-isr}
783
784 @emph{Blackfin Options}
785 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
786 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
787 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
788 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
789 -mno-id-shared-library -mshared-library-id=@var{n} @gol
790 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
791 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
792 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
793 -micplb}
794
795 @emph{C6X Options}
796 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
797 -msim -msdata=@var{sdata-type}}
798
799 @emph{CRIS Options}
800 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
801 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
802 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
803 -mstack-align -mdata-align -mconst-align @gol
804 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
805 -melf -maout -melinux -mlinux -sim -sim2 @gol
806 -mmul-bug-workaround -mno-mul-bug-workaround}
807
808 @emph{CR16 Options}
809 @gccoptlist{-mmac @gol
810 -mcr16cplus -mcr16c @gol
811 -msim -mint32 -mbit-ops
812 -mdata-model=@var{model}}
813
814 @emph{C-SKY Options}
815 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
816 -mbig-endian -EB -mlittle-endian -EL @gol
817 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
818 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
819 -mdsp -medsp -mvdsp @gol
820 -mdiv -msmart -mhigh-registers -manchor @gol
821 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
822 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
823
824 @emph{Darwin Options}
825 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
826 -arch_only -bind_at_load -bundle -bundle_loader @gol
827 -client_name -compatibility_version -current_version @gol
828 -dead_strip @gol
829 -dependency-file -dylib_file -dylinker_install_name @gol
830 -dynamic -dynamiclib -exported_symbols_list @gol
831 -filelist -flat_namespace -force_cpusubtype_ALL @gol
832 -force_flat_namespace -headerpad_max_install_names @gol
833 -iframework @gol
834 -image_base -init -install_name -keep_private_externs @gol
835 -multi_module -multiply_defined -multiply_defined_unused @gol
836 -noall_load -no_dead_strip_inits_and_terms @gol
837 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
838 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
839 -private_bundle -read_only_relocs -sectalign @gol
840 -sectobjectsymbols -whyload -seg1addr @gol
841 -sectcreate -sectobjectsymbols -sectorder @gol
842 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
843 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
844 -segprot -segs_read_only_addr -segs_read_write_addr @gol
845 -single_module -static -sub_library -sub_umbrella @gol
846 -twolevel_namespace -umbrella -undefined @gol
847 -unexported_symbols_list -weak_reference_mismatches @gol
848 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
849 -mkernel -mone-byte-bool}
850
851 @emph{DEC Alpha Options}
852 @gccoptlist{-mno-fp-regs -msoft-float @gol
853 -mieee -mieee-with-inexact -mieee-conformant @gol
854 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
855 -mtrap-precision=@var{mode} -mbuild-constants @gol
856 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
857 -mbwx -mmax -mfix -mcix @gol
858 -mfloat-vax -mfloat-ieee @gol
859 -mexplicit-relocs -msmall-data -mlarge-data @gol
860 -msmall-text -mlarge-text @gol
861 -mmemory-latency=@var{time}}
862
863 @emph{eBPF Options}
864 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
865 -mframe-limit=@var{bytes}}
866
867 @emph{FR30 Options}
868 @gccoptlist{-msmall-model -mno-lsim}
869
870 @emph{FT32 Options}
871 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
872
873 @emph{FRV Options}
874 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
875 -mhard-float -msoft-float @gol
876 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
877 -mdouble -mno-double @gol
878 -mmedia -mno-media -mmuladd -mno-muladd @gol
879 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
880 -mlinked-fp -mlong-calls -malign-labels @gol
881 -mlibrary-pic -macc-4 -macc-8 @gol
882 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
883 -moptimize-membar -mno-optimize-membar @gol
884 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
885 -mvliw-branch -mno-vliw-branch @gol
886 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
887 -mno-nested-cond-exec -mtomcat-stats @gol
888 -mTLS -mtls @gol
889 -mcpu=@var{cpu}}
890
891 @emph{GNU/Linux Options}
892 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
893 -tno-android-cc -tno-android-ld}
894
895 @emph{H8/300 Options}
896 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
897
898 @emph{HPPA Options}
899 @gccoptlist{-march=@var{architecture-type} @gol
900 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
901 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
902 -mfixed-range=@var{register-range} @gol
903 -mjump-in-delay -mlinker-opt -mlong-calls @gol
904 -mlong-load-store -mno-disable-fpregs @gol
905 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
906 -mno-jump-in-delay -mno-long-load-store @gol
907 -mno-portable-runtime -mno-soft-float @gol
908 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
909 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
910 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
911 -munix=@var{unix-std} -nolibdld -static -threads}
912
913 @emph{IA-64 Options}
914 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
915 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
916 -mconstant-gp -mauto-pic -mfused-madd @gol
917 -minline-float-divide-min-latency @gol
918 -minline-float-divide-max-throughput @gol
919 -mno-inline-float-divide @gol
920 -minline-int-divide-min-latency @gol
921 -minline-int-divide-max-throughput @gol
922 -mno-inline-int-divide @gol
923 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
924 -mno-inline-sqrt @gol
925 -mdwarf2-asm -mearly-stop-bits @gol
926 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
927 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
928 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
929 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
930 -msched-spec-ldc -msched-spec-control-ldc @gol
931 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
932 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
933 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
934 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
935
936 @emph{LM32 Options}
937 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
938 -msign-extend-enabled -muser-enabled}
939
940 @emph{M32R/D Options}
941 @gccoptlist{-m32r2 -m32rx -m32r @gol
942 -mdebug @gol
943 -malign-loops -mno-align-loops @gol
944 -missue-rate=@var{number} @gol
945 -mbranch-cost=@var{number} @gol
946 -mmodel=@var{code-size-model-type} @gol
947 -msdata=@var{sdata-type} @gol
948 -mno-flush-func -mflush-func=@var{name} @gol
949 -mno-flush-trap -mflush-trap=@var{number} @gol
950 -G @var{num}}
951
952 @emph{M32C Options}
953 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
954
955 @emph{M680x0 Options}
956 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
957 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
958 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
959 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
960 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
961 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
962 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
963 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
964 -mxgot -mno-xgot -mlong-jump-table-offsets}
965
966 @emph{MCore Options}
967 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
968 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
969 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
970 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
971 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
972
973 @emph{MeP Options}
974 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
975 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
976 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
977 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
978 -mtiny=@var{n}}
979
980 @emph{MicroBlaze Options}
981 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
982 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
983 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
984 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
985 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
986 -mpic-data-is-text-relative}
987
988 @emph{MIPS Options}
989 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
990 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
991 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
992 -mips16 -mno-mips16 -mflip-mips16 @gol
993 -minterlink-compressed -mno-interlink-compressed @gol
994 -minterlink-mips16 -mno-interlink-mips16 @gol
995 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
996 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
997 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
998 -mno-float -msingle-float -mdouble-float @gol
999 -modd-spreg -mno-odd-spreg @gol
1000 -mabs=@var{mode} -mnan=@var{encoding} @gol
1001 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1002 -mmcu -mmno-mcu @gol
1003 -meva -mno-eva @gol
1004 -mvirt -mno-virt @gol
1005 -mxpa -mno-xpa @gol
1006 -mcrc -mno-crc @gol
1007 -mginv -mno-ginv @gol
1008 -mmicromips -mno-micromips @gol
1009 -mmsa -mno-msa @gol
1010 -mloongson-mmi -mno-loongson-mmi @gol
1011 -mloongson-ext -mno-loongson-ext @gol
1012 -mloongson-ext2 -mno-loongson-ext2 @gol
1013 -mfpu=@var{fpu-type} @gol
1014 -msmartmips -mno-smartmips @gol
1015 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1016 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1017 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1018 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1019 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1020 -membedded-data -mno-embedded-data @gol
1021 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1022 -mcode-readable=@var{setting} @gol
1023 -msplit-addresses -mno-split-addresses @gol
1024 -mexplicit-relocs -mno-explicit-relocs @gol
1025 -mcheck-zero-division -mno-check-zero-division @gol
1026 -mdivide-traps -mdivide-breaks @gol
1027 -mload-store-pairs -mno-load-store-pairs @gol
1028 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1029 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1030 -mfix-24k -mno-fix-24k @gol
1031 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1032 -mfix-r5900 -mno-fix-r5900 @gol
1033 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1034 -mfix-vr4120 -mno-fix-vr4120 @gol
1035 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1036 -mflush-func=@var{func} -mno-flush-func @gol
1037 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1038 -mcompact-branches=@var{policy} @gol
1039 -mfp-exceptions -mno-fp-exceptions @gol
1040 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1041 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1042 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1043 -mframe-header-opt -mno-frame-header-opt}
1044
1045 @emph{MMIX Options}
1046 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1047 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1048 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1049 -mno-base-addresses -msingle-exit -mno-single-exit}
1050
1051 @emph{MN10300 Options}
1052 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1053 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1054 -mtune=@var{cpu-type} @gol
1055 -mreturn-pointer-on-d0 @gol
1056 -mno-crt0 -mrelax -mliw -msetlb}
1057
1058 @emph{Moxie Options}
1059 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1060
1061 @emph{MSP430 Options}
1062 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1063 -mwarn-mcu @gol
1064 -mcode-region= -mdata-region= @gol
1065 -msilicon-errata= -msilicon-errata-warn= @gol
1066 -mhwmult= -minrt -mtiny-printf}
1067
1068 @emph{NDS32 Options}
1069 @gccoptlist{-mbig-endian -mlittle-endian @gol
1070 -mreduced-regs -mfull-regs @gol
1071 -mcmov -mno-cmov @gol
1072 -mext-perf -mno-ext-perf @gol
1073 -mext-perf2 -mno-ext-perf2 @gol
1074 -mext-string -mno-ext-string @gol
1075 -mv3push -mno-v3push @gol
1076 -m16bit -mno-16bit @gol
1077 -misr-vector-size=@var{num} @gol
1078 -mcache-block-size=@var{num} @gol
1079 -march=@var{arch} @gol
1080 -mcmodel=@var{code-model} @gol
1081 -mctor-dtor -mrelax}
1082
1083 @emph{Nios II Options}
1084 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1085 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1086 -mel -meb @gol
1087 -mno-bypass-cache -mbypass-cache @gol
1088 -mno-cache-volatile -mcache-volatile @gol
1089 -mno-fast-sw-div -mfast-sw-div @gol
1090 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1091 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1092 -mcustom-fpu-cfg=@var{name} @gol
1093 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1094 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1095
1096 @emph{Nvidia PTX Options}
1097 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1098
1099 @emph{OpenRISC Options}
1100 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1101 -msoft-mul -msoft-div @gol
1102 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1103 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1104
1105 @emph{PDP-11 Options}
1106 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1107 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1108 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1109
1110 @emph{picoChip Options}
1111 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1112 -msymbol-as-address -mno-inefficient-warnings}
1113
1114 @emph{PowerPC Options}
1115 See RS/6000 and PowerPC Options.
1116
1117 @emph{PRU Options}
1118 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1119 -mabi=@var{variant} @gol}
1120
1121 @emph{RISC-V Options}
1122 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1123 -mplt -mno-plt @gol
1124 -mabi=@var{ABI-string} @gol
1125 -mfdiv -mno-fdiv @gol
1126 -mdiv -mno-div @gol
1127 -march=@var{ISA-string} @gol
1128 -mtune=@var{processor-string} @gol
1129 -mpreferred-stack-boundary=@var{num} @gol
1130 -msmall-data-limit=@var{N-bytes} @gol
1131 -msave-restore -mno-save-restore @gol
1132 -mstrict-align -mno-strict-align @gol
1133 -mcmodel=medlow -mcmodel=medany @gol
1134 -mexplicit-relocs -mno-explicit-relocs @gol
1135 -mrelax -mno-relax @gol
1136 -mriscv-attribute -mmo-riscv-attribute @gol
1137 -malign-data=@var{type}}
1138
1139 @emph{RL78 Options}
1140 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1141 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1142 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1143
1144 @emph{RS/6000 and PowerPC Options}
1145 @gccoptlist{-mcpu=@var{cpu-type} @gol
1146 -mtune=@var{cpu-type} @gol
1147 -mcmodel=@var{code-model} @gol
1148 -mpowerpc64 @gol
1149 -maltivec -mno-altivec @gol
1150 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1151 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1152 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1153 -mfprnd -mno-fprnd @gol
1154 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1155 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1156 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1157 -malign-power -malign-natural @gol
1158 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1159 -mupdate -mno-update @gol
1160 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1161 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1162 -mstrict-align -mno-strict-align -mrelocatable @gol
1163 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1164 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1165 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1166 -mprioritize-restricted-insns=@var{priority} @gol
1167 -msched-costly-dep=@var{dependence_type} @gol
1168 -minsert-sched-nops=@var{scheme} @gol
1169 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1170 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1171 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1172 -mtraceback=@var{traceback_type} @gol
1173 -maix-struct-return -msvr4-struct-return @gol
1174 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1175 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1176 -mblock-move-inline-limit=@var{num} @gol
1177 -mblock-compare-inline-limit=@var{num} @gol
1178 -mblock-compare-inline-loop-limit=@var{num} @gol
1179 -mstring-compare-inline-limit=@var{num} @gol
1180 -misel -mno-isel @gol
1181 -mvrsave -mno-vrsave @gol
1182 -mmulhw -mno-mulhw @gol
1183 -mdlmzb -mno-dlmzb @gol
1184 -mprototype -mno-prototype @gol
1185 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1186 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1187 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1188 -mno-recip-precision @gol
1189 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1190 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1191 -msave-toc-indirect -mno-save-toc-indirect @gol
1192 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1193 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1194 -mquad-memory -mno-quad-memory @gol
1195 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1196 -mcompat-align-parm -mno-compat-align-parm @gol
1197 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1198 -mgnu-attribute -mno-gnu-attribute @gol
1199 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1200 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1201 -mpcrel -mno-pcrel}
1202
1203 @emph{RX Options}
1204 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1205 -mcpu=@gol
1206 -mbig-endian-data -mlittle-endian-data @gol
1207 -msmall-data @gol
1208 -msim -mno-sim@gol
1209 -mas100-syntax -mno-as100-syntax@gol
1210 -mrelax@gol
1211 -mmax-constant-size=@gol
1212 -mint-register=@gol
1213 -mpid@gol
1214 -mallow-string-insns -mno-allow-string-insns@gol
1215 -mjsr@gol
1216 -mno-warn-multiple-fast-interrupts@gol
1217 -msave-acc-in-interrupts}
1218
1219 @emph{S/390 and zSeries Options}
1220 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1221 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1222 -mlong-double-64 -mlong-double-128 @gol
1223 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1224 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1225 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1226 -mhtm -mvx -mzvector @gol
1227 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1228 -mfused-madd -mno-fused-madd @gol
1229 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1230 -mhotpatch=@var{halfwords},@var{halfwords}}
1231
1232 @emph{Score Options}
1233 @gccoptlist{-meb -mel @gol
1234 -mnhwloop @gol
1235 -muls @gol
1236 -mmac @gol
1237 -mscore5 -mscore5u -mscore7 -mscore7d}
1238
1239 @emph{SH Options}
1240 @gccoptlist{-m1 -m2 -m2e @gol
1241 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1242 -m3 -m3e @gol
1243 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1244 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1245 -mb -ml -mdalign -mrelax @gol
1246 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1247 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1248 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1249 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1250 -maccumulate-outgoing-args @gol
1251 -matomic-model=@var{atomic-model} @gol
1252 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1253 -mcbranch-force-delay-slot @gol
1254 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1255 -mpretend-cmove -mtas}
1256
1257 @emph{Solaris 2 Options}
1258 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1259 -pthreads}
1260
1261 @emph{SPARC Options}
1262 @gccoptlist{-mcpu=@var{cpu-type} @gol
1263 -mtune=@var{cpu-type} @gol
1264 -mcmodel=@var{code-model} @gol
1265 -mmemory-model=@var{mem-model} @gol
1266 -m32 -m64 -mapp-regs -mno-app-regs @gol
1267 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1268 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1269 -mhard-quad-float -msoft-quad-float @gol
1270 -mstack-bias -mno-stack-bias @gol
1271 -mstd-struct-return -mno-std-struct-return @gol
1272 -munaligned-doubles -mno-unaligned-doubles @gol
1273 -muser-mode -mno-user-mode @gol
1274 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1275 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1276 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1277 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1278 -mpopc -mno-popc -msubxc -mno-subxc @gol
1279 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1280 -mlra -mno-lra}
1281
1282 @emph{System V Options}
1283 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1284
1285 @emph{TILE-Gx Options}
1286 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1287 -mcmodel=@var{code-model}}
1288
1289 @emph{TILEPro Options}
1290 @gccoptlist{-mcpu=@var{cpu} -m32}
1291
1292 @emph{V850 Options}
1293 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1294 -mprolog-function -mno-prolog-function -mspace @gol
1295 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1296 -mapp-regs -mno-app-regs @gol
1297 -mdisable-callt -mno-disable-callt @gol
1298 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1299 -mv850e -mv850 -mv850e3v5 @gol
1300 -mloop @gol
1301 -mrelax @gol
1302 -mlong-jumps @gol
1303 -msoft-float @gol
1304 -mhard-float @gol
1305 -mgcc-abi @gol
1306 -mrh850-abi @gol
1307 -mbig-switch}
1308
1309 @emph{VAX Options}
1310 @gccoptlist{-mg -mgnu -munix}
1311
1312 @emph{Visium Options}
1313 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1314 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1315
1316 @emph{VMS Options}
1317 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1318 -mpointer-size=@var{size}}
1319
1320 @emph{VxWorks Options}
1321 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1322 -Xbind-lazy -Xbind-now}
1323
1324 @emph{x86 Options}
1325 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1326 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1327 -mfpmath=@var{unit} @gol
1328 -masm=@var{dialect} -mno-fancy-math-387 @gol
1329 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1330 -mno-wide-multiply -mrtd -malign-double @gol
1331 -mpreferred-stack-boundary=@var{num} @gol
1332 -mincoming-stack-boundary=@var{num} @gol
1333 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1334 -mrecip -mrecip=@var{opt} @gol
1335 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1336 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1337 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1338 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1339 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1340 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1341 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1342 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1343 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1344 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1345 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1346 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1347 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1348 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1349 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1350 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1351 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1352 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1353 -mregparm=@var{num} -msseregparm @gol
1354 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1355 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1356 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1357 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1358 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1359 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1360 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1361 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1362 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1363 -mstack-protector-guard-reg=@var{reg} @gol
1364 -mstack-protector-guard-offset=@var{offset} @gol
1365 -mstack-protector-guard-symbol=@var{symbol} @gol
1366 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1367 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1368 -mindirect-branch-register}
1369
1370 @emph{x86 Windows Options}
1371 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1372 -mnop-fun-dllimport -mthread @gol
1373 -municode -mwin32 -mwindows -fno-set-stack-executable}
1374
1375 @emph{Xstormy16 Options}
1376 @gccoptlist{-msim}
1377
1378 @emph{Xtensa Options}
1379 @gccoptlist{-mconst16 -mno-const16 @gol
1380 -mfused-madd -mno-fused-madd @gol
1381 -mforce-no-pic @gol
1382 -mserialize-volatile -mno-serialize-volatile @gol
1383 -mtext-section-literals -mno-text-section-literals @gol
1384 -mauto-litpools -mno-auto-litpools @gol
1385 -mtarget-align -mno-target-align @gol
1386 -mlongcalls -mno-longcalls}
1387
1388 @emph{zSeries Options}
1389 See S/390 and zSeries Options.
1390 @end table
1391
1392
1393 @node Overall Options
1394 @section Options Controlling the Kind of Output
1395
1396 Compilation can involve up to four stages: preprocessing, compilation
1397 proper, assembly and linking, always in that order. GCC is capable of
1398 preprocessing and compiling several files either into several
1399 assembler input files, or into one assembler input file; then each
1400 assembler input file produces an object file, and linking combines all
1401 the object files (those newly compiled, and those specified as input)
1402 into an executable file.
1403
1404 @cindex file name suffix
1405 For any given input file, the file name suffix determines what kind of
1406 compilation is done:
1407
1408 @table @gcctabopt
1409 @item @var{file}.c
1410 C source code that must be preprocessed.
1411
1412 @item @var{file}.i
1413 C source code that should not be preprocessed.
1414
1415 @item @var{file}.ii
1416 C++ source code that should not be preprocessed.
1417
1418 @item @var{file}.m
1419 Objective-C source code. Note that you must link with the @file{libobjc}
1420 library to make an Objective-C program work.
1421
1422 @item @var{file}.mi
1423 Objective-C source code that should not be preprocessed.
1424
1425 @item @var{file}.mm
1426 @itemx @var{file}.M
1427 Objective-C++ source code. Note that you must link with the @file{libobjc}
1428 library to make an Objective-C++ program work. Note that @samp{.M} refers
1429 to a literal capital M@.
1430
1431 @item @var{file}.mii
1432 Objective-C++ source code that should not be preprocessed.
1433
1434 @item @var{file}.h
1435 C, C++, Objective-C or Objective-C++ header file to be turned into a
1436 precompiled header (default), or C, C++ header file to be turned into an
1437 Ada spec (via the @option{-fdump-ada-spec} switch).
1438
1439 @item @var{file}.cc
1440 @itemx @var{file}.cp
1441 @itemx @var{file}.cxx
1442 @itemx @var{file}.cpp
1443 @itemx @var{file}.CPP
1444 @itemx @var{file}.c++
1445 @itemx @var{file}.C
1446 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1447 the last two letters must both be literally @samp{x}. Likewise,
1448 @samp{.C} refers to a literal capital C@.
1449
1450 @item @var{file}.mm
1451 @itemx @var{file}.M
1452 Objective-C++ source code that must be preprocessed.
1453
1454 @item @var{file}.mii
1455 Objective-C++ source code that should not be preprocessed.
1456
1457 @item @var{file}.hh
1458 @itemx @var{file}.H
1459 @itemx @var{file}.hp
1460 @itemx @var{file}.hxx
1461 @itemx @var{file}.hpp
1462 @itemx @var{file}.HPP
1463 @itemx @var{file}.h++
1464 @itemx @var{file}.tcc
1465 C++ header file to be turned into a precompiled header or Ada spec.
1466
1467 @item @var{file}.f
1468 @itemx @var{file}.for
1469 @itemx @var{file}.ftn
1470 Fixed form Fortran source code that should not be preprocessed.
1471
1472 @item @var{file}.F
1473 @itemx @var{file}.FOR
1474 @itemx @var{file}.fpp
1475 @itemx @var{file}.FPP
1476 @itemx @var{file}.FTN
1477 Fixed form Fortran source code that must be preprocessed (with the traditional
1478 preprocessor).
1479
1480 @item @var{file}.f90
1481 @itemx @var{file}.f95
1482 @itemx @var{file}.f03
1483 @itemx @var{file}.f08
1484 Free form Fortran source code that should not be preprocessed.
1485
1486 @item @var{file}.F90
1487 @itemx @var{file}.F95
1488 @itemx @var{file}.F03
1489 @itemx @var{file}.F08
1490 Free form Fortran source code that must be preprocessed (with the
1491 traditional preprocessor).
1492
1493 @item @var{file}.go
1494 Go source code.
1495
1496 @item @var{file}.brig
1497 BRIG files (binary representation of HSAIL).
1498
1499 @item @var{file}.d
1500 D source code.
1501
1502 @item @var{file}.di
1503 D interface file.
1504
1505 @item @var{file}.dd
1506 D documentation code (Ddoc).
1507
1508 @item @var{file}.ads
1509 Ada source code file that contains a library unit declaration (a
1510 declaration of a package, subprogram, or generic, or a generic
1511 instantiation), or a library unit renaming declaration (a package,
1512 generic, or subprogram renaming declaration). Such files are also
1513 called @dfn{specs}.
1514
1515 @item @var{file}.adb
1516 Ada source code file containing a library unit body (a subprogram or
1517 package body). Such files are also called @dfn{bodies}.
1518
1519 @c GCC also knows about some suffixes for languages not yet included:
1520 @c Ratfor:
1521 @c @var{file}.r
1522
1523 @item @var{file}.s
1524 Assembler code.
1525
1526 @item @var{file}.S
1527 @itemx @var{file}.sx
1528 Assembler code that must be preprocessed.
1529
1530 @item @var{other}
1531 An object file to be fed straight into linking.
1532 Any file name with no recognized suffix is treated this way.
1533 @end table
1534
1535 @opindex x
1536 You can specify the input language explicitly with the @option{-x} option:
1537
1538 @table @gcctabopt
1539 @item -x @var{language}
1540 Specify explicitly the @var{language} for the following input files
1541 (rather than letting the compiler choose a default based on the file
1542 name suffix). This option applies to all following input files until
1543 the next @option{-x} option. Possible values for @var{language} are:
1544 @smallexample
1545 c c-header cpp-output
1546 c++ c++-header c++-cpp-output
1547 objective-c objective-c-header objective-c-cpp-output
1548 objective-c++ objective-c++-header objective-c++-cpp-output
1549 assembler assembler-with-cpp
1550 ada
1551 d
1552 f77 f77-cpp-input f95 f95-cpp-input
1553 go
1554 brig
1555 @end smallexample
1556
1557 @item -x none
1558 Turn off any specification of a language, so that subsequent files are
1559 handled according to their file name suffixes (as they are if @option{-x}
1560 has not been used at all).
1561 @end table
1562
1563 If you only want some of the stages of compilation, you can use
1564 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1565 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1566 @command{gcc} is to stop. Note that some combinations (for example,
1567 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1568
1569 @table @gcctabopt
1570 @item -c
1571 @opindex c
1572 Compile or assemble the source files, but do not link. The linking
1573 stage simply is not done. The ultimate output is in the form of an
1574 object file for each source file.
1575
1576 By default, the object file name for a source file is made by replacing
1577 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1578
1579 Unrecognized input files, not requiring compilation or assembly, are
1580 ignored.
1581
1582 @item -S
1583 @opindex S
1584 Stop after the stage of compilation proper; do not assemble. The output
1585 is in the form of an assembler code file for each non-assembler input
1586 file specified.
1587
1588 By default, the assembler file name for a source file is made by
1589 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1590
1591 Input files that don't require compilation are ignored.
1592
1593 @item -E
1594 @opindex E
1595 Stop after the preprocessing stage; do not run the compiler proper. The
1596 output is in the form of preprocessed source code, which is sent to the
1597 standard output.
1598
1599 Input files that don't require preprocessing are ignored.
1600
1601 @cindex output file option
1602 @item -o @var{file}
1603 @opindex o
1604 Place output in file @var{file}. This applies to whatever
1605 sort of output is being produced, whether it be an executable file,
1606 an object file, an assembler file or preprocessed C code.
1607
1608 If @option{-o} is not specified, the default is to put an executable
1609 file in @file{a.out}, the object file for
1610 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1611 assembler file in @file{@var{source}.s}, a precompiled header file in
1612 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1613 standard output.
1614
1615 @item -v
1616 @opindex v
1617 Print (on standard error output) the commands executed to run the stages
1618 of compilation. Also print the version number of the compiler driver
1619 program and of the preprocessor and the compiler proper.
1620
1621 @item -###
1622 @opindex ###
1623 Like @option{-v} except the commands are not executed and arguments
1624 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1625 This is useful for shell scripts to capture the driver-generated command lines.
1626
1627 @item --help
1628 @opindex help
1629 Print (on the standard output) a description of the command-line options
1630 understood by @command{gcc}. If the @option{-v} option is also specified
1631 then @option{--help} is also passed on to the various processes
1632 invoked by @command{gcc}, so that they can display the command-line options
1633 they accept. If the @option{-Wextra} option has also been specified
1634 (prior to the @option{--help} option), then command-line options that
1635 have no documentation associated with them are also displayed.
1636
1637 @item --target-help
1638 @opindex target-help
1639 Print (on the standard output) a description of target-specific command-line
1640 options for each tool. For some targets extra target-specific
1641 information may also be printed.
1642
1643 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1644 Print (on the standard output) a description of the command-line
1645 options understood by the compiler that fit into all specified classes
1646 and qualifiers. These are the supported classes:
1647
1648 @table @asis
1649 @item @samp{optimizers}
1650 Display all of the optimization options supported by the
1651 compiler.
1652
1653 @item @samp{warnings}
1654 Display all of the options controlling warning messages
1655 produced by the compiler.
1656
1657 @item @samp{target}
1658 Display target-specific options. Unlike the
1659 @option{--target-help} option however, target-specific options of the
1660 linker and assembler are not displayed. This is because those
1661 tools do not currently support the extended @option{--help=} syntax.
1662
1663 @item @samp{params}
1664 Display the values recognized by the @option{--param}
1665 option.
1666
1667 @item @var{language}
1668 Display the options supported for @var{language}, where
1669 @var{language} is the name of one of the languages supported in this
1670 version of GCC@. If an option is supported by all languages, one needs
1671 to select @samp{common} class.
1672
1673 @item @samp{common}
1674 Display the options that are common to all languages.
1675 @end table
1676
1677 These are the supported qualifiers:
1678
1679 @table @asis
1680 @item @samp{undocumented}
1681 Display only those options that are undocumented.
1682
1683 @item @samp{joined}
1684 Display options taking an argument that appears after an equal
1685 sign in the same continuous piece of text, such as:
1686 @samp{--help=target}.
1687
1688 @item @samp{separate}
1689 Display options taking an argument that appears as a separate word
1690 following the original option, such as: @samp{-o output-file}.
1691 @end table
1692
1693 Thus for example to display all the undocumented target-specific
1694 switches supported by the compiler, use:
1695
1696 @smallexample
1697 --help=target,undocumented
1698 @end smallexample
1699
1700 The sense of a qualifier can be inverted by prefixing it with the
1701 @samp{^} character, so for example to display all binary warning
1702 options (i.e., ones that are either on or off and that do not take an
1703 argument) that have a description, use:
1704
1705 @smallexample
1706 --help=warnings,^joined,^undocumented
1707 @end smallexample
1708
1709 The argument to @option{--help=} should not consist solely of inverted
1710 qualifiers.
1711
1712 Combining several classes is possible, although this usually
1713 restricts the output so much that there is nothing to display. One
1714 case where it does work, however, is when one of the classes is
1715 @var{target}. For example, to display all the target-specific
1716 optimization options, use:
1717
1718 @smallexample
1719 --help=target,optimizers
1720 @end smallexample
1721
1722 The @option{--help=} option can be repeated on the command line. Each
1723 successive use displays its requested class of options, skipping
1724 those that have already been displayed. If @option{--help} is also
1725 specified anywhere on the command line then this takes precedence
1726 over any @option{--help=} option.
1727
1728 If the @option{-Q} option appears on the command line before the
1729 @option{--help=} option, then the descriptive text displayed by
1730 @option{--help=} is changed. Instead of describing the displayed
1731 options, an indication is given as to whether the option is enabled,
1732 disabled or set to a specific value (assuming that the compiler
1733 knows this at the point where the @option{--help=} option is used).
1734
1735 Here is a truncated example from the ARM port of @command{gcc}:
1736
1737 @smallexample
1738 % gcc -Q -mabi=2 --help=target -c
1739 The following options are target specific:
1740 -mabi= 2
1741 -mabort-on-noreturn [disabled]
1742 -mapcs [disabled]
1743 @end smallexample
1744
1745 The output is sensitive to the effects of previous command-line
1746 options, so for example it is possible to find out which optimizations
1747 are enabled at @option{-O2} by using:
1748
1749 @smallexample
1750 -Q -O2 --help=optimizers
1751 @end smallexample
1752
1753 Alternatively you can discover which binary optimizations are enabled
1754 by @option{-O3} by using:
1755
1756 @smallexample
1757 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1758 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1759 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1760 @end smallexample
1761
1762 @item --version
1763 @opindex version
1764 Display the version number and copyrights of the invoked GCC@.
1765
1766 @item -pass-exit-codes
1767 @opindex pass-exit-codes
1768 Normally the @command{gcc} program exits with the code of 1 if any
1769 phase of the compiler returns a non-success return code. If you specify
1770 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1771 the numerically highest error produced by any phase returning an error
1772 indication. The C, C++, and Fortran front ends return 4 if an internal
1773 compiler error is encountered.
1774
1775 @item -pipe
1776 @opindex pipe
1777 Use pipes rather than temporary files for communication between the
1778 various stages of compilation. This fails to work on some systems where
1779 the assembler is unable to read from a pipe; but the GNU assembler has
1780 no trouble.
1781
1782 @item -specs=@var{file}
1783 @opindex specs
1784 Process @var{file} after the compiler reads in the standard @file{specs}
1785 file, in order to override the defaults which the @command{gcc} driver
1786 program uses when determining what switches to pass to @command{cc1},
1787 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1788 @option{-specs=@var{file}} can be specified on the command line, and they
1789 are processed in order, from left to right. @xref{Spec Files}, for
1790 information about the format of the @var{file}.
1791
1792 @item -wrapper
1793 @opindex wrapper
1794 Invoke all subcommands under a wrapper program. The name of the
1795 wrapper program and its parameters are passed as a comma separated
1796 list.
1797
1798 @smallexample
1799 gcc -c t.c -wrapper gdb,--args
1800 @end smallexample
1801
1802 @noindent
1803 This invokes all subprograms of @command{gcc} under
1804 @samp{gdb --args}, thus the invocation of @command{cc1} is
1805 @samp{gdb --args cc1 @dots{}}.
1806
1807 @item -ffile-prefix-map=@var{old}=@var{new}
1808 @opindex ffile-prefix-map
1809 When compiling files residing in directory @file{@var{old}}, record
1810 any references to them in the result of the compilation as if the
1811 files resided in directory @file{@var{new}} instead. Specifying this
1812 option is equivalent to specifying all the individual
1813 @option{-f*-prefix-map} options. This can be used to make reproducible
1814 builds that are location independent. See also
1815 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1816
1817 @item -fplugin=@var{name}.so
1818 @opindex fplugin
1819 Load the plugin code in file @var{name}.so, assumed to be a
1820 shared object to be dlopen'd by the compiler. The base name of
1821 the shared object file is used to identify the plugin for the
1822 purposes of argument parsing (See
1823 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1824 Each plugin should define the callback functions specified in the
1825 Plugins API.
1826
1827 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1828 @opindex fplugin-arg
1829 Define an argument called @var{key} with a value of @var{value}
1830 for the plugin called @var{name}.
1831
1832 @item -fdump-ada-spec@r{[}-slim@r{]}
1833 @opindex fdump-ada-spec
1834 For C and C++ source and include files, generate corresponding Ada specs.
1835 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1836 GNAT User's Guide}, which provides detailed documentation on this feature.
1837
1838 @item -fada-spec-parent=@var{unit}
1839 @opindex fada-spec-parent
1840 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1841 Ada specs as child units of parent @var{unit}.
1842
1843 @item -fdump-go-spec=@var{file}
1844 @opindex fdump-go-spec
1845 For input files in any language, generate corresponding Go
1846 declarations in @var{file}. This generates Go @code{const},
1847 @code{type}, @code{var}, and @code{func} declarations which may be a
1848 useful way to start writing a Go interface to code written in some
1849 other language.
1850
1851 @include @value{srcdir}/../libiberty/at-file.texi
1852 @end table
1853
1854 @node Invoking G++
1855 @section Compiling C++ Programs
1856
1857 @cindex suffixes for C++ source
1858 @cindex C++ source file suffixes
1859 C++ source files conventionally use one of the suffixes @samp{.C},
1860 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1861 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1862 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1863 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1864 files with these names and compiles them as C++ programs even if you
1865 call the compiler the same way as for compiling C programs (usually
1866 with the name @command{gcc}).
1867
1868 @findex g++
1869 @findex c++
1870 However, the use of @command{gcc} does not add the C++ library.
1871 @command{g++} is a program that calls GCC and automatically specifies linking
1872 against the C++ library. It treats @samp{.c},
1873 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1874 files unless @option{-x} is used. This program is also useful when
1875 precompiling a C header file with a @samp{.h} extension for use in C++
1876 compilations. On many systems, @command{g++} is also installed with
1877 the name @command{c++}.
1878
1879 @cindex invoking @command{g++}
1880 When you compile C++ programs, you may specify many of the same
1881 command-line options that you use for compiling programs in any
1882 language; or command-line options meaningful for C and related
1883 languages; or options that are meaningful only for C++ programs.
1884 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1885 explanations of options for languages related to C@.
1886 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1887 explanations of options that are meaningful only for C++ programs.
1888
1889 @node C Dialect Options
1890 @section Options Controlling C Dialect
1891 @cindex dialect options
1892 @cindex language dialect options
1893 @cindex options, dialect
1894
1895 The following options control the dialect of C (or languages derived
1896 from C, such as C++, Objective-C and Objective-C++) that the compiler
1897 accepts:
1898
1899 @table @gcctabopt
1900 @cindex ANSI support
1901 @cindex ISO support
1902 @item -ansi
1903 @opindex ansi
1904 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1905 equivalent to @option{-std=c++98}.
1906
1907 This turns off certain features of GCC that are incompatible with ISO
1908 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1909 such as the @code{asm} and @code{typeof} keywords, and
1910 predefined macros such as @code{unix} and @code{vax} that identify the
1911 type of system you are using. It also enables the undesirable and
1912 rarely used ISO trigraph feature. For the C compiler,
1913 it disables recognition of C++ style @samp{//} comments as well as
1914 the @code{inline} keyword.
1915
1916 The alternate keywords @code{__asm__}, @code{__extension__},
1917 @code{__inline__} and @code{__typeof__} continue to work despite
1918 @option{-ansi}. You would not want to use them in an ISO C program, of
1919 course, but it is useful to put them in header files that might be included
1920 in compilations done with @option{-ansi}. Alternate predefined macros
1921 such as @code{__unix__} and @code{__vax__} are also available, with or
1922 without @option{-ansi}.
1923
1924 The @option{-ansi} option does not cause non-ISO programs to be
1925 rejected gratuitously. For that, @option{-Wpedantic} is required in
1926 addition to @option{-ansi}. @xref{Warning Options}.
1927
1928 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1929 option is used. Some header files may notice this macro and refrain
1930 from declaring certain functions or defining certain macros that the
1931 ISO standard doesn't call for; this is to avoid interfering with any
1932 programs that might use these names for other things.
1933
1934 Functions that are normally built in but do not have semantics
1935 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1936 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1937 built-in functions provided by GCC}, for details of the functions
1938 affected.
1939
1940 @item -std=
1941 @opindex std
1942 Determine the language standard. @xref{Standards,,Language Standards
1943 Supported by GCC}, for details of these standard versions. This option
1944 is currently only supported when compiling C or C++.
1945
1946 The compiler can accept several base standards, such as @samp{c90} or
1947 @samp{c++98}, and GNU dialects of those standards, such as
1948 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1949 compiler accepts all programs following that standard plus those
1950 using GNU extensions that do not contradict it. For example,
1951 @option{-std=c90} turns off certain features of GCC that are
1952 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1953 keywords, but not other GNU extensions that do not have a meaning in
1954 ISO C90, such as omitting the middle term of a @code{?:}
1955 expression. On the other hand, when a GNU dialect of a standard is
1956 specified, all features supported by the compiler are enabled, even when
1957 those features change the meaning of the base standard. As a result, some
1958 strict-conforming programs may be rejected. The particular standard
1959 is used by @option{-Wpedantic} to identify which features are GNU
1960 extensions given that version of the standard. For example
1961 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1962 comments, while @option{-std=gnu99 -Wpedantic} does not.
1963
1964 A value for this option must be provided; possible values are
1965
1966 @table @samp
1967 @item c90
1968 @itemx c89
1969 @itemx iso9899:1990
1970 Support all ISO C90 programs (certain GNU extensions that conflict
1971 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1972
1973 @item iso9899:199409
1974 ISO C90 as modified in amendment 1.
1975
1976 @item c99
1977 @itemx c9x
1978 @itemx iso9899:1999
1979 @itemx iso9899:199x
1980 ISO C99. This standard is substantially completely supported, modulo
1981 bugs and floating-point issues
1982 (mainly but not entirely relating to optional C99 features from
1983 Annexes F and G). See
1984 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1985 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1986
1987 @item c11
1988 @itemx c1x
1989 @itemx iso9899:2011
1990 ISO C11, the 2011 revision of the ISO C standard. This standard is
1991 substantially completely supported, modulo bugs, floating-point issues
1992 (mainly but not entirely relating to optional C11 features from
1993 Annexes F and G) and the optional Annexes K (Bounds-checking
1994 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1995
1996 @item c17
1997 @itemx c18
1998 @itemx iso9899:2017
1999 @itemx iso9899:2018
2000 ISO C17, the 2017 revision of the ISO C standard
2001 (published in 2018). This standard is
2002 same as C11 except for corrections of defects (all of which are also
2003 applied with @option{-std=c11}) and a new value of
2004 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2005
2006 @item c2x
2007 The next version of the ISO C standard, still under development. The
2008 support for this version is experimental and incomplete.
2009
2010 @item gnu90
2011 @itemx gnu89
2012 GNU dialect of ISO C90 (including some C99 features).
2013
2014 @item gnu99
2015 @itemx gnu9x
2016 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2017
2018 @item gnu11
2019 @itemx gnu1x
2020 GNU dialect of ISO C11.
2021 The name @samp{gnu1x} is deprecated.
2022
2023 @item gnu17
2024 @itemx gnu18
2025 GNU dialect of ISO C17. This is the default for C code.
2026
2027 @item gnu2x
2028 The next version of the ISO C standard, still under development, plus
2029 GNU extensions. The support for this version is experimental and
2030 incomplete.
2031
2032 @item c++98
2033 @itemx c++03
2034 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2035 additional defect reports. Same as @option{-ansi} for C++ code.
2036
2037 @item gnu++98
2038 @itemx gnu++03
2039 GNU dialect of @option{-std=c++98}.
2040
2041 @item c++11
2042 @itemx c++0x
2043 The 2011 ISO C++ standard plus amendments.
2044 The name @samp{c++0x} is deprecated.
2045
2046 @item gnu++11
2047 @itemx gnu++0x
2048 GNU dialect of @option{-std=c++11}.
2049 The name @samp{gnu++0x} is deprecated.
2050
2051 @item c++14
2052 @itemx c++1y
2053 The 2014 ISO C++ standard plus amendments.
2054 The name @samp{c++1y} is deprecated.
2055
2056 @item gnu++14
2057 @itemx gnu++1y
2058 GNU dialect of @option{-std=c++14}.
2059 This is the default for C++ code.
2060 The name @samp{gnu++1y} is deprecated.
2061
2062 @item c++17
2063 @itemx c++1z
2064 The 2017 ISO C++ standard plus amendments.
2065 The name @samp{c++1z} is deprecated.
2066
2067 @item gnu++17
2068 @itemx gnu++1z
2069 GNU dialect of @option{-std=c++17}.
2070 The name @samp{gnu++1z} is deprecated.
2071
2072 @item c++20
2073 @itemx c++2a
2074 The next revision of the ISO C++ standard, planned for
2075 2020. Support is highly experimental, and will almost certainly
2076 change in incompatible ways in future releases.
2077
2078 @item gnu++20
2079 @itemx gnu++2a
2080 GNU dialect of @option{-std=c++20}. Support is highly experimental,
2081 and will almost certainly change in incompatible ways in future
2082 releases.
2083 @end table
2084
2085 @item -fgnu89-inline
2086 @opindex fgnu89-inline
2087 The option @option{-fgnu89-inline} tells GCC to use the traditional
2088 GNU semantics for @code{inline} functions when in C99 mode.
2089 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2090 Using this option is roughly equivalent to adding the
2091 @code{gnu_inline} function attribute to all inline functions
2092 (@pxref{Function Attributes}).
2093
2094 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2095 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2096 specifies the default behavior).
2097 This option is not supported in @option{-std=c90} or
2098 @option{-std=gnu90} mode.
2099
2100 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2101 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2102 in effect for @code{inline} functions. @xref{Common Predefined
2103 Macros,,,cpp,The C Preprocessor}.
2104
2105 @item -fpermitted-flt-eval-methods=@var{style}
2106 @opindex fpermitted-flt-eval-methods
2107 @opindex fpermitted-flt-eval-methods=c11
2108 @opindex fpermitted-flt-eval-methods=ts-18661-3
2109 ISO/IEC TS 18661-3 defines new permissible values for
2110 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2111 a semantic type that is an interchange or extended format should be
2112 evaluated to the precision and range of that type. These new values are
2113 a superset of those permitted under C99/C11, which does not specify the
2114 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2115 conforming to C11 may not have been written expecting the possibility of
2116 the new values.
2117
2118 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2119 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2120 or the extended set of values specified in ISO/IEC TS 18661-3.
2121
2122 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2123
2124 The default when in a standards compliant mode (@option{-std=c11} or similar)
2125 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2126 dialect (@option{-std=gnu11} or similar) is
2127 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2128
2129 @item -aux-info @var{filename}
2130 @opindex aux-info
2131 Output to the given filename prototyped declarations for all functions
2132 declared and/or defined in a translation unit, including those in header
2133 files. This option is silently ignored in any language other than C@.
2134
2135 Besides declarations, the file indicates, in comments, the origin of
2136 each declaration (source file and line), whether the declaration was
2137 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2138 @samp{O} for old, respectively, in the first character after the line
2139 number and the colon), and whether it came from a declaration or a
2140 definition (@samp{C} or @samp{F}, respectively, in the following
2141 character). In the case of function definitions, a K&R-style list of
2142 arguments followed by their declarations is also provided, inside
2143 comments, after the declaration.
2144
2145 @item -fallow-parameterless-variadic-functions
2146 @opindex fallow-parameterless-variadic-functions
2147 Accept variadic functions without named parameters.
2148
2149 Although it is possible to define such a function, this is not very
2150 useful as it is not possible to read the arguments. This is only
2151 supported for C as this construct is allowed by C++.
2152
2153 @item -fno-asm
2154 @opindex fno-asm
2155 @opindex fasm
2156 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2157 keyword, so that code can use these words as identifiers. You can use
2158 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2159 instead. @option{-ansi} implies @option{-fno-asm}.
2160
2161 In C++, this switch only affects the @code{typeof} keyword, since
2162 @code{asm} and @code{inline} are standard keywords. You may want to
2163 use the @option{-fno-gnu-keywords} flag instead, which has the same
2164 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2165 switch only affects the @code{asm} and @code{typeof} keywords, since
2166 @code{inline} is a standard keyword in ISO C99.
2167
2168 @item -fno-builtin
2169 @itemx -fno-builtin-@var{function}
2170 @opindex fno-builtin
2171 @opindex fbuiltin
2172 @cindex built-in functions
2173 Don't recognize built-in functions that do not begin with
2174 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2175 functions provided by GCC}, for details of the functions affected,
2176 including those which are not built-in functions when @option{-ansi} or
2177 @option{-std} options for strict ISO C conformance are used because they
2178 do not have an ISO standard meaning.
2179
2180 GCC normally generates special code to handle certain built-in functions
2181 more efficiently; for instance, calls to @code{alloca} may become single
2182 instructions which adjust the stack directly, and calls to @code{memcpy}
2183 may become inline copy loops. The resulting code is often both smaller
2184 and faster, but since the function calls no longer appear as such, you
2185 cannot set a breakpoint on those calls, nor can you change the behavior
2186 of the functions by linking with a different library. In addition,
2187 when a function is recognized as a built-in function, GCC may use
2188 information about that function to warn about problems with calls to
2189 that function, or to generate more efficient code, even if the
2190 resulting code still contains calls to that function. For example,
2191 warnings are given with @option{-Wformat} for bad calls to
2192 @code{printf} when @code{printf} is built in and @code{strlen} is
2193 known not to modify global memory.
2194
2195 With the @option{-fno-builtin-@var{function}} option
2196 only the built-in function @var{function} is
2197 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2198 function is named that is not built-in in this version of GCC, this
2199 option is ignored. There is no corresponding
2200 @option{-fbuiltin-@var{function}} option; if you wish to enable
2201 built-in functions selectively when using @option{-fno-builtin} or
2202 @option{-ffreestanding}, you may define macros such as:
2203
2204 @smallexample
2205 #define abs(n) __builtin_abs ((n))
2206 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2207 @end smallexample
2208
2209 @item -fgimple
2210 @opindex fgimple
2211
2212 Enable parsing of function definitions marked with @code{__GIMPLE}.
2213 This is an experimental feature that allows unit testing of GIMPLE
2214 passes.
2215
2216 @item -fhosted
2217 @opindex fhosted
2218 @cindex hosted environment
2219
2220 Assert that compilation targets a hosted environment. This implies
2221 @option{-fbuiltin}. A hosted environment is one in which the
2222 entire standard library is available, and in which @code{main} has a return
2223 type of @code{int}. Examples are nearly everything except a kernel.
2224 This is equivalent to @option{-fno-freestanding}.
2225
2226 @item -ffreestanding
2227 @opindex ffreestanding
2228 @cindex hosted environment
2229
2230 Assert that compilation targets a freestanding environment. This
2231 implies @option{-fno-builtin}. A freestanding environment
2232 is one in which the standard library may not exist, and program startup may
2233 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2234 This is equivalent to @option{-fno-hosted}.
2235
2236 @xref{Standards,,Language Standards Supported by GCC}, for details of
2237 freestanding and hosted environments.
2238
2239 @item -fopenacc
2240 @opindex fopenacc
2241 @cindex OpenACC accelerator programming
2242 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2243 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2244 compiler generates accelerated code according to the OpenACC Application
2245 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2246 implies @option{-pthread}, and thus is only supported on targets that
2247 have support for @option{-pthread}.
2248
2249 @item -fopenacc-dim=@var{geom}
2250 @opindex fopenacc-dim
2251 @cindex OpenACC accelerator programming
2252 Specify default compute dimensions for parallel offload regions that do
2253 not explicitly specify. The @var{geom} value is a triple of
2254 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2255 can be omitted, to use a target-specific default value.
2256
2257 @item -fopenmp
2258 @opindex fopenmp
2259 @cindex OpenMP parallel
2260 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2261 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2262 compiler generates parallel code according to the OpenMP Application
2263 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2264 implies @option{-pthread}, and thus is only supported on targets that
2265 have support for @option{-pthread}. @option{-fopenmp} implies
2266 @option{-fopenmp-simd}.
2267
2268 @item -fopenmp-simd
2269 @opindex fopenmp-simd
2270 @cindex OpenMP SIMD
2271 @cindex SIMD
2272 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2273 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2274 are ignored.
2275
2276 @item -fgnu-tm
2277 @opindex fgnu-tm
2278 When the option @option{-fgnu-tm} is specified, the compiler
2279 generates code for the Linux variant of Intel's current Transactional
2280 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2281 an experimental feature whose interface may change in future versions
2282 of GCC, as the official specification changes. Please note that not
2283 all architectures are supported for this feature.
2284
2285 For more information on GCC's support for transactional memory,
2286 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2287 Transactional Memory Library}.
2288
2289 Note that the transactional memory feature is not supported with
2290 non-call exceptions (@option{-fnon-call-exceptions}).
2291
2292 @item -fms-extensions
2293 @opindex fms-extensions
2294 Accept some non-standard constructs used in Microsoft header files.
2295
2296 In C++ code, this allows member names in structures to be similar
2297 to previous types declarations.
2298
2299 @smallexample
2300 typedef int UOW;
2301 struct ABC @{
2302 UOW UOW;
2303 @};
2304 @end smallexample
2305
2306 Some cases of unnamed fields in structures and unions are only
2307 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2308 fields within structs/unions}, for details.
2309
2310 Note that this option is off for all targets except for x86
2311 targets using ms-abi.
2312
2313 @item -fplan9-extensions
2314 @opindex fplan9-extensions
2315 Accept some non-standard constructs used in Plan 9 code.
2316
2317 This enables @option{-fms-extensions}, permits passing pointers to
2318 structures with anonymous fields to functions that expect pointers to
2319 elements of the type of the field, and permits referring to anonymous
2320 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2321 struct/union fields within structs/unions}, for details. This is only
2322 supported for C, not C++.
2323
2324 @item -fcond-mismatch
2325 @opindex fcond-mismatch
2326 Allow conditional expressions with mismatched types in the second and
2327 third arguments. The value of such an expression is void. This option
2328 is not supported for C++.
2329
2330 @item -flax-vector-conversions
2331 @opindex flax-vector-conversions
2332 Allow implicit conversions between vectors with differing numbers of
2333 elements and/or incompatible element types. This option should not be
2334 used for new code.
2335
2336 @item -funsigned-char
2337 @opindex funsigned-char
2338 Let the type @code{char} be unsigned, like @code{unsigned char}.
2339
2340 Each kind of machine has a default for what @code{char} should
2341 be. It is either like @code{unsigned char} by default or like
2342 @code{signed char} by default.
2343
2344 Ideally, a portable program should always use @code{signed char} or
2345 @code{unsigned char} when it depends on the signedness of an object.
2346 But many programs have been written to use plain @code{char} and
2347 expect it to be signed, or expect it to be unsigned, depending on the
2348 machines they were written for. This option, and its inverse, let you
2349 make such a program work with the opposite default.
2350
2351 The type @code{char} is always a distinct type from each of
2352 @code{signed char} or @code{unsigned char}, even though its behavior
2353 is always just like one of those two.
2354
2355 @item -fsigned-char
2356 @opindex fsigned-char
2357 Let the type @code{char} be signed, like @code{signed char}.
2358
2359 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2360 the negative form of @option{-funsigned-char}. Likewise, the option
2361 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2362
2363 @item -fsigned-bitfields
2364 @itemx -funsigned-bitfields
2365 @itemx -fno-signed-bitfields
2366 @itemx -fno-unsigned-bitfields
2367 @opindex fsigned-bitfields
2368 @opindex funsigned-bitfields
2369 @opindex fno-signed-bitfields
2370 @opindex fno-unsigned-bitfields
2371 These options control whether a bit-field is signed or unsigned, when the
2372 declaration does not use either @code{signed} or @code{unsigned}. By
2373 default, such a bit-field is signed, because this is consistent: the
2374 basic integer types such as @code{int} are signed types.
2375
2376 @item -fsso-struct=@var{endianness}
2377 @opindex fsso-struct
2378 Set the default scalar storage order of structures and unions to the
2379 specified endianness. The accepted values are @samp{big-endian},
2380 @samp{little-endian} and @samp{native} for the native endianness of
2381 the target (the default). This option is not supported for C++.
2382
2383 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2384 code that is not binary compatible with code generated without it if the
2385 specified endianness is not the native endianness of the target.
2386 @end table
2387
2388 @node C++ Dialect Options
2389 @section Options Controlling C++ Dialect
2390
2391 @cindex compiler options, C++
2392 @cindex C++ options, command-line
2393 @cindex options, C++
2394 This section describes the command-line options that are only meaningful
2395 for C++ programs. You can also use most of the GNU compiler options
2396 regardless of what language your program is in. For example, you
2397 might compile a file @file{firstClass.C} like this:
2398
2399 @smallexample
2400 g++ -g -fstrict-enums -O -c firstClass.C
2401 @end smallexample
2402
2403 @noindent
2404 In this example, only @option{-fstrict-enums} is an option meant
2405 only for C++ programs; you can use the other options with any
2406 language supported by GCC@.
2407
2408 Some options for compiling C programs, such as @option{-std}, are also
2409 relevant for C++ programs.
2410 @xref{C Dialect Options,,Options Controlling C Dialect}.
2411
2412 Here is a list of options that are @emph{only} for compiling C++ programs:
2413
2414 @table @gcctabopt
2415
2416 @item -fabi-version=@var{n}
2417 @opindex fabi-version
2418 Use version @var{n} of the C++ ABI@. The default is version 0.
2419
2420 Version 0 refers to the version conforming most closely to
2421 the C++ ABI specification. Therefore, the ABI obtained using version 0
2422 will change in different versions of G++ as ABI bugs are fixed.
2423
2424 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2425
2426 Version 2 is the version of the C++ ABI that first appeared in G++
2427 3.4, and was the default through G++ 4.9.
2428
2429 Version 3 corrects an error in mangling a constant address as a
2430 template argument.
2431
2432 Version 4, which first appeared in G++ 4.5, implements a standard
2433 mangling for vector types.
2434
2435 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2436 attribute const/volatile on function pointer types, decltype of a
2437 plain decl, and use of a function parameter in the declaration of
2438 another parameter.
2439
2440 Version 6, which first appeared in G++ 4.7, corrects the promotion
2441 behavior of C++11 scoped enums and the mangling of template argument
2442 packs, const/static_cast, prefix ++ and --, and a class scope function
2443 used as a template argument.
2444
2445 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2446 builtin type and corrects the mangling of lambdas in default argument
2447 scope.
2448
2449 Version 8, which first appeared in G++ 4.9, corrects the substitution
2450 behavior of function types with function-cv-qualifiers.
2451
2452 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2453 @code{nullptr_t}.
2454
2455 Version 10, which first appeared in G++ 6.1, adds mangling of
2456 attributes that affect type identity, such as ia32 calling convention
2457 attributes (e.g.@: @samp{stdcall}).
2458
2459 Version 11, which first appeared in G++ 7, corrects the mangling of
2460 sizeof... expressions and operator names. For multiple entities with
2461 the same name within a function, that are declared in different scopes,
2462 the mangling now changes starting with the twelfth occurrence. It also
2463 implies @option{-fnew-inheriting-ctors}.
2464
2465 Version 12, which first appeared in G++ 8, corrects the calling
2466 conventions for empty classes on the x86_64 target and for classes
2467 with only deleted copy/move constructors. It accidentally changes the
2468 calling convention for classes with a deleted copy constructor and a
2469 trivial move constructor.
2470
2471 Version 13, which first appeared in G++ 8.2, fixes the accidental
2472 change in version 12.
2473
2474 Version 14, which first appeared in G++ 10, corrects the mangling of
2475 the nullptr expression.
2476
2477 See also @option{-Wabi}.
2478
2479 @item -fabi-compat-version=@var{n}
2480 @opindex fabi-compat-version
2481 On targets that support strong aliases, G++
2482 works around mangling changes by creating an alias with the correct
2483 mangled name when defining a symbol with an incorrect mangled name.
2484 This switch specifies which ABI version to use for the alias.
2485
2486 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2487 compatibility). If another ABI version is explicitly selected, this
2488 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2489 use @option{-fabi-compat-version=2}.
2490
2491 If this option is not provided but @option{-Wabi=@var{n}} is, that
2492 version is used for compatibility aliases. If this option is provided
2493 along with @option{-Wabi} (without the version), the version from this
2494 option is used for the warning.
2495
2496 @item -fno-access-control
2497 @opindex fno-access-control
2498 @opindex faccess-control
2499 Turn off all access checking. This switch is mainly useful for working
2500 around bugs in the access control code.
2501
2502 @item -faligned-new
2503 @opindex faligned-new
2504 Enable support for C++17 @code{new} of types that require more
2505 alignment than @code{void* ::operator new(std::size_t)} provides. A
2506 numeric argument such as @code{-faligned-new=32} can be used to
2507 specify how much alignment (in bytes) is provided by that function,
2508 but few users will need to override the default of
2509 @code{alignof(std::max_align_t)}.
2510
2511 This flag is enabled by default for @option{-std=c++17}.
2512
2513 @item -fchar8_t
2514 @itemx -fno-char8_t
2515 @opindex fchar8_t
2516 @opindex fno-char8_t
2517 Enable support for @code{char8_t} as adopted for C++2a. This includes
2518 the addition of a new @code{char8_t} fundamental type, changes to the
2519 types of UTF-8 string and character literals, new signatures for
2520 user-defined literals, associated standard library updates, and new
2521 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2522
2523 This option enables functions to be overloaded for ordinary and UTF-8
2524 strings:
2525
2526 @smallexample
2527 int f(const char *); // #1
2528 int f(const char8_t *); // #2
2529 int v1 = f("text"); // Calls #1
2530 int v2 = f(u8"text"); // Calls #2
2531 @end smallexample
2532
2533 @noindent
2534 and introduces new signatures for user-defined literals:
2535
2536 @smallexample
2537 int operator""_udl1(char8_t);
2538 int v3 = u8'x'_udl1;
2539 int operator""_udl2(const char8_t*, std::size_t);
2540 int v4 = u8"text"_udl2;
2541 template<typename T, T...> int operator""_udl3();
2542 int v5 = u8"text"_udl3;
2543 @end smallexample
2544
2545 @noindent
2546 The change to the types of UTF-8 string and character literals introduces
2547 incompatibilities with ISO C++11 and later standards. For example, the
2548 following code is well-formed under ISO C++11, but is ill-formed when
2549 @option{-fchar8_t} is specified.
2550
2551 @smallexample
2552 char ca[] = u8"xx"; // error: char-array initialized from wide
2553 // string
2554 const char *cp = u8"xx";// error: invalid conversion from
2555 // `const char8_t*' to `const char*'
2556 int f(const char*);
2557 auto v = f(u8"xx"); // error: invalid conversion from
2558 // `const char8_t*' to `const char*'
2559 std::string s@{u8"xx"@}; // error: no matching function for call to
2560 // `std::basic_string<char>::basic_string()'
2561 using namespace std::literals;
2562 s = u8"xx"s; // error: conversion from
2563 // `basic_string<char8_t>' to non-scalar
2564 // type `basic_string<char>' requested
2565 @end smallexample
2566
2567 @item -fcheck-new
2568 @opindex fcheck-new
2569 Check that the pointer returned by @code{operator new} is non-null
2570 before attempting to modify the storage allocated. This check is
2571 normally unnecessary because the C++ standard specifies that
2572 @code{operator new} only returns @code{0} if it is declared
2573 @code{throw()}, in which case the compiler always checks the
2574 return value even without this option. In all other cases, when
2575 @code{operator new} has a non-empty exception specification, memory
2576 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2577 @samp{new (nothrow)}.
2578
2579 @item -fconcepts
2580 @itemx -fconcepts-ts
2581 @opindex fconcepts
2582 @opindex fconcepts-ts
2583 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2584 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2585
2586 With @option{-std=c++2a} and above, Concepts are part of the language
2587 standard, so @option{-fconcepts} defaults to on. But the standard
2588 specification of Concepts differs significantly from the TS, so some
2589 constructs that were allowed in the TS but didn't make it into the
2590 standard can still be enabled by @option{-fconcepts-ts}.
2591
2592 @item -fconstexpr-depth=@var{n}
2593 @opindex fconstexpr-depth
2594 Set the maximum nested evaluation depth for C++11 constexpr functions
2595 to @var{n}. A limit is needed to detect endless recursion during
2596 constant expression evaluation. The minimum specified by the standard
2597 is 512.
2598
2599 @item -fconstexpr-cache-depth=@var{n}
2600 @opindex fconstexpr-cache-depth
2601 Set the maximum level of nested evaluation depth for C++11 constexpr
2602 functions that will be cached to @var{n}. This is a heuristic that
2603 trades off compilation speed (when the cache avoids repeated
2604 calculations) against memory consumption (when the cache grows very
2605 large from highly recursive evaluations). The default is 8. Very few
2606 users are likely to want to adjust it, but if your code does heavy
2607 constexpr calculations you might want to experiment to find which
2608 value works best for you.
2609
2610 @item -fconstexpr-loop-limit=@var{n}
2611 @opindex fconstexpr-loop-limit
2612 Set the maximum number of iterations for a loop in C++14 constexpr functions
2613 to @var{n}. A limit is needed to detect infinite loops during
2614 constant expression evaluation. The default is 262144 (1<<18).
2615
2616 @item -fconstexpr-ops-limit=@var{n}
2617 @opindex fconstexpr-ops-limit
2618 Set the maximum number of operations during a single constexpr evaluation.
2619 Even when number of iterations of a single loop is limited with the above limit,
2620 if there are several nested loops and each of them has many iterations but still
2621 smaller than the above limit, or if in a body of some loop or even outside
2622 of a loop too many expressions need to be evaluated, the resulting constexpr
2623 evaluation might take too long.
2624 The default is 33554432 (1<<25).
2625
2626 @item -fcoroutines
2627 @opindex fcoroutines
2628 Enable support for the C++ coroutines extension (experimental).
2629
2630 @item -fno-elide-constructors
2631 @opindex fno-elide-constructors
2632 @opindex felide-constructors
2633 The C++ standard allows an implementation to omit creating a temporary
2634 that is only used to initialize another object of the same type.
2635 Specifying this option disables that optimization, and forces G++ to
2636 call the copy constructor in all cases. This option also causes G++
2637 to call trivial member functions which otherwise would be expanded inline.
2638
2639 In C++17, the compiler is required to omit these temporaries, but this
2640 option still affects trivial member functions.
2641
2642 @item -fno-enforce-eh-specs
2643 @opindex fno-enforce-eh-specs
2644 @opindex fenforce-eh-specs
2645 Don't generate code to check for violation of exception specifications
2646 at run time. This option violates the C++ standard, but may be useful
2647 for reducing code size in production builds, much like defining
2648 @code{NDEBUG}. This does not give user code permission to throw
2649 exceptions in violation of the exception specifications; the compiler
2650 still optimizes based on the specifications, so throwing an
2651 unexpected exception results in undefined behavior at run time.
2652
2653 @item -fextern-tls-init
2654 @itemx -fno-extern-tls-init
2655 @opindex fextern-tls-init
2656 @opindex fno-extern-tls-init
2657 The C++11 and OpenMP standards allow @code{thread_local} and
2658 @code{threadprivate} variables to have dynamic (runtime)
2659 initialization. To support this, any use of such a variable goes
2660 through a wrapper function that performs any necessary initialization.
2661 When the use and definition of the variable are in the same
2662 translation unit, this overhead can be optimized away, but when the
2663 use is in a different translation unit there is significant overhead
2664 even if the variable doesn't actually need dynamic initialization. If
2665 the programmer can be sure that no use of the variable in a
2666 non-defining TU needs to trigger dynamic initialization (either
2667 because the variable is statically initialized, or a use of the
2668 variable in the defining TU will be executed before any uses in
2669 another TU), they can avoid this overhead with the
2670 @option{-fno-extern-tls-init} option.
2671
2672 On targets that support symbol aliases, the default is
2673 @option{-fextern-tls-init}. On targets that do not support symbol
2674 aliases, the default is @option{-fno-extern-tls-init}.
2675
2676 @item -fno-gnu-keywords
2677 @opindex fno-gnu-keywords
2678 @opindex fgnu-keywords
2679 Do not recognize @code{typeof} as a keyword, so that code can use this
2680 word as an identifier. You can use the keyword @code{__typeof__} instead.
2681 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2682 @option{-std=c++98}, @option{-std=c++11}, etc.
2683
2684 @item -fno-implicit-templates
2685 @opindex fno-implicit-templates
2686 @opindex fimplicit-templates
2687 Never emit code for non-inline templates that are instantiated
2688 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2689 If you use this option, you must take care to structure your code to
2690 include all the necessary explicit instantiations to avoid getting
2691 undefined symbols at link time.
2692 @xref{Template Instantiation}, for more information.
2693
2694 @item -fno-implicit-inline-templates
2695 @opindex fno-implicit-inline-templates
2696 @opindex fimplicit-inline-templates
2697 Don't emit code for implicit instantiations of inline templates, either.
2698 The default is to handle inlines differently so that compiles with and
2699 without optimization need the same set of explicit instantiations.
2700
2701 @item -fno-implement-inlines
2702 @opindex fno-implement-inlines
2703 @opindex fimplement-inlines
2704 To save space, do not emit out-of-line copies of inline functions
2705 controlled by @code{#pragma implementation}. This causes linker
2706 errors if these functions are not inlined everywhere they are called.
2707
2708 @item -fms-extensions
2709 @opindex fms-extensions
2710 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2711 int and getting a pointer to member function via non-standard syntax.
2712
2713 @item -fnew-inheriting-ctors
2714 @opindex fnew-inheriting-ctors
2715 Enable the P0136 adjustment to the semantics of C++11 constructor
2716 inheritance. This is part of C++17 but also considered to be a Defect
2717 Report against C++11 and C++14. This flag is enabled by default
2718 unless @option{-fabi-version=10} or lower is specified.
2719
2720 @item -fnew-ttp-matching
2721 @opindex fnew-ttp-matching
2722 Enable the P0522 resolution to Core issue 150, template template
2723 parameters and default arguments: this allows a template with default
2724 template arguments as an argument for a template template parameter
2725 with fewer template parameters. This flag is enabled by default for
2726 @option{-std=c++17}.
2727
2728 @item -fno-nonansi-builtins
2729 @opindex fno-nonansi-builtins
2730 @opindex fnonansi-builtins
2731 Disable built-in declarations of functions that are not mandated by
2732 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2733 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2734
2735 @item -fnothrow-opt
2736 @opindex fnothrow-opt
2737 Treat a @code{throw()} exception specification as if it were a
2738 @code{noexcept} specification to reduce or eliminate the text size
2739 overhead relative to a function with no exception specification. If
2740 the function has local variables of types with non-trivial
2741 destructors, the exception specification actually makes the
2742 function smaller because the EH cleanups for those variables can be
2743 optimized away. The semantic effect is that an exception thrown out of
2744 a function with such an exception specification results in a call
2745 to @code{terminate} rather than @code{unexpected}.
2746
2747 @item -fno-operator-names
2748 @opindex fno-operator-names
2749 @opindex foperator-names
2750 Do not treat the operator name keywords @code{and}, @code{bitand},
2751 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2752 synonyms as keywords.
2753
2754 @item -fno-optional-diags
2755 @opindex fno-optional-diags
2756 @opindex foptional-diags
2757 Disable diagnostics that the standard says a compiler does not need to
2758 issue. Currently, the only such diagnostic issued by G++ is the one for
2759 a name having multiple meanings within a class.
2760
2761 @item -fpermissive
2762 @opindex fpermissive
2763 Downgrade some diagnostics about nonconformant code from errors to
2764 warnings. Thus, using @option{-fpermissive} allows some
2765 nonconforming code to compile.
2766
2767 @item -fno-pretty-templates
2768 @opindex fno-pretty-templates
2769 @opindex fpretty-templates
2770 When an error message refers to a specialization of a function
2771 template, the compiler normally prints the signature of the
2772 template followed by the template arguments and any typedefs or
2773 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2774 rather than @code{void f(int)}) so that it's clear which template is
2775 involved. When an error message refers to a specialization of a class
2776 template, the compiler omits any template arguments that match
2777 the default template arguments for that template. If either of these
2778 behaviors make it harder to understand the error message rather than
2779 easier, you can use @option{-fno-pretty-templates} to disable them.
2780
2781 @item -fno-rtti
2782 @opindex fno-rtti
2783 @opindex frtti
2784 Disable generation of information about every class with virtual
2785 functions for use by the C++ run-time type identification features
2786 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2787 of the language, you can save some space by using this flag. Note that
2788 exception handling uses the same information, but G++ generates it as
2789 needed. The @code{dynamic_cast} operator can still be used for casts that
2790 do not require run-time type information, i.e.@: casts to @code{void *} or to
2791 unambiguous base classes.
2792
2793 Mixing code compiled with @option{-frtti} with that compiled with
2794 @option{-fno-rtti} may not work. For example, programs may
2795 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2796 for a class compiled with @option{-frtti}.
2797
2798 @item -fsized-deallocation
2799 @opindex fsized-deallocation
2800 Enable the built-in global declarations
2801 @smallexample
2802 void operator delete (void *, std::size_t) noexcept;
2803 void operator delete[] (void *, std::size_t) noexcept;
2804 @end smallexample
2805 as introduced in C++14. This is useful for user-defined replacement
2806 deallocation functions that, for example, use the size of the object
2807 to make deallocation faster. Enabled by default under
2808 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2809 warns about places that might want to add a definition.
2810
2811 @item -fstrict-enums
2812 @opindex fstrict-enums
2813 Allow the compiler to optimize using the assumption that a value of
2814 enumerated type can only be one of the values of the enumeration (as
2815 defined in the C++ standard; basically, a value that can be
2816 represented in the minimum number of bits needed to represent all the
2817 enumerators). This assumption may not be valid if the program uses a
2818 cast to convert an arbitrary integer value to the enumerated type.
2819
2820 @item -fstrong-eval-order
2821 @opindex fstrong-eval-order
2822 Evaluate member access, array subscripting, and shift expressions in
2823 left-to-right order, and evaluate assignment in right-to-left order,
2824 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2825 @option{-fstrong-eval-order=some} enables just the ordering of member
2826 access and shift expressions, and is the default without
2827 @option{-std=c++17}.
2828
2829 @item -ftemplate-backtrace-limit=@var{n}
2830 @opindex ftemplate-backtrace-limit
2831 Set the maximum number of template instantiation notes for a single
2832 warning or error to @var{n}. The default value is 10.
2833
2834 @item -ftemplate-depth=@var{n}
2835 @opindex ftemplate-depth
2836 Set the maximum instantiation depth for template classes to @var{n}.
2837 A limit on the template instantiation depth is needed to detect
2838 endless recursions during template class instantiation. ANSI/ISO C++
2839 conforming programs must not rely on a maximum depth greater than 17
2840 (changed to 1024 in C++11). The default value is 900, as the compiler
2841 can run out of stack space before hitting 1024 in some situations.
2842
2843 @item -fno-threadsafe-statics
2844 @opindex fno-threadsafe-statics
2845 @opindex fthreadsafe-statics
2846 Do not emit the extra code to use the routines specified in the C++
2847 ABI for thread-safe initialization of local statics. You can use this
2848 option to reduce code size slightly in code that doesn't need to be
2849 thread-safe.
2850
2851 @item -fuse-cxa-atexit
2852 @opindex fuse-cxa-atexit
2853 Register destructors for objects with static storage duration with the
2854 @code{__cxa_atexit} function rather than the @code{atexit} function.
2855 This option is required for fully standards-compliant handling of static
2856 destructors, but only works if your C library supports
2857 @code{__cxa_atexit}.
2858
2859 @item -fno-use-cxa-get-exception-ptr
2860 @opindex fno-use-cxa-get-exception-ptr
2861 @opindex fuse-cxa-get-exception-ptr
2862 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2863 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2864 if the runtime routine is not available.
2865
2866 @item -fvisibility-inlines-hidden
2867 @opindex fvisibility-inlines-hidden
2868 This switch declares that the user does not attempt to compare
2869 pointers to inline functions or methods where the addresses of the two functions
2870 are taken in different shared objects.
2871
2872 The effect of this is that GCC may, effectively, mark inline methods with
2873 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2874 appear in the export table of a DSO and do not require a PLT indirection
2875 when used within the DSO@. Enabling this option can have a dramatic effect
2876 on load and link times of a DSO as it massively reduces the size of the
2877 dynamic export table when the library makes heavy use of templates.
2878
2879 The behavior of this switch is not quite the same as marking the
2880 methods as hidden directly, because it does not affect static variables
2881 local to the function or cause the compiler to deduce that
2882 the function is defined in only one shared object.
2883
2884 You may mark a method as having a visibility explicitly to negate the
2885 effect of the switch for that method. For example, if you do want to
2886 compare pointers to a particular inline method, you might mark it as
2887 having default visibility. Marking the enclosing class with explicit
2888 visibility has no effect.
2889
2890 Explicitly instantiated inline methods are unaffected by this option
2891 as their linkage might otherwise cross a shared library boundary.
2892 @xref{Template Instantiation}.
2893
2894 @item -fvisibility-ms-compat
2895 @opindex fvisibility-ms-compat
2896 This flag attempts to use visibility settings to make GCC's C++
2897 linkage model compatible with that of Microsoft Visual Studio.
2898
2899 The flag makes these changes to GCC's linkage model:
2900
2901 @enumerate
2902 @item
2903 It sets the default visibility to @code{hidden}, like
2904 @option{-fvisibility=hidden}.
2905
2906 @item
2907 Types, but not their members, are not hidden by default.
2908
2909 @item
2910 The One Definition Rule is relaxed for types without explicit
2911 visibility specifications that are defined in more than one
2912 shared object: those declarations are permitted if they are
2913 permitted when this option is not used.
2914 @end enumerate
2915
2916 In new code it is better to use @option{-fvisibility=hidden} and
2917 export those classes that are intended to be externally visible.
2918 Unfortunately it is possible for code to rely, perhaps accidentally,
2919 on the Visual Studio behavior.
2920
2921 Among the consequences of these changes are that static data members
2922 of the same type with the same name but defined in different shared
2923 objects are different, so changing one does not change the other;
2924 and that pointers to function members defined in different shared
2925 objects may not compare equal. When this flag is given, it is a
2926 violation of the ODR to define types with the same name differently.
2927
2928 @item -fno-weak
2929 @opindex fno-weak
2930 @opindex fweak
2931 Do not use weak symbol support, even if it is provided by the linker.
2932 By default, G++ uses weak symbols if they are available. This
2933 option exists only for testing, and should not be used by end-users;
2934 it results in inferior code and has no benefits. This option may
2935 be removed in a future release of G++.
2936
2937 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2938 @opindex fext-numeric-literals
2939 @opindex fno-ext-numeric-literals
2940 Accept imaginary, fixed-point, or machine-defined
2941 literal number suffixes as GNU extensions.
2942 When this option is turned off these suffixes are treated
2943 as C++11 user-defined literal numeric suffixes.
2944 This is on by default for all pre-C++11 dialects and all GNU dialects:
2945 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2946 @option{-std=gnu++14}.
2947 This option is off by default
2948 for ISO C++11 onwards (@option{-std=c++11}, ...).
2949
2950 @item -nostdinc++
2951 @opindex nostdinc++
2952 Do not search for header files in the standard directories specific to
2953 C++, but do still search the other standard directories. (This option
2954 is used when building the C++ library.)
2955 @end table
2956
2957 In addition, these warning options have meanings only for C++ programs:
2958
2959 @table @gcctabopt
2960 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2961 @opindex Wabi-tag
2962 @opindex Wabi-tag
2963 Warn when a type with an ABI tag is used in a context that does not
2964 have that ABI tag. See @ref{C++ Attributes} for more information
2965 about ABI tags.
2966
2967 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
2968 @opindex Wcomma-subscript
2969 @opindex Wno-comma-subscript
2970 Warn about uses of a comma expression within a subscripting expression.
2971 This usage was deprecated in C++2a. However, a comma expression wrapped
2972 in @code{( )} is not deprecated. Example:
2973
2974 @smallexample
2975 @group
2976 void f(int *a, int b, int c) @{
2977 a[b,c]; // deprecated
2978 a[(b,c)]; // OK
2979 @}
2980 @end group
2981 @end smallexample
2982
2983 Enabled by default with @option{-std=c++2a}.
2984
2985 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2986 @opindex Wctor-dtor-privacy
2987 @opindex Wno-ctor-dtor-privacy
2988 Warn when a class seems unusable because all the constructors or
2989 destructors in that class are private, and it has neither friends nor
2990 public static member functions. Also warn if there are no non-private
2991 methods, and there's at least one private member function that isn't
2992 a constructor or destructor.
2993
2994 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2995 @opindex Wdelete-non-virtual-dtor
2996 @opindex Wno-delete-non-virtual-dtor
2997 Warn when @code{delete} is used to destroy an instance of a class that
2998 has virtual functions and non-virtual destructor. It is unsafe to delete
2999 an instance of a derived class through a pointer to a base class if the
3000 base class does not have a virtual destructor. This warning is enabled
3001 by @option{-Wall}.
3002
3003 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3004 @opindex Wdeprecated-copy
3005 @opindex Wno-deprecated-copy
3006 Warn that the implicit declaration of a copy constructor or copy
3007 assignment operator is deprecated if the class has a user-provided
3008 copy constructor or copy assignment operator, in C++11 and up. This
3009 warning is enabled by @option{-Wextra}. With
3010 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3011 user-provided destructor.
3012
3013 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3014 @opindex Winit-list-lifetime
3015 @opindex Wno-init-list-lifetime
3016 Do not warn about uses of @code{std::initializer_list} that are likely
3017 to result in dangling pointers. Since the underlying array for an
3018 @code{initializer_list} is handled like a normal C++ temporary object,
3019 it is easy to inadvertently keep a pointer to the array past the end
3020 of the array's lifetime. For example:
3021
3022 @itemize @bullet
3023 @item
3024 If a function returns a temporary @code{initializer_list}, or a local
3025 @code{initializer_list} variable, the array's lifetime ends at the end
3026 of the return statement, so the value returned has a dangling pointer.
3027
3028 @item
3029 If a new-expression creates an @code{initializer_list}, the array only
3030 lives until the end of the enclosing full-expression, so the
3031 @code{initializer_list} in the heap has a dangling pointer.
3032
3033 @item
3034 When an @code{initializer_list} variable is assigned from a
3035 brace-enclosed initializer list, the temporary array created for the
3036 right side of the assignment only lives until the end of the
3037 full-expression, so at the next statement the @code{initializer_list}
3038 variable has a dangling pointer.
3039
3040 @smallexample
3041 // li's initial underlying array lives as long as li
3042 std::initializer_list<int> li = @{ 1,2,3 @};
3043 // assignment changes li to point to a temporary array
3044 li = @{ 4, 5 @};
3045 // now the temporary is gone and li has a dangling pointer
3046 int i = li.begin()[0] // undefined behavior
3047 @end smallexample
3048
3049 @item
3050 When a list constructor stores the @code{begin} pointer from the
3051 @code{initializer_list} argument, this doesn't extend the lifetime of
3052 the array, so if a class variable is constructed from a temporary
3053 @code{initializer_list}, the pointer is left dangling by the end of
3054 the variable declaration statement.
3055
3056 @end itemize
3057
3058 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3059 @opindex Wliteral-suffix
3060 @opindex Wno-literal-suffix
3061 Do not warn when a string or character literal is followed by a
3062 ud-suffix which does not begin with an underscore. As a conforming
3063 extension, GCC treats such suffixes as separate preprocessing tokens
3064 in order to maintain backwards compatibility with code that uses
3065 formatting macros from @code{<inttypes.h>}. For example:
3066
3067 @smallexample
3068 #define __STDC_FORMAT_MACROS
3069 #include <inttypes.h>
3070 #include <stdio.h>
3071
3072 int main() @{
3073 int64_t i64 = 123;
3074 printf("My int64: %" PRId64"\n", i64);
3075 @}
3076 @end smallexample
3077
3078 In this case, @code{PRId64} is treated as a separate preprocessing token.
3079
3080 This option also controls warnings when a user-defined literal
3081 operator is declared with a literal suffix identifier that doesn't
3082 begin with an underscore. Literal suffix identifiers that don't begin
3083 with an underscore are reserved for future standardization.
3084
3085 These warnings are enabled by default.
3086
3087 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3088 @opindex Wnarrowing
3089 @opindex Wno-narrowing
3090 For C++11 and later standards, narrowing conversions are diagnosed by default,
3091 as required by the standard. A narrowing conversion from a constant produces
3092 an error, and a narrowing conversion from a non-constant produces a warning,
3093 but @option{-Wno-narrowing} suppresses the diagnostic.
3094 Note that this does not affect the meaning of well-formed code;
3095 narrowing conversions are still considered ill-formed in SFINAE contexts.
3096
3097 With @option{-Wnarrowing} in C++98, warn when a narrowing
3098 conversion prohibited by C++11 occurs within
3099 @samp{@{ @}}, e.g.
3100
3101 @smallexample
3102 int i = @{ 2.2 @}; // error: narrowing from double to int
3103 @end smallexample
3104
3105 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3106
3107 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3108 @opindex Wnoexcept
3109 @opindex Wno-noexcept
3110 Warn when a noexcept-expression evaluates to false because of a call
3111 to a function that does not have a non-throwing exception
3112 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3113 the compiler to never throw an exception.
3114
3115 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3116 @opindex Wnoexcept-type
3117 @opindex Wno-noexcept-type
3118 Warn if the C++17 feature making @code{noexcept} part of a function
3119 type changes the mangled name of a symbol relative to C++14. Enabled
3120 by @option{-Wabi} and @option{-Wc++17-compat}.
3121
3122 As an example:
3123
3124 @smallexample
3125 template <class T> void f(T t) @{ t(); @};
3126 void g() noexcept;
3127 void h() @{ f(g); @}
3128 @end smallexample
3129
3130 @noindent
3131 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3132 C++17 it calls @code{f<void(*)()noexcept>}.
3133
3134 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3135 @opindex Wclass-memaccess
3136 @opindex Wno-class-memaccess
3137 Warn when the destination of a call to a raw memory function such as
3138 @code{memset} or @code{memcpy} is an object of class type, and when writing
3139 into such an object might bypass the class non-trivial or deleted constructor
3140 or copy assignment, violate const-correctness or encapsulation, or corrupt
3141 virtual table pointers. Modifying the representation of such objects may
3142 violate invariants maintained by member functions of the class. For example,
3143 the call to @code{memset} below is undefined because it modifies a non-trivial
3144 class object and is, therefore, diagnosed. The safe way to either initialize
3145 or clear the storage of objects of such types is by using the appropriate
3146 constructor or assignment operator, if one is available.
3147 @smallexample
3148 std::string str = "abc";
3149 memset (&str, 0, sizeof str);
3150 @end smallexample
3151 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3152 Explicitly casting the pointer to the class object to @code{void *} or
3153 to a type that can be safely accessed by the raw memory function suppresses
3154 the warning.
3155
3156 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3157 @opindex Wnon-virtual-dtor
3158 @opindex Wno-non-virtual-dtor
3159 Warn when a class has virtual functions and an accessible non-virtual
3160 destructor itself or in an accessible polymorphic base class, in which
3161 case it is possible but unsafe to delete an instance of a derived
3162 class through a pointer to the class itself or base class. This
3163 warning is automatically enabled if @option{-Weffc++} is specified.
3164
3165 @item -Wregister @r{(C++ and Objective-C++ only)}
3166 @opindex Wregister
3167 @opindex Wno-register
3168 Warn on uses of the @code{register} storage class specifier, except
3169 when it is part of the GNU @ref{Explicit Register Variables} extension.
3170 The use of the @code{register} keyword as storage class specifier has
3171 been deprecated in C++11 and removed in C++17.
3172 Enabled by default with @option{-std=c++17}.
3173
3174 @item -Wreorder @r{(C++ and Objective-C++ only)}
3175 @opindex Wreorder
3176 @opindex Wno-reorder
3177 @cindex reordering, warning
3178 @cindex warning for reordering of member initializers
3179 Warn when the order of member initializers given in the code does not
3180 match the order in which they must be executed. For instance:
3181
3182 @smallexample
3183 struct A @{
3184 int i;
3185 int j;
3186 A(): j (0), i (1) @{ @}
3187 @};
3188 @end smallexample
3189
3190 @noindent
3191 The compiler rearranges the member initializers for @code{i}
3192 and @code{j} to match the declaration order of the members, emitting
3193 a warning to that effect. This warning is enabled by @option{-Wall}.
3194
3195 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3196 @opindex Wpessimizing-move
3197 @opindex Wno-pessimizing-move
3198 This warning warns when a call to @code{std::move} prevents copy
3199 elision. A typical scenario when copy elision can occur is when returning in
3200 a function with a class return type, when the expression being returned is the
3201 name of a non-volatile automatic object, and is not a function parameter, and
3202 has the same type as the function return type.
3203
3204 @smallexample
3205 struct T @{
3206 @dots{}
3207 @};
3208 T fn()
3209 @{
3210 T t;
3211 @dots{}
3212 return std::move (t);
3213 @}
3214 @end smallexample
3215
3216 But in this example, the @code{std::move} call prevents copy elision.
3217
3218 This warning is enabled by @option{-Wall}.
3219
3220 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3221 @opindex Wredundant-move
3222 @opindex Wno-redundant-move
3223 This warning warns about redundant calls to @code{std::move}; that is, when
3224 a move operation would have been performed even without the @code{std::move}
3225 call. This happens because the compiler is forced to treat the object as if
3226 it were an rvalue in certain situations such as returning a local variable,
3227 where copy elision isn't applicable. Consider:
3228
3229 @smallexample
3230 struct T @{
3231 @dots{}
3232 @};
3233 T fn(T t)
3234 @{
3235 @dots{}
3236 return std::move (t);
3237 @}
3238 @end smallexample
3239
3240 Here, the @code{std::move} call is redundant. Because G++ implements Core
3241 Issue 1579, another example is:
3242
3243 @smallexample
3244 struct T @{ // convertible to U
3245 @dots{}
3246 @};
3247 struct U @{
3248 @dots{}
3249 @};
3250 U fn()
3251 @{
3252 T t;
3253 @dots{}
3254 return std::move (t);
3255 @}
3256 @end smallexample
3257 In this example, copy elision isn't applicable because the type of the
3258 expression being returned and the function return type differ, yet G++
3259 treats the return value as if it were designated by an rvalue.
3260
3261 This warning is enabled by @option{-Wextra}.
3262
3263 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3264 @opindex Wredundant-tags
3265 @opindex Wno-redundant-tags
3266 Warn about redundant class-key and enum-key in references to class types
3267 and enumerated types in contexts where the key can be eliminated without
3268 causing an ambiguity. For example:
3269
3270 @smallexample
3271 struct foo;
3272 struct foo *p; // warn that keyword struct can be eliminated
3273 @end smallexample
3274
3275 @noindent
3276 On the other hand, in this example there is no warning:
3277
3278 @smallexample
3279 struct foo;
3280 void foo (); // "hides" struct foo
3281 void bar (struct foo&); // no warning, keyword struct is necessary
3282 @end smallexample
3283
3284 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3285 @opindex Wsubobject-linkage
3286 @opindex Wno-subobject-linkage
3287 Do not warn
3288 if a class type has a base or a field whose type uses the anonymous
3289 namespace or depends on a type with no linkage. If a type A depends on
3290 a type B with no or internal linkage, defining it in multiple
3291 translation units would be an ODR violation because the meaning of B
3292 is different in each translation unit. If A only appears in a single
3293 translation unit, the best way to silence the warning is to give it
3294 internal linkage by putting it in an anonymous namespace as well. The
3295 compiler doesn't give this warning for types defined in the main .C
3296 file, as those are unlikely to have multiple definitions.
3297 @option{-Wsubobject-linkage} is enabled by default.
3298
3299 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3300 @opindex Weffc++
3301 @opindex Wno-effc++
3302 Warn about violations of the following style guidelines from Scott Meyers'
3303 @cite{Effective C++} series of books:
3304
3305 @itemize @bullet
3306 @item
3307 Define a copy constructor and an assignment operator for classes
3308 with dynamically-allocated memory.
3309
3310 @item
3311 Prefer initialization to assignment in constructors.
3312
3313 @item
3314 Have @code{operator=} return a reference to @code{*this}.
3315
3316 @item
3317 Don't try to return a reference when you must return an object.
3318
3319 @item
3320 Distinguish between prefix and postfix forms of increment and
3321 decrement operators.
3322
3323 @item
3324 Never overload @code{&&}, @code{||}, or @code{,}.
3325
3326 @end itemize
3327
3328 This option also enables @option{-Wnon-virtual-dtor}, which is also
3329 one of the effective C++ recommendations. However, the check is
3330 extended to warn about the lack of virtual destructor in accessible
3331 non-polymorphic bases classes too.
3332
3333 When selecting this option, be aware that the standard library
3334 headers do not obey all of these guidelines; use @samp{grep -v}
3335 to filter out those warnings.
3336
3337 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3338 @opindex Wstrict-null-sentinel
3339 @opindex Wno-strict-null-sentinel
3340 Warn about the use of an uncasted @code{NULL} as sentinel. When
3341 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3342 to @code{__null}. Although it is a null pointer constant rather than a
3343 null pointer, it is guaranteed to be of the same size as a pointer.
3344 But this use is not portable across different compilers.
3345
3346 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3347 @opindex Wno-non-template-friend
3348 @opindex Wnon-template-friend
3349 Disable warnings when non-template friend functions are declared
3350 within a template. In very old versions of GCC that predate implementation
3351 of the ISO standard, declarations such as
3352 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3353 could be interpreted as a particular specialization of a template
3354 function; the warning exists to diagnose compatibility problems,
3355 and is enabled by default.
3356
3357 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3358 @opindex Wold-style-cast
3359 @opindex Wno-old-style-cast
3360 Warn if an old-style (C-style) cast to a non-void type is used within
3361 a C++ program. The new-style casts (@code{dynamic_cast},
3362 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3363 less vulnerable to unintended effects and much easier to search for.
3364
3365 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3366 @opindex Woverloaded-virtual
3367 @opindex Wno-overloaded-virtual
3368 @cindex overloaded virtual function, warning
3369 @cindex warning for overloaded virtual function
3370 Warn when a function declaration hides virtual functions from a
3371 base class. For example, in:
3372
3373 @smallexample
3374 struct A @{
3375 virtual void f();
3376 @};
3377
3378 struct B: public A @{
3379 void f(int);
3380 @};
3381 @end smallexample
3382
3383 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3384 like:
3385
3386 @smallexample
3387 B* b;
3388 b->f();
3389 @end smallexample
3390
3391 @noindent
3392 fails to compile.
3393
3394 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3395 @opindex Wno-pmf-conversions
3396 @opindex Wpmf-conversions
3397 Disable the diagnostic for converting a bound pointer to member function
3398 to a plain pointer.
3399
3400 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3401 @opindex Wsign-promo
3402 @opindex Wno-sign-promo
3403 Warn when overload resolution chooses a promotion from unsigned or
3404 enumerated type to a signed type, over a conversion to an unsigned type of
3405 the same size. Previous versions of G++ tried to preserve
3406 unsignedness, but the standard mandates the current behavior.
3407
3408 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3409 @opindex Wtemplates
3410 @opindex Wno-templates
3411 Warn when a primary template declaration is encountered. Some coding
3412 rules disallow templates, and this may be used to enforce that rule.
3413 The warning is inactive inside a system header file, such as the STL, so
3414 one can still use the STL. One may also instantiate or specialize
3415 templates.
3416
3417 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3418 @opindex Wmismatched-tags
3419 @opindex Wno-mismatched-tags
3420 Warn for declarations of structs, classes, and class templates and their
3421 specializations with a class-key that does not match either the definition
3422 or the first declaration if no definition is provided.
3423
3424 For example, the declaration of @code{struct Object} in the argument list
3425 of @code{draw} triggers the warning. To avoid it, either remove the redundant
3426 class-key @code{struct} or replace it with @code{class} to match its definition.
3427 @smallexample
3428 class Object @{
3429 public:
3430 virtual ~Object () = 0;
3431 @};
3432 void draw (struct Object*);
3433 @end smallexample
3434
3435 It is not wrong to declare a class with the class-key @code{struct} as
3436 the example above shows. The @option{-Wmismatched-tags} option is intended
3437 to help achieve a consistent style of class declarations. In code that is
3438 intended to be portable to Windows-based compilers the warning helps prevent
3439 unresolved references due to the difference in the mangling of symbols
3440 declared with different class-keys. The option can be used either on its
3441 own or in conjunction with @option{-Wredundant-tags}.
3442
3443 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3444 @opindex Wmultiple-inheritance
3445 @opindex Wno-multiple-inheritance
3446 Warn when a class is defined with multiple direct base classes. Some
3447 coding rules disallow multiple inheritance, and this may be used to
3448 enforce that rule. The warning is inactive inside a system header file,
3449 such as the STL, so one can still use the STL. One may also define
3450 classes that indirectly use multiple inheritance.
3451
3452 @item -Wvirtual-inheritance
3453 @opindex Wvirtual-inheritance
3454 @opindex Wno-virtual-inheritance
3455 Warn when a class is defined with a virtual direct base class. Some
3456 coding rules disallow multiple inheritance, and this may be used to
3457 enforce that rule. The warning is inactive inside a system header file,
3458 such as the STL, so one can still use the STL. One may also define
3459 classes that indirectly use virtual inheritance.
3460
3461 @item -Wno-virtual-move-assign
3462 @opindex Wvirtual-move-assign
3463 @opindex Wno-virtual-move-assign
3464 Suppress warnings about inheriting from a virtual base with a
3465 non-trivial C++11 move assignment operator. This is dangerous because
3466 if the virtual base is reachable along more than one path, it is
3467 moved multiple times, which can mean both objects end up in the
3468 moved-from state. If the move assignment operator is written to avoid
3469 moving from a moved-from object, this warning can be disabled.
3470
3471 @item -Wnamespaces
3472 @opindex Wnamespaces
3473 @opindex Wno-namespaces
3474 Warn when a namespace definition is opened. Some coding rules disallow
3475 namespaces, and this may be used to enforce that rule. The warning is
3476 inactive inside a system header file, such as the STL, so one can still
3477 use the STL. One may also use using directives and qualified names.
3478
3479 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3480 @opindex Wterminate
3481 @opindex Wno-terminate
3482 Disable the warning about a throw-expression that will immediately
3483 result in a call to @code{terminate}.
3484
3485 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3486 @opindex Wno-class-conversion
3487 @opindex Wclass-conversion
3488 Do not warn when a conversion function converts an
3489 object to the same type, to a base class of that type, or to void; such
3490 a conversion function will never be called.
3491
3492 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3493 @opindex Wvolatile
3494 @opindex Wno-volatile
3495 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3496 postfix and prefix @code{++} and @code{--} expressions of
3497 @code{volatile}-qualified types, using simple assignments where the left
3498 operand is a @code{volatile}-qualified non-class type for their value,
3499 compound assignments where the left operand is a @code{volatile}-qualified
3500 non-class type, @code{volatile}-qualified function return type,
3501 @code{volatile}-qualified parameter type, and structured bindings of a
3502 @code{volatile}-qualified type. This usage was deprecated in C++20.
3503
3504 Enabled by default with @option{-std=c++2a}.
3505
3506 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
3507 @opindex Wzero-as-null-pointer-constant
3508 @opindex Wno-zero-as-null-pointer-constant
3509 Warn when a literal @samp{0} is used as null pointer constant. This can
3510 be useful to facilitate the conversion to @code{nullptr} in C++11.
3511
3512 @item -Waligned-new
3513 @opindex Waligned-new
3514 @opindex Wno-aligned-new
3515 Warn about a new-expression of a type that requires greater alignment
3516 than the @code{alignof(std::max_align_t)} but uses an allocation
3517 function without an explicit alignment parameter. This option is
3518 enabled by @option{-Wall}.
3519
3520 Normally this only warns about global allocation functions, but
3521 @option{-Waligned-new=all} also warns about class member allocation
3522 functions.
3523
3524 @item -Wno-placement-new
3525 @itemx -Wplacement-new=@var{n}
3526 @opindex Wplacement-new
3527 @opindex Wno-placement-new
3528 Warn about placement new expressions with undefined behavior, such as
3529 constructing an object in a buffer that is smaller than the type of
3530 the object. For example, the placement new expression below is diagnosed
3531 because it attempts to construct an array of 64 integers in a buffer only
3532 64 bytes large.
3533 @smallexample
3534 char buf [64];
3535 new (buf) int[64];
3536 @end smallexample
3537 This warning is enabled by default.
3538
3539 @table @gcctabopt
3540 @item -Wplacement-new=1
3541 This is the default warning level of @option{-Wplacement-new}. At this
3542 level the warning is not issued for some strictly undefined constructs that
3543 GCC allows as extensions for compatibility with legacy code. For example,
3544 the following @code{new} expression is not diagnosed at this level even
3545 though it has undefined behavior according to the C++ standard because
3546 it writes past the end of the one-element array.
3547 @smallexample
3548 struct S @{ int n, a[1]; @};
3549 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3550 new (s->a)int [32]();
3551 @end smallexample
3552
3553 @item -Wplacement-new=2
3554 At this level, in addition to diagnosing all the same constructs as at level
3555 1, a diagnostic is also issued for placement new expressions that construct
3556 an object in the last member of structure whose type is an array of a single
3557 element and whose size is less than the size of the object being constructed.
3558 While the previous example would be diagnosed, the following construct makes
3559 use of the flexible member array extension to avoid the warning at level 2.
3560 @smallexample
3561 struct S @{ int n, a[]; @};
3562 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3563 new (s->a)int [32]();
3564 @end smallexample
3565
3566 @end table
3567
3568 @item -Wcatch-value
3569 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
3570 @opindex Wcatch-value
3571 @opindex Wno-catch-value
3572 Warn about catch handlers that do not catch via reference.
3573 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
3574 warn about polymorphic class types that are caught by value.
3575 With @option{-Wcatch-value=2} warn about all class types that are caught
3576 by value. With @option{-Wcatch-value=3} warn about all types that are
3577 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
3578
3579 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
3580 @opindex Wconditionally-supported
3581 @opindex Wno-conditionally-supported
3582 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3583
3584 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
3585 @opindex Wdelete-incomplete
3586 @opindex Wno-delete-incomplete
3587 Do not warn when deleting a pointer to incomplete type, which may cause
3588 undefined behavior at runtime. This warning is enabled by default.
3589
3590 @item -Wextra-semi @r{(C++, Objective-C++ only)}
3591 @opindex Wextra-semi
3592 @opindex Wno-extra-semi
3593 Warn about redundant semicolons after in-class function definitions.
3594
3595 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
3596 @opindex Winaccessible-base
3597 @opindex Wno-inaccessible-base
3598 This option controls warnings
3599 when a base class is inaccessible in a class derived from it due to
3600 ambiguity. The warning is enabled by default.
3601 Note that the warning for ambiguous virtual
3602 bases is enabled by the @option{-Wextra} option.
3603 @smallexample
3604 @group
3605 struct A @{ int a; @};
3606
3607 struct B : A @{ @};
3608
3609 struct C : B, A @{ @};
3610 @end group
3611 @end smallexample
3612
3613 @item -Wno-inherited-variadic-ctor
3614 @opindex Winherited-variadic-ctor
3615 @opindex Wno-inherited-variadic-ctor
3616 Suppress warnings about use of C++11 inheriting constructors when the
3617 base class inherited from has a C variadic constructor; the warning is
3618 on by default because the ellipsis is not inherited.
3619
3620 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
3621 @opindex Wno-invalid-offsetof
3622 @opindex Winvalid-offsetof
3623 Suppress warnings from applying the @code{offsetof} macro to a non-POD
3624 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
3625 to a non-standard-layout type is undefined. In existing C++ implementations,
3626 however, @code{offsetof} typically gives meaningful results.
3627 This flag is for users who are aware that they are
3628 writing nonportable code and who have deliberately chosen to ignore the
3629 warning about it.
3630
3631 The restrictions on @code{offsetof} may be relaxed in a future version
3632 of the C++ standard.
3633
3634 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
3635 @opindex Wsized-deallocation
3636 @opindex Wno-sized-deallocation
3637 Warn about a definition of an unsized deallocation function
3638 @smallexample
3639 void operator delete (void *) noexcept;
3640 void operator delete[] (void *) noexcept;
3641 @end smallexample
3642 without a definition of the corresponding sized deallocation function
3643 @smallexample
3644 void operator delete (void *, std::size_t) noexcept;
3645 void operator delete[] (void *, std::size_t) noexcept;
3646 @end smallexample
3647 or vice versa. Enabled by @option{-Wextra} along with
3648 @option{-fsized-deallocation}.
3649
3650 @item -Wsuggest-final-types
3651 @opindex Wno-suggest-final-types
3652 @opindex Wsuggest-final-types
3653 Warn about types with virtual methods where code quality would be improved
3654 if the type were declared with the C++11 @code{final} specifier,
3655 or, if possible,
3656 declared in an anonymous namespace. This allows GCC to more aggressively
3657 devirtualize the polymorphic calls. This warning is more effective with
3658 link-time optimization,
3659 where the information about the class hierarchy graph is
3660 more complete.
3661
3662 @item -Wsuggest-final-methods
3663 @opindex Wno-suggest-final-methods
3664 @opindex Wsuggest-final-methods
3665 Warn about virtual methods where code quality would be improved if the method
3666 were declared with the C++11 @code{final} specifier,
3667 or, if possible, its type were
3668 declared in an anonymous namespace or with the @code{final} specifier.
3669 This warning is
3670 more effective with link-time optimization, where the information about the
3671 class hierarchy graph is more complete. It is recommended to first consider
3672 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
3673 annotations.
3674
3675 @item -Wsuggest-override
3676 @opindex Wsuggest-override
3677 @opindex Wno-suggest-override
3678 Warn about overriding virtual functions that are not marked with the
3679 @code{override} keyword.
3680
3681 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
3682 @opindex Wuseless-cast
3683 @opindex Wno-useless-cast
3684 Warn when an expression is casted to its own type.
3685
3686 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
3687 @opindex Wconversion-null
3688 @opindex Wno-conversion-null
3689 Do not warn for conversions between @code{NULL} and non-pointer
3690 types. @option{-Wconversion-null} is enabled by default.
3691
3692 @end table
3693
3694 @node Objective-C and Objective-C++ Dialect Options
3695 @section Options Controlling Objective-C and Objective-C++ Dialects
3696
3697 @cindex compiler options, Objective-C and Objective-C++
3698 @cindex Objective-C and Objective-C++ options, command-line
3699 @cindex options, Objective-C and Objective-C++
3700 (NOTE: This manual does not describe the Objective-C and Objective-C++
3701 languages themselves. @xref{Standards,,Language Standards
3702 Supported by GCC}, for references.)
3703
3704 This section describes the command-line options that are only meaningful
3705 for Objective-C and Objective-C++ programs. You can also use most of
3706 the language-independent GNU compiler options.
3707 For example, you might compile a file @file{some_class.m} like this:
3708
3709 @smallexample
3710 gcc -g -fgnu-runtime -O -c some_class.m
3711 @end smallexample
3712
3713 @noindent
3714 In this example, @option{-fgnu-runtime} is an option meant only for
3715 Objective-C and Objective-C++ programs; you can use the other options with
3716 any language supported by GCC@.
3717
3718 Note that since Objective-C is an extension of the C language, Objective-C
3719 compilations may also use options specific to the C front-end (e.g.,
3720 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3721 C++-specific options (e.g., @option{-Wabi}).
3722
3723 Here is a list of options that are @emph{only} for compiling Objective-C
3724 and Objective-C++ programs:
3725
3726 @table @gcctabopt
3727 @item -fconstant-string-class=@var{class-name}
3728 @opindex fconstant-string-class
3729 Use @var{class-name} as the name of the class to instantiate for each
3730 literal string specified with the syntax @code{@@"@dots{}"}. The default
3731 class name is @code{NXConstantString} if the GNU runtime is being used, and
3732 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3733 @option{-fconstant-cfstrings} option, if also present, overrides the
3734 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3735 to be laid out as constant CoreFoundation strings.
3736
3737 @item -fgnu-runtime
3738 @opindex fgnu-runtime
3739 Generate object code compatible with the standard GNU Objective-C
3740 runtime. This is the default for most types of systems.
3741
3742 @item -fnext-runtime
3743 @opindex fnext-runtime
3744 Generate output compatible with the NeXT runtime. This is the default
3745 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3746 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3747 used.
3748
3749 @item -fno-nil-receivers
3750 @opindex fno-nil-receivers
3751 @opindex fnil-receivers
3752 Assume that all Objective-C message dispatches (@code{[receiver
3753 message:arg]}) in this translation unit ensure that the receiver is
3754 not @code{nil}. This allows for more efficient entry points in the
3755 runtime to be used. This option is only available in conjunction with
3756 the NeXT runtime and ABI version 0 or 1.
3757
3758 @item -fobjc-abi-version=@var{n}
3759 @opindex fobjc-abi-version
3760 Use version @var{n} of the Objective-C ABI for the selected runtime.
3761 This option is currently supported only for the NeXT runtime. In that
3762 case, Version 0 is the traditional (32-bit) ABI without support for
3763 properties and other Objective-C 2.0 additions. Version 1 is the
3764 traditional (32-bit) ABI with support for properties and other
3765 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3766 nothing is specified, the default is Version 0 on 32-bit target
3767 machines, and Version 2 on 64-bit target machines.
3768
3769 @item -fobjc-call-cxx-cdtors
3770 @opindex fobjc-call-cxx-cdtors
3771 For each Objective-C class, check if any of its instance variables is a
3772 C++ object with a non-trivial default constructor. If so, synthesize a
3773 special @code{- (id) .cxx_construct} instance method which runs
3774 non-trivial default constructors on any such instance variables, in order,
3775 and then return @code{self}. Similarly, check if any instance variable
3776 is a C++ object with a non-trivial destructor, and if so, synthesize a
3777 special @code{- (void) .cxx_destruct} method which runs
3778 all such default destructors, in reverse order.
3779
3780 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3781 methods thusly generated only operate on instance variables
3782 declared in the current Objective-C class, and not those inherited
3783 from superclasses. It is the responsibility of the Objective-C
3784 runtime to invoke all such methods in an object's inheritance
3785 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3786 by the runtime immediately after a new object instance is allocated;
3787 the @code{- (void) .cxx_destruct} methods are invoked immediately
3788 before the runtime deallocates an object instance.
3789
3790 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3791 support for invoking the @code{- (id) .cxx_construct} and
3792 @code{- (void) .cxx_destruct} methods.
3793
3794 @item -fobjc-direct-dispatch
3795 @opindex fobjc-direct-dispatch
3796 Allow fast jumps to the message dispatcher. On Darwin this is
3797 accomplished via the comm page.
3798
3799 @item -fobjc-exceptions
3800 @opindex fobjc-exceptions
3801 Enable syntactic support for structured exception handling in
3802 Objective-C, similar to what is offered by C++. This option
3803 is required to use the Objective-C keywords @code{@@try},
3804 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3805 @code{@@synchronized}. This option is available with both the GNU
3806 runtime and the NeXT runtime (but not available in conjunction with
3807 the NeXT runtime on Mac OS X 10.2 and earlier).
3808
3809 @item -fobjc-gc
3810 @opindex fobjc-gc
3811 Enable garbage collection (GC) in Objective-C and Objective-C++
3812 programs. This option is only available with the NeXT runtime; the
3813 GNU runtime has a different garbage collection implementation that
3814 does not require special compiler flags.
3815
3816 @item -fobjc-nilcheck
3817 @opindex fobjc-nilcheck
3818 For the NeXT runtime with version 2 of the ABI, check for a nil
3819 receiver in method invocations before doing the actual method call.
3820 This is the default and can be disabled using
3821 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3822 checked for nil in this way no matter what this flag is set to.
3823 Currently this flag does nothing when the GNU runtime, or an older
3824 version of the NeXT runtime ABI, is used.
3825
3826 @item -fobjc-std=objc1
3827 @opindex fobjc-std
3828 Conform to the language syntax of Objective-C 1.0, the language
3829 recognized by GCC 4.0. This only affects the Objective-C additions to
3830 the C/C++ language; it does not affect conformance to C/C++ standards,
3831 which is controlled by the separate C/C++ dialect option flags. When
3832 this option is used with the Objective-C or Objective-C++ compiler,
3833 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3834 This is useful if you need to make sure that your Objective-C code can
3835 be compiled with older versions of GCC@.
3836
3837 @item -freplace-objc-classes
3838 @opindex freplace-objc-classes
3839 Emit a special marker instructing @command{ld(1)} not to statically link in
3840 the resulting object file, and allow @command{dyld(1)} to load it in at
3841 run time instead. This is used in conjunction with the Fix-and-Continue
3842 debugging mode, where the object file in question may be recompiled and
3843 dynamically reloaded in the course of program execution, without the need
3844 to restart the program itself. Currently, Fix-and-Continue functionality
3845 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3846 and later.
3847
3848 @item -fzero-link
3849 @opindex fzero-link
3850 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3851 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3852 compile time) with static class references that get initialized at load time,
3853 which improves run-time performance. Specifying the @option{-fzero-link} flag
3854 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3855 to be retained. This is useful in Zero-Link debugging mode, since it allows
3856 for individual class implementations to be modified during program execution.
3857 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3858 regardless of command-line options.
3859
3860 @item -fno-local-ivars
3861 @opindex fno-local-ivars
3862 @opindex flocal-ivars
3863 By default instance variables in Objective-C can be accessed as if
3864 they were local variables from within the methods of the class they're
3865 declared in. This can lead to shadowing between instance variables
3866 and other variables declared either locally inside a class method or
3867 globally with the same name. Specifying the @option{-fno-local-ivars}
3868 flag disables this behavior thus avoiding variable shadowing issues.
3869
3870 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3871 @opindex fivar-visibility
3872 Set the default instance variable visibility to the specified option
3873 so that instance variables declared outside the scope of any access
3874 modifier directives default to the specified visibility.
3875
3876 @item -gen-decls
3877 @opindex gen-decls
3878 Dump interface declarations for all classes seen in the source file to a
3879 file named @file{@var{sourcename}.decl}.
3880
3881 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3882 @opindex Wassign-intercept
3883 @opindex Wno-assign-intercept
3884 Warn whenever an Objective-C assignment is being intercepted by the
3885 garbage collector.
3886
3887 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
3888 @opindex Wproperty-assign-default
3889 @opindex Wno-property-assign-default
3890 Do not warn if a property for an Objective-C object has no assign
3891 semantics specified.
3892
3893 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3894 @opindex Wno-protocol
3895 @opindex Wprotocol
3896 If a class is declared to implement a protocol, a warning is issued for
3897 every method in the protocol that is not implemented by the class. The
3898 default behavior is to issue a warning for every method not explicitly
3899 implemented in the class, even if a method implementation is inherited
3900 from the superclass. If you use the @option{-Wno-protocol} option, then
3901 methods inherited from the superclass are considered to be implemented,
3902 and no warning is issued for them.
3903
3904 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3905 @opindex Wselector
3906 @opindex Wno-selector
3907 Warn if multiple methods of different types for the same selector are
3908 found during compilation. The check is performed on the list of methods
3909 in the final stage of compilation. Additionally, a check is performed
3910 for each selector appearing in a @code{@@selector(@dots{})}
3911 expression, and a corresponding method for that selector has been found
3912 during compilation. Because these checks scan the method table only at
3913 the end of compilation, these warnings are not produced if the final
3914 stage of compilation is not reached, for example because an error is
3915 found during compilation, or because the @option{-fsyntax-only} option is
3916 being used.
3917
3918 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3919 @opindex Wstrict-selector-match
3920 @opindex Wno-strict-selector-match
3921 Warn if multiple methods with differing argument and/or return types are
3922 found for a given selector when attempting to send a message using this
3923 selector to a receiver of type @code{id} or @code{Class}. When this flag
3924 is off (which is the default behavior), the compiler omits such warnings
3925 if any differences found are confined to types that share the same size
3926 and alignment.
3927
3928 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3929 @opindex Wundeclared-selector
3930 @opindex Wno-undeclared-selector
3931 Warn if a @code{@@selector(@dots{})} expression referring to an
3932 undeclared selector is found. A selector is considered undeclared if no
3933 method with that name has been declared before the
3934 @code{@@selector(@dots{})} expression, either explicitly in an
3935 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3936 an @code{@@implementation} section. This option always performs its
3937 checks as soon as a @code{@@selector(@dots{})} expression is found,
3938 while @option{-Wselector} only performs its checks in the final stage of
3939 compilation. This also enforces the coding style convention
3940 that methods and selectors must be declared before being used.
3941
3942 @item -print-objc-runtime-info
3943 @opindex print-objc-runtime-info
3944 Generate C header describing the largest structure that is passed by
3945 value, if any.
3946
3947 @end table
3948
3949 @node Diagnostic Message Formatting Options
3950 @section Options to Control Diagnostic Messages Formatting
3951 @cindex options to control diagnostics formatting
3952 @cindex diagnostic messages
3953 @cindex message formatting
3954
3955 Traditionally, diagnostic messages have been formatted irrespective of
3956 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3957 options described below
3958 to control the formatting algorithm for diagnostic messages,
3959 e.g.@: how many characters per line, how often source location
3960 information should be reported. Note that some language front ends may not
3961 honor these options.
3962
3963 @table @gcctabopt
3964 @item -fmessage-length=@var{n}
3965 @opindex fmessage-length
3966 Try to format error messages so that they fit on lines of about
3967 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3968 done; each error message appears on a single line. This is the
3969 default for all front ends.
3970
3971 Note - this option also affects the display of the @samp{#error} and
3972 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3973 function/type/variable attribute. It does not however affect the
3974 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3975
3976 @item -fdiagnostics-show-location=once
3977 @opindex fdiagnostics-show-location
3978 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3979 reporter to emit source location information @emph{once}; that is, in
3980 case the message is too long to fit on a single physical line and has to
3981 be wrapped, the source location won't be emitted (as prefix) again,
3982 over and over, in subsequent continuation lines. This is the default
3983 behavior.
3984
3985 @item -fdiagnostics-show-location=every-line
3986 Only meaningful in line-wrapping mode. Instructs the diagnostic
3987 messages reporter to emit the same source location information (as
3988 prefix) for physical lines that result from the process of breaking
3989 a message which is too long to fit on a single line.
3990
3991 @item -fdiagnostics-color[=@var{WHEN}]
3992 @itemx -fno-diagnostics-color
3993 @opindex fdiagnostics-color
3994 @cindex highlight, color
3995 @vindex GCC_COLORS @r{environment variable}
3996 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3997 or @samp{auto}. The default depends on how the compiler has been configured,
3998 it can be any of the above @var{WHEN} options or also @samp{never}
3999 if @env{GCC_COLORS} environment variable isn't present in the environment,
4000 and @samp{auto} otherwise.
4001 @samp{auto} makes GCC use color only when the standard error is a terminal,
4002 and when not executing in an emacs shell.
4003 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4004 aliases for @option{-fdiagnostics-color=always} and
4005 @option{-fdiagnostics-color=never}, respectively.
4006
4007 The colors are defined by the environment variable @env{GCC_COLORS}.
4008 Its value is a colon-separated list of capabilities and Select Graphic
4009 Rendition (SGR) substrings. SGR commands are interpreted by the
4010 terminal or terminal emulator. (See the section in the documentation
4011 of your text terminal for permitted values and their meanings as
4012 character attributes.) These substring values are integers in decimal
4013 representation and can be concatenated with semicolons.
4014 Common values to concatenate include
4015 @samp{1} for bold,
4016 @samp{4} for underline,
4017 @samp{5} for blink,
4018 @samp{7} for inverse,
4019 @samp{39} for default foreground color,
4020 @samp{30} to @samp{37} for foreground colors,
4021 @samp{90} to @samp{97} for 16-color mode foreground colors,
4022 @samp{38;5;0} to @samp{38;5;255}
4023 for 88-color and 256-color modes foreground colors,
4024 @samp{49} for default background color,
4025 @samp{40} to @samp{47} for background colors,
4026 @samp{100} to @samp{107} for 16-color mode background colors,
4027 and @samp{48;5;0} to @samp{48;5;255}
4028 for 88-color and 256-color modes background colors.
4029
4030 The default @env{GCC_COLORS} is
4031 @smallexample
4032 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4033 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4034 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4035 type-diff=01;32
4036 @end smallexample
4037 @noindent
4038 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4039 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4040 @samp{01} is bold, and @samp{31} is red.
4041 Setting @env{GCC_COLORS} to the empty string disables colors.
4042 Supported capabilities are as follows.
4043
4044 @table @code
4045 @item error=
4046 @vindex error GCC_COLORS @r{capability}
4047 SGR substring for error: markers.
4048
4049 @item warning=
4050 @vindex warning GCC_COLORS @r{capability}
4051 SGR substring for warning: markers.
4052
4053 @item note=
4054 @vindex note GCC_COLORS @r{capability}
4055 SGR substring for note: markers.
4056
4057 @item path=
4058 @vindex path GCC_COLORS @r{capability}
4059 SGR substring for colorizing paths of control-flow events as printed
4060 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4061 individual events and lines indicating interprocedural calls and returns.
4062
4063 @item range1=
4064 @vindex range1 GCC_COLORS @r{capability}
4065 SGR substring for first additional range.
4066
4067 @item range2=
4068 @vindex range2 GCC_COLORS @r{capability}
4069 SGR substring for second additional range.
4070
4071 @item locus=
4072 @vindex locus GCC_COLORS @r{capability}
4073 SGR substring for location information, @samp{file:line} or
4074 @samp{file:line:column} etc.
4075
4076 @item quote=
4077 @vindex quote GCC_COLORS @r{capability}
4078 SGR substring for information printed within quotes.
4079
4080 @item fixit-insert=
4081 @vindex fixit-insert GCC_COLORS @r{capability}
4082 SGR substring for fix-it hints suggesting text to
4083 be inserted or replaced.
4084
4085 @item fixit-delete=
4086 @vindex fixit-delete GCC_COLORS @r{capability}
4087 SGR substring for fix-it hints suggesting text to
4088 be deleted.
4089
4090 @item diff-filename=
4091 @vindex diff-filename GCC_COLORS @r{capability}
4092 SGR substring for filename headers within generated patches.
4093
4094 @item diff-hunk=
4095 @vindex diff-hunk GCC_COLORS @r{capability}
4096 SGR substring for the starts of hunks within generated patches.
4097
4098 @item diff-delete=
4099 @vindex diff-delete GCC_COLORS @r{capability}
4100 SGR substring for deleted lines within generated patches.
4101
4102 @item diff-insert=
4103 @vindex diff-insert GCC_COLORS @r{capability}
4104 SGR substring for inserted lines within generated patches.
4105
4106 @item type-diff=
4107 @vindex type-diff GCC_COLORS @r{capability}
4108 SGR substring for highlighting mismatching types within template
4109 arguments in the C++ frontend.
4110 @end table
4111
4112 @item -fdiagnostics-urls[=@var{WHEN}]
4113 @opindex fdiagnostics-urls
4114 @cindex urls
4115 @vindex GCC_URLS @r{environment variable}
4116 @vindex TERM_URLS @r{environment variable}
4117 Use escape sequences to embed URLs in diagnostics. For example, when
4118 @option{-fdiagnostics-show-option} emits text showing the command-line
4119 option controlling a diagnostic, embed a URL for documentation of that
4120 option.
4121
4122 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4123 @samp{auto} makes GCC use URL escape sequences only when the standard error
4124 is a terminal, and when not executing in an emacs shell or any graphical
4125 terminal which is known to be incompatible with this feature, see below.
4126
4127 The default depends on how the compiler has been configured.
4128 It can be any of the above @var{WHEN} options.
4129
4130 GCC can also be configured (via the
4131 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4132 so that the default is affected by environment variables.
4133 Under such a configuration, GCC defaults to using @samp{auto}
4134 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4135 present and non-empty in the environment of the compiler, or @samp{never}
4136 if neither are.
4137
4138 However, even with @option{-fdiagnostics-urls=always} the behavior is
4139 dependent on those environment variables:
4140 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4141 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4142 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4143 Any other non-empty value enables the feature.
4144 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4145 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4146 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4147
4148 At this time GCC tries to detect also a few terminals that are known to
4149 not implement the URL feature, and have bugs or at least had bugs in
4150 some versions that are still in use, where the URL escapes are likely
4151 to misbehave, i.e. print garbage on the screen.
4152 That list is currently xfce4-terminal, certain known to be buggy
4153 gnome-terminal versions, the linux console, and mingw.
4154 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4155
4156 @item -fno-diagnostics-show-option
4157 @opindex fno-diagnostics-show-option
4158 @opindex fdiagnostics-show-option
4159 By default, each diagnostic emitted includes text indicating the
4160 command-line option that directly controls the diagnostic (if such an
4161 option is known to the diagnostic machinery). Specifying the
4162 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4163
4164 @item -fno-diagnostics-show-caret
4165 @opindex fno-diagnostics-show-caret
4166 @opindex fdiagnostics-show-caret
4167 By default, each diagnostic emitted includes the original source line
4168 and a caret @samp{^} indicating the column. This option suppresses this
4169 information. The source line is truncated to @var{n} characters, if
4170 the @option{-fmessage-length=n} option is given. When the output is done
4171 to the terminal, the width is limited to the width given by the
4172 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4173
4174 @item -fno-diagnostics-show-labels
4175 @opindex fno-diagnostics-show-labels
4176 @opindex fdiagnostics-show-labels
4177 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4178 diagnostics can label ranges of source code with pertinent information, such
4179 as the types of expressions:
4180
4181 @smallexample
4182 printf ("foo %s bar", long_i + long_j);
4183 ~^ ~~~~~~~~~~~~~~~
4184 | |
4185 char * long int
4186 @end smallexample
4187
4188 This option suppresses the printing of these labels (in the example above,
4189 the vertical bars and the ``char *'' and ``long int'' text).
4190
4191 @item -fno-diagnostics-show-cwe
4192 @opindex fno-diagnostics-show-cwe
4193 @opindex fdiagnostics-show-cwe
4194 Diagnostic messages can optionally have an associated
4195 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4196 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4197 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4198 By default, if this information is present, it will be printed with
4199 the diagnostic. This option suppresses the printing of this metadata.
4200
4201 @item -fno-diagnostics-show-line-numbers
4202 @opindex fno-diagnostics-show-line-numbers
4203 @opindex fdiagnostics-show-line-numbers
4204 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4205 a left margin is printed, showing line numbers. This option suppresses this
4206 left margin.
4207
4208 @item -fdiagnostics-minimum-margin-width=@var{width}
4209 @opindex fdiagnostics-minimum-margin-width
4210 This option controls the minimum width of the left margin printed by
4211 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4212
4213 @item -fdiagnostics-parseable-fixits
4214 @opindex fdiagnostics-parseable-fixits
4215 Emit fix-it hints in a machine-parseable format, suitable for consumption
4216 by IDEs. For each fix-it, a line will be printed after the relevant
4217 diagnostic, starting with the string ``fix-it:''. For example:
4218
4219 @smallexample
4220 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4221 @end smallexample
4222
4223 The location is expressed as a half-open range, expressed as a count of
4224 bytes, starting at byte 1 for the initial column. In the above example,
4225 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4226 given string:
4227
4228 @smallexample
4229 00000000011111111112222222222
4230 12345678901234567890123456789
4231 gtk_widget_showall (dlg);
4232 ^^^^^^^^^^^^^^^^^^
4233 gtk_widget_show_all
4234 @end smallexample
4235
4236 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4237 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4238 (e.g. vertical tab as ``\013'').
4239
4240 An empty replacement string indicates that the given range is to be removed.
4241 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4242 be inserted at the given position.
4243
4244 @item -fdiagnostics-generate-patch
4245 @opindex fdiagnostics-generate-patch
4246 Print fix-it hints to stderr in unified diff format, after any diagnostics
4247 are printed. For example:
4248
4249 @smallexample
4250 --- test.c
4251 +++ test.c
4252 @@ -42,5 +42,5 @@
4253
4254 void show_cb(GtkDialog *dlg)
4255 @{
4256 - gtk_widget_showall(dlg);
4257 + gtk_widget_show_all(dlg);
4258 @}
4259
4260 @end smallexample
4261
4262 The diff may or may not be colorized, following the same rules
4263 as for diagnostics (see @option{-fdiagnostics-color}).
4264
4265 @item -fdiagnostics-show-template-tree
4266 @opindex fdiagnostics-show-template-tree
4267
4268 In the C++ frontend, when printing diagnostics showing mismatching
4269 template types, such as:
4270
4271 @smallexample
4272 could not convert 'std::map<int, std::vector<double> >()'
4273 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4274 @end smallexample
4275
4276 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4277 tree-like structure showing the common and differing parts of the types,
4278 such as:
4279
4280 @smallexample
4281 map<
4282 [...],
4283 vector<
4284 [double != float]>>
4285 @end smallexample
4286
4287 The parts that differ are highlighted with color (``double'' and
4288 ``float'' in this case).
4289
4290 @item -fno-elide-type
4291 @opindex fno-elide-type
4292 @opindex felide-type
4293 By default when the C++ frontend prints diagnostics showing mismatching
4294 template types, common parts of the types are printed as ``[...]'' to
4295 simplify the error message. For example:
4296
4297 @smallexample
4298 could not convert 'std::map<int, std::vector<double> >()'
4299 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4300 @end smallexample
4301
4302 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4303 This flag also affects the output of the
4304 @option{-fdiagnostics-show-template-tree} flag.
4305
4306 @item -fdiagnostics-path-format=@var{KIND}
4307 @opindex fdiagnostics-path-format
4308 Specify how to print paths of control-flow events for diagnostics that
4309 have such a path associated with them.
4310
4311 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4312 the default.
4313
4314 @samp{none} means to not print diagnostic paths.
4315
4316 @samp{separate-events} means to print a separate ``note'' diagnostic for
4317 each event within the diagnostic. For example:
4318
4319 @smallexample
4320 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4321 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4322 test.c:27:3: note: (2) when 'i < count'
4323 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4324 @end smallexample
4325
4326 @samp{inline-events} means to print the events ``inline'' within the source
4327 code. This view attempts to consolidate the events into runs of
4328 sufficiently-close events, printing them as labelled ranges within the source.
4329
4330 For example, the same events as above might be printed as:
4331
4332 @smallexample
4333 'test': events 1-3
4334 |
4335 | 25 | list = PyList_New(0);
4336 | | ^~~~~~~~~~~~~
4337 | | |
4338 | | (1) when 'PyList_New' fails, returning NULL
4339 | 26 |
4340 | 27 | for (i = 0; i < count; i++) @{
4341 | | ~~~
4342 | | |
4343 | | (2) when 'i < count'
4344 | 28 | item = PyLong_FromLong(random());
4345 | 29 | PyList_Append(list, item);
4346 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4347 | | |
4348 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4349 |
4350 @end smallexample
4351
4352 Interprocedural control flow is shown by grouping the events by stack frame,
4353 and using indentation to show how stack frames are nested, pushed, and popped.
4354
4355 For example:
4356
4357 @smallexample
4358 'test': events 1-2
4359 |
4360 | 133 | @{
4361 | | ^
4362 | | |
4363 | | (1) entering 'test'
4364 | 134 | boxed_int *obj = make_boxed_int (i);
4365 | | ~~~~~~~~~~~~~~~~~~
4366 | | |
4367 | | (2) calling 'make_boxed_int'
4368 |
4369 +--> 'make_boxed_int': events 3-4
4370 |
4371 | 120 | @{
4372 | | ^
4373 | | |
4374 | | (3) entering 'make_boxed_int'
4375 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4376 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4377 | | |
4378 | | (4) calling 'wrapped_malloc'
4379 |
4380 +--> 'wrapped_malloc': events 5-6
4381 |
4382 | 7 | @{
4383 | | ^
4384 | | |
4385 | | (5) entering 'wrapped_malloc'
4386 | 8 | return malloc (size);
4387 | | ~~~~~~~~~~~~~
4388 | | |
4389 | | (6) calling 'malloc'
4390 |
4391 <-------------+
4392 |
4393 'test': event 7
4394 |
4395 | 138 | free_boxed_int (obj);
4396 | | ^~~~~~~~~~~~~~~~~~~~
4397 | | |
4398 | | (7) calling 'free_boxed_int'
4399 |
4400 (etc)
4401 @end smallexample
4402
4403 @item -fdiagnostics-show-path-depths
4404 @opindex fdiagnostics-show-path-depths
4405 This option provides additional information when printing control-flow paths
4406 associated with a diagnostic.
4407
4408 If this is option is provided then the stack depth will be printed for
4409 each run of events within @option{-fdiagnostics-path-format=separate-events}.
4410
4411 This is intended for use by GCC developers and plugin developers when
4412 debugging diagnostics that report interprocedural control flow.
4413
4414 @item -fno-show-column
4415 @opindex fno-show-column
4416 @opindex fshow-column
4417 Do not print column numbers in diagnostics. This may be necessary if
4418 diagnostics are being scanned by a program that does not understand the
4419 column numbers, such as @command{dejagnu}.
4420
4421 @item -fdiagnostics-format=@var{FORMAT}
4422 @opindex fdiagnostics-format
4423 Select a different format for printing diagnostics.
4424 @var{FORMAT} is @samp{text} or @samp{json}.
4425 The default is @samp{text}.
4426
4427 The @samp{json} format consists of a top-level JSON array containing JSON
4428 objects representing the diagnostics.
4429
4430 The JSON is emitted as one line, without formatting; the examples below
4431 have been formatted for clarity.
4432
4433 Diagnostics can have child diagnostics. For example, this error and note:
4434
4435 @smallexample
4436 misleading-indentation.c:15:3: warning: this 'if' clause does not
4437 guard... [-Wmisleading-indentation]
4438 15 | if (flag)
4439 | ^~
4440 misleading-indentation.c:17:5: note: ...this statement, but the latter
4441 is misleadingly indented as if it were guarded by the 'if'
4442 17 | y = 2;
4443 | ^
4444 @end smallexample
4445
4446 @noindent
4447 might be printed in JSON form (after formatting) like this:
4448
4449 @smallexample
4450 [
4451 @{
4452 "kind": "warning",
4453 "locations": [
4454 @{
4455 "caret": @{
4456 "column": 3,
4457 "file": "misleading-indentation.c",
4458 "line": 15
4459 @},
4460 "finish": @{
4461 "column": 4,
4462 "file": "misleading-indentation.c",
4463 "line": 15
4464 @}
4465 @}
4466 ],
4467 "message": "this \u2018if\u2019 clause does not guard...",
4468 "option": "-Wmisleading-indentation",
4469 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4470 "children": [
4471 @{
4472 "kind": "note",
4473 "locations": [
4474 @{
4475 "caret": @{
4476 "column": 5,
4477 "file": "misleading-indentation.c",
4478 "line": 17
4479 @}
4480 @}
4481 ],
4482 "message": "...this statement, but the latter is @dots{}"
4483 @}
4484 ]
4485 @},
4486 @dots{}
4487 ]
4488 @end smallexample
4489
4490 @noindent
4491 where the @code{note} is a child of the @code{warning}.
4492
4493 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4494 an @code{option} key describing the command-line option controlling the
4495 warning.
4496
4497 A diagnostic can contain zero or more locations. Each location has up
4498 to three positions within it: a @code{caret} position and optional
4499 @code{start} and @code{finish} positions. A location can also have
4500 an optional @code{label} string. For example, this error:
4501
4502 @smallexample
4503 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4504 'struct s'@} and 'T' @{aka 'struct t'@})
4505 64 | return callee_4a () + callee_4b ();
4506 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4507 | | |
4508 | | T @{aka struct t@}
4509 | S @{aka struct s@}
4510 @end smallexample
4511
4512 @noindent
4513 has three locations. Its primary location is at the ``+'' token at column
4514 23. It has two secondary locations, describing the left and right-hand sides
4515 of the expression, which have labels. It might be printed in JSON form as:
4516
4517 @smallexample
4518 @{
4519 "children": [],
4520 "kind": "error",
4521 "locations": [
4522 @{
4523 "caret": @{
4524 "column": 23, "file": "bad-binary-ops.c", "line": 64
4525 @}
4526 @},
4527 @{
4528 "caret": @{
4529 "column": 10, "file": "bad-binary-ops.c", "line": 64
4530 @},
4531 "finish": @{
4532 "column": 21, "file": "bad-binary-ops.c", "line": 64
4533 @},
4534 "label": "S @{aka struct s@}"
4535 @},
4536 @{
4537 "caret": @{
4538 "column": 25, "file": "bad-binary-ops.c", "line": 64
4539 @},
4540 "finish": @{
4541 "column": 36, "file": "bad-binary-ops.c", "line": 64
4542 @},
4543 "label": "T @{aka struct t@}"
4544 @}
4545 ],
4546 "message": "invalid operands to binary + @dots{}"
4547 @}
4548 @end smallexample
4549
4550 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4551 consisting of half-open intervals, similar to the output of
4552 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4553 with a replacement fix-it hint:
4554
4555 @smallexample
4556 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4557 mean 'color'?
4558 8 | return ptr->colour;
4559 | ^~~~~~
4560 | color
4561 @end smallexample
4562
4563 @noindent
4564 might be printed in JSON form as:
4565
4566 @smallexample
4567 @{
4568 "children": [],
4569 "fixits": [
4570 @{
4571 "next": @{
4572 "column": 21,
4573 "file": "demo.c",
4574 "line": 8
4575 @},
4576 "start": @{
4577 "column": 15,
4578 "file": "demo.c",
4579 "line": 8
4580 @},
4581 "string": "color"
4582 @}
4583 ],
4584 "kind": "error",
4585 "locations": [
4586 @{
4587 "caret": @{
4588 "column": 15,
4589 "file": "demo.c",
4590 "line": 8
4591 @},
4592 "finish": @{
4593 "column": 20,
4594 "file": "demo.c",
4595 "line": 8
4596 @}
4597 @}
4598 ],
4599 "message": "\u2018struct s\u2019 has no member named @dots{}"
4600 @}
4601 @end smallexample
4602
4603 @noindent
4604 where the fix-it hint suggests replacing the text from @code{start} up
4605 to but not including @code{next} with @code{string}'s value. Deletions
4606 are expressed via an empty value for @code{string}, insertions by
4607 having @code{start} equal @code{next}.
4608
4609 If the diagnostic has a path of control-flow events associated with it,
4610 it has a @code{path} array of objects representing the events. Each
4611 event object has a @code{description} string, a @code{location} object,
4612 along with a @code{function} string and a @code{depth} number for
4613 representing interprocedural paths. The @code{function} represents the
4614 current function at that event, and the @code{depth} represents the
4615 stack depth relative to some baseline: the higher, the more frames are
4616 within the stack.
4617
4618 For example, the intraprocedural example shown for
4619 @option{-fdiagnostics-path-format=} might have this JSON for its path:
4620
4621 @smallexample
4622 "path": [
4623 @{
4624 "depth": 0,
4625 "description": "when 'PyList_New' fails, returning NULL",
4626 "function": "test",
4627 "location": @{
4628 "column": 10,
4629 "file": "test.c",
4630 "line": 25
4631 @}
4632 @},
4633 @{
4634 "depth": 0,
4635 "description": "when 'i < count'",
4636 "function": "test",
4637 "location": @{
4638 "column": 3,
4639 "file": "test.c",
4640 "line": 27
4641 @}
4642 @},
4643 @{
4644 "depth": 0,
4645 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4646 "function": "test",
4647 "location": @{
4648 "column": 5,
4649 "file": "test.c",
4650 "line": 29
4651 @}
4652 @}
4653 ]
4654 @end smallexample
4655
4656 @end table
4657
4658 @node Warning Options
4659 @section Options to Request or Suppress Warnings
4660 @cindex options to control warnings
4661 @cindex warning messages
4662 @cindex messages, warning
4663 @cindex suppressing warnings
4664
4665 Warnings are diagnostic messages that report constructions that
4666 are not inherently erroneous but that are risky or suggest there
4667 may have been an error.
4668
4669 The following language-independent options do not enable specific
4670 warnings but control the kinds of diagnostics produced by GCC@.
4671
4672 @table @gcctabopt
4673 @cindex syntax checking
4674 @item -fsyntax-only
4675 @opindex fsyntax-only
4676 Check the code for syntax errors, but don't do anything beyond that.
4677
4678 @item -fmax-errors=@var{n}
4679 @opindex fmax-errors
4680 Limits the maximum number of error messages to @var{n}, at which point
4681 GCC bails out rather than attempting to continue processing the source
4682 code. If @var{n} is 0 (the default), there is no limit on the number
4683 of error messages produced. If @option{-Wfatal-errors} is also
4684 specified, then @option{-Wfatal-errors} takes precedence over this
4685 option.
4686
4687 @item -w
4688 @opindex w
4689 Inhibit all warning messages.
4690
4691 @item -Werror
4692 @opindex Werror
4693 @opindex Wno-error
4694 Make all warnings into errors.
4695
4696 @item -Werror=
4697 @opindex Werror=
4698 @opindex Wno-error=
4699 Make the specified warning into an error. The specifier for a warning
4700 is appended; for example @option{-Werror=switch} turns the warnings
4701 controlled by @option{-Wswitch} into errors. This switch takes a
4702 negative form, to be used to negate @option{-Werror} for specific
4703 warnings; for example @option{-Wno-error=switch} makes
4704 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4705 is in effect.
4706
4707 The warning message for each controllable warning includes the
4708 option that controls the warning. That option can then be used with
4709 @option{-Werror=} and @option{-Wno-error=} as described above.
4710 (Printing of the option in the warning message can be disabled using the
4711 @option{-fno-diagnostics-show-option} flag.)
4712
4713 Note that specifying @option{-Werror=}@var{foo} automatically implies
4714 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4715 imply anything.
4716
4717 @item -Wfatal-errors
4718 @opindex Wfatal-errors
4719 @opindex Wno-fatal-errors
4720 This option causes the compiler to abort compilation on the first error
4721 occurred rather than trying to keep going and printing further error
4722 messages.
4723
4724 @end table
4725
4726 You can request many specific warnings with options beginning with
4727 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4728 implicit declarations. Each of these specific warning options also
4729 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4730 example, @option{-Wno-implicit}. This manual lists only one of the
4731 two forms, whichever is not the default. For further
4732 language-specific options also refer to @ref{C++ Dialect Options} and
4733 @ref{Objective-C and Objective-C++ Dialect Options}.
4734 Additional warnings can be produced by enabling the static analyzer;
4735 @xref{Static Analyzer Options}.
4736
4737 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4738 options, such as @option{-Wunused}, which may turn on further options,
4739 such as @option{-Wunused-value}. The combined effect of positive and
4740 negative forms is that more specific options have priority over less
4741 specific ones, independently of their position in the command-line. For
4742 options of the same specificity, the last one takes effect. Options
4743 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4744 as if they appeared at the end of the command-line.
4745
4746 When an unrecognized warning option is requested (e.g.,
4747 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4748 that the option is not recognized. However, if the @option{-Wno-} form
4749 is used, the behavior is slightly different: no diagnostic is
4750 produced for @option{-Wno-unknown-warning} unless other diagnostics
4751 are being produced. This allows the use of new @option{-Wno-} options
4752 with old compilers, but if something goes wrong, the compiler
4753 warns that an unrecognized option is present.
4754
4755 The effectiveness of some warnings depends on optimizations also being
4756 enabled. For example @option{-Wsuggest-final-types} is more effective
4757 with link-time optimization and @option{-Wmaybe-uninitialized} does not
4758 warn at all unless optimization is enabled.
4759
4760 @table @gcctabopt
4761 @item -Wpedantic
4762 @itemx -pedantic
4763 @opindex pedantic
4764 @opindex Wpedantic
4765 @opindex Wno-pedantic
4766 Issue all the warnings demanded by strict ISO C and ISO C++;
4767 reject all programs that use forbidden extensions, and some other
4768 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4769 version of the ISO C standard specified by any @option{-std} option used.
4770
4771 Valid ISO C and ISO C++ programs should compile properly with or without
4772 this option (though a rare few require @option{-ansi} or a
4773 @option{-std} option specifying the required version of ISO C)@. However,
4774 without this option, certain GNU extensions and traditional C and C++
4775 features are supported as well. With this option, they are rejected.
4776
4777 @option{-Wpedantic} does not cause warning messages for use of the
4778 alternate keywords whose names begin and end with @samp{__}. This alternate
4779 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4780 i.e. @samp{__intN__}.
4781 Pedantic warnings are also disabled in the expression that follows
4782 @code{__extension__}. However, only system header files should use
4783 these escape routes; application programs should avoid them.
4784 @xref{Alternate Keywords}.
4785
4786 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4787 C conformance. They soon find that it does not do quite what they want:
4788 it finds some non-ISO practices, but not all---only those for which
4789 ISO C @emph{requires} a diagnostic, and some others for which
4790 diagnostics have been added.
4791
4792 A feature to report any failure to conform to ISO C might be useful in
4793 some instances, but would require considerable additional work and would
4794 be quite different from @option{-Wpedantic}. We don't have plans to
4795 support such a feature in the near future.
4796
4797 Where the standard specified with @option{-std} represents a GNU
4798 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4799 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4800 extended dialect is based. Warnings from @option{-Wpedantic} are given
4801 where they are required by the base standard. (It does not make sense
4802 for such warnings to be given only for features not in the specified GNU
4803 C dialect, since by definition the GNU dialects of C include all
4804 features the compiler supports with the given option, and there would be
4805 nothing to warn about.)
4806
4807 @item -pedantic-errors
4808 @opindex pedantic-errors
4809 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4810 requires a diagnostic, in some cases where there is undefined behavior
4811 at compile-time and in some other cases that do not prevent compilation
4812 of programs that are valid according to the standard. This is not
4813 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4814 by this option and not enabled by the latter and vice versa.
4815
4816 @item -Wall
4817 @opindex Wall
4818 @opindex Wno-all
4819 This enables all the warnings about constructions that some users
4820 consider questionable, and that are easy to avoid (or modify to
4821 prevent the warning), even in conjunction with macros. This also
4822 enables some language-specific warnings described in @ref{C++ Dialect
4823 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4824
4825 @option{-Wall} turns on the following warning flags:
4826
4827 @gccoptlist{-Waddress @gol
4828 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4829 -Wbool-compare @gol
4830 -Wbool-operation @gol
4831 -Wc++11-compat -Wc++14-compat @gol
4832 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4833 -Wchar-subscripts @gol
4834 -Wcomment @gol
4835 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4836 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4837 -Wenum-conversion @r{in C/ObjC;} @gol
4838 -Wformat @gol
4839 -Wformat-overflow @gol
4840 -Wformat-truncation @gol
4841 -Wint-in-bool-context @gol
4842 -Wimplicit @r{(C and Objective-C only)} @gol
4843 -Wimplicit-int @r{(C and Objective-C only)} @gol
4844 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4845 -Winit-self @r{(only for C++)} @gol
4846 -Wlogical-not-parentheses @gol
4847 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4848 -Wmaybe-uninitialized @gol
4849 -Wmemset-elt-size @gol
4850 -Wmemset-transposed-args @gol
4851 -Wmisleading-indentation @r{(only for C/C++)} @gol
4852 -Wmissing-attributes @gol
4853 -Wmissing-braces @r{(only for C/ObjC)} @gol
4854 -Wmultistatement-macros @gol
4855 -Wnarrowing @r{(only for C++)} @gol
4856 -Wnonnull @gol
4857 -Wnonnull-compare @gol
4858 -Wopenmp-simd @gol
4859 -Wparentheses @gol
4860 -Wpessimizing-move @r{(only for C++)} @gol
4861 -Wpointer-sign @gol
4862 -Wreorder @gol
4863 -Wrestrict @gol
4864 -Wreturn-type @gol
4865 -Wsequence-point @gol
4866 -Wsign-compare @r{(only in C++)} @gol
4867 -Wsizeof-pointer-div @gol
4868 -Wsizeof-pointer-memaccess @gol
4869 -Wstrict-aliasing @gol
4870 -Wstrict-overflow=1 @gol
4871 -Wswitch @gol
4872 -Wtautological-compare @gol
4873 -Wtrigraphs @gol
4874 -Wuninitialized @gol
4875 -Wunknown-pragmas @gol
4876 -Wunused-function @gol
4877 -Wunused-label @gol
4878 -Wunused-value @gol
4879 -Wunused-variable @gol
4880 -Wvolatile-register-var @gol
4881 -Wzero-length-bounds}
4882
4883 Note that some warning flags are not implied by @option{-Wall}. Some of
4884 them warn about constructions that users generally do not consider
4885 questionable, but which occasionally you might wish to check for;
4886 others warn about constructions that are necessary or hard to avoid in
4887 some cases, and there is no simple way to modify the code to suppress
4888 the warning. Some of them are enabled by @option{-Wextra} but many of
4889 them must be enabled individually.
4890
4891 @item -Wextra
4892 @opindex W
4893 @opindex Wextra
4894 @opindex Wno-extra
4895 This enables some extra warning flags that are not enabled by
4896 @option{-Wall}. (This option used to be called @option{-W}. The older
4897 name is still supported, but the newer name is more descriptive.)
4898
4899 @gccoptlist{-Wclobbered @gol
4900 -Wcast-function-type @gol
4901 -Wdeprecated-copy @r{(C++ only)} @gol
4902 -Wempty-body @gol
4903 -Wignored-qualifiers @gol
4904 -Wimplicit-fallthrough=3 @gol
4905 -Wmissing-field-initializers @gol
4906 -Wmissing-parameter-type @r{(C only)} @gol
4907 -Wold-style-declaration @r{(C only)} @gol
4908 -Woverride-init @gol
4909 -Wsign-compare @r{(C only)} @gol
4910 -Wstring-compare @gol
4911 -Wredundant-move @r{(only for C++)} @gol
4912 -Wtype-limits @gol
4913 -Wuninitialized @gol
4914 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4915 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4916 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4917
4918
4919 The option @option{-Wextra} also prints warning messages for the
4920 following cases:
4921
4922 @itemize @bullet
4923
4924 @item
4925 A pointer is compared against integer zero with @code{<}, @code{<=},
4926 @code{>}, or @code{>=}.
4927
4928 @item
4929 (C++ only) An enumerator and a non-enumerator both appear in a
4930 conditional expression.
4931
4932 @item
4933 (C++ only) Ambiguous virtual bases.
4934
4935 @item
4936 (C++ only) Subscripting an array that has been declared @code{register}.
4937
4938 @item
4939 (C++ only) Taking the address of a variable that has been declared
4940 @code{register}.
4941
4942 @item
4943 (C++ only) A base class is not initialized in the copy constructor
4944 of a derived class.
4945
4946 @end itemize
4947
4948 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
4949 @opindex Wabi
4950 @opindex Wno-abi
4951
4952 Warn about code affected by ABI changes. This includes code that may
4953 not be compatible with the vendor-neutral C++ ABI as well as the psABI
4954 for the particular target.
4955
4956 Since G++ now defaults to updating the ABI with each major release,
4957 normally @option{-Wabi} warns only about C++ ABI compatibility
4958 problems if there is a check added later in a release series for an
4959 ABI issue discovered since the initial release. @option{-Wabi} warns
4960 about more things if an older ABI version is selected (with
4961 @option{-fabi-version=@var{n}}).
4962
4963 @option{-Wabi} can also be used with an explicit version number to
4964 warn about C++ ABI compatibility with a particular @option{-fabi-version}
4965 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
4966 @option{-fabi-version=2}.
4967
4968 If an explicit version number is provided and
4969 @option{-fabi-compat-version} is not specified, the version number
4970 from this option is used for compatibility aliases. If no explicit
4971 version number is provided with this option, but
4972 @option{-fabi-compat-version} is specified, that version number is
4973 used for C++ ABI warnings.
4974
4975 Although an effort has been made to warn about
4976 all such cases, there are probably some cases that are not warned about,
4977 even though G++ is generating incompatible code. There may also be
4978 cases where warnings are emitted even though the code that is generated
4979 is compatible.
4980
4981 You should rewrite your code to avoid these warnings if you are
4982 concerned about the fact that code generated by G++ may not be binary
4983 compatible with code generated by other compilers.
4984
4985 Known incompatibilities in @option{-fabi-version=2} (which was the
4986 default from GCC 3.4 to 4.9) include:
4987
4988 @itemize @bullet
4989
4990 @item
4991 A template with a non-type template parameter of reference type was
4992 mangled incorrectly:
4993 @smallexample
4994 extern int N;
4995 template <int &> struct S @{@};
4996 void n (S<N>) @{2@}
4997 @end smallexample
4998
4999 This was fixed in @option{-fabi-version=3}.
5000
5001 @item
5002 SIMD vector types declared using @code{__attribute ((vector_size))} were
5003 mangled in a non-standard way that does not allow for overloading of
5004 functions taking vectors of different sizes.
5005
5006 The mangling was changed in @option{-fabi-version=4}.
5007
5008 @item
5009 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5010 qualifiers, and @code{decltype} of a plain declaration was folded away.
5011
5012 These mangling issues were fixed in @option{-fabi-version=5}.
5013
5014 @item
5015 Scoped enumerators passed as arguments to a variadic function are
5016 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5017 On most targets this does not actually affect the parameter passing
5018 ABI, as there is no way to pass an argument smaller than @code{int}.
5019
5020 Also, the ABI changed the mangling of template argument packs,
5021 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5022 a class scope function used as a template argument.
5023
5024 These issues were corrected in @option{-fabi-version=6}.
5025
5026 @item
5027 Lambdas in default argument scope were mangled incorrectly, and the
5028 ABI changed the mangling of @code{nullptr_t}.
5029
5030 These issues were corrected in @option{-fabi-version=7}.
5031
5032 @item
5033 When mangling a function type with function-cv-qualifiers, the
5034 un-qualified function type was incorrectly treated as a substitution
5035 candidate.
5036
5037 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5038
5039 @item
5040 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5041 unaligned accesses. Note that this did not affect the ABI of a
5042 function with a @code{nullptr_t} parameter, as parameters have a
5043 minimum alignment.
5044
5045 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5046
5047 @item
5048 Target-specific attributes that affect the identity of a type, such as
5049 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5050 did not affect the mangled name, leading to name collisions when
5051 function pointers were used as template arguments.
5052
5053 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5054
5055 @end itemize
5056
5057 This option also enables warnings about psABI-related changes.
5058 The known psABI changes at this point include:
5059
5060 @itemize @bullet
5061
5062 @item
5063 For SysV/x86-64, unions with @code{long double} members are
5064 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5065 the case. For example:
5066
5067 @smallexample
5068 union U @{
5069 long double ld;
5070 int i;
5071 @};
5072 @end smallexample
5073
5074 @noindent
5075 @code{union U} is now always passed in memory.
5076
5077 @end itemize
5078
5079 @item -Wchar-subscripts
5080 @opindex Wchar-subscripts
5081 @opindex Wno-char-subscripts
5082 Warn if an array subscript has type @code{char}. This is a common cause
5083 of error, as programmers often forget that this type is signed on some
5084 machines.
5085 This warning is enabled by @option{-Wall}.
5086
5087 @item -Wno-coverage-mismatch
5088 @opindex Wno-coverage-mismatch
5089 @opindex Wcoverage-mismatch
5090 Warn if feedback profiles do not match when using the
5091 @option{-fprofile-use} option.
5092 If a source file is changed between compiling with @option{-fprofile-generate}
5093 and with @option{-fprofile-use}, the files with the profile feedback can fail
5094 to match the source file and GCC cannot use the profile feedback
5095 information. By default, this warning is enabled and is treated as an
5096 error. @option{-Wno-coverage-mismatch} can be used to disable the
5097 warning or @option{-Wno-error=coverage-mismatch} can be used to
5098 disable the error. Disabling the error for this warning can result in
5099 poorly optimized code and is useful only in the
5100 case of very minor changes such as bug fixes to an existing code-base.
5101 Completely disabling the warning is not recommended.
5102
5103 @item -Wno-cpp
5104 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5105 @opindex Wno-cpp
5106 @opindex Wcpp
5107 Suppress warning messages emitted by @code{#warning} directives.
5108
5109 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5110 @opindex Wdouble-promotion
5111 @opindex Wno-double-promotion
5112 Give a warning when a value of type @code{float} is implicitly
5113 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5114 floating-point unit implement @code{float} in hardware, but emulate
5115 @code{double} in software. On such a machine, doing computations
5116 using @code{double} values is much more expensive because of the
5117 overhead required for software emulation.
5118
5119 It is easy to accidentally do computations with @code{double} because
5120 floating-point literals are implicitly of type @code{double}. For
5121 example, in:
5122 @smallexample
5123 @group
5124 float area(float radius)
5125 @{
5126 return 3.14159 * radius * radius;
5127 @}
5128 @end group
5129 @end smallexample
5130 the compiler performs the entire computation with @code{double}
5131 because the floating-point literal is a @code{double}.
5132
5133 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5134 @opindex Wduplicate-decl-specifier
5135 @opindex Wno-duplicate-decl-specifier
5136 Warn if a declaration has duplicate @code{const}, @code{volatile},
5137 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5138 @option{-Wall}.
5139
5140 @item -Wformat
5141 @itemx -Wformat=@var{n}
5142 @opindex Wformat
5143 @opindex Wno-format
5144 @opindex ffreestanding
5145 @opindex fno-builtin
5146 @opindex Wformat=
5147 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5148 the arguments supplied have types appropriate to the format string
5149 specified, and that the conversions specified in the format string make
5150 sense. This includes standard functions, and others specified by format
5151 attributes (@pxref{Function Attributes}), in the @code{printf},
5152 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5153 not in the C standard) families (or other target-specific families).
5154 Which functions are checked without format attributes having been
5155 specified depends on the standard version selected, and such checks of
5156 functions without the attribute specified are disabled by
5157 @option{-ffreestanding} or @option{-fno-builtin}.
5158
5159 The formats are checked against the format features supported by GNU
5160 libc version 2.2. These include all ISO C90 and C99 features, as well
5161 as features from the Single Unix Specification and some BSD and GNU
5162 extensions. Other library implementations may not support all these
5163 features; GCC does not support warning about features that go beyond a
5164 particular library's limitations. However, if @option{-Wpedantic} is used
5165 with @option{-Wformat}, warnings are given about format features not
5166 in the selected standard version (but not for @code{strfmon} formats,
5167 since those are not in any version of the C standard). @xref{C Dialect
5168 Options,,Options Controlling C Dialect}.
5169
5170 @table @gcctabopt
5171 @item -Wformat=1
5172 @itemx -Wformat
5173 @opindex Wformat
5174 @opindex Wformat=1
5175 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5176 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5177 @option{-Wformat} also checks for null format arguments for several
5178 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5179 aspects of this level of format checking can be disabled by the
5180 options: @option{-Wno-format-contains-nul},
5181 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5182 @option{-Wformat} is enabled by @option{-Wall}.
5183
5184 @item -Wformat=2
5185 @opindex Wformat=2
5186 Enable @option{-Wformat} plus additional format checks. Currently
5187 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5188 -Wformat-y2k}.
5189 @end table
5190
5191 @item -Wno-format-contains-nul
5192 @opindex Wno-format-contains-nul
5193 @opindex Wformat-contains-nul
5194 If @option{-Wformat} is specified, do not warn about format strings that
5195 contain NUL bytes.
5196
5197 @item -Wno-format-extra-args
5198 @opindex Wno-format-extra-args
5199 @opindex Wformat-extra-args
5200 If @option{-Wformat} is specified, do not warn about excess arguments to a
5201 @code{printf} or @code{scanf} format function. The C standard specifies
5202 that such arguments are ignored.
5203
5204 Where the unused arguments lie between used arguments that are
5205 specified with @samp{$} operand number specifications, normally
5206 warnings are still given, since the implementation could not know what
5207 type to pass to @code{va_arg} to skip the unused arguments. However,
5208 in the case of @code{scanf} formats, this option suppresses the
5209 warning if the unused arguments are all pointers, since the Single
5210 Unix Specification says that such unused arguments are allowed.
5211
5212 @item -Wformat-overflow
5213 @itemx -Wformat-overflow=@var{level}
5214 @opindex Wformat-overflow
5215 @opindex Wno-format-overflow
5216 Warn about calls to formatted input/output functions such as @code{sprintf}
5217 and @code{vsprintf} that might overflow the destination buffer. When the
5218 exact number of bytes written by a format directive cannot be determined
5219 at compile-time it is estimated based on heuristics that depend on the
5220 @var{level} argument and on optimization. While enabling optimization
5221 will in most cases improve the accuracy of the warning, it may also
5222 result in false positives.
5223
5224 @table @gcctabopt
5225 @item -Wformat-overflow
5226 @itemx -Wformat-overflow=1
5227 @opindex Wformat-overflow
5228 @opindex Wno-format-overflow
5229 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5230 employs a conservative approach that warns only about calls that most
5231 likely overflow the buffer. At this level, numeric arguments to format
5232 directives with unknown values are assumed to have the value of one, and
5233 strings of unknown length to be empty. Numeric arguments that are known
5234 to be bounded to a subrange of their type, or string arguments whose output
5235 is bounded either by their directive's precision or by a finite set of
5236 string literals, are assumed to take on the value within the range that
5237 results in the most bytes on output. For example, the call to @code{sprintf}
5238 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5239 the terminating NUL character (@code{'\0'}) appended by the function
5240 to the destination buffer will be written past its end. Increasing
5241 the size of the buffer by a single byte is sufficient to avoid the
5242 warning, though it may not be sufficient to avoid the overflow.
5243
5244 @smallexample
5245 void f (int a, int b)
5246 @{
5247 char buf [13];
5248 sprintf (buf, "a = %i, b = %i\n", a, b);
5249 @}
5250 @end smallexample
5251
5252 @item -Wformat-overflow=2
5253 Level @var{2} warns also about calls that might overflow the destination
5254 buffer given an argument of sufficient length or magnitude. At level
5255 @var{2}, unknown numeric arguments are assumed to have the minimum
5256 representable value for signed types with a precision greater than 1, and
5257 the maximum representable value otherwise. Unknown string arguments whose
5258 length cannot be assumed to be bounded either by the directive's precision,
5259 or by a finite set of string literals they may evaluate to, or the character
5260 array they may point to, are assumed to be 1 character long.
5261
5262 At level @var{2}, the call in the example above is again diagnosed, but
5263 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5264 @code{%i} directive will write some of its digits beyond the end of
5265 the destination buffer. To make the call safe regardless of the values
5266 of the two variables, the size of the destination buffer must be increased
5267 to at least 34 bytes. GCC includes the minimum size of the buffer in
5268 an informational note following the warning.
5269
5270 An alternative to increasing the size of the destination buffer is to
5271 constrain the range of formatted values. The maximum length of string
5272 arguments can be bounded by specifying the precision in the format
5273 directive. When numeric arguments of format directives can be assumed
5274 to be bounded by less than the precision of their type, choosing
5275 an appropriate length modifier to the format specifier will reduce
5276 the required buffer size. For example, if @var{a} and @var{b} in the
5277 example above can be assumed to be within the precision of
5278 the @code{short int} type then using either the @code{%hi} format
5279 directive or casting the argument to @code{short} reduces the maximum
5280 required size of the buffer to 24 bytes.
5281
5282 @smallexample
5283 void f (int a, int b)
5284 @{
5285 char buf [23];
5286 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5287 @}
5288 @end smallexample
5289 @end table
5290
5291 @item -Wno-format-zero-length
5292 @opindex Wno-format-zero-length
5293 @opindex Wformat-zero-length
5294 If @option{-Wformat} is specified, do not warn about zero-length formats.
5295 The C standard specifies that zero-length formats are allowed.
5296
5297 @item -Wformat-nonliteral
5298 @opindex Wformat-nonliteral
5299 @opindex Wno-format-nonliteral
5300 If @option{-Wformat} is specified, also warn if the format string is not a
5301 string literal and so cannot be checked, unless the format function
5302 takes its format arguments as a @code{va_list}.
5303
5304 @item -Wformat-security
5305 @opindex Wformat-security
5306 @opindex Wno-format-security
5307 If @option{-Wformat} is specified, also warn about uses of format
5308 functions that represent possible security problems. At present, this
5309 warns about calls to @code{printf} and @code{scanf} functions where the
5310 format string is not a string literal and there are no format arguments,
5311 as in @code{printf (foo);}. This may be a security hole if the format
5312 string came from untrusted input and contains @samp{%n}. (This is
5313 currently a subset of what @option{-Wformat-nonliteral} warns about, but
5314 in future warnings may be added to @option{-Wformat-security} that are not
5315 included in @option{-Wformat-nonliteral}.)
5316
5317 @item -Wformat-signedness
5318 @opindex Wformat-signedness
5319 @opindex Wno-format-signedness
5320 If @option{-Wformat} is specified, also warn if the format string
5321 requires an unsigned argument and the argument is signed and vice versa.
5322
5323 @item -Wformat-truncation
5324 @itemx -Wformat-truncation=@var{level}
5325 @opindex Wformat-truncation
5326 @opindex Wno-format-truncation
5327 Warn about calls to formatted input/output functions such as @code{snprintf}
5328 and @code{vsnprintf} that might result in output truncation. When the exact
5329 number of bytes written by a format directive cannot be determined at
5330 compile-time it is estimated based on heuristics that depend on
5331 the @var{level} argument and on optimization. While enabling optimization
5332 will in most cases improve the accuracy of the warning, it may also result
5333 in false positives. Except as noted otherwise, the option uses the same
5334 logic @option{-Wformat-overflow}.
5335
5336 @table @gcctabopt
5337 @item -Wformat-truncation
5338 @itemx -Wformat-truncation=1
5339 @opindex Wformat-truncation
5340 @opindex Wno-format-truncation
5341 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5342 employs a conservative approach that warns only about calls to bounded
5343 functions whose return value is unused and that will most likely result
5344 in output truncation.
5345
5346 @item -Wformat-truncation=2
5347 Level @var{2} warns also about calls to bounded functions whose return
5348 value is used and that might result in truncation given an argument of
5349 sufficient length or magnitude.
5350 @end table
5351
5352 @item -Wformat-y2k
5353 @opindex Wformat-y2k
5354 @opindex Wno-format-y2k
5355 If @option{-Wformat} is specified, also warn about @code{strftime}
5356 formats that may yield only a two-digit year.
5357
5358 @item -Wnonnull
5359 @opindex Wnonnull
5360 @opindex Wno-nonnull
5361 Warn about passing a null pointer for arguments marked as
5362 requiring a non-null value by the @code{nonnull} function attribute.
5363
5364 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
5365 can be disabled with the @option{-Wno-nonnull} option.
5366
5367 @item -Wnonnull-compare
5368 @opindex Wnonnull-compare
5369 @opindex Wno-nonnull-compare
5370 Warn when comparing an argument marked with the @code{nonnull}
5371 function attribute against null inside the function.
5372
5373 @option{-Wnonnull-compare} is included in @option{-Wall}. It
5374 can be disabled with the @option{-Wno-nonnull-compare} option.
5375
5376 @item -Wnull-dereference
5377 @opindex Wnull-dereference
5378 @opindex Wno-null-dereference
5379 Warn if the compiler detects paths that trigger erroneous or
5380 undefined behavior due to dereferencing a null pointer. This option
5381 is only active when @option{-fdelete-null-pointer-checks} is active,
5382 which is enabled by optimizations in most targets. The precision of
5383 the warnings depends on the optimization options used.
5384
5385 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5386 @opindex Winit-self
5387 @opindex Wno-init-self
5388 Warn about uninitialized variables that are initialized with themselves.
5389 Note this option can only be used with the @option{-Wuninitialized} option.
5390
5391 For example, GCC warns about @code{i} being uninitialized in the
5392 following snippet only when @option{-Winit-self} has been specified:
5393 @smallexample
5394 @group
5395 int f()
5396 @{
5397 int i = i;
5398 return i;
5399 @}
5400 @end group
5401 @end smallexample
5402
5403 This warning is enabled by @option{-Wall} in C++.
5404
5405 @item -Wno-implicit-int @r{(C and Objective-C only)}
5406 @opindex Wimplicit-int
5407 @opindex Wno-implicit-int
5408 This option controls warnings when a declaration does not specify a type.
5409 This warning is enabled by default in C99 and later dialects of C,
5410 and also by @option{-Wall}.
5411
5412 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
5413 @opindex Wimplicit-function-declaration
5414 @opindex Wno-implicit-function-declaration
5415 This option controls warnings when a function is used before being declared.
5416 This warning is enabled by default in C99 and later dialects of C,
5417 and also by @option{-Wall}.
5418 The warning is made into an error by @option{-pedantic-errors}.
5419
5420 @item -Wimplicit @r{(C and Objective-C only)}
5421 @opindex Wimplicit
5422 @opindex Wno-implicit
5423 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5424 This warning is enabled by @option{-Wall}.
5425
5426 @item -Wimplicit-fallthrough
5427 @opindex Wimplicit-fallthrough
5428 @opindex Wno-implicit-fallthrough
5429 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5430 and @option{-Wno-implicit-fallthrough} is the same as
5431 @option{-Wimplicit-fallthrough=0}.
5432
5433 @item -Wimplicit-fallthrough=@var{n}
5434 @opindex Wimplicit-fallthrough=
5435 Warn when a switch case falls through. For example:
5436
5437 @smallexample
5438 @group
5439 switch (cond)
5440 @{
5441 case 1:
5442 a = 1;
5443 break;
5444 case 2:
5445 a = 2;
5446 case 3:
5447 a = 3;
5448 break;
5449 @}
5450 @end group
5451 @end smallexample
5452
5453 This warning does not warn when the last statement of a case cannot
5454 fall through, e.g. when there is a return statement or a call to function
5455 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
5456 also takes into account control flow statements, such as ifs, and only
5457 warns when appropriate. E.g.@:
5458
5459 @smallexample
5460 @group
5461 switch (cond)
5462 @{
5463 case 1:
5464 if (i > 3) @{
5465 bar (5);
5466 break;
5467 @} else if (i < 1) @{
5468 bar (0);
5469 @} else
5470 return;
5471 default:
5472 @dots{}
5473 @}
5474 @end group
5475 @end smallexample
5476
5477 Since there are occasions where a switch case fall through is desirable,
5478 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5479 to be used along with a null statement to suppress this warning that
5480 would normally occur:
5481
5482 @smallexample
5483 @group
5484 switch (cond)
5485 @{
5486 case 1:
5487 bar (0);
5488 __attribute__ ((fallthrough));
5489 default:
5490 @dots{}
5491 @}
5492 @end group
5493 @end smallexample
5494
5495 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5496 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
5497 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5498 Instead of these attributes, it is also possible to add a fallthrough comment
5499 to silence the warning. The whole body of the C or C++ style comment should
5500 match the given regular expressions listed below. The option argument @var{n}
5501 specifies what kind of comments are accepted:
5502
5503 @itemize @bullet
5504
5505 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5506
5507 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5508 expression, any comment is used as fallthrough comment.
5509
5510 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
5511 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5512
5513 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5514 following regular expressions:
5515
5516 @itemize @bullet
5517
5518 @item @code{-fallthrough}
5519
5520 @item @code{@@fallthrough@@}
5521
5522 @item @code{lint -fallthrough[ \t]*}
5523
5524 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5525
5526 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5527
5528 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5529
5530 @end itemize
5531
5532 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5533 following regular expressions:
5534
5535 @itemize @bullet
5536
5537 @item @code{-fallthrough}
5538
5539 @item @code{@@fallthrough@@}
5540
5541 @item @code{lint -fallthrough[ \t]*}
5542
5543 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5544
5545 @end itemize
5546
5547 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5548 fallthrough comments, only attributes disable the warning.
5549
5550 @end itemize
5551
5552 The comment needs to be followed after optional whitespace and other comments
5553 by @code{case} or @code{default} keywords or by a user label that precedes some
5554 @code{case} or @code{default} label.
5555
5556 @smallexample
5557 @group
5558 switch (cond)
5559 @{
5560 case 1:
5561 bar (0);
5562 /* FALLTHRU */
5563 default:
5564 @dots{}
5565 @}
5566 @end group
5567 @end smallexample
5568
5569 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5570
5571 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5572 @opindex Wif-not-aligned
5573 @opindex Wno-if-not-aligned
5574 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
5575 should be issued. These warnings are enabled by default.
5576
5577 @item -Wignored-qualifiers @r{(C and C++ only)}
5578 @opindex Wignored-qualifiers
5579 @opindex Wno-ignored-qualifiers
5580 Warn if the return type of a function has a type qualifier
5581 such as @code{const}. For ISO C such a type qualifier has no effect,
5582 since the value returned by a function is not an lvalue.
5583 For C++, the warning is only emitted for scalar types or @code{void}.
5584 ISO C prohibits qualified @code{void} return types on function
5585 definitions, so such return types always receive a warning
5586 even without this option.
5587
5588 This warning is also enabled by @option{-Wextra}.
5589
5590 @item -Wno-ignored-attributes @r{(C and C++ only)}
5591 @opindex Wignored-attributes
5592 @opindex Wno-ignored-attributes
5593 This option controls warnings when an attribute is ignored.
5594 This is different from the
5595 @option{-Wattributes} option in that it warns whenever the compiler decides
5596 to drop an attribute, not that the attribute is either unknown, used in a
5597 wrong place, etc. This warning is enabled by default.
5598
5599 @item -Wmain
5600 @opindex Wmain
5601 @opindex Wno-main
5602 Warn if the type of @code{main} is suspicious. @code{main} should be
5603 a function with external linkage, returning int, taking either zero
5604 arguments, two, or three arguments of appropriate types. This warning
5605 is enabled by default in C++ and is enabled by either @option{-Wall}
5606 or @option{-Wpedantic}.
5607
5608 @item -Wmisleading-indentation @r{(C and C++ only)}
5609 @opindex Wmisleading-indentation
5610 @opindex Wno-misleading-indentation
5611 Warn when the indentation of the code does not reflect the block structure.
5612 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5613 @code{for} clauses with a guarded statement that does not use braces,
5614 followed by an unguarded statement with the same indentation.
5615
5616 In the following example, the call to ``bar'' is misleadingly indented as
5617 if it were guarded by the ``if'' conditional.
5618
5619 @smallexample
5620 if (some_condition ())
5621 foo ();
5622 bar (); /* Gotcha: this is not guarded by the "if". */
5623 @end smallexample
5624
5625 In the case of mixed tabs and spaces, the warning uses the
5626 @option{-ftabstop=} option to determine if the statements line up
5627 (defaulting to 8).
5628
5629 The warning is not issued for code involving multiline preprocessor logic
5630 such as the following example.
5631
5632 @smallexample
5633 if (flagA)
5634 foo (0);
5635 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5636 if (flagB)
5637 #endif
5638 foo (1);
5639 @end smallexample
5640
5641 The warning is not issued after a @code{#line} directive, since this
5642 typically indicates autogenerated code, and no assumptions can be made
5643 about the layout of the file that the directive references.
5644
5645 This warning is enabled by @option{-Wall} in C and C++.
5646
5647 @item -Wmissing-attributes
5648 @opindex Wmissing-attributes
5649 @opindex Wno-missing-attributes
5650 Warn when a declaration of a function is missing one or more attributes
5651 that a related function is declared with and whose absence may adversely
5652 affect the correctness or efficiency of generated code. For example,
5653 the warning is issued for declarations of aliases that use attributes
5654 to specify less restrictive requirements than those of their targets.
5655 This typically represents a potential optimization opportunity.
5656 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5657 issued when the alias is more restrictive than the target, which could
5658 lead to incorrect code generation.
5659 Attributes considered include @code{alloc_align}, @code{alloc_size},
5660 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5661 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5662 @code{returns_nonnull}, and @code{returns_twice}.
5663
5664 In C++, the warning is issued when an explicit specialization of a primary
5665 template declared with attribute @code{alloc_align}, @code{alloc_size},
5666 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5667 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5668 @code{error}, and @code{warning} suppress the warning.
5669 (@pxref{Function Attributes}).
5670
5671 You can use the @code{copy} attribute to apply the same
5672 set of attributes to a declaration as that on another declaration without
5673 explicitly enumerating the attributes. This attribute can be applied
5674 to declarations of functions (@pxref{Common Function Attributes}),
5675 variables (@pxref{Common Variable Attributes}), or types
5676 (@pxref{Common Type Attributes}).
5677
5678 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5679
5680 For example, since the declaration of the primary function template
5681 below makes use of both attribute @code{malloc} and @code{alloc_size}
5682 the declaration of the explicit specialization of the template is
5683 diagnosed because it is missing one of the attributes.
5684
5685 @smallexample
5686 template <class T>
5687 T* __attribute__ ((malloc, alloc_size (1)))
5688 allocate (size_t);
5689
5690 template <>
5691 void* __attribute__ ((malloc)) // missing alloc_size
5692 allocate<void> (size_t);
5693 @end smallexample
5694
5695 @item -Wmissing-braces
5696 @opindex Wmissing-braces
5697 @opindex Wno-missing-braces
5698 Warn if an aggregate or union initializer is not fully bracketed. In
5699 the following example, the initializer for @code{a} is not fully
5700 bracketed, but that for @code{b} is fully bracketed.
5701
5702 @smallexample
5703 int a[2][2] = @{ 0, 1, 2, 3 @};
5704 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5705 @end smallexample
5706
5707 This warning is enabled by @option{-Wall}.
5708
5709 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5710 @opindex Wmissing-include-dirs
5711 @opindex Wno-missing-include-dirs
5712 Warn if a user-supplied include directory does not exist.
5713
5714 @item -Wno-missing-profile
5715 @opindex Wmissing-profile
5716 @opindex Wno-missing-profile
5717 This option controls warnings if feedback profiles are missing when using the
5718 @option{-fprofile-use} option.
5719 This option diagnoses those cases where a new function or a new file is added
5720 between compiling with @option{-fprofile-generate} and with
5721 @option{-fprofile-use}, without regenerating the profiles.
5722 In these cases, the profile feedback data files do not contain any
5723 profile feedback information for
5724 the newly added function or file respectively. Also, in the case when profile
5725 count data (.gcda) files are removed, GCC cannot use any profile feedback
5726 information. In all these cases, warnings are issued to inform you that a
5727 profile generation step is due.
5728 Ignoring the warning can result in poorly optimized code.
5729 @option{-Wno-missing-profile} can be used to
5730 disable the warning, but this is not recommended and should be done only
5731 when non-existent profile data is justified.
5732
5733 @item -Wmultistatement-macros
5734 @opindex Wmultistatement-macros
5735 @opindex Wno-multistatement-macros
5736 Warn about unsafe multiple statement macros that appear to be guarded
5737 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5738 @code{while}, in which only the first statement is actually guarded after
5739 the macro is expanded.
5740
5741 For example:
5742
5743 @smallexample
5744 #define DOIT x++; y++
5745 if (c)
5746 DOIT;
5747 @end smallexample
5748
5749 will increment @code{y} unconditionally, not just when @code{c} holds.
5750 The can usually be fixed by wrapping the macro in a do-while loop:
5751 @smallexample
5752 #define DOIT do @{ x++; y++; @} while (0)
5753 if (c)
5754 DOIT;
5755 @end smallexample
5756
5757 This warning is enabled by @option{-Wall} in C and C++.
5758
5759 @item -Wparentheses
5760 @opindex Wparentheses
5761 @opindex Wno-parentheses
5762 Warn if parentheses are omitted in certain contexts, such
5763 as when there is an assignment in a context where a truth value
5764 is expected, or when operators are nested whose precedence people
5765 often get confused about.
5766
5767 Also warn if a comparison like @code{x<=y<=z} appears; this is
5768 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5769 interpretation from that of ordinary mathematical notation.
5770
5771 Also warn for dangerous uses of the GNU extension to
5772 @code{?:} with omitted middle operand. When the condition
5773 in the @code{?}: operator is a boolean expression, the omitted value is
5774 always 1. Often programmers expect it to be a value computed
5775 inside the conditional expression instead.
5776
5777 For C++ this also warns for some cases of unnecessary parentheses in
5778 declarations, which can indicate an attempt at a function call instead
5779 of a declaration:
5780 @smallexample
5781 @{
5782 // Declares a local variable called mymutex.
5783 std::unique_lock<std::mutex> (mymutex);
5784 // User meant std::unique_lock<std::mutex> lock (mymutex);
5785 @}
5786 @end smallexample
5787
5788 This warning is enabled by @option{-Wall}.
5789
5790 @item -Wsequence-point
5791 @opindex Wsequence-point
5792 @opindex Wno-sequence-point
5793 Warn about code that may have undefined semantics because of violations
5794 of sequence point rules in the C and C++ standards.
5795
5796 The C and C++ standards define the order in which expressions in a C/C++
5797 program are evaluated in terms of @dfn{sequence points}, which represent
5798 a partial ordering between the execution of parts of the program: those
5799 executed before the sequence point, and those executed after it. These
5800 occur after the evaluation of a full expression (one which is not part
5801 of a larger expression), after the evaluation of the first operand of a
5802 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5803 function is called (but after the evaluation of its arguments and the
5804 expression denoting the called function), and in certain other places.
5805 Other than as expressed by the sequence point rules, the order of
5806 evaluation of subexpressions of an expression is not specified. All
5807 these rules describe only a partial order rather than a total order,
5808 since, for example, if two functions are called within one expression
5809 with no sequence point between them, the order in which the functions
5810 are called is not specified. However, the standards committee have
5811 ruled that function calls do not overlap.
5812
5813 It is not specified when between sequence points modifications to the
5814 values of objects take effect. Programs whose behavior depends on this
5815 have undefined behavior; the C and C++ standards specify that ``Between
5816 the previous and next sequence point an object shall have its stored
5817 value modified at most once by the evaluation of an expression.
5818 Furthermore, the prior value shall be read only to determine the value
5819 to be stored.''. If a program breaks these rules, the results on any
5820 particular implementation are entirely unpredictable.
5821
5822 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5823 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5824 diagnosed by this option, and it may give an occasional false positive
5825 result, but in general it has been found fairly effective at detecting
5826 this sort of problem in programs.
5827
5828 The C++17 standard will define the order of evaluation of operands in
5829 more cases: in particular it requires that the right-hand side of an
5830 assignment be evaluated before the left-hand side, so the above
5831 examples are no longer undefined. But this option will still warn
5832 about them, to help people avoid writing code that is undefined in C
5833 and earlier revisions of C++.
5834
5835 The standard is worded confusingly, therefore there is some debate
5836 over the precise meaning of the sequence point rules in subtle cases.
5837 Links to discussions of the problem, including proposed formal
5838 definitions, may be found on the GCC readings page, at
5839 @uref{http://gcc.gnu.org/@/readings.html}.
5840
5841 This warning is enabled by @option{-Wall} for C and C++.
5842
5843 @item -Wno-return-local-addr
5844 @opindex Wno-return-local-addr
5845 @opindex Wreturn-local-addr
5846 Do not warn about returning a pointer (or in C++, a reference) to a
5847 variable that goes out of scope after the function returns.
5848
5849 @item -Wreturn-type
5850 @opindex Wreturn-type
5851 @opindex Wno-return-type
5852 Warn whenever a function is defined with a return type that defaults
5853 to @code{int}. Also warn about any @code{return} statement with no
5854 return value in a function whose return type is not @code{void}
5855 (falling off the end of the function body is considered returning
5856 without a value).
5857
5858 For C only, warn about a @code{return} statement with an expression in a
5859 function whose return type is @code{void}, unless the expression type is
5860 also @code{void}. As a GNU extension, the latter case is accepted
5861 without a warning unless @option{-Wpedantic} is used. Attempting
5862 to use the return value of a non-@code{void} function other than @code{main}
5863 that flows off the end by reaching the closing curly brace that terminates
5864 the function is undefined.
5865
5866 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5867 than @code{main} results in undefined behavior even when the value of
5868 the function is not used.
5869
5870 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5871
5872 @item -Wno-shift-count-negative
5873 @opindex Wshift-count-negative
5874 @opindex Wno-shift-count-negative
5875 Controls warnings if a shift count is negative.
5876 This warning is enabled by default.
5877
5878 @item -Wno-shift-count-overflow
5879 @opindex Wshift-count-overflow
5880 @opindex Wno-shift-count-overflow
5881 Controls warnings if a shift count is greater than or equal to the bit width
5882 of the type. This warning is enabled by default.
5883
5884 @item -Wshift-negative-value
5885 @opindex Wshift-negative-value
5886 @opindex Wno-shift-negative-value
5887 Warn if left shifting a negative value. This warning is enabled by
5888 @option{-Wextra} in C99 and C++11 modes (and newer).
5889
5890 @item -Wno-shift-overflow
5891 @itemx -Wshift-overflow=@var{n}
5892 @opindex Wshift-overflow
5893 @opindex Wno-shift-overflow
5894 These options control warnings about left shift overflows.
5895
5896 @table @gcctabopt
5897 @item -Wshift-overflow=1
5898 This is the warning level of @option{-Wshift-overflow} and is enabled
5899 by default in C99 and C++11 modes (and newer). This warning level does
5900 not warn about left-shifting 1 into the sign bit. (However, in C, such
5901 an overflow is still rejected in contexts where an integer constant expression
5902 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5903 shifts always wrap.
5904
5905 @item -Wshift-overflow=2
5906 This warning level also warns about left-shifting 1 into the sign bit,
5907 unless C++14 mode (or newer) is active.
5908 @end table
5909
5910 @item -Wswitch
5911 @opindex Wswitch
5912 @opindex Wno-switch
5913 Warn whenever a @code{switch} statement has an index of enumerated type
5914 and lacks a @code{case} for one or more of the named codes of that
5915 enumeration. (The presence of a @code{default} label prevents this
5916 warning.) @code{case} labels outside the enumeration range also
5917 provoke warnings when this option is used (even if there is a
5918 @code{default} label).
5919 This warning is enabled by @option{-Wall}.
5920
5921 @item -Wswitch-default
5922 @opindex Wswitch-default
5923 @opindex Wno-switch-default
5924 Warn whenever a @code{switch} statement does not have a @code{default}
5925 case.
5926
5927 @item -Wswitch-enum
5928 @opindex Wswitch-enum
5929 @opindex Wno-switch-enum
5930 Warn whenever a @code{switch} statement has an index of enumerated type
5931 and lacks a @code{case} for one or more of the named codes of that
5932 enumeration. @code{case} labels outside the enumeration range also
5933 provoke warnings when this option is used. The only difference
5934 between @option{-Wswitch} and this option is that this option gives a
5935 warning about an omitted enumeration code even if there is a
5936 @code{default} label.
5937
5938 @item -Wno-switch-bool
5939 @opindex Wswitch-bool
5940 @opindex Wno-switch-bool
5941 Do not warn when a @code{switch} statement has an index of boolean type
5942 and the case values are outside the range of a boolean type.
5943 It is possible to suppress this warning by casting the controlling
5944 expression to a type other than @code{bool}. For example:
5945 @smallexample
5946 @group
5947 switch ((int) (a == 4))
5948 @{
5949 @dots{}
5950 @}
5951 @end group
5952 @end smallexample
5953 This warning is enabled by default for C and C++ programs.
5954
5955 @item -Wno-switch-outside-range
5956 @opindex Wswitch-outside-range
5957 @opindex Wno-switch-outside-range
5958 This option controls warnings when a @code{switch} case has a value
5959 that is outside of its
5960 respective type range. This warning is enabled by default for
5961 C and C++ programs.
5962
5963 @item -Wno-switch-unreachable
5964 @opindex Wswitch-unreachable
5965 @opindex Wno-switch-unreachable
5966 Do not warn when a @code{switch} statement contains statements between the
5967 controlling expression and the first case label, which will never be
5968 executed. For example:
5969 @smallexample
5970 @group
5971 switch (cond)
5972 @{
5973 i = 15;
5974 @dots{}
5975 case 5:
5976 @dots{}
5977 @}
5978 @end group
5979 @end smallexample
5980 @option{-Wswitch-unreachable} does not warn if the statement between the
5981 controlling expression and the first case label is just a declaration:
5982 @smallexample
5983 @group
5984 switch (cond)
5985 @{
5986 int i;
5987 @dots{}
5988 case 5:
5989 i = 5;
5990 @dots{}
5991 @}
5992 @end group
5993 @end smallexample
5994 This warning is enabled by default for C and C++ programs.
5995
5996 @item -Wsync-nand @r{(C and C++ only)}
5997 @opindex Wsync-nand
5998 @opindex Wno-sync-nand
5999 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6000 built-in functions are used. These functions changed semantics in GCC 4.4.
6001
6002 @item -Wunused-but-set-parameter
6003 @opindex Wunused-but-set-parameter
6004 @opindex Wno-unused-but-set-parameter
6005 Warn whenever a function parameter is assigned to, but otherwise unused
6006 (aside from its declaration).
6007
6008 To suppress this warning use the @code{unused} attribute
6009 (@pxref{Variable Attributes}).
6010
6011 This warning is also enabled by @option{-Wunused} together with
6012 @option{-Wextra}.
6013
6014 @item -Wunused-but-set-variable
6015 @opindex Wunused-but-set-variable
6016 @opindex Wno-unused-but-set-variable
6017 Warn whenever a local variable is assigned to, but otherwise unused
6018 (aside from its declaration).
6019 This warning is enabled by @option{-Wall}.
6020
6021 To suppress this warning use the @code{unused} attribute
6022 (@pxref{Variable Attributes}).
6023
6024 This warning is also enabled by @option{-Wunused}, which is enabled
6025 by @option{-Wall}.
6026
6027 @item -Wunused-function
6028 @opindex Wunused-function
6029 @opindex Wno-unused-function
6030 Warn whenever a static function is declared but not defined or a
6031 non-inline static function is unused.
6032 This warning is enabled by @option{-Wall}.
6033
6034 @item -Wunused-label
6035 @opindex Wunused-label
6036 @opindex Wno-unused-label
6037 Warn whenever a label is declared but not used.
6038 This warning is enabled by @option{-Wall}.
6039
6040 To suppress this warning use the @code{unused} attribute
6041 (@pxref{Variable Attributes}).
6042
6043 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6044 @opindex Wunused-local-typedefs
6045 @opindex Wno-unused-local-typedefs
6046 Warn when a typedef locally defined in a function is not used.
6047 This warning is enabled by @option{-Wall}.
6048
6049 @item -Wunused-parameter
6050 @opindex Wunused-parameter
6051 @opindex Wno-unused-parameter
6052 Warn whenever a function parameter is unused aside from its declaration.
6053
6054 To suppress this warning use the @code{unused} attribute
6055 (@pxref{Variable Attributes}).
6056
6057 @item -Wno-unused-result
6058 @opindex Wunused-result
6059 @opindex Wno-unused-result
6060 Do not warn if a caller of a function marked with attribute
6061 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6062 its return value. The default is @option{-Wunused-result}.
6063
6064 @item -Wunused-variable
6065 @opindex Wunused-variable
6066 @opindex Wno-unused-variable
6067 Warn whenever a local or static variable is unused aside from its
6068 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6069 but not for C++. This warning is enabled by @option{-Wall}.
6070
6071 To suppress this warning use the @code{unused} attribute
6072 (@pxref{Variable Attributes}).
6073
6074 @item -Wunused-const-variable
6075 @itemx -Wunused-const-variable=@var{n}
6076 @opindex Wunused-const-variable
6077 @opindex Wno-unused-const-variable
6078 Warn whenever a constant static variable is unused aside from its declaration.
6079 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6080 for C, but not for C++. In C this declares variable storage, but in C++ this
6081 is not an error since const variables take the place of @code{#define}s.
6082
6083 To suppress this warning use the @code{unused} attribute
6084 (@pxref{Variable Attributes}).
6085
6086 @table @gcctabopt
6087 @item -Wunused-const-variable=1
6088 This is the warning level that is enabled by @option{-Wunused-variable} for
6089 C. It warns only about unused static const variables defined in the main
6090 compilation unit, but not about static const variables declared in any
6091 header included.
6092
6093 @item -Wunused-const-variable=2
6094 This warning level also warns for unused constant static variables in
6095 headers (excluding system headers). This is the warning level of
6096 @option{-Wunused-const-variable} and must be explicitly requested since
6097 in C++ this isn't an error and in C it might be harder to clean up all
6098 headers included.
6099 @end table
6100
6101 @item -Wunused-value
6102 @opindex Wunused-value
6103 @opindex Wno-unused-value
6104 Warn whenever a statement computes a result that is explicitly not
6105 used. To suppress this warning cast the unused expression to
6106 @code{void}. This includes an expression-statement or the left-hand
6107 side of a comma expression that contains no side effects. For example,
6108 an expression such as @code{x[i,j]} causes a warning, while
6109 @code{x[(void)i,j]} does not.
6110
6111 This warning is enabled by @option{-Wall}.
6112
6113 @item -Wunused
6114 @opindex Wunused
6115 @opindex Wno-unused
6116 All the above @option{-Wunused} options combined.
6117
6118 In order to get a warning about an unused function parameter, you must
6119 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6120 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6121
6122 @item -Wuninitialized
6123 @opindex Wuninitialized
6124 @opindex Wno-uninitialized
6125 Warn if an automatic variable is used without first being initialized.
6126 In C++, warn if a non-static reference or non-static @code{const}
6127 member appears in a class without constructors.
6128
6129 If you want to warn about code that uses the uninitialized value of the
6130 variable in its own initializer, use the @option{-Winit-self} option.
6131
6132 These warnings occur for individual uninitialized elements of
6133 structure, union or array variables as well as for variables that are
6134 uninitialized as a whole. They do not occur for variables or elements
6135 declared @code{volatile}. Because these warnings depend on
6136 optimization, the exact variables or elements for which there are
6137 warnings depend on the precise optimization options and version of GCC
6138 used.
6139
6140 Note that there may be no warning about a variable that is used only
6141 to compute a value that itself is never used, because such
6142 computations may be deleted by data flow analysis before the warnings
6143 are printed.
6144
6145 @item -Wno-invalid-memory-model
6146 @opindex Winvalid-memory-model
6147 @opindex Wno-invalid-memory-model
6148 This option controls warnings
6149 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6150 and the C11 atomic generic functions with a memory consistency argument
6151 that is either invalid for the operation or outside the range of values
6152 of the @code{memory_order} enumeration. For example, since the
6153 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6154 defined for the relaxed, release, and sequentially consistent memory
6155 orders the following code is diagnosed:
6156
6157 @smallexample
6158 void store (int *i)
6159 @{
6160 __atomic_store_n (i, 0, memory_order_consume);
6161 @}
6162 @end smallexample
6163
6164 @option{-Winvalid-memory-model} is enabled by default.
6165
6166 @item -Wmaybe-uninitialized
6167 @opindex Wmaybe-uninitialized
6168 @opindex Wno-maybe-uninitialized
6169 For an automatic (i.e.@: local) variable, if there exists a path from the
6170 function entry to a use of the variable that is initialized, but there exist
6171 some other paths for which the variable is not initialized, the compiler
6172 emits a warning if it cannot prove the uninitialized paths are not
6173 executed at run time.
6174
6175 These warnings are only possible in optimizing compilation, because otherwise
6176 GCC does not keep track of the state of variables.
6177
6178 These warnings are made optional because GCC may not be able to determine when
6179 the code is correct in spite of appearing to have an error. Here is one
6180 example of how this can happen:
6181
6182 @smallexample
6183 @group
6184 @{
6185 int x;
6186 switch (y)
6187 @{
6188 case 1: x = 1;
6189 break;
6190 case 2: x = 4;
6191 break;
6192 case 3: x = 5;
6193 @}
6194 foo (x);
6195 @}
6196 @end group
6197 @end smallexample
6198
6199 @noindent
6200 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6201 always initialized, but GCC doesn't know this. To suppress the
6202 warning, you need to provide a default case with assert(0) or
6203 similar code.
6204
6205 @cindex @code{longjmp} warnings
6206 This option also warns when a non-volatile automatic variable might be
6207 changed by a call to @code{longjmp}.
6208 The compiler sees only the calls to @code{setjmp}. It cannot know
6209 where @code{longjmp} will be called; in fact, a signal handler could
6210 call it at any point in the code. As a result, you may get a warning
6211 even when there is in fact no problem because @code{longjmp} cannot
6212 in fact be called at the place that would cause a problem.
6213
6214 Some spurious warnings can be avoided if you declare all the functions
6215 you use that never return as @code{noreturn}. @xref{Function
6216 Attributes}.
6217
6218 This warning is enabled by @option{-Wall} or @option{-Wextra}.
6219
6220 @item -Wunknown-pragmas
6221 @opindex Wunknown-pragmas
6222 @opindex Wno-unknown-pragmas
6223 @cindex warning for unknown pragmas
6224 @cindex unknown pragmas, warning
6225 @cindex pragmas, warning of unknown
6226 Warn when a @code{#pragma} directive is encountered that is not understood by
6227 GCC@. If this command-line option is used, warnings are even issued
6228 for unknown pragmas in system header files. This is not the case if
6229 the warnings are only enabled by the @option{-Wall} command-line option.
6230
6231 @item -Wno-pragmas
6232 @opindex Wno-pragmas
6233 @opindex Wpragmas
6234 Do not warn about misuses of pragmas, such as incorrect parameters,
6235 invalid syntax, or conflicts between pragmas. See also
6236 @option{-Wunknown-pragmas}.
6237
6238 @item -Wno-prio-ctor-dtor
6239 @opindex Wno-prio-ctor-dtor
6240 @opindex Wprio-ctor-dtor
6241 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6242 The use of constructor and destructor attributes allow you to assign a
6243 priority to the constructor/destructor to control its order of execution
6244 before @code{main} is called or after it returns. The priority values must be
6245 greater than 100 as the compiler reserves priority values between 0--100 for
6246 the implementation.
6247
6248 @item -Wstrict-aliasing
6249 @opindex Wstrict-aliasing
6250 @opindex Wno-strict-aliasing
6251 This option is only active when @option{-fstrict-aliasing} is active.
6252 It warns about code that might break the strict aliasing rules that the
6253 compiler is using for optimization. The warning does not catch all
6254 cases, but does attempt to catch the more common pitfalls. It is
6255 included in @option{-Wall}.
6256 It is equivalent to @option{-Wstrict-aliasing=3}
6257
6258 @item -Wstrict-aliasing=n
6259 @opindex Wstrict-aliasing=n
6260 This option is only active when @option{-fstrict-aliasing} is active.
6261 It warns about code that might break the strict aliasing rules that the
6262 compiler is using for optimization.
6263 Higher levels correspond to higher accuracy (fewer false positives).
6264 Higher levels also correspond to more effort, similar to the way @option{-O}
6265 works.
6266 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6267
6268 Level 1: Most aggressive, quick, least accurate.
6269 Possibly useful when higher levels
6270 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6271 false negatives. However, it has many false positives.
6272 Warns for all pointer conversions between possibly incompatible types,
6273 even if never dereferenced. Runs in the front end only.
6274
6275 Level 2: Aggressive, quick, not too precise.
6276 May still have many false positives (not as many as level 1 though),
6277 and few false negatives (but possibly more than level 1).
6278 Unlike level 1, it only warns when an address is taken. Warns about
6279 incomplete types. Runs in the front end only.
6280
6281 Level 3 (default for @option{-Wstrict-aliasing}):
6282 Should have very few false positives and few false
6283 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
6284 Takes care of the common pun+dereference pattern in the front end:
6285 @code{*(int*)&some_float}.
6286 If optimization is enabled, it also runs in the back end, where it deals
6287 with multiple statement cases using flow-sensitive points-to information.
6288 Only warns when the converted pointer is dereferenced.
6289 Does not warn about incomplete types.
6290
6291 @item -Wstrict-overflow
6292 @itemx -Wstrict-overflow=@var{n}
6293 @opindex Wstrict-overflow
6294 @opindex Wno-strict-overflow
6295 This option is only active when signed overflow is undefined.
6296 It warns about cases where the compiler optimizes based on the
6297 assumption that signed overflow does not occur. Note that it does not
6298 warn about all cases where the code might overflow: it only warns
6299 about cases where the compiler implements some optimization. Thus
6300 this warning depends on the optimization level.
6301
6302 An optimization that assumes that signed overflow does not occur is
6303 perfectly safe if the values of the variables involved are such that
6304 overflow never does, in fact, occur. Therefore this warning can
6305 easily give a false positive: a warning about code that is not
6306 actually a problem. To help focus on important issues, several
6307 warning levels are defined. No warnings are issued for the use of
6308 undefined signed overflow when estimating how many iterations a loop
6309 requires, in particular when determining whether a loop will be
6310 executed at all.
6311
6312 @table @gcctabopt
6313 @item -Wstrict-overflow=1
6314 Warn about cases that are both questionable and easy to avoid. For
6315 example the compiler simplifies
6316 @code{x + 1 > x} to @code{1}. This level of
6317 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6318 are not, and must be explicitly requested.
6319
6320 @item -Wstrict-overflow=2
6321 Also warn about other cases where a comparison is simplified to a
6322 constant. For example: @code{abs (x) >= 0}. This can only be
6323 simplified when signed integer overflow is undefined, because
6324 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6325 zero. @option{-Wstrict-overflow} (with no level) is the same as
6326 @option{-Wstrict-overflow=2}.
6327
6328 @item -Wstrict-overflow=3
6329 Also warn about other cases where a comparison is simplified. For
6330 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6331
6332 @item -Wstrict-overflow=4
6333 Also warn about other simplifications not covered by the above cases.
6334 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6335
6336 @item -Wstrict-overflow=5
6337 Also warn about cases where the compiler reduces the magnitude of a
6338 constant involved in a comparison. For example: @code{x + 2 > y} is
6339 simplified to @code{x + 1 >= y}. This is reported only at the
6340 highest warning level because this simplification applies to many
6341 comparisons, so this warning level gives a very large number of
6342 false positives.
6343 @end table
6344
6345 @item -Wstring-compare
6346 @opindex Wstring-compare
6347 @opindex Wno-string-compare
6348 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6349 determined to be either zero or non-zero in tests for such equality
6350 owing to the length of one argument being greater than the size of
6351 the array the other argument is stored in (or the bound in the case
6352 of @code{strncmp}). Such calls could be mistakes. For example,
6353 the call to @code{strcmp} below is diagnosed because its result is
6354 necessarily non-zero irrespective of the contents of the array @code{a}.
6355
6356 @smallexample
6357 extern char a[4];
6358 void f (char *d)
6359 @{
6360 strcpy (d, "string");
6361 @dots{}
6362 if (0 == strcmp (a, d)) // cannot be true
6363 puts ("a and d are the same");
6364 @}
6365 @end smallexample
6366
6367 @option{-Wstring-compare} is enabled by @option{-Wextra}.
6368
6369 @item -Wstringop-overflow
6370 @itemx -Wstringop-overflow=@var{type}
6371 @opindex Wstringop-overflow
6372 @opindex Wno-stringop-overflow
6373 Warn for calls to string manipulation functions such as @code{memcpy} and
6374 @code{strcpy} that are determined to overflow the destination buffer. The
6375 optional argument is one greater than the type of Object Size Checking to
6376 perform to determine the size of the destination. @xref{Object Size Checking}.
6377 The argument is meaningful only for functions that operate on character arrays
6378 but not for raw memory functions like @code{memcpy} which always make use
6379 of Object Size type-0. The option also warns for calls that specify a size
6380 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6381 The option produces the best results with optimization enabled but can detect
6382 a small subset of simple buffer overflows even without optimization in
6383 calls to the GCC built-in functions like @code{__builtin_memcpy} that
6384 correspond to the standard functions. In any case, the option warns about
6385 just a subset of buffer overflows detected by the corresponding overflow
6386 checking built-ins. For example, the option issues a warning for
6387 the @code{strcpy} call below because it copies at least 5 characters
6388 (the string @code{"blue"} including the terminating NUL) into the buffer
6389 of size 4.
6390
6391 @smallexample
6392 enum Color @{ blue, purple, yellow @};
6393 const char* f (enum Color clr)
6394 @{
6395 static char buf [4];
6396 const char *str;
6397 switch (clr)
6398 @{
6399 case blue: str = "blue"; break;
6400 case purple: str = "purple"; break;
6401 case yellow: str = "yellow"; break;
6402 @}
6403
6404 return strcpy (buf, str); // warning here
6405 @}
6406 @end smallexample
6407
6408 Option @option{-Wstringop-overflow=2} is enabled by default.
6409
6410 @table @gcctabopt
6411 @item -Wstringop-overflow
6412 @itemx -Wstringop-overflow=1
6413 @opindex Wstringop-overflow
6414 @opindex Wno-stringop-overflow
6415 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6416 to determine the sizes of destination objects. This is the default setting
6417 of the option. At this setting the option does not warn for writes past
6418 the end of subobjects of larger objects accessed by pointers unless the
6419 size of the largest surrounding object is known. When the destination may
6420 be one of several objects it is assumed to be the largest one of them. On
6421 Linux systems, when optimization is enabled at this setting the option warns
6422 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6423 a non-zero value.
6424
6425 @item -Wstringop-overflow=2
6426 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6427 to determine the sizes of destination objects. At this setting the option
6428 warna about overflows when writing to members of the largest complete
6429 objects whose exact size is known. However, it does not warn for excessive
6430 writes to the same members of unknown objects referenced by pointers since
6431 they may point to arrays containing unknown numbers of elements.
6432
6433 @item -Wstringop-overflow=3
6434 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6435 to determine the sizes of destination objects. At this setting the option
6436 warns about overflowing the smallest object or data member. This is the
6437 most restrictive setting of the option that may result in warnings for safe
6438 code.
6439
6440 @item -Wstringop-overflow=4
6441 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6442 to determine the sizes of destination objects. At this setting the option
6443 warns about overflowing any data members, and when the destination is
6444 one of several objects it uses the size of the largest of them to decide
6445 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
6446 setting of the option may result in warnings for benign code.
6447 @end table
6448
6449 @item -Wno-stringop-truncation
6450 @opindex Wstringop-truncation
6451 @opindex Wno-stringop-truncation
6452 Do not warn for calls to bounded string manipulation functions
6453 such as @code{strncat},
6454 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6455 or leave the destination unchanged.
6456
6457 In the following example, the call to @code{strncat} specifies a bound that
6458 is less than the length of the source string. As a result, the copy of
6459 the source will be truncated and so the call is diagnosed. To avoid the
6460 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6461
6462 @smallexample
6463 void append (char *buf, size_t bufsize)
6464 @{
6465 strncat (buf, ".txt", 3);
6466 @}
6467 @end smallexample
6468
6469 As another example, the following call to @code{strncpy} results in copying
6470 to @code{d} just the characters preceding the terminating NUL, without
6471 appending the NUL to the end. Assuming the result of @code{strncpy} is
6472 necessarily a NUL-terminated string is a common mistake, and so the call
6473 is diagnosed. To avoid the warning when the result is not expected to be
6474 NUL-terminated, call @code{memcpy} instead.
6475
6476 @smallexample
6477 void copy (char *d, const char *s)
6478 @{
6479 strncpy (d, s, strlen (s));
6480 @}
6481 @end smallexample
6482
6483 In the following example, the call to @code{strncpy} specifies the size
6484 of the destination buffer as the bound. If the length of the source
6485 string is equal to or greater than this size the result of the copy will
6486 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
6487 the warning, specify @code{sizeof buf - 1} as the bound and set the last
6488 element of the buffer to @code{NUL}.
6489
6490 @smallexample
6491 void copy (const char *s)
6492 @{
6493 char buf[80];
6494 strncpy (buf, s, sizeof buf);
6495 @dots{}
6496 @}
6497 @end smallexample
6498
6499 In situations where a character array is intended to store a sequence
6500 of bytes with no terminating @code{NUL} such an array may be annotated
6501 with attribute @code{nonstring} to avoid this warning. Such arrays,
6502 however, are not suitable arguments to functions that expect
6503 @code{NUL}-terminated strings. To help detect accidental misuses of
6504 such arrays GCC issues warnings unless it can prove that the use is
6505 safe. @xref{Common Variable Attributes}.
6506
6507 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6508 @opindex Wsuggest-attribute=
6509 @opindex Wno-suggest-attribute=
6510 Warn for cases where adding an attribute may be beneficial. The
6511 attributes currently supported are listed below.
6512
6513 @table @gcctabopt
6514 @item -Wsuggest-attribute=pure
6515 @itemx -Wsuggest-attribute=const
6516 @itemx -Wsuggest-attribute=noreturn
6517 @itemx -Wmissing-noreturn
6518 @itemx -Wsuggest-attribute=malloc
6519 @opindex Wsuggest-attribute=pure
6520 @opindex Wno-suggest-attribute=pure
6521 @opindex Wsuggest-attribute=const
6522 @opindex Wno-suggest-attribute=const
6523 @opindex Wsuggest-attribute=noreturn
6524 @opindex Wno-suggest-attribute=noreturn
6525 @opindex Wmissing-noreturn
6526 @opindex Wno-missing-noreturn
6527 @opindex Wsuggest-attribute=malloc
6528 @opindex Wno-suggest-attribute=malloc
6529
6530 Warn about functions that might be candidates for attributes
6531 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6532 only warns for functions visible in other compilation units or (in the case of
6533 @code{pure} and @code{const}) if it cannot prove that the function returns
6534 normally. A function returns normally if it doesn't contain an infinite loop or
6535 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6536 requires option @option{-fipa-pure-const}, which is enabled by default at
6537 @option{-O} and higher. Higher optimization levels improve the accuracy
6538 of the analysis.
6539
6540 @item -Wsuggest-attribute=format
6541 @itemx -Wmissing-format-attribute
6542 @opindex Wsuggest-attribute=format
6543 @opindex Wmissing-format-attribute
6544 @opindex Wno-suggest-attribute=format
6545 @opindex Wno-missing-format-attribute
6546 @opindex Wformat
6547 @opindex Wno-format
6548
6549 Warn about function pointers that might be candidates for @code{format}
6550 attributes. Note these are only possible candidates, not absolute ones.
6551 GCC guesses that function pointers with @code{format} attributes that
6552 are used in assignment, initialization, parameter passing or return
6553 statements should have a corresponding @code{format} attribute in the
6554 resulting type. I.e.@: the left-hand side of the assignment or
6555 initialization, the type of the parameter variable, or the return type
6556 of the containing function respectively should also have a @code{format}
6557 attribute to avoid the warning.
6558
6559 GCC also warns about function definitions that might be
6560 candidates for @code{format} attributes. Again, these are only
6561 possible candidates. GCC guesses that @code{format} attributes
6562 might be appropriate for any function that calls a function like
6563 @code{vprintf} or @code{vscanf}, but this might not always be the
6564 case, and some functions for which @code{format} attributes are
6565 appropriate may not be detected.
6566
6567 @item -Wsuggest-attribute=cold
6568 @opindex Wsuggest-attribute=cold
6569 @opindex Wno-suggest-attribute=cold
6570
6571 Warn about functions that might be candidates for @code{cold} attribute. This
6572 is based on static detection and generally only warns about functions which
6573 always leads to a call to another @code{cold} function such as wrappers of
6574 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6575 @end table
6576
6577 @item -Walloc-zero
6578 @opindex Wno-alloc-zero
6579 @opindex Walloc-zero
6580 Warn about calls to allocation functions decorated with attribute
6581 @code{alloc_size} that specify zero bytes, including those to the built-in
6582 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6583 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6584 when called with a zero size differs among implementations (and in the case
6585 of @code{realloc} has been deprecated) relying on it may result in subtle
6586 portability bugs and should be avoided.
6587
6588 @item -Walloc-size-larger-than=@var{byte-size}
6589 @opindex Walloc-size-larger-than=
6590 @opindex Wno-alloc-size-larger-than
6591 Warn about calls to functions decorated with attribute @code{alloc_size}
6592 that attempt to allocate objects larger than the specified number of bytes,
6593 or where the result of the size computation in an integer type with infinite
6594 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6595 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6596 Warnings controlled by the option can be disabled either by specifying
6597 @var{byte-size} of @samp{SIZE_MAX} or more or by
6598 @option{-Wno-alloc-size-larger-than}.
6599 @xref{Function Attributes}.
6600
6601 @item -Wno-alloc-size-larger-than
6602 @opindex Wno-alloc-size-larger-than
6603 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6604 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6605 larger.
6606
6607 @item -Walloca
6608 @opindex Wno-alloca
6609 @opindex Walloca
6610 This option warns on all uses of @code{alloca} in the source.
6611
6612 @item -Walloca-larger-than=@var{byte-size}
6613 @opindex Walloca-larger-than=
6614 @opindex Wno-alloca-larger-than
6615 This option warns on calls to @code{alloca} with an integer argument whose
6616 value is either zero, or that is not bounded by a controlling predicate
6617 that limits its value to at most @var{byte-size}. It also warns for calls
6618 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6619 types are considered unbounded even if they appear to be constrained to
6620 the expected range.
6621
6622 For example, a bounded case of @code{alloca} could be:
6623
6624 @smallexample
6625 void func (size_t n)
6626 @{
6627 void *p;
6628 if (n <= 1000)
6629 p = alloca (n);
6630 else
6631 p = malloc (n);
6632 f (p);
6633 @}
6634 @end smallexample
6635
6636 In the above example, passing @code{-Walloca-larger-than=1000} would not
6637 issue a warning because the call to @code{alloca} is known to be at most
6638 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6639 the compiler would emit a warning.
6640
6641 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6642 controlling predicate constraining its integer argument. For example:
6643
6644 @smallexample
6645 void func ()
6646 @{
6647 void *p = alloca (n);
6648 f (p);
6649 @}
6650 @end smallexample
6651
6652 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6653 a warning, but this time because of the lack of bounds checking.
6654
6655 Note, that even seemingly correct code involving signed integers could
6656 cause a warning:
6657
6658 @smallexample
6659 void func (signed int n)
6660 @{
6661 if (n < 500)
6662 @{
6663 p = alloca (n);
6664 f (p);
6665 @}
6666 @}
6667 @end smallexample
6668
6669 In the above example, @var{n} could be negative, causing a larger than
6670 expected argument to be implicitly cast into the @code{alloca} call.
6671
6672 This option also warns when @code{alloca} is used in a loop.
6673
6674 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6675 but is usually only effective when @option{-ftree-vrp} is active (default
6676 for @option{-O2} and above).
6677
6678 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6679
6680 @item -Wno-alloca-larger-than
6681 @opindex Wno-alloca-larger-than
6682 Disable @option{-Walloca-larger-than=} warnings. The option is
6683 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6684
6685 @item -Warith-conversion
6686 @opindex Warith-conversion
6687 @opindex Wno-arith-conversion
6688 Do warn about implicit conversions from arithmetic operations even
6689 when conversion of the operands to the same type cannot change their
6690 values. This affects warnings from @option{-Wconversion},
6691 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
6692
6693 @smallexample
6694 @group
6695 void f (char c, int i)
6696 @{
6697 c = c + i; // warns with @option{-Wconversion}
6698 c = c + 1; // only warns with @option{-Warith-conversion}
6699 @}
6700 @end group
6701 @end smallexample
6702
6703 @item -Warray-bounds
6704 @itemx -Warray-bounds=@var{n}
6705 @opindex Wno-array-bounds
6706 @opindex Warray-bounds
6707 This option is only active when @option{-ftree-vrp} is active
6708 (default for @option{-O2} and above). It warns about subscripts to arrays
6709 that are always out of bounds. This warning is enabled by @option{-Wall}.
6710
6711 @table @gcctabopt
6712 @item -Warray-bounds=1
6713 This is the warning level of @option{-Warray-bounds} and is enabled
6714 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6715
6716 @item -Warray-bounds=2
6717 This warning level also warns about out of bounds access for
6718 arrays at the end of a struct and for arrays accessed through
6719 pointers. This warning level may give a larger number of
6720 false positives and is deactivated by default.
6721 @end table
6722
6723 @item -Wattribute-alias=@var{n}
6724 @itemx -Wno-attribute-alias
6725 @opindex Wattribute-alias
6726 @opindex Wno-attribute-alias
6727 Warn about declarations using the @code{alias} and similar attributes whose
6728 target is incompatible with the type of the alias.
6729 @xref{Function Attributes,,Declaring Attributes of Functions}.
6730
6731 @table @gcctabopt
6732 @item -Wattribute-alias=1
6733 The default warning level of the @option{-Wattribute-alias} option diagnoses
6734 incompatibilities between the type of the alias declaration and that of its
6735 target. Such incompatibilities are typically indicative of bugs.
6736
6737 @item -Wattribute-alias=2
6738
6739 At this level @option{-Wattribute-alias} also diagnoses cases where
6740 the attributes of the alias declaration are more restrictive than the
6741 attributes applied to its target. These mismatches can potentially
6742 result in incorrect code generation. In other cases they may be
6743 benign and could be resolved simply by adding the missing attribute to
6744 the target. For comparison, see the @option{-Wmissing-attributes}
6745 option, which controls diagnostics when the alias declaration is less
6746 restrictive than the target, rather than more restrictive.
6747
6748 Attributes considered include @code{alloc_align}, @code{alloc_size},
6749 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6750 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6751 @code{returns_nonnull}, and @code{returns_twice}.
6752 @end table
6753
6754 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6755 This is the default. You can disable these warnings with either
6756 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6757
6758 @item -Wbool-compare
6759 @opindex Wno-bool-compare
6760 @opindex Wbool-compare
6761 Warn about boolean expression compared with an integer value different from
6762 @code{true}/@code{false}. For instance, the following comparison is
6763 always false:
6764 @smallexample
6765 int n = 5;
6766 @dots{}
6767 if ((n > 1) == 2) @{ @dots{} @}
6768 @end smallexample
6769 This warning is enabled by @option{-Wall}.
6770
6771 @item -Wbool-operation
6772 @opindex Wno-bool-operation
6773 @opindex Wbool-operation
6774 Warn about suspicious operations on expressions of a boolean type. For
6775 instance, bitwise negation of a boolean is very likely a bug in the program.
6776 For C, this warning also warns about incrementing or decrementing a boolean,
6777 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6778 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6779
6780 This warning is enabled by @option{-Wall}.
6781
6782 @item -Wduplicated-branches
6783 @opindex Wno-duplicated-branches
6784 @opindex Wduplicated-branches
6785 Warn when an if-else has identical branches. This warning detects cases like
6786 @smallexample
6787 if (p != NULL)
6788 return 0;
6789 else
6790 return 0;
6791 @end smallexample
6792 It doesn't warn when both branches contain just a null statement. This warning
6793 also warn for conditional operators:
6794 @smallexample
6795 int i = x ? *p : *p;
6796 @end smallexample
6797
6798 @item -Wduplicated-cond
6799 @opindex Wno-duplicated-cond
6800 @opindex Wduplicated-cond
6801 Warn about duplicated conditions in an if-else-if chain. For instance,
6802 warn for the following code:
6803 @smallexample
6804 if (p->q != NULL) @{ @dots{} @}
6805 else if (p->q != NULL) @{ @dots{} @}
6806 @end smallexample
6807
6808 @item -Wframe-address
6809 @opindex Wno-frame-address
6810 @opindex Wframe-address
6811 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6812 is called with an argument greater than 0. Such calls may return indeterminate
6813 values or crash the program. The warning is included in @option{-Wall}.
6814
6815 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6816 @opindex Wno-discarded-qualifiers
6817 @opindex Wdiscarded-qualifiers
6818 Do not warn if type qualifiers on pointers are being discarded.
6819 Typically, the compiler warns if a @code{const char *} variable is
6820 passed to a function that takes a @code{char *} parameter. This option
6821 can be used to suppress such a warning.
6822
6823 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6824 @opindex Wno-discarded-array-qualifiers
6825 @opindex Wdiscarded-array-qualifiers
6826 Do not warn if type qualifiers on arrays which are pointer targets
6827 are being discarded. Typically, the compiler warns if a
6828 @code{const int (*)[]} variable is passed to a function that
6829 takes a @code{int (*)[]} parameter. This option can be used to
6830 suppress such a warning.
6831
6832 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6833 @opindex Wno-incompatible-pointer-types
6834 @opindex Wincompatible-pointer-types
6835 Do not warn when there is a conversion between pointers that have incompatible
6836 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6837 which warns for pointer argument passing or assignment with different
6838 signedness.
6839
6840 @item -Wno-int-conversion @r{(C and Objective-C only)}
6841 @opindex Wno-int-conversion
6842 @opindex Wint-conversion
6843 Do not warn about incompatible integer to pointer and pointer to integer
6844 conversions. This warning is about implicit conversions; for explicit
6845 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6846 @option{-Wno-pointer-to-int-cast} may be used.
6847
6848 @item -Wzero-length-bounds
6849 @opindex Wzero-length-bounds
6850 @opindex Wzero-length-bounds
6851 Warn about accesses to elements of zero-length array members that might
6852 overlap other members of the same object. Declaring interior zero-length
6853 arrays is discouraged because accesses to them are undefined. See
6854 @xref{Zero Length}.
6855
6856 For example, the first two stores in function @code{bad} are diagnosed
6857 because the array elements overlap the subsequent members @code{b} and
6858 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
6859 because it is beyond the bounds of the enclosing object.
6860
6861 @smallexample
6862 struct X @{ int a[0]; int b, c; @};
6863 struct X x;
6864
6865 void bad (void)
6866 @{
6867 x.a[0] = 0; // -Wzero-length-bounds
6868 x.a[1] = 1; // -Wzero-length-bounds
6869 x.a[2] = 2; // -Warray-bounds
6870 @}
6871 @end smallexample
6872
6873 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6874
6875 @item -Wno-div-by-zero
6876 @opindex Wno-div-by-zero
6877 @opindex Wdiv-by-zero
6878 Do not warn about compile-time integer division by zero. Floating-point
6879 division by zero is not warned about, as it can be a legitimate way of
6880 obtaining infinities and NaNs.
6881
6882 @item -Wsystem-headers
6883 @opindex Wsystem-headers
6884 @opindex Wno-system-headers
6885 @cindex warnings from system headers
6886 @cindex system headers, warnings from
6887 Print warning messages for constructs found in system header files.
6888 Warnings from system headers are normally suppressed, on the assumption
6889 that they usually do not indicate real problems and would only make the
6890 compiler output harder to read. Using this command-line option tells
6891 GCC to emit warnings from system headers as if they occurred in user
6892 code. However, note that using @option{-Wall} in conjunction with this
6893 option does @emph{not} warn about unknown pragmas in system
6894 headers---for that, @option{-Wunknown-pragmas} must also be used.
6895
6896 @item -Wtautological-compare
6897 @opindex Wtautological-compare
6898 @opindex Wno-tautological-compare
6899 Warn if a self-comparison always evaluates to true or false. This
6900 warning detects various mistakes such as:
6901 @smallexample
6902 int i = 1;
6903 @dots{}
6904 if (i > i) @{ @dots{} @}
6905 @end smallexample
6906
6907 This warning also warns about bitwise comparisons that always evaluate
6908 to true or false, for instance:
6909 @smallexample
6910 if ((a & 16) == 10) @{ @dots{} @}
6911 @end smallexample
6912 will always be false.
6913
6914 This warning is enabled by @option{-Wall}.
6915
6916 @item -Wtrampolines
6917 @opindex Wtrampolines
6918 @opindex Wno-trampolines
6919 Warn about trampolines generated for pointers to nested functions.
6920 A trampoline is a small piece of data or code that is created at run
6921 time on the stack when the address of a nested function is taken, and is
6922 used to call the nested function indirectly. For some targets, it is
6923 made up of data only and thus requires no special treatment. But, for
6924 most targets, it is made up of code and thus requires the stack to be
6925 made executable in order for the program to work properly.
6926
6927 @item -Wfloat-equal
6928 @opindex Wfloat-equal
6929 @opindex Wno-float-equal
6930 Warn if floating-point values are used in equality comparisons.
6931
6932 The idea behind this is that sometimes it is convenient (for the
6933 programmer) to consider floating-point values as approximations to
6934 infinitely precise real numbers. If you are doing this, then you need
6935 to compute (by analyzing the code, or in some other way) the maximum or
6936 likely maximum error that the computation introduces, and allow for it
6937 when performing comparisons (and when producing output, but that's a
6938 different problem). In particular, instead of testing for equality, you
6939 should check to see whether the two values have ranges that overlap; and
6940 this is done with the relational operators, so equality comparisons are
6941 probably mistaken.
6942
6943 @item -Wtraditional @r{(C and Objective-C only)}
6944 @opindex Wtraditional
6945 @opindex Wno-traditional
6946 Warn about certain constructs that behave differently in traditional and
6947 ISO C@. Also warn about ISO C constructs that have no traditional C
6948 equivalent, and/or problematic constructs that should be avoided.
6949
6950 @itemize @bullet
6951 @item
6952 Macro parameters that appear within string literals in the macro body.
6953 In traditional C macro replacement takes place within string literals,
6954 but in ISO C it does not.
6955
6956 @item
6957 In traditional C, some preprocessor directives did not exist.
6958 Traditional preprocessors only considered a line to be a directive
6959 if the @samp{#} appeared in column 1 on the line. Therefore
6960 @option{-Wtraditional} warns about directives that traditional C
6961 understands but ignores because the @samp{#} does not appear as the
6962 first character on the line. It also suggests you hide directives like
6963 @code{#pragma} not understood by traditional C by indenting them. Some
6964 traditional implementations do not recognize @code{#elif}, so this option
6965 suggests avoiding it altogether.
6966
6967 @item
6968 A function-like macro that appears without arguments.
6969
6970 @item
6971 The unary plus operator.
6972
6973 @item
6974 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6975 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6976 constants.) Note, these suffixes appear in macros defined in the system
6977 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6978 Use of these macros in user code might normally lead to spurious
6979 warnings, however GCC's integrated preprocessor has enough context to
6980 avoid warning in these cases.
6981
6982 @item
6983 A function declared external in one block and then used after the end of
6984 the block.
6985
6986 @item
6987 A @code{switch} statement has an operand of type @code{long}.
6988
6989 @item
6990 A non-@code{static} function declaration follows a @code{static} one.
6991 This construct is not accepted by some traditional C compilers.
6992
6993 @item
6994 The ISO type of an integer constant has a different width or
6995 signedness from its traditional type. This warning is only issued if
6996 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6997 typically represent bit patterns, are not warned about.
6998
6999 @item
7000 Usage of ISO string concatenation is detected.
7001
7002 @item
7003 Initialization of automatic aggregates.
7004
7005 @item
7006 Identifier conflicts with labels. Traditional C lacks a separate
7007 namespace for labels.
7008
7009 @item
7010 Initialization of unions. If the initializer is zero, the warning is
7011 omitted. This is done under the assumption that the zero initializer in
7012 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7013 initializer warnings and relies on default initialization to zero in the
7014 traditional C case.
7015
7016 @item
7017 Conversions by prototypes between fixed/floating-point values and vice
7018 versa. The absence of these prototypes when compiling with traditional
7019 C causes serious problems. This is a subset of the possible
7020 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7021
7022 @item
7023 Use of ISO C style function definitions. This warning intentionally is
7024 @emph{not} issued for prototype declarations or variadic functions
7025 because these ISO C features appear in your code when using
7026 libiberty's traditional C compatibility macros, @code{PARAMS} and
7027 @code{VPARAMS}. This warning is also bypassed for nested functions
7028 because that feature is already a GCC extension and thus not relevant to
7029 traditional C compatibility.
7030 @end itemize
7031
7032 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7033 @opindex Wtraditional-conversion
7034 @opindex Wno-traditional-conversion
7035 Warn if a prototype causes a type conversion that is different from what
7036 would happen to the same argument in the absence of a prototype. This
7037 includes conversions of fixed point to floating and vice versa, and
7038 conversions changing the width or signedness of a fixed-point argument
7039 except when the same as the default promotion.
7040
7041 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7042 @opindex Wdeclaration-after-statement
7043 @opindex Wno-declaration-after-statement
7044 Warn when a declaration is found after a statement in a block. This
7045 construct, known from C++, was introduced with ISO C99 and is by default
7046 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
7047
7048 @item -Wshadow
7049 @opindex Wshadow
7050 @opindex Wno-shadow
7051 Warn whenever a local variable or type declaration shadows another
7052 variable, parameter, type, class member (in C++), or instance variable
7053 (in Objective-C) or whenever a built-in function is shadowed. Note
7054 that in C++, the compiler warns if a local variable shadows an
7055 explicit typedef, but not if it shadows a struct/class/enum.
7056 If this warning is enabled, it includes also all instances of
7057 local shadowing. This means that @option{-Wno-shadow=local}
7058 and @option{-Wno-shadow=compatible-local} are ignored when
7059 @option{-Wshadow} is used.
7060 Same as @option{-Wshadow=global}.
7061
7062 @item -Wno-shadow-ivar @r{(Objective-C only)}
7063 @opindex Wno-shadow-ivar
7064 @opindex Wshadow-ivar
7065 Do not warn whenever a local variable shadows an instance variable in an
7066 Objective-C method.
7067
7068 @item -Wshadow=global
7069 @opindex Wshadow=global
7070 Warn for any shadowing.
7071 Same as @option{-Wshadow}.
7072
7073 @item -Wshadow=local
7074 @opindex Wshadow=local
7075 Warn when a local variable shadows another local variable or parameter.
7076
7077 @item -Wshadow=compatible-local
7078 @opindex Wshadow=compatible-local
7079 Warn when a local variable shadows another local variable or parameter
7080 whose type is compatible with that of the shadowing variable. In C++,
7081 type compatibility here means the type of the shadowing variable can be
7082 converted to that of the shadowed variable. The creation of this flag
7083 (in addition to @option{-Wshadow=local}) is based on the idea that when
7084 a local variable shadows another one of incompatible type, it is most
7085 likely intentional, not a bug or typo, as shown in the following example:
7086
7087 @smallexample
7088 @group
7089 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7090 @{
7091 for (int i = 0; i < N; ++i)
7092 @{
7093 ...
7094 @}
7095 ...
7096 @}
7097 @end group
7098 @end smallexample
7099
7100 Since the two variable @code{i} in the example above have incompatible types,
7101 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7102 Because their types are incompatible, if a programmer accidentally uses one
7103 in place of the other, type checking is expected to catch that and emit an
7104 error or warning. Use of this flag instead of @option{-Wshadow=local} can
7105 possibly reduce the number of warnings triggered by intentional shadowing.
7106 Note that this also means that shadowing @code{const char *i} by
7107 @code{char *i} does not emit a warning.
7108
7109 This warning is also enabled by @option{-Wshadow=local}.
7110
7111 @item -Wlarger-than=@var{byte-size}
7112 @opindex Wlarger-than=
7113 @opindex Wlarger-than-@var{byte-size}
7114 Warn whenever an object is defined whose size exceeds @var{byte-size}.
7115 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7116 Warnings controlled by the option can be disabled either by specifying
7117 @var{byte-size} of @samp{SIZE_MAX} or more or by
7118 @option{-Wno-larger-than}.
7119
7120 @item -Wno-larger-than
7121 @opindex Wno-larger-than
7122 Disable @option{-Wlarger-than=} warnings. The option is equivalent
7123 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7124
7125 @item -Wframe-larger-than=@var{byte-size}
7126 @opindex Wframe-larger-than=
7127 @opindex Wno-frame-larger-than
7128 Warn if the size of a function frame exceeds @var{byte-size}.
7129 The computation done to determine the stack frame size is approximate
7130 and not conservative.
7131 The actual requirements may be somewhat greater than @var{byte-size}
7132 even if you do not get a warning. In addition, any space allocated
7133 via @code{alloca}, variable-length arrays, or related constructs
7134 is not included by the compiler when determining
7135 whether or not to issue a warning.
7136 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7137 Warnings controlled by the option can be disabled either by specifying
7138 @var{byte-size} of @samp{SIZE_MAX} or more or by
7139 @option{-Wno-frame-larger-than}.
7140
7141 @item -Wno-frame-larger-than
7142 @opindex Wno-frame-larger-than
7143 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
7144 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7145
7146 @item -Wno-free-nonheap-object
7147 @opindex Wno-free-nonheap-object
7148 @opindex Wfree-nonheap-object
7149 Do not warn when attempting to free an object that was not allocated
7150 on the heap.
7151
7152 @item -Wstack-usage=@var{byte-size}
7153 @opindex Wstack-usage
7154 @opindex Wno-stack-usage
7155 Warn if the stack usage of a function might exceed @var{byte-size}.
7156 The computation done to determine the stack usage is conservative.
7157 Any space allocated via @code{alloca}, variable-length arrays, or related
7158 constructs is included by the compiler when determining whether or not to
7159 issue a warning.
7160
7161 The message is in keeping with the output of @option{-fstack-usage}.
7162
7163 @itemize
7164 @item
7165 If the stack usage is fully static but exceeds the specified amount, it's:
7166
7167 @smallexample
7168 warning: stack usage is 1120 bytes
7169 @end smallexample
7170 @item
7171 If the stack usage is (partly) dynamic but bounded, it's:
7172
7173 @smallexample
7174 warning: stack usage might be 1648 bytes
7175 @end smallexample
7176 @item
7177 If the stack usage is (partly) dynamic and not bounded, it's:
7178
7179 @smallexample
7180 warning: stack usage might be unbounded
7181 @end smallexample
7182 @end itemize
7183
7184 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7185 Warnings controlled by the option can be disabled either by specifying
7186 @var{byte-size} of @samp{SIZE_MAX} or more or by
7187 @option{-Wno-stack-usage}.
7188
7189 @item -Wno-stack-usage
7190 @opindex Wno-stack-usage
7191 Disable @option{-Wstack-usage=} warnings. The option is equivalent
7192 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7193
7194 @item -Wunsafe-loop-optimizations
7195 @opindex Wunsafe-loop-optimizations
7196 @opindex Wno-unsafe-loop-optimizations
7197 Warn if the loop cannot be optimized because the compiler cannot
7198 assume anything on the bounds of the loop indices. With
7199 @option{-funsafe-loop-optimizations} warn if the compiler makes
7200 such assumptions.
7201
7202 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7203 @opindex Wno-pedantic-ms-format
7204 @opindex Wpedantic-ms-format
7205 When used in combination with @option{-Wformat}
7206 and @option{-pedantic} without GNU extensions, this option
7207 disables the warnings about non-ISO @code{printf} / @code{scanf} format
7208 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7209 which depend on the MS runtime.
7210
7211 @item -Wpointer-arith
7212 @opindex Wpointer-arith
7213 @opindex Wno-pointer-arith
7214 Warn about anything that depends on the ``size of'' a function type or
7215 of @code{void}. GNU C assigns these types a size of 1, for
7216 convenience in calculations with @code{void *} pointers and pointers
7217 to functions. In C++, warn also when an arithmetic operation involves
7218 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
7219
7220 @item -Wno-pointer-compare
7221 @opindex Wpointer-compare
7222 @opindex Wno-pointer-compare
7223 Do not warn if a pointer is compared with a zero character constant.
7224 This usually
7225 means that the pointer was meant to be dereferenced. For example:
7226
7227 @smallexample
7228 const char *p = foo ();
7229 if (p == '\0')
7230 return 42;
7231 @end smallexample
7232
7233 Note that the code above is invalid in C++11.
7234
7235 This warning is enabled by default.
7236
7237 @item -Wtype-limits
7238 @opindex Wtype-limits
7239 @opindex Wno-type-limits
7240 Warn if a comparison is always true or always false due to the limited
7241 range of the data type, but do not warn for constant expressions. For
7242 example, warn if an unsigned variable is compared against zero with
7243 @code{<} or @code{>=}. This warning is also enabled by
7244 @option{-Wextra}.
7245
7246 @item -Wabsolute-value @r{(C and Objective-C only)}
7247 @opindex Wabsolute-value
7248 @opindex Wno-absolute-value
7249 Warn for calls to standard functions that compute the absolute value
7250 of an argument when a more appropriate standard function is available.
7251 For example, calling @code{abs(3.14)} triggers the warning because the
7252 appropriate function to call to compute the absolute value of a double
7253 argument is @code{fabs}. The option also triggers warnings when the
7254 argument in a call to such a function has an unsigned type. This
7255 warning can be suppressed with an explicit type cast and it is also
7256 enabled by @option{-Wextra}.
7257
7258 @include cppwarnopts.texi
7259
7260 @item -Wbad-function-cast @r{(C and Objective-C only)}
7261 @opindex Wbad-function-cast
7262 @opindex Wno-bad-function-cast
7263 Warn when a function call is cast to a non-matching type.
7264 For example, warn if a call to a function returning an integer type
7265 is cast to a pointer type.
7266
7267 @item -Wc90-c99-compat @r{(C and Objective-C only)}
7268 @opindex Wc90-c99-compat
7269 @opindex Wno-c90-c99-compat
7270 Warn about features not present in ISO C90, but present in ISO C99.
7271 For instance, warn about use of variable length arrays, @code{long long}
7272 type, @code{bool} type, compound literals, designated initializers, and so
7273 on. This option is independent of the standards mode. Warnings are disabled
7274 in the expression that follows @code{__extension__}.
7275
7276 @item -Wc99-c11-compat @r{(C and Objective-C only)}
7277 @opindex Wc99-c11-compat
7278 @opindex Wno-c99-c11-compat
7279 Warn about features not present in ISO C99, but present in ISO C11.
7280 For instance, warn about use of anonymous structures and unions,
7281 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7282 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7283 and so on. This option is independent of the standards mode. Warnings are
7284 disabled in the expression that follows @code{__extension__}.
7285
7286 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
7287 @opindex Wc11-c2x-compat
7288 @opindex Wno-c11-c2x-compat
7289 Warn about features not present in ISO C11, but present in ISO C2X.
7290 For instance, warn about omitting the string in @code{_Static_assert},
7291 use of @samp{[[]]} syntax for attributes, use of decimal
7292 floating-point types, and so on. This option is independent of the
7293 standards mode. Warnings are disabled in the expression that follows
7294 @code{__extension__}.
7295
7296 @item -Wc++-compat @r{(C and Objective-C only)}
7297 @opindex Wc++-compat
7298 @opindex Wno-c++-compat
7299 Warn about ISO C constructs that are outside of the common subset of
7300 ISO C and ISO C++, e.g.@: request for implicit conversion from
7301 @code{void *} to a pointer to non-@code{void} type.
7302
7303 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7304 @opindex Wc++11-compat
7305 @opindex Wno-c++11-compat
7306 Warn about C++ constructs whose meaning differs between ISO C++ 1998
7307 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7308 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
7309 enabled by @option{-Wall}.
7310
7311 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7312 @opindex Wc++14-compat
7313 @opindex Wno-c++14-compat
7314 Warn about C++ constructs whose meaning differs between ISO C++ 2011
7315 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
7316
7317 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7318 @opindex Wc++17-compat
7319 @opindex Wno-c++17-compat
7320 Warn about C++ constructs whose meaning differs between ISO C++ 2014
7321 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
7322
7323 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7324 @opindex Wc++20-compat
7325 @opindex Wno-c++20-compat
7326 Warn about C++ constructs whose meaning differs between ISO C++ 2017
7327 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
7328
7329 @item -Wcast-qual
7330 @opindex Wcast-qual
7331 @opindex Wno-cast-qual
7332 Warn whenever a pointer is cast so as to remove a type qualifier from
7333 the target type. For example, warn if a @code{const char *} is cast
7334 to an ordinary @code{char *}.
7335
7336 Also warn when making a cast that introduces a type qualifier in an
7337 unsafe way. For example, casting @code{char **} to @code{const char **}
7338 is unsafe, as in this example:
7339
7340 @smallexample
7341 /* p is char ** value. */
7342 const char **q = (const char **) p;
7343 /* Assignment of readonly string to const char * is OK. */
7344 *q = "string";
7345 /* Now char** pointer points to read-only memory. */
7346 **p = 'b';
7347 @end smallexample
7348
7349 @item -Wcast-align
7350 @opindex Wcast-align
7351 @opindex Wno-cast-align
7352 Warn whenever a pointer is cast such that the required alignment of the
7353 target is increased. For example, warn if a @code{char *} is cast to
7354 an @code{int *} on machines where integers can only be accessed at
7355 two- or four-byte boundaries.
7356
7357 @item -Wcast-align=strict
7358 @opindex Wcast-align=strict
7359 Warn whenever a pointer is cast such that the required alignment of the
7360 target is increased. For example, warn if a @code{char *} is cast to
7361 an @code{int *} regardless of the target machine.
7362
7363 @item -Wcast-function-type
7364 @opindex Wcast-function-type
7365 @opindex Wno-cast-function-type
7366 Warn when a function pointer is cast to an incompatible function pointer.
7367 In a cast involving function types with a variable argument list only
7368 the types of initial arguments that are provided are considered.
7369 Any parameter of pointer-type matches any other pointer-type. Any benign
7370 differences in integral types are ignored, like @code{int} vs.@: @code{long}
7371 on ILP32 targets. Likewise type qualifiers are ignored. The function
7372 type @code{void (*) (void)} is special and matches everything, which can
7373 be used to suppress this warning.
7374 In a cast involving pointer to member types this warning warns whenever
7375 the type cast is changing the pointer to member type.
7376 This warning is enabled by @option{-Wextra}.
7377
7378 @item -Wwrite-strings
7379 @opindex Wwrite-strings
7380 @opindex Wno-write-strings
7381 When compiling C, give string constants the type @code{const
7382 char[@var{length}]} so that copying the address of one into a
7383 non-@code{const} @code{char *} pointer produces a warning. These
7384 warnings help you find at compile time code that can try to write
7385 into a string constant, but only if you have been very careful about
7386 using @code{const} in declarations and prototypes. Otherwise, it is
7387 just a nuisance. This is why we did not make @option{-Wall} request
7388 these warnings.
7389
7390 When compiling C++, warn about the deprecated conversion from string
7391 literals to @code{char *}. This warning is enabled by default for C++
7392 programs.
7393
7394 @item -Wclobbered
7395 @opindex Wclobbered
7396 @opindex Wno-clobbered
7397 Warn for variables that might be changed by @code{longjmp} or
7398 @code{vfork}. This warning is also enabled by @option{-Wextra}.
7399
7400 @item -Wconversion
7401 @opindex Wconversion
7402 @opindex Wno-conversion
7403 Warn for implicit conversions that may alter a value. This includes
7404 conversions between real and integer, like @code{abs (x)} when
7405 @code{x} is @code{double}; conversions between signed and unsigned,
7406 like @code{unsigned ui = -1}; and conversions to smaller types, like
7407 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7408 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7409 changed by the conversion like in @code{abs (2.0)}. Warnings about
7410 conversions between signed and unsigned integers can be disabled by
7411 using @option{-Wno-sign-conversion}.
7412
7413 For C++, also warn for confusing overload resolution for user-defined
7414 conversions; and conversions that never use a type conversion
7415 operator: conversions to @code{void}, the same type, a base class or a
7416 reference to them. Warnings about conversions between signed and
7417 unsigned integers are disabled by default in C++ unless
7418 @option{-Wsign-conversion} is explicitly enabled.
7419
7420 Warnings about conversion from arithmetic on a small type back to that
7421 type are only given with @option{-Warith-conversion}.
7422
7423 @item -Wdangling-else
7424 @opindex Wdangling-else
7425 @opindex Wno-dangling-else
7426 Warn about constructions where there may be confusion to which
7427 @code{if} statement an @code{else} branch belongs. Here is an example of
7428 such a case:
7429
7430 @smallexample
7431 @group
7432 @{
7433 if (a)
7434 if (b)
7435 foo ();
7436 else
7437 bar ();
7438 @}
7439 @end group
7440 @end smallexample
7441
7442 In C/C++, every @code{else} branch belongs to the innermost possible
7443 @code{if} statement, which in this example is @code{if (b)}. This is
7444 often not what the programmer expected, as illustrated in the above
7445 example by indentation the programmer chose. When there is the
7446 potential for this confusion, GCC issues a warning when this flag
7447 is specified. To eliminate the warning, add explicit braces around
7448 the innermost @code{if} statement so there is no way the @code{else}
7449 can belong to the enclosing @code{if}. The resulting code
7450 looks like this:
7451
7452 @smallexample
7453 @group
7454 @{
7455 if (a)
7456 @{
7457 if (b)
7458 foo ();
7459 else
7460 bar ();
7461 @}
7462 @}
7463 @end group
7464 @end smallexample
7465
7466 This warning is enabled by @option{-Wparentheses}.
7467
7468 @item -Wdate-time
7469 @opindex Wdate-time
7470 @opindex Wno-date-time
7471 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7472 are encountered as they might prevent bit-wise-identical reproducible
7473 compilations.
7474
7475 @item -Wempty-body
7476 @opindex Wempty-body
7477 @opindex Wno-empty-body
7478 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7479 while} statement. This warning is also enabled by @option{-Wextra}.
7480
7481 @item -Wno-endif-labels
7482 @opindex Wendif-labels
7483 @opindex Wno-endif-labels
7484 Do not warn about stray tokens after @code{#else} and @code{#endif}.
7485
7486 @item -Wenum-compare
7487 @opindex Wenum-compare
7488 @opindex Wno-enum-compare
7489 Warn about a comparison between values of different enumerated types.
7490 In C++ enumerated type mismatches in conditional expressions are also
7491 diagnosed and the warning is enabled by default. In C this warning is
7492 enabled by @option{-Wall}.
7493
7494 @item -Wenum-conversion @r{(C, Objective-C only)}
7495 @opindex Wenum-conversion
7496 @opindex Wno-enum-conversion
7497 Warn when a value of enumerated type is implicitly converted to a
7498 different enumerated type. This warning is enabled by @option{-Wextra}.
7499
7500 @item -Wjump-misses-init @r{(C, Objective-C only)}
7501 @opindex Wjump-misses-init
7502 @opindex Wno-jump-misses-init
7503 Warn if a @code{goto} statement or a @code{switch} statement jumps
7504 forward across the initialization of a variable, or jumps backward to a
7505 label after the variable has been initialized. This only warns about
7506 variables that are initialized when they are declared. This warning is
7507 only supported for C and Objective-C; in C++ this sort of branch is an
7508 error in any case.
7509
7510 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7511 can be disabled with the @option{-Wno-jump-misses-init} option.
7512
7513 @item -Wsign-compare
7514 @opindex Wsign-compare
7515 @opindex Wno-sign-compare
7516 @cindex warning for comparison of signed and unsigned values
7517 @cindex comparison of signed and unsigned values, warning
7518 @cindex signed and unsigned values, comparison warning
7519 Warn when a comparison between signed and unsigned values could produce
7520 an incorrect result when the signed value is converted to unsigned.
7521 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7522 also enabled by @option{-Wextra}.
7523
7524 @item -Wsign-conversion
7525 @opindex Wsign-conversion
7526 @opindex Wno-sign-conversion
7527 Warn for implicit conversions that may change the sign of an integer
7528 value, like assigning a signed integer expression to an unsigned
7529 integer variable. An explicit cast silences the warning. In C, this
7530 option is enabled also by @option{-Wconversion}.
7531
7532 @item -Wfloat-conversion
7533 @opindex Wfloat-conversion
7534 @opindex Wno-float-conversion
7535 Warn for implicit conversions that reduce the precision of a real value.
7536 This includes conversions from real to integer, and from higher precision
7537 real to lower precision real values. This option is also enabled by
7538 @option{-Wconversion}.
7539
7540 @item -Wno-scalar-storage-order
7541 @opindex Wno-scalar-storage-order
7542 @opindex Wscalar-storage-order
7543 Do not warn on suspicious constructs involving reverse scalar storage order.
7544
7545 @item -Wsizeof-pointer-div
7546 @opindex Wsizeof-pointer-div
7547 @opindex Wno-sizeof-pointer-div
7548 Warn for suspicious divisions of two sizeof expressions that divide
7549 the pointer size by the element size, which is the usual way to compute
7550 the array size but won't work out correctly with pointers. This warning
7551 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7552 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7553
7554 @item -Wsizeof-pointer-memaccess
7555 @opindex Wsizeof-pointer-memaccess
7556 @opindex Wno-sizeof-pointer-memaccess
7557 Warn for suspicious length parameters to certain string and memory built-in
7558 functions if the argument uses @code{sizeof}. This warning triggers for
7559 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7560 an array, but a pointer, and suggests a possible fix, or about
7561 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7562 also warns about calls to bounded string copy functions like @code{strncat}
7563 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7564 the source array. For example, in the following function the call to
7565 @code{strncat} specifies the size of the source string as the bound. That
7566 is almost certainly a mistake and so the call is diagnosed.
7567 @smallexample
7568 void make_file (const char *name)
7569 @{
7570 char path[PATH_MAX];
7571 strncpy (path, name, sizeof path - 1);
7572 strncat (path, ".text", sizeof ".text");
7573 @dots{}
7574 @}
7575 @end smallexample
7576
7577 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7578
7579 @item -Wno-sizeof-array-argument
7580 @opindex Wsizeof-array-argument
7581 @opindex Wno-sizeof-array-argument
7582 Do not warn when the @code{sizeof} operator is applied to a parameter that is
7583 declared as an array in a function definition. This warning is enabled by
7584 default for C and C++ programs.
7585
7586 @item -Wmemset-elt-size
7587 @opindex Wmemset-elt-size
7588 @opindex Wno-memset-elt-size
7589 Warn for suspicious calls to the @code{memset} built-in function, if the
7590 first argument references an array, and the third argument is a number
7591 equal to the number of elements, but not equal to the size of the array
7592 in memory. This indicates that the user has omitted a multiplication by
7593 the element size. This warning is enabled by @option{-Wall}.
7594
7595 @item -Wmemset-transposed-args
7596 @opindex Wmemset-transposed-args
7597 @opindex Wno-memset-transposed-args
7598 Warn for suspicious calls to the @code{memset} built-in function where
7599 the second argument is not zero and the third argument is zero. For
7600 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7601 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7602 is only emitted if the third argument is a literal zero. Otherwise, if
7603 it is an expression that is folded to zero, or a cast of zero to some
7604 type, it is far less likely that the arguments have been mistakenly
7605 transposed and no warning is emitted. This warning is enabled
7606 by @option{-Wall}.
7607
7608 @item -Waddress
7609 @opindex Waddress
7610 @opindex Wno-address
7611 Warn about suspicious uses of memory addresses. These include using
7612 the address of a function in a conditional expression, such as
7613 @code{void func(void); if (func)}, and comparisons against the memory
7614 address of a string literal, such as @code{if (x == "abc")}. Such
7615 uses typically indicate a programmer error: the address of a function
7616 always evaluates to true, so their use in a conditional usually
7617 indicate that the programmer forgot the parentheses in a function
7618 call; and comparisons against string literals result in unspecified
7619 behavior and are not portable in C, so they usually indicate that the
7620 programmer intended to use @code{strcmp}. This warning is enabled by
7621 @option{-Wall}.
7622
7623 @item -Wno-address-of-packed-member
7624 @opindex Waddress-of-packed-member
7625 @opindex Wno-address-of-packed-member
7626 Do not warn when the address of packed member of struct or union is taken,
7627 which usually results in an unaligned pointer value. This is
7628 enabled by default.
7629
7630 @item -Wlogical-op
7631 @opindex Wlogical-op
7632 @opindex Wno-logical-op
7633 Warn about suspicious uses of logical operators in expressions.
7634 This includes using logical operators in contexts where a
7635 bit-wise operator is likely to be expected. Also warns when
7636 the operands of a logical operator are the same:
7637 @smallexample
7638 extern int a;
7639 if (a < 0 && a < 0) @{ @dots{} @}
7640 @end smallexample
7641
7642 @item -Wlogical-not-parentheses
7643 @opindex Wlogical-not-parentheses
7644 @opindex Wno-logical-not-parentheses
7645 Warn about logical not used on the left hand side operand of a comparison.
7646 This option does not warn if the right operand is considered to be a boolean
7647 expression. Its purpose is to detect suspicious code like the following:
7648 @smallexample
7649 int a;
7650 @dots{}
7651 if (!a > 1) @{ @dots{} @}
7652 @end smallexample
7653
7654 It is possible to suppress the warning by wrapping the LHS into
7655 parentheses:
7656 @smallexample
7657 if ((!a) > 1) @{ @dots{} @}
7658 @end smallexample
7659
7660 This warning is enabled by @option{-Wall}.
7661
7662 @item -Waggregate-return
7663 @opindex Waggregate-return
7664 @opindex Wno-aggregate-return
7665 Warn if any functions that return structures or unions are defined or
7666 called. (In languages where you can return an array, this also elicits
7667 a warning.)
7668
7669 @item -Wno-aggressive-loop-optimizations
7670 @opindex Wno-aggressive-loop-optimizations
7671 @opindex Waggressive-loop-optimizations
7672 Warn if in a loop with constant number of iterations the compiler detects
7673 undefined behavior in some statement during one or more of the iterations.
7674
7675 @item -Wno-attributes
7676 @opindex Wno-attributes
7677 @opindex Wattributes
7678 Do not warn if an unexpected @code{__attribute__} is used, such as
7679 unrecognized attributes, function attributes applied to variables,
7680 etc. This does not stop errors for incorrect use of supported
7681 attributes.
7682
7683 @item -Wno-builtin-declaration-mismatch
7684 @opindex Wno-builtin-declaration-mismatch
7685 @opindex Wbuiltin-declaration-mismatch
7686 Warn if a built-in function is declared with an incompatible signature
7687 or as a non-function, or when a built-in function declared with a type
7688 that does not include a prototype is called with arguments whose promoted
7689 types do not match those expected by the function. When @option{-Wextra}
7690 is specified, also warn when a built-in function that takes arguments is
7691 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
7692 warning is enabled by default. To avoid the warning include the appropriate
7693 header to bring the prototypes of built-in functions into scope.
7694
7695 For example, the call to @code{memset} below is diagnosed by the warning
7696 because the function expects a value of type @code{size_t} as its argument
7697 but the type of @code{32} is @code{int}. With @option{-Wextra},
7698 the declaration of the function is diagnosed as well.
7699 @smallexample
7700 extern void* memset ();
7701 void f (void *d)
7702 @{
7703 memset (d, '\0', 32);
7704 @}
7705 @end smallexample
7706
7707 @item -Wno-builtin-macro-redefined
7708 @opindex Wno-builtin-macro-redefined
7709 @opindex Wbuiltin-macro-redefined
7710 Do not warn if certain built-in macros are redefined. This suppresses
7711 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7712 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7713
7714 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7715 @opindex Wstrict-prototypes
7716 @opindex Wno-strict-prototypes
7717 Warn if a function is declared or defined without specifying the
7718 argument types. (An old-style function definition is permitted without
7719 a warning if preceded by a declaration that specifies the argument
7720 types.)
7721
7722 @item -Wold-style-declaration @r{(C and Objective-C only)}
7723 @opindex Wold-style-declaration
7724 @opindex Wno-old-style-declaration
7725 Warn for obsolescent usages, according to the C Standard, in a
7726 declaration. For example, warn if storage-class specifiers like
7727 @code{static} are not the first things in a declaration. This warning
7728 is also enabled by @option{-Wextra}.
7729
7730 @item -Wold-style-definition @r{(C and Objective-C only)}
7731 @opindex Wold-style-definition
7732 @opindex Wno-old-style-definition
7733 Warn if an old-style function definition is used. A warning is given
7734 even if there is a previous prototype. A definition using @samp{()}
7735 is not considered an old-style definition in C2X mode, because it is
7736 equivalent to @samp{(void)} in that case, but is considered an
7737 old-style definition for older standards.
7738
7739 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7740 @opindex Wmissing-parameter-type
7741 @opindex Wno-missing-parameter-type
7742 A function parameter is declared without a type specifier in K&R-style
7743 functions:
7744
7745 @smallexample
7746 void foo(bar) @{ @}
7747 @end smallexample
7748
7749 This warning is also enabled by @option{-Wextra}.
7750
7751 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7752 @opindex Wmissing-prototypes
7753 @opindex Wno-missing-prototypes
7754 Warn if a global function is defined without a previous prototype
7755 declaration. This warning is issued even if the definition itself
7756 provides a prototype. Use this option to detect global functions
7757 that do not have a matching prototype declaration in a header file.
7758 This option is not valid for C++ because all function declarations
7759 provide prototypes and a non-matching declaration declares an
7760 overload rather than conflict with an earlier declaration.
7761 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7762
7763 @item -Wmissing-declarations
7764 @opindex Wmissing-declarations
7765 @opindex Wno-missing-declarations
7766 Warn if a global function is defined without a previous declaration.
7767 Do so even if the definition itself provides a prototype.
7768 Use this option to detect global functions that are not declared in
7769 header files. In C, no warnings are issued for functions with previous
7770 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7771 missing prototypes. In C++, no warnings are issued for function templates,
7772 or for inline functions, or for functions in anonymous namespaces.
7773
7774 @item -Wmissing-field-initializers
7775 @opindex Wmissing-field-initializers
7776 @opindex Wno-missing-field-initializers
7777 @opindex W
7778 @opindex Wextra
7779 @opindex Wno-extra
7780 Warn if a structure's initializer has some fields missing. For
7781 example, the following code causes such a warning, because
7782 @code{x.h} is implicitly zero:
7783
7784 @smallexample
7785 struct s @{ int f, g, h; @};
7786 struct s x = @{ 3, 4 @};
7787 @end smallexample
7788
7789 This option does not warn about designated initializers, so the following
7790 modification does not trigger a warning:
7791
7792 @smallexample
7793 struct s @{ int f, g, h; @};
7794 struct s x = @{ .f = 3, .g = 4 @};
7795 @end smallexample
7796
7797 In C this option does not warn about the universal zero initializer
7798 @samp{@{ 0 @}}:
7799
7800 @smallexample
7801 struct s @{ int f, g, h; @};
7802 struct s x = @{ 0 @};
7803 @end smallexample
7804
7805 Likewise, in C++ this option does not warn about the empty @{ @}
7806 initializer, for example:
7807
7808 @smallexample
7809 struct s @{ int f, g, h; @};
7810 s x = @{ @};
7811 @end smallexample
7812
7813 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7814 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7815
7816 @item -Wno-multichar
7817 @opindex Wno-multichar
7818 @opindex Wmultichar
7819 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7820 Usually they indicate a typo in the user's code, as they have
7821 implementation-defined values, and should not be used in portable code.
7822
7823 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7824 @opindex Wnormalized=
7825 @opindex Wnormalized
7826 @opindex Wno-normalized
7827 @cindex NFC
7828 @cindex NFKC
7829 @cindex character set, input normalization
7830 In ISO C and ISO C++, two identifiers are different if they are
7831 different sequences of characters. However, sometimes when characters
7832 outside the basic ASCII character set are used, you can have two
7833 different character sequences that look the same. To avoid confusion,
7834 the ISO 10646 standard sets out some @dfn{normalization rules} which
7835 when applied ensure that two sequences that look the same are turned into
7836 the same sequence. GCC can warn you if you are using identifiers that
7837 have not been normalized; this option controls that warning.
7838
7839 There are four levels of warning supported by GCC@. The default is
7840 @option{-Wnormalized=nfc}, which warns about any identifier that is
7841 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7842 recommended form for most uses. It is equivalent to
7843 @option{-Wnormalized}.
7844
7845 Unfortunately, there are some characters allowed in identifiers by
7846 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7847 identifiers. That is, there's no way to use these symbols in portable
7848 ISO C or C++ and have all your identifiers in NFC@.
7849 @option{-Wnormalized=id} suppresses the warning for these characters.
7850 It is hoped that future versions of the standards involved will correct
7851 this, which is why this option is not the default.
7852
7853 You can switch the warning off for all characters by writing
7854 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7855 only do this if you are using some other normalization scheme (like
7856 ``D''), because otherwise you can easily create bugs that are
7857 literally impossible to see.
7858
7859 Some characters in ISO 10646 have distinct meanings but look identical
7860 in some fonts or display methodologies, especially once formatting has
7861 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7862 LETTER N'', displays just like a regular @code{n} that has been
7863 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7864 normalization scheme to convert all these into a standard form as
7865 well, and GCC warns if your code is not in NFKC if you use
7866 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7867 about every identifier that contains the letter O because it might be
7868 confused with the digit 0, and so is not the default, but may be
7869 useful as a local coding convention if the programming environment
7870 cannot be fixed to display these characters distinctly.
7871
7872 @item -Wno-attribute-warning
7873 @opindex Wno-attribute-warning
7874 @opindex Wattribute-warning
7875 Do not warn about usage of functions (@pxref{Function Attributes})
7876 declared with @code{warning} attribute. By default, this warning is
7877 enabled. @option{-Wno-attribute-warning} can be used to disable the
7878 warning or @option{-Wno-error=attribute-warning} can be used to
7879 disable the error when compiled with @option{-Werror} flag.
7880
7881 @item -Wno-deprecated
7882 @opindex Wno-deprecated
7883 @opindex Wdeprecated
7884 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7885
7886 @item -Wno-deprecated-declarations
7887 @opindex Wno-deprecated-declarations
7888 @opindex Wdeprecated-declarations
7889 Do not warn about uses of functions (@pxref{Function Attributes}),
7890 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7891 Attributes}) marked as deprecated by using the @code{deprecated}
7892 attribute.
7893
7894 @item -Wno-overflow
7895 @opindex Wno-overflow
7896 @opindex Woverflow
7897 Do not warn about compile-time overflow in constant expressions.
7898
7899 @item -Wno-odr
7900 @opindex Wno-odr
7901 @opindex Wodr
7902 Warn about One Definition Rule violations during link-time optimization.
7903 Enabled by default.
7904
7905 @item -Wopenmp-simd
7906 @opindex Wopenmp-simd
7907 @opindex Wno-openmp-simd
7908 Warn if the vectorizer cost model overrides the OpenMP
7909 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7910 option can be used to relax the cost model.
7911
7912 @item -Woverride-init @r{(C and Objective-C only)}
7913 @opindex Woverride-init
7914 @opindex Wno-override-init
7915 @opindex W
7916 @opindex Wextra
7917 @opindex Wno-extra
7918 Warn if an initialized field without side effects is overridden when
7919 using designated initializers (@pxref{Designated Inits, , Designated
7920 Initializers}).
7921
7922 This warning is included in @option{-Wextra}. To get other
7923 @option{-Wextra} warnings without this one, use @option{-Wextra
7924 -Wno-override-init}.
7925
7926 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
7927 @opindex Woverride-init-side-effects
7928 @opindex Wno-override-init-side-effects
7929 Do not warn if an initialized field with side effects is overridden when
7930 using designated initializers (@pxref{Designated Inits, , Designated
7931 Initializers}). This warning is enabled by default.
7932
7933 @item -Wpacked
7934 @opindex Wpacked
7935 @opindex Wno-packed
7936 Warn if a structure is given the packed attribute, but the packed
7937 attribute has no effect on the layout or size of the structure.
7938 Such structures may be mis-aligned for little benefit. For
7939 instance, in this code, the variable @code{f.x} in @code{struct bar}
7940 is misaligned even though @code{struct bar} does not itself
7941 have the packed attribute:
7942
7943 @smallexample
7944 @group
7945 struct foo @{
7946 int x;
7947 char a, b, c, d;
7948 @} __attribute__((packed));
7949 struct bar @{
7950 char z;
7951 struct foo f;
7952 @};
7953 @end group
7954 @end smallexample
7955
7956 @item -Wnopacked-bitfield-compat
7957 @opindex Wpacked-bitfield-compat
7958 @opindex Wno-packed-bitfield-compat
7959 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7960 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
7961 the change can lead to differences in the structure layout. GCC
7962 informs you when the offset of such a field has changed in GCC 4.4.
7963 For example there is no longer a 4-bit padding between field @code{a}
7964 and @code{b} in this structure:
7965
7966 @smallexample
7967 struct foo
7968 @{
7969 char a:4;
7970 char b:8;
7971 @} __attribute__ ((packed));
7972 @end smallexample
7973
7974 This warning is enabled by default. Use
7975 @option{-Wno-packed-bitfield-compat} to disable this warning.
7976
7977 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7978 @opindex Wpacked-not-aligned
7979 @opindex Wno-packed-not-aligned
7980 Warn if a structure field with explicitly specified alignment in a
7981 packed struct or union is misaligned. For example, a warning will
7982 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7983 'struct S' is less than 8}, in this code:
7984
7985 @smallexample
7986 @group
7987 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7988 struct __attribute__ ((packed)) S @{
7989 struct S8 s8;
7990 @};
7991 @end group
7992 @end smallexample
7993
7994 This warning is enabled by @option{-Wall}.
7995
7996 @item -Wpadded
7997 @opindex Wpadded
7998 @opindex Wno-padded
7999 Warn if padding is included in a structure, either to align an element
8000 of the structure or to align the whole structure. Sometimes when this
8001 happens it is possible to rearrange the fields of the structure to
8002 reduce the padding and so make the structure smaller.
8003
8004 @item -Wredundant-decls
8005 @opindex Wredundant-decls
8006 @opindex Wno-redundant-decls
8007 Warn if anything is declared more than once in the same scope, even in
8008 cases where multiple declaration is valid and changes nothing.
8009
8010 @item -Wrestrict
8011 @opindex Wrestrict
8012 @opindex Wno-restrict
8013 Warn when an object referenced by a @code{restrict}-qualified parameter
8014 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8015 argument, or when copies between such objects overlap. For example,
8016 the call to the @code{strcpy} function below attempts to truncate the string
8017 by replacing its initial characters with the last four. However, because
8018 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8019 the call is diagnosed.
8020
8021 @smallexample
8022 void foo (void)
8023 @{
8024 char a[] = "abcd1234";
8025 strcpy (a, a + 4);
8026 @dots{}
8027 @}
8028 @end smallexample
8029 The @option{-Wrestrict} option detects some instances of simple overlap
8030 even without optimization but works best at @option{-O2} and above. It
8031 is included in @option{-Wall}.
8032
8033 @item -Wnested-externs @r{(C and Objective-C only)}
8034 @opindex Wnested-externs
8035 @opindex Wno-nested-externs
8036 Warn if an @code{extern} declaration is encountered within a function.
8037
8038 @item -Winline
8039 @opindex Winline
8040 @opindex Wno-inline
8041 Warn if a function that is declared as inline cannot be inlined.
8042 Even with this option, the compiler does not warn about failures to
8043 inline functions declared in system headers.
8044
8045 The compiler uses a variety of heuristics to determine whether or not
8046 to inline a function. For example, the compiler takes into account
8047 the size of the function being inlined and the amount of inlining
8048 that has already been done in the current function. Therefore,
8049 seemingly insignificant changes in the source program can cause the
8050 warnings produced by @option{-Winline} to appear or disappear.
8051
8052 @item -Wint-in-bool-context
8053 @opindex Wint-in-bool-context
8054 @opindex Wno-int-in-bool-context
8055 Warn for suspicious use of integer values where boolean values are expected,
8056 such as conditional expressions (?:) using non-boolean integer constants in
8057 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
8058 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
8059 for all kinds of multiplications regardless of the data type.
8060 This warning is enabled by @option{-Wall}.
8061
8062 @item -Wno-int-to-pointer-cast
8063 @opindex Wno-int-to-pointer-cast
8064 @opindex Wint-to-pointer-cast
8065 Suppress warnings from casts to pointer type of an integer of a
8066 different size. In C++, casting to a pointer type of smaller size is
8067 an error. @option{Wint-to-pointer-cast} is enabled by default.
8068
8069
8070 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8071 @opindex Wno-pointer-to-int-cast
8072 @opindex Wpointer-to-int-cast
8073 Suppress warnings from casts from a pointer to an integer type of a
8074 different size.
8075
8076 @item -Winvalid-pch
8077 @opindex Winvalid-pch
8078 @opindex Wno-invalid-pch
8079 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8080 the search path but cannot be used.
8081
8082 @item -Wlong-long
8083 @opindex Wlong-long
8084 @opindex Wno-long-long
8085 Warn if @code{long long} type is used. This is enabled by either
8086 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8087 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
8088
8089 @item -Wvariadic-macros
8090 @opindex Wvariadic-macros
8091 @opindex Wno-variadic-macros
8092 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8093 alternate syntax is used in ISO C99 mode. This is enabled by either
8094 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
8095 messages, use @option{-Wno-variadic-macros}.
8096
8097 @item -Wno-varargs
8098 @opindex Wvarargs
8099 @opindex Wno-varargs
8100 Do not warn upon questionable usage of the macros used to handle variable
8101 arguments like @code{va_start}. These warnings are enabled by default.
8102
8103 @item -Wvector-operation-performance
8104 @opindex Wvector-operation-performance
8105 @opindex Wno-vector-operation-performance
8106 Warn if vector operation is not implemented via SIMD capabilities of the
8107 architecture. Mainly useful for the performance tuning.
8108 Vector operation can be implemented @code{piecewise}, which means that the
8109 scalar operation is performed on every vector element;
8110 @code{in parallel}, which means that the vector operation is implemented
8111 using scalars of wider type, which normally is more performance efficient;
8112 and @code{as a single scalar}, which means that vector fits into a
8113 scalar type.
8114
8115 @item -Wvla
8116 @opindex Wvla
8117 @opindex Wno-vla
8118 Warn if a variable-length array is used in the code.
8119 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8120 the variable-length array.
8121
8122 @item -Wvla-larger-than=@var{byte-size}
8123 @opindex Wvla-larger-than=
8124 @opindex Wno-vla-larger-than
8125 If this option is used, the compiler warns for declarations of
8126 variable-length arrays whose size is either unbounded, or bounded
8127 by an argument that allows the array size to exceed @var{byte-size}
8128 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8129 works, but with variable-length arrays.
8130
8131 Note that GCC may optimize small variable-length arrays of a known
8132 value into plain arrays, so this warning may not get triggered for
8133 such arrays.
8134
8135 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8136 is typically only effective when @option{-ftree-vrp} is active (default
8137 for @option{-O2} and above).
8138
8139 See also @option{-Walloca-larger-than=@var{byte-size}}.
8140
8141 @item -Wno-vla-larger-than
8142 @opindex Wno-vla-larger-than
8143 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
8144 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8145
8146 @item -Wvolatile-register-var
8147 @opindex Wvolatile-register-var
8148 @opindex Wno-volatile-register-var
8149 Warn if a register variable is declared volatile. The volatile
8150 modifier does not inhibit all optimizations that may eliminate reads
8151 and/or writes to register variables. This warning is enabled by
8152 @option{-Wall}.
8153
8154 @item -Wdisabled-optimization
8155 @opindex Wdisabled-optimization
8156 @opindex Wno-disabled-optimization
8157 Warn if a requested optimization pass is disabled. This warning does
8158 not generally indicate that there is anything wrong with your code; it
8159 merely indicates that GCC's optimizers are unable to handle the code
8160 effectively. Often, the problem is that your code is too big or too
8161 complex; GCC refuses to optimize programs when the optimization
8162 itself is likely to take inordinate amounts of time.
8163
8164 @item -Wpointer-sign @r{(C and Objective-C only)}
8165 @opindex Wpointer-sign
8166 @opindex Wno-pointer-sign
8167 Warn for pointer argument passing or assignment with different signedness.
8168 This option is only supported for C and Objective-C@. It is implied by
8169 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8170 @option{-Wno-pointer-sign}.
8171
8172 @item -Wstack-protector
8173 @opindex Wstack-protector
8174 @opindex Wno-stack-protector
8175 This option is only active when @option{-fstack-protector} is active. It
8176 warns about functions that are not protected against stack smashing.
8177
8178 @item -Woverlength-strings
8179 @opindex Woverlength-strings
8180 @opindex Wno-overlength-strings
8181 Warn about string constants that are longer than the ``minimum
8182 maximum'' length specified in the C standard. Modern compilers
8183 generally allow string constants that are much longer than the
8184 standard's minimum limit, but very portable programs should avoid
8185 using longer strings.
8186
8187 The limit applies @emph{after} string constant concatenation, and does
8188 not count the trailing NUL@. In C90, the limit was 509 characters; in
8189 C99, it was raised to 4095. C++98 does not specify a normative
8190 minimum maximum, so we do not diagnose overlength strings in C++@.
8191
8192 This option is implied by @option{-Wpedantic}, and can be disabled with
8193 @option{-Wno-overlength-strings}.
8194
8195 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8196 @opindex Wunsuffixed-float-constants
8197 @opindex Wno-unsuffixed-float-constants
8198
8199 Issue a warning for any floating constant that does not have
8200 a suffix. When used together with @option{-Wsystem-headers} it
8201 warns about such constants in system header files. This can be useful
8202 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8203 from the decimal floating-point extension to C99.
8204
8205 @item -Wno-lto-type-mismatch
8206 @opindex Wlto-type-mismatch
8207 @opindex Wno-lto-type-mismatch
8208
8209 During the link-time optimization, do not warn about type mismatches in
8210 global declarations from different compilation units.
8211 Requires @option{-flto} to be enabled. Enabled by default.
8212
8213 @item -Wno-designated-init @r{(C and Objective-C only)}
8214 @opindex Wdesignated-init
8215 @opindex Wno-designated-init
8216 Suppress warnings when a positional initializer is used to initialize
8217 a structure that has been marked with the @code{designated_init}
8218 attribute.
8219
8220 @item -Wno-hsa
8221 @opindex Whsa
8222 @opindex Wno-hsa
8223 Do not warn when HSAIL cannot be emitted for the compiled function or
8224 OpenMP construct. These warnings are enabled by default.
8225
8226 @end table
8227
8228 @node Static Analyzer Options
8229 @section Options That Control Static Analysis
8230
8231 @table @gcctabopt
8232 @item -fanalyzer
8233 @opindex analyzer
8234 @opindex fanalyzer
8235 @opindex fno-analyzer
8236 This option enables an static analysis of program flow which looks
8237 for ``interesting'' interprocedural paths through the
8238 code, and issues warnings for problems found on them.
8239
8240 This analysis is much more expensive than other GCC warnings.
8241
8242 Enabling this option effectively enables the following warnings:
8243
8244 @gccoptlist{ @gol
8245 -Wanalyzer-double-fclose @gol
8246 -Wanalyzer-double-free @gol
8247 -Wanalyzer-exposure-through-output-file @gol
8248 -Wanalyzer-file-leak @gol
8249 -Wanalyzer-free-of-non-heap @gol
8250 -Wanalyzer-malloc-leak @gol
8251 -Wanalyzer-possible-null-argument @gol
8252 -Wanalyzer-possible-null-dereference @gol
8253 -Wanalyzer-null-argument @gol
8254 -Wanalyzer-null-dereference @gol
8255 -Wanalyzer-stale-setjmp-buffer @gol
8256 -Wanalyzer-tainted-array-index @gol
8257 -Wanalyzer-unsafe-call-within-signal-handler @gol
8258 -Wanalyzer-use-after-free @gol
8259 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8260 }
8261
8262 This option is only available if GCC was configured with analyzer
8263 support enabled.
8264
8265 @item -Wanalyzer-too-complex
8266 @opindex Wanalyzer-too-complex
8267 @opindex Wno-analyzer-too-complex
8268 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8269 to attempt to explore the control flow and data flow in the program,
8270 but these can be defeated by sufficiently complicated code.
8271
8272 By default, the analysis silently stops if the code is too
8273 complicated for the analyzer to fully explore and it reaches an internal
8274 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
8275
8276 @item -Wno-analyzer-double-fclose
8277 @opindex Wanalyzer-double-fclose
8278 @opindex Wno-analyzer-double-fclose
8279 This warning requires @option{-fanalyzer}, which enables it; use
8280 @option{-Wno-analyzer-double-fclose} to disable it.
8281
8282 This diagnostic warns for paths through the code in which a @code{FILE *}
8283 can have @code{fclose} called on it more than once.
8284
8285 @item -Wno-analyzer-double-free
8286 @opindex Wanalyzer-double-free
8287 @opindex Wno-analyzer-double-free
8288 This warning requires @option{-fanalyzer}, which enables it; use
8289 @option{-Wno-analyzer-double-free} to disable it.
8290
8291 This diagnostic warns for paths through the code in which a pointer
8292 can have @code{free} called on it more than once.
8293
8294 @item -Wno-analyzer-exposure-through-output-file
8295 @opindex Wanalyzer-exposure-through-output-file
8296 @opindex Wno-analyzer-exposure-through-output-file
8297 This warning requires @option{-fanalyzer}, which enables it; use
8298 @option{-Wno-analyzer-exposure-through-output-file}
8299 to disable it.
8300
8301 This diagnostic warns for paths through the code in which a
8302 security-sensitive value is written to an output file
8303 (such as writing a password to a log file).
8304
8305 @item -Wno-analyzer-file-leak
8306 @opindex Wanalyzer-file-leak
8307 @opindex Wno-analyzer-file-leak
8308 This warning requires @option{-fanalyzer}, which enables it; use
8309 @option{-Wno-analyzer-file-leak}
8310 to disable it.
8311
8312 This diagnostic warns for paths through the code in which a
8313 @code{<stdio.h>} @code{FILE *} stream object is leaked.
8314
8315 @item -Wno-analyzer-free-of-non-heap
8316 @opindex Wanalyzer-free-of-non-heap
8317 @opindex Wno-analyzer-free-of-non-heap
8318 This warning requires @option{-fanalyzer}, which enables it; use
8319 @option{-Wno-analyzer-free-of-non-heap}
8320 to disable it.
8321
8322 This diagnostic warns for paths through the code in which @code{free}
8323 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
8324
8325 @item -Wno-analyzer-malloc-leak
8326 @opindex Wanalyzer-malloc-leak
8327 @opindex Wno-analyzer-malloc-leak
8328 This warning requires @option{-fanalyzer}, which enables it; use
8329 @option{-Wno-analyzer-malloc-leak}
8330 to disable it.
8331
8332 This diagnostic warns for paths through the code in which a
8333 pointer allocated via @code{malloc} is leaked.
8334
8335 @item -Wno-analyzer-possible-null-argument
8336 @opindex Wanalyzer-possible-null-argument
8337 @opindex Wno-analyzer-possible-null-argument
8338 This warning requires @option{-fanalyzer}, which enables it; use
8339 @option{-Wno-analyzer-possible-null-argument} to disable it.
8340
8341 This diagnostic warns for paths through the code in which a
8342 possibly-NULL value is passed to a function argument marked
8343 with @code{__attribute__((nonnull))} as requiring a non-NULL
8344 value.
8345
8346 @item -Wno-analyzer-possible-null-dereference
8347 @opindex Wanalyzer-possible-null-dereference
8348 @opindex Wno-analyzer-possible-null-dereference
8349 This warning requires @option{-fanalyzer}, which enables it; use
8350 @option{-Wno-analyzer-possible-null-dereference} to disable it.
8351
8352 This diagnostic warns for paths through the code in which a
8353 possibly-NULL value is dereferenced.
8354
8355 @item -Wno-analyzer-null-argument
8356 @opindex Wanalyzer-null-argument
8357 @opindex Wno-analyzer-null-argument
8358 This warning requires @option{-fanalyzer}, which enables it; use
8359 @option{-Wno-analyzer-null-argument} to disable it.
8360
8361 This diagnostic warns for paths through the code in which a
8362 value known to be NULL is passed to a function argument marked
8363 with @code{__attribute__((nonnull))} as requiring a non-NULL
8364 value.
8365
8366 @item -Wno-analyzer-null-dereference
8367 @opindex Wanalyzer-null-dereference
8368 @opindex Wno-analyzer-null-dereference
8369 This warning requires @option{-fanalyzer}, which enables it; use
8370 @option{-Wno-analyzer-null-dereference} to disable it.
8371
8372 This diagnostic warns for paths through the code in which a
8373 value known to be NULL is dereferenced.
8374
8375 @item -Wno-analyzer-stale-setjmp-buffer
8376 @opindex Wanalyzer-stale-setjmp-buffer
8377 @opindex Wno-analyzer-stale-setjmp-buffer
8378 This warning requires @option{-fanalyzer}, which enables it; use
8379 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
8380
8381 This diagnostic warns for paths through the code in which
8382 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
8383 to a @code{setjmp} call in a function that has returned.
8384
8385 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
8386 location, it records the stack frame. The stack frame becomes invalid
8387 when the function containing the @code{setjmp} call returns. Attempting
8388 to rewind to it via @code{longjmp} would reference a stack frame that
8389 no longer exists, and likely lead to a crash (or worse).
8390
8391 @item -Wno-analyzer-tainted-array-index
8392 @opindex Wanalyzer-tainted-array-index
8393 @opindex Wno-analyzer-tainted-array-index
8394 This warning requires both @option{-fanalyzer} and
8395 @option{-fanalyzer-checker=taint} to enable it;
8396 use @option{-Wno-analyzer-tainted-array-index} to disable it.
8397
8398 This diagnostic warns for paths through the code in which a value
8399 that could be under an attacker's control is used as the index
8400 of an array access without being sanitized.
8401
8402 @item -Wno-analyzer-unsafe-call-within-signal-handler
8403 @opindex Wanalyzer-unsafe-call-within-signal-handler
8404 @opindex Wno-analyzer-unsafe-call-within-signal-handler
8405 This warning requires @option{-fanalyzer}, which enables it; use
8406 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
8407
8408 This diagnostic warns for paths through the code in which a
8409 function known to be async-signal-unsafe (such as @code{fprintf}) is
8410 called from a signal handler.
8411
8412 @item -Wno-analyzer-use-after-free
8413 @opindex Wanalyzer-use-after-free
8414 @opindex Wno-analyzer-use-after-free
8415 This warning requires @option{-fanalyzer}, which enables it; use
8416 @option{-Wno-analyzer-use-after-free} to disable it.
8417
8418 This diagnostic warns for paths through the code in which a
8419 pointer is used after @code{free} is called on it.
8420
8421 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8422 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
8423 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
8424 This warning requires @option{-fanalyzer}, which enables it; use
8425 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
8426 to disable it.
8427
8428 This diagnostic warns for paths through the code in which a pointer
8429 is dereferenced that points to a variable in a stale stack frame.
8430
8431 @end table
8432
8433 Pertinent parameters for controlling the exploration are:
8434 @option{--param analyzer-bb-explosion-factor=@var{value}},
8435 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
8436 @option{--param analyzer-max-recursion-depth=@var{value}}, and
8437 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8438
8439 The following options control the analyzer.
8440
8441 @table @gcctabopt
8442
8443 @item -fanalyzer-call-summaries
8444 @opindex fanalyzer-call-summaries
8445 @opindex fno-analyzer-call-summaries
8446 Simplify interprocedural analysis by computing the effect of certain calls,
8447 rather than exploring all paths through the function from callsite to each
8448 possible return.
8449
8450 If enabled, call summaries are only used for functions with more than one
8451 call site, and that are sufficiently complicated (as per
8452 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8453
8454 @item -fanalyzer-checker=@var{name}
8455 @opindex fanalyzer-checker
8456 Restrict the analyzer to run just the named checker, and enable it.
8457
8458 Some checkers are disabled by default (even with @option{-fanalyzer}),
8459 such as the @code{taint} checker that implements
8460 @option{-Wanalyzer-tainted-array-index}, and this option is required
8461 to enable them.
8462
8463 @item -fanalyzer-fine-grained
8464 @opindex fanalyzer-fine-grained
8465 @opindex fno-analyzer-fine-grained
8466 This option is intended for analyzer developers.
8467
8468 Internally the analyzer builds an ``exploded graph'' that combines
8469 control flow graphs with data flow information.
8470
8471 By default, an edge in this graph can contain the effects of a run
8472 of multiple statements within a basic block. With
8473 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
8474
8475 @item -fanalyzer-show-duplicate-count
8476 @opindex fanalyzer-show-duplicate-count
8477 @opindex fno-analyzer-show-duplicate-count
8478 This option is intended for analyzer developers: if multiple diagnostics
8479 have been detected as being duplicates of each other, it emits a note when
8480 reporting the best diagnostic, giving the number of additional diagnostics
8481 that were suppressed by the deduplication logic.
8482
8483 @item -fno-analyzer-state-merge
8484 @opindex fanalyzer-state-merge
8485 @opindex fno-analyzer-state-merge
8486 This option is intended for analyzer developers.
8487
8488 By default the analyzer attempts to simplify analysis by merging
8489 sufficiently similar states at each program point as it builds its
8490 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
8491 merging can be suppressed, for debugging state-handling issues.
8492
8493 @item -fno-analyzer-state-purge
8494 @opindex fanalyzer-state-purge
8495 @opindex fno-analyzer-state-purge
8496 This option is intended for analyzer developers.
8497
8498 By default the analyzer attempts to simplify analysis by purging
8499 aspects of state at a program point that appear to no longer be relevant
8500 e.g. the values of locals that aren't accessed later in the function
8501 and which aren't relevant to leak analysis.
8502
8503 With @option{-fno-analyzer-state-purge} this purging of state can
8504 be suppressed, for debugging state-handling issues.
8505
8506 @item -fanalyzer-transitivity
8507 @opindex fanalyzer-transitivity
8508 @opindex fno-analyzer-transitivity
8509 This option enables transitivity of constraints within the analyzer.
8510
8511 @item -fanalyzer-verbose-edges
8512 This option is intended for analyzer developers. It enables more
8513 verbose, lower-level detail in the descriptions of control flow
8514 within diagnostic paths.
8515
8516 @item -fanalyzer-verbose-state-changes
8517 This option is intended for analyzer developers. It enables more
8518 verbose, lower-level detail in the descriptions of events relating
8519 to state machines within diagnostic paths.
8520
8521 @item -fanalyzer-verbosity=@var{level}
8522 This option controls the complexity of the control flow paths that are
8523 emitted for analyzer diagnostics.
8524
8525 The @var{level} can be one of:
8526
8527 @table @samp
8528 @item 0
8529 At this level, interprocedural call and return events are displayed,
8530 along with the most pertinent state-change events relating to
8531 a diagnostic. For example, for a double-@code{free} diagnostic,
8532 both calls to @code{free} will be shown.
8533
8534 @item 1
8535 As per the previous level, but also show events for the entry
8536 to each function.
8537
8538 @item 2
8539 As per the previous level, but also show events relating to
8540 control flow that are significant to triggering the issue
8541 (e.g. ``true path taken'' at a conditional).
8542
8543 This level is the default.
8544
8545 @item 3
8546 As per the previous level, but show all control flow events, not
8547 just significant ones.
8548
8549 @item 4
8550 This level is intended for analyzer developers; it adds various
8551 other events intended for debugging the analyzer.
8552
8553 @end table
8554
8555 @item -fdump-analyzer
8556 @opindex fdump-analyzer
8557 Dump internal details about what the analyzer is doing to
8558 @file{@var{file}.analyzer.txt}.
8559 This option is overridden by @option{-fdump-analyzer-stderr}.
8560
8561 @item -fdump-analyzer-stderr
8562 @opindex fdump-analyzer-stderr
8563 Dump internal details about what the analyzer is doing to stderr.
8564 This option overrides @option{-fdump-analyzer}.
8565
8566 @item -fdump-analyzer-callgraph
8567 @opindex fdump-analyzer-callgraph
8568 Dump a representation of the call graph suitable for viewing with
8569 GraphViz to @file{@var{file}.callgraph.dot}.
8570
8571 @item -fdump-analyzer-exploded-graph
8572 @opindex fdump-analyzer-exploded-graph
8573 Dump a representation of the ``exploded graph'' suitable for viewing with
8574 GraphViz to @file{@var{file}.eg.dot}.
8575 Nodes are color-coded based on state-machine states to emphasize
8576 state changes.
8577
8578 @item -fdump-analyzer-exploded-nodes
8579 @opindex dump-analyzer-exploded-nodes
8580 Emit diagnostics showing where nodes in the ``exploded graph'' are
8581 in relation to the program source.
8582
8583 @item -fdump-analyzer-exploded-nodes-2
8584 @opindex dump-analyzer-exploded-nodes-2
8585 Dump a textual representation of the ``exploded graph'' to
8586 @file{@var{file}.eg.txt}.
8587
8588 @item -fdump-analyzer-exploded-nodes-3
8589 @opindex dump-analyzer-exploded-nodes-3
8590 Dump a textual representation of the ``exploded graph'' to
8591 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
8592 This is typically a large number of dump files.
8593
8594 @item -fdump-analyzer-state-purge
8595 @opindex fdump-analyzer-state-purge
8596 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
8597 ``supergraph'' suitable for viewing with GraphViz, but annotate the
8598 graph with information on what state will be purged at each node.
8599 The graph is written to @file{@var{file}.state-purge.dot}.
8600
8601 @item -fdump-analyzer-supergraph
8602 @opindex fdump-analyzer-supergraph
8603 Dump representations of the ``supergraph'' suitable for viewing with
8604 GraphViz to @file{@var{file}.supergraph.dot} and to
8605 @file{@var{file}.supergraph-eg.dot}. These show all of the
8606 control flow graphs in the program, with interprocedural edges for
8607 calls and returns. The second dump contains annotations showing nodes
8608 in the ``exploded graph'' and diagnostics associated with them.
8609
8610 @end table
8611
8612 @node Debugging Options
8613 @section Options for Debugging Your Program
8614 @cindex options, debugging
8615 @cindex debugging information options
8616
8617 To tell GCC to emit extra information for use by a debugger, in almost
8618 all cases you need only to add @option{-g} to your other options.
8619
8620 GCC allows you to use @option{-g} with
8621 @option{-O}. The shortcuts taken by optimized code may occasionally
8622 be surprising: some variables you declared may not exist
8623 at all; flow of control may briefly move where you did not expect it;
8624 some statements may not be executed because they compute constant
8625 results or their values are already at hand; some statements may
8626 execute in different places because they have been moved out of loops.
8627 Nevertheless it is possible to debug optimized output. This makes
8628 it reasonable to use the optimizer for programs that might have bugs.
8629
8630 If you are not using some other optimization option, consider
8631 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
8632 With no @option{-O} option at all, some compiler passes that collect
8633 information useful for debugging do not run at all, so that
8634 @option{-Og} may result in a better debugging experience.
8635
8636 @table @gcctabopt
8637 @item -g
8638 @opindex g
8639 Produce debugging information in the operating system's native format
8640 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
8641 information.
8642
8643 On most systems that use stabs format, @option{-g} enables use of extra
8644 debugging information that only GDB can use; this extra information
8645 makes debugging work better in GDB but probably makes other debuggers
8646 crash or
8647 refuse to read the program. If you want to control for certain whether
8648 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
8649 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
8650
8651 @item -ggdb
8652 @opindex ggdb
8653 Produce debugging information for use by GDB@. This means to use the
8654 most expressive format available (DWARF, stabs, or the native format
8655 if neither of those are supported), including GDB extensions if at all
8656 possible.
8657
8658 @item -gdwarf
8659 @itemx -gdwarf-@var{version}
8660 @opindex gdwarf
8661 Produce debugging information in DWARF format (if that is supported).
8662 The value of @var{version} may be either 2, 3, 4 or 5; the default version
8663 for most targets is 4. DWARF Version 5 is only experimental.
8664
8665 Note that with DWARF Version 2, some ports require and always
8666 use some non-conflicting DWARF 3 extensions in the unwind tables.
8667
8668 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
8669 for maximum benefit.
8670
8671 GCC no longer supports DWARF Version 1, which is substantially
8672 different than Version 2 and later. For historical reasons, some
8673 other DWARF-related options such as
8674 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
8675 in their names, but apply to all currently-supported versions of DWARF.
8676
8677 @item -gstabs
8678 @opindex gstabs
8679 Produce debugging information in stabs format (if that is supported),
8680 without GDB extensions. This is the format used by DBX on most BSD
8681 systems. On MIPS, Alpha and System V Release 4 systems this option
8682 produces stabs debugging output that is not understood by DBX@.
8683 On System V Release 4 systems this option requires the GNU assembler.
8684
8685 @item -gstabs+
8686 @opindex gstabs+
8687 Produce debugging information in stabs format (if that is supported),
8688 using GNU extensions understood only by the GNU debugger (GDB)@. The
8689 use of these extensions is likely to make other debuggers crash or
8690 refuse to read the program.
8691
8692 @item -gxcoff
8693 @opindex gxcoff
8694 Produce debugging information in XCOFF format (if that is supported).
8695 This is the format used by the DBX debugger on IBM RS/6000 systems.
8696
8697 @item -gxcoff+
8698 @opindex gxcoff+
8699 Produce debugging information in XCOFF format (if that is supported),
8700 using GNU extensions understood only by the GNU debugger (GDB)@. The
8701 use of these extensions is likely to make other debuggers crash or
8702 refuse to read the program, and may cause assemblers other than the GNU
8703 assembler (GAS) to fail with an error.
8704
8705 @item -gvms
8706 @opindex gvms
8707 Produce debugging information in Alpha/VMS debug format (if that is
8708 supported). This is the format used by DEBUG on Alpha/VMS systems.
8709
8710 @item -g@var{level}
8711 @itemx -ggdb@var{level}
8712 @itemx -gstabs@var{level}
8713 @itemx -gxcoff@var{level}
8714 @itemx -gvms@var{level}
8715 Request debugging information and also use @var{level} to specify how
8716 much information. The default level is 2.
8717
8718 Level 0 produces no debug information at all. Thus, @option{-g0} negates
8719 @option{-g}.
8720
8721 Level 1 produces minimal information, enough for making backtraces in
8722 parts of the program that you don't plan to debug. This includes
8723 descriptions of functions and external variables, and line number
8724 tables, but no information about local variables.
8725
8726 Level 3 includes extra information, such as all the macro definitions
8727 present in the program. Some debuggers support macro expansion when
8728 you use @option{-g3}.
8729
8730 If you use multiple @option{-g} options, with or without level numbers,
8731 the last such option is the one that is effective.
8732
8733 @option{-gdwarf} does not accept a concatenated debug level, to avoid
8734 confusion with @option{-gdwarf-@var{level}}.
8735 Instead use an additional @option{-g@var{level}} option to change the
8736 debug level for DWARF.
8737
8738 @item -fno-eliminate-unused-debug-symbols
8739 @opindex feliminate-unused-debug-symbols
8740 @opindex fno-eliminate-unused-debug-symbols
8741 By default, no debug information is produced for symbols that are not actually
8742 used. Use this option if you want debug information for all symbols.
8743
8744 @item -femit-class-debug-always
8745 @opindex femit-class-debug-always
8746 Instead of emitting debugging information for a C++ class in only one
8747 object file, emit it in all object files using the class. This option
8748 should be used only with debuggers that are unable to handle the way GCC
8749 normally emits debugging information for classes because using this
8750 option increases the size of debugging information by as much as a
8751 factor of two.
8752
8753 @item -fno-merge-debug-strings
8754 @opindex fmerge-debug-strings
8755 @opindex fno-merge-debug-strings
8756 Direct the linker to not merge together strings in the debugging
8757 information that are identical in different object files. Merging is
8758 not supported by all assemblers or linkers. Merging decreases the size
8759 of the debug information in the output file at the cost of increasing
8760 link processing time. Merging is enabled by default.
8761
8762 @item -fdebug-prefix-map=@var{old}=@var{new}
8763 @opindex fdebug-prefix-map
8764 When compiling files residing in directory @file{@var{old}}, record
8765 debugging information describing them as if the files resided in
8766 directory @file{@var{new}} instead. This can be used to replace a
8767 build-time path with an install-time path in the debug info. It can
8768 also be used to change an absolute path to a relative path by using
8769 @file{.} for @var{new}. This can give more reproducible builds, which
8770 are location independent, but may require an extra command to tell GDB
8771 where to find the source files. See also @option{-ffile-prefix-map}.
8772
8773 @item -fvar-tracking
8774 @opindex fvar-tracking
8775 Run variable tracking pass. It computes where variables are stored at each
8776 position in code. Better debugging information is then generated
8777 (if the debugging information format supports this information).
8778
8779 It is enabled by default when compiling with optimization (@option{-Os},
8780 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8781 the debug info format supports it.
8782
8783 @item -fvar-tracking-assignments
8784 @opindex fvar-tracking-assignments
8785 @opindex fno-var-tracking-assignments
8786 Annotate assignments to user variables early in the compilation and
8787 attempt to carry the annotations over throughout the compilation all the
8788 way to the end, in an attempt to improve debug information while
8789 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
8790
8791 It can be enabled even if var-tracking is disabled, in which case
8792 annotations are created and maintained, but discarded at the end.
8793 By default, this flag is enabled together with @option{-fvar-tracking},
8794 except when selective scheduling is enabled.
8795
8796 @item -gsplit-dwarf
8797 @opindex gsplit-dwarf
8798 Separate as much DWARF debugging information as possible into a
8799 separate output file with the extension @file{.dwo}. This option allows
8800 the build system to avoid linking files with debug information. To
8801 be useful, this option requires a debugger capable of reading @file{.dwo}
8802 files.
8803
8804 @item -gdescribe-dies
8805 @opindex gdescribe-dies
8806 Add description attributes to some DWARF DIEs that have no name attribute,
8807 such as artificial variables, external references and call site
8808 parameter DIEs.
8809
8810 @item -gpubnames
8811 @opindex gpubnames
8812 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8813
8814 @item -ggnu-pubnames
8815 @opindex ggnu-pubnames
8816 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8817 suitable for conversion into a GDB@ index. This option is only useful
8818 with a linker that can produce GDB@ index version 7.
8819
8820 @item -fdebug-types-section
8821 @opindex fdebug-types-section
8822 @opindex fno-debug-types-section
8823 When using DWARF Version 4 or higher, type DIEs can be put into
8824 their own @code{.debug_types} section instead of making them part of the
8825 @code{.debug_info} section. It is more efficient to put them in a separate
8826 comdat section since the linker can then remove duplicates.
8827 But not all DWARF consumers support @code{.debug_types} sections yet
8828 and on some objects @code{.debug_types} produces larger instead of smaller
8829 debugging information.
8830
8831 @item -grecord-gcc-switches
8832 @itemx -gno-record-gcc-switches
8833 @opindex grecord-gcc-switches
8834 @opindex gno-record-gcc-switches
8835 This switch causes the command-line options used to invoke the
8836 compiler that may affect code generation to be appended to the
8837 DW_AT_producer attribute in DWARF debugging information. The options
8838 are concatenated with spaces separating them from each other and from
8839 the compiler version.
8840 It is enabled by default.
8841 See also @option{-frecord-gcc-switches} for another
8842 way of storing compiler options into the object file.
8843
8844 @item -gstrict-dwarf
8845 @opindex gstrict-dwarf
8846 Disallow using extensions of later DWARF standard version than selected
8847 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8848 DWARF extensions from later standard versions is allowed.
8849
8850 @item -gno-strict-dwarf
8851 @opindex gno-strict-dwarf
8852 Allow using extensions of later DWARF standard version than selected with
8853 @option{-gdwarf-@var{version}}.
8854
8855 @item -gas-loc-support
8856 @opindex gas-loc-support
8857 Inform the compiler that the assembler supports @code{.loc} directives.
8858 It may then use them for the assembler to generate DWARF2+ line number
8859 tables.
8860
8861 This is generally desirable, because assembler-generated line-number
8862 tables are a lot more compact than those the compiler can generate
8863 itself.
8864
8865 This option will be enabled by default if, at GCC configure time, the
8866 assembler was found to support such directives.
8867
8868 @item -gno-as-loc-support
8869 @opindex gno-as-loc-support
8870 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8871 line number tables are to be generated.
8872
8873 @item -gas-locview-support
8874 @opindex gas-locview-support
8875 Inform the compiler that the assembler supports @code{view} assignment
8876 and reset assertion checking in @code{.loc} directives.
8877
8878 This option will be enabled by default if, at GCC configure time, the
8879 assembler was found to support them.
8880
8881 @item -gno-as-locview-support
8882 Force GCC to assign view numbers internally, if
8883 @option{-gvariable-location-views} are explicitly requested.
8884
8885 @item -gcolumn-info
8886 @itemx -gno-column-info
8887 @opindex gcolumn-info
8888 @opindex gno-column-info
8889 Emit location column information into DWARF debugging information, rather
8890 than just file and line.
8891 This option is enabled by default.
8892
8893 @item -gstatement-frontiers
8894 @itemx -gno-statement-frontiers
8895 @opindex gstatement-frontiers
8896 @opindex gno-statement-frontiers
8897 This option causes GCC to create markers in the internal representation
8898 at the beginning of statements, and to keep them roughly in place
8899 throughout compilation, using them to guide the output of @code{is_stmt}
8900 markers in the line number table. This is enabled by default when
8901 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8902 @dots{}), and outputting DWARF 2 debug information at the normal level.
8903
8904 @item -gvariable-location-views
8905 @itemx -gvariable-location-views=incompat5
8906 @itemx -gno-variable-location-views
8907 @opindex gvariable-location-views
8908 @opindex gvariable-location-views=incompat5
8909 @opindex gno-variable-location-views
8910 Augment variable location lists with progressive view numbers implied
8911 from the line number table. This enables debug information consumers to
8912 inspect state at certain points of the program, even if no instructions
8913 associated with the corresponding source locations are present at that
8914 point. If the assembler lacks support for view numbers in line number
8915 tables, this will cause the compiler to emit the line number table,
8916 which generally makes them somewhat less compact. The augmented line
8917 number tables and location lists are fully backward-compatible, so they
8918 can be consumed by debug information consumers that are not aware of
8919 these augmentations, but they won't derive any benefit from them either.
8920
8921 This is enabled by default when outputting DWARF 2 debug information at
8922 the normal level, as long as there is assembler support,
8923 @option{-fvar-tracking-assignments} is enabled and
8924 @option{-gstrict-dwarf} is not. When assembler support is not
8925 available, this may still be enabled, but it will force GCC to output
8926 internal line number tables, and if
8927 @option{-ginternal-reset-location-views} is not enabled, that will most
8928 certainly lead to silently mismatching location views.
8929
8930 There is a proposed representation for view numbers that is not backward
8931 compatible with the location list format introduced in DWARF 5, that can
8932 be enabled with @option{-gvariable-location-views=incompat5}. This
8933 option may be removed in the future, is only provided as a reference
8934 implementation of the proposed representation. Debug information
8935 consumers are not expected to support this extended format, and they
8936 would be rendered unable to decode location lists using it.
8937
8938 @item -ginternal-reset-location-views
8939 @itemx -gno-internal-reset-location-views
8940 @opindex ginternal-reset-location-views
8941 @opindex gno-internal-reset-location-views
8942 Attempt to determine location views that can be omitted from location
8943 view lists. This requires the compiler to have very accurate insn
8944 length estimates, which isn't always the case, and it may cause
8945 incorrect view lists to be generated silently when using an assembler
8946 that does not support location view lists. The GNU assembler will flag
8947 any such error as a @code{view number mismatch}. This is only enabled
8948 on ports that define a reliable estimation function.
8949
8950 @item -ginline-points
8951 @itemx -gno-inline-points
8952 @opindex ginline-points
8953 @opindex gno-inline-points
8954 Generate extended debug information for inlined functions. Location
8955 view tracking markers are inserted at inlined entry points, so that
8956 address and view numbers can be computed and output in debug
8957 information. This can be enabled independently of location views, in
8958 which case the view numbers won't be output, but it can only be enabled
8959 along with statement frontiers, and it is only enabled by default if
8960 location views are enabled.
8961
8962 @item -gz@r{[}=@var{type}@r{]}
8963 @opindex gz
8964 Produce compressed debug sections in DWARF format, if that is supported.
8965 If @var{type} is not given, the default type depends on the capabilities
8966 of the assembler and linker used. @var{type} may be one of
8967 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8968 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8969 compression in traditional GNU format). If the linker doesn't support
8970 writing compressed debug sections, the option is rejected. Otherwise,
8971 if the assembler does not support them, @option{-gz} is silently ignored
8972 when producing object files.
8973
8974 @item -femit-struct-debug-baseonly
8975 @opindex femit-struct-debug-baseonly
8976 Emit debug information for struct-like types
8977 only when the base name of the compilation source file
8978 matches the base name of file in which the struct is defined.
8979
8980 This option substantially reduces the size of debugging information,
8981 but at significant potential loss in type information to the debugger.
8982 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8983 See @option{-femit-struct-debug-detailed} for more detailed control.
8984
8985 This option works only with DWARF debug output.
8986
8987 @item -femit-struct-debug-reduced
8988 @opindex femit-struct-debug-reduced
8989 Emit debug information for struct-like types
8990 only when the base name of the compilation source file
8991 matches the base name of file in which the type is defined,
8992 unless the struct is a template or defined in a system header.
8993
8994 This option significantly reduces the size of debugging information,
8995 with some potential loss in type information to the debugger.
8996 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8997 See @option{-femit-struct-debug-detailed} for more detailed control.
8998
8999 This option works only with DWARF debug output.
9000
9001 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9002 @opindex femit-struct-debug-detailed
9003 Specify the struct-like types
9004 for which the compiler generates debug information.
9005 The intent is to reduce duplicate struct debug information
9006 between different object files within the same program.
9007
9008 This option is a detailed version of
9009 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9010 which serves for most needs.
9011
9012 A specification has the syntax@*
9013 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9014
9015 The optional first word limits the specification to
9016 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9017 A struct type is used directly when it is the type of a variable, member.
9018 Indirect uses arise through pointers to structs.
9019 That is, when use of an incomplete struct is valid, the use is indirect.
9020 An example is
9021 @samp{struct one direct; struct two * indirect;}.
9022
9023 The optional second word limits the specification to
9024 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9025 Generic structs are a bit complicated to explain.
9026 For C++, these are non-explicit specializations of template classes,
9027 or non-template classes within the above.
9028 Other programming languages have generics,
9029 but @option{-femit-struct-debug-detailed} does not yet implement them.
9030
9031 The third word specifies the source files for those
9032 structs for which the compiler should emit debug information.
9033 The values @samp{none} and @samp{any} have the normal meaning.
9034 The value @samp{base} means that
9035 the base of name of the file in which the type declaration appears
9036 must match the base of the name of the main compilation file.
9037 In practice, this means that when compiling @file{foo.c}, debug information
9038 is generated for types declared in that file and @file{foo.h},
9039 but not other header files.
9040 The value @samp{sys} means those types satisfying @samp{base}
9041 or declared in system or compiler headers.
9042
9043 You may need to experiment to determine the best settings for your application.
9044
9045 The default is @option{-femit-struct-debug-detailed=all}.
9046
9047 This option works only with DWARF debug output.
9048
9049 @item -fno-dwarf2-cfi-asm
9050 @opindex fdwarf2-cfi-asm
9051 @opindex fno-dwarf2-cfi-asm
9052 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9053 instead of using GAS @code{.cfi_*} directives.
9054
9055 @item -fno-eliminate-unused-debug-types
9056 @opindex feliminate-unused-debug-types
9057 @opindex fno-eliminate-unused-debug-types
9058 Normally, when producing DWARF output, GCC avoids producing debug symbol
9059 output for types that are nowhere used in the source file being compiled.
9060 Sometimes it is useful to have GCC emit debugging
9061 information for all types declared in a compilation
9062 unit, regardless of whether or not they are actually used
9063 in that compilation unit, for example
9064 if, in the debugger, you want to cast a value to a type that is
9065 not actually used in your program (but is declared). More often,
9066 however, this results in a significant amount of wasted space.
9067 @end table
9068
9069 @node Optimize Options
9070 @section Options That Control Optimization
9071 @cindex optimize options
9072 @cindex options, optimization
9073
9074 These options control various sorts of optimizations.
9075
9076 Without any optimization option, the compiler's goal is to reduce the
9077 cost of compilation and to make debugging produce the expected
9078 results. Statements are independent: if you stop the program with a
9079 breakpoint between statements, you can then assign a new value to any
9080 variable or change the program counter to any other statement in the
9081 function and get exactly the results you expect from the source
9082 code.
9083
9084 Turning on optimization flags makes the compiler attempt to improve
9085 the performance and/or code size at the expense of compilation time
9086 and possibly the ability to debug the program.
9087
9088 The compiler performs optimization based on the knowledge it has of the
9089 program. Compiling multiple files at once to a single output file mode allows
9090 the compiler to use information gained from all of the files when compiling
9091 each of them.
9092
9093 Not all optimizations are controlled directly by a flag. Only
9094 optimizations that have a flag are listed in this section.
9095
9096 Most optimizations are completely disabled at @option{-O0} or if an
9097 @option{-O} level is not set on the command line, even if individual
9098 optimization flags are specified. Similarly, @option{-Og} suppresses
9099 many optimization passes.
9100
9101 Depending on the target and how GCC was configured, a slightly different
9102 set of optimizations may be enabled at each @option{-O} level than
9103 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
9104 to find out the exact set of optimizations that are enabled at each level.
9105 @xref{Overall Options}, for examples.
9106
9107 @table @gcctabopt
9108 @item -O
9109 @itemx -O1
9110 @opindex O
9111 @opindex O1
9112 Optimize. Optimizing compilation takes somewhat more time, and a lot
9113 more memory for a large function.
9114
9115 With @option{-O}, the compiler tries to reduce code size and execution
9116 time, without performing any optimizations that take a great deal of
9117 compilation time.
9118
9119 @c Note that in addition to the default_options_table list in opts.c,
9120 @c several optimization flags default to true but control optimization
9121 @c passes that are explicitly disabled at -O0.
9122
9123 @option{-O} turns on the following optimization flags:
9124
9125 @c Please keep the following list alphabetized.
9126 @gccoptlist{-fauto-inc-dec @gol
9127 -fbranch-count-reg @gol
9128 -fcombine-stack-adjustments @gol
9129 -fcompare-elim @gol
9130 -fcprop-registers @gol
9131 -fdce @gol
9132 -fdefer-pop @gol
9133 -fdelayed-branch @gol
9134 -fdse @gol
9135 -fforward-propagate @gol
9136 -fguess-branch-probability @gol
9137 -fif-conversion @gol
9138 -fif-conversion2 @gol
9139 -finline-functions-called-once @gol
9140 -fipa-profile @gol
9141 -fipa-pure-const @gol
9142 -fipa-reference @gol
9143 -fipa-reference-addressable @gol
9144 -fmerge-constants @gol
9145 -fmove-loop-invariants @gol
9146 -fomit-frame-pointer @gol
9147 -freorder-blocks @gol
9148 -fshrink-wrap @gol
9149 -fshrink-wrap-separate @gol
9150 -fsplit-wide-types @gol
9151 -fssa-backprop @gol
9152 -fssa-phiopt @gol
9153 -ftree-bit-ccp @gol
9154 -ftree-ccp @gol
9155 -ftree-ch @gol
9156 -ftree-coalesce-vars @gol
9157 -ftree-copy-prop @gol
9158 -ftree-dce @gol
9159 -ftree-dominator-opts @gol
9160 -ftree-dse @gol
9161 -ftree-forwprop @gol
9162 -ftree-fre @gol
9163 -ftree-phiprop @gol
9164 -ftree-pta @gol
9165 -ftree-scev-cprop @gol
9166 -ftree-sink @gol
9167 -ftree-slsr @gol
9168 -ftree-sra @gol
9169 -ftree-ter @gol
9170 -funit-at-a-time}
9171
9172 @item -O2
9173 @opindex O2
9174 Optimize even more. GCC performs nearly all supported optimizations
9175 that do not involve a space-speed tradeoff.
9176 As compared to @option{-O}, this option increases both compilation time
9177 and the performance of the generated code.
9178
9179 @option{-O2} turns on all optimization flags specified by @option{-O}. It
9180 also turns on the following optimization flags:
9181
9182 @c Please keep the following list alphabetized!
9183 @gccoptlist{-falign-functions -falign-jumps @gol
9184 -falign-labels -falign-loops @gol
9185 -fcaller-saves @gol
9186 -fcode-hoisting @gol
9187 -fcrossjumping @gol
9188 -fcse-follow-jumps -fcse-skip-blocks @gol
9189 -fdelete-null-pointer-checks @gol
9190 -fdevirtualize -fdevirtualize-speculatively @gol
9191 -fexpensive-optimizations @gol
9192 -ffinite-loops @gol
9193 -fgcse -fgcse-lm @gol
9194 -fhoist-adjacent-loads @gol
9195 -finline-functions @gol
9196 -finline-small-functions @gol
9197 -findirect-inlining @gol
9198 -fipa-bit-cp -fipa-cp -fipa-icf @gol
9199 -fipa-ra -fipa-sra -fipa-vrp @gol
9200 -fisolate-erroneous-paths-dereference @gol
9201 -flra-remat @gol
9202 -foptimize-sibling-calls @gol
9203 -foptimize-strlen @gol
9204 -fpartial-inlining @gol
9205 -fpeephole2 @gol
9206 -freorder-blocks-algorithm=stc @gol
9207 -freorder-blocks-and-partition -freorder-functions @gol
9208 -frerun-cse-after-loop @gol
9209 -fschedule-insns -fschedule-insns2 @gol
9210 -fsched-interblock -fsched-spec @gol
9211 -fstore-merging @gol
9212 -fstrict-aliasing @gol
9213 -fthread-jumps @gol
9214 -ftree-builtin-call-dce @gol
9215 -ftree-pre @gol
9216 -ftree-switch-conversion -ftree-tail-merge @gol
9217 -ftree-vrp}
9218
9219 Please note the warning under @option{-fgcse} about
9220 invoking @option{-O2} on programs that use computed gotos.
9221
9222 @item -O3
9223 @opindex O3
9224 Optimize yet more. @option{-O3} turns on all optimizations specified
9225 by @option{-O2} and also turns on the following optimization flags:
9226
9227 @c Please keep the following list alphabetized!
9228 @gccoptlist{-fgcse-after-reload @gol
9229 -fipa-cp-clone
9230 -floop-interchange @gol
9231 -floop-unroll-and-jam @gol
9232 -fpeel-loops @gol
9233 -fpredictive-commoning @gol
9234 -fsplit-loops @gol
9235 -fsplit-paths @gol
9236 -ftree-loop-distribution @gol
9237 -ftree-loop-vectorize @gol
9238 -ftree-partial-pre @gol
9239 -ftree-slp-vectorize @gol
9240 -funswitch-loops @gol
9241 -fvect-cost-model @gol
9242 -fvect-cost-model=dynamic @gol
9243 -fversion-loops-for-strides}
9244
9245 @item -O0
9246 @opindex O0
9247 Reduce compilation time and make debugging produce the expected
9248 results. This is the default.
9249
9250 @item -Os
9251 @opindex Os
9252 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
9253 except those that often increase code size:
9254
9255 @gccoptlist{-falign-functions -falign-jumps @gol
9256 -falign-labels -falign-loops @gol
9257 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
9258
9259 It also enables @option{-finline-functions}, causes the compiler to tune for
9260 code size rather than execution speed, and performs further optimizations
9261 designed to reduce code size.
9262
9263 @item -Ofast
9264 @opindex Ofast
9265 Disregard strict standards compliance. @option{-Ofast} enables all
9266 @option{-O3} optimizations. It also enables optimizations that are not
9267 valid for all standard-compliant programs.
9268 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9269 and the Fortran-specific @option{-fstack-arrays}, unless
9270 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9271
9272 @item -Og
9273 @opindex Og
9274 Optimize debugging experience. @option{-Og} should be the optimization
9275 level of choice for the standard edit-compile-debug cycle, offering
9276 a reasonable level of optimization while maintaining fast compilation
9277 and a good debugging experience. It is a better choice than @option{-O0}
9278 for producing debuggable code because some compiler passes
9279 that collect debug information are disabled at @option{-O0}.
9280
9281 Like @option{-O0}, @option{-Og} completely disables a number of
9282 optimization passes so that individual options controlling them have
9283 no effect. Otherwise @option{-Og} enables all @option{-O1}
9284 optimization flags except for those that may interfere with debugging:
9285
9286 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
9287 -fdse -fif-conversion -fif-conversion2 @gol
9288 -finline-functions-called-once @gol
9289 -fmove-loop-invariants -fssa-phiopt @gol
9290 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
9291
9292 @end table
9293
9294 If you use multiple @option{-O} options, with or without level numbers,
9295 the last such option is the one that is effective.
9296
9297 Options of the form @option{-f@var{flag}} specify machine-independent
9298 flags. Most flags have both positive and negative forms; the negative
9299 form of @option{-ffoo} is @option{-fno-foo}. In the table
9300 below, only one of the forms is listed---the one you typically
9301 use. You can figure out the other form by either removing @samp{no-}
9302 or adding it.
9303
9304 The following options control specific optimizations. They are either
9305 activated by @option{-O} options or are related to ones that are. You
9306 can use the following flags in the rare cases when ``fine-tuning'' of
9307 optimizations to be performed is desired.
9308
9309 @table @gcctabopt
9310 @item -fno-defer-pop
9311 @opindex fno-defer-pop
9312 @opindex fdefer-pop
9313 For machines that must pop arguments after a function call, always pop
9314 the arguments as soon as each function returns.
9315 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9316 this allows the compiler to let arguments accumulate on the stack for several
9317 function calls and pop them all at once.
9318
9319 @item -fforward-propagate
9320 @opindex fforward-propagate
9321 Perform a forward propagation pass on RTL@. The pass tries to combine two
9322 instructions and checks if the result can be simplified. If loop unrolling
9323 is active, two passes are performed and the second is scheduled after
9324 loop unrolling.
9325
9326 This option is enabled by default at optimization levels @option{-O},
9327 @option{-O2}, @option{-O3}, @option{-Os}.
9328
9329 @item -ffp-contract=@var{style}
9330 @opindex ffp-contract
9331 @option{-ffp-contract=off} disables floating-point expression contraction.
9332 @option{-ffp-contract=fast} enables floating-point expression contraction
9333 such as forming of fused multiply-add operations if the target has
9334 native support for them.
9335 @option{-ffp-contract=on} enables floating-point expression contraction
9336 if allowed by the language standard. This is currently not implemented
9337 and treated equal to @option{-ffp-contract=off}.
9338
9339 The default is @option{-ffp-contract=fast}.
9340
9341 @item -fomit-frame-pointer
9342 @opindex fomit-frame-pointer
9343 Omit the frame pointer in functions that don't need one. This avoids the
9344 instructions to save, set up and restore the frame pointer; on many targets
9345 it also makes an extra register available.
9346
9347 On some targets this flag has no effect because the standard calling sequence
9348 always uses a frame pointer, so it cannot be omitted.
9349
9350 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9351 is used in all functions. Several targets always omit the frame pointer in
9352 leaf functions.
9353
9354 Enabled by default at @option{-O} and higher.
9355
9356 @item -foptimize-sibling-calls
9357 @opindex foptimize-sibling-calls
9358 Optimize sibling and tail recursive calls.
9359
9360 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9361
9362 @item -foptimize-strlen
9363 @opindex foptimize-strlen
9364 Optimize various standard C string functions (e.g.@: @code{strlen},
9365 @code{strchr} or @code{strcpy}) and
9366 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9367
9368 Enabled at levels @option{-O2}, @option{-O3}.
9369
9370 @item -fno-inline
9371 @opindex fno-inline
9372 @opindex finline
9373 Do not expand any functions inline apart from those marked with
9374 the @code{always_inline} attribute. This is the default when not
9375 optimizing.
9376
9377 Single functions can be exempted from inlining by marking them
9378 with the @code{noinline} attribute.
9379
9380 @item -finline-small-functions
9381 @opindex finline-small-functions
9382 Integrate functions into their callers when their body is smaller than expected
9383 function call code (so overall size of program gets smaller). The compiler
9384 heuristically decides which functions are simple enough to be worth integrating
9385 in this way. This inlining applies to all functions, even those not declared
9386 inline.
9387
9388 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9389
9390 @item -findirect-inlining
9391 @opindex findirect-inlining
9392 Inline also indirect calls that are discovered to be known at compile
9393 time thanks to previous inlining. This option has any effect only
9394 when inlining itself is turned on by the @option{-finline-functions}
9395 or @option{-finline-small-functions} options.
9396
9397 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9398
9399 @item -finline-functions
9400 @opindex finline-functions
9401 Consider all functions for inlining, even if they are not declared inline.
9402 The compiler heuristically decides which functions are worth integrating
9403 in this way.
9404
9405 If all calls to a given function are integrated, and the function is
9406 declared @code{static}, then the function is normally not output as
9407 assembler code in its own right.
9408
9409 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
9410 by @option{-fprofile-use} and @option{-fauto-profile}.
9411
9412 @item -finline-functions-called-once
9413 @opindex finline-functions-called-once
9414 Consider all @code{static} functions called once for inlining into their
9415 caller even if they are not marked @code{inline}. If a call to a given
9416 function is integrated, then the function is not output as assembler code
9417 in its own right.
9418
9419 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9420 but not @option{-Og}.
9421
9422 @item -fearly-inlining
9423 @opindex fearly-inlining
9424 Inline functions marked by @code{always_inline} and functions whose body seems
9425 smaller than the function call overhead early before doing
9426 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
9427 makes profiling significantly cheaper and usually inlining faster on programs
9428 having large chains of nested wrapper functions.
9429
9430 Enabled by default.
9431
9432 @item -fipa-sra
9433 @opindex fipa-sra
9434 Perform interprocedural scalar replacement of aggregates, removal of
9435 unused parameters and replacement of parameters passed by reference
9436 by parameters passed by value.
9437
9438 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9439
9440 @item -finline-limit=@var{n}
9441 @opindex finline-limit
9442 By default, GCC limits the size of functions that can be inlined. This flag
9443 allows coarse control of this limit. @var{n} is the size of functions that
9444 can be inlined in number of pseudo instructions.
9445
9446 Inlining is actually controlled by a number of parameters, which may be
9447 specified individually by using @option{--param @var{name}=@var{value}}.
9448 The @option{-finline-limit=@var{n}} option sets some of these parameters
9449 as follows:
9450
9451 @table @gcctabopt
9452 @item max-inline-insns-single
9453 is set to @var{n}/2.
9454 @item max-inline-insns-auto
9455 is set to @var{n}/2.
9456 @end table
9457
9458 See below for a documentation of the individual
9459 parameters controlling inlining and for the defaults of these parameters.
9460
9461 @emph{Note:} there may be no value to @option{-finline-limit} that results
9462 in default behavior.
9463
9464 @emph{Note:} pseudo instruction represents, in this particular context, an
9465 abstract measurement of function's size. In no way does it represent a count
9466 of assembly instructions and as such its exact meaning might change from one
9467 release to an another.
9468
9469 @item -fno-keep-inline-dllexport
9470 @opindex fno-keep-inline-dllexport
9471 @opindex fkeep-inline-dllexport
9472 This is a more fine-grained version of @option{-fkeep-inline-functions},
9473 which applies only to functions that are declared using the @code{dllexport}
9474 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
9475 Functions}.
9476
9477 @item -fkeep-inline-functions
9478 @opindex fkeep-inline-functions
9479 In C, emit @code{static} functions that are declared @code{inline}
9480 into the object file, even if the function has been inlined into all
9481 of its callers. This switch does not affect functions using the
9482 @code{extern inline} extension in GNU C90@. In C++, emit any and all
9483 inline functions into the object file.
9484
9485 @item -fkeep-static-functions
9486 @opindex fkeep-static-functions
9487 Emit @code{static} functions into the object file, even if the function
9488 is never used.
9489
9490 @item -fkeep-static-consts
9491 @opindex fkeep-static-consts
9492 Emit variables declared @code{static const} when optimization isn't turned
9493 on, even if the variables aren't referenced.
9494
9495 GCC enables this option by default. If you want to force the compiler to
9496 check if a variable is referenced, regardless of whether or not
9497 optimization is turned on, use the @option{-fno-keep-static-consts} option.
9498
9499 @item -fmerge-constants
9500 @opindex fmerge-constants
9501 Attempt to merge identical constants (string constants and floating-point
9502 constants) across compilation units.
9503
9504 This option is the default for optimized compilation if the assembler and
9505 linker support it. Use @option{-fno-merge-constants} to inhibit this
9506 behavior.
9507
9508 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9509
9510 @item -fmerge-all-constants
9511 @opindex fmerge-all-constants
9512 Attempt to merge identical constants and identical variables.
9513
9514 This option implies @option{-fmerge-constants}. In addition to
9515 @option{-fmerge-constants} this considers e.g.@: even constant initialized
9516 arrays or initialized constant variables with integral or floating-point
9517 types. Languages like C or C++ require each variable, including multiple
9518 instances of the same variable in recursive calls, to have distinct locations,
9519 so using this option results in non-conforming
9520 behavior.
9521
9522 @item -fmodulo-sched
9523 @opindex fmodulo-sched
9524 Perform swing modulo scheduling immediately before the first scheduling
9525 pass. This pass looks at innermost loops and reorders their
9526 instructions by overlapping different iterations.
9527
9528 @item -fmodulo-sched-allow-regmoves
9529 @opindex fmodulo-sched-allow-regmoves
9530 Perform more aggressive SMS-based modulo scheduling with register moves
9531 allowed. By setting this flag certain anti-dependences edges are
9532 deleted, which triggers the generation of reg-moves based on the
9533 life-range analysis. This option is effective only with
9534 @option{-fmodulo-sched} enabled.
9535
9536 @item -fno-branch-count-reg
9537 @opindex fno-branch-count-reg
9538 @opindex fbranch-count-reg
9539 Disable the optimization pass that scans for opportunities to use
9540 ``decrement and branch'' instructions on a count register instead of
9541 instruction sequences that decrement a register, compare it against zero, and
9542 then branch based upon the result. This option is only meaningful on
9543 architectures that support such instructions, which include x86, PowerPC,
9544 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
9545 doesn't remove the decrement and branch instructions from the generated
9546 instruction stream introduced by other optimization passes.
9547
9548 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9549 except for @option{-Og}.
9550
9551 @item -fno-function-cse
9552 @opindex fno-function-cse
9553 @opindex ffunction-cse
9554 Do not put function addresses in registers; make each instruction that
9555 calls a constant function contain the function's address explicitly.
9556
9557 This option results in less efficient code, but some strange hacks
9558 that alter the assembler output may be confused by the optimizations
9559 performed when this option is not used.
9560
9561 The default is @option{-ffunction-cse}
9562
9563 @item -fno-zero-initialized-in-bss
9564 @opindex fno-zero-initialized-in-bss
9565 @opindex fzero-initialized-in-bss
9566 If the target supports a BSS section, GCC by default puts variables that
9567 are initialized to zero into BSS@. This can save space in the resulting
9568 code.
9569
9570 This option turns off this behavior because some programs explicitly
9571 rely on variables going to the data section---e.g., so that the
9572 resulting executable can find the beginning of that section and/or make
9573 assumptions based on that.
9574
9575 The default is @option{-fzero-initialized-in-bss}.
9576
9577 @item -fthread-jumps
9578 @opindex fthread-jumps
9579 Perform optimizations that check to see if a jump branches to a
9580 location where another comparison subsumed by the first is found. If
9581 so, the first branch is redirected to either the destination of the
9582 second branch or a point immediately following it, depending on whether
9583 the condition is known to be true or false.
9584
9585 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9586
9587 @item -fsplit-wide-types
9588 @opindex fsplit-wide-types
9589 When using a type that occupies multiple registers, such as @code{long
9590 long} on a 32-bit system, split the registers apart and allocate them
9591 independently. This normally generates better code for those types,
9592 but may make debugging more difficult.
9593
9594 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
9595 @option{-Os}.
9596
9597 @item -fsplit-wide-types-early
9598 @opindex fsplit-wide-types-early
9599 Fully split wide types early, instead of very late.
9600 This option has no effect unless @option{-fsplit-wide-types} is turned on.
9601
9602 This is the default on some targets.
9603
9604 @item -fcse-follow-jumps
9605 @opindex fcse-follow-jumps
9606 In common subexpression elimination (CSE), scan through jump instructions
9607 when the target of the jump is not reached by any other path. For
9608 example, when CSE encounters an @code{if} statement with an
9609 @code{else} clause, CSE follows the jump when the condition
9610 tested is false.
9611
9612 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9613
9614 @item -fcse-skip-blocks
9615 @opindex fcse-skip-blocks
9616 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
9617 follow jumps that conditionally skip over blocks. When CSE
9618 encounters a simple @code{if} statement with no else clause,
9619 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
9620 body of the @code{if}.
9621
9622 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9623
9624 @item -frerun-cse-after-loop
9625 @opindex frerun-cse-after-loop
9626 Re-run common subexpression elimination after loop optimizations are
9627 performed.
9628
9629 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9630
9631 @item -fgcse
9632 @opindex fgcse
9633 Perform a global common subexpression elimination pass.
9634 This pass also performs global constant and copy propagation.
9635
9636 @emph{Note:} When compiling a program using computed gotos, a GCC
9637 extension, you may get better run-time performance if you disable
9638 the global common subexpression elimination pass by adding
9639 @option{-fno-gcse} to the command line.
9640
9641 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9642
9643 @item -fgcse-lm
9644 @opindex fgcse-lm
9645 When @option{-fgcse-lm} is enabled, global common subexpression elimination
9646 attempts to move loads that are only killed by stores into themselves. This
9647 allows a loop containing a load/store sequence to be changed to a load outside
9648 the loop, and a copy/store within the loop.
9649
9650 Enabled by default when @option{-fgcse} is enabled.
9651
9652 @item -fgcse-sm
9653 @opindex fgcse-sm
9654 When @option{-fgcse-sm} is enabled, a store motion pass is run after
9655 global common subexpression elimination. This pass attempts to move
9656 stores out of loops. When used in conjunction with @option{-fgcse-lm},
9657 loops containing a load/store sequence can be changed to a load before
9658 the loop and a store after the loop.
9659
9660 Not enabled at any optimization level.
9661
9662 @item -fgcse-las
9663 @opindex fgcse-las
9664 When @option{-fgcse-las} is enabled, the global common subexpression
9665 elimination pass eliminates redundant loads that come after stores to the
9666 same memory location (both partial and full redundancies).
9667
9668 Not enabled at any optimization level.
9669
9670 @item -fgcse-after-reload
9671 @opindex fgcse-after-reload
9672 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
9673 pass is performed after reload. The purpose of this pass is to clean up
9674 redundant spilling.
9675
9676 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9677
9678 @item -faggressive-loop-optimizations
9679 @opindex faggressive-loop-optimizations
9680 This option tells the loop optimizer to use language constraints to
9681 derive bounds for the number of iterations of a loop. This assumes that
9682 loop code does not invoke undefined behavior by for example causing signed
9683 integer overflows or out-of-bound array accesses. The bounds for the
9684 number of iterations of a loop are used to guide loop unrolling and peeling
9685 and loop exit test optimizations.
9686 This option is enabled by default.
9687
9688 @item -funconstrained-commons
9689 @opindex funconstrained-commons
9690 This option tells the compiler that variables declared in common blocks
9691 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
9692 prevents certain optimizations that depend on knowing the array bounds.
9693
9694 @item -fcrossjumping
9695 @opindex fcrossjumping
9696 Perform cross-jumping transformation.
9697 This transformation unifies equivalent code and saves code size. The
9698 resulting code may or may not perform better than without cross-jumping.
9699
9700 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9701
9702 @item -fauto-inc-dec
9703 @opindex fauto-inc-dec
9704 Combine increments or decrements of addresses with memory accesses.
9705 This pass is always skipped on architectures that do not have
9706 instructions to support this. Enabled by default at @option{-O} and
9707 higher on architectures that support this.
9708
9709 @item -fdce
9710 @opindex fdce
9711 Perform dead code elimination (DCE) on RTL@.
9712 Enabled by default at @option{-O} and higher.
9713
9714 @item -fdse
9715 @opindex fdse
9716 Perform dead store elimination (DSE) on RTL@.
9717 Enabled by default at @option{-O} and higher.
9718
9719 @item -fif-conversion
9720 @opindex fif-conversion
9721 Attempt to transform conditional jumps into branch-less equivalents. This
9722 includes use of conditional moves, min, max, set flags and abs instructions, and
9723 some tricks doable by standard arithmetics. The use of conditional execution
9724 on chips where it is available is controlled by @option{-fif-conversion2}.
9725
9726 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9727 not with @option{-Og}.
9728
9729 @item -fif-conversion2
9730 @opindex fif-conversion2
9731 Use conditional execution (where available) to transform conditional jumps into
9732 branch-less equivalents.
9733
9734 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9735 not with @option{-Og}.
9736
9737 @item -fdeclone-ctor-dtor
9738 @opindex fdeclone-ctor-dtor
9739 The C++ ABI requires multiple entry points for constructors and
9740 destructors: one for a base subobject, one for a complete object, and
9741 one for a virtual destructor that calls operator delete afterwards.
9742 For a hierarchy with virtual bases, the base and complete variants are
9743 clones, which means two copies of the function. With this option, the
9744 base and complete variants are changed to be thunks that call a common
9745 implementation.
9746
9747 Enabled by @option{-Os}.
9748
9749 @item -fdelete-null-pointer-checks
9750 @opindex fdelete-null-pointer-checks
9751 Assume that programs cannot safely dereference null pointers, and that
9752 no code or data element resides at address zero.
9753 This option enables simple constant
9754 folding optimizations at all optimization levels. In addition, other
9755 optimization passes in GCC use this flag to control global dataflow
9756 analyses that eliminate useless checks for null pointers; these assume
9757 that a memory access to address zero always results in a trap, so
9758 that if a pointer is checked after it has already been dereferenced,
9759 it cannot be null.
9760
9761 Note however that in some environments this assumption is not true.
9762 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9763 for programs that depend on that behavior.
9764
9765 This option is enabled by default on most targets. On Nios II ELF, it
9766 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
9767
9768 Passes that use the dataflow information
9769 are enabled independently at different optimization levels.
9770
9771 @item -fdevirtualize
9772 @opindex fdevirtualize
9773 Attempt to convert calls to virtual functions to direct calls. This
9774 is done both within a procedure and interprocedurally as part of
9775 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9776 propagation (@option{-fipa-cp}).
9777 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9778
9779 @item -fdevirtualize-speculatively
9780 @opindex fdevirtualize-speculatively
9781 Attempt to convert calls to virtual functions to speculative direct calls.
9782 Based on the analysis of the type inheritance graph, determine for a given call
9783 the set of likely targets. If the set is small, preferably of size 1, change
9784 the call into a conditional deciding between direct and indirect calls. The
9785 speculative calls enable more optimizations, such as inlining. When they seem
9786 useless after further optimization, they are converted back into original form.
9787
9788 @item -fdevirtualize-at-ltrans
9789 @opindex fdevirtualize-at-ltrans
9790 Stream extra information needed for aggressive devirtualization when running
9791 the link-time optimizer in local transformation mode.
9792 This option enables more devirtualization but
9793 significantly increases the size of streamed data. For this reason it is
9794 disabled by default.
9795
9796 @item -fexpensive-optimizations
9797 @opindex fexpensive-optimizations
9798 Perform a number of minor optimizations that are relatively expensive.
9799
9800 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9801
9802 @item -free
9803 @opindex free
9804 Attempt to remove redundant extension instructions. This is especially
9805 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9806 registers after writing to their lower 32-bit half.
9807
9808 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9809 @option{-O3}, @option{-Os}.
9810
9811 @item -fno-lifetime-dse
9812 @opindex fno-lifetime-dse
9813 @opindex flifetime-dse
9814 In C++ the value of an object is only affected by changes within its
9815 lifetime: when the constructor begins, the object has an indeterminate
9816 value, and any changes during the lifetime of the object are dead when
9817 the object is destroyed. Normally dead store elimination will take
9818 advantage of this; if your code relies on the value of the object
9819 storage persisting beyond the lifetime of the object, you can use this
9820 flag to disable this optimization. To preserve stores before the
9821 constructor starts (e.g.@: because your operator new clears the object
9822 storage) but still treat the object as dead after the destructor, you
9823 can use @option{-flifetime-dse=1}. The default behavior can be
9824 explicitly selected with @option{-flifetime-dse=2}.
9825 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9826
9827 @item -flive-range-shrinkage
9828 @opindex flive-range-shrinkage
9829 Attempt to decrease register pressure through register live range
9830 shrinkage. This is helpful for fast processors with small or moderate
9831 size register sets.
9832
9833 @item -fira-algorithm=@var{algorithm}
9834 @opindex fira-algorithm
9835 Use the specified coloring algorithm for the integrated register
9836 allocator. The @var{algorithm} argument can be @samp{priority}, which
9837 specifies Chow's priority coloring, or @samp{CB}, which specifies
9838 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9839 for all architectures, but for those targets that do support it, it is
9840 the default because it generates better code.
9841
9842 @item -fira-region=@var{region}
9843 @opindex fira-region
9844 Use specified regions for the integrated register allocator. The
9845 @var{region} argument should be one of the following:
9846
9847 @table @samp
9848
9849 @item all
9850 Use all loops as register allocation regions.
9851 This can give the best results for machines with a small and/or
9852 irregular register set.
9853
9854 @item mixed
9855 Use all loops except for loops with small register pressure
9856 as the regions. This value usually gives
9857 the best results in most cases and for most architectures,
9858 and is enabled by default when compiling with optimization for speed
9859 (@option{-O}, @option{-O2}, @dots{}).
9860
9861 @item one
9862 Use all functions as a single region.
9863 This typically results in the smallest code size, and is enabled by default for
9864 @option{-Os} or @option{-O0}.
9865
9866 @end table
9867
9868 @item -fira-hoist-pressure
9869 @opindex fira-hoist-pressure
9870 Use IRA to evaluate register pressure in the code hoisting pass for
9871 decisions to hoist expressions. This option usually results in smaller
9872 code, but it can slow the compiler down.
9873
9874 This option is enabled at level @option{-Os} for all targets.
9875
9876 @item -fira-loop-pressure
9877 @opindex fira-loop-pressure
9878 Use IRA to evaluate register pressure in loops for decisions to move
9879 loop invariants. This option usually results in generation
9880 of faster and smaller code on machines with large register files (>= 32
9881 registers), but it can slow the compiler down.
9882
9883 This option is enabled at level @option{-O3} for some targets.
9884
9885 @item -fno-ira-share-save-slots
9886 @opindex fno-ira-share-save-slots
9887 @opindex fira-share-save-slots
9888 Disable sharing of stack slots used for saving call-used hard
9889 registers living through a call. Each hard register gets a
9890 separate stack slot, and as a result function stack frames are
9891 larger.
9892
9893 @item -fno-ira-share-spill-slots
9894 @opindex fno-ira-share-spill-slots
9895 @opindex fira-share-spill-slots
9896 Disable sharing of stack slots allocated for pseudo-registers. Each
9897 pseudo-register that does not get a hard register gets a separate
9898 stack slot, and as a result function stack frames are larger.
9899
9900 @item -flra-remat
9901 @opindex flra-remat
9902 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9903 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9904 values if it is profitable.
9905
9906 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9907
9908 @item -fdelayed-branch
9909 @opindex fdelayed-branch
9910 If supported for the target machine, attempt to reorder instructions
9911 to exploit instruction slots available after delayed branch
9912 instructions.
9913
9914 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9915 but not at @option{-Og}.
9916
9917 @item -fschedule-insns
9918 @opindex fschedule-insns
9919 If supported for the target machine, attempt to reorder instructions to
9920 eliminate execution stalls due to required data being unavailable. This
9921 helps machines that have slow floating point or memory load instructions
9922 by allowing other instructions to be issued until the result of the load
9923 or floating-point instruction is required.
9924
9925 Enabled at levels @option{-O2}, @option{-O3}.
9926
9927 @item -fschedule-insns2
9928 @opindex fschedule-insns2
9929 Similar to @option{-fschedule-insns}, but requests an additional pass of
9930 instruction scheduling after register allocation has been done. This is
9931 especially useful on machines with a relatively small number of
9932 registers and where memory load instructions take more than one cycle.
9933
9934 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9935
9936 @item -fno-sched-interblock
9937 @opindex fno-sched-interblock
9938 @opindex fsched-interblock
9939 Disable instruction scheduling across basic blocks, which
9940 is normally enabled when scheduling before register allocation, i.e.@:
9941 with @option{-fschedule-insns} or at @option{-O2} or higher.
9942
9943 @item -fno-sched-spec
9944 @opindex fno-sched-spec
9945 @opindex fsched-spec
9946 Disable speculative motion of non-load instructions, which
9947 is normally enabled when scheduling before register allocation, i.e.@:
9948 with @option{-fschedule-insns} or at @option{-O2} or higher.
9949
9950 @item -fsched-pressure
9951 @opindex fsched-pressure
9952 Enable register pressure sensitive insn scheduling before register
9953 allocation. This only makes sense when scheduling before register
9954 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9955 @option{-O2} or higher. Usage of this option can improve the
9956 generated code and decrease its size by preventing register pressure
9957 increase above the number of available hard registers and subsequent
9958 spills in register allocation.
9959
9960 @item -fsched-spec-load
9961 @opindex fsched-spec-load
9962 Allow speculative motion of some load instructions. This only makes
9963 sense when scheduling before register allocation, i.e.@: with
9964 @option{-fschedule-insns} or at @option{-O2} or higher.
9965
9966 @item -fsched-spec-load-dangerous
9967 @opindex fsched-spec-load-dangerous
9968 Allow speculative motion of more load instructions. This only makes
9969 sense when scheduling before register allocation, i.e.@: with
9970 @option{-fschedule-insns} or at @option{-O2} or higher.
9971
9972 @item -fsched-stalled-insns
9973 @itemx -fsched-stalled-insns=@var{n}
9974 @opindex fsched-stalled-insns
9975 Define how many insns (if any) can be moved prematurely from the queue
9976 of stalled insns into the ready list during the second scheduling pass.
9977 @option{-fno-sched-stalled-insns} means that no insns are moved
9978 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9979 on how many queued insns can be moved prematurely.
9980 @option{-fsched-stalled-insns} without a value is equivalent to
9981 @option{-fsched-stalled-insns=1}.
9982
9983 @item -fsched-stalled-insns-dep
9984 @itemx -fsched-stalled-insns-dep=@var{n}
9985 @opindex fsched-stalled-insns-dep
9986 Define how many insn groups (cycles) are examined for a dependency
9987 on a stalled insn that is a candidate for premature removal from the queue
9988 of stalled insns. This has an effect only during the second scheduling pass,
9989 and only if @option{-fsched-stalled-insns} is used.
9990 @option{-fno-sched-stalled-insns-dep} is equivalent to
9991 @option{-fsched-stalled-insns-dep=0}.
9992 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9993 @option{-fsched-stalled-insns-dep=1}.
9994
9995 @item -fsched2-use-superblocks
9996 @opindex fsched2-use-superblocks
9997 When scheduling after register allocation, use superblock scheduling.
9998 This allows motion across basic block boundaries,
9999 resulting in faster schedules. This option is experimental, as not all machine
10000 descriptions used by GCC model the CPU closely enough to avoid unreliable
10001 results from the algorithm.
10002
10003 This only makes sense when scheduling after register allocation, i.e.@: with
10004 @option{-fschedule-insns2} or at @option{-O2} or higher.
10005
10006 @item -fsched-group-heuristic
10007 @opindex fsched-group-heuristic
10008 Enable the group heuristic in the scheduler. This heuristic favors
10009 the instruction that belongs to a schedule group. This is enabled
10010 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10011 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10012
10013 @item -fsched-critical-path-heuristic
10014 @opindex fsched-critical-path-heuristic
10015 Enable the critical-path heuristic in the scheduler. This heuristic favors
10016 instructions on the critical path. This is enabled by default when
10017 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10018 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10019
10020 @item -fsched-spec-insn-heuristic
10021 @opindex fsched-spec-insn-heuristic
10022 Enable the speculative instruction heuristic in the scheduler. This
10023 heuristic favors speculative instructions with greater dependency weakness.
10024 This is enabled by default when scheduling is enabled, i.e.@:
10025 with @option{-fschedule-insns} or @option{-fschedule-insns2}
10026 or at @option{-O2} or higher.
10027
10028 @item -fsched-rank-heuristic
10029 @opindex fsched-rank-heuristic
10030 Enable the rank heuristic in the scheduler. This heuristic favors
10031 the instruction belonging to a basic block with greater size or frequency.
10032 This is enabled by default when scheduling is enabled, i.e.@:
10033 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10034 at @option{-O2} or higher.
10035
10036 @item -fsched-last-insn-heuristic
10037 @opindex fsched-last-insn-heuristic
10038 Enable the last-instruction heuristic in the scheduler. This heuristic
10039 favors the instruction that is less dependent on the last instruction
10040 scheduled. This is enabled by default when scheduling is enabled,
10041 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10042 at @option{-O2} or higher.
10043
10044 @item -fsched-dep-count-heuristic
10045 @opindex fsched-dep-count-heuristic
10046 Enable the dependent-count heuristic in the scheduler. This heuristic
10047 favors the instruction that has more instructions depending on it.
10048 This is enabled by default when scheduling is enabled, i.e.@:
10049 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10050 at @option{-O2} or higher.
10051
10052 @item -freschedule-modulo-scheduled-loops
10053 @opindex freschedule-modulo-scheduled-loops
10054 Modulo scheduling is performed before traditional scheduling. If a loop
10055 is modulo scheduled, later scheduling passes may change its schedule.
10056 Use this option to control that behavior.
10057
10058 @item -fselective-scheduling
10059 @opindex fselective-scheduling
10060 Schedule instructions using selective scheduling algorithm. Selective
10061 scheduling runs instead of the first scheduler pass.
10062
10063 @item -fselective-scheduling2
10064 @opindex fselective-scheduling2
10065 Schedule instructions using selective scheduling algorithm. Selective
10066 scheduling runs instead of the second scheduler pass.
10067
10068 @item -fsel-sched-pipelining
10069 @opindex fsel-sched-pipelining
10070 Enable software pipelining of innermost loops during selective scheduling.
10071 This option has no effect unless one of @option{-fselective-scheduling} or
10072 @option{-fselective-scheduling2} is turned on.
10073
10074 @item -fsel-sched-pipelining-outer-loops
10075 @opindex fsel-sched-pipelining-outer-loops
10076 When pipelining loops during selective scheduling, also pipeline outer loops.
10077 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10078
10079 @item -fsemantic-interposition
10080 @opindex fsemantic-interposition
10081 Some object formats, like ELF, allow interposing of symbols by the
10082 dynamic linker.
10083 This means that for symbols exported from the DSO, the compiler cannot perform
10084 interprocedural propagation, inlining and other optimizations in anticipation
10085 that the function or variable in question may change. While this feature is
10086 useful, for example, to rewrite memory allocation functions by a debugging
10087 implementation, it is expensive in the terms of code quality.
10088 With @option{-fno-semantic-interposition} the compiler assumes that
10089 if interposition happens for functions the overwriting function will have
10090 precisely the same semantics (and side effects).
10091 Similarly if interposition happens
10092 for variables, the constructor of the variable will be the same. The flag
10093 has no effect for functions explicitly declared inline
10094 (where it is never allowed for interposition to change semantics)
10095 and for symbols explicitly declared weak.
10096
10097 @item -fshrink-wrap
10098 @opindex fshrink-wrap
10099 Emit function prologues only before parts of the function that need it,
10100 rather than at the top of the function. This flag is enabled by default at
10101 @option{-O} and higher.
10102
10103 @item -fshrink-wrap-separate
10104 @opindex fshrink-wrap-separate
10105 Shrink-wrap separate parts of the prologue and epilogue separately, so that
10106 those parts are only executed when needed.
10107 This option is on by default, but has no effect unless @option{-fshrink-wrap}
10108 is also turned on and the target supports this.
10109
10110 @item -fcaller-saves
10111 @opindex fcaller-saves
10112 Enable allocation of values to registers that are clobbered by
10113 function calls, by emitting extra instructions to save and restore the
10114 registers around such calls. Such allocation is done only when it
10115 seems to result in better code.
10116
10117 This option is always enabled by default on certain machines, usually
10118 those which have no call-preserved registers to use instead.
10119
10120 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10121
10122 @item -fcombine-stack-adjustments
10123 @opindex fcombine-stack-adjustments
10124 Tracks stack adjustments (pushes and pops) and stack memory references
10125 and then tries to find ways to combine them.
10126
10127 Enabled by default at @option{-O1} and higher.
10128
10129 @item -fipa-ra
10130 @opindex fipa-ra
10131 Use caller save registers for allocation if those registers are not used by
10132 any called function. In that case it is not necessary to save and restore
10133 them around calls. This is only possible if called functions are part of
10134 same compilation unit as current function and they are compiled before it.
10135
10136 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10137 is disabled if generated code will be instrumented for profiling
10138 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10139 exactly (this happens on targets that do not expose prologues
10140 and epilogues in RTL).
10141
10142 @item -fconserve-stack
10143 @opindex fconserve-stack
10144 Attempt to minimize stack usage. The compiler attempts to use less
10145 stack space, even if that makes the program slower. This option
10146 implies setting the @option{large-stack-frame} parameter to 100
10147 and the @option{large-stack-frame-growth} parameter to 400.
10148
10149 @item -ftree-reassoc
10150 @opindex ftree-reassoc
10151 Perform reassociation on trees. This flag is enabled by default
10152 at @option{-O} and higher.
10153
10154 @item -fcode-hoisting
10155 @opindex fcode-hoisting
10156 Perform code hoisting. Code hoisting tries to move the
10157 evaluation of expressions executed on all paths to the function exit
10158 as early as possible. This is especially useful as a code size
10159 optimization, but it often helps for code speed as well.
10160 This flag is enabled by default at @option{-O2} and higher.
10161
10162 @item -ftree-pre
10163 @opindex ftree-pre
10164 Perform partial redundancy elimination (PRE) on trees. This flag is
10165 enabled by default at @option{-O2} and @option{-O3}.
10166
10167 @item -ftree-partial-pre
10168 @opindex ftree-partial-pre
10169 Make partial redundancy elimination (PRE) more aggressive. This flag is
10170 enabled by default at @option{-O3}.
10171
10172 @item -ftree-forwprop
10173 @opindex ftree-forwprop
10174 Perform forward propagation on trees. This flag is enabled by default
10175 at @option{-O} and higher.
10176
10177 @item -ftree-fre
10178 @opindex ftree-fre
10179 Perform full redundancy elimination (FRE) on trees. The difference
10180 between FRE and PRE is that FRE only considers expressions
10181 that are computed on all paths leading to the redundant computation.
10182 This analysis is faster than PRE, though it exposes fewer redundancies.
10183 This flag is enabled by default at @option{-O} and higher.
10184
10185 @item -ftree-phiprop
10186 @opindex ftree-phiprop
10187 Perform hoisting of loads from conditional pointers on trees. This
10188 pass is enabled by default at @option{-O} and higher.
10189
10190 @item -fhoist-adjacent-loads
10191 @opindex fhoist-adjacent-loads
10192 Speculatively hoist loads from both branches of an if-then-else if the
10193 loads are from adjacent locations in the same structure and the target
10194 architecture has a conditional move instruction. This flag is enabled
10195 by default at @option{-O2} and higher.
10196
10197 @item -ftree-copy-prop
10198 @opindex ftree-copy-prop
10199 Perform copy propagation on trees. This pass eliminates unnecessary
10200 copy operations. This flag is enabled by default at @option{-O} and
10201 higher.
10202
10203 @item -fipa-pure-const
10204 @opindex fipa-pure-const
10205 Discover which functions are pure or constant.
10206 Enabled by default at @option{-O} and higher.
10207
10208 @item -fipa-reference
10209 @opindex fipa-reference
10210 Discover which static variables do not escape the
10211 compilation unit.
10212 Enabled by default at @option{-O} and higher.
10213
10214 @item -fipa-reference-addressable
10215 @opindex fipa-reference-addressable
10216 Discover read-only, write-only and non-addressable static variables.
10217 Enabled by default at @option{-O} and higher.
10218
10219 @item -fipa-stack-alignment
10220 @opindex fipa-stack-alignment
10221 Reduce stack alignment on call sites if possible.
10222 Enabled by default.
10223
10224 @item -fipa-pta
10225 @opindex fipa-pta
10226 Perform interprocedural pointer analysis and interprocedural modification
10227 and reference analysis. This option can cause excessive memory and
10228 compile-time usage on large compilation units. It is not enabled by
10229 default at any optimization level.
10230
10231 @item -fipa-profile
10232 @opindex fipa-profile
10233 Perform interprocedural profile propagation. The functions called only from
10234 cold functions are marked as cold. Also functions executed once (such as
10235 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10236 functions and loop less parts of functions executed once are then optimized for
10237 size.
10238 Enabled by default at @option{-O} and higher.
10239
10240 @item -fipa-cp
10241 @opindex fipa-cp
10242 Perform interprocedural constant propagation.
10243 This optimization analyzes the program to determine when values passed
10244 to functions are constants and then optimizes accordingly.
10245 This optimization can substantially increase performance
10246 if the application has constants passed to functions.
10247 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10248 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10249
10250 @item -fipa-cp-clone
10251 @opindex fipa-cp-clone
10252 Perform function cloning to make interprocedural constant propagation stronger.
10253 When enabled, interprocedural constant propagation performs function cloning
10254 when externally visible function can be called with constant arguments.
10255 Because this optimization can create multiple copies of functions,
10256 it may significantly increase code size
10257 (see @option{--param ipcp-unit-growth=@var{value}}).
10258 This flag is enabled by default at @option{-O3}.
10259 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10260
10261 @item -fipa-bit-cp
10262 @opindex fipa-bit-cp
10263 When enabled, perform interprocedural bitwise constant
10264 propagation. This flag is enabled by default at @option{-O2} and
10265 by @option{-fprofile-use} and @option{-fauto-profile}.
10266 It requires that @option{-fipa-cp} is enabled.
10267
10268 @item -fipa-vrp
10269 @opindex fipa-vrp
10270 When enabled, perform interprocedural propagation of value
10271 ranges. This flag is enabled by default at @option{-O2}. It requires
10272 that @option{-fipa-cp} is enabled.
10273
10274 @item -fipa-icf
10275 @opindex fipa-icf
10276 Perform Identical Code Folding for functions and read-only variables.
10277 The optimization reduces code size and may disturb unwind stacks by replacing
10278 a function by equivalent one with a different name. The optimization works
10279 more effectively with link-time optimization enabled.
10280
10281 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10282 works on different levels and thus the optimizations are not same - there are
10283 equivalences that are found only by GCC and equivalences found only by Gold.
10284
10285 This flag is enabled by default at @option{-O2} and @option{-Os}.
10286
10287 @item -flive-patching=@var{level}
10288 @opindex flive-patching
10289 Control GCC's optimizations to produce output suitable for live-patching.
10290
10291 If the compiler's optimization uses a function's body or information extracted
10292 from its body to optimize/change another function, the latter is called an
10293 impacted function of the former. If a function is patched, its impacted
10294 functions should be patched too.
10295
10296 The impacted functions are determined by the compiler's interprocedural
10297 optimizations. For example, a caller is impacted when inlining a function
10298 into its caller,
10299 cloning a function and changing its caller to call this new clone,
10300 or extracting a function's pureness/constness information to optimize
10301 its direct or indirect callers, etc.
10302
10303 Usually, the more IPA optimizations enabled, the larger the number of
10304 impacted functions for each function. In order to control the number of
10305 impacted functions and more easily compute the list of impacted function,
10306 IPA optimizations can be partially enabled at two different levels.
10307
10308 The @var{level} argument should be one of the following:
10309
10310 @table @samp
10311
10312 @item inline-clone
10313
10314 Only enable inlining and cloning optimizations, which includes inlining,
10315 cloning, interprocedural scalar replacement of aggregates and partial inlining.
10316 As a result, when patching a function, all its callers and its clones'
10317 callers are impacted, therefore need to be patched as well.
10318
10319 @option{-flive-patching=inline-clone} disables the following optimization flags:
10320 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
10321 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
10322 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
10323 -fipa-stack-alignment}
10324
10325 @item inline-only-static
10326
10327 Only enable inlining of static functions.
10328 As a result, when patching a static function, all its callers are impacted
10329 and so need to be patched as well.
10330
10331 In addition to all the flags that @option{-flive-patching=inline-clone}
10332 disables,
10333 @option{-flive-patching=inline-only-static} disables the following additional
10334 optimization flags:
10335 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
10336
10337 @end table
10338
10339 When @option{-flive-patching} is specified without any value, the default value
10340 is @var{inline-clone}.
10341
10342 This flag is disabled by default.
10343
10344 Note that @option{-flive-patching} is not supported with link-time optimization
10345 (@option{-flto}).
10346
10347 @item -fisolate-erroneous-paths-dereference
10348 @opindex fisolate-erroneous-paths-dereference
10349 Detect paths that trigger erroneous or undefined behavior due to
10350 dereferencing a null pointer. Isolate those paths from the main control
10351 flow and turn the statement with erroneous or undefined behavior into a trap.
10352 This flag is enabled by default at @option{-O2} and higher and depends on
10353 @option{-fdelete-null-pointer-checks} also being enabled.
10354
10355 @item -fisolate-erroneous-paths-attribute
10356 @opindex fisolate-erroneous-paths-attribute
10357 Detect paths that trigger erroneous or undefined behavior due to a null value
10358 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10359 attribute. Isolate those paths from the main control flow and turn the
10360 statement with erroneous or undefined behavior into a trap. This is not
10361 currently enabled, but may be enabled by @option{-O2} in the future.
10362
10363 @item -ftree-sink
10364 @opindex ftree-sink
10365 Perform forward store motion on trees. This flag is
10366 enabled by default at @option{-O} and higher.
10367
10368 @item -ftree-bit-ccp
10369 @opindex ftree-bit-ccp
10370 Perform sparse conditional bit constant propagation on trees and propagate
10371 pointer alignment information.
10372 This pass only operates on local scalar variables and is enabled by default
10373 at @option{-O1} and higher, except for @option{-Og}.
10374 It requires that @option{-ftree-ccp} is enabled.
10375
10376 @item -ftree-ccp
10377 @opindex ftree-ccp
10378 Perform sparse conditional constant propagation (CCP) on trees. This
10379 pass only operates on local scalar variables and is enabled by default
10380 at @option{-O} and higher.
10381
10382 @item -fssa-backprop
10383 @opindex fssa-backprop
10384 Propagate information about uses of a value up the definition chain
10385 in order to simplify the definitions. For example, this pass strips
10386 sign operations if the sign of a value never matters. The flag is
10387 enabled by default at @option{-O} and higher.
10388
10389 @item -fssa-phiopt
10390 @opindex fssa-phiopt
10391 Perform pattern matching on SSA PHI nodes to optimize conditional
10392 code. This pass is enabled by default at @option{-O1} and higher,
10393 except for @option{-Og}.
10394
10395 @item -ftree-switch-conversion
10396 @opindex ftree-switch-conversion
10397 Perform conversion of simple initializations in a switch to
10398 initializations from a scalar array. This flag is enabled by default
10399 at @option{-O2} and higher.
10400
10401 @item -ftree-tail-merge
10402 @opindex ftree-tail-merge
10403 Look for identical code sequences. When found, replace one with a jump to the
10404 other. This optimization is known as tail merging or cross jumping. This flag
10405 is enabled by default at @option{-O2} and higher. The compilation time
10406 in this pass can
10407 be limited using @option{max-tail-merge-comparisons} parameter and
10408 @option{max-tail-merge-iterations} parameter.
10409
10410 @item -ftree-dce
10411 @opindex ftree-dce
10412 Perform dead code elimination (DCE) on trees. This flag is enabled by
10413 default at @option{-O} and higher.
10414
10415 @item -ftree-builtin-call-dce
10416 @opindex ftree-builtin-call-dce
10417 Perform conditional dead code elimination (DCE) for calls to built-in functions
10418 that may set @code{errno} but are otherwise free of side effects. This flag is
10419 enabled by default at @option{-O2} and higher if @option{-Os} is not also
10420 specified.
10421
10422 @item -ffinite-loops
10423 @opindex ffinite-loops
10424 @opindex fno-finite-loops
10425 Assume that a loop with an exit will eventually take the exit and not loop
10426 indefinitely. This allows the compiler to remove loops that otherwise have
10427 no side-effects, not considering eventual endless looping as such.
10428
10429 This option is enabled by default at @option{-O2} for C++ with -std=c++11
10430 or higher.
10431
10432 @item -ftree-dominator-opts
10433 @opindex ftree-dominator-opts
10434 Perform a variety of simple scalar cleanups (constant/copy
10435 propagation, redundancy elimination, range propagation and expression
10436 simplification) based on a dominator tree traversal. This also
10437 performs jump threading (to reduce jumps to jumps). This flag is
10438 enabled by default at @option{-O} and higher.
10439
10440 @item -ftree-dse
10441 @opindex ftree-dse
10442 Perform dead store elimination (DSE) on trees. A dead store is a store into
10443 a memory location that is later overwritten by another store without
10444 any intervening loads. In this case the earlier store can be deleted. This
10445 flag is enabled by default at @option{-O} and higher.
10446
10447 @item -ftree-ch
10448 @opindex ftree-ch
10449 Perform loop header copying on trees. This is beneficial since it increases
10450 effectiveness of code motion optimizations. It also saves one jump. This flag
10451 is enabled by default at @option{-O} and higher. It is not enabled
10452 for @option{-Os}, since it usually increases code size.
10453
10454 @item -ftree-loop-optimize
10455 @opindex ftree-loop-optimize
10456 Perform loop optimizations on trees. This flag is enabled by default
10457 at @option{-O} and higher.
10458
10459 @item -ftree-loop-linear
10460 @itemx -floop-strip-mine
10461 @itemx -floop-block
10462 @opindex ftree-loop-linear
10463 @opindex floop-strip-mine
10464 @opindex floop-block
10465 Perform loop nest optimizations. Same as
10466 @option{-floop-nest-optimize}. To use this code transformation, GCC has
10467 to be configured with @option{--with-isl} to enable the Graphite loop
10468 transformation infrastructure.
10469
10470 @item -fgraphite-identity
10471 @opindex fgraphite-identity
10472 Enable the identity transformation for graphite. For every SCoP we generate
10473 the polyhedral representation and transform it back to gimple. Using
10474 @option{-fgraphite-identity} we can check the costs or benefits of the
10475 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
10476 are also performed by the code generator isl, like index splitting and
10477 dead code elimination in loops.
10478
10479 @item -floop-nest-optimize
10480 @opindex floop-nest-optimize
10481 Enable the isl based loop nest optimizer. This is a generic loop nest
10482 optimizer based on the Pluto optimization algorithms. It calculates a loop
10483 structure optimized for data-locality and parallelism. This option
10484 is experimental.
10485
10486 @item -floop-parallelize-all
10487 @opindex floop-parallelize-all
10488 Use the Graphite data dependence analysis to identify loops that can
10489 be parallelized. Parallelize all the loops that can be analyzed to
10490 not contain loop carried dependences without checking that it is
10491 profitable to parallelize the loops.
10492
10493 @item -ftree-coalesce-vars
10494 @opindex ftree-coalesce-vars
10495 While transforming the program out of the SSA representation, attempt to
10496 reduce copying by coalescing versions of different user-defined
10497 variables, instead of just compiler temporaries. This may severely
10498 limit the ability to debug an optimized program compiled with
10499 @option{-fno-var-tracking-assignments}. In the negated form, this flag
10500 prevents SSA coalescing of user variables. This option is enabled by
10501 default if optimization is enabled, and it does very little otherwise.
10502
10503 @item -ftree-loop-if-convert
10504 @opindex ftree-loop-if-convert
10505 Attempt to transform conditional jumps in the innermost loops to
10506 branch-less equivalents. The intent is to remove control-flow from
10507 the innermost loops in order to improve the ability of the
10508 vectorization pass to handle these loops. This is enabled by default
10509 if vectorization is enabled.
10510
10511 @item -ftree-loop-distribution
10512 @opindex ftree-loop-distribution
10513 Perform loop distribution. This flag can improve cache performance on
10514 big loop bodies and allow further loop optimizations, like
10515 parallelization or vectorization, to take place. For example, the loop
10516 @smallexample
10517 DO I = 1, N
10518 A(I) = B(I) + C
10519 D(I) = E(I) * F
10520 ENDDO
10521 @end smallexample
10522 is transformed to
10523 @smallexample
10524 DO I = 1, N
10525 A(I) = B(I) + C
10526 ENDDO
10527 DO I = 1, N
10528 D(I) = E(I) * F
10529 ENDDO
10530 @end smallexample
10531 This flag is enabled by default at @option{-O3}.
10532 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10533
10534 @item -ftree-loop-distribute-patterns
10535 @opindex ftree-loop-distribute-patterns
10536 Perform loop distribution of patterns that can be code generated with
10537 calls to a library. This flag is enabled by default at @option{-O2} and
10538 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10539
10540 This pass distributes the initialization loops and generates a call to
10541 memset zero. For example, the loop
10542 @smallexample
10543 DO I = 1, N
10544 A(I) = 0
10545 B(I) = A(I) + I
10546 ENDDO
10547 @end smallexample
10548 is transformed to
10549 @smallexample
10550 DO I = 1, N
10551 A(I) = 0
10552 ENDDO
10553 DO I = 1, N
10554 B(I) = A(I) + I
10555 ENDDO
10556 @end smallexample
10557 and the initialization loop is transformed into a call to memset zero.
10558 This flag is enabled by default at @option{-O3}.
10559 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10560
10561 @item -floop-interchange
10562 @opindex floop-interchange
10563 Perform loop interchange outside of graphite. This flag can improve cache
10564 performance on loop nest and allow further loop optimizations, like
10565 vectorization, to take place. For example, the loop
10566 @smallexample
10567 for (int i = 0; i < N; i++)
10568 for (int j = 0; j < N; j++)
10569 for (int k = 0; k < N; k++)
10570 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10571 @end smallexample
10572 is transformed to
10573 @smallexample
10574 for (int i = 0; i < N; i++)
10575 for (int k = 0; k < N; k++)
10576 for (int j = 0; j < N; j++)
10577 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10578 @end smallexample
10579 This flag is enabled by default at @option{-O3}.
10580 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10581
10582 @item -floop-unroll-and-jam
10583 @opindex floop-unroll-and-jam
10584 Apply unroll and jam transformations on feasible loops. In a loop
10585 nest this unrolls the outer loop by some factor and fuses the resulting
10586 multiple inner loops. This flag is enabled by default at @option{-O3}.
10587 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10588
10589 @item -ftree-loop-im
10590 @opindex ftree-loop-im
10591 Perform loop invariant motion on trees. This pass moves only invariants that
10592 are hard to handle at RTL level (function calls, operations that expand to
10593 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
10594 operands of conditions that are invariant out of the loop, so that we can use
10595 just trivial invariantness analysis in loop unswitching. The pass also includes
10596 store motion.
10597
10598 @item -ftree-loop-ivcanon
10599 @opindex ftree-loop-ivcanon
10600 Create a canonical counter for number of iterations in loops for which
10601 determining number of iterations requires complicated analysis. Later
10602 optimizations then may determine the number easily. Useful especially
10603 in connection with unrolling.
10604
10605 @item -ftree-scev-cprop
10606 @opindex ftree-scev-cprop
10607 Perform final value replacement. If a variable is modified in a loop
10608 in such a way that its value when exiting the loop can be determined using
10609 only its initial value and the number of loop iterations, replace uses of
10610 the final value by such a computation, provided it is sufficiently cheap.
10611 This reduces data dependencies and may allow further simplifications.
10612 Enabled by default at @option{-O} and higher.
10613
10614 @item -fivopts
10615 @opindex fivopts
10616 Perform induction variable optimizations (strength reduction, induction
10617 variable merging and induction variable elimination) on trees.
10618
10619 @item -ftree-parallelize-loops=n
10620 @opindex ftree-parallelize-loops
10621 Parallelize loops, i.e., split their iteration space to run in n threads.
10622 This is only possible for loops whose iterations are independent
10623 and can be arbitrarily reordered. The optimization is only
10624 profitable on multiprocessor machines, for loops that are CPU-intensive,
10625 rather than constrained e.g.@: by memory bandwidth. This option
10626 implies @option{-pthread}, and thus is only supported on targets
10627 that have support for @option{-pthread}.
10628
10629 @item -ftree-pta
10630 @opindex ftree-pta
10631 Perform function-local points-to analysis on trees. This flag is
10632 enabled by default at @option{-O1} and higher, except for @option{-Og}.
10633
10634 @item -ftree-sra
10635 @opindex ftree-sra
10636 Perform scalar replacement of aggregates. This pass replaces structure
10637 references with scalars to prevent committing structures to memory too
10638 early. This flag is enabled by default at @option{-O1} and higher,
10639 except for @option{-Og}.
10640
10641 @item -fstore-merging
10642 @opindex fstore-merging
10643 Perform merging of narrow stores to consecutive memory addresses. This pass
10644 merges contiguous stores of immediate values narrower than a word into fewer
10645 wider stores to reduce the number of instructions. This is enabled by default
10646 at @option{-O2} and higher as well as @option{-Os}.
10647
10648 @item -ftree-ter
10649 @opindex ftree-ter
10650 Perform temporary expression replacement during the SSA->normal phase. Single
10651 use/single def temporaries are replaced at their use location with their
10652 defining expression. This results in non-GIMPLE code, but gives the expanders
10653 much more complex trees to work on resulting in better RTL generation. This is
10654 enabled by default at @option{-O} and higher.
10655
10656 @item -ftree-slsr
10657 @opindex ftree-slsr
10658 Perform straight-line strength reduction on trees. This recognizes related
10659 expressions involving multiplications and replaces them by less expensive
10660 calculations when possible. This is enabled by default at @option{-O} and
10661 higher.
10662
10663 @item -ftree-vectorize
10664 @opindex ftree-vectorize
10665 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
10666 and @option{-ftree-slp-vectorize} if not explicitly specified.
10667
10668 @item -ftree-loop-vectorize
10669 @opindex ftree-loop-vectorize
10670 Perform loop vectorization on trees. This flag is enabled by default at
10671 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10672 and @option{-fauto-profile}.
10673
10674 @item -ftree-slp-vectorize
10675 @opindex ftree-slp-vectorize
10676 Perform basic block vectorization on trees. This flag is enabled by default at
10677 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10678 and @option{-fauto-profile}.
10679
10680 @item -fvect-cost-model=@var{model}
10681 @opindex fvect-cost-model
10682 Alter the cost model used for vectorization. The @var{model} argument
10683 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
10684 With the @samp{unlimited} model the vectorized code-path is assumed
10685 to be profitable while with the @samp{dynamic} model a runtime check
10686 guards the vectorized code-path to enable it only for iteration
10687 counts that will likely execute faster than when executing the original
10688 scalar loop. The @samp{cheap} model disables vectorization of
10689 loops where doing so would be cost prohibitive for example due to
10690 required runtime checks for data dependence or alignment but otherwise
10691 is equal to the @samp{dynamic} model.
10692 The default cost model depends on other optimization flags and is
10693 either @samp{dynamic} or @samp{cheap}.
10694
10695 @item -fsimd-cost-model=@var{model}
10696 @opindex fsimd-cost-model
10697 Alter the cost model used for vectorization of loops marked with the OpenMP
10698 simd directive. The @var{model} argument should be one of
10699 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
10700 have the same meaning as described in @option{-fvect-cost-model} and by
10701 default a cost model defined with @option{-fvect-cost-model} is used.
10702
10703 @item -ftree-vrp
10704 @opindex ftree-vrp
10705 Perform Value Range Propagation on trees. This is similar to the
10706 constant propagation pass, but instead of values, ranges of values are
10707 propagated. This allows the optimizers to remove unnecessary range
10708 checks like array bound checks and null pointer checks. This is
10709 enabled by default at @option{-O2} and higher. Null pointer check
10710 elimination is only done if @option{-fdelete-null-pointer-checks} is
10711 enabled.
10712
10713 @item -fsplit-paths
10714 @opindex fsplit-paths
10715 Split paths leading to loop backedges. This can improve dead code
10716 elimination and common subexpression elimination. This is enabled by
10717 default at @option{-O3} and above.
10718
10719 @item -fsplit-ivs-in-unroller
10720 @opindex fsplit-ivs-in-unroller
10721 Enables expression of values of induction variables in later iterations
10722 of the unrolled loop using the value in the first iteration. This breaks
10723 long dependency chains, thus improving efficiency of the scheduling passes.
10724
10725 A combination of @option{-fweb} and CSE is often sufficient to obtain the
10726 same effect. However, that is not reliable in cases where the loop body
10727 is more complicated than a single basic block. It also does not work at all
10728 on some architectures due to restrictions in the CSE pass.
10729
10730 This optimization is enabled by default.
10731
10732 @item -fvariable-expansion-in-unroller
10733 @opindex fvariable-expansion-in-unroller
10734 With this option, the compiler creates multiple copies of some
10735 local variables when unrolling a loop, which can result in superior code.
10736
10737 This optimization is enabled by default for PowerPC targets, but disabled
10738 by default otherwise.
10739
10740 @item -fpartial-inlining
10741 @opindex fpartial-inlining
10742 Inline parts of functions. This option has any effect only
10743 when inlining itself is turned on by the @option{-finline-functions}
10744 or @option{-finline-small-functions} options.
10745
10746 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10747
10748 @item -fpredictive-commoning
10749 @opindex fpredictive-commoning
10750 Perform predictive commoning optimization, i.e., reusing computations
10751 (especially memory loads and stores) performed in previous
10752 iterations of loops.
10753
10754 This option is enabled at level @option{-O3}.
10755 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10756
10757 @item -fprefetch-loop-arrays
10758 @opindex fprefetch-loop-arrays
10759 If supported by the target machine, generate instructions to prefetch
10760 memory to improve the performance of loops that access large arrays.
10761
10762 This option may generate better or worse code; results are highly
10763 dependent on the structure of loops within the source code.
10764
10765 Disabled at level @option{-Os}.
10766
10767 @item -fno-printf-return-value
10768 @opindex fno-printf-return-value
10769 @opindex fprintf-return-value
10770 Do not substitute constants for known return value of formatted output
10771 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10772 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
10773 transformation allows GCC to optimize or even eliminate branches based
10774 on the known return value of these functions called with arguments that
10775 are either constant, or whose values are known to be in a range that
10776 makes determining the exact return value possible. For example, when
10777 @option{-fprintf-return-value} is in effect, both the branch and the
10778 body of the @code{if} statement (but not the call to @code{snprint})
10779 can be optimized away when @code{i} is a 32-bit or smaller integer
10780 because the return value is guaranteed to be at most 8.
10781
10782 @smallexample
10783 char buf[9];
10784 if (snprintf (buf, "%08x", i) >= sizeof buf)
10785 @dots{}
10786 @end smallexample
10787
10788 The @option{-fprintf-return-value} option relies on other optimizations
10789 and yields best results with @option{-O2} and above. It works in tandem
10790 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10791 options. The @option{-fprintf-return-value} option is enabled by default.
10792
10793 @item -fno-peephole
10794 @itemx -fno-peephole2
10795 @opindex fno-peephole
10796 @opindex fpeephole
10797 @opindex fno-peephole2
10798 @opindex fpeephole2
10799 Disable any machine-specific peephole optimizations. The difference
10800 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10801 are implemented in the compiler; some targets use one, some use the
10802 other, a few use both.
10803
10804 @option{-fpeephole} is enabled by default.
10805 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10806
10807 @item -fno-guess-branch-probability
10808 @opindex fno-guess-branch-probability
10809 @opindex fguess-branch-probability
10810 Do not guess branch probabilities using heuristics.
10811
10812 GCC uses heuristics to guess branch probabilities if they are
10813 not provided by profiling feedback (@option{-fprofile-arcs}). These
10814 heuristics are based on the control flow graph. If some branch probabilities
10815 are specified by @code{__builtin_expect}, then the heuristics are
10816 used to guess branch probabilities for the rest of the control flow graph,
10817 taking the @code{__builtin_expect} info into account. The interactions
10818 between the heuristics and @code{__builtin_expect} can be complex, and in
10819 some cases, it may be useful to disable the heuristics so that the effects
10820 of @code{__builtin_expect} are easier to understand.
10821
10822 It is also possible to specify expected probability of the expression
10823 with @code{__builtin_expect_with_probability} built-in function.
10824
10825 The default is @option{-fguess-branch-probability} at levels
10826 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10827
10828 @item -freorder-blocks
10829 @opindex freorder-blocks
10830 Reorder basic blocks in the compiled function in order to reduce number of
10831 taken branches and improve code locality.
10832
10833 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10834
10835 @item -freorder-blocks-algorithm=@var{algorithm}
10836 @opindex freorder-blocks-algorithm
10837 Use the specified algorithm for basic block reordering. The
10838 @var{algorithm} argument can be @samp{simple}, which does not increase
10839 code size (except sometimes due to secondary effects like alignment),
10840 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10841 put all often executed code together, minimizing the number of branches
10842 executed by making extra copies of code.
10843
10844 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10845 @samp{stc} at levels @option{-O2}, @option{-O3}.
10846
10847 @item -freorder-blocks-and-partition
10848 @opindex freorder-blocks-and-partition
10849 In addition to reordering basic blocks in the compiled function, in order
10850 to reduce number of taken branches, partitions hot and cold basic blocks
10851 into separate sections of the assembly and @file{.o} files, to improve
10852 paging and cache locality performance.
10853
10854 This optimization is automatically turned off in the presence of
10855 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10856 section attribute and on any architecture that does not support named
10857 sections. When @option{-fsplit-stack} is used this option is not
10858 enabled by default (to avoid linker errors), but may be enabled
10859 explicitly (if using a working linker).
10860
10861 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10862
10863 @item -freorder-functions
10864 @opindex freorder-functions
10865 Reorder functions in the object file in order to
10866 improve code locality. This is implemented by using special
10867 subsections @code{.text.hot} for most frequently executed functions and
10868 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10869 the linker so object file format must support named sections and linker must
10870 place them in a reasonable way.
10871
10872 This option isn't effective unless you either provide profile feedback
10873 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10874 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10875
10876 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10877
10878 @item -fstrict-aliasing
10879 @opindex fstrict-aliasing
10880 Allow the compiler to assume the strictest aliasing rules applicable to
10881 the language being compiled. For C (and C++), this activates
10882 optimizations based on the type of expressions. In particular, an
10883 object of one type is assumed never to reside at the same address as an
10884 object of a different type, unless the types are almost the same. For
10885 example, an @code{unsigned int} can alias an @code{int}, but not a
10886 @code{void*} or a @code{double}. A character type may alias any other
10887 type.
10888
10889 @anchor{Type-punning}Pay special attention to code like this:
10890 @smallexample
10891 union a_union @{
10892 int i;
10893 double d;
10894 @};
10895
10896 int f() @{
10897 union a_union t;
10898 t.d = 3.0;
10899 return t.i;
10900 @}
10901 @end smallexample
10902 The practice of reading from a different union member than the one most
10903 recently written to (called ``type-punning'') is common. Even with
10904 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10905 is accessed through the union type. So, the code above works as
10906 expected. @xref{Structures unions enumerations and bit-fields
10907 implementation}. However, this code might not:
10908 @smallexample
10909 int f() @{
10910 union a_union t;
10911 int* ip;
10912 t.d = 3.0;
10913 ip = &t.i;
10914 return *ip;
10915 @}
10916 @end smallexample
10917
10918 Similarly, access by taking the address, casting the resulting pointer
10919 and dereferencing the result has undefined behavior, even if the cast
10920 uses a union type, e.g.:
10921 @smallexample
10922 int f() @{
10923 double d = 3.0;
10924 return ((union a_union *) &d)->i;
10925 @}
10926 @end smallexample
10927
10928 The @option{-fstrict-aliasing} option is enabled at levels
10929 @option{-O2}, @option{-O3}, @option{-Os}.
10930
10931 @item -falign-functions
10932 @itemx -falign-functions=@var{n}
10933 @itemx -falign-functions=@var{n}:@var{m}
10934 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10935 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10936 @opindex falign-functions
10937 Align the start of functions to the next power-of-two greater than or
10938 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
10939 least the first @var{m} bytes of the function can be fetched by the CPU
10940 without crossing an @var{n}-byte alignment boundary.
10941
10942 If @var{m} is not specified, it defaults to @var{n}.
10943
10944 Examples: @option{-falign-functions=32} aligns functions to the next
10945 32-byte boundary, @option{-falign-functions=24} aligns to the next
10946 32-byte boundary only if this can be done by skipping 23 bytes or less,
10947 @option{-falign-functions=32:7} aligns to the next
10948 32-byte boundary only if this can be done by skipping 6 bytes or less.
10949
10950 The second pair of @var{n2}:@var{m2} values allows you to specify
10951 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10952 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10953 otherwise aligns to the next 32-byte boundary if this can be done
10954 by skipping 2 bytes or less.
10955 If @var{m2} is not specified, it defaults to @var{n2}.
10956
10957 Some assemblers only support this flag when @var{n} is a power of two;
10958 in that case, it is rounded up.
10959
10960 @option{-fno-align-functions} and @option{-falign-functions=1} are
10961 equivalent and mean that functions are not aligned.
10962
10963 If @var{n} is not specified or is zero, use a machine-dependent default.
10964 The maximum allowed @var{n} option value is 65536.
10965
10966 Enabled at levels @option{-O2}, @option{-O3}.
10967
10968 @item -flimit-function-alignment
10969 If this option is enabled, the compiler tries to avoid unnecessarily
10970 overaligning functions. It attempts to instruct the assembler to align
10971 by the amount specified by @option{-falign-functions}, but not to
10972 skip more bytes than the size of the function.
10973
10974 @item -falign-labels
10975 @itemx -falign-labels=@var{n}
10976 @itemx -falign-labels=@var{n}:@var{m}
10977 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10978 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10979 @opindex falign-labels
10980 Align all branch targets to a power-of-two boundary.
10981
10982 Parameters of this option are analogous to the @option{-falign-functions} option.
10983 @option{-fno-align-labels} and @option{-falign-labels=1} are
10984 equivalent and mean that labels are not aligned.
10985
10986 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10987 are greater than this value, then their values are used instead.
10988
10989 If @var{n} is not specified or is zero, use a machine-dependent default
10990 which is very likely to be @samp{1}, meaning no alignment.
10991 The maximum allowed @var{n} option value is 65536.
10992
10993 Enabled at levels @option{-O2}, @option{-O3}.
10994
10995 @item -falign-loops
10996 @itemx -falign-loops=@var{n}
10997 @itemx -falign-loops=@var{n}:@var{m}
10998 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10999 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
11000 @opindex falign-loops
11001 Align loops to a power-of-two boundary. If the loops are executed
11002 many times, this makes up for any execution of the dummy padding
11003 instructions.
11004
11005 If @option{-falign-labels} is greater than this value, then its value
11006 is used instead.
11007
11008 Parameters of this option are analogous to the @option{-falign-functions} option.
11009 @option{-fno-align-loops} and @option{-falign-loops=1} are
11010 equivalent and mean that loops are not aligned.
11011 The maximum allowed @var{n} option value is 65536.
11012
11013 If @var{n} is not specified or is zero, use a machine-dependent default.
11014
11015 Enabled at levels @option{-O2}, @option{-O3}.
11016
11017 @item -falign-jumps
11018 @itemx -falign-jumps=@var{n}
11019 @itemx -falign-jumps=@var{n}:@var{m}
11020 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
11021 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
11022 @opindex falign-jumps
11023 Align branch targets to a power-of-two boundary, for branch targets
11024 where the targets can only be reached by jumping. In this case,
11025 no dummy operations need be executed.
11026
11027 If @option{-falign-labels} is greater than this value, then its value
11028 is used instead.
11029
11030 Parameters of this option are analogous to the @option{-falign-functions} option.
11031 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
11032 equivalent and mean that loops are not aligned.
11033
11034 If @var{n} is not specified or is zero, use a machine-dependent default.
11035 The maximum allowed @var{n} option value is 65536.
11036
11037 Enabled at levels @option{-O2}, @option{-O3}.
11038
11039 @item -fno-allocation-dce
11040 @opindex fno-allocation-dce
11041 Do not remove unused C++ allocations in dead code elimination.
11042
11043 @item -fallow-store-data-races
11044 @opindex fallow-store-data-races
11045 Allow the compiler to introduce new data races on stores.
11046
11047 Enabled at level @option{-Ofast}.
11048
11049 @item -funit-at-a-time
11050 @opindex funit-at-a-time
11051 This option is left for compatibility reasons. @option{-funit-at-a-time}
11052 has no effect, while @option{-fno-unit-at-a-time} implies
11053 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11054
11055 Enabled by default.
11056
11057 @item -fno-toplevel-reorder
11058 @opindex fno-toplevel-reorder
11059 @opindex ftoplevel-reorder
11060 Do not reorder top-level functions, variables, and @code{asm}
11061 statements. Output them in the same order that they appear in the
11062 input file. When this option is used, unreferenced static variables
11063 are not removed. This option is intended to support existing code
11064 that relies on a particular ordering. For new code, it is better to
11065 use attributes when possible.
11066
11067 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11068 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11069 Additionally @option{-fno-toplevel-reorder} implies
11070 @option{-fno-section-anchors}.
11071
11072 @item -fweb
11073 @opindex fweb
11074 Constructs webs as commonly used for register allocation purposes and assign
11075 each web individual pseudo register. This allows the register allocation pass
11076 to operate on pseudos directly, but also strengthens several other optimization
11077 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
11078 however, make debugging impossible, since variables no longer stay in a
11079 ``home register''.
11080
11081 Enabled by default with @option{-funroll-loops}.
11082
11083 @item -fwhole-program
11084 @opindex fwhole-program
11085 Assume that the current compilation unit represents the whole program being
11086 compiled. All public functions and variables with the exception of @code{main}
11087 and those merged by attribute @code{externally_visible} become static functions
11088 and in effect are optimized more aggressively by interprocedural optimizers.
11089
11090 This option should not be used in combination with @option{-flto}.
11091 Instead relying on a linker plugin should provide safer and more precise
11092 information.
11093
11094 @item -flto[=@var{n}]
11095 @opindex flto
11096 This option runs the standard link-time optimizer. When invoked
11097 with source code, it generates GIMPLE (one of GCC's internal
11098 representations) and writes it to special ELF sections in the object
11099 file. When the object files are linked together, all the function
11100 bodies are read from these ELF sections and instantiated as if they
11101 had been part of the same translation unit.
11102
11103 To use the link-time optimizer, @option{-flto} and optimization
11104 options should be specified at compile time and during the final link.
11105 It is recommended that you compile all the files participating in the
11106 same link with the same options and also specify those options at
11107 link time.
11108 For example:
11109
11110 @smallexample
11111 gcc -c -O2 -flto foo.c
11112 gcc -c -O2 -flto bar.c
11113 gcc -o myprog -flto -O2 foo.o bar.o
11114 @end smallexample
11115
11116 The first two invocations to GCC save a bytecode representation
11117 of GIMPLE into special ELF sections inside @file{foo.o} and
11118 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
11119 @file{foo.o} and @file{bar.o}, merges the two files into a single
11120 internal image, and compiles the result as usual. Since both
11121 @file{foo.o} and @file{bar.o} are merged into a single image, this
11122 causes all the interprocedural analyses and optimizations in GCC to
11123 work across the two files as if they were a single one. This means,
11124 for example, that the inliner is able to inline functions in
11125 @file{bar.o} into functions in @file{foo.o} and vice-versa.
11126
11127 Another (simpler) way to enable link-time optimization is:
11128
11129 @smallexample
11130 gcc -o myprog -flto -O2 foo.c bar.c
11131 @end smallexample
11132
11133 The above generates bytecode for @file{foo.c} and @file{bar.c},
11134 merges them together into a single GIMPLE representation and optimizes
11135 them as usual to produce @file{myprog}.
11136
11137 The important thing to keep in mind is that to enable link-time
11138 optimizations you need to use the GCC driver to perform the link step.
11139 GCC automatically performs link-time optimization if any of the
11140 objects involved were compiled with the @option{-flto} command-line option.
11141 You can always override
11142 the automatic decision to do link-time optimization
11143 by passing @option{-fno-lto} to the link command.
11144
11145 To make whole program optimization effective, it is necessary to make
11146 certain whole program assumptions. The compiler needs to know
11147 what functions and variables can be accessed by libraries and runtime
11148 outside of the link-time optimized unit. When supported by the linker,
11149 the linker plugin (see @option{-fuse-linker-plugin}) passes information
11150 to the compiler about used and externally visible symbols. When
11151 the linker plugin is not available, @option{-fwhole-program} should be
11152 used to allow the compiler to make these assumptions, which leads
11153 to more aggressive optimization decisions.
11154
11155 When a file is compiled with @option{-flto} without
11156 @option{-fuse-linker-plugin}, the generated object file is larger than
11157 a regular object file because it contains GIMPLE bytecodes and the usual
11158 final code (see @option{-ffat-lto-objects}. This means that
11159 object files with LTO information can be linked as normal object
11160 files; if @option{-fno-lto} is passed to the linker, no
11161 interprocedural optimizations are applied. Note that when
11162 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
11163 but you cannot perform a regular, non-LTO link on them.
11164
11165 When producing the final binary, GCC only
11166 applies link-time optimizations to those files that contain bytecode.
11167 Therefore, you can mix and match object files and libraries with
11168 GIMPLE bytecodes and final object code. GCC automatically selects
11169 which files to optimize in LTO mode and which files to link without
11170 further processing.
11171
11172 Generally, options specified at link time override those
11173 specified at compile time, although in some cases GCC attempts to infer
11174 link-time options from the settings used to compile the input files.
11175
11176 If you do not specify an optimization level option @option{-O} at
11177 link time, then GCC uses the highest optimization level
11178 used when compiling the object files. Note that it is generally
11179 ineffective to specify an optimization level option only at link time and
11180 not at compile time, for two reasons. First, compiling without
11181 optimization suppresses compiler passes that gather information
11182 needed for effective optimization at link time. Second, some early
11183 optimization passes can be performed only at compile time and
11184 not at link time.
11185
11186 There are some code generation flags preserved by GCC when
11187 generating bytecodes, as they need to be used during the final link.
11188 Currently, the following options and their settings are taken from
11189 the first object file that explicitly specifies them:
11190 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
11191 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
11192 and all the @option{-m} target flags.
11193
11194 Certain ABI-changing flags are required to match in all compilation units,
11195 and trying to override this at link time with a conflicting value
11196 is ignored. This includes options such as @option{-freg-struct-return}
11197 and @option{-fpcc-struct-return}.
11198
11199 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11200 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11201 are passed through to the link stage and merged conservatively for
11202 conflicting translation units. Specifically
11203 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11204 precedence; and for example @option{-ffp-contract=off} takes precedence
11205 over @option{-ffp-contract=fast}. You can override them at link time.
11206
11207 When you need to pass options to the assembler via @option{-Wa} or
11208 @option{-Xassembler} make sure to either compile such translation
11209 units with @option{-fno-lto} or consistently use the same assembler
11210 options on all translation units. You can alternatively also
11211 specify assembler options at LTO link time.
11212
11213 To enable debug info generation you need to supply @option{-g} at
11214 compile time. If any of the input files at link time were built
11215 with debug info generation enabled the link will enable debug info
11216 generation as well. Any elaborate debug info settings
11217 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11218 at the linker command line and mixing different settings in different
11219 translation units is discouraged.
11220
11221 If LTO encounters objects with C linkage declared with incompatible
11222 types in separate translation units to be linked together (undefined
11223 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11224 issued. The behavior is still undefined at run time. Similar
11225 diagnostics may be raised for other languages.
11226
11227 Another feature of LTO is that it is possible to apply interprocedural
11228 optimizations on files written in different languages:
11229
11230 @smallexample
11231 gcc -c -flto foo.c
11232 g++ -c -flto bar.cc
11233 gfortran -c -flto baz.f90
11234 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11235 @end smallexample
11236
11237 Notice that the final link is done with @command{g++} to get the C++
11238 runtime libraries and @option{-lgfortran} is added to get the Fortran
11239 runtime libraries. In general, when mixing languages in LTO mode, you
11240 should use the same link command options as when mixing languages in a
11241 regular (non-LTO) compilation.
11242
11243 If object files containing GIMPLE bytecode are stored in a library archive, say
11244 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11245 are using a linker with plugin support. To create static libraries suitable
11246 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11247 and @command{ranlib};
11248 to show the symbols of object files with GIMPLE bytecode, use
11249 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
11250 and @command{nm} have been compiled with plugin support. At link time, use the
11251 flag @option{-fuse-linker-plugin} to ensure that the library participates in
11252 the LTO optimization process:
11253
11254 @smallexample
11255 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11256 @end smallexample
11257
11258 With the linker plugin enabled, the linker extracts the needed
11259 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11260 to make them part of the aggregated GIMPLE image to be optimized.
11261
11262 If you are not using a linker with plugin support and/or do not
11263 enable the linker plugin, then the objects inside @file{libfoo.a}
11264 are extracted and linked as usual, but they do not participate
11265 in the LTO optimization process. In order to make a static library suitable
11266 for both LTO optimization and usual linkage, compile its object files with
11267 @option{-flto} @option{-ffat-lto-objects}.
11268
11269 Link-time optimizations do not require the presence of the whole program to
11270 operate. If the program does not require any symbols to be exported, it is
11271 possible to combine @option{-flto} and @option{-fwhole-program} to allow
11272 the interprocedural optimizers to use more aggressive assumptions which may
11273 lead to improved optimization opportunities.
11274 Use of @option{-fwhole-program} is not needed when linker plugin is
11275 active (see @option{-fuse-linker-plugin}).
11276
11277 The current implementation of LTO makes no
11278 attempt to generate bytecode that is portable between different
11279 types of hosts. The bytecode files are versioned and there is a
11280 strict version check, so bytecode files generated in one version of
11281 GCC do not work with an older or newer version of GCC.
11282
11283 Link-time optimization does not work well with generation of debugging
11284 information on systems other than those using a combination of ELF and
11285 DWARF.
11286
11287 If you specify the optional @var{n}, the optimization and code
11288 generation done at link time is executed in parallel using @var{n}
11289 parallel jobs by utilizing an installed @command{make} program. The
11290 environment variable @env{MAKE} may be used to override the program
11291 used.
11292
11293 You can also specify @option{-flto=jobserver} to use GNU make's
11294 job server mode to determine the number of parallel jobs. This
11295 is useful when the Makefile calling GCC is already executing in parallel.
11296 You must prepend a @samp{+} to the command recipe in the parent Makefile
11297 for this to work. This option likely only works if @env{MAKE} is
11298 GNU make. Even without the option value, GCC tries to automatically
11299 detect a running GNU make's job server.
11300
11301 Use @option{-flto=auto} to use GNU make's job server, if available,
11302 or otherwise fall back to autodetection of the number of CPU threads
11303 present in your system.
11304
11305 @item -flto-partition=@var{alg}
11306 @opindex flto-partition
11307 Specify the partitioning algorithm used by the link-time optimizer.
11308 The value is either @samp{1to1} to specify a partitioning mirroring
11309 the original source files or @samp{balanced} to specify partitioning
11310 into equally sized chunks (whenever possible) or @samp{max} to create
11311 new partition for every symbol where possible. Specifying @samp{none}
11312 as an algorithm disables partitioning and streaming completely.
11313 The default value is @samp{balanced}. While @samp{1to1} can be used
11314 as an workaround for various code ordering issues, the @samp{max}
11315 partitioning is intended for internal testing only.
11316 The value @samp{one} specifies that exactly one partition should be
11317 used while the value @samp{none} bypasses partitioning and executes
11318 the link-time optimization step directly from the WPA phase.
11319
11320 @item -flto-compression-level=@var{n}
11321 @opindex flto-compression-level
11322 This option specifies the level of compression used for intermediate
11323 language written to LTO object files, and is only meaningful in
11324 conjunction with LTO mode (@option{-flto}). Valid
11325 values are 0 (no compression) to 9 (maximum compression). Values
11326 outside this range are clamped to either 0 or 9. If the option is not
11327 given, a default balanced compression setting is used.
11328
11329 @item -fuse-linker-plugin
11330 @opindex fuse-linker-plugin
11331 Enables the use of a linker plugin during link-time optimization. This
11332 option relies on plugin support in the linker, which is available in gold
11333 or in GNU ld 2.21 or newer.
11334
11335 This option enables the extraction of object files with GIMPLE bytecode out
11336 of library archives. This improves the quality of optimization by exposing
11337 more code to the link-time optimizer. This information specifies what
11338 symbols can be accessed externally (by non-LTO object or during dynamic
11339 linking). Resulting code quality improvements on binaries (and shared
11340 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11341 See @option{-flto} for a description of the effect of this flag and how to
11342 use it.
11343
11344 This option is enabled by default when LTO support in GCC is enabled
11345 and GCC was configured for use with
11346 a linker supporting plugins (GNU ld 2.21 or newer or gold).
11347
11348 @item -ffat-lto-objects
11349 @opindex ffat-lto-objects
11350 Fat LTO objects are object files that contain both the intermediate language
11351 and the object code. This makes them usable for both LTO linking and normal
11352 linking. This option is effective only when compiling with @option{-flto}
11353 and is ignored at link time.
11354
11355 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11356 requires the complete toolchain to be aware of LTO. It requires a linker with
11357 linker plugin support for basic functionality. Additionally,
11358 @command{nm}, @command{ar} and @command{ranlib}
11359 need to support linker plugins to allow a full-featured build environment
11360 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
11361 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11362 to these tools. With non fat LTO makefiles need to be modified to use them.
11363
11364 Note that modern binutils provide plugin auto-load mechanism.
11365 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11366 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11367 @command{gcc-ranlib}).
11368
11369 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11370 support.
11371
11372 @item -fcompare-elim
11373 @opindex fcompare-elim
11374 After register allocation and post-register allocation instruction splitting,
11375 identify arithmetic instructions that compute processor flags similar to a
11376 comparison operation based on that arithmetic. If possible, eliminate the
11377 explicit comparison operation.
11378
11379 This pass only applies to certain targets that cannot explicitly represent
11380 the comparison operation before register allocation is complete.
11381
11382 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11383
11384 @item -fcprop-registers
11385 @opindex fcprop-registers
11386 After register allocation and post-register allocation instruction splitting,
11387 perform a copy-propagation pass to try to reduce scheduling dependencies
11388 and occasionally eliminate the copy.
11389
11390 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11391
11392 @item -fprofile-correction
11393 @opindex fprofile-correction
11394 Profiles collected using an instrumented binary for multi-threaded programs may
11395 be inconsistent due to missed counter updates. When this option is specified,
11396 GCC uses heuristics to correct or smooth out such inconsistencies. By
11397 default, GCC emits an error message when an inconsistent profile is detected.
11398
11399 This option is enabled by @option{-fauto-profile}.
11400
11401 @item -fprofile-partial-training
11402 @opindex fprofile-use
11403 With @code{-fprofile-use} all portions of programs not executed during train
11404 run are optimized agressively for size rather than speed. In some cases it is
11405 not practical to train all possible hot paths in the program. (For
11406 example, program may contain functions specific for a given hardware and
11407 trianing may not cover all hardware configurations program is run on.) With
11408 @code{-fprofile-partial-training} profile feedback will be ignored for all
11409 functions not executed during the train run leading them to be optimized as if
11410 they were compiled without profile feedback. This leads to better performance
11411 when train run is not representative but also leads to significantly bigger
11412 code.
11413
11414 @item -fprofile-use
11415 @itemx -fprofile-use=@var{path}
11416 @opindex fprofile-use
11417 Enable profile feedback-directed optimizations,
11418 and the following optimizations, many of which
11419 are generally profitable only with profile feedback available:
11420
11421 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11422 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11423 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11424 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11425 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11426 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11427 -fprofile-reorder-functions}
11428
11429 Before you can use this option, you must first generate profiling information.
11430 @xref{Instrumentation Options}, for information about the
11431 @option{-fprofile-generate} option.
11432
11433 By default, GCC emits an error message if the feedback profiles do not
11434 match the source code. This error can be turned into a warning by using
11435 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
11436 optimized code. Additionally, by default, GCC also emits a warning message if
11437 the feedback profiles do not exist (see @option{-Wmissing-profile}).
11438
11439 If @var{path} is specified, GCC looks at the @var{path} to find
11440 the profile feedback data files. See @option{-fprofile-dir}.
11441
11442 @item -fauto-profile
11443 @itemx -fauto-profile=@var{path}
11444 @opindex fauto-profile
11445 Enable sampling-based feedback-directed optimizations,
11446 and the following optimizations,
11447 many of which are generally profitable only with profile feedback available:
11448
11449 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11450 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11451 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11452 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11453 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11454 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11455 -fprofile-correction}
11456
11457 @var{path} is the name of a file containing AutoFDO profile information.
11458 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11459
11460 Producing an AutoFDO profile data file requires running your program
11461 with the @command{perf} utility on a supported GNU/Linux target system.
11462 For more information, see @uref{https://perf.wiki.kernel.org/}.
11463
11464 E.g.
11465 @smallexample
11466 perf record -e br_inst_retired:near_taken -b -o perf.data \
11467 -- your_program
11468 @end smallexample
11469
11470 Then use the @command{create_gcov} tool to convert the raw profile data
11471 to a format that can be used by GCC.@ You must also supply the
11472 unstripped binary for your program to this tool.
11473 See @uref{https://github.com/google/autofdo}.
11474
11475 E.g.
11476 @smallexample
11477 create_gcov --binary=your_program.unstripped --profile=perf.data \
11478 --gcov=profile.afdo
11479 @end smallexample
11480 @end table
11481
11482 The following options control compiler behavior regarding floating-point
11483 arithmetic. These options trade off between speed and
11484 correctness. All must be specifically enabled.
11485
11486 @table @gcctabopt
11487 @item -ffloat-store
11488 @opindex ffloat-store
11489 Do not store floating-point variables in registers, and inhibit other
11490 options that might change whether a floating-point value is taken from a
11491 register or memory.
11492
11493 @cindex floating-point precision
11494 This option prevents undesirable excess precision on machines such as
11495 the 68000 where the floating registers (of the 68881) keep more
11496 precision than a @code{double} is supposed to have. Similarly for the
11497 x86 architecture. For most programs, the excess precision does only
11498 good, but a few programs rely on the precise definition of IEEE floating
11499 point. Use @option{-ffloat-store} for such programs, after modifying
11500 them to store all pertinent intermediate computations into variables.
11501
11502 @item -fexcess-precision=@var{style}
11503 @opindex fexcess-precision
11504 This option allows further control over excess precision on machines
11505 where floating-point operations occur in a format with more precision or
11506 range than the IEEE standard and interchange floating-point types. By
11507 default, @option{-fexcess-precision=fast} is in effect; this means that
11508 operations may be carried out in a wider precision than the types specified
11509 in the source if that would result in faster code, and it is unpredictable
11510 when rounding to the types specified in the source code takes place.
11511 When compiling C, if @option{-fexcess-precision=standard} is specified then
11512 excess precision follows the rules specified in ISO C99; in particular,
11513 both casts and assignments cause values to be rounded to their
11514 semantic types (whereas @option{-ffloat-store} only affects
11515 assignments). This option is enabled by default for C if a strict
11516 conformance option such as @option{-std=c99} is used.
11517 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11518 regardless of whether a strict conformance option is used.
11519
11520 @opindex mfpmath
11521 @option{-fexcess-precision=standard} is not implemented for languages
11522 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
11523 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11524 semantics apply without excess precision, and in the latter, rounding
11525 is unpredictable.
11526
11527 @item -ffast-math
11528 @opindex ffast-math
11529 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11530 @option{-ffinite-math-only}, @option{-fno-rounding-math},
11531 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11532 @option{-fexcess-precision=fast}.
11533
11534 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11535
11536 This option is not turned on by any @option{-O} option besides
11537 @option{-Ofast} since it can result in incorrect output for programs
11538 that depend on an exact implementation of IEEE or ISO rules/specifications
11539 for math functions. It may, however, yield faster code for programs
11540 that do not require the guarantees of these specifications.
11541
11542 @item -fno-math-errno
11543 @opindex fno-math-errno
11544 @opindex fmath-errno
11545 Do not set @code{errno} after calling math functions that are executed
11546 with a single instruction, e.g., @code{sqrt}. A program that relies on
11547 IEEE exceptions for math error handling may want to use this flag
11548 for speed while maintaining IEEE arithmetic compatibility.
11549
11550 This option is not turned on by any @option{-O} option since
11551 it can result in incorrect output for programs that depend on
11552 an exact implementation of IEEE or ISO rules/specifications for
11553 math functions. It may, however, yield faster code for programs
11554 that do not require the guarantees of these specifications.
11555
11556 The default is @option{-fmath-errno}.
11557
11558 On Darwin systems, the math library never sets @code{errno}. There is
11559 therefore no reason for the compiler to consider the possibility that
11560 it might, and @option{-fno-math-errno} is the default.
11561
11562 @item -funsafe-math-optimizations
11563 @opindex funsafe-math-optimizations
11564
11565 Allow optimizations for floating-point arithmetic that (a) assume
11566 that arguments and results are valid and (b) may violate IEEE or
11567 ANSI standards. When used at link time, it may include libraries
11568 or startup files that change the default FPU control word or other
11569 similar optimizations.
11570
11571 This option is not turned on by any @option{-O} option since
11572 it can result in incorrect output for programs that depend on
11573 an exact implementation of IEEE or ISO rules/specifications for
11574 math functions. It may, however, yield faster code for programs
11575 that do not require the guarantees of these specifications.
11576 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
11577 @option{-fassociative-math} and @option{-freciprocal-math}.
11578
11579 The default is @option{-fno-unsafe-math-optimizations}.
11580
11581 @item -fassociative-math
11582 @opindex fassociative-math
11583
11584 Allow re-association of operands in series of floating-point operations.
11585 This violates the ISO C and C++ language standard by possibly changing
11586 computation result. NOTE: re-ordering may change the sign of zero as
11587 well as ignore NaNs and inhibit or create underflow or overflow (and
11588 thus cannot be used on code that relies on rounding behavior like
11589 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
11590 and thus may not be used when ordered comparisons are required.
11591 This option requires that both @option{-fno-signed-zeros} and
11592 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
11593 much sense with @option{-frounding-math}. For Fortran the option
11594 is automatically enabled when both @option{-fno-signed-zeros} and
11595 @option{-fno-trapping-math} are in effect.
11596
11597 The default is @option{-fno-associative-math}.
11598
11599 @item -freciprocal-math
11600 @opindex freciprocal-math
11601
11602 Allow the reciprocal of a value to be used instead of dividing by
11603 the value if this enables optimizations. For example @code{x / y}
11604 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
11605 is subject to common subexpression elimination. Note that this loses
11606 precision and increases the number of flops operating on the value.
11607
11608 The default is @option{-fno-reciprocal-math}.
11609
11610 @item -ffinite-math-only
11611 @opindex ffinite-math-only
11612 Allow optimizations for floating-point arithmetic that assume
11613 that arguments and results are not NaNs or +-Infs.
11614
11615 This option is not turned on by any @option{-O} option since
11616 it can result in incorrect output for programs that depend on
11617 an exact implementation of IEEE or ISO rules/specifications for
11618 math functions. It may, however, yield faster code for programs
11619 that do not require the guarantees of these specifications.
11620
11621 The default is @option{-fno-finite-math-only}.
11622
11623 @item -fno-signed-zeros
11624 @opindex fno-signed-zeros
11625 @opindex fsigned-zeros
11626 Allow optimizations for floating-point arithmetic that ignore the
11627 signedness of zero. IEEE arithmetic specifies the behavior of
11628 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
11629 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
11630 This option implies that the sign of a zero result isn't significant.
11631
11632 The default is @option{-fsigned-zeros}.
11633
11634 @item -fno-trapping-math
11635 @opindex fno-trapping-math
11636 @opindex ftrapping-math
11637 Compile code assuming that floating-point operations cannot generate
11638 user-visible traps. These traps include division by zero, overflow,
11639 underflow, inexact result and invalid operation. This option requires
11640 that @option{-fno-signaling-nans} be in effect. Setting this option may
11641 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
11642
11643 This option should never be turned on by any @option{-O} option since
11644 it can result in incorrect output for programs that depend on
11645 an exact implementation of IEEE or ISO rules/specifications for
11646 math functions.
11647
11648 The default is @option{-ftrapping-math}.
11649
11650 @item -frounding-math
11651 @opindex frounding-math
11652 Disable transformations and optimizations that assume default floating-point
11653 rounding behavior. This is round-to-zero for all floating point
11654 to integer conversions, and round-to-nearest for all other arithmetic
11655 truncations. This option should be specified for programs that change
11656 the FP rounding mode dynamically, or that may be executed with a
11657 non-default rounding mode. This option disables constant folding of
11658 floating-point expressions at compile time (which may be affected by
11659 rounding mode) and arithmetic transformations that are unsafe in the
11660 presence of sign-dependent rounding modes.
11661
11662 The default is @option{-fno-rounding-math}.
11663
11664 This option is experimental and does not currently guarantee to
11665 disable all GCC optimizations that are affected by rounding mode.
11666 Future versions of GCC may provide finer control of this setting
11667 using C99's @code{FENV_ACCESS} pragma. This command-line option
11668 will be used to specify the default state for @code{FENV_ACCESS}.
11669
11670 @item -fsignaling-nans
11671 @opindex fsignaling-nans
11672 Compile code assuming that IEEE signaling NaNs may generate user-visible
11673 traps during floating-point operations. Setting this option disables
11674 optimizations that may change the number of exceptions visible with
11675 signaling NaNs. This option implies @option{-ftrapping-math}.
11676
11677 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
11678 be defined.
11679
11680 The default is @option{-fno-signaling-nans}.
11681
11682 This option is experimental and does not currently guarantee to
11683 disable all GCC optimizations that affect signaling NaN behavior.
11684
11685 @item -fno-fp-int-builtin-inexact
11686 @opindex fno-fp-int-builtin-inexact
11687 @opindex ffp-int-builtin-inexact
11688 Do not allow the built-in functions @code{ceil}, @code{floor},
11689 @code{round} and @code{trunc}, and their @code{float} and @code{long
11690 double} variants, to generate code that raises the ``inexact''
11691 floating-point exception for noninteger arguments. ISO C99 and C11
11692 allow these functions to raise the ``inexact'' exception, but ISO/IEC
11693 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
11694 ISO C2X, does not allow these functions to do so.
11695
11696 The default is @option{-ffp-int-builtin-inexact}, allowing the
11697 exception to be raised, unless C2X or a later C standard is selected.
11698 This option does nothing unless @option{-ftrapping-math} is in effect.
11699
11700 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
11701 generate a call to a library function then the ``inexact'' exception
11702 may be raised if the library implementation does not follow TS 18661.
11703
11704 @item -fsingle-precision-constant
11705 @opindex fsingle-precision-constant
11706 Treat floating-point constants as single precision instead of
11707 implicitly converting them to double-precision constants.
11708
11709 @item -fcx-limited-range
11710 @opindex fcx-limited-range
11711 When enabled, this option states that a range reduction step is not
11712 needed when performing complex division. Also, there is no checking
11713 whether the result of a complex multiplication or division is @code{NaN
11714 + I*NaN}, with an attempt to rescue the situation in that case. The
11715 default is @option{-fno-cx-limited-range}, but is enabled by
11716 @option{-ffast-math}.
11717
11718 This option controls the default setting of the ISO C99
11719 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
11720 all languages.
11721
11722 @item -fcx-fortran-rules
11723 @opindex fcx-fortran-rules
11724 Complex multiplication and division follow Fortran rules. Range
11725 reduction is done as part of complex division, but there is no checking
11726 whether the result of a complex multiplication or division is @code{NaN
11727 + I*NaN}, with an attempt to rescue the situation in that case.
11728
11729 The default is @option{-fno-cx-fortran-rules}.
11730
11731 @end table
11732
11733 The following options control optimizations that may improve
11734 performance, but are not enabled by any @option{-O} options. This
11735 section includes experimental options that may produce broken code.
11736
11737 @table @gcctabopt
11738 @item -fbranch-probabilities
11739 @opindex fbranch-probabilities
11740 After running a program compiled with @option{-fprofile-arcs}
11741 (@pxref{Instrumentation Options}),
11742 you can compile it a second time using
11743 @option{-fbranch-probabilities}, to improve optimizations based on
11744 the number of times each branch was taken. When a program
11745 compiled with @option{-fprofile-arcs} exits, it saves arc execution
11746 counts to a file called @file{@var{sourcename}.gcda} for each source
11747 file. The information in this data file is very dependent on the
11748 structure of the generated code, so you must use the same source code
11749 and the same optimization options for both compilations.
11750
11751 With @option{-fbranch-probabilities}, GCC puts a
11752 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
11753 These can be used to improve optimization. Currently, they are only
11754 used in one place: in @file{reorg.c}, instead of guessing which path a
11755 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
11756 exactly determine which path is taken more often.
11757
11758 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11759
11760 @item -fprofile-values
11761 @opindex fprofile-values
11762 If combined with @option{-fprofile-arcs}, it adds code so that some
11763 data about values of expressions in the program is gathered.
11764
11765 With @option{-fbranch-probabilities}, it reads back the data gathered
11766 from profiling values of expressions for usage in optimizations.
11767
11768 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
11769 @option{-fauto-profile}.
11770
11771 @item -fprofile-reorder-functions
11772 @opindex fprofile-reorder-functions
11773 Function reordering based on profile instrumentation collects
11774 first time of execution of a function and orders these functions
11775 in ascending order.
11776
11777 Enabled with @option{-fprofile-use}.
11778
11779 @item -fvpt
11780 @opindex fvpt
11781 If combined with @option{-fprofile-arcs}, this option instructs the compiler
11782 to add code to gather information about values of expressions.
11783
11784 With @option{-fbranch-probabilities}, it reads back the data gathered
11785 and actually performs the optimizations based on them.
11786 Currently the optimizations include specialization of division operations
11787 using the knowledge about the value of the denominator.
11788
11789 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
11790
11791 @item -frename-registers
11792 @opindex frename-registers
11793 Attempt to avoid false dependencies in scheduled code by making use
11794 of registers left over after register allocation. This optimization
11795 most benefits processors with lots of registers. Depending on the
11796 debug information format adopted by the target, however, it can
11797 make debugging impossible, since variables no longer stay in
11798 a ``home register''.
11799
11800 Enabled by default with @option{-funroll-loops}.
11801
11802 @item -fschedule-fusion
11803 @opindex fschedule-fusion
11804 Performs a target dependent pass over the instruction stream to schedule
11805 instructions of same type together because target machine can execute them
11806 more efficiently if they are adjacent to each other in the instruction flow.
11807
11808 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11809
11810 @item -ftracer
11811 @opindex ftracer
11812 Perform tail duplication to enlarge superblock size. This transformation
11813 simplifies the control flow of the function allowing other optimizations to do
11814 a better job.
11815
11816 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11817
11818 @item -funroll-loops
11819 @opindex funroll-loops
11820 Unroll loops whose number of iterations can be determined at compile time or
11821 upon entry to the loop. @option{-funroll-loops} implies
11822 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11823 It also turns on complete loop peeling (i.e.@: complete removal of loops with
11824 a small constant number of iterations). This option makes code larger, and may
11825 or may not make it run faster.
11826
11827 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11828
11829 @item -funroll-all-loops
11830 @opindex funroll-all-loops
11831 Unroll all loops, even if their number of iterations is uncertain when
11832 the loop is entered. This usually makes programs run more slowly.
11833 @option{-funroll-all-loops} implies the same options as
11834 @option{-funroll-loops}.
11835
11836 @item -fpeel-loops
11837 @opindex fpeel-loops
11838 Peels loops for which there is enough information that they do not
11839 roll much (from profile feedback or static analysis). It also turns on
11840 complete loop peeling (i.e.@: complete removal of loops with small constant
11841 number of iterations).
11842
11843 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11844
11845 @item -fmove-loop-invariants
11846 @opindex fmove-loop-invariants
11847 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11848 at level @option{-O1} and higher, except for @option{-Og}.
11849
11850 @item -fsplit-loops
11851 @opindex fsplit-loops
11852 Split a loop into two if it contains a condition that's always true
11853 for one side of the iteration space and false for the other.
11854
11855 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11856
11857 @item -funswitch-loops
11858 @opindex funswitch-loops
11859 Move branches with loop invariant conditions out of the loop, with duplicates
11860 of the loop on both branches (modified according to result of the condition).
11861
11862 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11863
11864 @item -fversion-loops-for-strides
11865 @opindex fversion-loops-for-strides
11866 If a loop iterates over an array with a variable stride, create another
11867 version of the loop that assumes the stride is always one. For example:
11868
11869 @smallexample
11870 for (int i = 0; i < n; ++i)
11871 x[i * stride] = @dots{};
11872 @end smallexample
11873
11874 becomes:
11875
11876 @smallexample
11877 if (stride == 1)
11878 for (int i = 0; i < n; ++i)
11879 x[i] = @dots{};
11880 else
11881 for (int i = 0; i < n; ++i)
11882 x[i * stride] = @dots{};
11883 @end smallexample
11884
11885 This is particularly useful for assumed-shape arrays in Fortran where
11886 (for example) it allows better vectorization assuming contiguous accesses.
11887 This flag is enabled by default at @option{-O3}.
11888 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11889
11890 @item -ffunction-sections
11891 @itemx -fdata-sections
11892 @opindex ffunction-sections
11893 @opindex fdata-sections
11894 Place each function or data item into its own section in the output
11895 file if the target supports arbitrary sections. The name of the
11896 function or the name of the data item determines the section's name
11897 in the output file.
11898
11899 Use these options on systems where the linker can perform optimizations to
11900 improve locality of reference in the instruction space. Most systems using the
11901 ELF object format have linkers with such optimizations. On AIX, the linker
11902 rearranges sections (CSECTs) based on the call graph. The performance impact
11903 varies.
11904
11905 Together with a linker garbage collection (linker @option{--gc-sections}
11906 option) these options may lead to smaller statically-linked executables (after
11907 stripping).
11908
11909 On ELF/DWARF systems these options do not degenerate the quality of the debug
11910 information. There could be issues with other object files/debug info formats.
11911
11912 Only use these options when there are significant benefits from doing so. When
11913 you specify these options, the assembler and linker create larger object and
11914 executable files and are also slower. These options affect code generation.
11915 They prevent optimizations by the compiler and assembler using relative
11916 locations inside a translation unit since the locations are unknown until
11917 link time. An example of such an optimization is relaxing calls to short call
11918 instructions.
11919
11920 @item -fstdarg-opt
11921 @opindex fstdarg-opt
11922 Optimize the prologue of variadic argument functions with respect to usage of
11923 those arguments.
11924
11925 @item -fsection-anchors
11926 @opindex fsection-anchors
11927 Try to reduce the number of symbolic address calculations by using
11928 shared ``anchor'' symbols to address nearby objects. This transformation
11929 can help to reduce the number of GOT entries and GOT accesses on some
11930 targets.
11931
11932 For example, the implementation of the following function @code{foo}:
11933
11934 @smallexample
11935 static int a, b, c;
11936 int foo (void) @{ return a + b + c; @}
11937 @end smallexample
11938
11939 @noindent
11940 usually calculates the addresses of all three variables, but if you
11941 compile it with @option{-fsection-anchors}, it accesses the variables
11942 from a common anchor point instead. The effect is similar to the
11943 following pseudocode (which isn't valid C):
11944
11945 @smallexample
11946 int foo (void)
11947 @{
11948 register int *xr = &x;
11949 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11950 @}
11951 @end smallexample
11952
11953 Not all targets support this option.
11954
11955 @item --param @var{name}=@var{value}
11956 @opindex param
11957 In some places, GCC uses various constants to control the amount of
11958 optimization that is done. For example, GCC does not inline functions
11959 that contain more than a certain number of instructions. You can
11960 control some of these constants on the command line using the
11961 @option{--param} option.
11962
11963 The names of specific parameters, and the meaning of the values, are
11964 tied to the internals of the compiler, and are subject to change
11965 without notice in future releases.
11966
11967 In order to get minimal, maximal and default value of a parameter,
11968 one can use @option{--help=param -Q} options.
11969
11970 In each case, the @var{value} is an integer. The following choices
11971 of @var{name} are recognized for all targets:
11972
11973 @table @gcctabopt
11974 @item predictable-branch-outcome
11975 When branch is predicted to be taken with probability lower than this threshold
11976 (in percent), then it is considered well predictable.
11977
11978 @item max-rtl-if-conversion-insns
11979 RTL if-conversion tries to remove conditional branches around a block and
11980 replace them with conditionally executed instructions. This parameter
11981 gives the maximum number of instructions in a block which should be
11982 considered for if-conversion. The compiler will
11983 also use other heuristics to decide whether if-conversion is likely to be
11984 profitable.
11985
11986 @item max-rtl-if-conversion-predictable-cost
11987 @itemx max-rtl-if-conversion-unpredictable-cost
11988 RTL if-conversion will try to remove conditional branches around a block
11989 and replace them with conditionally executed instructions. These parameters
11990 give the maximum permissible cost for the sequence that would be generated
11991 by if-conversion depending on whether the branch is statically determined
11992 to be predictable or not. The units for this parameter are the same as
11993 those for the GCC internal seq_cost metric. The compiler will try to
11994 provide a reasonable default for this parameter using the BRANCH_COST
11995 target macro.
11996
11997 @item max-crossjump-edges
11998 The maximum number of incoming edges to consider for cross-jumping.
11999 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
12000 the number of edges incoming to each block. Increasing values mean
12001 more aggressive optimization, making the compilation time increase with
12002 probably small improvement in executable size.
12003
12004 @item min-crossjump-insns
12005 The minimum number of instructions that must be matched at the end
12006 of two blocks before cross-jumping is performed on them. This
12007 value is ignored in the case where all instructions in the block being
12008 cross-jumped from are matched.
12009
12010 @item max-grow-copy-bb-insns
12011 The maximum code size expansion factor when copying basic blocks
12012 instead of jumping. The expansion is relative to a jump instruction.
12013
12014 @item max-goto-duplication-insns
12015 The maximum number of instructions to duplicate to a block that jumps
12016 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
12017 passes, GCC factors computed gotos early in the compilation process,
12018 and unfactors them as late as possible. Only computed jumps at the
12019 end of a basic blocks with no more than max-goto-duplication-insns are
12020 unfactored.
12021
12022 @item max-delay-slot-insn-search
12023 The maximum number of instructions to consider when looking for an
12024 instruction to fill a delay slot. If more than this arbitrary number of
12025 instructions are searched, the time savings from filling the delay slot
12026 are minimal, so stop searching. Increasing values mean more
12027 aggressive optimization, making the compilation time increase with probably
12028 small improvement in execution time.
12029
12030 @item max-delay-slot-live-search
12031 When trying to fill delay slots, the maximum number of instructions to
12032 consider when searching for a block with valid live register
12033 information. Increasing this arbitrarily chosen value means more
12034 aggressive optimization, increasing the compilation time. This parameter
12035 should be removed when the delay slot code is rewritten to maintain the
12036 control-flow graph.
12037
12038 @item max-gcse-memory
12039 The approximate maximum amount of memory that can be allocated in
12040 order to perform the global common subexpression elimination
12041 optimization. If more memory than specified is required, the
12042 optimization is not done.
12043
12044 @item max-gcse-insertion-ratio
12045 If the ratio of expression insertions to deletions is larger than this value
12046 for any expression, then RTL PRE inserts or removes the expression and thus
12047 leaves partially redundant computations in the instruction stream.
12048
12049 @item max-pending-list-length
12050 The maximum number of pending dependencies scheduling allows
12051 before flushing the current state and starting over. Large functions
12052 with few branches or calls can create excessively large lists which
12053 needlessly consume memory and resources.
12054
12055 @item max-modulo-backtrack-attempts
12056 The maximum number of backtrack attempts the scheduler should make
12057 when modulo scheduling a loop. Larger values can exponentially increase
12058 compilation time.
12059
12060 @item max-inline-insns-single
12061 Several parameters control the tree inliner used in GCC@. This number sets the
12062 maximum number of instructions (counted in GCC's internal representation) in a
12063 single function that the tree inliner considers for inlining. This only
12064 affects functions declared inline and methods implemented in a class
12065 declaration (C++).
12066
12067
12068 @item max-inline-insns-auto
12069 When you use @option{-finline-functions} (included in @option{-O3}),
12070 a lot of functions that would otherwise not be considered for inlining
12071 by the compiler are investigated. To those functions, a different
12072 (more restrictive) limit compared to functions declared inline can
12073 be applied (@option{--param max-inline-insns-auto}).
12074
12075 @item max-inline-insns-small
12076 This is bound applied to calls which are considered relevant with
12077 @option{-finline-small-functions}.
12078
12079 @item max-inline-insns-size
12080 This is bound applied to calls which are optimized for size. Small growth
12081 may be desirable to anticipate optimization oppurtunities exposed by inlining.
12082
12083 @item uninlined-function-insns
12084 Number of instructions accounted by inliner for function overhead such as
12085 function prologue and epilogue.
12086
12087 @item uninlined-function-time
12088 Extra time accounted by inliner for function overhead such as time needed to
12089 execute function prologue and epilogue
12090
12091 @item inline-heuristics-hint-percent
12092 The scale (in percents) applied to @option{inline-insns-single},
12093 @option{inline-insns-single-O2}, @option{inline-insns-auto}
12094 when inline heuristics hints that inlining is
12095 very profitable (will enable later optimizations).
12096
12097 @item uninlined-thunk-insns
12098 @item uninlined-thunk-time
12099 Same as @option{--param uninlined-function-insns} and
12100 @option{--param uninlined-function-time} but applied to function thunks
12101
12102 @item inline-min-speedup
12103 When estimated performance improvement of caller + callee runtime exceeds this
12104 threshold (in percent), the function can be inlined regardless of the limit on
12105 @option{--param max-inline-insns-single} and @option{--param
12106 max-inline-insns-auto}.
12107
12108 @item large-function-insns
12109 The limit specifying really large functions. For functions larger than this
12110 limit after inlining, inlining is constrained by
12111 @option{--param large-function-growth}. This parameter is useful primarily
12112 to avoid extreme compilation time caused by non-linear algorithms used by the
12113 back end.
12114
12115 @item large-function-growth
12116 Specifies maximal growth of large function caused by inlining in percents.
12117 For example, parameter value 100 limits large function growth to 2.0 times
12118 the original size.
12119
12120 @item large-unit-insns
12121 The limit specifying large translation unit. Growth caused by inlining of
12122 units larger than this limit is limited by @option{--param inline-unit-growth}.
12123 For small units this might be too tight.
12124 For example, consider a unit consisting of function A
12125 that is inline and B that just calls A three times. If B is small relative to
12126 A, the growth of unit is 300\% and yet such inlining is very sane. For very
12127 large units consisting of small inlineable functions, however, the overall unit
12128 growth limit is needed to avoid exponential explosion of code size. Thus for
12129 smaller units, the size is increased to @option{--param large-unit-insns}
12130 before applying @option{--param inline-unit-growth}.
12131
12132 @item inline-unit-growth
12133 Specifies maximal overall growth of the compilation unit caused by inlining.
12134 For example, parameter value 20 limits unit growth to 1.2 times the original
12135 size. Cold functions (either marked cold via an attribute or by profile
12136 feedback) are not accounted into the unit size.
12137
12138 @item ipcp-unit-growth
12139 Specifies maximal overall growth of the compilation unit caused by
12140 interprocedural constant propagation. For example, parameter value 10 limits
12141 unit growth to 1.1 times the original size.
12142
12143 @item large-stack-frame
12144 The limit specifying large stack frames. While inlining the algorithm is trying
12145 to not grow past this limit too much.
12146
12147 @item large-stack-frame-growth
12148 Specifies maximal growth of large stack frames caused by inlining in percents.
12149 For example, parameter value 1000 limits large stack frame growth to 11 times
12150 the original size.
12151
12152 @item max-inline-insns-recursive
12153 @itemx max-inline-insns-recursive-auto
12154 Specifies the maximum number of instructions an out-of-line copy of a
12155 self-recursive inline
12156 function can grow into by performing recursive inlining.
12157
12158 @option{--param max-inline-insns-recursive} applies to functions
12159 declared inline.
12160 For functions not declared inline, recursive inlining
12161 happens only when @option{-finline-functions} (included in @option{-O3}) is
12162 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12163
12164 @item max-inline-recursive-depth
12165 @itemx max-inline-recursive-depth-auto
12166 Specifies the maximum recursion depth used for recursive inlining.
12167
12168 @option{--param max-inline-recursive-depth} applies to functions
12169 declared inline. For functions not declared inline, recursive inlining
12170 happens only when @option{-finline-functions} (included in @option{-O3}) is
12171 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12172
12173 @item min-inline-recursive-probability
12174 Recursive inlining is profitable only for function having deep recursion
12175 in average and can hurt for function having little recursion depth by
12176 increasing the prologue size or complexity of function body to other
12177 optimizers.
12178
12179 When profile feedback is available (see @option{-fprofile-generate}) the actual
12180 recursion depth can be guessed from the probability that function recurses
12181 via a given call expression. This parameter limits inlining only to call
12182 expressions whose probability exceeds the given threshold (in percents).
12183
12184 @item early-inlining-insns
12185 Specify growth that the early inliner can make. In effect it increases
12186 the amount of inlining for code having a large abstraction penalty.
12187
12188 @item max-early-inliner-iterations
12189 Limit of iterations of the early inliner. This basically bounds
12190 the number of nested indirect calls the early inliner can resolve.
12191 Deeper chains are still handled by late inlining.
12192
12193 @item comdat-sharing-probability
12194 Probability (in percent) that C++ inline function with comdat visibility
12195 are shared across multiple compilation units.
12196
12197 @item profile-func-internal-id
12198 A parameter to control whether to use function internal id in profile
12199 database lookup. If the value is 0, the compiler uses an id that
12200 is based on function assembler name and filename, which makes old profile
12201 data more tolerant to source changes such as function reordering etc.
12202
12203 @item min-vect-loop-bound
12204 The minimum number of iterations under which loops are not vectorized
12205 when @option{-ftree-vectorize} is used. The number of iterations after
12206 vectorization needs to be greater than the value specified by this option
12207 to allow vectorization.
12208
12209 @item gcse-cost-distance-ratio
12210 Scaling factor in calculation of maximum distance an expression
12211 can be moved by GCSE optimizations. This is currently supported only in the
12212 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
12213 is with simple expressions, i.e., the expressions that have cost
12214 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
12215 hoisting of simple expressions.
12216
12217 @item gcse-unrestricted-cost
12218 Cost, roughly measured as the cost of a single typical machine
12219 instruction, at which GCSE optimizations do not constrain
12220 the distance an expression can travel. This is currently
12221 supported only in the code hoisting pass. The lesser the cost,
12222 the more aggressive code hoisting is. Specifying 0
12223 allows all expressions to travel unrestricted distances.
12224
12225 @item max-hoist-depth
12226 The depth of search in the dominator tree for expressions to hoist.
12227 This is used to avoid quadratic behavior in hoisting algorithm.
12228 The value of 0 does not limit on the search, but may slow down compilation
12229 of huge functions.
12230
12231 @item max-tail-merge-comparisons
12232 The maximum amount of similar bbs to compare a bb with. This is used to
12233 avoid quadratic behavior in tree tail merging.
12234
12235 @item max-tail-merge-iterations
12236 The maximum amount of iterations of the pass over the function. This is used to
12237 limit compilation time in tree tail merging.
12238
12239 @item store-merging-allow-unaligned
12240 Allow the store merging pass to introduce unaligned stores if it is legal to
12241 do so.
12242
12243 @item max-stores-to-merge
12244 The maximum number of stores to attempt to merge into wider stores in the store
12245 merging pass.
12246
12247 @item max-unrolled-insns
12248 The maximum number of instructions that a loop may have to be unrolled.
12249 If a loop is unrolled, this parameter also determines how many times
12250 the loop code is unrolled.
12251
12252 @item max-average-unrolled-insns
12253 The maximum number of instructions biased by probabilities of their execution
12254 that a loop may have to be unrolled. If a loop is unrolled,
12255 this parameter also determines how many times the loop code is unrolled.
12256
12257 @item max-unroll-times
12258 The maximum number of unrollings of a single loop.
12259
12260 @item max-peeled-insns
12261 The maximum number of instructions that a loop may have to be peeled.
12262 If a loop is peeled, this parameter also determines how many times
12263 the loop code is peeled.
12264
12265 @item max-peel-times
12266 The maximum number of peelings of a single loop.
12267
12268 @item max-peel-branches
12269 The maximum number of branches on the hot path through the peeled sequence.
12270
12271 @item max-completely-peeled-insns
12272 The maximum number of insns of a completely peeled loop.
12273
12274 @item max-completely-peel-times
12275 The maximum number of iterations of a loop to be suitable for complete peeling.
12276
12277 @item max-completely-peel-loop-nest-depth
12278 The maximum depth of a loop nest suitable for complete peeling.
12279
12280 @item max-unswitch-insns
12281 The maximum number of insns of an unswitched loop.
12282
12283 @item max-unswitch-level
12284 The maximum number of branches unswitched in a single loop.
12285
12286 @item lim-expensive
12287 The minimum cost of an expensive expression in the loop invariant motion.
12288
12289 @item min-loop-cond-split-prob
12290 When FDO profile information is available, @option{min-loop-cond-split-prob}
12291 specifies minimum threshold for probability of semi-invariant condition
12292 statement to trigger loop split.
12293
12294 @item iv-consider-all-candidates-bound
12295 Bound on number of candidates for induction variables, below which
12296 all candidates are considered for each use in induction variable
12297 optimizations. If there are more candidates than this,
12298 only the most relevant ones are considered to avoid quadratic time complexity.
12299
12300 @item iv-max-considered-uses
12301 The induction variable optimizations give up on loops that contain more
12302 induction variable uses.
12303
12304 @item iv-always-prune-cand-set-bound
12305 If the number of candidates in the set is smaller than this value,
12306 always try to remove unnecessary ivs from the set
12307 when adding a new one.
12308
12309 @item avg-loop-niter
12310 Average number of iterations of a loop.
12311
12312 @item dse-max-object-size
12313 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12314 Larger values may result in larger compilation times.
12315
12316 @item dse-max-alias-queries-per-store
12317 Maximum number of queries into the alias oracle per store.
12318 Larger values result in larger compilation times and may result in more
12319 removed dead stores.
12320
12321 @item scev-max-expr-size
12322 Bound on size of expressions used in the scalar evolutions analyzer.
12323 Large expressions slow the analyzer.
12324
12325 @item scev-max-expr-complexity
12326 Bound on the complexity of the expressions in the scalar evolutions analyzer.
12327 Complex expressions slow the analyzer.
12328
12329 @item max-tree-if-conversion-phi-args
12330 Maximum number of arguments in a PHI supported by TREE if conversion
12331 unless the loop is marked with simd pragma.
12332
12333 @item vect-max-version-for-alignment-checks
12334 The maximum number of run-time checks that can be performed when
12335 doing loop versioning for alignment in the vectorizer.
12336
12337 @item vect-max-version-for-alias-checks
12338 The maximum number of run-time checks that can be performed when
12339 doing loop versioning for alias in the vectorizer.
12340
12341 @item vect-max-peeling-for-alignment
12342 The maximum number of loop peels to enhance access alignment
12343 for vectorizer. Value -1 means no limit.
12344
12345 @item max-iterations-to-track
12346 The maximum number of iterations of a loop the brute-force algorithm
12347 for analysis of the number of iterations of the loop tries to evaluate.
12348
12349 @item hot-bb-count-fraction
12350 The denominator n of fraction 1/n of the maximal execution count of a
12351 basic block in the entire program that a basic block needs to at least
12352 have in order to be considered hot. The default is 10000, which means
12353 that a basic block is considered hot if its execution count is greater
12354 than 1/10000 of the maximal execution count. 0 means that it is never
12355 considered hot. Used in non-LTO mode.
12356
12357 @item hot-bb-count-ws-permille
12358 The number of most executed permilles, ranging from 0 to 1000, of the
12359 profiled execution of the entire program to which the execution count
12360 of a basic block must be part of in order to be considered hot. The
12361 default is 990, which means that a basic block is considered hot if
12362 its execution count contributes to the upper 990 permilles, or 99.0%,
12363 of the profiled execution of the entire program. 0 means that it is
12364 never considered hot. Used in LTO mode.
12365
12366 @item hot-bb-frequency-fraction
12367 The denominator n of fraction 1/n of the execution frequency of the
12368 entry block of a function that a basic block of this function needs
12369 to at least have in order to be considered hot. The default is 1000,
12370 which means that a basic block is considered hot in a function if it
12371 is executed more frequently than 1/1000 of the frequency of the entry
12372 block of the function. 0 means that it is never considered hot.
12373
12374 @item unlikely-bb-count-fraction
12375 The denominator n of fraction 1/n of the number of profiled runs of
12376 the entire program below which the execution count of a basic block
12377 must be in order for the basic block to be considered unlikely executed.
12378 The default is 20, which means that a basic block is considered unlikely
12379 executed if it is executed in fewer than 1/20, or 5%, of the runs of
12380 the program. 0 means that it is always considered unlikely executed.
12381
12382 @item max-predicted-iterations
12383 The maximum number of loop iterations we predict statically. This is useful
12384 in cases where a function contains a single loop with known bound and
12385 another loop with unknown bound.
12386 The known number of iterations is predicted correctly, while
12387 the unknown number of iterations average to roughly 10. This means that the
12388 loop without bounds appears artificially cold relative to the other one.
12389
12390 @item builtin-expect-probability
12391 Control the probability of the expression having the specified value. This
12392 parameter takes a percentage (i.e.@: 0 ... 100) as input.
12393
12394 @item builtin-string-cmp-inline-length
12395 The maximum length of a constant string for a builtin string cmp call
12396 eligible for inlining.
12397
12398 @item align-threshold
12399
12400 Select fraction of the maximal frequency of executions of a basic block in
12401 a function to align the basic block.
12402
12403 @item align-loop-iterations
12404
12405 A loop expected to iterate at least the selected number of iterations is
12406 aligned.
12407
12408 @item tracer-dynamic-coverage
12409 @itemx tracer-dynamic-coverage-feedback
12410
12411 This value is used to limit superblock formation once the given percentage of
12412 executed instructions is covered. This limits unnecessary code size
12413 expansion.
12414
12415 The @option{tracer-dynamic-coverage-feedback} parameter
12416 is used only when profile
12417 feedback is available. The real profiles (as opposed to statically estimated
12418 ones) are much less balanced allowing the threshold to be larger value.
12419
12420 @item tracer-max-code-growth
12421 Stop tail duplication once code growth has reached given percentage. This is
12422 a rather artificial limit, as most of the duplicates are eliminated later in
12423 cross jumping, so it may be set to much higher values than is the desired code
12424 growth.
12425
12426 @item tracer-min-branch-ratio
12427
12428 Stop reverse growth when the reverse probability of best edge is less than this
12429 threshold (in percent).
12430
12431 @item tracer-min-branch-probability
12432 @itemx tracer-min-branch-probability-feedback
12433
12434 Stop forward growth if the best edge has probability lower than this
12435 threshold.
12436
12437 Similarly to @option{tracer-dynamic-coverage} two parameters are
12438 provided. @option{tracer-min-branch-probability-feedback} is used for
12439 compilation with profile feedback and @option{tracer-min-branch-probability}
12440 compilation without. The value for compilation with profile feedback
12441 needs to be more conservative (higher) in order to make tracer
12442 effective.
12443
12444 @item stack-clash-protection-guard-size
12445 Specify the size of the operating system provided stack guard as
12446 2 raised to @var{num} bytes. Higher values may reduce the
12447 number of explicit probes, but a value larger than the operating system
12448 provided guard will leave code vulnerable to stack clash style attacks.
12449
12450 @item stack-clash-protection-probe-interval
12451 Stack clash protection involves probing stack space as it is allocated. This
12452 param controls the maximum distance between probes into the stack as 2 raised
12453 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
12454 larger than the operating system provided guard will leave code vulnerable to
12455 stack clash style attacks.
12456
12457 @item max-cse-path-length
12458
12459 The maximum number of basic blocks on path that CSE considers.
12460
12461 @item max-cse-insns
12462 The maximum number of instructions CSE processes before flushing.
12463
12464 @item ggc-min-expand
12465
12466 GCC uses a garbage collector to manage its own memory allocation. This
12467 parameter specifies the minimum percentage by which the garbage
12468 collector's heap should be allowed to expand between collections.
12469 Tuning this may improve compilation speed; it has no effect on code
12470 generation.
12471
12472 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12473 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
12474 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
12475 GCC is not able to calculate RAM on a particular platform, the lower
12476 bound of 30% is used. Setting this parameter and
12477 @option{ggc-min-heapsize} to zero causes a full collection to occur at
12478 every opportunity. This is extremely slow, but can be useful for
12479 debugging.
12480
12481 @item ggc-min-heapsize
12482
12483 Minimum size of the garbage collector's heap before it begins bothering
12484 to collect garbage. The first collection occurs after the heap expands
12485 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
12486 tuning this may improve compilation speed, and has no effect on code
12487 generation.
12488
12489 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12490 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12491 with a lower bound of 4096 (four megabytes) and an upper bound of
12492 131072 (128 megabytes). If GCC is not able to calculate RAM on a
12493 particular platform, the lower bound is used. Setting this parameter
12494 very large effectively disables garbage collection. Setting this
12495 parameter and @option{ggc-min-expand} to zero causes a full collection
12496 to occur at every opportunity.
12497
12498 @item max-reload-search-insns
12499 The maximum number of instruction reload should look backward for equivalent
12500 register. Increasing values mean more aggressive optimization, making the
12501 compilation time increase with probably slightly better performance.
12502
12503 @item max-cselib-memory-locations
12504 The maximum number of memory locations cselib should take into account.
12505 Increasing values mean more aggressive optimization, making the compilation time
12506 increase with probably slightly better performance.
12507
12508 @item max-sched-ready-insns
12509 The maximum number of instructions ready to be issued the scheduler should
12510 consider at any given time during the first scheduling pass. Increasing
12511 values mean more thorough searches, making the compilation time increase
12512 with probably little benefit.
12513
12514 @item max-sched-region-blocks
12515 The maximum number of blocks in a region to be considered for
12516 interblock scheduling.
12517
12518 @item max-pipeline-region-blocks
12519 The maximum number of blocks in a region to be considered for
12520 pipelining in the selective scheduler.
12521
12522 @item max-sched-region-insns
12523 The maximum number of insns in a region to be considered for
12524 interblock scheduling.
12525
12526 @item max-pipeline-region-insns
12527 The maximum number of insns in a region to be considered for
12528 pipelining in the selective scheduler.
12529
12530 @item min-spec-prob
12531 The minimum probability (in percents) of reaching a source block
12532 for interblock speculative scheduling.
12533
12534 @item max-sched-extend-regions-iters
12535 The maximum number of iterations through CFG to extend regions.
12536 A value of 0 disables region extensions.
12537
12538 @item max-sched-insn-conflict-delay
12539 The maximum conflict delay for an insn to be considered for speculative motion.
12540
12541 @item sched-spec-prob-cutoff
12542 The minimal probability of speculation success (in percents), so that
12543 speculative insns are scheduled.
12544
12545 @item sched-state-edge-prob-cutoff
12546 The minimum probability an edge must have for the scheduler to save its
12547 state across it.
12548
12549 @item sched-mem-true-dep-cost
12550 Minimal distance (in CPU cycles) between store and load targeting same
12551 memory locations.
12552
12553 @item selsched-max-lookahead
12554 The maximum size of the lookahead window of selective scheduling. It is a
12555 depth of search for available instructions.
12556
12557 @item selsched-max-sched-times
12558 The maximum number of times that an instruction is scheduled during
12559 selective scheduling. This is the limit on the number of iterations
12560 through which the instruction may be pipelined.
12561
12562 @item selsched-insns-to-rename
12563 The maximum number of best instructions in the ready list that are considered
12564 for renaming in the selective scheduler.
12565
12566 @item sms-min-sc
12567 The minimum value of stage count that swing modulo scheduler
12568 generates.
12569
12570 @item max-last-value-rtl
12571 The maximum size measured as number of RTLs that can be recorded in an expression
12572 in combiner for a pseudo register as last known value of that register.
12573
12574 @item max-combine-insns
12575 The maximum number of instructions the RTL combiner tries to combine.
12576
12577 @item integer-share-limit
12578 Small integer constants can use a shared data structure, reducing the
12579 compiler's memory usage and increasing its speed. This sets the maximum
12580 value of a shared integer constant.
12581
12582 @item ssp-buffer-size
12583 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
12584 protection when @option{-fstack-protection} is used.
12585
12586 @item min-size-for-stack-sharing
12587 The minimum size of variables taking part in stack slot sharing when not
12588 optimizing.
12589
12590 @item max-jump-thread-duplication-stmts
12591 Maximum number of statements allowed in a block that needs to be
12592 duplicated when threading jumps.
12593
12594 @item max-fields-for-field-sensitive
12595 Maximum number of fields in a structure treated in
12596 a field sensitive manner during pointer analysis.
12597
12598 @item prefetch-latency
12599 Estimate on average number of instructions that are executed before
12600 prefetch finishes. The distance prefetched ahead is proportional
12601 to this constant. Increasing this number may also lead to less
12602 streams being prefetched (see @option{simultaneous-prefetches}).
12603
12604 @item simultaneous-prefetches
12605 Maximum number of prefetches that can run at the same time.
12606
12607 @item l1-cache-line-size
12608 The size of cache line in L1 data cache, in bytes.
12609
12610 @item l1-cache-size
12611 The size of L1 data cache, in kilobytes.
12612
12613 @item l2-cache-size
12614 The size of L2 data cache, in kilobytes.
12615
12616 @item prefetch-dynamic-strides
12617 Whether the loop array prefetch pass should issue software prefetch hints
12618 for strides that are non-constant. In some cases this may be
12619 beneficial, though the fact the stride is non-constant may make it
12620 hard to predict when there is clear benefit to issuing these hints.
12621
12622 Set to 1 if the prefetch hints should be issued for non-constant
12623 strides. Set to 0 if prefetch hints should be issued only for strides that
12624 are known to be constant and below @option{prefetch-minimum-stride}.
12625
12626 @item prefetch-minimum-stride
12627 Minimum constant stride, in bytes, to start using prefetch hints for. If
12628 the stride is less than this threshold, prefetch hints will not be issued.
12629
12630 This setting is useful for processors that have hardware prefetchers, in
12631 which case there may be conflicts between the hardware prefetchers and
12632 the software prefetchers. If the hardware prefetchers have a maximum
12633 stride they can handle, it should be used here to improve the use of
12634 software prefetchers.
12635
12636 A value of -1 means we don't have a threshold and therefore
12637 prefetch hints can be issued for any constant stride.
12638
12639 This setting is only useful for strides that are known and constant.
12640
12641 @item loop-interchange-max-num-stmts
12642 The maximum number of stmts in a loop to be interchanged.
12643
12644 @item loop-interchange-stride-ratio
12645 The minimum ratio between stride of two loops for interchange to be profitable.
12646
12647 @item min-insn-to-prefetch-ratio
12648 The minimum ratio between the number of instructions and the
12649 number of prefetches to enable prefetching in a loop.
12650
12651 @item prefetch-min-insn-to-mem-ratio
12652 The minimum ratio between the number of instructions and the
12653 number of memory references to enable prefetching in a loop.
12654
12655 @item use-canonical-types
12656 Whether the compiler should use the ``canonical'' type system.
12657 Should always be 1, which uses a more efficient internal
12658 mechanism for comparing types in C++ and Objective-C++. However, if
12659 bugs in the canonical type system are causing compilation failures,
12660 set this value to 0 to disable canonical types.
12661
12662 @item switch-conversion-max-branch-ratio
12663 Switch initialization conversion refuses to create arrays that are
12664 bigger than @option{switch-conversion-max-branch-ratio} times the number of
12665 branches in the switch.
12666
12667 @item max-partial-antic-length
12668 Maximum length of the partial antic set computed during the tree
12669 partial redundancy elimination optimization (@option{-ftree-pre}) when
12670 optimizing at @option{-O3} and above. For some sorts of source code
12671 the enhanced partial redundancy elimination optimization can run away,
12672 consuming all of the memory available on the host machine. This
12673 parameter sets a limit on the length of the sets that are computed,
12674 which prevents the runaway behavior. Setting a value of 0 for
12675 this parameter allows an unlimited set length.
12676
12677 @item rpo-vn-max-loop-depth
12678 Maximum loop depth that is value-numbered optimistically.
12679 When the limit hits the innermost
12680 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
12681 loop nest are value-numbered optimistically and the remaining ones not.
12682
12683 @item sccvn-max-alias-queries-per-access
12684 Maximum number of alias-oracle queries we perform when looking for
12685 redundancies for loads and stores. If this limit is hit the search
12686 is aborted and the load or store is not considered redundant. The
12687 number of queries is algorithmically limited to the number of
12688 stores on all paths from the load to the function entry.
12689
12690 @item ira-max-loops-num
12691 IRA uses regional register allocation by default. If a function
12692 contains more loops than the number given by this parameter, only at most
12693 the given number of the most frequently-executed loops form regions
12694 for regional register allocation.
12695
12696 @item ira-max-conflict-table-size
12697 Although IRA uses a sophisticated algorithm to compress the conflict
12698 table, the table can still require excessive amounts of memory for
12699 huge functions. If the conflict table for a function could be more
12700 than the size in MB given by this parameter, the register allocator
12701 instead uses a faster, simpler, and lower-quality
12702 algorithm that does not require building a pseudo-register conflict table.
12703
12704 @item ira-loop-reserved-regs
12705 IRA can be used to evaluate more accurate register pressure in loops
12706 for decisions to move loop invariants (see @option{-O3}). The number
12707 of available registers reserved for some other purposes is given
12708 by this parameter. Default of the parameter
12709 is the best found from numerous experiments.
12710
12711 @item lra-inheritance-ebb-probability-cutoff
12712 LRA tries to reuse values reloaded in registers in subsequent insns.
12713 This optimization is called inheritance. EBB is used as a region to
12714 do this optimization. The parameter defines a minimal fall-through
12715 edge probability in percentage used to add BB to inheritance EBB in
12716 LRA. The default value was chosen
12717 from numerous runs of SPEC2000 on x86-64.
12718
12719 @item loop-invariant-max-bbs-in-loop
12720 Loop invariant motion can be very expensive, both in compilation time and
12721 in amount of needed compile-time memory, with very large loops. Loops
12722 with more basic blocks than this parameter won't have loop invariant
12723 motion optimization performed on them.
12724
12725 @item loop-max-datarefs-for-datadeps
12726 Building data dependencies is expensive for very large loops. This
12727 parameter limits the number of data references in loops that are
12728 considered for data dependence analysis. These large loops are no
12729 handled by the optimizations using loop data dependencies.
12730
12731 @item max-vartrack-size
12732 Sets a maximum number of hash table slots to use during variable
12733 tracking dataflow analysis of any function. If this limit is exceeded
12734 with variable tracking at assignments enabled, analysis for that
12735 function is retried without it, after removing all debug insns from
12736 the function. If the limit is exceeded even without debug insns, var
12737 tracking analysis is completely disabled for the function. Setting
12738 the parameter to zero makes it unlimited.
12739
12740 @item max-vartrack-expr-depth
12741 Sets a maximum number of recursion levels when attempting to map
12742 variable names or debug temporaries to value expressions. This trades
12743 compilation time for more complete debug information. If this is set too
12744 low, value expressions that are available and could be represented in
12745 debug information may end up not being used; setting this higher may
12746 enable the compiler to find more complex debug expressions, but compile
12747 time and memory use may grow.
12748
12749 @item max-debug-marker-count
12750 Sets a threshold on the number of debug markers (e.g.@: begin stmt
12751 markers) to avoid complexity explosion at inlining or expanding to RTL.
12752 If a function has more such gimple stmts than the set limit, such stmts
12753 will be dropped from the inlined copy of a function, and from its RTL
12754 expansion.
12755
12756 @item min-nondebug-insn-uid
12757 Use uids starting at this parameter for nondebug insns. The range below
12758 the parameter is reserved exclusively for debug insns created by
12759 @option{-fvar-tracking-assignments}, but debug insns may get
12760 (non-overlapping) uids above it if the reserved range is exhausted.
12761
12762 @item ipa-sra-ptr-growth-factor
12763 IPA-SRA replaces a pointer to an aggregate with one or more new
12764 parameters only when their cumulative size is less or equal to
12765 @option{ipa-sra-ptr-growth-factor} times the size of the original
12766 pointer parameter.
12767
12768 @item ipa-sra-max-replacements
12769 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12770 consequence, it is also the maximum number of replacements of a formal
12771 parameter.
12772
12773 @item sra-max-scalarization-size-Ospeed
12774 @itemx sra-max-scalarization-size-Osize
12775 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12776 replace scalar parts of aggregates with uses of independent scalar
12777 variables. These parameters control the maximum size, in storage units,
12778 of aggregate which is considered for replacement when compiling for
12779 speed
12780 (@option{sra-max-scalarization-size-Ospeed}) or size
12781 (@option{sra-max-scalarization-size-Osize}) respectively.
12782
12783 @item sra-max-propagations
12784 The maximum number of artificial accesses that Scalar Replacement of
12785 Aggregates (SRA) will track, per one local variable, in order to
12786 facilitate copy propagation.
12787
12788 @item tm-max-aggregate-size
12789 When making copies of thread-local variables in a transaction, this
12790 parameter specifies the size in bytes after which variables are
12791 saved with the logging functions as opposed to save/restore code
12792 sequence pairs. This option only applies when using
12793 @option{-fgnu-tm}.
12794
12795 @item graphite-max-nb-scop-params
12796 To avoid exponential effects in the Graphite loop transforms, the
12797 number of parameters in a Static Control Part (SCoP) is bounded.
12798 A value of zero can be used to lift
12799 the bound. A variable whose value is unknown at compilation time and
12800 defined outside a SCoP is a parameter of the SCoP.
12801
12802 @item loop-block-tile-size
12803 Loop blocking or strip mining transforms, enabled with
12804 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12805 loop in the loop nest by a given number of iterations. The strip
12806 length can be changed using the @option{loop-block-tile-size}
12807 parameter.
12808
12809 @item ipa-cp-value-list-size
12810 IPA-CP attempts to track all possible values and types passed to a function's
12811 parameter in order to propagate them and perform devirtualization.
12812 @option{ipa-cp-value-list-size} is the maximum number of values and types it
12813 stores per one formal parameter of a function.
12814
12815 @item ipa-cp-eval-threshold
12816 IPA-CP calculates its own score of cloning profitability heuristics
12817 and performs those cloning opportunities with scores that exceed
12818 @option{ipa-cp-eval-threshold}.
12819
12820 @item ipa-cp-max-recursive-depth
12821 Maximum depth of recursive cloning for self-recursive function.
12822
12823 @item ipa-cp-min-recursive-probability
12824 Recursive cloning only when the probability of call being executed exceeds
12825 the parameter.
12826
12827 @item ipa-cp-recursion-penalty
12828 Percentage penalty the recursive functions will receive when they
12829 are evaluated for cloning.
12830
12831 @item ipa-cp-single-call-penalty
12832 Percentage penalty functions containing a single call to another
12833 function will receive when they are evaluated for cloning.
12834
12835 @item ipa-max-agg-items
12836 IPA-CP is also capable to propagate a number of scalar values passed
12837 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12838 number of such values per one parameter.
12839
12840 @item ipa-cp-loop-hint-bonus
12841 When IPA-CP determines that a cloning candidate would make the number
12842 of iterations of a loop known, it adds a bonus of
12843 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12844 the candidate.
12845
12846 @item ipa-max-aa-steps
12847 During its analysis of function bodies, IPA-CP employs alias analysis
12848 in order to track values pointed to by function parameters. In order
12849 not spend too much time analyzing huge functions, it gives up and
12850 consider all memory clobbered after examining
12851 @option{ipa-max-aa-steps} statements modifying memory.
12852
12853 @item ipa-max-switch-predicate-bounds
12854 Maximal number of boundary endpoints of case ranges of switch statement.
12855 For switch exceeding this limit, IPA-CP will not construct cloning cost
12856 predicate, which is used to estimate cloning benefit, for default case
12857 of the switch statement.
12858
12859 @item ipa-max-param-expr-ops
12860 IPA-CP will analyze conditional statement that references some function
12861 parameter to estimate benefit for cloning upon certain constant value.
12862 But if number of operations in a parameter expression exceeds
12863 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12864 one, and is not handled by IPA analysis.
12865
12866 @item lto-partitions
12867 Specify desired number of partitions produced during WHOPR compilation.
12868 The number of partitions should exceed the number of CPUs used for compilation.
12869
12870 @item lto-min-partition
12871 Size of minimal partition for WHOPR (in estimated instructions).
12872 This prevents expenses of splitting very small programs into too many
12873 partitions.
12874
12875 @item lto-max-partition
12876 Size of max partition for WHOPR (in estimated instructions).
12877 to provide an upper bound for individual size of partition.
12878 Meant to be used only with balanced partitioning.
12879
12880 @item lto-max-streaming-parallelism
12881 Maximal number of parallel processes used for LTO streaming.
12882
12883 @item cxx-max-namespaces-for-diagnostic-help
12884 The maximum number of namespaces to consult for suggestions when C++
12885 name lookup fails for an identifier.
12886
12887 @item sink-frequency-threshold
12888 The maximum relative execution frequency (in percents) of the target block
12889 relative to a statement's original block to allow statement sinking of a
12890 statement. Larger numbers result in more aggressive statement sinking.
12891 A small positive adjustment is applied for
12892 statements with memory operands as those are even more profitable so sink.
12893
12894 @item max-stores-to-sink
12895 The maximum number of conditional store pairs that can be sunk. Set to 0
12896 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12897 (@option{-ftree-loop-if-convert}) is disabled.
12898
12899 @item case-values-threshold
12900 The smallest number of different values for which it is best to use a
12901 jump-table instead of a tree of conditional branches. If the value is
12902 0, use the default for the machine.
12903
12904 @item jump-table-max-growth-ratio-for-size
12905 The maximum code size growth ratio when expanding
12906 into a jump table (in percent). The parameter is used when
12907 optimizing for size.
12908
12909 @item jump-table-max-growth-ratio-for-speed
12910 The maximum code size growth ratio when expanding
12911 into a jump table (in percent). The parameter is used when
12912 optimizing for speed.
12913
12914 @item tree-reassoc-width
12915 Set the maximum number of instructions executed in parallel in
12916 reassociated tree. This parameter overrides target dependent
12917 heuristics used by default if has non zero value.
12918
12919 @item sched-pressure-algorithm
12920 Choose between the two available implementations of
12921 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12922 and is the more likely to prevent instructions from being reordered.
12923 Algorithm 2 was designed to be a compromise between the relatively
12924 conservative approach taken by algorithm 1 and the rather aggressive
12925 approach taken by the default scheduler. It relies more heavily on
12926 having a regular register file and accurate register pressure classes.
12927 See @file{haifa-sched.c} in the GCC sources for more details.
12928
12929 The default choice depends on the target.
12930
12931 @item max-slsr-cand-scan
12932 Set the maximum number of existing candidates that are considered when
12933 seeking a basis for a new straight-line strength reduction candidate.
12934
12935 @item asan-globals
12936 Enable buffer overflow detection for global objects. This kind
12937 of protection is enabled by default if you are using
12938 @option{-fsanitize=address} option.
12939 To disable global objects protection use @option{--param asan-globals=0}.
12940
12941 @item asan-stack
12942 Enable buffer overflow detection for stack objects. This kind of
12943 protection is enabled by default when using @option{-fsanitize=address}.
12944 To disable stack protection use @option{--param asan-stack=0} option.
12945
12946 @item asan-instrument-reads
12947 Enable buffer overflow detection for memory reads. This kind of
12948 protection is enabled by default when using @option{-fsanitize=address}.
12949 To disable memory reads protection use
12950 @option{--param asan-instrument-reads=0}.
12951
12952 @item asan-instrument-writes
12953 Enable buffer overflow detection for memory writes. This kind of
12954 protection is enabled by default when using @option{-fsanitize=address}.
12955 To disable memory writes protection use
12956 @option{--param asan-instrument-writes=0} option.
12957
12958 @item asan-memintrin
12959 Enable detection for built-in functions. This kind of protection
12960 is enabled by default when using @option{-fsanitize=address}.
12961 To disable built-in functions protection use
12962 @option{--param asan-memintrin=0}.
12963
12964 @item asan-use-after-return
12965 Enable detection of use-after-return. This kind of protection
12966 is enabled by default when using the @option{-fsanitize=address} option.
12967 To disable it use @option{--param asan-use-after-return=0}.
12968
12969 Note: By default the check is disabled at run time. To enable it,
12970 add @code{detect_stack_use_after_return=1} to the environment variable
12971 @env{ASAN_OPTIONS}.
12972
12973 @item asan-instrumentation-with-call-threshold
12974 If number of memory accesses in function being instrumented
12975 is greater or equal to this number, use callbacks instead of inline checks.
12976 E.g. to disable inline code use
12977 @option{--param asan-instrumentation-with-call-threshold=0}.
12978
12979 @item use-after-scope-direct-emission-threshold
12980 If the size of a local variable in bytes is smaller or equal to this
12981 number, directly poison (or unpoison) shadow memory instead of using
12982 run-time callbacks.
12983
12984 @item max-fsm-thread-path-insns
12985 Maximum number of instructions to copy when duplicating blocks on a
12986 finite state automaton jump thread path.
12987
12988 @item max-fsm-thread-length
12989 Maximum number of basic blocks on a finite state automaton jump thread
12990 path.
12991
12992 @item max-fsm-thread-paths
12993 Maximum number of new jump thread paths to create for a finite state
12994 automaton.
12995
12996 @item parloops-chunk-size
12997 Chunk size of omp schedule for loops parallelized by parloops.
12998
12999 @item parloops-schedule
13000 Schedule type of omp schedule for loops parallelized by parloops (static,
13001 dynamic, guided, auto, runtime).
13002
13003 @item parloops-min-per-thread
13004 The minimum number of iterations per thread of an innermost parallelized
13005 loop for which the parallelized variant is preferred over the single threaded
13006 one. Note that for a parallelized loop nest the
13007 minimum number of iterations of the outermost loop per thread is two.
13008
13009 @item max-ssa-name-query-depth
13010 Maximum depth of recursion when querying properties of SSA names in things
13011 like fold routines. One level of recursion corresponds to following a
13012 use-def chain.
13013
13014 @item hsa-gen-debug-stores
13015 Enable emission of special debug stores within HSA kernels which are
13016 then read and reported by libgomp plugin. Generation of these stores
13017 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
13018 enable it.
13019
13020 @item max-speculative-devirt-maydefs
13021 The maximum number of may-defs we analyze when looking for a must-def
13022 specifying the dynamic type of an object that invokes a virtual call
13023 we may be able to devirtualize speculatively.
13024
13025 @item max-vrp-switch-assertions
13026 The maximum number of assertions to add along the default edge of a switch
13027 statement during VRP.
13028
13029 @item unroll-jam-min-percent
13030 The minimum percentage of memory references that must be optimized
13031 away for the unroll-and-jam transformation to be considered profitable.
13032
13033 @item unroll-jam-max-unroll
13034 The maximum number of times the outer loop should be unrolled by
13035 the unroll-and-jam transformation.
13036
13037 @item max-rtl-if-conversion-unpredictable-cost
13038 Maximum permissible cost for the sequence that would be generated
13039 by the RTL if-conversion pass for a branch that is considered unpredictable.
13040
13041 @item max-variable-expansions-in-unroller
13042 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
13043 of times that an individual variable will be expanded during loop unrolling.
13044
13045 @item tracer-min-branch-probability-feedback
13046 Stop forward growth if the probability of best edge is less than
13047 this threshold (in percent). Used when profile feedback is available.
13048
13049 @item partial-inlining-entry-probability
13050 Maximum probability of the entry BB of split region
13051 (in percent relative to entry BB of the function)
13052 to make partial inlining happen.
13053
13054 @item max-tracked-strlens
13055 Maximum number of strings for which strlen optimization pass will
13056 track string lengths.
13057
13058 @item gcse-after-reload-partial-fraction
13059 The threshold ratio for performing partial redundancy
13060 elimination after reload.
13061
13062 @item gcse-after-reload-critical-fraction
13063 The threshold ratio of critical edges execution count that
13064 permit performing redundancy elimination after reload.
13065
13066 @item max-loop-header-insns
13067 The maximum number of insns in loop header duplicated
13068 by the copy loop headers pass.
13069
13070 @item vect-epilogues-nomask
13071 Enable loop epilogue vectorization using smaller vector size.
13072
13073 @item slp-max-insns-in-bb
13074 Maximum number of instructions in basic block to be
13075 considered for SLP vectorization.
13076
13077 @item avoid-fma-max-bits
13078 Maximum number of bits for which we avoid creating FMAs.
13079
13080 @item sms-loop-average-count-threshold
13081 A threshold on the average loop count considered by the swing modulo scheduler.
13082
13083 @item sms-dfa-history
13084 The number of cycles the swing modulo scheduler considers when checking
13085 conflicts using DFA.
13086
13087 @item max-inline-insns-recursive-auto
13088 The maximum number of instructions non-inline function
13089 can grow to via recursive inlining.
13090
13091 @item graphite-allow-codegen-errors
13092 Whether codegen errors should be ICEs when @option{-fchecking}.
13093
13094 @item sms-max-ii-factor
13095 A factor for tuning the upper bound that swing modulo scheduler
13096 uses for scheduling a loop.
13097
13098 @item lra-max-considered-reload-pseudos
13099 The max number of reload pseudos which are considered during
13100 spilling a non-reload pseudo.
13101
13102 @item max-pow-sqrt-depth
13103 Maximum depth of sqrt chains to use when synthesizing exponentiation
13104 by a real constant.
13105
13106 @item max-dse-active-local-stores
13107 Maximum number of active local stores in RTL dead store elimination.
13108
13109 @item asan-instrument-allocas
13110 Enable asan allocas/VLAs protection.
13111
13112 @item max-iterations-computation-cost
13113 Bound on the cost of an expression to compute the number of iterations.
13114
13115 @item max-isl-operations
13116 Maximum number of isl operations, 0 means unlimited.
13117
13118 @item graphite-max-arrays-per-scop
13119 Maximum number of arrays per scop.
13120
13121 @item max-vartrack-reverse-op-size
13122 Max. size of loc list for which reverse ops should be added.
13123
13124 @item tracer-dynamic-coverage-feedback
13125 The percentage of function, weighted by execution frequency,
13126 that must be covered by trace formation.
13127 Used when profile feedback is available.
13128
13129 @item max-inline-recursive-depth-auto
13130 The maximum depth of recursive inlining for non-inline functions.
13131
13132 @item fsm-scale-path-stmts
13133 Scale factor to apply to the number of statements in a threading path
13134 when comparing to the number of (scaled) blocks.
13135
13136 @item fsm-maximum-phi-arguments
13137 Maximum number of arguments a PHI may have before the FSM threader
13138 will not try to thread through its block.
13139
13140 @item uninit-control-dep-attempts
13141 Maximum number of nested calls to search for control dependencies
13142 during uninitialized variable analysis.
13143
13144 @item max-once-peeled-insns
13145 The maximum number of insns of a peeled loop that rolls only once.
13146
13147 @item sra-max-scalarization-size-Osize
13148 Maximum size, in storage units, of an aggregate
13149 which should be considered for scalarization when compiling for size.
13150
13151 @item fsm-scale-path-blocks
13152 Scale factor to apply to the number of blocks in a threading path
13153 when comparing to the number of (scaled) statements.
13154
13155 @item sched-autopref-queue-depth
13156 Hardware autoprefetcher scheduler model control flag.
13157 Number of lookahead cycles the model looks into; at '
13158 ' only enable instruction sorting heuristic.
13159
13160 @item loop-versioning-max-inner-insns
13161 The maximum number of instructions that an inner loop can have
13162 before the loop versioning pass considers it too big to copy.
13163
13164 @item loop-versioning-max-outer-insns
13165 The maximum number of instructions that an outer loop can have
13166 before the loop versioning pass considers it too big to copy,
13167 discounting any instructions in inner loops that directly benefit
13168 from versioning.
13169
13170 @item ssa-name-def-chain-limit
13171 The maximum number of SSA_NAME assignments to follow in determining
13172 a property of a variable such as its value. This limits the number
13173 of iterations or recursive calls GCC performs when optimizing certain
13174 statements or when determining their validity prior to issuing
13175 diagnostics.
13176
13177 @end table
13178
13179 The following choices of @var{name} are available on AArch64 targets:
13180
13181 @table @gcctabopt
13182 @item aarch64-sve-compare-costs
13183 When vectorizing for SVE, consider using ``unpacked'' vectors for
13184 smaller elements and use the cost model to pick the cheapest approach.
13185 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13186
13187 Using unpacked vectors includes storing smaller elements in larger
13188 containers and accessing elements with extending loads and truncating
13189 stores.
13190
13191 @item aarch64-float-recp-precision
13192 The number of Newton iterations for calculating the reciprocal for float type.
13193 The precision of division is proportional to this param when division
13194 approximation is enabled. The default value is 1.
13195
13196 @item aarch64-double-recp-precision
13197 The number of Newton iterations for calculating the reciprocal for double type.
13198 The precision of division is propotional to this param when division
13199 approximation is enabled. The default value is 2.
13200
13201 @end table
13202
13203 @end table
13204
13205 @node Instrumentation Options
13206 @section Program Instrumentation Options
13207 @cindex instrumentation options
13208 @cindex program instrumentation options
13209 @cindex run-time error checking options
13210 @cindex profiling options
13211 @cindex options, program instrumentation
13212 @cindex options, run-time error checking
13213 @cindex options, profiling
13214
13215 GCC supports a number of command-line options that control adding
13216 run-time instrumentation to the code it normally generates.
13217 For example, one purpose of instrumentation is collect profiling
13218 statistics for use in finding program hot spots, code coverage
13219 analysis, or profile-guided optimizations.
13220 Another class of program instrumentation is adding run-time checking
13221 to detect programming errors like invalid pointer
13222 dereferences or out-of-bounds array accesses, as well as deliberately
13223 hostile attacks such as stack smashing or C++ vtable hijacking.
13224 There is also a general hook which can be used to implement other
13225 forms of tracing or function-level instrumentation for debug or
13226 program analysis purposes.
13227
13228 @table @gcctabopt
13229 @cindex @command{prof}
13230 @cindex @command{gprof}
13231 @item -p
13232 @itemx -pg
13233 @opindex p
13234 @opindex pg
13235 Generate extra code to write profile information suitable for the
13236 analysis program @command{prof} (for @option{-p}) or @command{gprof}
13237 (for @option{-pg}). You must use this option when compiling
13238 the source files you want data about, and you must also use it when
13239 linking.
13240
13241 You can use the function attribute @code{no_instrument_function} to
13242 suppress profiling of individual functions when compiling with these options.
13243 @xref{Common Function Attributes}.
13244
13245 @item -fprofile-arcs
13246 @opindex fprofile-arcs
13247 Add code so that program flow @dfn{arcs} are instrumented. During
13248 execution the program records how many times each branch and call is
13249 executed and how many times it is taken or returns. On targets that support
13250 constructors with priority support, profiling properly handles constructors,
13251 destructors and C++ constructors (and destructors) of classes which are used
13252 as a type of a global variable.
13253
13254 When the compiled
13255 program exits it saves this data to a file called
13256 @file{@var{auxname}.gcda} for each source file. The data may be used for
13257 profile-directed optimizations (@option{-fbranch-probabilities}), or for
13258 test coverage analysis (@option{-ftest-coverage}). Each object file's
13259 @var{auxname} is generated from the name of the output file, if
13260 explicitly specified and it is not the final executable, otherwise it is
13261 the basename of the source file. In both cases any suffix is removed
13262 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13263 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13264 @xref{Cross-profiling}.
13265
13266 @cindex @command{gcov}
13267 @item --coverage
13268 @opindex coverage
13269
13270 This option is used to compile and link code instrumented for coverage
13271 analysis. The option is a synonym for @option{-fprofile-arcs}
13272 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13273 linking). See the documentation for those options for more details.
13274
13275 @itemize
13276
13277 @item
13278 Compile the source files with @option{-fprofile-arcs} plus optimization
13279 and code generation options. For test coverage analysis, use the
13280 additional @option{-ftest-coverage} option. You do not need to profile
13281 every source file in a program.
13282
13283 @item
13284 Compile the source files additionally with @option{-fprofile-abs-path}
13285 to create absolute path names in the @file{.gcno} files. This allows
13286 @command{gcov} to find the correct sources in projects where compilations
13287 occur with different working directories.
13288
13289 @item
13290 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13291 (the latter implies the former).
13292
13293 @item
13294 Run the program on a representative workload to generate the arc profile
13295 information. This may be repeated any number of times. You can run
13296 concurrent instances of your program, and provided that the file system
13297 supports locking, the data files will be correctly updated. Unless
13298 a strict ISO C dialect option is in effect, @code{fork} calls are
13299 detected and correctly handled without double counting.
13300
13301 @item
13302 For profile-directed optimizations, compile the source files again with
13303 the same optimization and code generation options plus
13304 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13305 Control Optimization}).
13306
13307 @item
13308 For test coverage analysis, use @command{gcov} to produce human readable
13309 information from the @file{.gcno} and @file{.gcda} files. Refer to the
13310 @command{gcov} documentation for further information.
13311
13312 @end itemize
13313
13314 With @option{-fprofile-arcs}, for each function of your program GCC
13315 creates a program flow graph, then finds a spanning tree for the graph.
13316 Only arcs that are not on the spanning tree have to be instrumented: the
13317 compiler adds code to count the number of times that these arcs are
13318 executed. When an arc is the only exit or only entrance to a block, the
13319 instrumentation code can be added to the block; otherwise, a new basic
13320 block must be created to hold the instrumentation code.
13321
13322 @need 2000
13323 @item -ftest-coverage
13324 @opindex ftest-coverage
13325 Produce a notes file that the @command{gcov} code-coverage utility
13326 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13327 show program coverage. Each source file's note file is called
13328 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
13329 above for a description of @var{auxname} and instructions on how to
13330 generate test coverage data. Coverage data matches the source files
13331 more closely if you do not optimize.
13332
13333 @item -fprofile-abs-path
13334 @opindex fprofile-abs-path
13335 Automatically convert relative source file names to absolute path names
13336 in the @file{.gcno} files. This allows @command{gcov} to find the correct
13337 sources in projects where compilations occur with different working
13338 directories.
13339
13340 @item -fprofile-dir=@var{path}
13341 @opindex fprofile-dir
13342
13343 Set the directory to search for the profile data files in to @var{path}.
13344 This option affects only the profile data generated by
13345 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13346 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13347 and its related options. Both absolute and relative paths can be used.
13348 By default, GCC uses the current directory as @var{path}, thus the
13349 profile data file appears in the same directory as the object file.
13350 In order to prevent the file name clashing, if the object file name is
13351 not an absolute path, we mangle the absolute path of the
13352 @file{@var{sourcename}.gcda} file and use it as the file name of a
13353 @file{.gcda} file. See similar option @option{-fprofile-note}.
13354
13355 When an executable is run in a massive parallel environment, it is recommended
13356 to save profile to different folders. That can be done with variables
13357 in @var{path} that are exported during run-time:
13358
13359 @table @gcctabopt
13360
13361 @item %p
13362 process ID.
13363
13364 @item %q@{VAR@}
13365 value of environment variable @var{VAR}
13366
13367 @end table
13368
13369 @item -fprofile-generate
13370 @itemx -fprofile-generate=@var{path}
13371 @opindex fprofile-generate
13372
13373 Enable options usually used for instrumenting application to produce
13374 profile useful for later recompilation with profile feedback based
13375 optimization. You must use @option{-fprofile-generate} both when
13376 compiling and when linking your program.
13377
13378 The following options are enabled:
13379 @option{-fprofile-arcs}, @option{-fprofile-values},
13380 @option{-finline-functions}, and @option{-fipa-bit-cp}.
13381
13382 If @var{path} is specified, GCC looks at the @var{path} to find
13383 the profile feedback data files. See @option{-fprofile-dir}.
13384
13385 To optimize the program based on the collected profile information, use
13386 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
13387
13388 @item -fprofile-note=@var{path}
13389 @opindex fprofile-note
13390
13391 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13392 location. If you combine the option with multiple source files,
13393 the @file{.gcno} file will be overwritten.
13394
13395 @item -fprofile-prefix-path=@var{path}
13396
13397 This option can be used in combination with
13398 @option{profile-generate=}@var{profile_dir} and
13399 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
13400 directory of built source tree. By default @var{profile_dir} will contain
13401 files with mangled absolute paths of all object files in the built project.
13402 This is not desirable when directory used to build the instrumented binary
13403 differs from the directory used to build the binary optimized with profile
13404 feedback because the profile data will not be found during the optimized build.
13405 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
13406 pointing to the base directory of the build can be used to strip the irrelevant
13407 part of the path and keep all file names relative to the main build directory.
13408
13409 @item -fprofile-update=@var{method}
13410 @opindex fprofile-update
13411
13412 Alter the update method for an application instrumented for profile
13413 feedback based optimization. The @var{method} argument should be one of
13414 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13415 The first one is useful for single-threaded applications,
13416 while the second one prevents profile corruption by emitting thread-safe code.
13417
13418 @strong{Warning:} When an application does not properly join all threads
13419 (or creates an detached thread), a profile file can be still corrupted.
13420
13421 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13422 when supported by a target, or to @samp{single} otherwise. The GCC driver
13423 automatically selects @samp{prefer-atomic} when @option{-pthread}
13424 is present in the command line.
13425
13426 @item -fprofile-filter-files=@var{regex}
13427 @opindex fprofile-filter-files
13428
13429 Instrument only functions from files where names match
13430 any regular expression (separated by a semi-colon).
13431
13432 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
13433 only @file{main.c} and all C files starting with 'module'.
13434
13435 @item -fprofile-exclude-files=@var{regex}
13436 @opindex fprofile-exclude-files
13437
13438 Instrument only functions from files where names do not match
13439 all the regular expressions (separated by a semi-colon).
13440
13441 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
13442 of all files that are located in @file{/usr/} folder.
13443
13444 @item -fprofile-reproducible
13445 @opindex fprofile-reproducible
13446 Control level of reproducibility of profile gathered by
13447 @code{-fprofile-generate}. This makes it possible to rebuild program
13448 with same outcome which is useful, for example, for distribution
13449 packages.
13450
13451 With @option{-fprofile-reproducibility=serial} the profile gathered by
13452 @option{-fprofile-generate} is reproducible provided the trained program
13453 behaves the same at each invocation of the train run, it is not
13454 multi-threaded and profile data streaming is always done in the same
13455 order. Note that profile streaming happens at the end of program run but
13456 also before @code{fork} function is invoked.
13457
13458 Note that it is quite common that execution counts of some part of
13459 programs depends, for example, on length of temporary file names or
13460 memory space randomization (that may affect hash-table collision rate).
13461 Such non-reproducible part of programs may be annotated by
13462 @code{no_instrument_function} function attribute. @code{gcov-dump} with
13463 @option{-l} can be used to dump gathered data and verify that they are
13464 indeed reproducible.
13465
13466 With @option{-fprofile-reproducibility=parallel-runs} collected profile
13467 stays reproducible regardless the order of streaming of the data into
13468 gcda files. This setting makes it possible to run multiple instances of
13469 instrumented program in parallel (such as with @code{make -j}). This
13470 reduces quality of gathered data, in particular of indirect call
13471 profiling.
13472
13473 @item -fsanitize=address
13474 @opindex fsanitize=address
13475 Enable AddressSanitizer, a fast memory error detector.
13476 Memory access instructions are instrumented to detect
13477 out-of-bounds and use-after-free bugs.
13478 The option enables @option{-fsanitize-address-use-after-scope}.
13479 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13480 more details. The run-time behavior can be influenced using the
13481 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
13482 the available options are shown at startup of the instrumented program. See
13483 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13484 for a list of supported options.
13485 The option cannot be combined with @option{-fsanitize=thread}.
13486
13487 @item -fsanitize=kernel-address
13488 @opindex fsanitize=kernel-address
13489 Enable AddressSanitizer for Linux kernel.
13490 See @uref{https://github.com/google/kasan/wiki} for more details.
13491
13492 @item -fsanitize=pointer-compare
13493 @opindex fsanitize=pointer-compare
13494 Instrument comparison operation (<, <=, >, >=) with pointer operands.
13495 The option must be combined with either @option{-fsanitize=kernel-address} or
13496 @option{-fsanitize=address}
13497 The option cannot be combined with @option{-fsanitize=thread}.
13498 Note: By default the check is disabled at run time. To enable it,
13499 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13500 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13501 invalid operation only when both pointers are non-null.
13502
13503 @item -fsanitize=pointer-subtract
13504 @opindex fsanitize=pointer-subtract
13505 Instrument subtraction with pointer operands.
13506 The option must be combined with either @option{-fsanitize=kernel-address} or
13507 @option{-fsanitize=address}
13508 The option cannot be combined with @option{-fsanitize=thread}.
13509 Note: By default the check is disabled at run time. To enable it,
13510 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13511 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13512 invalid operation only when both pointers are non-null.
13513
13514 @item -fsanitize=thread
13515 @opindex fsanitize=thread
13516 Enable ThreadSanitizer, a fast data race detector.
13517 Memory access instructions are instrumented to detect
13518 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13519 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13520 environment variable; see
13521 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13522 supported options.
13523 The option cannot be combined with @option{-fsanitize=address},
13524 @option{-fsanitize=leak}.
13525
13526 Note that sanitized atomic builtins cannot throw exceptions when
13527 operating on invalid memory addresses with non-call exceptions
13528 (@option{-fnon-call-exceptions}).
13529
13530 @item -fsanitize=leak
13531 @opindex fsanitize=leak
13532 Enable LeakSanitizer, a memory leak detector.
13533 This option only matters for linking of executables and
13534 the executable is linked against a library that overrides @code{malloc}
13535 and other allocator functions. See
13536 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13537 details. The run-time behavior can be influenced using the
13538 @env{LSAN_OPTIONS} environment variable.
13539 The option cannot be combined with @option{-fsanitize=thread}.
13540
13541 @item -fsanitize=undefined
13542 @opindex fsanitize=undefined
13543 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
13544 Various computations are instrumented to detect undefined behavior
13545 at runtime. Current suboptions are:
13546
13547 @table @gcctabopt
13548
13549 @item -fsanitize=shift
13550 @opindex fsanitize=shift
13551 This option enables checking that the result of a shift operation is
13552 not undefined. Note that what exactly is considered undefined differs
13553 slightly between C and C++, as well as between ISO C90 and C99, etc.
13554 This option has two suboptions, @option{-fsanitize=shift-base} and
13555 @option{-fsanitize=shift-exponent}.
13556
13557 @item -fsanitize=shift-exponent
13558 @opindex fsanitize=shift-exponent
13559 This option enables checking that the second argument of a shift operation
13560 is not negative and is smaller than the precision of the promoted first
13561 argument.
13562
13563 @item -fsanitize=shift-base
13564 @opindex fsanitize=shift-base
13565 If the second argument of a shift operation is within range, check that the
13566 result of a shift operation is not undefined. Note that what exactly is
13567 considered undefined differs slightly between C and C++, as well as between
13568 ISO C90 and C99, etc.
13569
13570 @item -fsanitize=integer-divide-by-zero
13571 @opindex fsanitize=integer-divide-by-zero
13572 Detect integer division by zero as well as @code{INT_MIN / -1} division.
13573
13574 @item -fsanitize=unreachable
13575 @opindex fsanitize=unreachable
13576 With this option, the compiler turns the @code{__builtin_unreachable}
13577 call into a diagnostics message call instead. When reaching the
13578 @code{__builtin_unreachable} call, the behavior is undefined.
13579
13580 @item -fsanitize=vla-bound
13581 @opindex fsanitize=vla-bound
13582 This option instructs the compiler to check that the size of a variable
13583 length array is positive.
13584
13585 @item -fsanitize=null
13586 @opindex fsanitize=null
13587 This option enables pointer checking. Particularly, the application
13588 built with this option turned on will issue an error message when it
13589 tries to dereference a NULL pointer, or if a reference (possibly an
13590 rvalue reference) is bound to a NULL pointer, or if a method is invoked
13591 on an object pointed by a NULL pointer.
13592
13593 @item -fsanitize=return
13594 @opindex fsanitize=return
13595 This option enables return statement checking. Programs
13596 built with this option turned on will issue an error message
13597 when the end of a non-void function is reached without actually
13598 returning a value. This option works in C++ only.
13599
13600 @item -fsanitize=signed-integer-overflow
13601 @opindex fsanitize=signed-integer-overflow
13602 This option enables signed integer overflow checking. We check that
13603 the result of @code{+}, @code{*}, and both unary and binary @code{-}
13604 does not overflow in the signed arithmetics. Note, integer promotion
13605 rules must be taken into account. That is, the following is not an
13606 overflow:
13607 @smallexample
13608 signed char a = SCHAR_MAX;
13609 a++;
13610 @end smallexample
13611
13612 @item -fsanitize=bounds
13613 @opindex fsanitize=bounds
13614 This option enables instrumentation of array bounds. Various out of bounds
13615 accesses are detected. Flexible array members, flexible array member-like
13616 arrays, and initializers of variables with static storage are not instrumented.
13617
13618 @item -fsanitize=bounds-strict
13619 @opindex fsanitize=bounds-strict
13620 This option enables strict instrumentation of array bounds. Most out of bounds
13621 accesses are detected, including flexible array members and flexible array
13622 member-like arrays. Initializers of variables with static storage are not
13623 instrumented.
13624
13625 @item -fsanitize=alignment
13626 @opindex fsanitize=alignment
13627
13628 This option enables checking of alignment of pointers when they are
13629 dereferenced, or when a reference is bound to insufficiently aligned target,
13630 or when a method or constructor is invoked on insufficiently aligned object.
13631
13632 @item -fsanitize=object-size
13633 @opindex fsanitize=object-size
13634 This option enables instrumentation of memory references using the
13635 @code{__builtin_object_size} function. Various out of bounds pointer
13636 accesses are detected.
13637
13638 @item -fsanitize=float-divide-by-zero
13639 @opindex fsanitize=float-divide-by-zero
13640 Detect floating-point division by zero. Unlike other similar options,
13641 @option{-fsanitize=float-divide-by-zero} is not enabled by
13642 @option{-fsanitize=undefined}, since floating-point division by zero can
13643 be a legitimate way of obtaining infinities and NaNs.
13644
13645 @item -fsanitize=float-cast-overflow
13646 @opindex fsanitize=float-cast-overflow
13647 This option enables floating-point type to integer conversion checking.
13648 We check that the result of the conversion does not overflow.
13649 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
13650 not enabled by @option{-fsanitize=undefined}.
13651 This option does not work well with @code{FE_INVALID} exceptions enabled.
13652
13653 @item -fsanitize=nonnull-attribute
13654 @opindex fsanitize=nonnull-attribute
13655
13656 This option enables instrumentation of calls, checking whether null values
13657 are not passed to arguments marked as requiring a non-null value by the
13658 @code{nonnull} function attribute.
13659
13660 @item -fsanitize=returns-nonnull-attribute
13661 @opindex fsanitize=returns-nonnull-attribute
13662
13663 This option enables instrumentation of return statements in functions
13664 marked with @code{returns_nonnull} function attribute, to detect returning
13665 of null values from such functions.
13666
13667 @item -fsanitize=bool
13668 @opindex fsanitize=bool
13669
13670 This option enables instrumentation of loads from bool. If a value other
13671 than 0/1 is loaded, a run-time error is issued.
13672
13673 @item -fsanitize=enum
13674 @opindex fsanitize=enum
13675
13676 This option enables instrumentation of loads from an enum type. If
13677 a value outside the range of values for the enum type is loaded,
13678 a run-time error is issued.
13679
13680 @item -fsanitize=vptr
13681 @opindex fsanitize=vptr
13682
13683 This option enables instrumentation of C++ member function calls, member
13684 accesses and some conversions between pointers to base and derived classes,
13685 to verify the referenced object has the correct dynamic type.
13686
13687 @item -fsanitize=pointer-overflow
13688 @opindex fsanitize=pointer-overflow
13689
13690 This option enables instrumentation of pointer arithmetics. If the pointer
13691 arithmetics overflows, a run-time error is issued.
13692
13693 @item -fsanitize=builtin
13694 @opindex fsanitize=builtin
13695
13696 This option enables instrumentation of arguments to selected builtin
13697 functions. If an invalid value is passed to such arguments, a run-time
13698 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
13699 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
13700 by this option.
13701
13702 @end table
13703
13704 While @option{-ftrapv} causes traps for signed overflows to be emitted,
13705 @option{-fsanitize=undefined} gives a diagnostic message.
13706 This currently works only for the C family of languages.
13707
13708 @item -fno-sanitize=all
13709 @opindex fno-sanitize=all
13710
13711 This option disables all previously enabled sanitizers.
13712 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
13713 together.
13714
13715 @item -fasan-shadow-offset=@var{number}
13716 @opindex fasan-shadow-offset
13717 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
13718 It is useful for experimenting with different shadow memory layouts in
13719 Kernel AddressSanitizer.
13720
13721 @item -fsanitize-sections=@var{s1},@var{s2},...
13722 @opindex fsanitize-sections
13723 Sanitize global variables in selected user-defined sections. @var{si} may
13724 contain wildcards.
13725
13726 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
13727 @opindex fsanitize-recover
13728 @opindex fno-sanitize-recover
13729 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
13730 mentioned in comma-separated list of @var{opts}. Enabling this option
13731 for a sanitizer component causes it to attempt to continue
13732 running the program as if no error happened. This means multiple
13733 runtime errors can be reported in a single program run, and the exit
13734 code of the program may indicate success even when errors
13735 have been reported. The @option{-fno-sanitize-recover=} option
13736 can be used to alter
13737 this behavior: only the first detected error is reported
13738 and program then exits with a non-zero exit code.
13739
13740 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
13741 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
13742 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
13743 @option{-fsanitize=bounds-strict},
13744 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
13745 For these sanitizers error recovery is turned on by default,
13746 except @option{-fsanitize=address}, for which this feature is experimental.
13747 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
13748 accepted, the former enables recovery for all sanitizers that support it,
13749 the latter disables recovery for all sanitizers that support it.
13750
13751 Even if a recovery mode is turned on the compiler side, it needs to be also
13752 enabled on the runtime library side, otherwise the failures are still fatal.
13753 The runtime library defaults to @code{halt_on_error=0} for
13754 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
13755 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
13756 setting the @code{halt_on_error} flag in the corresponding environment variable.
13757
13758 Syntax without an explicit @var{opts} parameter is deprecated. It is
13759 equivalent to specifying an @var{opts} list of:
13760
13761 @smallexample
13762 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13763 @end smallexample
13764
13765 @item -fsanitize-address-use-after-scope
13766 @opindex fsanitize-address-use-after-scope
13767 Enable sanitization of local variables to detect use-after-scope bugs.
13768 The option sets @option{-fstack-reuse} to @samp{none}.
13769
13770 @item -fsanitize-undefined-trap-on-error
13771 @opindex fsanitize-undefined-trap-on-error
13772 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
13773 report undefined behavior using @code{__builtin_trap} rather than
13774 a @code{libubsan} library routine. The advantage of this is that the
13775 @code{libubsan} library is not needed and is not linked in, so this
13776 is usable even in freestanding environments.
13777
13778 @item -fsanitize-coverage=trace-pc
13779 @opindex fsanitize-coverage=trace-pc
13780 Enable coverage-guided fuzzing code instrumentation.
13781 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
13782
13783 @item -fsanitize-coverage=trace-cmp
13784 @opindex fsanitize-coverage=trace-cmp
13785 Enable dataflow guided fuzzing code instrumentation.
13786 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
13787 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
13788 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
13789 variable or @code{__sanitizer_cov_trace_const_cmp1},
13790 @code{__sanitizer_cov_trace_const_cmp2},
13791 @code{__sanitizer_cov_trace_const_cmp4} or
13792 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
13793 operand constant, @code{__sanitizer_cov_trace_cmpf} or
13794 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
13795 @code{__sanitizer_cov_trace_switch} for switch statements.
13796
13797 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
13798 @opindex fcf-protection
13799 Enable code instrumentation of control-flow transfers to increase
13800 program security by checking that target addresses of control-flow
13801 transfer instructions (such as indirect function call, function return,
13802 indirect jump) are valid. This prevents diverting the flow of control
13803 to an unexpected target. This is intended to protect against such
13804 threats as Return-oriented Programming (ROP), and similarly
13805 call/jmp-oriented programming (COP/JOP).
13806
13807 The value @code{branch} tells the compiler to implement checking of
13808 validity of control-flow transfer at the point of indirect branch
13809 instructions, i.e.@: call/jmp instructions. The value @code{return}
13810 implements checking of validity at the point of returning from a
13811 function. The value @code{full} is an alias for specifying both
13812 @code{branch} and @code{return}. The value @code{none} turns off
13813 instrumentation.
13814
13815 The macro @code{__CET__} is defined when @option{-fcf-protection} is
13816 used. The first bit of @code{__CET__} is set to 1 for the value
13817 @code{branch} and the second bit of @code{__CET__} is set to 1 for
13818 the @code{return}.
13819
13820 You can also use the @code{nocf_check} attribute to identify
13821 which functions and calls should be skipped from instrumentation
13822 (@pxref{Function Attributes}).
13823
13824 Currently the x86 GNU/Linux target provides an implementation based
13825 on Intel Control-flow Enforcement Technology (CET).
13826
13827 @item -fstack-protector
13828 @opindex fstack-protector
13829 Emit extra code to check for buffer overflows, such as stack smashing
13830 attacks. This is done by adding a guard variable to functions with
13831 vulnerable objects. This includes functions that call @code{alloca}, and
13832 functions with buffers larger than or equal to 8 bytes. The guards are
13833 initialized when a function is entered and then checked when the function
13834 exits. If a guard check fails, an error message is printed and the program
13835 exits. Only variables that are actually allocated on the stack are
13836 considered, optimized away variables or variables allocated in registers
13837 don't count.
13838
13839 @item -fstack-protector-all
13840 @opindex fstack-protector-all
13841 Like @option{-fstack-protector} except that all functions are protected.
13842
13843 @item -fstack-protector-strong
13844 @opindex fstack-protector-strong
13845 Like @option{-fstack-protector} but includes additional functions to
13846 be protected --- those that have local array definitions, or have
13847 references to local frame addresses. Only variables that are actually
13848 allocated on the stack are considered, optimized away variables or variables
13849 allocated in registers don't count.
13850
13851 @item -fstack-protector-explicit
13852 @opindex fstack-protector-explicit
13853 Like @option{-fstack-protector} but only protects those functions which
13854 have the @code{stack_protect} attribute.
13855
13856 @item -fstack-check
13857 @opindex fstack-check
13858 Generate code to verify that you do not go beyond the boundary of the
13859 stack. You should specify this flag if you are running in an
13860 environment with multiple threads, but you only rarely need to specify it in
13861 a single-threaded environment since stack overflow is automatically
13862 detected on nearly all systems if there is only one stack.
13863
13864 Note that this switch does not actually cause checking to be done; the
13865 operating system or the language runtime must do that. The switch causes
13866 generation of code to ensure that they see the stack being extended.
13867
13868 You can additionally specify a string parameter: @samp{no} means no
13869 checking, @samp{generic} means force the use of old-style checking,
13870 @samp{specific} means use the best checking method and is equivalent
13871 to bare @option{-fstack-check}.
13872
13873 Old-style checking is a generic mechanism that requires no specific
13874 target support in the compiler but comes with the following drawbacks:
13875
13876 @enumerate
13877 @item
13878 Modified allocation strategy for large objects: they are always
13879 allocated dynamically if their size exceeds a fixed threshold. Note this
13880 may change the semantics of some code.
13881
13882 @item
13883 Fixed limit on the size of the static frame of functions: when it is
13884 topped by a particular function, stack checking is not reliable and
13885 a warning is issued by the compiler.
13886
13887 @item
13888 Inefficiency: because of both the modified allocation strategy and the
13889 generic implementation, code performance is hampered.
13890 @end enumerate
13891
13892 Note that old-style stack checking is also the fallback method for
13893 @samp{specific} if no target support has been added in the compiler.
13894
13895 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13896 and stack overflows. @samp{specific} is an excellent choice when compiling
13897 Ada code. It is not generally sufficient to protect against stack-clash
13898 attacks. To protect against those you want @samp{-fstack-clash-protection}.
13899
13900 @item -fstack-clash-protection
13901 @opindex fstack-clash-protection
13902 Generate code to prevent stack clash style attacks. When this option is
13903 enabled, the compiler will only allocate one page of stack space at a time
13904 and each page is accessed immediately after allocation. Thus, it prevents
13905 allocations from jumping over any stack guard page provided by the
13906 operating system.
13907
13908 Most targets do not fully support stack clash protection. However, on
13909 those targets @option{-fstack-clash-protection} will protect dynamic stack
13910 allocations. @option{-fstack-clash-protection} may also provide limited
13911 protection for static stack allocations if the target supports
13912 @option{-fstack-check=specific}.
13913
13914 @item -fstack-limit-register=@var{reg}
13915 @itemx -fstack-limit-symbol=@var{sym}
13916 @itemx -fno-stack-limit
13917 @opindex fstack-limit-register
13918 @opindex fstack-limit-symbol
13919 @opindex fno-stack-limit
13920 Generate code to ensure that the stack does not grow beyond a certain value,
13921 either the value of a register or the address of a symbol. If a larger
13922 stack is required, a signal is raised at run time. For most targets,
13923 the signal is raised before the stack overruns the boundary, so
13924 it is possible to catch the signal without taking special precautions.
13925
13926 For instance, if the stack starts at absolute address @samp{0x80000000}
13927 and grows downwards, you can use the flags
13928 @option{-fstack-limit-symbol=__stack_limit} and
13929 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13930 of 128KB@. Note that this may only work with the GNU linker.
13931
13932 You can locally override stack limit checking by using the
13933 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13934
13935 @item -fsplit-stack
13936 @opindex fsplit-stack
13937 Generate code to automatically split the stack before it overflows.
13938 The resulting program has a discontiguous stack which can only
13939 overflow if the program is unable to allocate any more memory. This
13940 is most useful when running threaded programs, as it is no longer
13941 necessary to calculate a good stack size to use for each thread. This
13942 is currently only implemented for the x86 targets running
13943 GNU/Linux.
13944
13945 When code compiled with @option{-fsplit-stack} calls code compiled
13946 without @option{-fsplit-stack}, there may not be much stack space
13947 available for the latter code to run. If compiling all code,
13948 including library code, with @option{-fsplit-stack} is not an option,
13949 then the linker can fix up these calls so that the code compiled
13950 without @option{-fsplit-stack} always has a large stack. Support for
13951 this is implemented in the gold linker in GNU binutils release 2.21
13952 and later.
13953
13954 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13955 @opindex fvtable-verify
13956 This option is only available when compiling C++ code.
13957 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13958 feature that verifies at run time, for every virtual call, that
13959 the vtable pointer through which the call is made is valid for the type of
13960 the object, and has not been corrupted or overwritten. If an invalid vtable
13961 pointer is detected at run time, an error is reported and execution of the
13962 program is immediately halted.
13963
13964 This option causes run-time data structures to be built at program startup,
13965 which are used for verifying the vtable pointers.
13966 The options @samp{std} and @samp{preinit}
13967 control the timing of when these data structures are built. In both cases the
13968 data structures are built before execution reaches @code{main}. Using
13969 @option{-fvtable-verify=std} causes the data structures to be built after
13970 shared libraries have been loaded and initialized.
13971 @option{-fvtable-verify=preinit} causes them to be built before shared
13972 libraries have been loaded and initialized.
13973
13974 If this option appears multiple times in the command line with different
13975 values specified, @samp{none} takes highest priority over both @samp{std} and
13976 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13977
13978 @item -fvtv-debug
13979 @opindex fvtv-debug
13980 When used in conjunction with @option{-fvtable-verify=std} or
13981 @option{-fvtable-verify=preinit}, causes debug versions of the
13982 runtime functions for the vtable verification feature to be called.
13983 This flag also causes the compiler to log information about which
13984 vtable pointers it finds for each class.
13985 This information is written to a file named @file{vtv_set_ptr_data.log}
13986 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13987 if that is defined or the current working directory otherwise.
13988
13989 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13990 file, be sure to delete any existing one.
13991
13992 @item -fvtv-counts
13993 @opindex fvtv-counts
13994 This is a debugging flag. When used in conjunction with
13995 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13996 causes the compiler to keep track of the total number of virtual calls
13997 it encounters and the number of verifications it inserts. It also
13998 counts the number of calls to certain run-time library functions
13999 that it inserts and logs this information for each compilation unit.
14000 The compiler writes this information to a file named
14001 @file{vtv_count_data.log} in the directory named by the environment
14002 variable @env{VTV_LOGS_DIR} if that is defined or the current working
14003 directory otherwise. It also counts the size of the vtable pointer sets
14004 for each class, and writes this information to @file{vtv_class_set_sizes.log}
14005 in the same directory.
14006
14007 Note: This feature @emph{appends} data to the log files. To get fresh log
14008 files, be sure to delete any existing ones.
14009
14010 @item -finstrument-functions
14011 @opindex finstrument-functions
14012 Generate instrumentation calls for entry and exit to functions. Just
14013 after function entry and just before function exit, the following
14014 profiling functions are called with the address of the current
14015 function and its call site. (On some platforms,
14016 @code{__builtin_return_address} does not work beyond the current
14017 function, so the call site information may not be available to the
14018 profiling functions otherwise.)
14019
14020 @smallexample
14021 void __cyg_profile_func_enter (void *this_fn,
14022 void *call_site);
14023 void __cyg_profile_func_exit (void *this_fn,
14024 void *call_site);
14025 @end smallexample
14026
14027 The first argument is the address of the start of the current function,
14028 which may be looked up exactly in the symbol table.
14029
14030 This instrumentation is also done for functions expanded inline in other
14031 functions. The profiling calls indicate where, conceptually, the
14032 inline function is entered and exited. This means that addressable
14033 versions of such functions must be available. If all your uses of a
14034 function are expanded inline, this may mean an additional expansion of
14035 code size. If you use @code{extern inline} in your C code, an
14036 addressable version of such functions must be provided. (This is
14037 normally the case anyway, but if you get lucky and the optimizer always
14038 expands the functions inline, you might have gotten away without
14039 providing static copies.)
14040
14041 A function may be given the attribute @code{no_instrument_function}, in
14042 which case this instrumentation is not done. This can be used, for
14043 example, for the profiling functions listed above, high-priority
14044 interrupt routines, and any functions from which the profiling functions
14045 cannot safely be called (perhaps signal handlers, if the profiling
14046 routines generate output or allocate memory).
14047 @xref{Common Function Attributes}.
14048
14049 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14050 @opindex finstrument-functions-exclude-file-list
14051
14052 Set the list of functions that are excluded from instrumentation (see
14053 the description of @option{-finstrument-functions}). If the file that
14054 contains a function definition matches with one of @var{file}, then
14055 that function is not instrumented. The match is done on substrings:
14056 if the @var{file} parameter is a substring of the file name, it is
14057 considered to be a match.
14058
14059 For example:
14060
14061 @smallexample
14062 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14063 @end smallexample
14064
14065 @noindent
14066 excludes any inline function defined in files whose pathnames
14067 contain @file{/bits/stl} or @file{include/sys}.
14068
14069 If, for some reason, you want to include letter @samp{,} in one of
14070 @var{sym}, write @samp{\,}. For example,
14071 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
14072 (note the single quote surrounding the option).
14073
14074 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14075 @opindex finstrument-functions-exclude-function-list
14076
14077 This is similar to @option{-finstrument-functions-exclude-file-list},
14078 but this option sets the list of function names to be excluded from
14079 instrumentation. The function name to be matched is its user-visible
14080 name, such as @code{vector<int> blah(const vector<int> &)}, not the
14081 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
14082 match is done on substrings: if the @var{sym} parameter is a substring
14083 of the function name, it is considered to be a match. For C99 and C++
14084 extended identifiers, the function name must be given in UTF-8, not
14085 using universal character names.
14086
14087 @item -fpatchable-function-entry=@var{N}[,@var{M}]
14088 @opindex fpatchable-function-entry
14089 Generate @var{N} NOPs right at the beginning
14090 of each function, with the function entry point before the @var{M}th NOP.
14091 If @var{M} is omitted, it defaults to @code{0} so the
14092 function entry points to the address just at the first NOP.
14093 The NOP instructions reserve extra space which can be used to patch in
14094 any desired instrumentation at run time, provided that the code segment
14095 is writable. The amount of space is controllable indirectly via
14096 the number of NOPs; the NOP instruction used corresponds to the instruction
14097 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
14098 is target-specific and may also depend on the architecture variant and/or
14099 other compilation options.
14100
14101 For run-time identification, the starting addresses of these areas,
14102 which correspond to their respective function entries minus @var{M},
14103 are additionally collected in the @code{__patchable_function_entries}
14104 section of the resulting binary.
14105
14106 Note that the value of @code{__attribute__ ((patchable_function_entry
14107 (N,M)))} takes precedence over command-line option
14108 @option{-fpatchable-function-entry=N,M}. This can be used to increase
14109 the area size or to remove it completely on a single function.
14110 If @code{N=0}, no pad location is recorded.
14111
14112 The NOP instructions are inserted at---and maybe before, depending on
14113 @var{M}---the function entry address, even before the prologue.
14114
14115 The maximum value of @var{N} and @var{M} is 65535.
14116 @end table
14117
14118
14119 @node Preprocessor Options
14120 @section Options Controlling the Preprocessor
14121 @cindex preprocessor options
14122 @cindex options, preprocessor
14123
14124 These options control the C preprocessor, which is run on each C source
14125 file before actual compilation.
14126
14127 If you use the @option{-E} option, nothing is done except preprocessing.
14128 Some of these options make sense only together with @option{-E} because
14129 they cause the preprocessor output to be unsuitable for actual
14130 compilation.
14131
14132 In addition to the options listed here, there are a number of options
14133 to control search paths for include files documented in
14134 @ref{Directory Options}.
14135 Options to control preprocessor diagnostics are listed in
14136 @ref{Warning Options}.
14137
14138 @table @gcctabopt
14139 @include cppopts.texi
14140
14141 @item -Wp,@var{option}
14142 @opindex Wp
14143 You can use @option{-Wp,@var{option}} to bypass the compiler driver
14144 and pass @var{option} directly through to the preprocessor. If
14145 @var{option} contains commas, it is split into multiple options at the
14146 commas. However, many options are modified, translated or interpreted
14147 by the compiler driver before being passed to the preprocessor, and
14148 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
14149 interface is undocumented and subject to change, so whenever possible
14150 you should avoid using @option{-Wp} and let the driver handle the
14151 options instead.
14152
14153 @item -Xpreprocessor @var{option}
14154 @opindex Xpreprocessor
14155 Pass @var{option} as an option to the preprocessor. You can use this to
14156 supply system-specific preprocessor options that GCC does not
14157 recognize.
14158
14159 If you want to pass an option that takes an argument, you must use
14160 @option{-Xpreprocessor} twice, once for the option and once for the argument.
14161
14162 @item -no-integrated-cpp
14163 @opindex no-integrated-cpp
14164 Perform preprocessing as a separate pass before compilation.
14165 By default, GCC performs preprocessing as an integrated part of
14166 input tokenization and parsing.
14167 If this option is provided, the appropriate language front end
14168 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14169 and Objective-C, respectively) is instead invoked twice,
14170 once for preprocessing only and once for actual compilation
14171 of the preprocessed input.
14172 This option may be useful in conjunction with the @option{-B} or
14173 @option{-wrapper} options to specify an alternate preprocessor or
14174 perform additional processing of the program source between
14175 normal preprocessing and compilation.
14176
14177 @item -flarge-source-files
14178 @opindex flarge-source-files
14179 Adjust GCC to expect large source files, at the expense of slower
14180 compilation and higher memory usage.
14181
14182 Specifically, GCC normally tracks both column numbers and line numbers
14183 within source files and it normally prints both of these numbers in
14184 diagnostics. However, once it has processed a certain number of source
14185 lines, it stops tracking column numbers and only tracks line numbers.
14186 This means that diagnostics for later lines do not include column numbers.
14187 It also means that options like @option{-Wmisleading-indentation} cease to work
14188 at that point, although the compiler prints a note if this happens.
14189 Passing @option{-flarge-source-files} significantly increases the number
14190 of source lines that GCC can process before it stops tracking columns.
14191
14192 @end table
14193
14194 @node Assembler Options
14195 @section Passing Options to the Assembler
14196
14197 @c prevent bad page break with this line
14198 You can pass options to the assembler.
14199
14200 @table @gcctabopt
14201 @item -Wa,@var{option}
14202 @opindex Wa
14203 Pass @var{option} as an option to the assembler. If @var{option}
14204 contains commas, it is split into multiple options at the commas.
14205
14206 @item -Xassembler @var{option}
14207 @opindex Xassembler
14208 Pass @var{option} as an option to the assembler. You can use this to
14209 supply system-specific assembler options that GCC does not
14210 recognize.
14211
14212 If you want to pass an option that takes an argument, you must use
14213 @option{-Xassembler} twice, once for the option and once for the argument.
14214
14215 @end table
14216
14217 @node Link Options
14218 @section Options for Linking
14219 @cindex link options
14220 @cindex options, linking
14221
14222 These options come into play when the compiler links object files into
14223 an executable output file. They are meaningless if the compiler is
14224 not doing a link step.
14225
14226 @table @gcctabopt
14227 @cindex file names
14228 @item @var{object-file-name}
14229 A file name that does not end in a special recognized suffix is
14230 considered to name an object file or library. (Object files are
14231 distinguished from libraries by the linker according to the file
14232 contents.) If linking is done, these object files are used as input
14233 to the linker.
14234
14235 @item -c
14236 @itemx -S
14237 @itemx -E
14238 @opindex c
14239 @opindex S
14240 @opindex E
14241 If any of these options is used, then the linker is not run, and
14242 object file names should not be used as arguments. @xref{Overall
14243 Options}.
14244
14245 @item -flinker-output=@var{type}
14246 @opindex flinker-output
14247 This option controls code generation of the link-time optimizer. By
14248 default the linker output is automatically determined by the linker
14249 plugin. For debugging the compiler and if incremental linking with a
14250 non-LTO object file is desired, it may be useful to control the type
14251 manually.
14252
14253 If @var{type} is @samp{exec}, code generation produces a static
14254 binary. In this case @option{-fpic} and @option{-fpie} are both
14255 disabled.
14256
14257 If @var{type} is @samp{dyn}, code generation produces a shared
14258 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
14259 but not enabled automatically. This allows to build shared libraries
14260 without position-independent code on architectures where this is
14261 possible, i.e.@: on x86.
14262
14263 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14264 executable. This results in similar optimizations as @samp{exec}
14265 except that @option{-fpie} is not disabled if specified at compilation
14266 time.
14267
14268 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14269 done. The sections containing intermediate code for link-time optimization are
14270 merged, pre-optimized, and output to the resulting object file. In addition, if
14271 @option{-ffat-lto-objects} is specified, binary code is produced for future
14272 non-LTO linking. The object file produced by incremental linking is smaller
14273 than a static library produced from the same object files. At link time the
14274 result of incremental linking also loads faster than a static
14275 library assuming that the majority of objects in the library are used.
14276
14277 Finally @samp{nolto-rel} configures the compiler for incremental linking where
14278 code generation is forced, a final binary is produced, and the intermediate
14279 code for later link-time optimization is stripped. When multiple object files
14280 are linked together the resulting code is better optimized than with
14281 link-time optimizations disabled (for example, cross-module inlining
14282 happens), but most of benefits of whole program optimizations are lost.
14283
14284 During the incremental link (by @option{-r}) the linker plugin defaults to
14285 @option{rel}. With current interfaces to GNU Binutils it is however not
14286 possible to incrementally link LTO objects and non-LTO objects into a single
14287 mixed object file. If any of object files in incremental link cannot
14288 be used for link-time optimization, the linker plugin issues a warning and
14289 uses @samp{nolto-rel}. To maintain whole program optimization, it is
14290 recommended to link such objects into static library instead. Alternatively it
14291 is possible to use H.J. Lu's binutils with support for mixed objects.
14292
14293 @item -fuse-ld=bfd
14294 @opindex fuse-ld=bfd
14295 Use the @command{bfd} linker instead of the default linker.
14296
14297 @item -fuse-ld=gold
14298 @opindex fuse-ld=gold
14299 Use the @command{gold} linker instead of the default linker.
14300
14301 @item -fuse-ld=lld
14302 @opindex fuse-ld=lld
14303 Use the LLVM @command{lld} linker instead of the default linker.
14304
14305 @cindex Libraries
14306 @item -l@var{library}
14307 @itemx -l @var{library}
14308 @opindex l
14309 Search the library named @var{library} when linking. (The second
14310 alternative with the library as a separate argument is only for
14311 POSIX compliance and is not recommended.)
14312
14313 The @option{-l} option is passed directly to the linker by GCC. Refer
14314 to your linker documentation for exact details. The general
14315 description below applies to the GNU linker.
14316
14317 The linker searches a standard list of directories for the library.
14318 The directories searched include several standard system directories
14319 plus any that you specify with @option{-L}.
14320
14321 Static libraries are archives of object files, and have file names
14322 like @file{lib@var{library}.a}. Some targets also support shared
14323 libraries, which typically have names like @file{lib@var{library}.so}.
14324 If both static and shared libraries are found, the linker gives
14325 preference to linking with the shared library unless the
14326 @option{-static} option is used.
14327
14328 It makes a difference where in the command you write this option; the
14329 linker searches and processes libraries and object files in the order they
14330 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14331 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
14332 to functions in @samp{z}, those functions may not be loaded.
14333
14334 @item -lobjc
14335 @opindex lobjc
14336 You need this special case of the @option{-l} option in order to
14337 link an Objective-C or Objective-C++ program.
14338
14339 @item -nostartfiles
14340 @opindex nostartfiles
14341 Do not use the standard system startup files when linking.
14342 The standard system libraries are used normally, unless @option{-nostdlib},
14343 @option{-nolibc}, or @option{-nodefaultlibs} is used.
14344
14345 @item -nodefaultlibs
14346 @opindex nodefaultlibs
14347 Do not use the standard system libraries when linking.
14348 Only the libraries you specify are passed to the linker, and options
14349 specifying linkage of the system libraries, such as @option{-static-libgcc}
14350 or @option{-shared-libgcc}, are ignored.
14351 The standard startup files are used normally, unless @option{-nostartfiles}
14352 is used.
14353
14354 The compiler may generate calls to @code{memcmp},
14355 @code{memset}, @code{memcpy} and @code{memmove}.
14356 These entries are usually resolved by entries in
14357 libc. These entry points should be supplied through some other
14358 mechanism when this option is specified.
14359
14360 @item -nolibc
14361 @opindex nolibc
14362 Do not use the C library or system libraries tightly coupled with it when
14363 linking. Still link with the startup files, @file{libgcc} or toolchain
14364 provided language support libraries such as @file{libgnat}, @file{libgfortran}
14365 or @file{libstdc++} unless options preventing their inclusion are used as
14366 well. This typically removes @option{-lc} from the link command line, as well
14367 as system libraries that normally go with it and become meaningless when
14368 absence of a C library is assumed, for example @option{-lpthread} or
14369 @option{-lm} in some configurations. This is intended for bare-board
14370 targets when there is indeed no C library available.
14371
14372 @item -nostdlib
14373 @opindex nostdlib
14374 Do not use the standard system startup files or libraries when linking.
14375 No startup files and only the libraries you specify are passed to
14376 the linker, and options specifying linkage of the system libraries, such as
14377 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14378
14379 The compiler may generate calls to @code{memcmp}, @code{memset},
14380 @code{memcpy} and @code{memmove}.
14381 These entries are usually resolved by entries in
14382 libc. These entry points should be supplied through some other
14383 mechanism when this option is specified.
14384
14385 @cindex @option{-lgcc}, use with @option{-nostdlib}
14386 @cindex @option{-nostdlib} and unresolved references
14387 @cindex unresolved references and @option{-nostdlib}
14388 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14389 @cindex @option{-nodefaultlibs} and unresolved references
14390 @cindex unresolved references and @option{-nodefaultlibs}
14391 One of the standard libraries bypassed by @option{-nostdlib} and
14392 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14393 which GCC uses to overcome shortcomings of particular machines, or special
14394 needs for some languages.
14395 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14396 Collection (GCC) Internals},
14397 for more discussion of @file{libgcc.a}.)
14398 In most cases, you need @file{libgcc.a} even when you want to avoid
14399 other standard libraries. In other words, when you specify @option{-nostdlib}
14400 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14401 This ensures that you have no unresolved references to internal GCC
14402 library subroutines.
14403 (An example of such an internal subroutine is @code{__main}, used to ensure C++
14404 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14405 GNU Compiler Collection (GCC) Internals}.)
14406
14407 @item -e @var{entry}
14408 @itemx --entry=@var{entry}
14409 @opindex e
14410 @opindex entry
14411
14412 Specify that the program entry point is @var{entry}. The argument is
14413 interpreted by the linker; the GNU linker accepts either a symbol name
14414 or an address.
14415
14416 @item -pie
14417 @opindex pie
14418 Produce a dynamically linked position independent executable on targets
14419 that support it. For predictable results, you must also specify the same
14420 set of options used for compilation (@option{-fpie}, @option{-fPIE},
14421 or model suboptions) when you specify this linker option.
14422
14423 @item -no-pie
14424 @opindex no-pie
14425 Don't produce a dynamically linked position independent executable.
14426
14427 @item -static-pie
14428 @opindex static-pie
14429 Produce a static position independent executable on targets that support
14430 it. A static position independent executable is similar to a static
14431 executable, but can be loaded at any address without a dynamic linker.
14432 For predictable results, you must also specify the same set of options
14433 used for compilation (@option{-fpie}, @option{-fPIE}, or model
14434 suboptions) when you specify this linker option.
14435
14436 @item -pthread
14437 @opindex pthread
14438 Link with the POSIX threads library. This option is supported on
14439 GNU/Linux targets, most other Unix derivatives, and also on
14440 x86 Cygwin and MinGW targets. On some targets this option also sets
14441 flags for the preprocessor, so it should be used consistently for both
14442 compilation and linking.
14443
14444 @item -r
14445 @opindex r
14446 Produce a relocatable object as output. This is also known as partial
14447 linking.
14448
14449 @item -rdynamic
14450 @opindex rdynamic
14451 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14452 that support it. This instructs the linker to add all symbols, not
14453 only used ones, to the dynamic symbol table. This option is needed
14454 for some uses of @code{dlopen} or to allow obtaining backtraces
14455 from within a program.
14456
14457 @item -s
14458 @opindex s
14459 Remove all symbol table and relocation information from the executable.
14460
14461 @item -static
14462 @opindex static
14463 On systems that support dynamic linking, this overrides @option{-pie}
14464 and prevents linking with the shared libraries. On other systems, this
14465 option has no effect.
14466
14467 @item -shared
14468 @opindex shared
14469 Produce a shared object which can then be linked with other objects to
14470 form an executable. Not all systems support this option. For predictable
14471 results, you must also specify the same set of options used for compilation
14472 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
14473 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14474 needs to build supplementary stub code for constructors to work. On
14475 multi-libbed systems, @samp{gcc -shared} must select the correct support
14476 libraries to link against. Failing to supply the correct flags may lead
14477 to subtle defects. Supplying them in cases where they are not necessary
14478 is innocuous.}
14479
14480 @item -shared-libgcc
14481 @itemx -static-libgcc
14482 @opindex shared-libgcc
14483 @opindex static-libgcc
14484 On systems that provide @file{libgcc} as a shared library, these options
14485 force the use of either the shared or static version, respectively.
14486 If no shared version of @file{libgcc} was built when the compiler was
14487 configured, these options have no effect.
14488
14489 There are several situations in which an application should use the
14490 shared @file{libgcc} instead of the static version. The most common
14491 of these is when the application wishes to throw and catch exceptions
14492 across different shared libraries. In that case, each of the libraries
14493 as well as the application itself should use the shared @file{libgcc}.
14494
14495 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14496 whenever you build a shared library or a main executable, because C++
14497 programs typically use exceptions, so this is the right thing to do.
14498
14499 If, instead, you use the GCC driver to create shared libraries, you may
14500 find that they are not always linked with the shared @file{libgcc}.
14501 If GCC finds, at its configuration time, that you have a non-GNU linker
14502 or a GNU linker that does not support option @option{--eh-frame-hdr},
14503 it links the shared version of @file{libgcc} into shared libraries
14504 by default. Otherwise, it takes advantage of the linker and optimizes
14505 away the linking with the shared version of @file{libgcc}, linking with
14506 the static version of libgcc by default. This allows exceptions to
14507 propagate through such shared libraries, without incurring relocation
14508 costs at library load time.
14509
14510 However, if a library or main executable is supposed to throw or catch
14511 exceptions, you must link it using the G++ driver, or using the option
14512 @option{-shared-libgcc}, such that it is linked with the shared
14513 @file{libgcc}.
14514
14515 @item -static-libasan
14516 @opindex static-libasan
14517 When the @option{-fsanitize=address} option is used to link a program,
14518 the GCC driver automatically links against @option{libasan}. If
14519 @file{libasan} is available as a shared library, and the @option{-static}
14520 option is not used, then this links against the shared version of
14521 @file{libasan}. The @option{-static-libasan} option directs the GCC
14522 driver to link @file{libasan} statically, without necessarily linking
14523 other libraries statically.
14524
14525 @item -static-libtsan
14526 @opindex static-libtsan
14527 When the @option{-fsanitize=thread} option is used to link a program,
14528 the GCC driver automatically links against @option{libtsan}. If
14529 @file{libtsan} is available as a shared library, and the @option{-static}
14530 option is not used, then this links against the shared version of
14531 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
14532 driver to link @file{libtsan} statically, without necessarily linking
14533 other libraries statically.
14534
14535 @item -static-liblsan
14536 @opindex static-liblsan
14537 When the @option{-fsanitize=leak} option is used to link a program,
14538 the GCC driver automatically links against @option{liblsan}. If
14539 @file{liblsan} is available as a shared library, and the @option{-static}
14540 option is not used, then this links against the shared version of
14541 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
14542 driver to link @file{liblsan} statically, without necessarily linking
14543 other libraries statically.
14544
14545 @item -static-libubsan
14546 @opindex static-libubsan
14547 When the @option{-fsanitize=undefined} option is used to link a program,
14548 the GCC driver automatically links against @option{libubsan}. If
14549 @file{libubsan} is available as a shared library, and the @option{-static}
14550 option is not used, then this links against the shared version of
14551 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
14552 driver to link @file{libubsan} statically, without necessarily linking
14553 other libraries statically.
14554
14555 @item -static-libstdc++
14556 @opindex static-libstdc++
14557 When the @command{g++} program is used to link a C++ program, it
14558 normally automatically links against @option{libstdc++}. If
14559 @file{libstdc++} is available as a shared library, and the
14560 @option{-static} option is not used, then this links against the
14561 shared version of @file{libstdc++}. That is normally fine. However, it
14562 is sometimes useful to freeze the version of @file{libstdc++} used by
14563 the program without going all the way to a fully static link. The
14564 @option{-static-libstdc++} option directs the @command{g++} driver to
14565 link @file{libstdc++} statically, without necessarily linking other
14566 libraries statically.
14567
14568 @item -symbolic
14569 @opindex symbolic
14570 Bind references to global symbols when building a shared object. Warn
14571 about any unresolved references (unless overridden by the link editor
14572 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
14573 this option.
14574
14575 @item -T @var{script}
14576 @opindex T
14577 @cindex linker script
14578 Use @var{script} as the linker script. This option is supported by most
14579 systems using the GNU linker. On some targets, such as bare-board
14580 targets without an operating system, the @option{-T} option may be required
14581 when linking to avoid references to undefined symbols.
14582
14583 @item -Xlinker @var{option}
14584 @opindex Xlinker
14585 Pass @var{option} as an option to the linker. You can use this to
14586 supply system-specific linker options that GCC does not recognize.
14587
14588 If you want to pass an option that takes a separate argument, you must use
14589 @option{-Xlinker} twice, once for the option and once for the argument.
14590 For example, to pass @option{-assert definitions}, you must write
14591 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
14592 @option{-Xlinker "-assert definitions"}, because this passes the entire
14593 string as a single argument, which is not what the linker expects.
14594
14595 When using the GNU linker, it is usually more convenient to pass
14596 arguments to linker options using the @option{@var{option}=@var{value}}
14597 syntax than as separate arguments. For example, you can specify
14598 @option{-Xlinker -Map=output.map} rather than
14599 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
14600 this syntax for command-line options.
14601
14602 @item -Wl,@var{option}
14603 @opindex Wl
14604 Pass @var{option} as an option to the linker. If @var{option} contains
14605 commas, it is split into multiple options at the commas. You can use this
14606 syntax to pass an argument to the option.
14607 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
14608 linker. When using the GNU linker, you can also get the same effect with
14609 @option{-Wl,-Map=output.map}.
14610
14611 @item -u @var{symbol}
14612 @opindex u
14613 Pretend the symbol @var{symbol} is undefined, to force linking of
14614 library modules to define it. You can use @option{-u} multiple times with
14615 different symbols to force loading of additional library modules.
14616
14617 @item -z @var{keyword}
14618 @opindex z
14619 @option{-z} is passed directly on to the linker along with the keyword
14620 @var{keyword}. See the section in the documentation of your linker for
14621 permitted values and their meanings.
14622 @end table
14623
14624 @node Directory Options
14625 @section Options for Directory Search
14626 @cindex directory options
14627 @cindex options, directory search
14628 @cindex search path
14629
14630 These options specify directories to search for header files, for
14631 libraries and for parts of the compiler:
14632
14633 @table @gcctabopt
14634 @include cppdiropts.texi
14635
14636 @item -iplugindir=@var{dir}
14637 @opindex iplugindir=
14638 Set the directory to search for plugins that are passed
14639 by @option{-fplugin=@var{name}} instead of
14640 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
14641 to be used by the user, but only passed by the driver.
14642
14643 @item -L@var{dir}
14644 @opindex L
14645 Add directory @var{dir} to the list of directories to be searched
14646 for @option{-l}.
14647
14648 @item -B@var{prefix}
14649 @opindex B
14650 This option specifies where to find the executables, libraries,
14651 include files, and data files of the compiler itself.
14652
14653 The compiler driver program runs one or more of the subprograms
14654 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
14655 @var{prefix} as a prefix for each program it tries to run, both with and
14656 without @samp{@var{machine}/@var{version}/} for the corresponding target
14657 machine and compiler version.
14658
14659 For each subprogram to be run, the compiler driver first tries the
14660 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
14661 is not specified, the driver tries two standard prefixes,
14662 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
14663 those results in a file name that is found, the unmodified program
14664 name is searched for using the directories specified in your
14665 @env{PATH} environment variable.
14666
14667 The compiler checks to see if the path provided by @option{-B}
14668 refers to a directory, and if necessary it adds a directory
14669 separator character at the end of the path.
14670
14671 @option{-B} prefixes that effectively specify directory names also apply
14672 to libraries in the linker, because the compiler translates these
14673 options into @option{-L} options for the linker. They also apply to
14674 include files in the preprocessor, because the compiler translates these
14675 options into @option{-isystem} options for the preprocessor. In this case,
14676 the compiler appends @samp{include} to the prefix.
14677
14678 The runtime support file @file{libgcc.a} can also be searched for using
14679 the @option{-B} prefix, if needed. If it is not found there, the two
14680 standard prefixes above are tried, and that is all. The file is left
14681 out of the link if it is not found by those means.
14682
14683 Another way to specify a prefix much like the @option{-B} prefix is to use
14684 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
14685 Variables}.
14686
14687 As a special kludge, if the path provided by @option{-B} is
14688 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
14689 9, then it is replaced by @file{[dir/]include}. This is to help
14690 with boot-strapping the compiler.
14691
14692 @item -no-canonical-prefixes
14693 @opindex no-canonical-prefixes
14694 Do not expand any symbolic links, resolve references to @samp{/../}
14695 or @samp{/./}, or make the path absolute when generating a relative
14696 prefix.
14697
14698 @item --sysroot=@var{dir}
14699 @opindex sysroot
14700 Use @var{dir} as the logical root directory for headers and libraries.
14701 For example, if the compiler normally searches for headers in
14702 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
14703 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
14704
14705 If you use both this option and the @option{-isysroot} option, then
14706 the @option{--sysroot} option applies to libraries, but the
14707 @option{-isysroot} option applies to header files.
14708
14709 The GNU linker (beginning with version 2.16) has the necessary support
14710 for this option. If your linker does not support this option, the
14711 header file aspect of @option{--sysroot} still works, but the
14712 library aspect does not.
14713
14714 @item --no-sysroot-suffix
14715 @opindex no-sysroot-suffix
14716 For some targets, a suffix is added to the root directory specified
14717 with @option{--sysroot}, depending on the other options used, so that
14718 headers may for example be found in
14719 @file{@var{dir}/@var{suffix}/usr/include} instead of
14720 @file{@var{dir}/usr/include}. This option disables the addition of
14721 such a suffix.
14722
14723 @end table
14724
14725 @node Code Gen Options
14726 @section Options for Code Generation Conventions
14727 @cindex code generation conventions
14728 @cindex options, code generation
14729 @cindex run-time options
14730
14731 These machine-independent options control the interface conventions
14732 used in code generation.
14733
14734 Most of them have both positive and negative forms; the negative form
14735 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
14736 one of the forms is listed---the one that is not the default. You
14737 can figure out the other form by either removing @samp{no-} or adding
14738 it.
14739
14740 @table @gcctabopt
14741 @item -fstack-reuse=@var{reuse-level}
14742 @opindex fstack_reuse
14743 This option controls stack space reuse for user declared local/auto variables
14744 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
14745 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
14746 local variables and temporaries, @samp{named_vars} enables the reuse only for
14747 user defined local variables with names, and @samp{none} disables stack reuse
14748 completely. The default value is @samp{all}. The option is needed when the
14749 program extends the lifetime of a scoped local variable or a compiler generated
14750 temporary beyond the end point defined by the language. When a lifetime of
14751 a variable ends, and if the variable lives in memory, the optimizing compiler
14752 has the freedom to reuse its stack space with other temporaries or scoped
14753 local variables whose live range does not overlap with it. Legacy code extending
14754 local lifetime is likely to break with the stack reuse optimization.
14755
14756 For example,
14757
14758 @smallexample
14759 int *p;
14760 @{
14761 int local1;
14762
14763 p = &local1;
14764 local1 = 10;
14765 ....
14766 @}
14767 @{
14768 int local2;
14769 local2 = 20;
14770 ...
14771 @}
14772
14773 if (*p == 10) // out of scope use of local1
14774 @{
14775
14776 @}
14777 @end smallexample
14778
14779 Another example:
14780 @smallexample
14781
14782 struct A
14783 @{
14784 A(int k) : i(k), j(k) @{ @}
14785 int i;
14786 int j;
14787 @};
14788
14789 A *ap;
14790
14791 void foo(const A& ar)
14792 @{
14793 ap = &ar;
14794 @}
14795
14796 void bar()
14797 @{
14798 foo(A(10)); // temp object's lifetime ends when foo returns
14799
14800 @{
14801 A a(20);
14802 ....
14803 @}
14804 ap->i+= 10; // ap references out of scope temp whose space
14805 // is reused with a. What is the value of ap->i?
14806 @}
14807
14808 @end smallexample
14809
14810 The lifetime of a compiler generated temporary is well defined by the C++
14811 standard. When a lifetime of a temporary ends, and if the temporary lives
14812 in memory, the optimizing compiler has the freedom to reuse its stack
14813 space with other temporaries or scoped local variables whose live range
14814 does not overlap with it. However some of the legacy code relies on
14815 the behavior of older compilers in which temporaries' stack space is
14816 not reused, the aggressive stack reuse can lead to runtime errors. This
14817 option is used to control the temporary stack reuse optimization.
14818
14819 @item -ftrapv
14820 @opindex ftrapv
14821 This option generates traps for signed overflow on addition, subtraction,
14822 multiplication operations.
14823 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14824 @option{-ftrapv} @option{-fwrapv} on the command-line results in
14825 @option{-fwrapv} being effective. Note that only active options override, so
14826 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14827 results in @option{-ftrapv} being effective.
14828
14829 @item -fwrapv
14830 @opindex fwrapv
14831 This option instructs the compiler to assume that signed arithmetic
14832 overflow of addition, subtraction and multiplication wraps around
14833 using twos-complement representation. This flag enables some optimizations
14834 and disables others.
14835 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14836 @option{-ftrapv} @option{-fwrapv} on the command-line results in
14837 @option{-fwrapv} being effective. Note that only active options override, so
14838 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14839 results in @option{-ftrapv} being effective.
14840
14841 @item -fwrapv-pointer
14842 @opindex fwrapv-pointer
14843 This option instructs the compiler to assume that pointer arithmetic
14844 overflow on addition and subtraction wraps around using twos-complement
14845 representation. This flag disables some optimizations which assume
14846 pointer overflow is invalid.
14847
14848 @item -fstrict-overflow
14849 @opindex fstrict-overflow
14850 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
14851 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
14852
14853 @item -fexceptions
14854 @opindex fexceptions
14855 Enable exception handling. Generates extra code needed to propagate
14856 exceptions. For some targets, this implies GCC generates frame
14857 unwind information for all functions, which can produce significant data
14858 size overhead, although it does not affect execution. If you do not
14859 specify this option, GCC enables it by default for languages like
14860 C++ that normally require exception handling, and disables it for
14861 languages like C that do not normally require it. However, you may need
14862 to enable this option when compiling C code that needs to interoperate
14863 properly with exception handlers written in C++. You may also wish to
14864 disable this option if you are compiling older C++ programs that don't
14865 use exception handling.
14866
14867 @item -fnon-call-exceptions
14868 @opindex fnon-call-exceptions
14869 Generate code that allows trapping instructions to throw exceptions.
14870 Note that this requires platform-specific runtime support that does
14871 not exist everywhere. Moreover, it only allows @emph{trapping}
14872 instructions to throw exceptions, i.e.@: memory references or floating-point
14873 instructions. It does not allow exceptions to be thrown from
14874 arbitrary signal handlers such as @code{SIGALRM}.
14875
14876 @item -fdelete-dead-exceptions
14877 @opindex fdelete-dead-exceptions
14878 Consider that instructions that may throw exceptions but don't otherwise
14879 contribute to the execution of the program can be optimized away.
14880 This option is enabled by default for the Ada front end, as permitted by
14881 the Ada language specification.
14882 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14883
14884 @item -funwind-tables
14885 @opindex funwind-tables
14886 Similar to @option{-fexceptions}, except that it just generates any needed
14887 static data, but does not affect the generated code in any other way.
14888 You normally do not need to enable this option; instead, a language processor
14889 that needs this handling enables it on your behalf.
14890
14891 @item -fasynchronous-unwind-tables
14892 @opindex fasynchronous-unwind-tables
14893 Generate unwind table in DWARF format, if supported by target machine. The
14894 table is exact at each instruction boundary, so it can be used for stack
14895 unwinding from asynchronous events (such as debugger or garbage collector).
14896
14897 @item -fno-gnu-unique
14898 @opindex fno-gnu-unique
14899 @opindex fgnu-unique
14900 On systems with recent GNU assembler and C library, the C++ compiler
14901 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14902 of template static data members and static local variables in inline
14903 functions are unique even in the presence of @code{RTLD_LOCAL}; this
14904 is necessary to avoid problems with a library used by two different
14905 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
14906 therefore disagreeing with the other one about the binding of the
14907 symbol. But this causes @code{dlclose} to be ignored for affected
14908 DSOs; if your program relies on reinitialization of a DSO via
14909 @code{dlclose} and @code{dlopen}, you can use
14910 @option{-fno-gnu-unique}.
14911
14912 @item -fpcc-struct-return
14913 @opindex fpcc-struct-return
14914 Return ``short'' @code{struct} and @code{union} values in memory like
14915 longer ones, rather than in registers. This convention is less
14916 efficient, but it has the advantage of allowing intercallability between
14917 GCC-compiled files and files compiled with other compilers, particularly
14918 the Portable C Compiler (pcc).
14919
14920 The precise convention for returning structures in memory depends
14921 on the target configuration macros.
14922
14923 Short structures and unions are those whose size and alignment match
14924 that of some integer type.
14925
14926 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14927 switch is not binary compatible with code compiled with the
14928 @option{-freg-struct-return} switch.
14929 Use it to conform to a non-default application binary interface.
14930
14931 @item -freg-struct-return
14932 @opindex freg-struct-return
14933 Return @code{struct} and @code{union} values in registers when possible.
14934 This is more efficient for small structures than
14935 @option{-fpcc-struct-return}.
14936
14937 If you specify neither @option{-fpcc-struct-return} nor
14938 @option{-freg-struct-return}, GCC defaults to whichever convention is
14939 standard for the target. If there is no standard convention, GCC
14940 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14941 the principal compiler. In those cases, we can choose the standard, and
14942 we chose the more efficient register return alternative.
14943
14944 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14945 switch is not binary compatible with code compiled with the
14946 @option{-fpcc-struct-return} switch.
14947 Use it to conform to a non-default application binary interface.
14948
14949 @item -fshort-enums
14950 @opindex fshort-enums
14951 Allocate to an @code{enum} type only as many bytes as it needs for the
14952 declared range of possible values. Specifically, the @code{enum} type
14953 is equivalent to the smallest integer type that has enough room.
14954
14955 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14956 code that is not binary compatible with code generated without that switch.
14957 Use it to conform to a non-default application binary interface.
14958
14959 @item -fshort-wchar
14960 @opindex fshort-wchar
14961 Override the underlying type for @code{wchar_t} to be @code{short
14962 unsigned int} instead of the default for the target. This option is
14963 useful for building programs to run under WINE@.
14964
14965 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14966 code that is not binary compatible with code generated without that switch.
14967 Use it to conform to a non-default application binary interface.
14968
14969 @item -fcommon
14970 @opindex fcommon
14971 @opindex fno-common
14972 @cindex tentative definitions
14973 In C code, this option controls the placement of global variables
14974 defined without an initializer, known as @dfn{tentative definitions}
14975 in the C standard. Tentative definitions are distinct from declarations
14976 of a variable with the @code{extern} keyword, which do not allocate storage.
14977
14978 The default is @option{-fno-common}, which specifies that the compiler places
14979 uninitialized global variables in the BSS section of the object file.
14980 This inhibits the merging of tentative definitions by the linker so you get a
14981 multiple-definition error if the same variable is accidentally defined in more
14982 than one compilation unit.
14983
14984 The @option{-fcommon} places uninitialized global variables in a common block.
14985 This allows the linker to resolve all tentative definitions of the same variable
14986 in different compilation units to the same object, or to a non-tentative
14987 definition. This behavior is inconsistent with C++, and on many targets implies
14988 a speed and code size penalty on global variable references. It is mainly
14989 useful to enable legacy code to link without errors.
14990
14991 @item -fno-ident
14992 @opindex fno-ident
14993 @opindex fident
14994 Ignore the @code{#ident} directive.
14995
14996 @item -finhibit-size-directive
14997 @opindex finhibit-size-directive
14998 Don't output a @code{.size} assembler directive, or anything else that
14999 would cause trouble if the function is split in the middle, and the
15000 two halves are placed at locations far apart in memory. This option is
15001 used when compiling @file{crtstuff.c}; you should not need to use it
15002 for anything else.
15003
15004 @item -fverbose-asm
15005 @opindex fverbose-asm
15006 Put extra commentary information in the generated assembly code to
15007 make it more readable. This option is generally only of use to those
15008 who actually need to read the generated assembly code (perhaps while
15009 debugging the compiler itself).
15010
15011 @option{-fno-verbose-asm}, the default, causes the
15012 extra information to be omitted and is useful when comparing two assembler
15013 files.
15014
15015 The added comments include:
15016
15017 @itemize @bullet
15018
15019 @item
15020 information on the compiler version and command-line options,
15021
15022 @item
15023 the source code lines associated with the assembly instructions,
15024 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15025
15026 @item
15027 hints on which high-level expressions correspond to
15028 the various assembly instruction operands.
15029
15030 @end itemize
15031
15032 For example, given this C source file:
15033
15034 @smallexample
15035 int test (int n)
15036 @{
15037 int i;
15038 int total = 0;
15039
15040 for (i = 0; i < n; i++)
15041 total += i * i;
15042
15043 return total;
15044 @}
15045 @end smallexample
15046
15047 compiling to (x86_64) assembly via @option{-S} and emitting the result
15048 direct to stdout via @option{-o} @option{-}
15049
15050 @smallexample
15051 gcc -S test.c -fverbose-asm -Os -o -
15052 @end smallexample
15053
15054 gives output similar to this:
15055
15056 @smallexample
15057 .file "test.c"
15058 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15059 [...snip...]
15060 # options passed:
15061 [...snip...]
15062
15063 .text
15064 .globl test
15065 .type test, @@function
15066 test:
15067 .LFB0:
15068 .cfi_startproc
15069 # test.c:4: int total = 0;
15070 xorl %eax, %eax # <retval>
15071 # test.c:6: for (i = 0; i < n; i++)
15072 xorl %edx, %edx # i
15073 .L2:
15074 # test.c:6: for (i = 0; i < n; i++)
15075 cmpl %edi, %edx # n, i
15076 jge .L5 #,
15077 # test.c:7: total += i * i;
15078 movl %edx, %ecx # i, tmp92
15079 imull %edx, %ecx # i, tmp92
15080 # test.c:6: for (i = 0; i < n; i++)
15081 incl %edx # i
15082 # test.c:7: total += i * i;
15083 addl %ecx, %eax # tmp92, <retval>
15084 jmp .L2 #
15085 .L5:
15086 # test.c:10: @}
15087 ret
15088 .cfi_endproc
15089 .LFE0:
15090 .size test, .-test
15091 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15092 .section .note.GNU-stack,"",@@progbits
15093 @end smallexample
15094
15095 The comments are intended for humans rather than machines and hence the
15096 precise format of the comments is subject to change.
15097
15098 @item -frecord-gcc-switches
15099 @opindex frecord-gcc-switches
15100 This switch causes the command line used to invoke the
15101 compiler to be recorded into the object file that is being created.
15102 This switch is only implemented on some targets and the exact format
15103 of the recording is target and binary file format dependent, but it
15104 usually takes the form of a section containing ASCII text. This
15105 switch is related to the @option{-fverbose-asm} switch, but that
15106 switch only records information in the assembler output file as
15107 comments, so it never reaches the object file.
15108 See also @option{-grecord-gcc-switches} for another
15109 way of storing compiler options into the object file.
15110
15111 @item -fpic
15112 @opindex fpic
15113 @cindex global offset table
15114 @cindex PIC
15115 Generate position-independent code (PIC) suitable for use in a shared
15116 library, if supported for the target machine. Such code accesses all
15117 constant addresses through a global offset table (GOT)@. The dynamic
15118 loader resolves the GOT entries when the program starts (the dynamic
15119 loader is not part of GCC; it is part of the operating system). If
15120 the GOT size for the linked executable exceeds a machine-specific
15121 maximum size, you get an error message from the linker indicating that
15122 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15123 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
15124 on the m68k and RS/6000. The x86 has no such limit.)
15125
15126 Position-independent code requires special support, and therefore works
15127 only on certain machines. For the x86, GCC supports PIC for System V
15128 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
15129 position-independent.
15130
15131 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15132 are defined to 1.
15133
15134 @item -fPIC
15135 @opindex fPIC
15136 If supported for the target machine, emit position-independent code,
15137 suitable for dynamic linking and avoiding any limit on the size of the
15138 global offset table. This option makes a difference on AArch64, m68k,
15139 PowerPC and SPARC@.
15140
15141 Position-independent code requires special support, and therefore works
15142 only on certain machines.
15143
15144 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15145 are defined to 2.
15146
15147 @item -fpie
15148 @itemx -fPIE
15149 @opindex fpie
15150 @opindex fPIE
15151 These options are similar to @option{-fpic} and @option{-fPIC}, but the
15152 generated position-independent code can be only linked into executables.
15153 Usually these options are used to compile code that will be linked using
15154 the @option{-pie} GCC option.
15155
15156 @option{-fpie} and @option{-fPIE} both define the macros
15157 @code{__pie__} and @code{__PIE__}. The macros have the value 1
15158 for @option{-fpie} and 2 for @option{-fPIE}.
15159
15160 @item -fno-plt
15161 @opindex fno-plt
15162 @opindex fplt
15163 Do not use the PLT for external function calls in position-independent code.
15164 Instead, load the callee address at call sites from the GOT and branch to it.
15165 This leads to more efficient code by eliminating PLT stubs and exposing
15166 GOT loads to optimizations. On architectures such as 32-bit x86 where
15167 PLT stubs expect the GOT pointer in a specific register, this gives more
15168 register allocation freedom to the compiler.
15169 Lazy binding requires use of the PLT;
15170 with @option{-fno-plt} all external symbols are resolved at load time.
15171
15172 Alternatively, the function attribute @code{noplt} can be used to avoid calls
15173 through the PLT for specific external functions.
15174
15175 In position-dependent code, a few targets also convert calls to
15176 functions that are marked to not use the PLT to use the GOT instead.
15177
15178 @item -fno-jump-tables
15179 @opindex fno-jump-tables
15180 @opindex fjump-tables
15181 Do not use jump tables for switch statements even where it would be
15182 more efficient than other code generation strategies. This option is
15183 of use in conjunction with @option{-fpic} or @option{-fPIC} for
15184 building code that forms part of a dynamic linker and cannot
15185 reference the address of a jump table. On some targets, jump tables
15186 do not require a GOT and this option is not needed.
15187
15188 @item -ffixed-@var{reg}
15189 @opindex ffixed
15190 Treat the register named @var{reg} as a fixed register; generated code
15191 should never refer to it (except perhaps as a stack pointer, frame
15192 pointer or in some other fixed role).
15193
15194 @var{reg} must be the name of a register. The register names accepted
15195 are machine-specific and are defined in the @code{REGISTER_NAMES}
15196 macro in the machine description macro file.
15197
15198 This flag does not have a negative form, because it specifies a
15199 three-way choice.
15200
15201 @item -fcall-used-@var{reg}
15202 @opindex fcall-used
15203 Treat the register named @var{reg} as an allocable register that is
15204 clobbered by function calls. It may be allocated for temporaries or
15205 variables that do not live across a call. Functions compiled this way
15206 do not save and restore the register @var{reg}.
15207
15208 It is an error to use this flag with the frame pointer or stack pointer.
15209 Use of this flag for other registers that have fixed pervasive roles in
15210 the machine's execution model produces disastrous results.
15211
15212 This flag does not have a negative form, because it specifies a
15213 three-way choice.
15214
15215 @item -fcall-saved-@var{reg}
15216 @opindex fcall-saved
15217 Treat the register named @var{reg} as an allocable register saved by
15218 functions. It may be allocated even for temporaries or variables that
15219 live across a call. Functions compiled this way save and restore
15220 the register @var{reg} if they use it.
15221
15222 It is an error to use this flag with the frame pointer or stack pointer.
15223 Use of this flag for other registers that have fixed pervasive roles in
15224 the machine's execution model produces disastrous results.
15225
15226 A different sort of disaster results from the use of this flag for
15227 a register in which function values may be returned.
15228
15229 This flag does not have a negative form, because it specifies a
15230 three-way choice.
15231
15232 @item -fpack-struct[=@var{n}]
15233 @opindex fpack-struct
15234 Without a value specified, pack all structure members together without
15235 holes. When a value is specified (which must be a small power of two), pack
15236 structure members according to this value, representing the maximum
15237 alignment (that is, objects with default alignment requirements larger than
15238 this are output potentially unaligned at the next fitting location.
15239
15240 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15241 code that is not binary compatible with code generated without that switch.
15242 Additionally, it makes the code suboptimal.
15243 Use it to conform to a non-default application binary interface.
15244
15245 @item -fleading-underscore
15246 @opindex fleading-underscore
15247 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15248 change the way C symbols are represented in the object file. One use
15249 is to help link with legacy assembly code.
15250
15251 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15252 generate code that is not binary compatible with code generated without that
15253 switch. Use it to conform to a non-default application binary interface.
15254 Not all targets provide complete support for this switch.
15255
15256 @item -ftls-model=@var{model}
15257 @opindex ftls-model
15258 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15259 The @var{model} argument should be one of @samp{global-dynamic},
15260 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15261 Note that the choice is subject to optimization: the compiler may use
15262 a more efficient model for symbols not visible outside of the translation
15263 unit, or if @option{-fpic} is not given on the command line.
15264
15265 The default without @option{-fpic} is @samp{initial-exec}; with
15266 @option{-fpic} the default is @samp{global-dynamic}.
15267
15268 @item -ftrampolines
15269 @opindex ftrampolines
15270 For targets that normally need trampolines for nested functions, always
15271 generate them instead of using descriptors. Otherwise, for targets that
15272 do not need them, like for example HP-PA or IA-64, do nothing.
15273
15274 A trampoline is a small piece of code that is created at run time on the
15275 stack when the address of a nested function is taken, and is used to call
15276 the nested function indirectly. Therefore, it requires the stack to be
15277 made executable in order for the program to work properly.
15278
15279 @option{-fno-trampolines} is enabled by default on a language by language
15280 basis to let the compiler avoid generating them, if it computes that this
15281 is safe, and replace them with descriptors. Descriptors are made up of data
15282 only, but the generated code must be prepared to deal with them. As of this
15283 writing, @option{-fno-trampolines} is enabled by default only for Ada.
15284
15285 Moreover, code compiled with @option{-ftrampolines} and code compiled with
15286 @option{-fno-trampolines} are not binary compatible if nested functions are
15287 present. This option must therefore be used on a program-wide basis and be
15288 manipulated with extreme care.
15289
15290 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15291 @opindex fvisibility
15292 Set the default ELF image symbol visibility to the specified option---all
15293 symbols are marked with this unless overridden within the code.
15294 Using this feature can very substantially improve linking and
15295 load times of shared object libraries, produce more optimized
15296 code, provide near-perfect API export and prevent symbol clashes.
15297 It is @strong{strongly} recommended that you use this in any shared objects
15298 you distribute.
15299
15300 Despite the nomenclature, @samp{default} always means public; i.e.,
15301 available to be linked against from outside the shared object.
15302 @samp{protected} and @samp{internal} are pretty useless in real-world
15303 usage so the only other commonly used option is @samp{hidden}.
15304 The default if @option{-fvisibility} isn't specified is
15305 @samp{default}, i.e., make every symbol public.
15306
15307 A good explanation of the benefits offered by ensuring ELF
15308 symbols have the correct visibility is given by ``How To Write
15309 Shared Libraries'' by Ulrich Drepper (which can be found at
15310 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15311 solution made possible by this option to marking things hidden when
15312 the default is public is to make the default hidden and mark things
15313 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15314 and @code{__attribute__ ((visibility("default")))} instead of
15315 @code{__declspec(dllexport)} you get almost identical semantics with
15316 identical syntax. This is a great boon to those working with
15317 cross-platform projects.
15318
15319 For those adding visibility support to existing code, you may find
15320 @code{#pragma GCC visibility} of use. This works by you enclosing
15321 the declarations you wish to set visibility for with (for example)
15322 @code{#pragma GCC visibility push(hidden)} and
15323 @code{#pragma GCC visibility pop}.
15324 Bear in mind that symbol visibility should be viewed @strong{as
15325 part of the API interface contract} and thus all new code should
15326 always specify visibility when it is not the default; i.e., declarations
15327 only for use within the local DSO should @strong{always} be marked explicitly
15328 as hidden as so to avoid PLT indirection overheads---making this
15329 abundantly clear also aids readability and self-documentation of the code.
15330 Note that due to ISO C++ specification requirements, @code{operator new} and
15331 @code{operator delete} must always be of default visibility.
15332
15333 Be aware that headers from outside your project, in particular system
15334 headers and headers from any other library you use, may not be
15335 expecting to be compiled with visibility other than the default. You
15336 may need to explicitly say @code{#pragma GCC visibility push(default)}
15337 before including any such headers.
15338
15339 @code{extern} declarations are not affected by @option{-fvisibility}, so
15340 a lot of code can be recompiled with @option{-fvisibility=hidden} with
15341 no modifications. However, this means that calls to @code{extern}
15342 functions with no explicit visibility use the PLT, so it is more
15343 effective to use @code{__attribute ((visibility))} and/or
15344 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
15345 declarations should be treated as hidden.
15346
15347 Note that @option{-fvisibility} does affect C++ vague linkage
15348 entities. This means that, for instance, an exception class that is
15349 be thrown between DSOs must be explicitly marked with default
15350 visibility so that the @samp{type_info} nodes are unified between
15351 the DSOs.
15352
15353 An overview of these techniques, their benefits and how to use them
15354 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15355
15356 @item -fstrict-volatile-bitfields
15357 @opindex fstrict-volatile-bitfields
15358 This option should be used if accesses to volatile bit-fields (or other
15359 structure fields, although the compiler usually honors those types
15360 anyway) should use a single access of the width of the
15361 field's type, aligned to a natural alignment if possible. For
15362 example, targets with memory-mapped peripheral registers might require
15363 all such accesses to be 16 bits wide; with this flag you can
15364 declare all peripheral bit-fields as @code{unsigned short} (assuming short
15365 is 16 bits on these targets) to force GCC to use 16-bit accesses
15366 instead of, perhaps, a more efficient 32-bit access.
15367
15368 If this option is disabled, the compiler uses the most efficient
15369 instruction. In the previous example, that might be a 32-bit load
15370 instruction, even though that accesses bytes that do not contain
15371 any portion of the bit-field, or memory-mapped registers unrelated to
15372 the one being updated.
15373
15374 In some cases, such as when the @code{packed} attribute is applied to a
15375 structure field, it may not be possible to access the field with a single
15376 read or write that is correctly aligned for the target machine. In this
15377 case GCC falls back to generating multiple accesses rather than code that
15378 will fault or truncate the result at run time.
15379
15380 Note: Due to restrictions of the C/C++11 memory model, write accesses are
15381 not allowed to touch non bit-field members. It is therefore recommended
15382 to define all bits of the field's type as bit-field members.
15383
15384 The default value of this option is determined by the application binary
15385 interface for the target processor.
15386
15387 @item -fsync-libcalls
15388 @opindex fsync-libcalls
15389 This option controls whether any out-of-line instance of the @code{__sync}
15390 family of functions may be used to implement the C++11 @code{__atomic}
15391 family of functions.
15392
15393 The default value of this option is enabled, thus the only useful form
15394 of the option is @option{-fno-sync-libcalls}. This option is used in
15395 the implementation of the @file{libatomic} runtime library.
15396
15397 @end table
15398
15399 @node Developer Options
15400 @section GCC Developer Options
15401 @cindex developer options
15402 @cindex debugging GCC
15403 @cindex debug dump options
15404 @cindex dump options
15405 @cindex compilation statistics
15406
15407 This section describes command-line options that are primarily of
15408 interest to GCC developers, including options to support compiler
15409 testing and investigation of compiler bugs and compile-time
15410 performance problems. This includes options that produce debug dumps
15411 at various points in the compilation; that print statistics such as
15412 memory use and execution time; and that print information about GCC's
15413 configuration, such as where it searches for libraries. You should
15414 rarely need to use any of these options for ordinary compilation and
15415 linking tasks.
15416
15417 Many developer options that cause GCC to dump output to a file take an
15418 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15419 or @samp{-} to dump to standard output, and @samp{stderr} for standard
15420 error.
15421
15422 If @samp{=@var{filename}} is omitted, a default dump file name is
15423 constructed by concatenating the base dump file name, a pass number,
15424 phase letter, and pass name. The base dump file name is the name of
15425 output file produced by the compiler if explicitly specified and not
15426 an executable; otherwise it is the source file name.
15427 The pass number is determined by the order passes are registered with
15428 the compiler's pass manager.
15429 This is generally the same as the order of execution, but passes
15430 registered by plugins, target-specific passes, or passes that are
15431 otherwise registered late are numbered higher than the pass named
15432 @samp{final}, even if they are executed earlier. The phase letter is
15433 one of @samp{i} (inter-procedural analysis), @samp{l}
15434 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
15435 The files are created in the directory of the output file.
15436
15437 @table @gcctabopt
15438
15439 @item -fcallgraph-info
15440 @itemx -fcallgraph-info=@var{MARKERS}
15441 @opindex fcallgraph-info
15442 Makes the compiler output callgraph information for the program, on a
15443 per-object-file basis. The information is generated in the common VCG
15444 format. It can be decorated with additional, per-node and/or per-edge
15445 information, if a list of comma-separated markers is additionally
15446 specified. When the @code{su} marker is specified, the callgraph is
15447 decorated with stack usage information; it is equivalent to
15448 @option{-fstack-usage}. When the @code{da} marker is specified, the
15449 callgraph is decorated with information about dynamically allocated
15450 objects.
15451
15452 When compiling with @option{-flto}, no callgraph information is output
15453 along with the object file. At LTO link time, @option{-fcallgraph-info}
15454 may generate multiple callgraph information files next to intermediate
15455 LTO output files.
15456
15457 @item -d@var{letters}
15458 @itemx -fdump-rtl-@var{pass}
15459 @itemx -fdump-rtl-@var{pass}=@var{filename}
15460 @opindex d
15461 @opindex fdump-rtl-@var{pass}
15462 Says to make debugging dumps during compilation at times specified by
15463 @var{letters}. This is used for debugging the RTL-based passes of the
15464 compiler.
15465
15466 Some @option{-d@var{letters}} switches have different meaning when
15467 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
15468 for information about preprocessor-specific dump options.
15469
15470 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15471 @option{-d} option @var{letters}. Here are the possible
15472 letters for use in @var{pass} and @var{letters}, and their meanings:
15473
15474 @table @gcctabopt
15475
15476 @item -fdump-rtl-alignments
15477 @opindex fdump-rtl-alignments
15478 Dump after branch alignments have been computed.
15479
15480 @item -fdump-rtl-asmcons
15481 @opindex fdump-rtl-asmcons
15482 Dump after fixing rtl statements that have unsatisfied in/out constraints.
15483
15484 @item -fdump-rtl-auto_inc_dec
15485 @opindex fdump-rtl-auto_inc_dec
15486 Dump after auto-inc-dec discovery. This pass is only run on
15487 architectures that have auto inc or auto dec instructions.
15488
15489 @item -fdump-rtl-barriers
15490 @opindex fdump-rtl-barriers
15491 Dump after cleaning up the barrier instructions.
15492
15493 @item -fdump-rtl-bbpart
15494 @opindex fdump-rtl-bbpart
15495 Dump after partitioning hot and cold basic blocks.
15496
15497 @item -fdump-rtl-bbro
15498 @opindex fdump-rtl-bbro
15499 Dump after block reordering.
15500
15501 @item -fdump-rtl-btl1
15502 @itemx -fdump-rtl-btl2
15503 @opindex fdump-rtl-btl2
15504 @opindex fdump-rtl-btl2
15505 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15506 after the two branch
15507 target load optimization passes.
15508
15509 @item -fdump-rtl-bypass
15510 @opindex fdump-rtl-bypass
15511 Dump after jump bypassing and control flow optimizations.
15512
15513 @item -fdump-rtl-combine
15514 @opindex fdump-rtl-combine
15515 Dump after the RTL instruction combination pass.
15516
15517 @item -fdump-rtl-compgotos
15518 @opindex fdump-rtl-compgotos
15519 Dump after duplicating the computed gotos.
15520
15521 @item -fdump-rtl-ce1
15522 @itemx -fdump-rtl-ce2
15523 @itemx -fdump-rtl-ce3
15524 @opindex fdump-rtl-ce1
15525 @opindex fdump-rtl-ce2
15526 @opindex fdump-rtl-ce3
15527 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15528 @option{-fdump-rtl-ce3} enable dumping after the three
15529 if conversion passes.
15530
15531 @item -fdump-rtl-cprop_hardreg
15532 @opindex fdump-rtl-cprop_hardreg
15533 Dump after hard register copy propagation.
15534
15535 @item -fdump-rtl-csa
15536 @opindex fdump-rtl-csa
15537 Dump after combining stack adjustments.
15538
15539 @item -fdump-rtl-cse1
15540 @itemx -fdump-rtl-cse2
15541 @opindex fdump-rtl-cse1
15542 @opindex fdump-rtl-cse2
15543 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
15544 the two common subexpression elimination passes.
15545
15546 @item -fdump-rtl-dce
15547 @opindex fdump-rtl-dce
15548 Dump after the standalone dead code elimination passes.
15549
15550 @item -fdump-rtl-dbr
15551 @opindex fdump-rtl-dbr
15552 Dump after delayed branch scheduling.
15553
15554 @item -fdump-rtl-dce1
15555 @itemx -fdump-rtl-dce2
15556 @opindex fdump-rtl-dce1
15557 @opindex fdump-rtl-dce2
15558 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
15559 the two dead store elimination passes.
15560
15561 @item -fdump-rtl-eh
15562 @opindex fdump-rtl-eh
15563 Dump after finalization of EH handling code.
15564
15565 @item -fdump-rtl-eh_ranges
15566 @opindex fdump-rtl-eh_ranges
15567 Dump after conversion of EH handling range regions.
15568
15569 @item -fdump-rtl-expand
15570 @opindex fdump-rtl-expand
15571 Dump after RTL generation.
15572
15573 @item -fdump-rtl-fwprop1
15574 @itemx -fdump-rtl-fwprop2
15575 @opindex fdump-rtl-fwprop1
15576 @opindex fdump-rtl-fwprop2
15577 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
15578 dumping after the two forward propagation passes.
15579
15580 @item -fdump-rtl-gcse1
15581 @itemx -fdump-rtl-gcse2
15582 @opindex fdump-rtl-gcse1
15583 @opindex fdump-rtl-gcse2
15584 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
15585 after global common subexpression elimination.
15586
15587 @item -fdump-rtl-init-regs
15588 @opindex fdump-rtl-init-regs
15589 Dump after the initialization of the registers.
15590
15591 @item -fdump-rtl-initvals
15592 @opindex fdump-rtl-initvals
15593 Dump after the computation of the initial value sets.
15594
15595 @item -fdump-rtl-into_cfglayout
15596 @opindex fdump-rtl-into_cfglayout
15597 Dump after converting to cfglayout mode.
15598
15599 @item -fdump-rtl-ira
15600 @opindex fdump-rtl-ira
15601 Dump after iterated register allocation.
15602
15603 @item -fdump-rtl-jump
15604 @opindex fdump-rtl-jump
15605 Dump after the second jump optimization.
15606
15607 @item -fdump-rtl-loop2
15608 @opindex fdump-rtl-loop2
15609 @option{-fdump-rtl-loop2} enables dumping after the rtl
15610 loop optimization passes.
15611
15612 @item -fdump-rtl-mach
15613 @opindex fdump-rtl-mach
15614 Dump after performing the machine dependent reorganization pass, if that
15615 pass exists.
15616
15617 @item -fdump-rtl-mode_sw
15618 @opindex fdump-rtl-mode_sw
15619 Dump after removing redundant mode switches.
15620
15621 @item -fdump-rtl-rnreg
15622 @opindex fdump-rtl-rnreg
15623 Dump after register renumbering.
15624
15625 @item -fdump-rtl-outof_cfglayout
15626 @opindex fdump-rtl-outof_cfglayout
15627 Dump after converting from cfglayout mode.
15628
15629 @item -fdump-rtl-peephole2
15630 @opindex fdump-rtl-peephole2
15631 Dump after the peephole pass.
15632
15633 @item -fdump-rtl-postreload
15634 @opindex fdump-rtl-postreload
15635 Dump after post-reload optimizations.
15636
15637 @item -fdump-rtl-pro_and_epilogue
15638 @opindex fdump-rtl-pro_and_epilogue
15639 Dump after generating the function prologues and epilogues.
15640
15641 @item -fdump-rtl-sched1
15642 @itemx -fdump-rtl-sched2
15643 @opindex fdump-rtl-sched1
15644 @opindex fdump-rtl-sched2
15645 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
15646 after the basic block scheduling passes.
15647
15648 @item -fdump-rtl-ree
15649 @opindex fdump-rtl-ree
15650 Dump after sign/zero extension elimination.
15651
15652 @item -fdump-rtl-seqabstr
15653 @opindex fdump-rtl-seqabstr
15654 Dump after common sequence discovery.
15655
15656 @item -fdump-rtl-shorten
15657 @opindex fdump-rtl-shorten
15658 Dump after shortening branches.
15659
15660 @item -fdump-rtl-sibling
15661 @opindex fdump-rtl-sibling
15662 Dump after sibling call optimizations.
15663
15664 @item -fdump-rtl-split1
15665 @itemx -fdump-rtl-split2
15666 @itemx -fdump-rtl-split3
15667 @itemx -fdump-rtl-split4
15668 @itemx -fdump-rtl-split5
15669 @opindex fdump-rtl-split1
15670 @opindex fdump-rtl-split2
15671 @opindex fdump-rtl-split3
15672 @opindex fdump-rtl-split4
15673 @opindex fdump-rtl-split5
15674 These options enable dumping after five rounds of
15675 instruction splitting.
15676
15677 @item -fdump-rtl-sms
15678 @opindex fdump-rtl-sms
15679 Dump after modulo scheduling. This pass is only run on some
15680 architectures.
15681
15682 @item -fdump-rtl-stack
15683 @opindex fdump-rtl-stack
15684 Dump after conversion from GCC's ``flat register file'' registers to the
15685 x87's stack-like registers. This pass is only run on x86 variants.
15686
15687 @item -fdump-rtl-subreg1
15688 @itemx -fdump-rtl-subreg2
15689 @opindex fdump-rtl-subreg1
15690 @opindex fdump-rtl-subreg2
15691 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
15692 the two subreg expansion passes.
15693
15694 @item -fdump-rtl-unshare
15695 @opindex fdump-rtl-unshare
15696 Dump after all rtl has been unshared.
15697
15698 @item -fdump-rtl-vartrack
15699 @opindex fdump-rtl-vartrack
15700 Dump after variable tracking.
15701
15702 @item -fdump-rtl-vregs
15703 @opindex fdump-rtl-vregs
15704 Dump after converting virtual registers to hard registers.
15705
15706 @item -fdump-rtl-web
15707 @opindex fdump-rtl-web
15708 Dump after live range splitting.
15709
15710 @item -fdump-rtl-regclass
15711 @itemx -fdump-rtl-subregs_of_mode_init
15712 @itemx -fdump-rtl-subregs_of_mode_finish
15713 @itemx -fdump-rtl-dfinit
15714 @itemx -fdump-rtl-dfinish
15715 @opindex fdump-rtl-regclass
15716 @opindex fdump-rtl-subregs_of_mode_init
15717 @opindex fdump-rtl-subregs_of_mode_finish
15718 @opindex fdump-rtl-dfinit
15719 @opindex fdump-rtl-dfinish
15720 These dumps are defined but always produce empty files.
15721
15722 @item -da
15723 @itemx -fdump-rtl-all
15724 @opindex da
15725 @opindex fdump-rtl-all
15726 Produce all the dumps listed above.
15727
15728 @item -dA
15729 @opindex dA
15730 Annotate the assembler output with miscellaneous debugging information.
15731
15732 @item -dD
15733 @opindex dD
15734 Dump all macro definitions, at the end of preprocessing, in addition to
15735 normal output.
15736
15737 @item -dH
15738 @opindex dH
15739 Produce a core dump whenever an error occurs.
15740
15741 @item -dp
15742 @opindex dp
15743 Annotate the assembler output with a comment indicating which
15744 pattern and alternative is used. The length and cost of each instruction are
15745 also printed.
15746
15747 @item -dP
15748 @opindex dP
15749 Dump the RTL in the assembler output as a comment before each instruction.
15750 Also turns on @option{-dp} annotation.
15751
15752 @item -dx
15753 @opindex dx
15754 Just generate RTL for a function instead of compiling it. Usually used
15755 with @option{-fdump-rtl-expand}.
15756 @end table
15757
15758 @item -fdump-debug
15759 @opindex fdump-debug
15760 Dump debugging information generated during the debug
15761 generation phase.
15762
15763 @item -fdump-earlydebug
15764 @opindex fdump-earlydebug
15765 Dump debugging information generated during the early debug
15766 generation phase.
15767
15768 @item -fdump-noaddr
15769 @opindex fdump-noaddr
15770 When doing debugging dumps, suppress address output. This makes it more
15771 feasible to use diff on debugging dumps for compiler invocations with
15772 different compiler binaries and/or different
15773 text / bss / data / heap / stack / dso start locations.
15774
15775 @item -freport-bug
15776 @opindex freport-bug
15777 Collect and dump debug information into a temporary file if an
15778 internal compiler error (ICE) occurs.
15779
15780 @item -fdump-unnumbered
15781 @opindex fdump-unnumbered
15782 When doing debugging dumps, suppress instruction numbers and address output.
15783 This makes it more feasible to use diff on debugging dumps for compiler
15784 invocations with different options, in particular with and without
15785 @option{-g}.
15786
15787 @item -fdump-unnumbered-links
15788 @opindex fdump-unnumbered-links
15789 When doing debugging dumps (see @option{-d} option above), suppress
15790 instruction numbers for the links to the previous and next instructions
15791 in a sequence.
15792
15793 @item -fdump-ipa-@var{switch}
15794 @itemx -fdump-ipa-@var{switch}-@var{options}
15795 @opindex fdump-ipa
15796 Control the dumping at various stages of inter-procedural analysis
15797 language tree to a file. The file name is generated by appending a
15798 switch specific suffix to the source file name, and the file is created
15799 in the same directory as the output file. The following dumps are
15800 possible:
15801
15802 @table @samp
15803 @item all
15804 Enables all inter-procedural analysis dumps.
15805
15806 @item cgraph
15807 Dumps information about call-graph optimization, unused function removal,
15808 and inlining decisions.
15809
15810 @item inline
15811 Dump after function inlining.
15812
15813 @end table
15814
15815 Additionally, the options @option{-optimized}, @option{-missed},
15816 @option{-note}, and @option{-all} can be provided, with the same meaning
15817 as for @option{-fopt-info}, defaulting to @option{-optimized}.
15818
15819 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
15820 information on callsites that were inlined, along with callsites
15821 that were not inlined.
15822
15823 By default, the dump will contain messages about successful
15824 optimizations (equivalent to @option{-optimized}) together with
15825 low-level details about the analysis.
15826
15827 @item -fdump-lang-all
15828 @itemx -fdump-lang-@var{switch}
15829 @itemx -fdump-lang-@var{switch}-@var{options}
15830 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
15831 @opindex fdump-lang-all
15832 @opindex fdump-lang
15833 Control the dumping of language-specific information. The @var{options}
15834 and @var{filename} portions behave as described in the
15835 @option{-fdump-tree} option. The following @var{switch} values are
15836 accepted:
15837
15838 @table @samp
15839 @item all
15840
15841 Enable all language-specific dumps.
15842
15843 @item class
15844 Dump class hierarchy information. Virtual table information is emitted
15845 unless '@option{slim}' is specified. This option is applicable to C++ only.
15846
15847 @item raw
15848 Dump the raw internal tree data. This option is applicable to C++ only.
15849
15850 @end table
15851
15852 @item -fdump-passes
15853 @opindex fdump-passes
15854 Print on @file{stderr} the list of optimization passes that are turned
15855 on and off by the current command-line options.
15856
15857 @item -fdump-statistics-@var{option}
15858 @opindex fdump-statistics
15859 Enable and control dumping of pass statistics in a separate file. The
15860 file name is generated by appending a suffix ending in
15861 @samp{.statistics} to the source file name, and the file is created in
15862 the same directory as the output file. If the @samp{-@var{option}}
15863 form is used, @samp{-stats} causes counters to be summed over the
15864 whole compilation unit while @samp{-details} dumps every event as
15865 the passes generate them. The default with no option is to sum
15866 counters for each function compiled.
15867
15868 @item -fdump-tree-all
15869 @itemx -fdump-tree-@var{switch}
15870 @itemx -fdump-tree-@var{switch}-@var{options}
15871 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15872 @opindex fdump-tree-all
15873 @opindex fdump-tree
15874 Control the dumping at various stages of processing the intermediate
15875 language tree to a file. If the @samp{-@var{options}}
15876 form is used, @var{options} is a list of @samp{-} separated options
15877 which control the details of the dump. Not all options are applicable
15878 to all dumps; those that are not meaningful are ignored. The
15879 following options are available
15880
15881 @table @samp
15882 @item address
15883 Print the address of each node. Usually this is not meaningful as it
15884 changes according to the environment and source file. Its primary use
15885 is for tying up a dump file with a debug environment.
15886 @item asmname
15887 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15888 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
15889 use working backward from mangled names in the assembly file.
15890 @item slim
15891 When dumping front-end intermediate representations, inhibit dumping
15892 of members of a scope or body of a function merely because that scope
15893 has been reached. Only dump such items when they are directly reachable
15894 by some other path.
15895
15896 When dumping pretty-printed trees, this option inhibits dumping the
15897 bodies of control structures.
15898
15899 When dumping RTL, print the RTL in slim (condensed) form instead of
15900 the default LISP-like representation.
15901 @item raw
15902 Print a raw representation of the tree. By default, trees are
15903 pretty-printed into a C-like representation.
15904 @item details
15905 Enable more detailed dumps (not honored by every dump option). Also
15906 include information from the optimization passes.
15907 @item stats
15908 Enable dumping various statistics about the pass (not honored by every dump
15909 option).
15910 @item blocks
15911 Enable showing basic block boundaries (disabled in raw dumps).
15912 @item graph
15913 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15914 dump a representation of the control flow graph suitable for viewing with
15915 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
15916 the file is pretty-printed as a subgraph, so that GraphViz can render them
15917 all in a single plot.
15918
15919 This option currently only works for RTL dumps, and the RTL is always
15920 dumped in slim form.
15921 @item vops
15922 Enable showing virtual operands for every statement.
15923 @item lineno
15924 Enable showing line numbers for statements.
15925 @item uid
15926 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15927 @item verbose
15928 Enable showing the tree dump for each statement.
15929 @item eh
15930 Enable showing the EH region number holding each statement.
15931 @item scev
15932 Enable showing scalar evolution analysis details.
15933 @item optimized
15934 Enable showing optimization information (only available in certain
15935 passes).
15936 @item missed
15937 Enable showing missed optimization information (only available in certain
15938 passes).
15939 @item note
15940 Enable other detailed optimization information (only available in
15941 certain passes).
15942 @item all
15943 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15944 and @option{lineno}.
15945 @item optall
15946 Turn on all optimization options, i.e., @option{optimized},
15947 @option{missed}, and @option{note}.
15948 @end table
15949
15950 To determine what tree dumps are available or find the dump for a pass
15951 of interest follow the steps below.
15952
15953 @enumerate
15954 @item
15955 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15956 look for a code that corresponds to the pass you are interested in.
15957 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15958 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15959 The number at the end distinguishes distinct invocations of the same pass.
15960 @item
15961 To enable the creation of the dump file, append the pass code to
15962 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15963 to enable the dump from the Early Value Range Propagation pass, invoke
15964 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15965 specify the name of the dump file. If you don't specify one, GCC
15966 creates as described below.
15967 @item
15968 Find the pass dump in a file whose name is composed of three components
15969 separated by a period: the name of the source file GCC was invoked to
15970 compile, a numeric suffix indicating the pass number followed by the
15971 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15972 and finally the pass code. For example, the Early VRP pass dump might
15973 be in a file named @file{myfile.c.038t.evrp} in the current working
15974 directory. Note that the numeric codes are not stable and may change
15975 from one version of GCC to another.
15976 @end enumerate
15977
15978 @item -fopt-info
15979 @itemx -fopt-info-@var{options}
15980 @itemx -fopt-info-@var{options}=@var{filename}
15981 @opindex fopt-info
15982 Controls optimization dumps from various optimization passes. If the
15983 @samp{-@var{options}} form is used, @var{options} is a list of
15984 @samp{-} separated option keywords to select the dump details and
15985 optimizations.
15986
15987 The @var{options} can be divided into three groups:
15988 @enumerate
15989 @item
15990 options describing what kinds of messages should be emitted,
15991 @item
15992 options describing the verbosity of the dump, and
15993 @item
15994 options describing which optimizations should be included.
15995 @end enumerate
15996 The options from each group can be freely mixed as they are
15997 non-overlapping. However, in case of any conflicts,
15998 the later options override the earlier options on the command
15999 line.
16000
16001 The following options control which kinds of messages should be emitted:
16002
16003 @table @samp
16004 @item optimized
16005 Print information when an optimization is successfully applied. It is
16006 up to a pass to decide which information is relevant. For example, the
16007 vectorizer passes print the source location of loops which are
16008 successfully vectorized.
16009 @item missed
16010 Print information about missed optimizations. Individual passes
16011 control which information to include in the output.
16012 @item note
16013 Print verbose information about optimizations, such as certain
16014 transformations, more detailed messages about decisions etc.
16015 @item all
16016 Print detailed optimization information. This includes
16017 @samp{optimized}, @samp{missed}, and @samp{note}.
16018 @end table
16019
16020 The following option controls the dump verbosity:
16021
16022 @table @samp
16023 @item internals
16024 By default, only ``high-level'' messages are emitted. This option enables
16025 additional, more detailed, messages, which are likely to only be of interest
16026 to GCC developers.
16027 @end table
16028
16029 One or more of the following option keywords can be used to describe a
16030 group of optimizations:
16031
16032 @table @samp
16033 @item ipa
16034 Enable dumps from all interprocedural optimizations.
16035 @item loop
16036 Enable dumps from all loop optimizations.
16037 @item inline
16038 Enable dumps from all inlining optimizations.
16039 @item omp
16040 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
16041 @item vec
16042 Enable dumps from all vectorization optimizations.
16043 @item optall
16044 Enable dumps from all optimizations. This is a superset of
16045 the optimization groups listed above.
16046 @end table
16047
16048 If @var{options} is
16049 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
16050 about successful optimizations from all the passes, omitting messages
16051 that are treated as ``internals''.
16052
16053 If the @var{filename} is provided, then the dumps from all the
16054 applicable optimizations are concatenated into the @var{filename}.
16055 Otherwise the dump is output onto @file{stderr}. Though multiple
16056 @option{-fopt-info} options are accepted, only one of them can include
16057 a @var{filename}. If other filenames are provided then all but the
16058 first such option are ignored.
16059
16060 Note that the output @var{filename} is overwritten
16061 in case of multiple translation units. If a combined output from
16062 multiple translation units is desired, @file{stderr} should be used
16063 instead.
16064
16065 In the following example, the optimization info is output to
16066 @file{stderr}:
16067
16068 @smallexample
16069 gcc -O3 -fopt-info
16070 @end smallexample
16071
16072 This example:
16073 @smallexample
16074 gcc -O3 -fopt-info-missed=missed.all
16075 @end smallexample
16076
16077 @noindent
16078 outputs missed optimization report from all the passes into
16079 @file{missed.all}, and this one:
16080
16081 @smallexample
16082 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16083 @end smallexample
16084
16085 @noindent
16086 prints information about missed optimization opportunities from
16087 vectorization passes on @file{stderr}.
16088 Note that @option{-fopt-info-vec-missed} is equivalent to
16089 @option{-fopt-info-missed-vec}. The order of the optimization group
16090 names and message types listed after @option{-fopt-info} does not matter.
16091
16092 As another example,
16093 @smallexample
16094 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16095 @end smallexample
16096
16097 @noindent
16098 outputs information about missed optimizations as well as
16099 optimized locations from all the inlining passes into
16100 @file{inline.txt}.
16101
16102 Finally, consider:
16103
16104 @smallexample
16105 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16106 @end smallexample
16107
16108 @noindent
16109 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
16110 in conflict since only one output file is allowed. In this case, only
16111 the first option takes effect and the subsequent options are
16112 ignored. Thus only @file{vec.miss} is produced which contains
16113 dumps from the vectorizer about missed opportunities.
16114
16115 @item -fsave-optimization-record
16116 @opindex fsave-optimization-record
16117 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
16118 were performed, for those optimizations that support @option{-fopt-info}.
16119
16120 This option is experimental and the format of the data within the
16121 compressed JSON file is subject to change.
16122
16123 It is roughly equivalent to a machine-readable version of
16124 @option{-fopt-info-all}, as a collection of messages with source file,
16125 line number and column number, with the following additional data for
16126 each message:
16127
16128 @itemize @bullet
16129
16130 @item
16131 the execution count of the code being optimized, along with metadata about
16132 whether this was from actual profile data, or just an estimate, allowing
16133 consumers to prioritize messages by code hotness,
16134
16135 @item
16136 the function name of the code being optimized, where applicable,
16137
16138 @item
16139 the ``inlining chain'' for the code being optimized, so that when
16140 a function is inlined into several different places (which might
16141 themselves be inlined), the reader can distinguish between the copies,
16142
16143 @item
16144 objects identifying those parts of the message that refer to expressions,
16145 statements or symbol-table nodes, which of these categories they are, and,
16146 when available, their source code location,
16147
16148 @item
16149 the GCC pass that emitted the message, and
16150
16151 @item
16152 the location in GCC's own code from which the message was emitted
16153
16154 @end itemize
16155
16156 Additionally, some messages are logically nested within other
16157 messages, reflecting implementation details of the optimization
16158 passes.
16159
16160 @item -fsched-verbose=@var{n}
16161 @opindex fsched-verbose
16162 On targets that use instruction scheduling, this option controls the
16163 amount of debugging output the scheduler prints to the dump files.
16164
16165 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16166 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16167 For @var{n} greater than one, it also output basic block probabilities,
16168 detailed ready list information and unit/insn info. For @var{n} greater
16169 than two, it includes RTL at abort point, control-flow and regions info.
16170 And for @var{n} over four, @option{-fsched-verbose} also includes
16171 dependence info.
16172
16173
16174
16175 @item -fenable-@var{kind}-@var{pass}
16176 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16177 @opindex fdisable-
16178 @opindex fenable-
16179
16180 This is a set of options that are used to explicitly disable/enable
16181 optimization passes. These options are intended for use for debugging GCC.
16182 Compiler users should use regular options for enabling/disabling
16183 passes instead.
16184
16185 @table @gcctabopt
16186
16187 @item -fdisable-ipa-@var{pass}
16188 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16189 statically invoked in the compiler multiple times, the pass name should be
16190 appended with a sequential number starting from 1.
16191
16192 @item -fdisable-rtl-@var{pass}
16193 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
16194 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
16195 statically invoked in the compiler multiple times, the pass name should be
16196 appended with a sequential number starting from 1. @var{range-list} is a
16197 comma-separated list of function ranges or assembler names. Each range is a number
16198 pair separated by a colon. The range is inclusive in both ends. If the range
16199 is trivial, the number pair can be simplified as a single number. If the
16200 function's call graph node's @var{uid} falls within one of the specified ranges,
16201 the @var{pass} is disabled for that function. The @var{uid} is shown in the
16202 function header of a dump file, and the pass names can be dumped by using
16203 option @option{-fdump-passes}.
16204
16205 @item -fdisable-tree-@var{pass}
16206 @itemx -fdisable-tree-@var{pass}=@var{range-list}
16207 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
16208 option arguments.
16209
16210 @item -fenable-ipa-@var{pass}
16211 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16212 statically invoked in the compiler multiple times, the pass name should be
16213 appended with a sequential number starting from 1.
16214
16215 @item -fenable-rtl-@var{pass}
16216 @itemx -fenable-rtl-@var{pass}=@var{range-list}
16217 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
16218 description and examples.
16219
16220 @item -fenable-tree-@var{pass}
16221 @itemx -fenable-tree-@var{pass}=@var{range-list}
16222 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
16223 of option arguments.
16224
16225 @end table
16226
16227 Here are some examples showing uses of these options.
16228
16229 @smallexample
16230
16231 # disable ccp1 for all functions
16232 -fdisable-tree-ccp1
16233 # disable complete unroll for function whose cgraph node uid is 1
16234 -fenable-tree-cunroll=1
16235 # disable gcse2 for functions at the following ranges [1,1],
16236 # [300,400], and [400,1000]
16237 # disable gcse2 for functions foo and foo2
16238 -fdisable-rtl-gcse2=foo,foo2
16239 # disable early inlining
16240 -fdisable-tree-einline
16241 # disable ipa inlining
16242 -fdisable-ipa-inline
16243 # enable tree full unroll
16244 -fenable-tree-unroll
16245
16246 @end smallexample
16247
16248 @item -fchecking
16249 @itemx -fchecking=@var{n}
16250 @opindex fchecking
16251 @opindex fno-checking
16252 Enable internal consistency checking. The default depends on
16253 the compiler configuration. @option{-fchecking=2} enables further
16254 internal consistency checking that might affect code generation.
16255
16256 @item -frandom-seed=@var{string}
16257 @opindex frandom-seed
16258 This option provides a seed that GCC uses in place of
16259 random numbers in generating certain symbol names
16260 that have to be different in every compiled file. It is also used to
16261 place unique stamps in coverage data files and the object files that
16262 produce them. You can use the @option{-frandom-seed} option to produce
16263 reproducibly identical object files.
16264
16265 The @var{string} can either be a number (decimal, octal or hex) or an
16266 arbitrary string (in which case it's converted to a number by
16267 computing CRC32).
16268
16269 The @var{string} should be different for every file you compile.
16270
16271 @item -save-temps
16272 @itemx -save-temps=cwd
16273 @opindex save-temps
16274 Store the usual ``temporary'' intermediate files permanently; place them
16275 in the current directory and name them based on the source file. Thus,
16276 compiling @file{foo.c} with @option{-c -save-temps} produces files
16277 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
16278 preprocessed @file{foo.i} output file even though the compiler now
16279 normally uses an integrated preprocessor.
16280
16281 When used in combination with the @option{-x} command-line option,
16282 @option{-save-temps} is sensible enough to avoid over writing an
16283 input source file with the same extension as an intermediate file.
16284 The corresponding intermediate file may be obtained by renaming the
16285 source file before using @option{-save-temps}.
16286
16287 If you invoke GCC in parallel, compiling several different source
16288 files that share a common base name in different subdirectories or the
16289 same source file compiled for multiple output destinations, it is
16290 likely that the different parallel compilers will interfere with each
16291 other, and overwrite the temporary files. For instance:
16292
16293 @smallexample
16294 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
16295 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
16296 @end smallexample
16297
16298 may result in @file{foo.i} and @file{foo.o} being written to
16299 simultaneously by both compilers.
16300
16301 @item -save-temps=obj
16302 @opindex save-temps=obj
16303 Store the usual ``temporary'' intermediate files permanently. If the
16304 @option{-o} option is used, the temporary files are based on the
16305 object file. If the @option{-o} option is not used, the
16306 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
16307
16308 For example:
16309
16310 @smallexample
16311 gcc -save-temps=obj -c foo.c
16312 gcc -save-temps=obj -c bar.c -o dir/xbar.o
16313 gcc -save-temps=obj foobar.c -o dir2/yfoobar
16314 @end smallexample
16315
16316 @noindent
16317 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
16318 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
16319 @file{dir2/yfoobar.o}.
16320
16321 @item -time@r{[}=@var{file}@r{]}
16322 @opindex time
16323 Report the CPU time taken by each subprocess in the compilation
16324 sequence. For C source files, this is the compiler proper and assembler
16325 (plus the linker if linking is done).
16326
16327 Without the specification of an output file, the output looks like this:
16328
16329 @smallexample
16330 # cc1 0.12 0.01
16331 # as 0.00 0.01
16332 @end smallexample
16333
16334 The first number on each line is the ``user time'', that is time spent
16335 executing the program itself. The second number is ``system time'',
16336 time spent executing operating system routines on behalf of the program.
16337 Both numbers are in seconds.
16338
16339 With the specification of an output file, the output is appended to the
16340 named file, and it looks like this:
16341
16342 @smallexample
16343 0.12 0.01 cc1 @var{options}
16344 0.00 0.01 as @var{options}
16345 @end smallexample
16346
16347 The ``user time'' and the ``system time'' are moved before the program
16348 name, and the options passed to the program are displayed, so that one
16349 can later tell what file was being compiled, and with which options.
16350
16351 @item -fdump-final-insns@r{[}=@var{file}@r{]}
16352 @opindex fdump-final-insns
16353 Dump the final internal representation (RTL) to @var{file}. If the
16354 optional argument is omitted (or if @var{file} is @code{.}), the name
16355 of the dump file is determined by appending @code{.gkd} to the
16356 compilation output file name.
16357
16358 @item -fcompare-debug@r{[}=@var{opts}@r{]}
16359 @opindex fcompare-debug
16360 @opindex fno-compare-debug
16361 If no error occurs during compilation, run the compiler a second time,
16362 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16363 passed to the second compilation. Dump the final internal
16364 representation in both compilations, and print an error if they differ.
16365
16366 If the equal sign is omitted, the default @option{-gtoggle} is used.
16367
16368 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16369 and nonzero, implicitly enables @option{-fcompare-debug}. If
16370 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16371 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16372 is used.
16373
16374 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
16375 is equivalent to @option{-fno-compare-debug}, which disables the dumping
16376 of the final representation and the second compilation, preventing even
16377 @env{GCC_COMPARE_DEBUG} from taking effect.
16378
16379 To verify full coverage during @option{-fcompare-debug} testing, set
16380 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16381 which GCC rejects as an invalid option in any actual compilation
16382 (rather than preprocessing, assembly or linking). To get just a
16383 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16384 not overridden} will do.
16385
16386 @item -fcompare-debug-second
16387 @opindex fcompare-debug-second
16388 This option is implicitly passed to the compiler for the second
16389 compilation requested by @option{-fcompare-debug}, along with options to
16390 silence warnings, and omitting other options that would cause the compiler
16391 to produce output to files or to standard output as a side effect. Dump
16392 files and preserved temporary files are renamed so as to contain the
16393 @code{.gk} additional extension during the second compilation, to avoid
16394 overwriting those generated by the first.
16395
16396 When this option is passed to the compiler driver, it causes the
16397 @emph{first} compilation to be skipped, which makes it useful for little
16398 other than debugging the compiler proper.
16399
16400 @item -gtoggle
16401 @opindex gtoggle
16402 Turn off generation of debug info, if leaving out this option
16403 generates it, or turn it on at level 2 otherwise. The position of this
16404 argument in the command line does not matter; it takes effect after all
16405 other options are processed, and it does so only once, no matter how
16406 many times it is given. This is mainly intended to be used with
16407 @option{-fcompare-debug}.
16408
16409 @item -fvar-tracking-assignments-toggle
16410 @opindex fvar-tracking-assignments-toggle
16411 @opindex fno-var-tracking-assignments-toggle
16412 Toggle @option{-fvar-tracking-assignments}, in the same way that
16413 @option{-gtoggle} toggles @option{-g}.
16414
16415 @item -Q
16416 @opindex Q
16417 Makes the compiler print out each function name as it is compiled, and
16418 print some statistics about each pass when it finishes.
16419
16420 @item -ftime-report
16421 @opindex ftime-report
16422 Makes the compiler print some statistics about the time consumed by each
16423 pass when it finishes.
16424
16425 @item -ftime-report-details
16426 @opindex ftime-report-details
16427 Record the time consumed by infrastructure parts separately for each pass.
16428
16429 @item -fira-verbose=@var{n}
16430 @opindex fira-verbose
16431 Control the verbosity of the dump file for the integrated register allocator.
16432 The default value is 5. If the value @var{n} is greater or equal to 10,
16433 the dump output is sent to stderr using the same format as @var{n} minus 10.
16434
16435 @item -flto-report
16436 @opindex flto-report
16437 Prints a report with internal details on the workings of the link-time
16438 optimizer. The contents of this report vary from version to version.
16439 It is meant to be useful to GCC developers when processing object
16440 files in LTO mode (via @option{-flto}).
16441
16442 Disabled by default.
16443
16444 @item -flto-report-wpa
16445 @opindex flto-report-wpa
16446 Like @option{-flto-report}, but only print for the WPA phase of link-time
16447 optimization.
16448
16449 @item -fmem-report
16450 @opindex fmem-report
16451 Makes the compiler print some statistics about permanent memory
16452 allocation when it finishes.
16453
16454 @item -fmem-report-wpa
16455 @opindex fmem-report-wpa
16456 Makes the compiler print some statistics about permanent memory
16457 allocation for the WPA phase only.
16458
16459 @item -fpre-ipa-mem-report
16460 @opindex fpre-ipa-mem-report
16461 @item -fpost-ipa-mem-report
16462 @opindex fpost-ipa-mem-report
16463 Makes the compiler print some statistics about permanent memory
16464 allocation before or after interprocedural optimization.
16465
16466 @item -fprofile-report
16467 @opindex fprofile-report
16468 Makes the compiler print some statistics about consistency of the
16469 (estimated) profile and effect of individual passes.
16470
16471 @item -fstack-usage
16472 @opindex fstack-usage
16473 Makes the compiler output stack usage information for the program, on a
16474 per-function basis. The filename for the dump is made by appending
16475 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
16476 the output file, if explicitly specified and it is not an executable,
16477 otherwise it is the basename of the source file. An entry is made up
16478 of three fields:
16479
16480 @itemize
16481 @item
16482 The name of the function.
16483 @item
16484 A number of bytes.
16485 @item
16486 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16487 @end itemize
16488
16489 The qualifier @code{static} means that the function manipulates the stack
16490 statically: a fixed number of bytes are allocated for the frame on function
16491 entry and released on function exit; no stack adjustments are otherwise made
16492 in the function. The second field is this fixed number of bytes.
16493
16494 The qualifier @code{dynamic} means that the function manipulates the stack
16495 dynamically: in addition to the static allocation described above, stack
16496 adjustments are made in the body of the function, for example to push/pop
16497 arguments around function calls. If the qualifier @code{bounded} is also
16498 present, the amount of these adjustments is bounded at compile time and
16499 the second field is an upper bound of the total amount of stack used by
16500 the function. If it is not present, the amount of these adjustments is
16501 not bounded at compile time and the second field only represents the
16502 bounded part.
16503
16504 @item -fstats
16505 @opindex fstats
16506 Emit statistics about front-end processing at the end of the compilation.
16507 This option is supported only by the C++ front end, and
16508 the information is generally only useful to the G++ development team.
16509
16510 @item -fdbg-cnt-list
16511 @opindex fdbg-cnt-list
16512 Print the name and the counter upper bound for all debug counters.
16513
16514
16515 @item -fdbg-cnt=@var{counter-value-list}
16516 @opindex fdbg-cnt
16517 Set the internal debug counter lower and upper bound. @var{counter-value-list}
16518 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16519 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16520 the name of the counter and list of closed intervals.
16521 The @var{lower_bound} is optional and is zero
16522 initialized if not set.
16523 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16524 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16525 eleventh invocation.
16526 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16527
16528 @item -print-file-name=@var{library}
16529 @opindex print-file-name
16530 Print the full absolute name of the library file @var{library} that
16531 would be used when linking---and don't do anything else. With this
16532 option, GCC does not compile or link anything; it just prints the
16533 file name.
16534
16535 @item -print-multi-directory
16536 @opindex print-multi-directory
16537 Print the directory name corresponding to the multilib selected by any
16538 other switches present in the command line. This directory is supposed
16539 to exist in @env{GCC_EXEC_PREFIX}.
16540
16541 @item -print-multi-lib
16542 @opindex print-multi-lib
16543 Print the mapping from multilib directory names to compiler switches
16544 that enable them. The directory name is separated from the switches by
16545 @samp{;}, and each switch starts with an @samp{@@} instead of the
16546 @samp{-}, without spaces between multiple switches. This is supposed to
16547 ease shell processing.
16548
16549 @item -print-multi-os-directory
16550 @opindex print-multi-os-directory
16551 Print the path to OS libraries for the selected
16552 multilib, relative to some @file{lib} subdirectory. If OS libraries are
16553 present in the @file{lib} subdirectory and no multilibs are used, this is
16554 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16555 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16556 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16557 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16558
16559 @item -print-multiarch
16560 @opindex print-multiarch
16561 Print the path to OS libraries for the selected multiarch,
16562 relative to some @file{lib} subdirectory.
16563
16564 @item -print-prog-name=@var{program}
16565 @opindex print-prog-name
16566 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
16567
16568 @item -print-libgcc-file-name
16569 @opindex print-libgcc-file-name
16570 Same as @option{-print-file-name=libgcc.a}.
16571
16572 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
16573 but you do want to link with @file{libgcc.a}. You can do:
16574
16575 @smallexample
16576 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
16577 @end smallexample
16578
16579 @item -print-search-dirs
16580 @opindex print-search-dirs
16581 Print the name of the configured installation directory and a list of
16582 program and library directories @command{gcc} searches---and don't do anything else.
16583
16584 This is useful when @command{gcc} prints the error message
16585 @samp{installation problem, cannot exec cpp0: No such file or directory}.
16586 To resolve this you either need to put @file{cpp0} and the other compiler
16587 components where @command{gcc} expects to find them, or you can set the environment
16588 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
16589 Don't forget the trailing @samp{/}.
16590 @xref{Environment Variables}.
16591
16592 @item -print-sysroot
16593 @opindex print-sysroot
16594 Print the target sysroot directory that is used during
16595 compilation. This is the target sysroot specified either at configure
16596 time or using the @option{--sysroot} option, possibly with an extra
16597 suffix that depends on compilation options. If no target sysroot is
16598 specified, the option prints nothing.
16599
16600 @item -print-sysroot-headers-suffix
16601 @opindex print-sysroot-headers-suffix
16602 Print the suffix added to the target sysroot when searching for
16603 headers, or give an error if the compiler is not configured with such
16604 a suffix---and don't do anything else.
16605
16606 @item -dumpmachine
16607 @opindex dumpmachine
16608 Print the compiler's target machine (for example,
16609 @samp{i686-pc-linux-gnu})---and don't do anything else.
16610
16611 @item -dumpversion
16612 @opindex dumpversion
16613 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
16614 anything else. This is the compiler version used in filesystem paths and
16615 specs. Depending on how the compiler has been configured it can be just
16616 a single number (major version), two numbers separated by a dot (major and
16617 minor version) or three numbers separated by dots (major, minor and patchlevel
16618 version).
16619
16620 @item -dumpfullversion
16621 @opindex dumpfullversion
16622 Print the full compiler version---and don't do anything else. The output is
16623 always three numbers separated by dots, major, minor and patchlevel version.
16624
16625 @item -dumpspecs
16626 @opindex dumpspecs
16627 Print the compiler's built-in specs---and don't do anything else. (This
16628 is used when GCC itself is being built.) @xref{Spec Files}.
16629 @end table
16630
16631 @node Submodel Options
16632 @section Machine-Dependent Options
16633 @cindex submodel options
16634 @cindex specifying hardware config
16635 @cindex hardware models and configurations, specifying
16636 @cindex target-dependent options
16637 @cindex machine-dependent options
16638
16639 Each target machine supported by GCC can have its own options---for
16640 example, to allow you to compile for a particular processor variant or
16641 ABI, or to control optimizations specific to that machine. By
16642 convention, the names of machine-specific options start with
16643 @samp{-m}.
16644
16645 Some configurations of the compiler also support additional target-specific
16646 options, usually for compatibility with other compilers on the same
16647 platform.
16648
16649 @c This list is ordered alphanumerically by subsection name.
16650 @c It should be the same order and spelling as these options are listed
16651 @c in Machine Dependent Options
16652
16653 @menu
16654 * AArch64 Options::
16655 * Adapteva Epiphany Options::
16656 * AMD GCN Options::
16657 * ARC Options::
16658 * ARM Options::
16659 * AVR Options::
16660 * Blackfin Options::
16661 * C6X Options::
16662 * CRIS Options::
16663 * CR16 Options::
16664 * C-SKY Options::
16665 * Darwin Options::
16666 * DEC Alpha Options::
16667 * eBPF Options::
16668 * FR30 Options::
16669 * FT32 Options::
16670 * FRV Options::
16671 * GNU/Linux Options::
16672 * H8/300 Options::
16673 * HPPA Options::
16674 * IA-64 Options::
16675 * LM32 Options::
16676 * M32C Options::
16677 * M32R/D Options::
16678 * M680x0 Options::
16679 * MCore Options::
16680 * MeP Options::
16681 * MicroBlaze Options::
16682 * MIPS Options::
16683 * MMIX Options::
16684 * MN10300 Options::
16685 * Moxie Options::
16686 * MSP430 Options::
16687 * NDS32 Options::
16688 * Nios II Options::
16689 * Nvidia PTX Options::
16690 * OpenRISC Options::
16691 * PDP-11 Options::
16692 * picoChip Options::
16693 * PowerPC Options::
16694 * PRU Options::
16695 * RISC-V Options::
16696 * RL78 Options::
16697 * RS/6000 and PowerPC Options::
16698 * RX Options::
16699 * S/390 and zSeries Options::
16700 * Score Options::
16701 * SH Options::
16702 * Solaris 2 Options::
16703 * SPARC Options::
16704 * System V Options::
16705 * TILE-Gx Options::
16706 * TILEPro Options::
16707 * V850 Options::
16708 * VAX Options::
16709 * Visium Options::
16710 * VMS Options::
16711 * VxWorks Options::
16712 * x86 Options::
16713 * x86 Windows Options::
16714 * Xstormy16 Options::
16715 * Xtensa Options::
16716 * zSeries Options::
16717 @end menu
16718
16719 @node AArch64 Options
16720 @subsection AArch64 Options
16721 @cindex AArch64 Options
16722
16723 These options are defined for AArch64 implementations:
16724
16725 @table @gcctabopt
16726
16727 @item -mabi=@var{name}
16728 @opindex mabi
16729 Generate code for the specified data model. Permissible values
16730 are @samp{ilp32} for SysV-like data model where int, long int and pointers
16731 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
16732 but long int and pointers are 64 bits.
16733
16734 The default depends on the specific target configuration. Note that
16735 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
16736 entire program with the same ABI, and link with a compatible set of libraries.
16737
16738 @item -mbig-endian
16739 @opindex mbig-endian
16740 Generate big-endian code. This is the default when GCC is configured for an
16741 @samp{aarch64_be-*-*} target.
16742
16743 @item -mgeneral-regs-only
16744 @opindex mgeneral-regs-only
16745 Generate code which uses only the general-purpose registers. This will prevent
16746 the compiler from using floating-point and Advanced SIMD registers but will not
16747 impose any restrictions on the assembler.
16748
16749 @item -mlittle-endian
16750 @opindex mlittle-endian
16751 Generate little-endian code. This is the default when GCC is configured for an
16752 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
16753
16754 @item -mcmodel=tiny
16755 @opindex mcmodel=tiny
16756 Generate code for the tiny code model. The program and its statically defined
16757 symbols must be within 1MB of each other. Programs can be statically or
16758 dynamically linked.
16759
16760 @item -mcmodel=small
16761 @opindex mcmodel=small
16762 Generate code for the small code model. The program and its statically defined
16763 symbols must be within 4GB of each other. Programs can be statically or
16764 dynamically linked. This is the default code model.
16765
16766 @item -mcmodel=large
16767 @opindex mcmodel=large
16768 Generate code for the large code model. This makes no assumptions about
16769 addresses and sizes of sections. Programs can be statically linked only. The
16770 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
16771 @option{-fpic} and @option{-fPIC}.
16772
16773 @item -mstrict-align
16774 @itemx -mno-strict-align
16775 @opindex mstrict-align
16776 @opindex mno-strict-align
16777 Avoid or allow generating memory accesses that may not be aligned on a natural
16778 object boundary as described in the architecture specification.
16779
16780 @item -momit-leaf-frame-pointer
16781 @itemx -mno-omit-leaf-frame-pointer
16782 @opindex momit-leaf-frame-pointer
16783 @opindex mno-omit-leaf-frame-pointer
16784 Omit or keep the frame pointer in leaf functions. The former behavior is the
16785 default.
16786
16787 @item -mstack-protector-guard=@var{guard}
16788 @itemx -mstack-protector-guard-reg=@var{reg}
16789 @itemx -mstack-protector-guard-offset=@var{offset}
16790 @opindex mstack-protector-guard
16791 @opindex mstack-protector-guard-reg
16792 @opindex mstack-protector-guard-offset
16793 Generate stack protection code using canary at @var{guard}. Supported
16794 locations are @samp{global} for a global canary or @samp{sysreg} for a
16795 canary in an appropriate system register.
16796
16797 With the latter choice the options
16798 @option{-mstack-protector-guard-reg=@var{reg}} and
16799 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16800 which system register to use as base register for reading the canary,
16801 and from what offset from that base register. There is no default
16802 register or offset as this is entirely for use within the Linux
16803 kernel.
16804
16805 @item -mstack-protector-guard=@var{guard}
16806 @itemx -mstack-protector-guard-reg=@var{reg}
16807 @itemx -mstack-protector-guard-offset=@var{offset}
16808 @opindex mstack-protector-guard
16809 @opindex mstack-protector-guard-reg
16810 @opindex mstack-protector-guard-offset
16811 Generate stack protection code using canary at @var{guard}. Supported
16812 locations are @samp{global} for a global canary or @samp{sysreg} for a
16813 canary in an appropriate system register.
16814
16815 With the latter choice the options
16816 @option{-mstack-protector-guard-reg=@var{reg}} and
16817 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16818 which system register to use as base register for reading the canary,
16819 and from what offset from that base register. There is no default
16820 register or offset as this is entirely for use within the Linux
16821 kernel.
16822
16823 @item -mtls-dialect=desc
16824 @opindex mtls-dialect=desc
16825 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
16826 of TLS variables. This is the default.
16827
16828 @item -mtls-dialect=traditional
16829 @opindex mtls-dialect=traditional
16830 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
16831 of TLS variables.
16832
16833 @item -mtls-size=@var{size}
16834 @opindex mtls-size
16835 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
16836 This option requires binutils 2.26 or newer.
16837
16838 @item -mfix-cortex-a53-835769
16839 @itemx -mno-fix-cortex-a53-835769
16840 @opindex mfix-cortex-a53-835769
16841 @opindex mno-fix-cortex-a53-835769
16842 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
16843 This involves inserting a NOP instruction between memory instructions and
16844 64-bit integer multiply-accumulate instructions.
16845
16846 @item -mfix-cortex-a53-843419
16847 @itemx -mno-fix-cortex-a53-843419
16848 @opindex mfix-cortex-a53-843419
16849 @opindex mno-fix-cortex-a53-843419
16850 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
16851 This erratum workaround is made at link time and this will only pass the
16852 corresponding flag to the linker.
16853
16854 @item -mlow-precision-recip-sqrt
16855 @itemx -mno-low-precision-recip-sqrt
16856 @opindex mlow-precision-recip-sqrt
16857 @opindex mno-low-precision-recip-sqrt
16858 Enable or disable the reciprocal square root approximation.
16859 This option only has an effect if @option{-ffast-math} or
16860 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16861 precision of reciprocal square root results to about 16 bits for
16862 single precision and to 32 bits for double precision.
16863
16864 @item -mlow-precision-sqrt
16865 @itemx -mno-low-precision-sqrt
16866 @opindex mlow-precision-sqrt
16867 @opindex mno-low-precision-sqrt
16868 Enable or disable the square root approximation.
16869 This option only has an effect if @option{-ffast-math} or
16870 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16871 precision of square root results to about 16 bits for
16872 single precision and to 32 bits for double precision.
16873 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16874
16875 @item -mlow-precision-div
16876 @itemx -mno-low-precision-div
16877 @opindex mlow-precision-div
16878 @opindex mno-low-precision-div
16879 Enable or disable the division approximation.
16880 This option only has an effect if @option{-ffast-math} or
16881 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16882 precision of division results to about 16 bits for
16883 single precision and to 32 bits for double precision.
16884
16885 @item -mtrack-speculation
16886 @itemx -mno-track-speculation
16887 Enable or disable generation of additional code to track speculative
16888 execution through conditional branches. The tracking state can then
16889 be used by the compiler when expanding calls to
16890 @code{__builtin_speculation_safe_copy} to permit a more efficient code
16891 sequence to be generated.
16892
16893 @item -moutline-atomics
16894 @itemx -mno-outline-atomics
16895 Enable or disable calls to out-of-line helpers to implement atomic operations.
16896 These helpers will, at runtime, determine if the LSE instructions from
16897 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16898 instructions that are present in the base ARMv8.0 ISA.
16899
16900 This option is only applicable when compiling for the base ARMv8.0
16901 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
16902 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16903 used directly. The same applies when using @option{-mcpu=} when the
16904 selected cpu supports the @samp{lse} feature.
16905 This option is on by default.
16906
16907 @item -march=@var{name}
16908 @opindex march
16909 Specify the name of the target architecture and, optionally, one or
16910 more feature modifiers. This option has the form
16911 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16912
16913 The table below summarizes the permissible values for @var{arch}
16914 and the features that they enable by default:
16915
16916 @multitable @columnfractions 0.20 0.20 0.60
16917 @headitem @var{arch} value @tab Architecture @tab Includes by default
16918 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
16919 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
16920 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
16921 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
16922 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
16923 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
16924 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
16925 @end multitable
16926
16927 The value @samp{native} is available on native AArch64 GNU/Linux and
16928 causes the compiler to pick the architecture of the host system. This
16929 option has no effect if the compiler is unable to recognize the
16930 architecture of the host system,
16931
16932 The permissible values for @var{feature} are listed in the sub-section
16933 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16934 Feature Modifiers}. Where conflicting feature modifiers are
16935 specified, the right-most feature is used.
16936
16937 GCC uses @var{name} to determine what kind of instructions it can emit
16938 when generating assembly code. If @option{-march} is specified
16939 without either of @option{-mtune} or @option{-mcpu} also being
16940 specified, the code is tuned to perform well across a range of target
16941 processors implementing the target architecture.
16942
16943 @item -mtune=@var{name}
16944 @opindex mtune
16945 Specify the name of the target processor for which GCC should tune the
16946 performance of the code. Permissible values for this option are:
16947 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16948 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16949 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16950 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16951 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16952 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16953 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16954 @samp{octeontx81}, @samp{octeontx83},
16955 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
16956 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
16957 @samp{octeontx2f95mm}
16958 @samp{thunderx}, @samp{thunderxt88},
16959 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16960 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110},
16961 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16962 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16963 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16964 @samp{native}.
16965
16966 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16967 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16968 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16969 should tune for a big.LITTLE system.
16970
16971 Additionally on native AArch64 GNU/Linux systems the value
16972 @samp{native} tunes performance to the host system. This option has no effect
16973 if the compiler is unable to recognize the processor of the host system.
16974
16975 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16976 are specified, the code is tuned to perform well across a range
16977 of target processors.
16978
16979 This option cannot be suffixed by feature modifiers.
16980
16981 @item -mcpu=@var{name}
16982 @opindex mcpu
16983 Specify the name of the target processor, optionally suffixed by one
16984 or more feature modifiers. This option has the form
16985 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16986 the permissible values for @var{cpu} are the same as those available
16987 for @option{-mtune}. The permissible values for @var{feature} are
16988 documented in the sub-section on
16989 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16990 Feature Modifiers}. Where conflicting feature modifiers are
16991 specified, the right-most feature is used.
16992
16993 GCC uses @var{name} to determine what kind of instructions it can emit when
16994 generating assembly code (as if by @option{-march}) and to determine
16995 the target processor for which to tune for performance (as if
16996 by @option{-mtune}). Where this option is used in conjunction
16997 with @option{-march} or @option{-mtune}, those options take precedence
16998 over the appropriate part of this option.
16999
17000 @item -moverride=@var{string}
17001 @opindex moverride
17002 Override tuning decisions made by the back-end in response to a
17003 @option{-mtune=} switch. The syntax, semantics, and accepted values
17004 for @var{string} in this option are not guaranteed to be consistent
17005 across releases.
17006
17007 This option is only intended to be useful when developing GCC.
17008
17009 @item -mverbose-cost-dump
17010 @opindex mverbose-cost-dump
17011 Enable verbose cost model dumping in the debug dump files. This option is
17012 provided for use in debugging the compiler.
17013
17014 @item -mpc-relative-literal-loads
17015 @itemx -mno-pc-relative-literal-loads
17016 @opindex mpc-relative-literal-loads
17017 @opindex mno-pc-relative-literal-loads
17018 Enable or disable PC-relative literal loads. With this option literal pools are
17019 accessed using a single instruction and emitted after each function. This
17020 limits the maximum size of functions to 1MB. This is enabled by default for
17021 @option{-mcmodel=tiny}.
17022
17023 @item -msign-return-address=@var{scope}
17024 @opindex msign-return-address
17025 Select the function scope on which return address signing will be applied.
17026 Permissible values are @samp{none}, which disables return address signing,
17027 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
17028 functions, and @samp{all}, which enables pointer signing for all functions. The
17029 default value is @samp{none}. This option has been deprecated by
17030 -mbranch-protection.
17031
17032 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
17033 @opindex mbranch-protection
17034 Select the branch protection features to use.
17035 @samp{none} is the default and turns off all types of branch protection.
17036 @samp{standard} turns on all types of branch protection features. If a feature
17037 has additional tuning options, then @samp{standard} sets it to its standard
17038 level.
17039 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
17040 level: signing functions that save the return address to memory (non-leaf
17041 functions will practically always do this) using the a-key. The optional
17042 argument @samp{leaf} can be used to extend the signing to include leaf
17043 functions. The optional argument @samp{b-key} can be used to sign the functions
17044 with the B-key instead of the A-key.
17045 @samp{bti} turns on branch target identification mechanism.
17046
17047 @item -msve-vector-bits=@var{bits}
17048 @opindex msve-vector-bits
17049 Specify the number of bits in an SVE vector register. This option only has
17050 an effect when SVE is enabled.
17051
17052 GCC supports two forms of SVE code generation: ``vector-length
17053 agnostic'' output that works with any size of vector register and
17054 ``vector-length specific'' output that allows GCC to make assumptions
17055 about the vector length when it is useful for optimization reasons.
17056 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
17057 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
17058 Specifying @samp{scalable} selects vector-length agnostic
17059 output. At present @samp{-msve-vector-bits=128} also generates vector-length
17060 agnostic output for big-endian targets. All other values generate
17061 vector-length specific code. The behavior of these values may change
17062 in future releases and no value except @samp{scalable} should be
17063 relied on for producing code that is portable across different
17064 hardware SVE vector lengths.
17065
17066 The default is @samp{-msve-vector-bits=scalable}, which produces
17067 vector-length agnostic code.
17068 @end table
17069
17070 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
17071 @anchor{aarch64-feature-modifiers}
17072 @cindex @option{-march} feature modifiers
17073 @cindex @option{-mcpu} feature modifiers
17074 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
17075 the following and their inverses @option{no@var{feature}}:
17076
17077 @table @samp
17078 @item crc
17079 Enable CRC extension. This is on by default for
17080 @option{-march=armv8.1-a}.
17081 @item crypto
17082 Enable Crypto extension. This also enables Advanced SIMD and floating-point
17083 instructions.
17084 @item fp
17085 Enable floating-point instructions. This is on by default for all possible
17086 values for options @option{-march} and @option{-mcpu}.
17087 @item simd
17088 Enable Advanced SIMD instructions. This also enables floating-point
17089 instructions. This is on by default for all possible values for options
17090 @option{-march} and @option{-mcpu}.
17091 @item sve
17092 Enable Scalable Vector Extension instructions. This also enables Advanced
17093 SIMD and floating-point instructions.
17094 @item lse
17095 Enable Large System Extension instructions. This is on by default for
17096 @option{-march=armv8.1-a}.
17097 @item rdma
17098 Enable Round Double Multiply Accumulate instructions. This is on by default
17099 for @option{-march=armv8.1-a}.
17100 @item fp16
17101 Enable FP16 extension. This also enables floating-point instructions.
17102 @item fp16fml
17103 Enable FP16 fmla extension. This also enables FP16 extensions and
17104 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.
17105
17106 @item rcpc
17107 Enable the RcPc extension. This does not change code generation from GCC,
17108 but is passed on to the assembler, enabling inline asm statements to use
17109 instructions from the RcPc extension.
17110 @item dotprod
17111 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17112 @item aes
17113 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
17114 SIMD instructions.
17115 @item sha2
17116 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
17117 @item sha3
17118 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
17119 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
17120 @item sm4
17121 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
17122 Use of this option with architectures prior to Armv8.2-A is not supported.
17123 @item profile
17124 Enable the Statistical Profiling extension. This option is only to enable the
17125 extension at the assembler level and does not affect code generation.
17126 @item rng
17127 Enable the Armv8.5-a Random Number instructions. This option is only to
17128 enable the extension at the assembler level and does not affect code
17129 generation.
17130 @item memtag
17131 Enable the Armv8.5-a Memory Tagging Extensions.
17132 Use of this option with architectures prior to Armv8.5-A is not supported.
17133 @item sb
17134 Enable the Armv8-a Speculation Barrier instruction. This option is only to
17135 enable the extension at the assembler level and does not affect code
17136 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17137 @item ssbs
17138 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
17139 is only to enable the extension at the assembler level and does not affect code
17140 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17141 @item predres
17142 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17143 This option is only to enable the extension at the assembler level and does
17144 not affect code generation. This option is enabled by default for
17145 @option{-march=armv8.5-a}.
17146 @item sve2
17147 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
17148 instructions.
17149 @item sve2-bitperm
17150 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
17151 @item sve2-sm4
17152 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17153 @item sve2-aes
17154 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17155 @item sve2-sha3
17156 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
17157 @item tme
17158 Enable the Transactional Memory Extension.
17159 @item i8mm
17160 Enable 8-bit Integer Matrix Multiply instructions. This also enables
17161 Advanced SIMD and floating-point instructions. This option is enabled by
17162 default for @option{-march=armv8.6-a}. Use of this option with architectures
17163 prior to Armv8.2-A is not supported.
17164 @item f32mm
17165 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
17166 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17167 not supported.
17168 @item f64mm
17169 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
17170 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17171 not supported.
17172 @item bf16
17173 Enable brain half-precision floating-point instructions. This also enables
17174 Advanced SIMD and floating-point instructions. This option is enabled by
17175 default for @option{-march=armv8.6-a}. Use of this option with architectures
17176 prior to Armv8.2-A is not supported.
17177
17178 @end table
17179
17180 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17181 which implies @option{fp}.
17182 Conversely, @option{nofp} implies @option{nosimd}, which implies
17183 @option{nocrypto}, @option{noaes} and @option{nosha2}.
17184
17185 @node Adapteva Epiphany Options
17186 @subsection Adapteva Epiphany Options
17187
17188 These @samp{-m} options are defined for Adapteva Epiphany:
17189
17190 @table @gcctabopt
17191 @item -mhalf-reg-file
17192 @opindex mhalf-reg-file
17193 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17194 That allows code to run on hardware variants that lack these registers.
17195
17196 @item -mprefer-short-insn-regs
17197 @opindex mprefer-short-insn-regs
17198 Preferentially allocate registers that allow short instruction generation.
17199 This can result in increased instruction count, so this may either reduce or
17200 increase overall code size.
17201
17202 @item -mbranch-cost=@var{num}
17203 @opindex mbranch-cost
17204 Set the cost of branches to roughly @var{num} ``simple'' instructions.
17205 This cost is only a heuristic and is not guaranteed to produce
17206 consistent results across releases.
17207
17208 @item -mcmove
17209 @opindex mcmove
17210 Enable the generation of conditional moves.
17211
17212 @item -mnops=@var{num}
17213 @opindex mnops
17214 Emit @var{num} NOPs before every other generated instruction.
17215
17216 @item -mno-soft-cmpsf
17217 @opindex mno-soft-cmpsf
17218 @opindex msoft-cmpsf
17219 For single-precision floating-point comparisons, emit an @code{fsub} instruction
17220 and test the flags. This is faster than a software comparison, but can
17221 get incorrect results in the presence of NaNs, or when two different small
17222 numbers are compared such that their difference is calculated as zero.
17223 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17224 software comparisons.
17225
17226 @item -mstack-offset=@var{num}
17227 @opindex mstack-offset
17228 Set the offset between the top of the stack and the stack pointer.
17229 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17230 can be used by leaf functions without stack allocation.
17231 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17232 Note also that this option changes the ABI; compiling a program with a
17233 different stack offset than the libraries have been compiled with
17234 generally does not work.
17235 This option can be useful if you want to evaluate if a different stack
17236 offset would give you better code, but to actually use a different stack
17237 offset to build working programs, it is recommended to configure the
17238 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17239
17240 @item -mno-round-nearest
17241 @opindex mno-round-nearest
17242 @opindex mround-nearest
17243 Make the scheduler assume that the rounding mode has been set to
17244 truncating. The default is @option{-mround-nearest}.
17245
17246 @item -mlong-calls
17247 @opindex mlong-calls
17248 If not otherwise specified by an attribute, assume all calls might be beyond
17249 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17250 function address into a register before performing a (otherwise direct) call.
17251 This is the default.
17252
17253 @item -mshort-calls
17254 @opindex short-calls
17255 If not otherwise specified by an attribute, assume all direct calls are
17256 in the range of the @code{b} / @code{bl} instructions, so use these instructions
17257 for direct calls. The default is @option{-mlong-calls}.
17258
17259 @item -msmall16
17260 @opindex msmall16
17261 Assume addresses can be loaded as 16-bit unsigned values. This does not
17262 apply to function addresses for which @option{-mlong-calls} semantics
17263 are in effect.
17264
17265 @item -mfp-mode=@var{mode}
17266 @opindex mfp-mode
17267 Set the prevailing mode of the floating-point unit.
17268 This determines the floating-point mode that is provided and expected
17269 at function call and return time. Making this mode match the mode you
17270 predominantly need at function start can make your programs smaller and
17271 faster by avoiding unnecessary mode switches.
17272
17273 @var{mode} can be set to one the following values:
17274
17275 @table @samp
17276 @item caller
17277 Any mode at function entry is valid, and retained or restored when
17278 the function returns, and when it calls other functions.
17279 This mode is useful for compiling libraries or other compilation units
17280 you might want to incorporate into different programs with different
17281 prevailing FPU modes, and the convenience of being able to use a single
17282 object file outweighs the size and speed overhead for any extra
17283 mode switching that might be needed, compared with what would be needed
17284 with a more specific choice of prevailing FPU mode.
17285
17286 @item truncate
17287 This is the mode used for floating-point calculations with
17288 truncating (i.e.@: round towards zero) rounding mode. That includes
17289 conversion from floating point to integer.
17290
17291 @item round-nearest
17292 This is the mode used for floating-point calculations with
17293 round-to-nearest-or-even rounding mode.
17294
17295 @item int
17296 This is the mode used to perform integer calculations in the FPU, e.g.@:
17297 integer multiply, or integer multiply-and-accumulate.
17298 @end table
17299
17300 The default is @option{-mfp-mode=caller}
17301
17302 @item -mno-split-lohi
17303 @itemx -mno-postinc
17304 @itemx -mno-postmodify
17305 @opindex mno-split-lohi
17306 @opindex msplit-lohi
17307 @opindex mno-postinc
17308 @opindex mpostinc
17309 @opindex mno-postmodify
17310 @opindex mpostmodify
17311 Code generation tweaks that disable, respectively, splitting of 32-bit
17312 loads, generation of post-increment addresses, and generation of
17313 post-modify addresses. The defaults are @option{msplit-lohi},
17314 @option{-mpost-inc}, and @option{-mpost-modify}.
17315
17316 @item -mnovect-double
17317 @opindex mno-vect-double
17318 @opindex mvect-double
17319 Change the preferred SIMD mode to SImode. The default is
17320 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
17321
17322 @item -max-vect-align=@var{num}
17323 @opindex max-vect-align
17324 The maximum alignment for SIMD vector mode types.
17325 @var{num} may be 4 or 8. The default is 8.
17326 Note that this is an ABI change, even though many library function
17327 interfaces are unaffected if they don't use SIMD vector modes
17328 in places that affect size and/or alignment of relevant types.
17329
17330 @item -msplit-vecmove-early
17331 @opindex msplit-vecmove-early
17332 Split vector moves into single word moves before reload. In theory this
17333 can give better register allocation, but so far the reverse seems to be
17334 generally the case.
17335
17336 @item -m1reg-@var{reg}
17337 @opindex m1reg-
17338 Specify a register to hold the constant @minus{}1, which makes loading small negative
17339 constants and certain bitmasks faster.
17340 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17341 which specify use of that register as a fixed register,
17342 and @samp{none}, which means that no register is used for this
17343 purpose. The default is @option{-m1reg-none}.
17344
17345 @end table
17346
17347 @node AMD GCN Options
17348 @subsection AMD GCN Options
17349 @cindex AMD GCN Options
17350
17351 These options are defined specifically for the AMD GCN port.
17352
17353 @table @gcctabopt
17354
17355 @item -march=@var{gpu}
17356 @opindex march
17357 @itemx -mtune=@var{gpu}
17358 @opindex mtune
17359 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17360 are
17361
17362 @table @samp
17363 @opindex fiji
17364 @item fiji
17365 Compile for GCN3 Fiji devices (gfx803).
17366
17367 @item gfx900
17368 Compile for GCN5 Vega 10 devices (gfx900).
17369
17370 @item gfx906
17371 Compile for GCN5 Vega 20 devices (gfx906).
17372
17373 @end table
17374
17375 @item -mstack-size=@var{bytes}
17376 @opindex mstack-size
17377 Specify how many @var{bytes} of stack space will be requested for each GPU
17378 thread (wave-front). Beware that there may be many threads and limited memory
17379 available. The size of the stack allocation may also have an impact on
17380 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
17381 1MB otherwise.
17382
17383 @end table
17384
17385 @node ARC Options
17386 @subsection ARC Options
17387 @cindex ARC options
17388
17389 The following options control the architecture variant for which code
17390 is being compiled:
17391
17392 @c architecture variants
17393 @table @gcctabopt
17394
17395 @item -mbarrel-shifter
17396 @opindex mbarrel-shifter
17397 Generate instructions supported by barrel shifter. This is the default
17398 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17399
17400 @item -mjli-always
17401 @opindex mjli-alawys
17402 Force to call a function using jli_s instruction. This option is
17403 valid only for ARCv2 architecture.
17404
17405 @item -mcpu=@var{cpu}
17406 @opindex mcpu
17407 Set architecture type, register usage, and instruction scheduling
17408 parameters for @var{cpu}. There are also shortcut alias options
17409 available for backward compatibility and convenience. Supported
17410 values for @var{cpu} are
17411
17412 @table @samp
17413 @opindex mA6
17414 @opindex mARC600
17415 @item arc600
17416 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
17417
17418 @item arc601
17419 @opindex mARC601
17420 Compile for ARC601. Alias: @option{-mARC601}.
17421
17422 @item arc700
17423 @opindex mA7
17424 @opindex mARC700
17425 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
17426 This is the default when configured with @option{--with-cpu=arc700}@.
17427
17428 @item arcem
17429 Compile for ARC EM.
17430
17431 @item archs
17432 Compile for ARC HS.
17433
17434 @item em
17435 Compile for ARC EM CPU with no hardware extensions.
17436
17437 @item em4
17438 Compile for ARC EM4 CPU.
17439
17440 @item em4_dmips
17441 Compile for ARC EM4 DMIPS CPU.
17442
17443 @item em4_fpus
17444 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17445 extension.
17446
17447 @item em4_fpuda
17448 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17449 double assist instructions.
17450
17451 @item hs
17452 Compile for ARC HS CPU with no hardware extensions except the atomic
17453 instructions.
17454
17455 @item hs34
17456 Compile for ARC HS34 CPU.
17457
17458 @item hs38
17459 Compile for ARC HS38 CPU.
17460
17461 @item hs38_linux
17462 Compile for ARC HS38 CPU with all hardware extensions on.
17463
17464 @item arc600_norm
17465 Compile for ARC 600 CPU with @code{norm} instructions enabled.
17466
17467 @item arc600_mul32x16
17468 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
17469 instructions enabled.
17470
17471 @item arc600_mul64
17472 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
17473 instructions enabled.
17474
17475 @item arc601_norm
17476 Compile for ARC 601 CPU with @code{norm} instructions enabled.
17477
17478 @item arc601_mul32x16
17479 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17480 instructions enabled.
17481
17482 @item arc601_mul64
17483 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17484 instructions enabled.
17485
17486 @item nps400
17487 Compile for ARC 700 on NPS400 chip.
17488
17489 @item em_mini
17490 Compile for ARC EM minimalist configuration featuring reduced register
17491 set.
17492
17493 @end table
17494
17495 @item -mdpfp
17496 @opindex mdpfp
17497 @itemx -mdpfp-compact
17498 @opindex mdpfp-compact
17499 Generate double-precision FPX instructions, tuned for the compact
17500 implementation.
17501
17502 @item -mdpfp-fast
17503 @opindex mdpfp-fast
17504 Generate double-precision FPX instructions, tuned for the fast
17505 implementation.
17506
17507 @item -mno-dpfp-lrsr
17508 @opindex mno-dpfp-lrsr
17509 Disable @code{lr} and @code{sr} instructions from using FPX extension
17510 aux registers.
17511
17512 @item -mea
17513 @opindex mea
17514 Generate extended arithmetic instructions. Currently only
17515 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17516 supported. Only valid for @option{-mcpu=ARC700}.
17517
17518 @item -mno-mpy
17519 @opindex mno-mpy
17520 @opindex mmpy
17521 Do not generate @code{mpy}-family instructions for ARC700. This option is
17522 deprecated.
17523
17524 @item -mmul32x16
17525 @opindex mmul32x16
17526 Generate 32x16-bit multiply and multiply-accumulate instructions.
17527
17528 @item -mmul64
17529 @opindex mmul64
17530 Generate @code{mul64} and @code{mulu64} instructions.
17531 Only valid for @option{-mcpu=ARC600}.
17532
17533 @item -mnorm
17534 @opindex mnorm
17535 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
17536 is in effect.
17537
17538 @item -mspfp
17539 @opindex mspfp
17540 @itemx -mspfp-compact
17541 @opindex mspfp-compact
17542 Generate single-precision FPX instructions, tuned for the compact
17543 implementation.
17544
17545 @item -mspfp-fast
17546 @opindex mspfp-fast
17547 Generate single-precision FPX instructions, tuned for the fast
17548 implementation.
17549
17550 @item -msimd
17551 @opindex msimd
17552 Enable generation of ARC SIMD instructions via target-specific
17553 builtins. Only valid for @option{-mcpu=ARC700}.
17554
17555 @item -msoft-float
17556 @opindex msoft-float
17557 This option ignored; it is provided for compatibility purposes only.
17558 Software floating-point code is emitted by default, and this default
17559 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17560 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
17561 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17562
17563 @item -mswap
17564 @opindex mswap
17565 Generate @code{swap} instructions.
17566
17567 @item -matomic
17568 @opindex matomic
17569 This enables use of the locked load/store conditional extension to implement
17570 atomic memory built-in functions. Not available for ARC 6xx or ARC
17571 EM cores.
17572
17573 @item -mdiv-rem
17574 @opindex mdiv-rem
17575 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
17576
17577 @item -mcode-density
17578 @opindex mcode-density
17579 Enable code density instructions for ARC EM.
17580 This option is on by default for ARC HS.
17581
17582 @item -mll64
17583 @opindex mll64
17584 Enable double load/store operations for ARC HS cores.
17585
17586 @item -mtp-regno=@var{regno}
17587 @opindex mtp-regno
17588 Specify thread pointer register number.
17589
17590 @item -mmpy-option=@var{multo}
17591 @opindex mmpy-option
17592 Compile ARCv2 code with a multiplier design option. You can specify
17593 the option using either a string or numeric value for @var{multo}.
17594 @samp{wlh1} is the default value. The recognized values are:
17595
17596 @table @samp
17597 @item 0
17598 @itemx none
17599 No multiplier available.
17600
17601 @item 1
17602 @itemx w
17603 16x16 multiplier, fully pipelined.
17604 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
17605
17606 @item 2
17607 @itemx wlh1
17608 32x32 multiplier, fully
17609 pipelined (1 stage). The following instructions are additionally
17610 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17611
17612 @item 3
17613 @itemx wlh2
17614 32x32 multiplier, fully pipelined
17615 (2 stages). The following instructions are additionally enabled: @code{mpy},
17616 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17617
17618 @item 4
17619 @itemx wlh3
17620 Two 16x16 multipliers, blocking,
17621 sequential. The following instructions are additionally enabled: @code{mpy},
17622 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17623
17624 @item 5
17625 @itemx wlh4
17626 One 16x16 multiplier, blocking,
17627 sequential. The following instructions are additionally enabled: @code{mpy},
17628 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17629
17630 @item 6
17631 @itemx wlh5
17632 One 32x4 multiplier, blocking,
17633 sequential. The following instructions are additionally enabled: @code{mpy},
17634 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17635
17636 @item 7
17637 @itemx plus_dmpy
17638 ARC HS SIMD support.
17639
17640 @item 8
17641 @itemx plus_macd
17642 ARC HS SIMD support.
17643
17644 @item 9
17645 @itemx plus_qmacw
17646 ARC HS SIMD support.
17647
17648 @end table
17649
17650 This option is only available for ARCv2 cores@.
17651
17652 @item -mfpu=@var{fpu}
17653 @opindex mfpu
17654 Enables support for specific floating-point hardware extensions for ARCv2
17655 cores. Supported values for @var{fpu} are:
17656
17657 @table @samp
17658
17659 @item fpus
17660 Enables support for single-precision floating-point hardware
17661 extensions@.
17662
17663 @item fpud
17664 Enables support for double-precision floating-point hardware
17665 extensions. The single-precision floating-point extension is also
17666 enabled. Not available for ARC EM@.
17667
17668 @item fpuda
17669 Enables support for double-precision floating-point hardware
17670 extensions using double-precision assist instructions. The single-precision
17671 floating-point extension is also enabled. This option is
17672 only available for ARC EM@.
17673
17674 @item fpuda_div
17675 Enables support for double-precision floating-point hardware
17676 extensions using double-precision assist instructions.
17677 The single-precision floating-point, square-root, and divide
17678 extensions are also enabled. This option is
17679 only available for ARC EM@.
17680
17681 @item fpuda_fma
17682 Enables support for double-precision floating-point hardware
17683 extensions using double-precision assist instructions.
17684 The single-precision floating-point and fused multiply and add
17685 hardware extensions are also enabled. This option is
17686 only available for ARC EM@.
17687
17688 @item fpuda_all
17689 Enables support for double-precision floating-point hardware
17690 extensions using double-precision assist instructions.
17691 All single-precision floating-point hardware extensions are also
17692 enabled. This option is only available for ARC EM@.
17693
17694 @item fpus_div
17695 Enables support for single-precision floating-point, square-root and divide
17696 hardware extensions@.
17697
17698 @item fpud_div
17699 Enables support for double-precision floating-point, square-root and divide
17700 hardware extensions. This option
17701 includes option @samp{fpus_div}. Not available for ARC EM@.
17702
17703 @item fpus_fma
17704 Enables support for single-precision floating-point and
17705 fused multiply and add hardware extensions@.
17706
17707 @item fpud_fma
17708 Enables support for double-precision floating-point and
17709 fused multiply and add hardware extensions. This option
17710 includes option @samp{fpus_fma}. Not available for ARC EM@.
17711
17712 @item fpus_all
17713 Enables support for all single-precision floating-point hardware
17714 extensions@.
17715
17716 @item fpud_all
17717 Enables support for all single- and double-precision floating-point
17718 hardware extensions. Not available for ARC EM@.
17719
17720 @end table
17721
17722 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
17723 @opindex mirq-ctrl-saved
17724 Specifies general-purposes registers that the processor automatically
17725 saves/restores on interrupt entry and exit. @var{register-range} is
17726 specified as two registers separated by a dash. The register range
17727 always starts with @code{r0}, the upper limit is @code{fp} register.
17728 @var{blink} and @var{lp_count} are optional. This option is only
17729 valid for ARC EM and ARC HS cores.
17730
17731 @item -mrgf-banked-regs=@var{number}
17732 @opindex mrgf-banked-regs
17733 Specifies the number of registers replicated in second register bank
17734 on entry to fast interrupt. Fast interrupts are interrupts with the
17735 highest priority level P0. These interrupts save only PC and STATUS32
17736 registers to avoid memory transactions during interrupt entry and exit
17737 sequences. Use this option when you are using fast interrupts in an
17738 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
17739
17740 @item -mlpc-width=@var{width}
17741 @opindex mlpc-width
17742 Specify the width of the @code{lp_count} register. Valid values for
17743 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
17744 fixed to 32 bits. If the width is less than 32, the compiler does not
17745 attempt to transform loops in your program to use the zero-delay loop
17746 mechanism unless it is known that the @code{lp_count} register can
17747 hold the required loop-counter value. Depending on the width
17748 specified, the compiler and run-time library might continue to use the
17749 loop mechanism for various needs. This option defines macro
17750 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
17751
17752 @item -mrf16
17753 @opindex mrf16
17754 This option instructs the compiler to generate code for a 16-entry
17755 register file. This option defines the @code{__ARC_RF16__}
17756 preprocessor macro.
17757
17758 @item -mbranch-index
17759 @opindex mbranch-index
17760 Enable use of @code{bi} or @code{bih} instructions to implement jump
17761 tables.
17762
17763 @end table
17764
17765 The following options are passed through to the assembler, and also
17766 define preprocessor macro symbols.
17767
17768 @c Flags used by the assembler, but for which we define preprocessor
17769 @c macro symbols as well.
17770 @table @gcctabopt
17771 @item -mdsp-packa
17772 @opindex mdsp-packa
17773 Passed down to the assembler to enable the DSP Pack A extensions.
17774 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
17775 deprecated.
17776
17777 @item -mdvbf
17778 @opindex mdvbf
17779 Passed down to the assembler to enable the dual Viterbi butterfly
17780 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
17781 option is deprecated.
17782
17783 @c ARC700 4.10 extension instruction
17784 @item -mlock
17785 @opindex mlock
17786 Passed down to the assembler to enable the locked load/store
17787 conditional extension. Also sets the preprocessor symbol
17788 @code{__Xlock}.
17789
17790 @item -mmac-d16
17791 @opindex mmac-d16
17792 Passed down to the assembler. Also sets the preprocessor symbol
17793 @code{__Xxmac_d16}. This option is deprecated.
17794
17795 @item -mmac-24
17796 @opindex mmac-24
17797 Passed down to the assembler. Also sets the preprocessor symbol
17798 @code{__Xxmac_24}. This option is deprecated.
17799
17800 @c ARC700 4.10 extension instruction
17801 @item -mrtsc
17802 @opindex mrtsc
17803 Passed down to the assembler to enable the 64-bit time-stamp counter
17804 extension instruction. Also sets the preprocessor symbol
17805 @code{__Xrtsc}. This option is deprecated.
17806
17807 @c ARC700 4.10 extension instruction
17808 @item -mswape
17809 @opindex mswape
17810 Passed down to the assembler to enable the swap byte ordering
17811 extension instruction. Also sets the preprocessor symbol
17812 @code{__Xswape}.
17813
17814 @item -mtelephony
17815 @opindex mtelephony
17816 Passed down to the assembler to enable dual- and single-operand
17817 instructions for telephony. Also sets the preprocessor symbol
17818 @code{__Xtelephony}. This option is deprecated.
17819
17820 @item -mxy
17821 @opindex mxy
17822 Passed down to the assembler to enable the XY memory extension. Also
17823 sets the preprocessor symbol @code{__Xxy}.
17824
17825 @end table
17826
17827 The following options control how the assembly code is annotated:
17828
17829 @c Assembly annotation options
17830 @table @gcctabopt
17831 @item -misize
17832 @opindex misize
17833 Annotate assembler instructions with estimated addresses.
17834
17835 @item -mannotate-align
17836 @opindex mannotate-align
17837 Explain what alignment considerations lead to the decision to make an
17838 instruction short or long.
17839
17840 @end table
17841
17842 The following options are passed through to the linker:
17843
17844 @c options passed through to the linker
17845 @table @gcctabopt
17846 @item -marclinux
17847 @opindex marclinux
17848 Passed through to the linker, to specify use of the @code{arclinux} emulation.
17849 This option is enabled by default in tool chains built for
17850 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
17851 when profiling is not requested.
17852
17853 @item -marclinux_prof
17854 @opindex marclinux_prof
17855 Passed through to the linker, to specify use of the
17856 @code{arclinux_prof} emulation. This option is enabled by default in
17857 tool chains built for @w{@code{arc-linux-uclibc}} and
17858 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
17859
17860 @end table
17861
17862 The following options control the semantics of generated code:
17863
17864 @c semantically relevant code generation options
17865 @table @gcctabopt
17866 @item -mlong-calls
17867 @opindex mlong-calls
17868 Generate calls as register indirect calls, thus providing access
17869 to the full 32-bit address range.
17870
17871 @item -mmedium-calls
17872 @opindex mmedium-calls
17873 Don't use less than 25-bit addressing range for calls, which is the
17874 offset available for an unconditional branch-and-link
17875 instruction. Conditional execution of function calls is suppressed, to
17876 allow use of the 25-bit range, rather than the 21-bit range with
17877 conditional branch-and-link. This is the default for tool chains built
17878 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
17879
17880 @item -G @var{num}
17881 @opindex G
17882 Put definitions of externally-visible data in a small data section if
17883 that data is no bigger than @var{num} bytes. The default value of
17884 @var{num} is 4 for any ARC configuration, or 8 when we have double
17885 load/store operations.
17886
17887 @item -mno-sdata
17888 @opindex mno-sdata
17889 @opindex msdata
17890 Do not generate sdata references. This is the default for tool chains
17891 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17892 targets.
17893
17894 @item -mvolatile-cache
17895 @opindex mvolatile-cache
17896 Use ordinarily cached memory accesses for volatile references. This is the
17897 default.
17898
17899 @item -mno-volatile-cache
17900 @opindex mno-volatile-cache
17901 @opindex mvolatile-cache
17902 Enable cache bypass for volatile references.
17903
17904 @end table
17905
17906 The following options fine tune code generation:
17907 @c code generation tuning options
17908 @table @gcctabopt
17909 @item -malign-call
17910 @opindex malign-call
17911 Do alignment optimizations for call instructions.
17912
17913 @item -mauto-modify-reg
17914 @opindex mauto-modify-reg
17915 Enable the use of pre/post modify with register displacement.
17916
17917 @item -mbbit-peephole
17918 @opindex mbbit-peephole
17919 Enable bbit peephole2.
17920
17921 @item -mno-brcc
17922 @opindex mno-brcc
17923 This option disables a target-specific pass in @file{arc_reorg} to
17924 generate compare-and-branch (@code{br@var{cc}}) instructions.
17925 It has no effect on
17926 generation of these instructions driven by the combiner pass.
17927
17928 @item -mcase-vector-pcrel
17929 @opindex mcase-vector-pcrel
17930 Use PC-relative switch case tables to enable case table shortening.
17931 This is the default for @option{-Os}.
17932
17933 @item -mcompact-casesi
17934 @opindex mcompact-casesi
17935 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
17936 and only available for ARCv1 cores. This option is deprecated.
17937
17938 @item -mno-cond-exec
17939 @opindex mno-cond-exec
17940 Disable the ARCompact-specific pass to generate conditional
17941 execution instructions.
17942
17943 Due to delay slot scheduling and interactions between operand numbers,
17944 literal sizes, instruction lengths, and the support for conditional execution,
17945 the target-independent pass to generate conditional execution is often lacking,
17946 so the ARC port has kept a special pass around that tries to find more
17947 conditional execution generation opportunities after register allocation,
17948 branch shortening, and delay slot scheduling have been done. This pass
17949 generally, but not always, improves performance and code size, at the cost of
17950 extra compilation time, which is why there is an option to switch it off.
17951 If you have a problem with call instructions exceeding their allowable
17952 offset range because they are conditionalized, you should consider using
17953 @option{-mmedium-calls} instead.
17954
17955 @item -mearly-cbranchsi
17956 @opindex mearly-cbranchsi
17957 Enable pre-reload use of the @code{cbranchsi} pattern.
17958
17959 @item -mexpand-adddi
17960 @opindex mexpand-adddi
17961 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17962 @code{add.f}, @code{adc} etc. This option is deprecated.
17963
17964 @item -mindexed-loads
17965 @opindex mindexed-loads
17966 Enable the use of indexed loads. This can be problematic because some
17967 optimizers then assume that indexed stores exist, which is not
17968 the case.
17969
17970 @item -mlra
17971 @opindex mlra
17972 Enable Local Register Allocation. This is still experimental for ARC,
17973 so by default the compiler uses standard reload
17974 (i.e.@: @option{-mno-lra}).
17975
17976 @item -mlra-priority-none
17977 @opindex mlra-priority-none
17978 Don't indicate any priority for target registers.
17979
17980 @item -mlra-priority-compact
17981 @opindex mlra-priority-compact
17982 Indicate target register priority for r0..r3 / r12..r15.
17983
17984 @item -mlra-priority-noncompact
17985 @opindex mlra-priority-noncompact
17986 Reduce target register priority for r0..r3 / r12..r15.
17987
17988 @item -mmillicode
17989 @opindex mmillicode
17990 When optimizing for size (using @option{-Os}), prologues and epilogues
17991 that have to save or restore a large number of registers are often
17992 shortened by using call to a special function in libgcc; this is
17993 referred to as a @emph{millicode} call. As these calls can pose
17994 performance issues, and/or cause linking issues when linking in a
17995 nonstandard way, this option is provided to turn on or off millicode
17996 call generation.
17997
17998 @item -mcode-density-frame
17999 @opindex mcode-density-frame
18000 This option enable the compiler to emit @code{enter} and @code{leave}
18001 instructions. These instructions are only valid for CPUs with
18002 code-density feature.
18003
18004 @item -mmixed-code
18005 @opindex mmixed-code
18006 Tweak register allocation to help 16-bit instruction generation.
18007 This generally has the effect of decreasing the average instruction size
18008 while increasing the instruction count.
18009
18010 @item -mq-class
18011 @opindex mq-class
18012 Ths option is deprecated. Enable @samp{q} instruction alternatives.
18013 This is the default for @option{-Os}.
18014
18015 @item -mRcq
18016 @opindex mRcq
18017 Enable @samp{Rcq} constraint handling.
18018 Most short code generation depends on this.
18019 This is the default.
18020
18021 @item -mRcw
18022 @opindex mRcw
18023 Enable @samp{Rcw} constraint handling.
18024 Most ccfsm condexec mostly depends on this.
18025 This is the default.
18026
18027 @item -msize-level=@var{level}
18028 @opindex msize-level
18029 Fine-tune size optimization with regards to instruction lengths and alignment.
18030 The recognized values for @var{level} are:
18031 @table @samp
18032 @item 0
18033 No size optimization. This level is deprecated and treated like @samp{1}.
18034
18035 @item 1
18036 Short instructions are used opportunistically.
18037
18038 @item 2
18039 In addition, alignment of loops and of code after barriers are dropped.
18040
18041 @item 3
18042 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
18043
18044 @end table
18045
18046 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
18047 the behavior when this is not set is equivalent to level @samp{1}.
18048
18049 @item -mtune=@var{cpu}
18050 @opindex mtune
18051 Set instruction scheduling parameters for @var{cpu}, overriding any implied
18052 by @option{-mcpu=}.
18053
18054 Supported values for @var{cpu} are
18055
18056 @table @samp
18057 @item ARC600
18058 Tune for ARC600 CPU.
18059
18060 @item ARC601
18061 Tune for ARC601 CPU.
18062
18063 @item ARC700
18064 Tune for ARC700 CPU with standard multiplier block.
18065
18066 @item ARC700-xmac
18067 Tune for ARC700 CPU with XMAC block.
18068
18069 @item ARC725D
18070 Tune for ARC725D CPU.
18071
18072 @item ARC750D
18073 Tune for ARC750D CPU.
18074
18075 @end table
18076
18077 @item -mmultcost=@var{num}
18078 @opindex mmultcost
18079 Cost to assume for a multiply instruction, with @samp{4} being equal to a
18080 normal instruction.
18081
18082 @item -munalign-prob-threshold=@var{probability}
18083 @opindex munalign-prob-threshold
18084 Set probability threshold for unaligning branches.
18085 When tuning for @samp{ARC700} and optimizing for speed, branches without
18086 filled delay slot are preferably emitted unaligned and long, unless
18087 profiling indicates that the probability for the branch to be taken
18088 is below @var{probability}. @xref{Cross-profiling}.
18089 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
18090
18091 @end table
18092
18093 The following options are maintained for backward compatibility, but
18094 are now deprecated and will be removed in a future release:
18095
18096 @c Deprecated options
18097 @table @gcctabopt
18098
18099 @item -margonaut
18100 @opindex margonaut
18101 Obsolete FPX.
18102
18103 @item -mbig-endian
18104 @opindex mbig-endian
18105 @itemx -EB
18106 @opindex EB
18107 Compile code for big-endian targets. Use of these options is now
18108 deprecated. Big-endian code is supported by configuring GCC to build
18109 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
18110 for which big endian is the default.
18111
18112 @item -mlittle-endian
18113 @opindex mlittle-endian
18114 @itemx -EL
18115 @opindex EL
18116 Compile code for little-endian targets. Use of these options is now
18117 deprecated. Little-endian code is supported by configuring GCC to build
18118 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
18119 for which little endian is the default.
18120
18121 @item -mbarrel_shifter
18122 @opindex mbarrel_shifter
18123 Replaced by @option{-mbarrel-shifter}.
18124
18125 @item -mdpfp_compact
18126 @opindex mdpfp_compact
18127 Replaced by @option{-mdpfp-compact}.
18128
18129 @item -mdpfp_fast
18130 @opindex mdpfp_fast
18131 Replaced by @option{-mdpfp-fast}.
18132
18133 @item -mdsp_packa
18134 @opindex mdsp_packa
18135 Replaced by @option{-mdsp-packa}.
18136
18137 @item -mEA
18138 @opindex mEA
18139 Replaced by @option{-mea}.
18140
18141 @item -mmac_24
18142 @opindex mmac_24
18143 Replaced by @option{-mmac-24}.
18144
18145 @item -mmac_d16
18146 @opindex mmac_d16
18147 Replaced by @option{-mmac-d16}.
18148
18149 @item -mspfp_compact
18150 @opindex mspfp_compact
18151 Replaced by @option{-mspfp-compact}.
18152
18153 @item -mspfp_fast
18154 @opindex mspfp_fast
18155 Replaced by @option{-mspfp-fast}.
18156
18157 @item -mtune=@var{cpu}
18158 @opindex mtune
18159 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18160 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18161 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18162
18163 @item -multcost=@var{num}
18164 @opindex multcost
18165 Replaced by @option{-mmultcost}.
18166
18167 @end table
18168
18169 @node ARM Options
18170 @subsection ARM Options
18171 @cindex ARM options
18172
18173 These @samp{-m} options are defined for the ARM port:
18174
18175 @table @gcctabopt
18176 @item -mabi=@var{name}
18177 @opindex mabi
18178 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
18179 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18180
18181 @item -mapcs-frame
18182 @opindex mapcs-frame
18183 Generate a stack frame that is compliant with the ARM Procedure Call
18184 Standard for all functions, even if this is not strictly necessary for
18185 correct execution of the code. Specifying @option{-fomit-frame-pointer}
18186 with this option causes the stack frames not to be generated for
18187 leaf functions. The default is @option{-mno-apcs-frame}.
18188 This option is deprecated.
18189
18190 @item -mapcs
18191 @opindex mapcs
18192 This is a synonym for @option{-mapcs-frame} and is deprecated.
18193
18194 @ignore
18195 @c not currently implemented
18196 @item -mapcs-stack-check
18197 @opindex mapcs-stack-check
18198 Generate code to check the amount of stack space available upon entry to
18199 every function (that actually uses some stack space). If there is
18200 insufficient space available then either the function
18201 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18202 called, depending upon the amount of stack space required. The runtime
18203 system is required to provide these functions. The default is
18204 @option{-mno-apcs-stack-check}, since this produces smaller code.
18205
18206 @c not currently implemented
18207 @item -mapcs-reentrant
18208 @opindex mapcs-reentrant
18209 Generate reentrant, position-independent code. The default is
18210 @option{-mno-apcs-reentrant}.
18211 @end ignore
18212
18213 @item -mthumb-interwork
18214 @opindex mthumb-interwork
18215 Generate code that supports calling between the ARM and Thumb
18216 instruction sets. Without this option, on pre-v5 architectures, the
18217 two instruction sets cannot be reliably used inside one program. The
18218 default is @option{-mno-thumb-interwork}, since slightly larger code
18219 is generated when @option{-mthumb-interwork} is specified. In AAPCS
18220 configurations this option is meaningless.
18221
18222 @item -mno-sched-prolog
18223 @opindex mno-sched-prolog
18224 @opindex msched-prolog
18225 Prevent the reordering of instructions in the function prologue, or the
18226 merging of those instruction with the instructions in the function's
18227 body. This means that all functions start with a recognizable set
18228 of instructions (or in fact one of a choice from a small set of
18229 different function prologues), and this information can be used to
18230 locate the start of functions inside an executable piece of code. The
18231 default is @option{-msched-prolog}.
18232
18233 @item -mfloat-abi=@var{name}
18234 @opindex mfloat-abi
18235 Specifies which floating-point ABI to use. Permissible values
18236 are: @samp{soft}, @samp{softfp} and @samp{hard}.
18237
18238 Specifying @samp{soft} causes GCC to generate output containing
18239 library calls for floating-point operations.
18240 @samp{softfp} allows the generation of code using hardware floating-point
18241 instructions, but still uses the soft-float calling conventions.
18242 @samp{hard} allows generation of floating-point instructions
18243 and uses FPU-specific calling conventions.
18244
18245 The default depends on the specific target configuration. Note that
18246 the hard-float and soft-float ABIs are not link-compatible; you must
18247 compile your entire program with the same ABI, and link with a
18248 compatible set of libraries.
18249
18250 @item -mgeneral-regs-only
18251 @opindex mgeneral-regs-only
18252 Generate code which uses only the general-purpose registers. This will prevent
18253 the compiler from using floating-point and Advanced SIMD registers but will not
18254 impose any restrictions on the assembler.
18255
18256 @item -mlittle-endian
18257 @opindex mlittle-endian
18258 Generate code for a processor running in little-endian mode. This is
18259 the default for all standard configurations.
18260
18261 @item -mbig-endian
18262 @opindex mbig-endian
18263 Generate code for a processor running in big-endian mode; the default is
18264 to compile code for a little-endian processor.
18265
18266 @item -mbe8
18267 @itemx -mbe32
18268 @opindex mbe8
18269 When linking a big-endian image select between BE8 and BE32 formats.
18270 The option has no effect for little-endian images and is ignored. The
18271 default is dependent on the selected target architecture. For ARMv6
18272 and later architectures the default is BE8, for older architectures
18273 the default is BE32. BE32 format has been deprecated by ARM.
18274
18275 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
18276 @opindex march
18277 This specifies the name of the target ARM architecture. GCC uses this
18278 name to determine what kind of instructions it can emit when generating
18279 assembly code. This option can be used in conjunction with or instead
18280 of the @option{-mcpu=} option.
18281
18282 Permissible names are:
18283 @samp{armv4t},
18284 @samp{armv5t}, @samp{armv5te},
18285 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18286 @samp{armv6z}, @samp{armv6zk},
18287 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
18288 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18289 @samp{armv8.4-a},
18290 @samp{armv8.5-a},
18291 @samp{armv8.6-a},
18292 @samp{armv7-r},
18293 @samp{armv8-r},
18294 @samp{armv6-m}, @samp{armv6s-m},
18295 @samp{armv7-m}, @samp{armv7e-m},
18296 @samp{armv8-m.base}, @samp{armv8-m.main},
18297 @samp{armv8.1-m.main},
18298 @samp{iwmmxt} and @samp{iwmmxt2}.
18299
18300 Additionally, the following architectures, which lack support for the
18301 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18302
18303 Many of the architectures support extensions. These can be added by
18304 appending @samp{+@var{extension}} to the architecture name. Extension
18305 options are processed in order and capabilities accumulate. An extension
18306 will also enable any necessary base extensions
18307 upon which it depends. For example, the @samp{+crypto} extension
18308 will always enable the @samp{+simd} extension. The exception to the
18309 additive construction is for extensions that are prefixed with
18310 @samp{+no@dots{}}: these extensions disable the specified option and
18311 any other extensions that may depend on the presence of that
18312 extension.
18313
18314 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18315 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18316 entirely disabled by the @samp{+nofp} option that follows it.
18317
18318 Most extension names are generically named, but have an effect that is
18319 dependent upon the architecture to which it is applied. For example,
18320 the @samp{+simd} option can be applied to both @samp{armv7-a} and
18321 @samp{armv8-a} architectures, but will enable the original ARMv7-A
18322 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18323 variant for @samp{armv8-a}.
18324
18325 The table below lists the supported extensions for each architecture.
18326 Architectures not mentioned do not support any extensions.
18327
18328 @table @samp
18329 @item armv5te
18330 @itemx armv6
18331 @itemx armv6j
18332 @itemx armv6k
18333 @itemx armv6kz
18334 @itemx armv6t2
18335 @itemx armv6z
18336 @itemx armv6zk
18337 @table @samp
18338 @item +fp
18339 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
18340 used as an alias for this extension.
18341
18342 @item +nofp
18343 Disable the floating-point instructions.
18344 @end table
18345
18346 @item armv7
18347 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18348 @table @samp
18349 @item +fp
18350 The VFPv3 floating-point instructions, with 16 double-precision
18351 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18352 for this extension. Note that floating-point is not supported by the
18353 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18354 ARMv7-R architectures.
18355
18356 @item +nofp
18357 Disable the floating-point instructions.
18358 @end table
18359
18360 @item armv7-a
18361 @table @samp
18362 @item +mp
18363 The multiprocessing extension.
18364
18365 @item +sec
18366 The security extension.
18367
18368 @item +fp
18369 The VFPv3 floating-point instructions, with 16 double-precision
18370 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18371 for this extension.
18372
18373 @item +simd
18374 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18375 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18376 for this extension.
18377
18378 @item +vfpv3
18379 The VFPv3 floating-point instructions, with 32 double-precision
18380 registers.
18381
18382 @item +vfpv3-d16-fp16
18383 The VFPv3 floating-point instructions, with 16 double-precision
18384 registers and the half-precision floating-point conversion operations.
18385
18386 @item +vfpv3-fp16
18387 The VFPv3 floating-point instructions, with 32 double-precision
18388 registers and the half-precision floating-point conversion operations.
18389
18390 @item +vfpv4-d16
18391 The VFPv4 floating-point instructions, with 16 double-precision
18392 registers.
18393
18394 @item +vfpv4
18395 The VFPv4 floating-point instructions, with 32 double-precision
18396 registers.
18397
18398 @item +neon-fp16
18399 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18400 the half-precision floating-point conversion operations.
18401
18402 @item +neon-vfpv4
18403 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18404
18405 @item +nosimd
18406 Disable the Advanced SIMD instructions (does not disable floating point).
18407
18408 @item +nofp
18409 Disable the floating-point and Advanced SIMD instructions.
18410 @end table
18411
18412 @item armv7ve
18413 The extended version of the ARMv7-A architecture with support for
18414 virtualization.
18415 @table @samp
18416 @item +fp
18417 The VFPv4 floating-point instructions, with 16 double-precision registers.
18418 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18419
18420 @item +simd
18421 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
18422 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18423
18424 @item +vfpv3-d16
18425 The VFPv3 floating-point instructions, with 16 double-precision
18426 registers.
18427
18428 @item +vfpv3
18429 The VFPv3 floating-point instructions, with 32 double-precision
18430 registers.
18431
18432 @item +vfpv3-d16-fp16
18433 The VFPv3 floating-point instructions, with 16 double-precision
18434 registers and the half-precision floating-point conversion operations.
18435
18436 @item +vfpv3-fp16
18437 The VFPv3 floating-point instructions, with 32 double-precision
18438 registers and the half-precision floating-point conversion operations.
18439
18440 @item +vfpv4-d16
18441 The VFPv4 floating-point instructions, with 16 double-precision
18442 registers.
18443
18444 @item +vfpv4
18445 The VFPv4 floating-point instructions, with 32 double-precision
18446 registers.
18447
18448 @item +neon
18449 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18450 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18451
18452 @item +neon-fp16
18453 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18454 the half-precision floating-point conversion operations.
18455
18456 @item +nosimd
18457 Disable the Advanced SIMD instructions (does not disable floating point).
18458
18459 @item +nofp
18460 Disable the floating-point and Advanced SIMD instructions.
18461 @end table
18462
18463 @item armv8-a
18464 @table @samp
18465 @item +crc
18466 The Cyclic Redundancy Check (CRC) instructions.
18467 @item +simd
18468 The ARMv8-A Advanced SIMD and floating-point instructions.
18469 @item +crypto
18470 The cryptographic instructions.
18471 @item +nocrypto
18472 Disable the cryptographic instructions.
18473 @item +nofp
18474 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18475 @item +sb
18476 Speculation Barrier Instruction.
18477 @item +predres
18478 Execution and Data Prediction Restriction Instructions.
18479 @end table
18480
18481 @item armv8.1-a
18482 @table @samp
18483 @item +simd
18484 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18485
18486 @item +crypto
18487 The cryptographic instructions. This also enables the Advanced SIMD and
18488 floating-point instructions.
18489
18490 @item +nocrypto
18491 Disable the cryptographic instructions.
18492
18493 @item +nofp
18494 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18495
18496 @item +sb
18497 Speculation Barrier Instruction.
18498
18499 @item +predres
18500 Execution and Data Prediction Restriction Instructions.
18501 @end table
18502
18503 @item armv8.2-a
18504 @itemx armv8.3-a
18505 @table @samp
18506 @item +fp16
18507 The half-precision floating-point data processing instructions.
18508 This also enables the Advanced SIMD and floating-point instructions.
18509
18510 @item +fp16fml
18511 The half-precision floating-point fmla extension. This also enables
18512 the half-precision floating-point extension and Advanced SIMD and
18513 floating-point instructions.
18514
18515 @item +simd
18516 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18517
18518 @item +crypto
18519 The cryptographic instructions. This also enables the Advanced SIMD and
18520 floating-point instructions.
18521
18522 @item +dotprod
18523 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
18524
18525 @item +nocrypto
18526 Disable the cryptographic extension.
18527
18528 @item +nofp
18529 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18530
18531 @item +sb
18532 Speculation Barrier Instruction.
18533
18534 @item +predres
18535 Execution and Data Prediction Restriction Instructions.
18536
18537 @item +i8mm
18538 8-bit Integer Matrix Multiply instructions.
18539 This also enables Advanced SIMD and floating-point instructions.
18540
18541 @item +bf16
18542 Brain half-precision floating-point instructions.
18543 This also enables Advanced SIMD and floating-point instructions.
18544 @end table
18545
18546 @item armv8.4-a
18547 @table @samp
18548 @item +fp16
18549 The half-precision floating-point data processing instructions.
18550 This also enables the Advanced SIMD and floating-point instructions as well
18551 as the Dot Product extension and the half-precision floating-point fmla
18552 extension.
18553
18554 @item +simd
18555 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18556 Dot Product extension.
18557
18558 @item +crypto
18559 The cryptographic instructions. This also enables the Advanced SIMD and
18560 floating-point instructions as well as the Dot Product extension.
18561
18562 @item +nocrypto
18563 Disable the cryptographic extension.
18564
18565 @item +nofp
18566 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18567
18568 @item +sb
18569 Speculation Barrier Instruction.
18570
18571 @item +predres
18572 Execution and Data Prediction Restriction Instructions.
18573
18574 @item +i8mm
18575 8-bit Integer Matrix Multiply instructions.
18576 This also enables Advanced SIMD and floating-point instructions.
18577
18578 @item +bf16
18579 Brain half-precision floating-point instructions.
18580 This also enables Advanced SIMD and floating-point instructions.
18581 @end table
18582
18583 @item armv8.5-a
18584 @table @samp
18585 @item +fp16
18586 The half-precision floating-point data processing instructions.
18587 This also enables the Advanced SIMD and floating-point instructions as well
18588 as the Dot Product extension and the half-precision floating-point fmla
18589 extension.
18590
18591 @item +simd
18592 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18593 Dot Product extension.
18594
18595 @item +crypto
18596 The cryptographic instructions. This also enables the Advanced SIMD and
18597 floating-point instructions as well as the Dot Product extension.
18598
18599 @item +nocrypto
18600 Disable the cryptographic extension.
18601
18602 @item +nofp
18603 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18604
18605 @item +i8mm
18606 8-bit Integer Matrix Multiply instructions.
18607 This also enables Advanced SIMD and floating-point instructions.
18608
18609 @item +bf16
18610 Brain half-precision floating-point instructions.
18611 This also enables Advanced SIMD and floating-point instructions.
18612 @end table
18613
18614 @item armv8.6-a
18615 @table @samp
18616 @item +fp16
18617 The half-precision floating-point data processing instructions.
18618 This also enables the Advanced SIMD and floating-point instructions as well
18619 as the Dot Product extension and the half-precision floating-point fmla
18620 extension.
18621
18622 @item +simd
18623 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18624 Dot Product extension.
18625
18626 @item +crypto
18627 The cryptographic instructions. This also enables the Advanced SIMD and
18628 floating-point instructions as well as the Dot Product extension.
18629
18630 @item +nocrypto
18631 Disable the cryptographic extension.
18632
18633 @item +nofp
18634 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18635
18636 @item +i8mm
18637 8-bit Integer Matrix Multiply instructions.
18638 This also enables Advanced SIMD and floating-point instructions.
18639
18640 @item +bf16
18641 Brain half-precision floating-point instructions.
18642 This also enables Advanced SIMD and floating-point instructions.
18643 @end table
18644
18645 @item armv7-r
18646 @table @samp
18647 @item +fp.sp
18648 The single-precision VFPv3 floating-point instructions. The extension
18649 @samp{+vfpv3xd} can be used as an alias for this extension.
18650
18651 @item +fp
18652 The VFPv3 floating-point instructions with 16 double-precision registers.
18653 The extension +vfpv3-d16 can be used as an alias for this extension.
18654
18655 @item +vfpv3xd-d16-fp16
18656 The single-precision VFPv3 floating-point instructions with 16 double-precision
18657 registers and the half-precision floating-point conversion operations.
18658
18659 @item +vfpv3-d16-fp16
18660 The VFPv3 floating-point instructions with 16 double-precision
18661 registers and the half-precision floating-point conversion operations.
18662
18663 @item +nofp
18664 Disable the floating-point extension.
18665
18666 @item +idiv
18667 The ARM-state integer division instructions.
18668
18669 @item +noidiv
18670 Disable the ARM-state integer division extension.
18671 @end table
18672
18673 @item armv7e-m
18674 @table @samp
18675 @item +fp
18676 The single-precision VFPv4 floating-point instructions.
18677
18678 @item +fpv5
18679 The single-precision FPv5 floating-point instructions.
18680
18681 @item +fp.dp
18682 The single- and double-precision FPv5 floating-point instructions.
18683
18684 @item +nofp
18685 Disable the floating-point extensions.
18686 @end table
18687
18688 @item armv8.1-m.main
18689 @table @samp
18690
18691 @item +dsp
18692 The DSP instructions.
18693
18694 @item +mve
18695 The M-Profile Vector Extension (MVE) integer instructions.
18696
18697 @item +mve.fp
18698 The M-Profile Vector Extension (MVE) integer and single precision
18699 floating-point instructions.
18700
18701 @item +fp
18702 The single-precision floating-point instructions.
18703
18704 @item +fp.dp
18705 The single- and double-precision floating-point instructions.
18706
18707 @item +nofp
18708 Disable the floating-point extension.
18709
18710 @item +cdecp0, +cdecp1, ... , +cdecp7
18711 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
18712 to the numbers given in the options in the range 0 to 7.
18713 @end table
18714
18715 @item armv8-m.main
18716 @table @samp
18717 @item +dsp
18718 The DSP instructions.
18719
18720 @item +nodsp
18721 Disable the DSP extension.
18722
18723 @item +fp
18724 The single-precision floating-point instructions.
18725
18726 @item +fp.dp
18727 The single- and double-precision floating-point instructions.
18728
18729 @item +nofp
18730 Disable the floating-point extension.
18731
18732 @item +cdecp0, +cdecp1, ... , +cdecp7
18733 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
18734 to the numbers given in the options in the range 0 to 7.
18735 @end table
18736
18737 @item armv8-r
18738 @table @samp
18739 @item +crc
18740 The Cyclic Redundancy Check (CRC) instructions.
18741 @item +fp.sp
18742 The single-precision FPv5 floating-point instructions.
18743 @item +simd
18744 The ARMv8-A Advanced SIMD and floating-point instructions.
18745 @item +crypto
18746 The cryptographic instructions.
18747 @item +nocrypto
18748 Disable the cryptographic instructions.
18749 @item +nofp
18750 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18751 @end table
18752
18753 @end table
18754
18755 @option{-march=native} causes the compiler to auto-detect the architecture
18756 of the build computer. At present, this feature is only supported on
18757 GNU/Linux, and not all architectures are recognized. If the auto-detect
18758 is unsuccessful the option has no effect.
18759
18760 @item -mtune=@var{name}
18761 @opindex mtune
18762 This option specifies the name of the target ARM processor for
18763 which GCC should tune the performance of the code.
18764 For some ARM implementations better performance can be obtained by using
18765 this option.
18766 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
18767 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
18768 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
18769 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
18770 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
18771 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
18772 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
18773 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
18774 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
18775 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
18776 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
18777 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18778 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18779 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18780 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
18781 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
18782 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
18783 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
18784 @samp{cortex-m35p}, @samp{cortex-m55},
18785 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
18786 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
18787 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
18788 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
18789 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
18790
18791 Additionally, this option can specify that GCC should tune the performance
18792 of the code for a big.LITTLE system. Permissible names are:
18793 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
18794 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18795 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
18796 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
18797
18798 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
18799 performance for a blend of processors within architecture @var{arch}.
18800 The aim is to generate code that run well on the current most popular
18801 processors, balancing between optimizations that benefit some CPUs in the
18802 range, and avoiding performance pitfalls of other CPUs. The effects of
18803 this option may change in future GCC versions as CPU models come and go.
18804
18805 @option{-mtune} permits the same extension options as @option{-mcpu}, but
18806 the extension options do not affect the tuning of the generated code.
18807
18808 @option{-mtune=native} causes the compiler to auto-detect the CPU
18809 of the build computer. At present, this feature is only supported on
18810 GNU/Linux, and not all architectures are recognized. If the auto-detect is
18811 unsuccessful the option has no effect.
18812
18813 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
18814 @opindex mcpu
18815 This specifies the name of the target ARM processor. GCC uses this name
18816 to derive the name of the target ARM architecture (as if specified
18817 by @option{-march}) and the ARM processor type for which to tune for
18818 performance (as if specified by @option{-mtune}). Where this option
18819 is used in conjunction with @option{-march} or @option{-mtune},
18820 those options take precedence over the appropriate part of this option.
18821
18822 Many of the supported CPUs implement optional architectural
18823 extensions. Where this is so the architectural extensions are
18824 normally enabled by default. If implementations that lack the
18825 extension exist, then the extension syntax can be used to disable
18826 those extensions that have been omitted. For floating-point and
18827 Advanced SIMD (Neon) instructions, the settings of the options
18828 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
18829 floating-point and Advanced SIMD instructions will only be used if
18830 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
18831 @option{-mfpu} other than @samp{auto} will override the available
18832 floating-point and SIMD extension instructions.
18833
18834 For example, @samp{cortex-a9} can be found in three major
18835 configurations: integer only, with just a floating-point unit or with
18836 floating-point and Advanced SIMD. The default is to enable all the
18837 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
18838 be used to disable just the SIMD or both the SIMD and floating-point
18839 instructions respectively.
18840
18841 Permissible names for this option are the same as those for
18842 @option{-mtune}.
18843
18844 The following extension options are common to the listed CPUs:
18845
18846 @table @samp
18847 @item +nodsp
18848 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
18849
18850 @item +nofp
18851 Disables the floating-point instructions on @samp{arm9e},
18852 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
18853 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
18854 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
18855 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
18856 Disables the floating-point and SIMD instructions on
18857 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
18858 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
18859 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
18860 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
18861 @samp{cortex-a53} and @samp{cortex-a55}.
18862
18863 @item +nofp.dp
18864 Disables the double-precision component of the floating-point instructions
18865 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
18866 @samp{cortex-m7}.
18867
18868 @item +nosimd
18869 Disables the SIMD (but not floating-point) instructions on
18870 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
18871 and @samp{cortex-a9}.
18872
18873 @item +crypto
18874 Enables the cryptographic instructions on @samp{cortex-a32},
18875 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
18876 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
18877 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18878 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
18879 @samp{cortex-a75.cortex-a55}.
18880 @end table
18881
18882 Additionally the @samp{generic-armv7-a} pseudo target defaults to
18883 VFPv3 with 16 double-precision registers. It supports the following
18884 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
18885 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
18886 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
18887 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
18888 the extensions to @option{-march=armv7-a}.
18889
18890 @option{-mcpu=generic-@var{arch}} is also permissible, and is
18891 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
18892 See @option{-mtune} for more information.
18893
18894 @option{-mcpu=native} causes the compiler to auto-detect the CPU
18895 of the build computer. At present, this feature is only supported on
18896 GNU/Linux, and not all architectures are recognized. If the auto-detect
18897 is unsuccessful the option has no effect.
18898
18899 @item -mfpu=@var{name}
18900 @opindex mfpu
18901 This specifies what floating-point hardware (or hardware emulation) is
18902 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
18903 @samp{vfpv3},
18904 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
18905 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
18906 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
18907 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
18908 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
18909 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
18910 is an alias for @samp{vfpv2}.
18911
18912 The setting @samp{auto} is the default and is special. It causes the
18913 compiler to select the floating-point and Advanced SIMD instructions
18914 based on the settings of @option{-mcpu} and @option{-march}.
18915
18916 If the selected floating-point hardware includes the NEON extension
18917 (e.g.@: @option{-mfpu=neon}), note that floating-point
18918 operations are not generated by GCC's auto-vectorization pass unless
18919 @option{-funsafe-math-optimizations} is also specified. This is
18920 because NEON hardware does not fully implement the IEEE 754 standard for
18921 floating-point arithmetic (in particular denormal values are treated as
18922 zero), so the use of NEON instructions may lead to a loss of precision.
18923
18924 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}).
18925
18926 @item -mfp16-format=@var{name}
18927 @opindex mfp16-format
18928 Specify the format of the @code{__fp16} half-precision floating-point type.
18929 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
18930 the default is @samp{none}, in which case the @code{__fp16} type is not
18931 defined. @xref{Half-Precision}, for more information.
18932
18933 @item -mstructure-size-boundary=@var{n}
18934 @opindex mstructure-size-boundary
18935 The sizes of all structures and unions are rounded up to a multiple
18936 of the number of bits set by this option. Permissible values are 8, 32
18937 and 64. The default value varies for different toolchains. For the COFF
18938 targeted toolchain the default value is 8. A value of 64 is only allowed
18939 if the underlying ABI supports it.
18940
18941 Specifying a larger number can produce faster, more efficient code, but
18942 can also increase the size of the program. Different values are potentially
18943 incompatible. Code compiled with one value cannot necessarily expect to
18944 work with code or libraries compiled with another value, if they exchange
18945 information using structures or unions.
18946
18947 This option is deprecated.
18948
18949 @item -mabort-on-noreturn
18950 @opindex mabort-on-noreturn
18951 Generate a call to the function @code{abort} at the end of a
18952 @code{noreturn} function. It is executed if the function tries to
18953 return.
18954
18955 @item -mlong-calls
18956 @itemx -mno-long-calls
18957 @opindex mlong-calls
18958 @opindex mno-long-calls
18959 Tells the compiler to perform function calls by first loading the
18960 address of the function into a register and then performing a subroutine
18961 call on this register. This switch is needed if the target function
18962 lies outside of the 64-megabyte addressing range of the offset-based
18963 version of subroutine call instruction.
18964
18965 Even if this switch is enabled, not all function calls are turned
18966 into long calls. The heuristic is that static functions, functions
18967 that have the @code{short_call} attribute, functions that are inside
18968 the scope of a @code{#pragma no_long_calls} directive, and functions whose
18969 definitions have already been compiled within the current compilation
18970 unit are not turned into long calls. The exceptions to this rule are
18971 that weak function definitions, functions with the @code{long_call}
18972 attribute or the @code{section} attribute, and functions that are within
18973 the scope of a @code{#pragma long_calls} directive are always
18974 turned into long calls.
18975
18976 This feature is not enabled by default. Specifying
18977 @option{-mno-long-calls} restores the default behavior, as does
18978 placing the function calls within the scope of a @code{#pragma
18979 long_calls_off} directive. Note these switches have no effect on how
18980 the compiler generates code to handle function calls via function
18981 pointers.
18982
18983 @item -msingle-pic-base
18984 @opindex msingle-pic-base
18985 Treat the register used for PIC addressing as read-only, rather than
18986 loading it in the prologue for each function. The runtime system is
18987 responsible for initializing this register with an appropriate value
18988 before execution begins.
18989
18990 @item -mpic-register=@var{reg}
18991 @opindex mpic-register
18992 Specify the register to be used for PIC addressing.
18993 For standard PIC base case, the default is any suitable register
18994 determined by compiler. For single PIC base case, the default is
18995 @samp{R9} if target is EABI based or stack-checking is enabled,
18996 otherwise the default is @samp{R10}.
18997
18998 @item -mpic-data-is-text-relative
18999 @opindex mpic-data-is-text-relative
19000 Assume that the displacement between the text and data segments is fixed
19001 at static link time. This permits using PC-relative addressing
19002 operations to access data known to be in the data segment. For
19003 non-VxWorks RTP targets, this option is enabled by default. When
19004 disabled on such targets, it will enable @option{-msingle-pic-base} by
19005 default.
19006
19007 @item -mpoke-function-name
19008 @opindex mpoke-function-name
19009 Write the name of each function into the text section, directly
19010 preceding the function prologue. The generated code is similar to this:
19011
19012 @smallexample
19013 t0
19014 .ascii "arm_poke_function_name", 0
19015 .align
19016 t1
19017 .word 0xff000000 + (t1 - t0)
19018 arm_poke_function_name
19019 mov ip, sp
19020 stmfd sp!, @{fp, ip, lr, pc@}
19021 sub fp, ip, #4
19022 @end smallexample
19023
19024 When performing a stack backtrace, code can inspect the value of
19025 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
19026 location @code{pc - 12} and the top 8 bits are set, then we know that
19027 there is a function name embedded immediately preceding this location
19028 and has length @code{((pc[-3]) & 0xff000000)}.
19029
19030 @item -mthumb
19031 @itemx -marm
19032 @opindex marm
19033 @opindex mthumb
19034
19035 Select between generating code that executes in ARM and Thumb
19036 states. The default for most configurations is to generate code
19037 that executes in ARM state, but the default can be changed by
19038 configuring GCC with the @option{--with-mode=}@var{state}
19039 configure option.
19040
19041 You can also override the ARM and Thumb mode for each function
19042 by using the @code{target("thumb")} and @code{target("arm")} function attributes
19043 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
19044
19045 @item -mflip-thumb
19046 @opindex mflip-thumb
19047 Switch ARM/Thumb modes on alternating functions.
19048 This option is provided for regression testing of mixed Thumb/ARM code
19049 generation, and is not intended for ordinary use in compiling code.
19050
19051 @item -mtpcs-frame
19052 @opindex mtpcs-frame
19053 Generate a stack frame that is compliant with the Thumb Procedure Call
19054 Standard for all non-leaf functions. (A leaf function is one that does
19055 not call any other functions.) The default is @option{-mno-tpcs-frame}.
19056
19057 @item -mtpcs-leaf-frame
19058 @opindex mtpcs-leaf-frame
19059 Generate a stack frame that is compliant with the Thumb Procedure Call
19060 Standard for all leaf functions. (A leaf function is one that does
19061 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
19062
19063 @item -mcallee-super-interworking
19064 @opindex mcallee-super-interworking
19065 Gives all externally visible functions in the file being compiled an ARM
19066 instruction set header which switches to Thumb mode before executing the
19067 rest of the function. This allows these functions to be called from
19068 non-interworking code. This option is not valid in AAPCS configurations
19069 because interworking is enabled by default.
19070
19071 @item -mcaller-super-interworking
19072 @opindex mcaller-super-interworking
19073 Allows calls via function pointers (including virtual functions) to
19074 execute correctly regardless of whether the target code has been
19075 compiled for interworking or not. There is a small overhead in the cost
19076 of executing a function pointer if this option is enabled. This option
19077 is not valid in AAPCS configurations because interworking is enabled
19078 by default.
19079
19080 @item -mtp=@var{name}
19081 @opindex mtp
19082 Specify the access model for the thread local storage pointer. The valid
19083 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
19084 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
19085 (supported in the arm6k architecture), and @samp{auto}, which uses the
19086 best available method for the selected processor. The default setting is
19087 @samp{auto}.
19088
19089 @item -mtls-dialect=@var{dialect}
19090 @opindex mtls-dialect
19091 Specify the dialect to use for accessing thread local storage. Two
19092 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
19093 @samp{gnu} dialect selects the original GNU scheme for supporting
19094 local and global dynamic TLS models. The @samp{gnu2} dialect
19095 selects the GNU descriptor scheme, which provides better performance
19096 for shared libraries. The GNU descriptor scheme is compatible with
19097 the original scheme, but does require new assembler, linker and
19098 library support. Initial and local exec TLS models are unaffected by
19099 this option and always use the original scheme.
19100
19101 @item -mword-relocations
19102 @opindex mword-relocations
19103 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
19104 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
19105 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
19106 is specified. This option conflicts with @option{-mslow-flash-data}.
19107
19108 @item -mfix-cortex-m3-ldrd
19109 @opindex mfix-cortex-m3-ldrd
19110 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
19111 with overlapping destination and base registers are used. This option avoids
19112 generating these instructions. This option is enabled by default when
19113 @option{-mcpu=cortex-m3} is specified.
19114
19115 @item -munaligned-access
19116 @itemx -mno-unaligned-access
19117 @opindex munaligned-access
19118 @opindex mno-unaligned-access
19119 Enables (or disables) reading and writing of 16- and 32- bit values
19120 from addresses that are not 16- or 32- bit aligned. By default
19121 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19122 ARMv8-M Baseline architectures, and enabled for all other
19123 architectures. If unaligned access is not enabled then words in packed
19124 data structures are accessed a byte at a time.
19125
19126 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
19127 generated object file to either true or false, depending upon the
19128 setting of this option. If unaligned access is enabled then the
19129 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
19130 defined.
19131
19132 @item -mneon-for-64bits
19133 @opindex mneon-for-64bits
19134 This option is deprecated and has no effect.
19135
19136 @item -mslow-flash-data
19137 @opindex mslow-flash-data
19138 Assume loading data from flash is slower than fetching instruction.
19139 Therefore literal load is minimized for better performance.
19140 This option is only supported when compiling for ARMv7 M-profile and
19141 off by default. It conflicts with @option{-mword-relocations}.
19142
19143 @item -masm-syntax-unified
19144 @opindex masm-syntax-unified
19145 Assume inline assembler is using unified asm syntax. The default is
19146 currently off which implies divided syntax. This option has no impact
19147 on Thumb2. However, this may change in future releases of GCC.
19148 Divided syntax should be considered deprecated.
19149
19150 @item -mrestrict-it
19151 @opindex mrestrict-it
19152 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19153 IT blocks can only contain a single 16-bit instruction from a select
19154 set of instructions. This option is on by default for ARMv8-A Thumb mode.
19155
19156 @item -mprint-tune-info
19157 @opindex mprint-tune-info
19158 Print CPU tuning information as comment in assembler file. This is
19159 an option used only for regression testing of the compiler and not
19160 intended for ordinary use in compiling code. This option is disabled
19161 by default.
19162
19163 @item -mverbose-cost-dump
19164 @opindex mverbose-cost-dump
19165 Enable verbose cost model dumping in the debug dump files. This option is
19166 provided for use in debugging the compiler.
19167
19168 @item -mpure-code
19169 @opindex mpure-code
19170 Do not allow constant data to be placed in code sections.
19171 Additionally, when compiling for ELF object format give all text sections the
19172 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
19173 is only available when generating non-pic code for M-profile targets.
19174
19175 @item -mcmse
19176 @opindex mcmse
19177 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19178 Development Tools Engineering Specification", which can be found on
19179 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
19180
19181 @item -mfdpic
19182 @itemx -mno-fdpic
19183 @opindex mfdpic
19184 @opindex mno-fdpic
19185 Select the FDPIC ABI, which uses 64-bit function descriptors to
19186 represent pointers to functions. When the compiler is configured for
19187 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19188 and implies @option{-fPIE} if none of the PIC/PIE-related options is
19189 provided. On other targets, it only enables the FDPIC-specific code
19190 generation features, and the user should explicitly provide the
19191 PIC/PIE-related options as needed.
19192
19193 Note that static linking is not supported because it would still
19194 involve the dynamic linker when the program self-relocates. If such
19195 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19196
19197 The opposite @option{-mno-fdpic} option is useful (and required) to
19198 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19199 toolchain as the one used to build the userland programs.
19200
19201 @end table
19202
19203 @node AVR Options
19204 @subsection AVR Options
19205 @cindex AVR Options
19206
19207 These options are defined for AVR implementations:
19208
19209 @table @gcctabopt
19210 @item -mmcu=@var{mcu}
19211 @opindex mmcu
19212 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19213
19214 The default for this option is@tie{}@samp{avr2}.
19215
19216 GCC supports the following AVR devices and ISAs:
19217
19218 @include avr-mmcu.texi
19219
19220 @item -mabsdata
19221 @opindex mabsdata
19222
19223 Assume that all data in static storage can be accessed by LDS / STS
19224 instructions. This option has only an effect on reduced Tiny devices like
19225 ATtiny40. See also the @code{absdata}
19226 @ref{AVR Variable Attributes,variable attribute}.
19227
19228 @item -maccumulate-args
19229 @opindex maccumulate-args
19230 Accumulate outgoing function arguments and acquire/release the needed
19231 stack space for outgoing function arguments once in function
19232 prologue/epilogue. Without this option, outgoing arguments are pushed
19233 before calling a function and popped afterwards.
19234
19235 Popping the arguments after the function call can be expensive on
19236 AVR so that accumulating the stack space might lead to smaller
19237 executables because arguments need not be removed from the
19238 stack after such a function call.
19239
19240 This option can lead to reduced code size for functions that perform
19241 several calls to functions that get their arguments on the stack like
19242 calls to printf-like functions.
19243
19244 @item -mbranch-cost=@var{cost}
19245 @opindex mbranch-cost
19246 Set the branch costs for conditional branch instructions to
19247 @var{cost}. Reasonable values for @var{cost} are small, non-negative
19248 integers. The default branch cost is 0.
19249
19250 @item -mcall-prologues
19251 @opindex mcall-prologues
19252 Functions prologues/epilogues are expanded as calls to appropriate
19253 subroutines. Code size is smaller.
19254
19255 @item -mdouble=@var{bits}
19256 @itemx -mlong-double=@var{bits}
19257 @opindex mdouble
19258 @opindex mlong-double
19259 Set the size (in bits) of the @code{double} or @code{long double} type,
19260 respectively. Possible values for @var{bits} are 32 and 64.
19261 Whether or not a specific value for @var{bits} is allowed depends on
19262 the @code{--with-double=} and @code{--with-long-double=}
19263 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19264 and the same applies for the default values of the options.
19265
19266 @item -mgas-isr-prologues
19267 @opindex mgas-isr-prologues
19268 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19269 instruction supported by GNU Binutils.
19270 If this option is on, the feature can still be disabled for individual
19271 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19272 function attribute. This feature is activated per default
19273 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19274 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19275
19276 @item -mint8
19277 @opindex mint8
19278 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
19279 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19280 and @code{long long} is 4 bytes. Please note that this option does not
19281 conform to the C standards, but it results in smaller code
19282 size.
19283
19284 @item -mmain-is-OS_task
19285 @opindex mmain-is-OS_task
19286 Do not save registers in @code{main}. The effect is the same like
19287 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19288 to @code{main}. It is activated per default if optimization is on.
19289
19290 @item -mn-flash=@var{num}
19291 @opindex mn-flash
19292 Assume that the flash memory has a size of
19293 @var{num} times 64@tie{}KiB.
19294
19295 @item -mno-interrupts
19296 @opindex mno-interrupts
19297 Generated code is not compatible with hardware interrupts.
19298 Code size is smaller.
19299
19300 @item -mrelax
19301 @opindex mrelax
19302 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19303 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19304 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19305 the assembler's command line and the @option{--relax} option to the
19306 linker's command line.
19307
19308 Jump relaxing is performed by the linker because jump offsets are not
19309 known before code is located. Therefore, the assembler code generated by the
19310 compiler is the same, but the instructions in the executable may
19311 differ from instructions in the assembler code.
19312
19313 Relaxing must be turned on if linker stubs are needed, see the
19314 section on @code{EIND} and linker stubs below.
19315
19316 @item -mrmw
19317 @opindex mrmw
19318 Assume that the device supports the Read-Modify-Write
19319 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19320
19321 @item -mshort-calls
19322 @opindex mshort-calls
19323
19324 Assume that @code{RJMP} and @code{RCALL} can target the whole
19325 program memory.
19326
19327 This option is used internally for multilib selection. It is
19328 not an optimization option, and you don't need to set it by hand.
19329
19330 @item -msp8
19331 @opindex msp8
19332 Treat the stack pointer register as an 8-bit register,
19333 i.e.@: assume the high byte of the stack pointer is zero.
19334 In general, you don't need to set this option by hand.
19335
19336 This option is used internally by the compiler to select and
19337 build multilibs for architectures @code{avr2} and @code{avr25}.
19338 These architectures mix devices with and without @code{SPH}.
19339 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19340 the compiler driver adds or removes this option from the compiler
19341 proper's command line, because the compiler then knows if the device
19342 or architecture has an 8-bit stack pointer and thus no @code{SPH}
19343 register or not.
19344
19345 @item -mstrict-X
19346 @opindex mstrict-X
19347 Use address register @code{X} in a way proposed by the hardware. This means
19348 that @code{X} is only used in indirect, post-increment or
19349 pre-decrement addressing.
19350
19351 Without this option, the @code{X} register may be used in the same way
19352 as @code{Y} or @code{Z} which then is emulated by additional
19353 instructions.
19354 For example, loading a value with @code{X+const} addressing with a
19355 small non-negative @code{const < 64} to a register @var{Rn} is
19356 performed as
19357
19358 @example
19359 adiw r26, const ; X += const
19360 ld @var{Rn}, X ; @var{Rn} = *X
19361 sbiw r26, const ; X -= const
19362 @end example
19363
19364 @item -mtiny-stack
19365 @opindex mtiny-stack
19366 Only change the lower 8@tie{}bits of the stack pointer.
19367
19368 @item -mfract-convert-truncate
19369 @opindex mfract-convert-truncate
19370 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19371
19372 @item -nodevicelib
19373 @opindex nodevicelib
19374 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19375
19376 @item -nodevicespecs
19377 @opindex nodevicespecs
19378 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19379 command line. The user takes responsibility for supplying the sub-processes
19380 like compiler proper, assembler and linker with appropriate command line
19381 options. This means that the user has to supply her private device specs
19382 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
19383 more need for option @option{-mmcu=@var{mcu}}.
19384
19385 This option can also serve as a replacement for the older way of
19386 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19387 which contains a folder named @code{device-specs} which contains a specs file named
19388 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19389
19390 @item -Waddr-space-convert
19391 @opindex Waddr-space-convert
19392 @opindex Wno-addr-space-convert
19393 Warn about conversions between address spaces in the case where the
19394 resulting address space is not contained in the incoming address space.
19395
19396 @item -Wmisspelled-isr
19397 @opindex Wmisspelled-isr
19398 @opindex Wno-misspelled-isr
19399 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19400 Enabled by default.
19401 @end table
19402
19403 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19404 @cindex @code{EIND}
19405 Pointers in the implementation are 16@tie{}bits wide.
19406 The address of a function or label is represented as word address so
19407 that indirect jumps and calls can target any code address in the
19408 range of 64@tie{}Ki words.
19409
19410 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19411 bytes of program memory space, there is a special function register called
19412 @code{EIND} that serves as most significant part of the target address
19413 when @code{EICALL} or @code{EIJMP} instructions are used.
19414
19415 Indirect jumps and calls on these devices are handled as follows by
19416 the compiler and are subject to some limitations:
19417
19418 @itemize @bullet
19419
19420 @item
19421 The compiler never sets @code{EIND}.
19422
19423 @item
19424 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19425 instructions or might read @code{EIND} directly in order to emulate an
19426 indirect call/jump by means of a @code{RET} instruction.
19427
19428 @item
19429 The compiler assumes that @code{EIND} never changes during the startup
19430 code or during the application. In particular, @code{EIND} is not
19431 saved/restored in function or interrupt service routine
19432 prologue/epilogue.
19433
19434 @item
19435 For indirect calls to functions and computed goto, the linker
19436 generates @emph{stubs}. Stubs are jump pads sometimes also called
19437 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19438 The stub contains a direct jump to the desired address.
19439
19440 @item
19441 Linker relaxation must be turned on so that the linker generates
19442 the stubs correctly in all situations. See the compiler option
19443 @option{-mrelax} and the linker option @option{--relax}.
19444 There are corner cases where the linker is supposed to generate stubs
19445 but aborts without relaxation and without a helpful error message.
19446
19447 @item
19448 The default linker script is arranged for code with @code{EIND = 0}.
19449 If code is supposed to work for a setup with @code{EIND != 0}, a custom
19450 linker script has to be used in order to place the sections whose
19451 name start with @code{.trampolines} into the segment where @code{EIND}
19452 points to.
19453
19454 @item
19455 The startup code from libgcc never sets @code{EIND}.
19456 Notice that startup code is a blend of code from libgcc and AVR-LibC.
19457 For the impact of AVR-LibC on @code{EIND}, see the
19458 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19459
19460 @item
19461 It is legitimate for user-specific startup code to set up @code{EIND}
19462 early, for example by means of initialization code located in
19463 section @code{.init3}. Such code runs prior to general startup code
19464 that initializes RAM and calls constructors, but after the bit
19465 of startup code from AVR-LibC that sets @code{EIND} to the segment
19466 where the vector table is located.
19467 @example
19468 #include <avr/io.h>
19469
19470 static void
19471 __attribute__((section(".init3"),naked,used,no_instrument_function))
19472 init3_set_eind (void)
19473 @{
19474 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19475 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19476 @}
19477 @end example
19478
19479 @noindent
19480 The @code{__trampolines_start} symbol is defined in the linker script.
19481
19482 @item
19483 Stubs are generated automatically by the linker if
19484 the following two conditions are met:
19485 @itemize @minus
19486
19487 @item The address of a label is taken by means of the @code{gs} modifier
19488 (short for @emph{generate stubs}) like so:
19489 @example
19490 LDI r24, lo8(gs(@var{func}))
19491 LDI r25, hi8(gs(@var{func}))
19492 @end example
19493 @item The final location of that label is in a code segment
19494 @emph{outside} the segment where the stubs are located.
19495 @end itemize
19496
19497 @item
19498 The compiler emits such @code{gs} modifiers for code labels in the
19499 following situations:
19500 @itemize @minus
19501 @item Taking address of a function or code label.
19502 @item Computed goto.
19503 @item If prologue-save function is used, see @option{-mcall-prologues}
19504 command-line option.
19505 @item Switch/case dispatch tables. If you do not want such dispatch
19506 tables you can specify the @option{-fno-jump-tables} command-line option.
19507 @item C and C++ constructors/destructors called during startup/shutdown.
19508 @item If the tools hit a @code{gs()} modifier explained above.
19509 @end itemize
19510
19511 @item
19512 Jumping to non-symbolic addresses like so is @emph{not} supported:
19513
19514 @example
19515 int main (void)
19516 @{
19517 /* Call function at word address 0x2 */
19518 return ((int(*)(void)) 0x2)();
19519 @}
19520 @end example
19521
19522 Instead, a stub has to be set up, i.e.@: the function has to be called
19523 through a symbol (@code{func_4} in the example):
19524
19525 @example
19526 int main (void)
19527 @{
19528 extern int func_4 (void);
19529
19530 /* Call function at byte address 0x4 */
19531 return func_4();
19532 @}
19533 @end example
19534
19535 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19536 Alternatively, @code{func_4} can be defined in the linker script.
19537 @end itemize
19538
19539 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19540 @cindex @code{RAMPD}
19541 @cindex @code{RAMPX}
19542 @cindex @code{RAMPY}
19543 @cindex @code{RAMPZ}
19544 Some AVR devices support memories larger than the 64@tie{}KiB range
19545 that can be accessed with 16-bit pointers. To access memory locations
19546 outside this 64@tie{}KiB range, the content of a @code{RAMP}
19547 register is used as high part of the address:
19548 The @code{X}, @code{Y}, @code{Z} address register is concatenated
19549 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19550 register, respectively, to get a wide address. Similarly,
19551 @code{RAMPD} is used together with direct addressing.
19552
19553 @itemize
19554 @item
19555 The startup code initializes the @code{RAMP} special function
19556 registers with zero.
19557
19558 @item
19559 If a @ref{AVR Named Address Spaces,named address space} other than
19560 generic or @code{__flash} is used, then @code{RAMPZ} is set
19561 as needed before the operation.
19562
19563 @item
19564 If the device supports RAM larger than 64@tie{}KiB and the compiler
19565 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
19566 is reset to zero after the operation.
19567
19568 @item
19569 If the device comes with a specific @code{RAMP} register, the ISR
19570 prologue/epilogue saves/restores that SFR and initializes it with
19571 zero in case the ISR code might (implicitly) use it.
19572
19573 @item
19574 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
19575 If you use inline assembler to read from locations outside the
19576 16-bit address range and change one of the @code{RAMP} registers,
19577 you must reset it to zero after the access.
19578
19579 @end itemize
19580
19581 @subsubsection AVR Built-in Macros
19582
19583 GCC defines several built-in macros so that the user code can test
19584 for the presence or absence of features. Almost any of the following
19585 built-in macros are deduced from device capabilities and thus
19586 triggered by the @option{-mmcu=} command-line option.
19587
19588 For even more AVR-specific built-in macros see
19589 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
19590
19591 @table @code
19592
19593 @item __AVR_ARCH__
19594 Build-in macro that resolves to a decimal number that identifies the
19595 architecture and depends on the @option{-mmcu=@var{mcu}} option.
19596 Possible values are:
19597
19598 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
19599 @code{4}, @code{5}, @code{51}, @code{6}
19600
19601 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
19602 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
19603
19604 respectively and
19605
19606 @code{100},
19607 @code{102}, @code{103}, @code{104},
19608 @code{105}, @code{106}, @code{107}
19609
19610 for @var{mcu}=@code{avrtiny},
19611 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
19612 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
19613 If @var{mcu} specifies a device, this built-in macro is set
19614 accordingly. For example, with @option{-mmcu=atmega8} the macro is
19615 defined to @code{4}.
19616
19617 @item __AVR_@var{Device}__
19618 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
19619 the device's name. For example, @option{-mmcu=atmega8} defines the
19620 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
19621 @code{__AVR_ATtiny261A__}, etc.
19622
19623 The built-in macros' names follow
19624 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
19625 the device name as from the AVR user manual. The difference between
19626 @var{Device} in the built-in macro and @var{device} in
19627 @option{-mmcu=@var{device}} is that the latter is always lowercase.
19628
19629 If @var{device} is not a device but only a core architecture like
19630 @samp{avr51}, this macro is not defined.
19631
19632 @item __AVR_DEVICE_NAME__
19633 Setting @option{-mmcu=@var{device}} defines this built-in macro to
19634 the device's name. For example, with @option{-mmcu=atmega8} the macro
19635 is defined to @code{atmega8}.
19636
19637 If @var{device} is not a device but only a core architecture like
19638 @samp{avr51}, this macro is not defined.
19639
19640 @item __AVR_XMEGA__
19641 The device / architecture belongs to the XMEGA family of devices.
19642
19643 @item __AVR_HAVE_ELPM__
19644 The device has the @code{ELPM} instruction.
19645
19646 @item __AVR_HAVE_ELPMX__
19647 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
19648 R@var{n},Z+} instructions.
19649
19650 @item __AVR_HAVE_MOVW__
19651 The device has the @code{MOVW} instruction to perform 16-bit
19652 register-register moves.
19653
19654 @item __AVR_HAVE_LPMX__
19655 The device has the @code{LPM R@var{n},Z} and
19656 @code{LPM R@var{n},Z+} instructions.
19657
19658 @item __AVR_HAVE_MUL__
19659 The device has a hardware multiplier.
19660
19661 @item __AVR_HAVE_JMP_CALL__
19662 The device has the @code{JMP} and @code{CALL} instructions.
19663 This is the case for devices with more than 8@tie{}KiB of program
19664 memory.
19665
19666 @item __AVR_HAVE_EIJMP_EICALL__
19667 @itemx __AVR_3_BYTE_PC__
19668 The device has the @code{EIJMP} and @code{EICALL} instructions.
19669 This is the case for devices with more than 128@tie{}KiB of program memory.
19670 This also means that the program counter
19671 (PC) is 3@tie{}bytes wide.
19672
19673 @item __AVR_2_BYTE_PC__
19674 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
19675 with up to 128@tie{}KiB of program memory.
19676
19677 @item __AVR_HAVE_8BIT_SP__
19678 @itemx __AVR_HAVE_16BIT_SP__
19679 The stack pointer (SP) register is treated as 8-bit respectively
19680 16-bit register by the compiler.
19681 The definition of these macros is affected by @option{-mtiny-stack}.
19682
19683 @item __AVR_HAVE_SPH__
19684 @itemx __AVR_SP8__
19685 The device has the SPH (high part of stack pointer) special function
19686 register or has an 8-bit stack pointer, respectively.
19687 The definition of these macros is affected by @option{-mmcu=} and
19688 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
19689 by @option{-msp8}.
19690
19691 @item __AVR_HAVE_RAMPD__
19692 @itemx __AVR_HAVE_RAMPX__
19693 @itemx __AVR_HAVE_RAMPY__
19694 @itemx __AVR_HAVE_RAMPZ__
19695 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
19696 @code{RAMPZ} special function register, respectively.
19697
19698 @item __NO_INTERRUPTS__
19699 This macro reflects the @option{-mno-interrupts} command-line option.
19700
19701 @item __AVR_ERRATA_SKIP__
19702 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
19703 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19704 instructions because of a hardware erratum. Skip instructions are
19705 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
19706 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
19707 set.
19708
19709 @item __AVR_ISA_RMW__
19710 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
19711
19712 @item __AVR_SFR_OFFSET__=@var{offset}
19713 Instructions that can address I/O special function registers directly
19714 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
19715 address as if addressed by an instruction to access RAM like @code{LD}
19716 or @code{STS}. This offset depends on the device architecture and has
19717 to be subtracted from the RAM address in order to get the
19718 respective I/O@tie{}address.
19719
19720 @item __AVR_SHORT_CALLS__
19721 The @option{-mshort-calls} command line option is set.
19722
19723 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
19724 Some devices support reading from flash memory by means of @code{LD*}
19725 instructions. The flash memory is seen in the data address space
19726 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
19727 is not defined, this feature is not available. If defined,
19728 the address space is linear and there is no need to put
19729 @code{.rodata} into RAM. This is handled by the default linker
19730 description file, and is currently available for
19731 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
19732 there is no need to use address spaces like @code{__flash} or
19733 features like attribute @code{progmem} and @code{pgm_read_*}.
19734
19735 @item __WITH_AVRLIBC__
19736 The compiler is configured to be used together with AVR-Libc.
19737 See the @option{--with-avrlibc} configure option.
19738
19739 @item __HAVE_DOUBLE_MULTILIB__
19740 Defined if @option{-mdouble=} acts as a multilib option.
19741
19742 @item __HAVE_DOUBLE32__
19743 @itemx __HAVE_DOUBLE64__
19744 Defined if the compiler supports 32-bit double resp. 64-bit double.
19745 The actual layout is specified by option @option{-mdouble=}.
19746
19747 @item __DEFAULT_DOUBLE__
19748 The size in bits of @code{double} if @option{-mdouble=} is not set.
19749 To test the layout of @code{double} in a program, use the built-in
19750 macro @code{__SIZEOF_DOUBLE__}.
19751
19752 @item __HAVE_LONG_DOUBLE32__
19753 @itemx __HAVE_LONG_DOUBLE64__
19754 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
19755 @itemx __DEFAULT_LONG_DOUBLE__
19756 Same as above, but for @code{long double} instead of @code{double}.
19757
19758 @item __WITH_DOUBLE_COMPARISON__
19759 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
19760 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
19761 and is defined to @code{2} or @code{3}.
19762
19763 @item __WITH_LIBF7_LIBGCC__
19764 @itemx __WITH_LIBF7_MATH__
19765 @itemx __WITH_LIBF7_MATH_SYMBOLS__
19766 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
19767 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
19768
19769 @end table
19770
19771 @node Blackfin Options
19772 @subsection Blackfin Options
19773 @cindex Blackfin Options
19774
19775 @table @gcctabopt
19776 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
19777 @opindex mcpu=
19778 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
19779 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
19780 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
19781 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
19782 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
19783 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
19784 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
19785 @samp{bf561}, @samp{bf592}.
19786
19787 The optional @var{sirevision} specifies the silicon revision of the target
19788 Blackfin processor. Any workarounds available for the targeted silicon revision
19789 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
19790 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
19791 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
19792 hexadecimal digits representing the major and minor numbers in the silicon
19793 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
19794 is not defined. If @var{sirevision} is @samp{any}, the
19795 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
19796 If this optional @var{sirevision} is not used, GCC assumes the latest known
19797 silicon revision of the targeted Blackfin processor.
19798
19799 GCC defines a preprocessor macro for the specified @var{cpu}.
19800 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
19801 provided by libgloss to be linked in if @option{-msim} is not given.
19802
19803 Without this option, @samp{bf532} is used as the processor by default.
19804
19805 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
19806 only the preprocessor macro is defined.
19807
19808 @item -msim
19809 @opindex msim
19810 Specifies that the program will be run on the simulator. This causes
19811 the simulator BSP provided by libgloss to be linked in. This option
19812 has effect only for @samp{bfin-elf} toolchain.
19813 Certain other options, such as @option{-mid-shared-library} and
19814 @option{-mfdpic}, imply @option{-msim}.
19815
19816 @item -momit-leaf-frame-pointer
19817 @opindex momit-leaf-frame-pointer
19818 Don't keep the frame pointer in a register for leaf functions. This
19819 avoids the instructions to save, set up and restore frame pointers and
19820 makes an extra register available in leaf functions.
19821
19822 @item -mspecld-anomaly
19823 @opindex mspecld-anomaly
19824 When enabled, the compiler ensures that the generated code does not
19825 contain speculative loads after jump instructions. If this option is used,
19826 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
19827
19828 @item -mno-specld-anomaly
19829 @opindex mno-specld-anomaly
19830 @opindex mspecld-anomaly
19831 Don't generate extra code to prevent speculative loads from occurring.
19832
19833 @item -mcsync-anomaly
19834 @opindex mcsync-anomaly
19835 When enabled, the compiler ensures that the generated code does not
19836 contain CSYNC or SSYNC instructions too soon after conditional branches.
19837 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
19838
19839 @item -mno-csync-anomaly
19840 @opindex mno-csync-anomaly
19841 @opindex mcsync-anomaly
19842 Don't generate extra code to prevent CSYNC or SSYNC instructions from
19843 occurring too soon after a conditional branch.
19844
19845 @item -mlow64k
19846 @opindex mlow64k
19847 When enabled, the compiler is free to take advantage of the knowledge that
19848 the entire program fits into the low 64k of memory.
19849
19850 @item -mno-low64k
19851 @opindex mno-low64k
19852 Assume that the program is arbitrarily large. This is the default.
19853
19854 @item -mstack-check-l1
19855 @opindex mstack-check-l1
19856 Do stack checking using information placed into L1 scratchpad memory by the
19857 uClinux kernel.
19858
19859 @item -mid-shared-library
19860 @opindex mid-shared-library
19861 Generate code that supports shared libraries via the library ID method.
19862 This allows for execute in place and shared libraries in an environment
19863 without virtual memory management. This option implies @option{-fPIC}.
19864 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19865
19866 @item -mno-id-shared-library
19867 @opindex mno-id-shared-library
19868 @opindex mid-shared-library
19869 Generate code that doesn't assume ID-based shared libraries are being used.
19870 This is the default.
19871
19872 @item -mleaf-id-shared-library
19873 @opindex mleaf-id-shared-library
19874 Generate code that supports shared libraries via the library ID method,
19875 but assumes that this library or executable won't link against any other
19876 ID shared libraries. That allows the compiler to use faster code for jumps
19877 and calls.
19878
19879 @item -mno-leaf-id-shared-library
19880 @opindex mno-leaf-id-shared-library
19881 @opindex mleaf-id-shared-library
19882 Do not assume that the code being compiled won't link against any ID shared
19883 libraries. Slower code is generated for jump and call insns.
19884
19885 @item -mshared-library-id=n
19886 @opindex mshared-library-id
19887 Specifies the identification number of the ID-based shared library being
19888 compiled. Specifying a value of 0 generates more compact code; specifying
19889 other values forces the allocation of that number to the current
19890 library but is no more space- or time-efficient than omitting this option.
19891
19892 @item -msep-data
19893 @opindex msep-data
19894 Generate code that allows the data segment to be located in a different
19895 area of memory from the text segment. This allows for execute in place in
19896 an environment without virtual memory management by eliminating relocations
19897 against the text section.
19898
19899 @item -mno-sep-data
19900 @opindex mno-sep-data
19901 @opindex msep-data
19902 Generate code that assumes that the data segment follows the text segment.
19903 This is the default.
19904
19905 @item -mlong-calls
19906 @itemx -mno-long-calls
19907 @opindex mlong-calls
19908 @opindex mno-long-calls
19909 Tells the compiler to perform function calls by first loading the
19910 address of the function into a register and then performing a subroutine
19911 call on this register. This switch is needed if the target function
19912 lies outside of the 24-bit addressing range of the offset-based
19913 version of subroutine call instruction.
19914
19915 This feature is not enabled by default. Specifying
19916 @option{-mno-long-calls} restores the default behavior. Note these
19917 switches have no effect on how the compiler generates code to handle
19918 function calls via function pointers.
19919
19920 @item -mfast-fp
19921 @opindex mfast-fp
19922 Link with the fast floating-point library. This library relaxes some of
19923 the IEEE floating-point standard's rules for checking inputs against
19924 Not-a-Number (NAN), in the interest of performance.
19925
19926 @item -minline-plt
19927 @opindex minline-plt
19928 Enable inlining of PLT entries in function calls to functions that are
19929 not known to bind locally. It has no effect without @option{-mfdpic}.
19930
19931 @item -mmulticore
19932 @opindex mmulticore
19933 Build a standalone application for multicore Blackfin processors.
19934 This option causes proper start files and link scripts supporting
19935 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
19936 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
19937
19938 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
19939 selects the one-application-per-core programming model. Without
19940 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
19941 programming model is used. In this model, the main function of Core B
19942 should be named as @code{coreb_main}.
19943
19944 If this option is not used, the single-core application programming
19945 model is used.
19946
19947 @item -mcorea
19948 @opindex mcorea
19949 Build a standalone application for Core A of BF561 when using
19950 the one-application-per-core programming model. Proper start files
19951 and link scripts are used to support Core A, and the macro
19952 @code{__BFIN_COREA} is defined.
19953 This option can only be used in conjunction with @option{-mmulticore}.
19954
19955 @item -mcoreb
19956 @opindex mcoreb
19957 Build a standalone application for Core B of BF561 when using
19958 the one-application-per-core programming model. Proper start files
19959 and link scripts are used to support Core B, and the macro
19960 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
19961 should be used instead of @code{main}.
19962 This option can only be used in conjunction with @option{-mmulticore}.
19963
19964 @item -msdram
19965 @opindex msdram
19966 Build a standalone application for SDRAM. Proper start files and
19967 link scripts are used to put the application into SDRAM, and the macro
19968 @code{__BFIN_SDRAM} is defined.
19969 The loader should initialize SDRAM before loading the application.
19970
19971 @item -micplb
19972 @opindex micplb
19973 Assume that ICPLBs are enabled at run time. This has an effect on certain
19974 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
19975 are enabled; for standalone applications the default is off.
19976 @end table
19977
19978 @node C6X Options
19979 @subsection C6X Options
19980 @cindex C6X Options
19981
19982 @table @gcctabopt
19983 @item -march=@var{name}
19984 @opindex march
19985 This specifies the name of the target architecture. GCC uses this
19986 name to determine what kind of instructions it can emit when generating
19987 assembly code. Permissible names are: @samp{c62x},
19988 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
19989
19990 @item -mbig-endian
19991 @opindex mbig-endian
19992 Generate code for a big-endian target.
19993
19994 @item -mlittle-endian
19995 @opindex mlittle-endian
19996 Generate code for a little-endian target. This is the default.
19997
19998 @item -msim
19999 @opindex msim
20000 Choose startup files and linker script suitable for the simulator.
20001
20002 @item -msdata=default
20003 @opindex msdata=default
20004 Put small global and static data in the @code{.neardata} section,
20005 which is pointed to by register @code{B14}. Put small uninitialized
20006 global and static data in the @code{.bss} section, which is adjacent
20007 to the @code{.neardata} section. Put small read-only data into the
20008 @code{.rodata} section. The corresponding sections used for large
20009 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
20010
20011 @item -msdata=all
20012 @opindex msdata=all
20013 Put all data, not just small objects, into the sections reserved for
20014 small data, and use addressing relative to the @code{B14} register to
20015 access them.
20016
20017 @item -msdata=none
20018 @opindex msdata=none
20019 Make no use of the sections reserved for small data, and use absolute
20020 addresses to access all data. Put all initialized global and static
20021 data in the @code{.fardata} section, and all uninitialized data in the
20022 @code{.far} section. Put all constant data into the @code{.const}
20023 section.
20024 @end table
20025
20026 @node CRIS Options
20027 @subsection CRIS Options
20028 @cindex CRIS Options
20029
20030 These options are defined specifically for the CRIS ports.
20031
20032 @table @gcctabopt
20033 @item -march=@var{architecture-type}
20034 @itemx -mcpu=@var{architecture-type}
20035 @opindex march
20036 @opindex mcpu
20037 Generate code for the specified architecture. The choices for
20038 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
20039 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
20040 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
20041 @samp{v10}.
20042
20043 @item -mtune=@var{architecture-type}
20044 @opindex mtune
20045 Tune to @var{architecture-type} everything applicable about the generated
20046 code, except for the ABI and the set of available instructions. The
20047 choices for @var{architecture-type} are the same as for
20048 @option{-march=@var{architecture-type}}.
20049
20050 @item -mmax-stack-frame=@var{n}
20051 @opindex mmax-stack-frame
20052 Warn when the stack frame of a function exceeds @var{n} bytes.
20053
20054 @item -metrax4
20055 @itemx -metrax100
20056 @opindex metrax4
20057 @opindex metrax100
20058 The options @option{-metrax4} and @option{-metrax100} are synonyms for
20059 @option{-march=v3} and @option{-march=v8} respectively.
20060
20061 @item -mmul-bug-workaround
20062 @itemx -mno-mul-bug-workaround
20063 @opindex mmul-bug-workaround
20064 @opindex mno-mul-bug-workaround
20065 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
20066 models where it applies. This option is active by default.
20067
20068 @item -mpdebug
20069 @opindex mpdebug
20070 Enable CRIS-specific verbose debug-related information in the assembly
20071 code. This option also has the effect of turning off the @samp{#NO_APP}
20072 formatted-code indicator to the assembler at the beginning of the
20073 assembly file.
20074
20075 @item -mcc-init
20076 @opindex mcc-init
20077 Do not use condition-code results from previous instruction; always emit
20078 compare and test instructions before use of condition codes.
20079
20080 @item -mno-side-effects
20081 @opindex mno-side-effects
20082 @opindex mside-effects
20083 Do not emit instructions with side effects in addressing modes other than
20084 post-increment.
20085
20086 @item -mstack-align
20087 @itemx -mno-stack-align
20088 @itemx -mdata-align
20089 @itemx -mno-data-align
20090 @itemx -mconst-align
20091 @itemx -mno-const-align
20092 @opindex mstack-align
20093 @opindex mno-stack-align
20094 @opindex mdata-align
20095 @opindex mno-data-align
20096 @opindex mconst-align
20097 @opindex mno-const-align
20098 These options (@samp{no-} options) arrange (eliminate arrangements) for the
20099 stack frame, individual data and constants to be aligned for the maximum
20100 single data access size for the chosen CPU model. The default is to
20101 arrange for 32-bit alignment. ABI details such as structure layout are
20102 not affected by these options.
20103
20104 @item -m32-bit
20105 @itemx -m16-bit
20106 @itemx -m8-bit
20107 @opindex m32-bit
20108 @opindex m16-bit
20109 @opindex m8-bit
20110 Similar to the stack- data- and const-align options above, these options
20111 arrange for stack frame, writable data and constants to all be 32-bit,
20112 16-bit or 8-bit aligned. The default is 32-bit alignment.
20113
20114 @item -mno-prologue-epilogue
20115 @itemx -mprologue-epilogue
20116 @opindex mno-prologue-epilogue
20117 @opindex mprologue-epilogue
20118 With @option{-mno-prologue-epilogue}, the normal function prologue and
20119 epilogue which set up the stack frame are omitted and no return
20120 instructions or return sequences are generated in the code. Use this
20121 option only together with visual inspection of the compiled code: no
20122 warnings or errors are generated when call-saved registers must be saved,
20123 or storage for local variables needs to be allocated.
20124
20125 @item -mno-gotplt
20126 @itemx -mgotplt
20127 @opindex mno-gotplt
20128 @opindex mgotplt
20129 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
20130 instruction sequences that load addresses for functions from the PLT part
20131 of the GOT rather than (traditional on other architectures) calls to the
20132 PLT@. The default is @option{-mgotplt}.
20133
20134 @item -melf
20135 @opindex melf
20136 Legacy no-op option only recognized with the cris-axis-elf and
20137 cris-axis-linux-gnu targets.
20138
20139 @item -mlinux
20140 @opindex mlinux
20141 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20142
20143 @item -sim
20144 @opindex sim
20145 This option, recognized for the cris-axis-elf, arranges
20146 to link with input-output functions from a simulator library. Code,
20147 initialized data and zero-initialized data are allocated consecutively.
20148
20149 @item -sim2
20150 @opindex sim2
20151 Like @option{-sim}, but pass linker options to locate initialized data at
20152 0x40000000 and zero-initialized data at 0x80000000.
20153 @end table
20154
20155 @node CR16 Options
20156 @subsection CR16 Options
20157 @cindex CR16 Options
20158
20159 These options are defined specifically for the CR16 ports.
20160
20161 @table @gcctabopt
20162
20163 @item -mmac
20164 @opindex mmac
20165 Enable the use of multiply-accumulate instructions. Disabled by default.
20166
20167 @item -mcr16cplus
20168 @itemx -mcr16c
20169 @opindex mcr16cplus
20170 @opindex mcr16c
20171 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
20172 is default.
20173
20174 @item -msim
20175 @opindex msim
20176 Links the library libsim.a which is in compatible with simulator. Applicable
20177 to ELF compiler only.
20178
20179 @item -mint32
20180 @opindex mint32
20181 Choose integer type as 32-bit wide.
20182
20183 @item -mbit-ops
20184 @opindex mbit-ops
20185 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20186
20187 @item -mdata-model=@var{model}
20188 @opindex mdata-model
20189 Choose a data model. The choices for @var{model} are @samp{near},
20190 @samp{far} or @samp{medium}. @samp{medium} is default.
20191 However, @samp{far} is not valid with @option{-mcr16c}, as the
20192 CR16C architecture does not support the far data model.
20193 @end table
20194
20195 @node C-SKY Options
20196 @subsection C-SKY Options
20197 @cindex C-SKY Options
20198
20199 GCC supports these options when compiling for C-SKY V2 processors.
20200
20201 @table @gcctabopt
20202
20203 @item -march=@var{arch}
20204 @opindex march=
20205 Specify the C-SKY target architecture. Valid values for @var{arch} are:
20206 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20207 The default is @samp{ck810}.
20208
20209 @item -mcpu=@var{cpu}
20210 @opindex mcpu=
20211 Specify the C-SKY target processor. Valid values for @var{cpu} are:
20212 @samp{ck801}, @samp{ck801t},
20213 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
20214 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20215 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20216 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20217 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20218 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20219 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20220 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20221 @samp{ck803eftr1}, @samp{ck803efhtr1},
20222 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20223 @samp{ck803sef}, @samp{ck803seft},
20224 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20225 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20226 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20227 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20228
20229 @item -mbig-endian
20230 @opindex mbig-endian
20231 @itemx -EB
20232 @opindex EB
20233 @itemx -mlittle-endian
20234 @opindex mlittle-endian
20235 @itemx -EL
20236 @opindex EL
20237
20238 Select big- or little-endian code. The default is little-endian.
20239
20240 @item -mhard-float
20241 @opindex mhard-float
20242 @itemx -msoft-float
20243 @opindex msoft-float
20244
20245 Select hardware or software floating-point implementations.
20246 The default is soft float.
20247
20248 @item -mdouble-float
20249 @itemx -mno-double-float
20250 @opindex mdouble-float
20251 When @option{-mhard-float} is in effect, enable generation of
20252 double-precision float instructions. This is the default except
20253 when compiling for CK803.
20254
20255 @item -mfdivdu
20256 @itemx -mno-fdivdu
20257 @opindex mfdivdu
20258 When @option{-mhard-float} is in effect, enable generation of
20259 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20260 This is the default except when compiling for CK803.
20261
20262 @item -mfpu=@var{fpu}
20263 @opindex mfpu=
20264 Select the floating-point processor. This option can only be used with
20265 @option{-mhard-float}.
20266 Values for @var{fpu} are
20267 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20268 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20269 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20270
20271 @item -melrw
20272 @itemx -mno-elrw
20273 @opindex melrw
20274 Enable the extended @code{lrw} instruction. This option defaults to on
20275 for CK801 and off otherwise.
20276
20277 @item -mistack
20278 @itemx -mno-istack
20279 @opindex mistack
20280 Enable interrupt stack instructions; the default is off.
20281
20282 The @option{-mistack} option is required to handle the
20283 @code{interrupt} and @code{isr} function attributes
20284 (@pxref{C-SKY Function Attributes}).
20285
20286 @item -mmp
20287 @opindex mmp
20288 Enable multiprocessor instructions; the default is off.
20289
20290 @item -mcp
20291 @opindex mcp
20292 Enable coprocessor instructions; the default is off.
20293
20294 @item -mcache
20295 @opindex mcache
20296 Enable coprocessor instructions; the default is off.
20297
20298 @item -msecurity
20299 @opindex msecurity
20300 Enable C-SKY security instructions; the default is off.
20301
20302 @item -mtrust
20303 @opindex mtrust
20304 Enable C-SKY trust instructions; the default is off.
20305
20306 @item -mdsp
20307 @opindex mdsp
20308 @itemx -medsp
20309 @opindex medsp
20310 @itemx -mvdsp
20311 @opindex mvdsp
20312 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20313 All of these options default to off.
20314
20315 @item -mdiv
20316 @itemx -mno-div
20317 @opindex mdiv
20318 Generate divide instructions. Default is off.
20319
20320 @item -msmart
20321 @itemx -mno-smart
20322 @opindex msmart
20323 Generate code for Smart Mode, using only registers numbered 0-7 to allow
20324 use of 16-bit instructions. This option is ignored for CK801 where this
20325 is the required behavior, and it defaults to on for CK802.
20326 For other targets, the default is off.
20327
20328 @item -mhigh-registers
20329 @itemx -mno-high-registers
20330 @opindex mhigh-registers
20331 Generate code using the high registers numbered 16-31. This option
20332 is not supported on CK801, CK802, or CK803, and is enabled by default
20333 for other processors.
20334
20335 @item -manchor
20336 @itemx -mno-anchor
20337 @opindex manchor
20338 Generate code using global anchor symbol addresses.
20339
20340 @item -mpushpop
20341 @itemx -mno-pushpop
20342 @opindex mpushpop
20343 Generate code using @code{push} and @code{pop} instructions. This option
20344 defaults to on.
20345
20346 @item -mmultiple-stld
20347 @itemx -mstm
20348 @itemx -mno-multiple-stld
20349 @itemx -mno-stm
20350 @opindex mmultiple-stld
20351 Generate code using @code{stm} and @code{ldm} instructions. This option
20352 isn't supported on CK801 but is enabled by default on other processors.
20353
20354 @item -mconstpool
20355 @itemx -mno-constpool
20356 @opindex mconstpool
20357 Create constant pools in the compiler instead of deferring it to the
20358 assembler. This option is the default and required for correct code
20359 generation on CK801 and CK802, and is optional on other processors.
20360
20361 @item -mstack-size
20362 @item -mno-stack-size
20363 @opindex mstack-size
20364 Emit @code{.stack_size} directives for each function in the assembly
20365 output. This option defaults to off.
20366
20367 @item -mccrt
20368 @itemx -mno-ccrt
20369 @opindex mccrt
20370 Generate code for the C-SKY compiler runtime instead of libgcc. This
20371 option defaults to off.
20372
20373 @item -mbranch-cost=@var{n}
20374 @opindex mbranch-cost=
20375 Set the branch costs to roughly @code{n} instructions. The default is 1.
20376
20377 @item -msched-prolog
20378 @itemx -mno-sched-prolog
20379 @opindex msched-prolog
20380 Permit scheduling of function prologue and epilogue sequences. Using
20381 this option can result in code that is not compliant with the C-SKY V2 ABI
20382 prologue requirements and that cannot be debugged or backtraced.
20383 It is disabled by default.
20384
20385 @end table
20386
20387 @node Darwin Options
20388 @subsection Darwin Options
20389 @cindex Darwin options
20390
20391 These options are defined for all architectures running the Darwin operating
20392 system.
20393
20394 FSF GCC on Darwin does not create ``fat'' object files; it creates
20395 an object file for the single architecture that GCC was built to
20396 target. Apple's GCC on Darwin does create ``fat'' files if multiple
20397 @option{-arch} options are used; it does so by running the compiler or
20398 linker multiple times and joining the results together with
20399 @file{lipo}.
20400
20401 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20402 @samp{i686}) is determined by the flags that specify the ISA
20403 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
20404 @option{-force_cpusubtype_ALL} option can be used to override this.
20405
20406 The Darwin tools vary in their behavior when presented with an ISA
20407 mismatch. The assembler, @file{as}, only permits instructions to
20408 be used that are valid for the subtype of the file it is generating,
20409 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20410 The linker for shared libraries, @file{/usr/bin/libtool}, fails
20411 and prints an error if asked to create a shared library with a less
20412 restrictive subtype than its input files (for instance, trying to put
20413 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
20414 for executables, @command{ld}, quietly gives the executable the most
20415 restrictive subtype of any of its input files.
20416
20417 @table @gcctabopt
20418 @item -F@var{dir}
20419 @opindex F
20420 Add the framework directory @var{dir} to the head of the list of
20421 directories to be searched for header files. These directories are
20422 interleaved with those specified by @option{-I} options and are
20423 scanned in a left-to-right order.
20424
20425 A framework directory is a directory with frameworks in it. A
20426 framework is a directory with a @file{Headers} and/or
20427 @file{PrivateHeaders} directory contained directly in it that ends
20428 in @file{.framework}. The name of a framework is the name of this
20429 directory excluding the @file{.framework}. Headers associated with
20430 the framework are found in one of those two directories, with
20431 @file{Headers} being searched first. A subframework is a framework
20432 directory that is in a framework's @file{Frameworks} directory.
20433 Includes of subframework headers can only appear in a header of a
20434 framework that contains the subframework, or in a sibling subframework
20435 header. Two subframeworks are siblings if they occur in the same
20436 framework. A subframework should not have the same name as a
20437 framework; a warning is issued if this is violated. Currently a
20438 subframework cannot have subframeworks; in the future, the mechanism
20439 may be extended to support this. The standard frameworks can be found
20440 in @file{/System/Library/Frameworks} and
20441 @file{/Library/Frameworks}. An example include looks like
20442 @code{#include <Framework/header.h>}, where @file{Framework} denotes
20443 the name of the framework and @file{header.h} is found in the
20444 @file{PrivateHeaders} or @file{Headers} directory.
20445
20446 @item -iframework@var{dir}
20447 @opindex iframework
20448 Like @option{-F} except the directory is a treated as a system
20449 directory. The main difference between this @option{-iframework} and
20450 @option{-F} is that with @option{-iframework} the compiler does not
20451 warn about constructs contained within header files found via
20452 @var{dir}. This option is valid only for the C family of languages.
20453
20454 @item -gused
20455 @opindex gused
20456 Emit debugging information for symbols that are used. For stabs
20457 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20458 This is by default ON@.
20459
20460 @item -gfull
20461 @opindex gfull
20462 Emit debugging information for all symbols and types.
20463
20464 @item -mmacosx-version-min=@var{version}
20465 The earliest version of MacOS X that this executable will run on
20466 is @var{version}. Typical values of @var{version} include @code{10.1},
20467 @code{10.2}, and @code{10.3.9}.
20468
20469 If the compiler was built to use the system's headers by default,
20470 then the default for this option is the system version on which the
20471 compiler is running, otherwise the default is to make choices that
20472 are compatible with as many systems and code bases as possible.
20473
20474 @item -mkernel
20475 @opindex mkernel
20476 Enable kernel development mode. The @option{-mkernel} option sets
20477 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20478 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20479 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20480 applicable. This mode also sets @option{-mno-altivec},
20481 @option{-msoft-float}, @option{-fno-builtin} and
20482 @option{-mlong-branch} for PowerPC targets.
20483
20484 @item -mone-byte-bool
20485 @opindex mone-byte-bool
20486 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20487 By default @code{sizeof(bool)} is @code{4} when compiling for
20488 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20489 option has no effect on x86.
20490
20491 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20492 to generate code that is not binary compatible with code generated
20493 without that switch. Using this switch may require recompiling all
20494 other modules in a program, including system libraries. Use this
20495 switch to conform to a non-default data model.
20496
20497 @item -mfix-and-continue
20498 @itemx -ffix-and-continue
20499 @itemx -findirect-data
20500 @opindex mfix-and-continue
20501 @opindex ffix-and-continue
20502 @opindex findirect-data
20503 Generate code suitable for fast turnaround development, such as to
20504 allow GDB to dynamically load @file{.o} files into already-running
20505 programs. @option{-findirect-data} and @option{-ffix-and-continue}
20506 are provided for backwards compatibility.
20507
20508 @item -all_load
20509 @opindex all_load
20510 Loads all members of static archive libraries.
20511 See man ld(1) for more information.
20512
20513 @item -arch_errors_fatal
20514 @opindex arch_errors_fatal
20515 Cause the errors having to do with files that have the wrong architecture
20516 to be fatal.
20517
20518 @item -bind_at_load
20519 @opindex bind_at_load
20520 Causes the output file to be marked such that the dynamic linker will
20521 bind all undefined references when the file is loaded or launched.
20522
20523 @item -bundle
20524 @opindex bundle
20525 Produce a Mach-o bundle format file.
20526 See man ld(1) for more information.
20527
20528 @item -bundle_loader @var{executable}
20529 @opindex bundle_loader
20530 This option specifies the @var{executable} that will load the build
20531 output file being linked. See man ld(1) for more information.
20532
20533 @item -dynamiclib
20534 @opindex dynamiclib
20535 When passed this option, GCC produces a dynamic library instead of
20536 an executable when linking, using the Darwin @file{libtool} command.
20537
20538 @item -force_cpusubtype_ALL
20539 @opindex force_cpusubtype_ALL
20540 This causes GCC's output file to have the @samp{ALL} subtype, instead of
20541 one controlled by the @option{-mcpu} or @option{-march} option.
20542
20543 @item -allowable_client @var{client_name}
20544 @itemx -client_name
20545 @itemx -compatibility_version
20546 @itemx -current_version
20547 @itemx -dead_strip
20548 @itemx -dependency-file
20549 @itemx -dylib_file
20550 @itemx -dylinker_install_name
20551 @itemx -dynamic
20552 @itemx -exported_symbols_list
20553 @itemx -filelist
20554 @need 800
20555 @itemx -flat_namespace
20556 @itemx -force_flat_namespace
20557 @itemx -headerpad_max_install_names
20558 @itemx -image_base
20559 @itemx -init
20560 @itemx -install_name
20561 @itemx -keep_private_externs
20562 @itemx -multi_module
20563 @itemx -multiply_defined
20564 @itemx -multiply_defined_unused
20565 @need 800
20566 @itemx -noall_load
20567 @itemx -no_dead_strip_inits_and_terms
20568 @itemx -nofixprebinding
20569 @itemx -nomultidefs
20570 @itemx -noprebind
20571 @itemx -noseglinkedit
20572 @itemx -pagezero_size
20573 @itemx -prebind
20574 @itemx -prebind_all_twolevel_modules
20575 @itemx -private_bundle
20576 @need 800
20577 @itemx -read_only_relocs
20578 @itemx -sectalign
20579 @itemx -sectobjectsymbols
20580 @itemx -whyload
20581 @itemx -seg1addr
20582 @itemx -sectcreate
20583 @itemx -sectobjectsymbols
20584 @itemx -sectorder
20585 @itemx -segaddr
20586 @itemx -segs_read_only_addr
20587 @need 800
20588 @itemx -segs_read_write_addr
20589 @itemx -seg_addr_table
20590 @itemx -seg_addr_table_filename
20591 @itemx -seglinkedit
20592 @itemx -segprot
20593 @itemx -segs_read_only_addr
20594 @itemx -segs_read_write_addr
20595 @itemx -single_module
20596 @itemx -static
20597 @itemx -sub_library
20598 @need 800
20599 @itemx -sub_umbrella
20600 @itemx -twolevel_namespace
20601 @itemx -umbrella
20602 @itemx -undefined
20603 @itemx -unexported_symbols_list
20604 @itemx -weak_reference_mismatches
20605 @itemx -whatsloaded
20606 @opindex allowable_client
20607 @opindex client_name
20608 @opindex compatibility_version
20609 @opindex current_version
20610 @opindex dead_strip
20611 @opindex dependency-file
20612 @opindex dylib_file
20613 @opindex dylinker_install_name
20614 @opindex dynamic
20615 @opindex exported_symbols_list
20616 @opindex filelist
20617 @opindex flat_namespace
20618 @opindex force_flat_namespace
20619 @opindex headerpad_max_install_names
20620 @opindex image_base
20621 @opindex init
20622 @opindex install_name
20623 @opindex keep_private_externs
20624 @opindex multi_module
20625 @opindex multiply_defined
20626 @opindex multiply_defined_unused
20627 @opindex noall_load
20628 @opindex no_dead_strip_inits_and_terms
20629 @opindex nofixprebinding
20630 @opindex nomultidefs
20631 @opindex noprebind
20632 @opindex noseglinkedit
20633 @opindex pagezero_size
20634 @opindex prebind
20635 @opindex prebind_all_twolevel_modules
20636 @opindex private_bundle
20637 @opindex read_only_relocs
20638 @opindex sectalign
20639 @opindex sectobjectsymbols
20640 @opindex whyload
20641 @opindex seg1addr
20642 @opindex sectcreate
20643 @opindex sectobjectsymbols
20644 @opindex sectorder
20645 @opindex segaddr
20646 @opindex segs_read_only_addr
20647 @opindex segs_read_write_addr
20648 @opindex seg_addr_table
20649 @opindex seg_addr_table_filename
20650 @opindex seglinkedit
20651 @opindex segprot
20652 @opindex segs_read_only_addr
20653 @opindex segs_read_write_addr
20654 @opindex single_module
20655 @opindex static
20656 @opindex sub_library
20657 @opindex sub_umbrella
20658 @opindex twolevel_namespace
20659 @opindex umbrella
20660 @opindex undefined
20661 @opindex unexported_symbols_list
20662 @opindex weak_reference_mismatches
20663 @opindex whatsloaded
20664 These options are passed to the Darwin linker. The Darwin linker man page
20665 describes them in detail.
20666 @end table
20667
20668 @node DEC Alpha Options
20669 @subsection DEC Alpha Options
20670
20671 These @samp{-m} options are defined for the DEC Alpha implementations:
20672
20673 @table @gcctabopt
20674 @item -mno-soft-float
20675 @itemx -msoft-float
20676 @opindex mno-soft-float
20677 @opindex msoft-float
20678 Use (do not use) the hardware floating-point instructions for
20679 floating-point operations. When @option{-msoft-float} is specified,
20680 functions in @file{libgcc.a} are used to perform floating-point
20681 operations. Unless they are replaced by routines that emulate the
20682 floating-point operations, or compiled in such a way as to call such
20683 emulations routines, these routines issue floating-point
20684 operations. If you are compiling for an Alpha without floating-point
20685 operations, you must ensure that the library is built so as not to call
20686 them.
20687
20688 Note that Alpha implementations without floating-point operations are
20689 required to have floating-point registers.
20690
20691 @item -mfp-reg
20692 @itemx -mno-fp-regs
20693 @opindex mfp-reg
20694 @opindex mno-fp-regs
20695 Generate code that uses (does not use) the floating-point register set.
20696 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
20697 register set is not used, floating-point operands are passed in integer
20698 registers as if they were integers and floating-point results are passed
20699 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
20700 so any function with a floating-point argument or return value called by code
20701 compiled with @option{-mno-fp-regs} must also be compiled with that
20702 option.
20703
20704 A typical use of this option is building a kernel that does not use,
20705 and hence need not save and restore, any floating-point registers.
20706
20707 @item -mieee
20708 @opindex mieee
20709 The Alpha architecture implements floating-point hardware optimized for
20710 maximum performance. It is mostly compliant with the IEEE floating-point
20711 standard. However, for full compliance, software assistance is
20712 required. This option generates code fully IEEE-compliant code
20713 @emph{except} that the @var{inexact-flag} is not maintained (see below).
20714 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
20715 defined during compilation. The resulting code is less efficient but is
20716 able to correctly support denormalized numbers and exceptional IEEE
20717 values such as not-a-number and plus/minus infinity. Other Alpha
20718 compilers call this option @option{-ieee_with_no_inexact}.
20719
20720 @item -mieee-with-inexact
20721 @opindex mieee-with-inexact
20722 This is like @option{-mieee} except the generated code also maintains
20723 the IEEE @var{inexact-flag}. Turning on this option causes the
20724 generated code to implement fully-compliant IEEE math. In addition to
20725 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
20726 macro. On some Alpha implementations the resulting code may execute
20727 significantly slower than the code generated by default. Since there is
20728 very little code that depends on the @var{inexact-flag}, you should
20729 normally not specify this option. Other Alpha compilers call this
20730 option @option{-ieee_with_inexact}.
20731
20732 @item -mfp-trap-mode=@var{trap-mode}
20733 @opindex mfp-trap-mode
20734 This option controls what floating-point related traps are enabled.
20735 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
20736 The trap mode can be set to one of four values:
20737
20738 @table @samp
20739 @item n
20740 This is the default (normal) setting. The only traps that are enabled
20741 are the ones that cannot be disabled in software (e.g., division by zero
20742 trap).
20743
20744 @item u
20745 In addition to the traps enabled by @samp{n}, underflow traps are enabled
20746 as well.
20747
20748 @item su
20749 Like @samp{u}, but the instructions are marked to be safe for software
20750 completion (see Alpha architecture manual for details).
20751
20752 @item sui
20753 Like @samp{su}, but inexact traps are enabled as well.
20754 @end table
20755
20756 @item -mfp-rounding-mode=@var{rounding-mode}
20757 @opindex mfp-rounding-mode
20758 Selects the IEEE rounding mode. Other Alpha compilers call this option
20759 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
20760 of:
20761
20762 @table @samp
20763 @item n
20764 Normal IEEE rounding mode. Floating-point numbers are rounded towards
20765 the nearest machine number or towards the even machine number in case
20766 of a tie.
20767
20768 @item m
20769 Round towards minus infinity.
20770
20771 @item c
20772 Chopped rounding mode. Floating-point numbers are rounded towards zero.
20773
20774 @item d
20775 Dynamic rounding mode. A field in the floating-point control register
20776 (@var{fpcr}, see Alpha architecture reference manual) controls the
20777 rounding mode in effect. The C library initializes this register for
20778 rounding towards plus infinity. Thus, unless your program modifies the
20779 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
20780 @end table
20781
20782 @item -mtrap-precision=@var{trap-precision}
20783 @opindex mtrap-precision
20784 In the Alpha architecture, floating-point traps are imprecise. This
20785 means without software assistance it is impossible to recover from a
20786 floating trap and program execution normally needs to be terminated.
20787 GCC can generate code that can assist operating system trap handlers
20788 in determining the exact location that caused a floating-point trap.
20789 Depending on the requirements of an application, different levels of
20790 precisions can be selected:
20791
20792 @table @samp
20793 @item p
20794 Program precision. This option is the default and means a trap handler
20795 can only identify which program caused a floating-point exception.
20796
20797 @item f
20798 Function precision. The trap handler can determine the function that
20799 caused a floating-point exception.
20800
20801 @item i
20802 Instruction precision. The trap handler can determine the exact
20803 instruction that caused a floating-point exception.
20804 @end table
20805
20806 Other Alpha compilers provide the equivalent options called
20807 @option{-scope_safe} and @option{-resumption_safe}.
20808
20809 @item -mieee-conformant
20810 @opindex mieee-conformant
20811 This option marks the generated code as IEEE conformant. You must not
20812 use this option unless you also specify @option{-mtrap-precision=i} and either
20813 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
20814 is to emit the line @samp{.eflag 48} in the function prologue of the
20815 generated assembly file.
20816
20817 @item -mbuild-constants
20818 @opindex mbuild-constants
20819 Normally GCC examines a 32- or 64-bit integer constant to
20820 see if it can construct it from smaller constants in two or three
20821 instructions. If it cannot, it outputs the constant as a literal and
20822 generates code to load it from the data segment at run time.
20823
20824 Use this option to require GCC to construct @emph{all} integer constants
20825 using code, even if it takes more instructions (the maximum is six).
20826
20827 You typically use this option to build a shared library dynamic
20828 loader. Itself a shared library, it must relocate itself in memory
20829 before it can find the variables and constants in its own data segment.
20830
20831 @item -mbwx
20832 @itemx -mno-bwx
20833 @itemx -mcix
20834 @itemx -mno-cix
20835 @itemx -mfix
20836 @itemx -mno-fix
20837 @itemx -mmax
20838 @itemx -mno-max
20839 @opindex mbwx
20840 @opindex mno-bwx
20841 @opindex mcix
20842 @opindex mno-cix
20843 @opindex mfix
20844 @opindex mno-fix
20845 @opindex mmax
20846 @opindex mno-max
20847 Indicate whether GCC should generate code to use the optional BWX,
20848 CIX, FIX and MAX instruction sets. The default is to use the instruction
20849 sets supported by the CPU type specified via @option{-mcpu=} option or that
20850 of the CPU on which GCC was built if none is specified.
20851
20852 @item -mfloat-vax
20853 @itemx -mfloat-ieee
20854 @opindex mfloat-vax
20855 @opindex mfloat-ieee
20856 Generate code that uses (does not use) VAX F and G floating-point
20857 arithmetic instead of IEEE single and double precision.
20858
20859 @item -mexplicit-relocs
20860 @itemx -mno-explicit-relocs
20861 @opindex mexplicit-relocs
20862 @opindex mno-explicit-relocs
20863 Older Alpha assemblers provided no way to generate symbol relocations
20864 except via assembler macros. Use of these macros does not allow
20865 optimal instruction scheduling. GNU binutils as of version 2.12
20866 supports a new syntax that allows the compiler to explicitly mark
20867 which relocations should apply to which instructions. This option
20868 is mostly useful for debugging, as GCC detects the capabilities of
20869 the assembler when it is built and sets the default accordingly.
20870
20871 @item -msmall-data
20872 @itemx -mlarge-data
20873 @opindex msmall-data
20874 @opindex mlarge-data
20875 When @option{-mexplicit-relocs} is in effect, static data is
20876 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
20877 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
20878 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
20879 16-bit relocations off of the @code{$gp} register. This limits the
20880 size of the small data area to 64KB, but allows the variables to be
20881 directly accessed via a single instruction.
20882
20883 The default is @option{-mlarge-data}. With this option the data area
20884 is limited to just below 2GB@. Programs that require more than 2GB of
20885 data must use @code{malloc} or @code{mmap} to allocate the data in the
20886 heap instead of in the program's data segment.
20887
20888 When generating code for shared libraries, @option{-fpic} implies
20889 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
20890
20891 @item -msmall-text
20892 @itemx -mlarge-text
20893 @opindex msmall-text
20894 @opindex mlarge-text
20895 When @option{-msmall-text} is used, the compiler assumes that the
20896 code of the entire program (or shared library) fits in 4MB, and is
20897 thus reachable with a branch instruction. When @option{-msmall-data}
20898 is used, the compiler can assume that all local symbols share the
20899 same @code{$gp} value, and thus reduce the number of instructions
20900 required for a function call from 4 to 1.
20901
20902 The default is @option{-mlarge-text}.
20903
20904 @item -mcpu=@var{cpu_type}
20905 @opindex mcpu
20906 Set the instruction set and instruction scheduling parameters for
20907 machine type @var{cpu_type}. You can specify either the @samp{EV}
20908 style name or the corresponding chip number. GCC supports scheduling
20909 parameters for the EV4, EV5 and EV6 family of processors and
20910 chooses the default values for the instruction set from the processor
20911 you specify. If you do not specify a processor type, GCC defaults
20912 to the processor on which the compiler was built.
20913
20914 Supported values for @var{cpu_type} are
20915
20916 @table @samp
20917 @item ev4
20918 @itemx ev45
20919 @itemx 21064
20920 Schedules as an EV4 and has no instruction set extensions.
20921
20922 @item ev5
20923 @itemx 21164
20924 Schedules as an EV5 and has no instruction set extensions.
20925
20926 @item ev56
20927 @itemx 21164a
20928 Schedules as an EV5 and supports the BWX extension.
20929
20930 @item pca56
20931 @itemx 21164pc
20932 @itemx 21164PC
20933 Schedules as an EV5 and supports the BWX and MAX extensions.
20934
20935 @item ev6
20936 @itemx 21264
20937 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
20938
20939 @item ev67
20940 @itemx 21264a
20941 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
20942 @end table
20943
20944 Native toolchains also support the value @samp{native},
20945 which selects the best architecture option for the host processor.
20946 @option{-mcpu=native} has no effect if GCC does not recognize
20947 the processor.
20948
20949 @item -mtune=@var{cpu_type}
20950 @opindex mtune
20951 Set only the instruction scheduling parameters for machine type
20952 @var{cpu_type}. The instruction set is not changed.
20953
20954 Native toolchains also support the value @samp{native},
20955 which selects the best architecture option for the host processor.
20956 @option{-mtune=native} has no effect if GCC does not recognize
20957 the processor.
20958
20959 @item -mmemory-latency=@var{time}
20960 @opindex mmemory-latency
20961 Sets the latency the scheduler should assume for typical memory
20962 references as seen by the application. This number is highly
20963 dependent on the memory access patterns used by the application
20964 and the size of the external cache on the machine.
20965
20966 Valid options for @var{time} are
20967
20968 @table @samp
20969 @item @var{number}
20970 A decimal number representing clock cycles.
20971
20972 @item L1
20973 @itemx L2
20974 @itemx L3
20975 @itemx main
20976 The compiler contains estimates of the number of clock cycles for
20977 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20978 (also called Dcache, Scache, and Bcache), as well as to main memory.
20979 Note that L3 is only valid for EV5.
20980
20981 @end table
20982 @end table
20983
20984 @node eBPF Options
20985 @subsection eBPF Options
20986 @cindex eBPF Options
20987
20988 @table @gcctabopt
20989 @item -mframe-limit=@var{bytes}
20990 This specifies the hard limit for frame sizes, in bytes. Currently,
20991 the value that can be specified should be less than or equal to
20992 @samp{32767}. Defaults to whatever limit is imposed by the version of
20993 the Linux kernel targeted.
20994
20995 @item -mkernel=@var{version}
20996 @opindex mkernel
20997 This specifies the minimum version of the kernel that will run the
20998 compiled program. GCC uses this version to determine which
20999 instructions to use, what kernel helpers to allow, etc. Currently,
21000 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
21001 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
21002 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
21003 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
21004 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
21005 @samp{5.2}, @samp{latest} and @samp{native}.
21006
21007 @item -mbig-endian
21008 @opindex mbig-endian
21009 Generate code for a big-endian target.
21010
21011 @item -mlittle-endian
21012 @opindex mlittle-endian
21013 Generate code for a little-endian target. This is the default.
21014 @end table
21015
21016 @node FR30 Options
21017 @subsection FR30 Options
21018 @cindex FR30 Options
21019
21020 These options are defined specifically for the FR30 port.
21021
21022 @table @gcctabopt
21023
21024 @item -msmall-model
21025 @opindex msmall-model
21026 Use the small address space model. This can produce smaller code, but
21027 it does assume that all symbolic values and addresses fit into a
21028 20-bit range.
21029
21030 @item -mno-lsim
21031 @opindex mno-lsim
21032 Assume that runtime support has been provided and so there is no need
21033 to include the simulator library (@file{libsim.a}) on the linker
21034 command line.
21035
21036 @end table
21037
21038 @node FT32 Options
21039 @subsection FT32 Options
21040 @cindex FT32 Options
21041
21042 These options are defined specifically for the FT32 port.
21043
21044 @table @gcctabopt
21045
21046 @item -msim
21047 @opindex msim
21048 Specifies that the program will be run on the simulator. This causes
21049 an alternate runtime startup and library to be linked.
21050 You must not use this option when generating programs that will run on
21051 real hardware; you must provide your own runtime library for whatever
21052 I/O functions are needed.
21053
21054 @item -mlra
21055 @opindex mlra
21056 Enable Local Register Allocation. This is still experimental for FT32,
21057 so by default the compiler uses standard reload.
21058
21059 @item -mnodiv
21060 @opindex mnodiv
21061 Do not use div and mod instructions.
21062
21063 @item -mft32b
21064 @opindex mft32b
21065 Enable use of the extended instructions of the FT32B processor.
21066
21067 @item -mcompress
21068 @opindex mcompress
21069 Compress all code using the Ft32B code compression scheme.
21070
21071 @item -mnopm
21072 @opindex mnopm
21073 Do not generate code that reads program memory.
21074
21075 @end table
21076
21077 @node FRV Options
21078 @subsection FRV Options
21079 @cindex FRV Options
21080
21081 @table @gcctabopt
21082 @item -mgpr-32
21083 @opindex mgpr-32
21084
21085 Only use the first 32 general-purpose registers.
21086
21087 @item -mgpr-64
21088 @opindex mgpr-64
21089
21090 Use all 64 general-purpose registers.
21091
21092 @item -mfpr-32
21093 @opindex mfpr-32
21094
21095 Use only the first 32 floating-point registers.
21096
21097 @item -mfpr-64
21098 @opindex mfpr-64
21099
21100 Use all 64 floating-point registers.
21101
21102 @item -mhard-float
21103 @opindex mhard-float
21104
21105 Use hardware instructions for floating-point operations.
21106
21107 @item -msoft-float
21108 @opindex msoft-float
21109
21110 Use library routines for floating-point operations.
21111
21112 @item -malloc-cc
21113 @opindex malloc-cc
21114
21115 Dynamically allocate condition code registers.
21116
21117 @item -mfixed-cc
21118 @opindex mfixed-cc
21119
21120 Do not try to dynamically allocate condition code registers, only
21121 use @code{icc0} and @code{fcc0}.
21122
21123 @item -mdword
21124 @opindex mdword
21125
21126 Change ABI to use double word insns.
21127
21128 @item -mno-dword
21129 @opindex mno-dword
21130 @opindex mdword
21131
21132 Do not use double word instructions.
21133
21134 @item -mdouble
21135 @opindex mdouble
21136
21137 Use floating-point double instructions.
21138
21139 @item -mno-double
21140 @opindex mno-double
21141
21142 Do not use floating-point double instructions.
21143
21144 @item -mmedia
21145 @opindex mmedia
21146
21147 Use media instructions.
21148
21149 @item -mno-media
21150 @opindex mno-media
21151
21152 Do not use media instructions.
21153
21154 @item -mmuladd
21155 @opindex mmuladd
21156
21157 Use multiply and add/subtract instructions.
21158
21159 @item -mno-muladd
21160 @opindex mno-muladd
21161
21162 Do not use multiply and add/subtract instructions.
21163
21164 @item -mfdpic
21165 @opindex mfdpic
21166
21167 Select the FDPIC ABI, which uses function descriptors to represent
21168 pointers to functions. Without any PIC/PIE-related options, it
21169 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
21170 assumes GOT entries and small data are within a 12-bit range from the
21171 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21172 are computed with 32 bits.
21173 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21174
21175 @item -minline-plt
21176 @opindex minline-plt
21177
21178 Enable inlining of PLT entries in function calls to functions that are
21179 not known to bind locally. It has no effect without @option{-mfdpic}.
21180 It's enabled by default if optimizing for speed and compiling for
21181 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21182 optimization option such as @option{-O3} or above is present in the
21183 command line.
21184
21185 @item -mTLS
21186 @opindex mTLS
21187
21188 Assume a large TLS segment when generating thread-local code.
21189
21190 @item -mtls
21191 @opindex mtls
21192
21193 Do not assume a large TLS segment when generating thread-local code.
21194
21195 @item -mgprel-ro
21196 @opindex mgprel-ro
21197
21198 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21199 that is known to be in read-only sections. It's enabled by default,
21200 except for @option{-fpic} or @option{-fpie}: even though it may help
21201 make the global offset table smaller, it trades 1 instruction for 4.
21202 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21203 one of which may be shared by multiple symbols, and it avoids the need
21204 for a GOT entry for the referenced symbol, so it's more likely to be a
21205 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
21206
21207 @item -multilib-library-pic
21208 @opindex multilib-library-pic
21209
21210 Link with the (library, not FD) pic libraries. It's implied by
21211 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
21212 @option{-fpic} without @option{-mfdpic}. You should never have to use
21213 it explicitly.
21214
21215 @item -mlinked-fp
21216 @opindex mlinked-fp
21217
21218 Follow the EABI requirement of always creating a frame pointer whenever
21219 a stack frame is allocated. This option is enabled by default and can
21220 be disabled with @option{-mno-linked-fp}.
21221
21222 @item -mlong-calls
21223 @opindex mlong-calls
21224
21225 Use indirect addressing to call functions outside the current
21226 compilation unit. This allows the functions to be placed anywhere
21227 within the 32-bit address space.
21228
21229 @item -malign-labels
21230 @opindex malign-labels
21231
21232 Try to align labels to an 8-byte boundary by inserting NOPs into the
21233 previous packet. This option only has an effect when VLIW packing
21234 is enabled. It doesn't create new packets; it merely adds NOPs to
21235 existing ones.
21236
21237 @item -mlibrary-pic
21238 @opindex mlibrary-pic
21239
21240 Generate position-independent EABI code.
21241
21242 @item -macc-4
21243 @opindex macc-4
21244
21245 Use only the first four media accumulator registers.
21246
21247 @item -macc-8
21248 @opindex macc-8
21249
21250 Use all eight media accumulator registers.
21251
21252 @item -mpack
21253 @opindex mpack
21254
21255 Pack VLIW instructions.
21256
21257 @item -mno-pack
21258 @opindex mno-pack
21259
21260 Do not pack VLIW instructions.
21261
21262 @item -mno-eflags
21263 @opindex mno-eflags
21264
21265 Do not mark ABI switches in e_flags.
21266
21267 @item -mcond-move
21268 @opindex mcond-move
21269
21270 Enable the use of conditional-move instructions (default).
21271
21272 This switch is mainly for debugging the compiler and will likely be removed
21273 in a future version.
21274
21275 @item -mno-cond-move
21276 @opindex mno-cond-move
21277
21278 Disable the use of conditional-move instructions.
21279
21280 This switch is mainly for debugging the compiler and will likely be removed
21281 in a future version.
21282
21283 @item -mscc
21284 @opindex mscc
21285
21286 Enable the use of conditional set instructions (default).
21287
21288 This switch is mainly for debugging the compiler and will likely be removed
21289 in a future version.
21290
21291 @item -mno-scc
21292 @opindex mno-scc
21293
21294 Disable the use of conditional set instructions.
21295
21296 This switch is mainly for debugging the compiler and will likely be removed
21297 in a future version.
21298
21299 @item -mcond-exec
21300 @opindex mcond-exec
21301
21302 Enable the use of conditional execution (default).
21303
21304 This switch is mainly for debugging the compiler and will likely be removed
21305 in a future version.
21306
21307 @item -mno-cond-exec
21308 @opindex mno-cond-exec
21309
21310 Disable the use of conditional execution.
21311
21312 This switch is mainly for debugging the compiler and will likely be removed
21313 in a future version.
21314
21315 @item -mvliw-branch
21316 @opindex mvliw-branch
21317
21318 Run a pass to pack branches into VLIW instructions (default).
21319
21320 This switch is mainly for debugging the compiler and will likely be removed
21321 in a future version.
21322
21323 @item -mno-vliw-branch
21324 @opindex mno-vliw-branch
21325
21326 Do not run a pass to pack branches into VLIW instructions.
21327
21328 This switch is mainly for debugging the compiler and will likely be removed
21329 in a future version.
21330
21331 @item -mmulti-cond-exec
21332 @opindex mmulti-cond-exec
21333
21334 Enable optimization of @code{&&} and @code{||} in conditional execution
21335 (default).
21336
21337 This switch is mainly for debugging the compiler and will likely be removed
21338 in a future version.
21339
21340 @item -mno-multi-cond-exec
21341 @opindex mno-multi-cond-exec
21342
21343 Disable optimization of @code{&&} and @code{||} in conditional execution.
21344
21345 This switch is mainly for debugging the compiler and will likely be removed
21346 in a future version.
21347
21348 @item -mnested-cond-exec
21349 @opindex mnested-cond-exec
21350
21351 Enable nested conditional execution optimizations (default).
21352
21353 This switch is mainly for debugging the compiler and will likely be removed
21354 in a future version.
21355
21356 @item -mno-nested-cond-exec
21357 @opindex mno-nested-cond-exec
21358
21359 Disable nested conditional execution optimizations.
21360
21361 This switch is mainly for debugging the compiler and will likely be removed
21362 in a future version.
21363
21364 @item -moptimize-membar
21365 @opindex moptimize-membar
21366
21367 This switch removes redundant @code{membar} instructions from the
21368 compiler-generated code. It is enabled by default.
21369
21370 @item -mno-optimize-membar
21371 @opindex mno-optimize-membar
21372 @opindex moptimize-membar
21373
21374 This switch disables the automatic removal of redundant @code{membar}
21375 instructions from the generated code.
21376
21377 @item -mtomcat-stats
21378 @opindex mtomcat-stats
21379
21380 Cause gas to print out tomcat statistics.
21381
21382 @item -mcpu=@var{cpu}
21383 @opindex mcpu
21384
21385 Select the processor type for which to generate code. Possible values are
21386 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21387 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21388
21389 @end table
21390
21391 @node GNU/Linux Options
21392 @subsection GNU/Linux Options
21393
21394 These @samp{-m} options are defined for GNU/Linux targets:
21395
21396 @table @gcctabopt
21397 @item -mglibc
21398 @opindex mglibc
21399 Use the GNU C library. This is the default except
21400 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21401 @samp{*-*-linux-*android*} targets.
21402
21403 @item -muclibc
21404 @opindex muclibc
21405 Use uClibc C library. This is the default on
21406 @samp{*-*-linux-*uclibc*} targets.
21407
21408 @item -mmusl
21409 @opindex mmusl
21410 Use the musl C library. This is the default on
21411 @samp{*-*-linux-*musl*} targets.
21412
21413 @item -mbionic
21414 @opindex mbionic
21415 Use Bionic C library. This is the default on
21416 @samp{*-*-linux-*android*} targets.
21417
21418 @item -mandroid
21419 @opindex mandroid
21420 Compile code compatible with Android platform. This is the default on
21421 @samp{*-*-linux-*android*} targets.
21422
21423 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21424 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
21425 this option makes the GCC driver pass Android-specific options to the linker.
21426 Finally, this option causes the preprocessor macro @code{__ANDROID__}
21427 to be defined.
21428
21429 @item -tno-android-cc
21430 @opindex tno-android-cc
21431 Disable compilation effects of @option{-mandroid}, i.e., do not enable
21432 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21433 @option{-fno-rtti} by default.
21434
21435 @item -tno-android-ld
21436 @opindex tno-android-ld
21437 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21438 linking options to the linker.
21439
21440 @end table
21441
21442 @node H8/300 Options
21443 @subsection H8/300 Options
21444
21445 These @samp{-m} options are defined for the H8/300 implementations:
21446
21447 @table @gcctabopt
21448 @item -mrelax
21449 @opindex mrelax
21450 Shorten some address references at link time, when possible; uses the
21451 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
21452 ld, Using ld}, for a fuller description.
21453
21454 @item -mh
21455 @opindex mh
21456 Generate code for the H8/300H@.
21457
21458 @item -ms
21459 @opindex ms
21460 Generate code for the H8S@.
21461
21462 @item -mn
21463 @opindex mn
21464 Generate code for the H8S and H8/300H in the normal mode. This switch
21465 must be used either with @option{-mh} or @option{-ms}.
21466
21467 @item -ms2600
21468 @opindex ms2600
21469 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
21470
21471 @item -mexr
21472 @opindex mexr
21473 Extended registers are stored on stack before execution of function
21474 with monitor attribute. Default option is @option{-mexr}.
21475 This option is valid only for H8S targets.
21476
21477 @item -mno-exr
21478 @opindex mno-exr
21479 @opindex mexr
21480 Extended registers are not stored on stack before execution of function
21481 with monitor attribute. Default option is @option{-mno-exr}.
21482 This option is valid only for H8S targets.
21483
21484 @item -mint32
21485 @opindex mint32
21486 Make @code{int} data 32 bits by default.
21487
21488 @item -malign-300
21489 @opindex malign-300
21490 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21491 The default for the H8/300H and H8S is to align longs and floats on
21492 4-byte boundaries.
21493 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
21494 This option has no effect on the H8/300.
21495 @end table
21496
21497 @node HPPA Options
21498 @subsection HPPA Options
21499 @cindex HPPA Options
21500
21501 These @samp{-m} options are defined for the HPPA family of computers:
21502
21503 @table @gcctabopt
21504 @item -march=@var{architecture-type}
21505 @opindex march
21506 Generate code for the specified architecture. The choices for
21507 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
21508 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
21509 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21510 architecture option for your machine. Code compiled for lower numbered
21511 architectures runs on higher numbered architectures, but not the
21512 other way around.
21513
21514 @item -mpa-risc-1-0
21515 @itemx -mpa-risc-1-1
21516 @itemx -mpa-risc-2-0
21517 @opindex mpa-risc-1-0
21518 @opindex mpa-risc-1-1
21519 @opindex mpa-risc-2-0
21520 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21521
21522 @item -mcaller-copies
21523 @opindex mcaller-copies
21524 The caller copies function arguments passed by hidden reference. This
21525 option should be used with care as it is not compatible with the default
21526 32-bit runtime. However, only aggregates larger than eight bytes are
21527 passed by hidden reference and the option provides better compatibility
21528 with OpenMP.
21529
21530 @item -mjump-in-delay
21531 @opindex mjump-in-delay
21532 This option is ignored and provided for compatibility purposes only.
21533
21534 @item -mdisable-fpregs
21535 @opindex mdisable-fpregs
21536 Prevent floating-point registers from being used in any manner. This is
21537 necessary for compiling kernels that perform lazy context switching of
21538 floating-point registers. If you use this option and attempt to perform
21539 floating-point operations, the compiler aborts.
21540
21541 @item -mdisable-indexing
21542 @opindex mdisable-indexing
21543 Prevent the compiler from using indexing address modes. This avoids some
21544 rather obscure problems when compiling MIG generated code under MACH@.
21545
21546 @item -mno-space-regs
21547 @opindex mno-space-regs
21548 @opindex mspace-regs
21549 Generate code that assumes the target has no space registers. This allows
21550 GCC to generate faster indirect calls and use unscaled index address modes.
21551
21552 Such code is suitable for level 0 PA systems and kernels.
21553
21554 @item -mfast-indirect-calls
21555 @opindex mfast-indirect-calls
21556 Generate code that assumes calls never cross space boundaries. This
21557 allows GCC to emit code that performs faster indirect calls.
21558
21559 This option does not work in the presence of shared libraries or nested
21560 functions.
21561
21562 @item -mfixed-range=@var{register-range}
21563 @opindex mfixed-range
21564 Generate code treating the given register range as fixed registers.
21565 A fixed register is one that the register allocator cannot use. This is
21566 useful when compiling kernel code. A register range is specified as
21567 two registers separated by a dash. Multiple register ranges can be
21568 specified separated by a comma.
21569
21570 @item -mlong-load-store
21571 @opindex mlong-load-store
21572 Generate 3-instruction load and store sequences as sometimes required by
21573 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
21574 the HP compilers.
21575
21576 @item -mportable-runtime
21577 @opindex mportable-runtime
21578 Use the portable calling conventions proposed by HP for ELF systems.
21579
21580 @item -mgas
21581 @opindex mgas
21582 Enable the use of assembler directives only GAS understands.
21583
21584 @item -mschedule=@var{cpu-type}
21585 @opindex mschedule
21586 Schedule code according to the constraints for the machine type
21587 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
21588 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
21589 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
21590 proper scheduling option for your machine. The default scheduling is
21591 @samp{8000}.
21592
21593 @item -mlinker-opt
21594 @opindex mlinker-opt
21595 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
21596 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
21597 linkers in which they give bogus error messages when linking some programs.
21598
21599 @item -msoft-float
21600 @opindex msoft-float
21601 Generate output containing library calls for floating point.
21602 @strong{Warning:} the requisite libraries are not available for all HPPA
21603 targets. Normally the facilities of the machine's usual C compiler are
21604 used, but this cannot be done directly in cross-compilation. You must make
21605 your own arrangements to provide suitable library functions for
21606 cross-compilation.
21607
21608 @option{-msoft-float} changes the calling convention in the output file;
21609 therefore, it is only useful if you compile @emph{all} of a program with
21610 this option. In particular, you need to compile @file{libgcc.a}, the
21611 library that comes with GCC, with @option{-msoft-float} in order for
21612 this to work.
21613
21614 @item -msio
21615 @opindex msio
21616 Generate the predefine, @code{_SIO}, for server IO@. The default is
21617 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
21618 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
21619 options are available under HP-UX and HI-UX@.
21620
21621 @item -mgnu-ld
21622 @opindex mgnu-ld
21623 Use options specific to GNU @command{ld}.
21624 This passes @option{-shared} to @command{ld} when
21625 building a shared library. It is the default when GCC is configured,
21626 explicitly or implicitly, with the GNU linker. This option does not
21627 affect which @command{ld} is called; it only changes what parameters
21628 are passed to that @command{ld}.
21629 The @command{ld} that is called is determined by the
21630 @option{--with-ld} configure option, GCC's program search path, and
21631 finally by the user's @env{PATH}. The linker used by GCC can be printed
21632 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
21633 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21634
21635 @item -mhp-ld
21636 @opindex mhp-ld
21637 Use options specific to HP @command{ld}.
21638 This passes @option{-b} to @command{ld} when building
21639 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
21640 links. It is the default when GCC is configured, explicitly or
21641 implicitly, with the HP linker. This option does not affect
21642 which @command{ld} is called; it only changes what parameters are passed to that
21643 @command{ld}.
21644 The @command{ld} that is called is determined by the @option{--with-ld}
21645 configure option, GCC's program search path, and finally by the user's
21646 @env{PATH}. The linker used by GCC can be printed using @samp{which
21647 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
21648 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21649
21650 @item -mlong-calls
21651 @opindex mno-long-calls
21652 @opindex mlong-calls
21653 Generate code that uses long call sequences. This ensures that a call
21654 is always able to reach linker generated stubs. The default is to generate
21655 long calls only when the distance from the call site to the beginning
21656 of the function or translation unit, as the case may be, exceeds a
21657 predefined limit set by the branch type being used. The limits for
21658 normal calls are 7,600,000 and 240,000 bytes, respectively for the
21659 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
21660 240,000 bytes.
21661
21662 Distances are measured from the beginning of functions when using the
21663 @option{-ffunction-sections} option, or when using the @option{-mgas}
21664 and @option{-mno-portable-runtime} options together under HP-UX with
21665 the SOM linker.
21666
21667 It is normally not desirable to use this option as it degrades
21668 performance. However, it may be useful in large applications,
21669 particularly when partial linking is used to build the application.
21670
21671 The types of long calls used depends on the capabilities of the
21672 assembler and linker, and the type of code being generated. The
21673 impact on systems that support long absolute calls, and long pic
21674 symbol-difference or pc-relative calls should be relatively small.
21675 However, an indirect call is used on 32-bit ELF systems in pic code
21676 and it is quite long.
21677
21678 @item -munix=@var{unix-std}
21679 @opindex march
21680 Generate compiler predefines and select a startfile for the specified
21681 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
21682 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
21683 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
21684 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
21685 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
21686 and later.
21687
21688 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
21689 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
21690 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
21691 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
21692 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
21693 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
21694
21695 It is @emph{important} to note that this option changes the interfaces
21696 for various library routines. It also affects the operational behavior
21697 of the C library. Thus, @emph{extreme} care is needed in using this
21698 option.
21699
21700 Library code that is intended to operate with more than one UNIX
21701 standard must test, set and restore the variable @code{__xpg4_extended_mask}
21702 as appropriate. Most GNU software doesn't provide this capability.
21703
21704 @item -nolibdld
21705 @opindex nolibdld
21706 Suppress the generation of link options to search libdld.sl when the
21707 @option{-static} option is specified on HP-UX 10 and later.
21708
21709 @item -static
21710 @opindex static
21711 The HP-UX implementation of setlocale in libc has a dependency on
21712 libdld.sl. There isn't an archive version of libdld.sl. Thus,
21713 when the @option{-static} option is specified, special link options
21714 are needed to resolve this dependency.
21715
21716 On HP-UX 10 and later, the GCC driver adds the necessary options to
21717 link with libdld.sl when the @option{-static} option is specified.
21718 This causes the resulting binary to be dynamic. On the 64-bit port,
21719 the linkers generate dynamic binaries by default in any case. The
21720 @option{-nolibdld} option can be used to prevent the GCC driver from
21721 adding these link options.
21722
21723 @item -threads
21724 @opindex threads
21725 Add support for multithreading with the @dfn{dce thread} library
21726 under HP-UX@. This option sets flags for both the preprocessor and
21727 linker.
21728 @end table
21729
21730 @node IA-64 Options
21731 @subsection IA-64 Options
21732 @cindex IA-64 Options
21733
21734 These are the @samp{-m} options defined for the Intel IA-64 architecture.
21735
21736 @table @gcctabopt
21737 @item -mbig-endian
21738 @opindex mbig-endian
21739 Generate code for a big-endian target. This is the default for HP-UX@.
21740
21741 @item -mlittle-endian
21742 @opindex mlittle-endian
21743 Generate code for a little-endian target. This is the default for AIX5
21744 and GNU/Linux.
21745
21746 @item -mgnu-as
21747 @itemx -mno-gnu-as
21748 @opindex mgnu-as
21749 @opindex mno-gnu-as
21750 Generate (or don't) code for the GNU assembler. This is the default.
21751 @c Also, this is the default if the configure option @option{--with-gnu-as}
21752 @c is used.
21753
21754 @item -mgnu-ld
21755 @itemx -mno-gnu-ld
21756 @opindex mgnu-ld
21757 @opindex mno-gnu-ld
21758 Generate (or don't) code for the GNU linker. This is the default.
21759 @c Also, this is the default if the configure option @option{--with-gnu-ld}
21760 @c is used.
21761
21762 @item -mno-pic
21763 @opindex mno-pic
21764 Generate code that does not use a global pointer register. The result
21765 is not position independent code, and violates the IA-64 ABI@.
21766
21767 @item -mvolatile-asm-stop
21768 @itemx -mno-volatile-asm-stop
21769 @opindex mvolatile-asm-stop
21770 @opindex mno-volatile-asm-stop
21771 Generate (or don't) a stop bit immediately before and after volatile asm
21772 statements.
21773
21774 @item -mregister-names
21775 @itemx -mno-register-names
21776 @opindex mregister-names
21777 @opindex mno-register-names
21778 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
21779 the stacked registers. This may make assembler output more readable.
21780
21781 @item -mno-sdata
21782 @itemx -msdata
21783 @opindex mno-sdata
21784 @opindex msdata
21785 Disable (or enable) optimizations that use the small data section. This may
21786 be useful for working around optimizer bugs.
21787
21788 @item -mconstant-gp
21789 @opindex mconstant-gp
21790 Generate code that uses a single constant global pointer value. This is
21791 useful when compiling kernel code.
21792
21793 @item -mauto-pic
21794 @opindex mauto-pic
21795 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
21796 This is useful when compiling firmware code.
21797
21798 @item -minline-float-divide-min-latency
21799 @opindex minline-float-divide-min-latency
21800 Generate code for inline divides of floating-point values
21801 using the minimum latency algorithm.
21802
21803 @item -minline-float-divide-max-throughput
21804 @opindex minline-float-divide-max-throughput
21805 Generate code for inline divides of floating-point values
21806 using the maximum throughput algorithm.
21807
21808 @item -mno-inline-float-divide
21809 @opindex mno-inline-float-divide
21810 Do not generate inline code for divides of floating-point values.
21811
21812 @item -minline-int-divide-min-latency
21813 @opindex minline-int-divide-min-latency
21814 Generate code for inline divides of integer values
21815 using the minimum latency algorithm.
21816
21817 @item -minline-int-divide-max-throughput
21818 @opindex minline-int-divide-max-throughput
21819 Generate code for inline divides of integer values
21820 using the maximum throughput algorithm.
21821
21822 @item -mno-inline-int-divide
21823 @opindex mno-inline-int-divide
21824 @opindex minline-int-divide
21825 Do not generate inline code for divides of integer values.
21826
21827 @item -minline-sqrt-min-latency
21828 @opindex minline-sqrt-min-latency
21829 Generate code for inline square roots
21830 using the minimum latency algorithm.
21831
21832 @item -minline-sqrt-max-throughput
21833 @opindex minline-sqrt-max-throughput
21834 Generate code for inline square roots
21835 using the maximum throughput algorithm.
21836
21837 @item -mno-inline-sqrt
21838 @opindex mno-inline-sqrt
21839 Do not generate inline code for @code{sqrt}.
21840
21841 @item -mfused-madd
21842 @itemx -mno-fused-madd
21843 @opindex mfused-madd
21844 @opindex mno-fused-madd
21845 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
21846 instructions. The default is to use these instructions.
21847
21848 @item -mno-dwarf2-asm
21849 @itemx -mdwarf2-asm
21850 @opindex mno-dwarf2-asm
21851 @opindex mdwarf2-asm
21852 Don't (or do) generate assembler code for the DWARF line number debugging
21853 info. This may be useful when not using the GNU assembler.
21854
21855 @item -mearly-stop-bits
21856 @itemx -mno-early-stop-bits
21857 @opindex mearly-stop-bits
21858 @opindex mno-early-stop-bits
21859 Allow stop bits to be placed earlier than immediately preceding the
21860 instruction that triggered the stop bit. This can improve instruction
21861 scheduling, but does not always do so.
21862
21863 @item -mfixed-range=@var{register-range}
21864 @opindex mfixed-range
21865 Generate code treating the given register range as fixed registers.
21866 A fixed register is one that the register allocator cannot use. This is
21867 useful when compiling kernel code. A register range is specified as
21868 two registers separated by a dash. Multiple register ranges can be
21869 specified separated by a comma.
21870
21871 @item -mtls-size=@var{tls-size}
21872 @opindex mtls-size
21873 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
21874 64.
21875
21876 @item -mtune=@var{cpu-type}
21877 @opindex mtune
21878 Tune the instruction scheduling for a particular CPU, Valid values are
21879 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
21880 and @samp{mckinley}.
21881
21882 @item -milp32
21883 @itemx -mlp64
21884 @opindex milp32
21885 @opindex mlp64
21886 Generate code for a 32-bit or 64-bit environment.
21887 The 32-bit environment sets int, long and pointer to 32 bits.
21888 The 64-bit environment sets int to 32 bits and long and pointer
21889 to 64 bits. These are HP-UX specific flags.
21890
21891 @item -mno-sched-br-data-spec
21892 @itemx -msched-br-data-spec
21893 @opindex mno-sched-br-data-spec
21894 @opindex msched-br-data-spec
21895 (Dis/En)able data speculative scheduling before reload.
21896 This results in generation of @code{ld.a} instructions and
21897 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21898 The default setting is disabled.
21899
21900 @item -msched-ar-data-spec
21901 @itemx -mno-sched-ar-data-spec
21902 @opindex msched-ar-data-spec
21903 @opindex mno-sched-ar-data-spec
21904 (En/Dis)able data speculative scheduling after reload.
21905 This results in generation of @code{ld.a} instructions and
21906 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21907 The default setting is enabled.
21908
21909 @item -mno-sched-control-spec
21910 @itemx -msched-control-spec
21911 @opindex mno-sched-control-spec
21912 @opindex msched-control-spec
21913 (Dis/En)able control speculative scheduling. This feature is
21914 available only during region scheduling (i.e.@: before reload).
21915 This results in generation of the @code{ld.s} instructions and
21916 the corresponding check instructions @code{chk.s}.
21917 The default setting is disabled.
21918
21919 @item -msched-br-in-data-spec
21920 @itemx -mno-sched-br-in-data-spec
21921 @opindex msched-br-in-data-spec
21922 @opindex mno-sched-br-in-data-spec
21923 (En/Dis)able speculative scheduling of the instructions that
21924 are dependent on the data speculative loads before reload.
21925 This is effective only with @option{-msched-br-data-spec} enabled.
21926 The default setting is enabled.
21927
21928 @item -msched-ar-in-data-spec
21929 @itemx -mno-sched-ar-in-data-spec
21930 @opindex msched-ar-in-data-spec
21931 @opindex mno-sched-ar-in-data-spec
21932 (En/Dis)able speculative scheduling of the instructions that
21933 are dependent on the data speculative loads after reload.
21934 This is effective only with @option{-msched-ar-data-spec} enabled.
21935 The default setting is enabled.
21936
21937 @item -msched-in-control-spec
21938 @itemx -mno-sched-in-control-spec
21939 @opindex msched-in-control-spec
21940 @opindex mno-sched-in-control-spec
21941 (En/Dis)able speculative scheduling of the instructions that
21942 are dependent on the control speculative loads.
21943 This is effective only with @option{-msched-control-spec} enabled.
21944 The default setting is enabled.
21945
21946 @item -mno-sched-prefer-non-data-spec-insns
21947 @itemx -msched-prefer-non-data-spec-insns
21948 @opindex mno-sched-prefer-non-data-spec-insns
21949 @opindex msched-prefer-non-data-spec-insns
21950 If enabled, data-speculative instructions are chosen for schedule
21951 only if there are no other choices at the moment. This makes
21952 the use of the data speculation much more conservative.
21953 The default setting is disabled.
21954
21955 @item -mno-sched-prefer-non-control-spec-insns
21956 @itemx -msched-prefer-non-control-spec-insns
21957 @opindex mno-sched-prefer-non-control-spec-insns
21958 @opindex msched-prefer-non-control-spec-insns
21959 If enabled, control-speculative instructions are chosen for schedule
21960 only if there are no other choices at the moment. This makes
21961 the use of the control speculation much more conservative.
21962 The default setting is disabled.
21963
21964 @item -mno-sched-count-spec-in-critical-path
21965 @itemx -msched-count-spec-in-critical-path
21966 @opindex mno-sched-count-spec-in-critical-path
21967 @opindex msched-count-spec-in-critical-path
21968 If enabled, speculative dependencies are considered during
21969 computation of the instructions priorities. This makes the use of the
21970 speculation a bit more conservative.
21971 The default setting is disabled.
21972
21973 @item -msched-spec-ldc
21974 @opindex msched-spec-ldc
21975 Use a simple data speculation check. This option is on by default.
21976
21977 @item -msched-control-spec-ldc
21978 @opindex msched-spec-ldc
21979 Use a simple check for control speculation. This option is on by default.
21980
21981 @item -msched-stop-bits-after-every-cycle
21982 @opindex msched-stop-bits-after-every-cycle
21983 Place a stop bit after every cycle when scheduling. This option is on
21984 by default.
21985
21986 @item -msched-fp-mem-deps-zero-cost
21987 @opindex msched-fp-mem-deps-zero-cost
21988 Assume that floating-point stores and loads are not likely to cause a conflict
21989 when placed into the same instruction group. This option is disabled by
21990 default.
21991
21992 @item -msel-sched-dont-check-control-spec
21993 @opindex msel-sched-dont-check-control-spec
21994 Generate checks for control speculation in selective scheduling.
21995 This flag is disabled by default.
21996
21997 @item -msched-max-memory-insns=@var{max-insns}
21998 @opindex msched-max-memory-insns
21999 Limit on the number of memory insns per instruction group, giving lower
22000 priority to subsequent memory insns attempting to schedule in the same
22001 instruction group. Frequently useful to prevent cache bank conflicts.
22002 The default value is 1.
22003
22004 @item -msched-max-memory-insns-hard-limit
22005 @opindex msched-max-memory-insns-hard-limit
22006 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
22007 disallowing more than that number in an instruction group.
22008 Otherwise, the limit is ``soft'', meaning that non-memory operations
22009 are preferred when the limit is reached, but memory operations may still
22010 be scheduled.
22011
22012 @end table
22013
22014 @node LM32 Options
22015 @subsection LM32 Options
22016 @cindex LM32 options
22017
22018 These @option{-m} options are defined for the LatticeMico32 architecture:
22019
22020 @table @gcctabopt
22021 @item -mbarrel-shift-enabled
22022 @opindex mbarrel-shift-enabled
22023 Enable barrel-shift instructions.
22024
22025 @item -mdivide-enabled
22026 @opindex mdivide-enabled
22027 Enable divide and modulus instructions.
22028
22029 @item -mmultiply-enabled
22030 @opindex multiply-enabled
22031 Enable multiply instructions.
22032
22033 @item -msign-extend-enabled
22034 @opindex msign-extend-enabled
22035 Enable sign extend instructions.
22036
22037 @item -muser-enabled
22038 @opindex muser-enabled
22039 Enable user-defined instructions.
22040
22041 @end table
22042
22043 @node M32C Options
22044 @subsection M32C Options
22045 @cindex M32C options
22046
22047 @table @gcctabopt
22048 @item -mcpu=@var{name}
22049 @opindex mcpu=
22050 Select the CPU for which code is generated. @var{name} may be one of
22051 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
22052 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
22053 the M32C/80 series.
22054
22055 @item -msim
22056 @opindex msim
22057 Specifies that the program will be run on the simulator. This causes
22058 an alternate runtime library to be linked in which supports, for
22059 example, file I/O@. You must not use this option when generating
22060 programs that will run on real hardware; you must provide your own
22061 runtime library for whatever I/O functions are needed.
22062
22063 @item -memregs=@var{number}
22064 @opindex memregs=
22065 Specifies the number of memory-based pseudo-registers GCC uses
22066 during code generation. These pseudo-registers are used like real
22067 registers, so there is a tradeoff between GCC's ability to fit the
22068 code into available registers, and the performance penalty of using
22069 memory instead of registers. Note that all modules in a program must
22070 be compiled with the same value for this option. Because of that, you
22071 must not use this option with GCC's default runtime libraries.
22072
22073 @end table
22074
22075 @node M32R/D Options
22076 @subsection M32R/D Options
22077 @cindex M32R/D options
22078
22079 These @option{-m} options are defined for Renesas M32R/D architectures:
22080
22081 @table @gcctabopt
22082 @item -m32r2
22083 @opindex m32r2
22084 Generate code for the M32R/2@.
22085
22086 @item -m32rx
22087 @opindex m32rx
22088 Generate code for the M32R/X@.
22089
22090 @item -m32r
22091 @opindex m32r
22092 Generate code for the M32R@. This is the default.
22093
22094 @item -mmodel=small
22095 @opindex mmodel=small
22096 Assume all objects live in the lower 16MB of memory (so that their addresses
22097 can be loaded with the @code{ld24} instruction), and assume all subroutines
22098 are reachable with the @code{bl} instruction.
22099 This is the default.
22100
22101 The addressability of a particular object can be set with the
22102 @code{model} attribute.
22103
22104 @item -mmodel=medium
22105 @opindex mmodel=medium
22106 Assume objects may be anywhere in the 32-bit address space (the compiler
22107 generates @code{seth/add3} instructions to load their addresses), and
22108 assume all subroutines are reachable with the @code{bl} instruction.
22109
22110 @item -mmodel=large
22111 @opindex mmodel=large
22112 Assume objects may be anywhere in the 32-bit address space (the compiler
22113 generates @code{seth/add3} instructions to load their addresses), and
22114 assume subroutines may not be reachable with the @code{bl} instruction
22115 (the compiler generates the much slower @code{seth/add3/jl}
22116 instruction sequence).
22117
22118 @item -msdata=none
22119 @opindex msdata=none
22120 Disable use of the small data area. Variables are put into
22121 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
22122 @code{section} attribute has been specified).
22123 This is the default.
22124
22125 The small data area consists of sections @code{.sdata} and @code{.sbss}.
22126 Objects may be explicitly put in the small data area with the
22127 @code{section} attribute using one of these sections.
22128
22129 @item -msdata=sdata
22130 @opindex msdata=sdata
22131 Put small global and static data in the small data area, but do not
22132 generate special code to reference them.
22133
22134 @item -msdata=use
22135 @opindex msdata=use
22136 Put small global and static data in the small data area, and generate
22137 special instructions to reference them.
22138
22139 @item -G @var{num}
22140 @opindex G
22141 @cindex smaller data references
22142 Put global and static objects less than or equal to @var{num} bytes
22143 into the small data or BSS sections instead of the normal data or BSS
22144 sections. The default value of @var{num} is 8.
22145 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22146 for this option to have any effect.
22147
22148 All modules should be compiled with the same @option{-G @var{num}} value.
22149 Compiling with different values of @var{num} may or may not work; if it
22150 doesn't the linker gives an error message---incorrect code is not
22151 generated.
22152
22153 @item -mdebug
22154 @opindex mdebug
22155 Makes the M32R-specific code in the compiler display some statistics
22156 that might help in debugging programs.
22157
22158 @item -malign-loops
22159 @opindex malign-loops
22160 Align all loops to a 32-byte boundary.
22161
22162 @item -mno-align-loops
22163 @opindex mno-align-loops
22164 Do not enforce a 32-byte alignment for loops. This is the default.
22165
22166 @item -missue-rate=@var{number}
22167 @opindex missue-rate=@var{number}
22168 Issue @var{number} instructions per cycle. @var{number} can only be 1
22169 or 2.
22170
22171 @item -mbranch-cost=@var{number}
22172 @opindex mbranch-cost=@var{number}
22173 @var{number} can only be 1 or 2. If it is 1 then branches are
22174 preferred over conditional code, if it is 2, then the opposite applies.
22175
22176 @item -mflush-trap=@var{number}
22177 @opindex mflush-trap=@var{number}
22178 Specifies the trap number to use to flush the cache. The default is
22179 12. Valid numbers are between 0 and 15 inclusive.
22180
22181 @item -mno-flush-trap
22182 @opindex mno-flush-trap
22183 Specifies that the cache cannot be flushed by using a trap.
22184
22185 @item -mflush-func=@var{name}
22186 @opindex mflush-func=@var{name}
22187 Specifies the name of the operating system function to call to flush
22188 the cache. The default is @samp{_flush_cache}, but a function call
22189 is only used if a trap is not available.
22190
22191 @item -mno-flush-func
22192 @opindex mno-flush-func
22193 Indicates that there is no OS function for flushing the cache.
22194
22195 @end table
22196
22197 @node M680x0 Options
22198 @subsection M680x0 Options
22199 @cindex M680x0 options
22200
22201 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22202 The default settings depend on which architecture was selected when
22203 the compiler was configured; the defaults for the most common choices
22204 are given below.
22205
22206 @table @gcctabopt
22207 @item -march=@var{arch}
22208 @opindex march
22209 Generate code for a specific M680x0 or ColdFire instruction set
22210 architecture. Permissible values of @var{arch} for M680x0
22211 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22212 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
22213 architectures are selected according to Freescale's ISA classification
22214 and the permissible values are: @samp{isaa}, @samp{isaaplus},
22215 @samp{isab} and @samp{isac}.
22216
22217 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22218 code for a ColdFire target. The @var{arch} in this macro is one of the
22219 @option{-march} arguments given above.
22220
22221 When used together, @option{-march} and @option{-mtune} select code
22222 that runs on a family of similar processors but that is optimized
22223 for a particular microarchitecture.
22224
22225 @item -mcpu=@var{cpu}
22226 @opindex mcpu
22227 Generate code for a specific M680x0 or ColdFire processor.
22228 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22229 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22230 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
22231 below, which also classifies the CPUs into families:
22232
22233 @multitable @columnfractions 0.20 0.80
22234 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22235 @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}
22236 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22237 @item @samp{5206e} @tab @samp{5206e}
22238 @item @samp{5208} @tab @samp{5207} @samp{5208}
22239 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22240 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22241 @item @samp{5216} @tab @samp{5214} @samp{5216}
22242 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22243 @item @samp{5225} @tab @samp{5224} @samp{5225}
22244 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22245 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22246 @item @samp{5249} @tab @samp{5249}
22247 @item @samp{5250} @tab @samp{5250}
22248 @item @samp{5271} @tab @samp{5270} @samp{5271}
22249 @item @samp{5272} @tab @samp{5272}
22250 @item @samp{5275} @tab @samp{5274} @samp{5275}
22251 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22252 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22253 @item @samp{5307} @tab @samp{5307}
22254 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22255 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22256 @item @samp{5407} @tab @samp{5407}
22257 @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}
22258 @end multitable
22259
22260 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22261 @var{arch} is compatible with @var{cpu}. Other combinations of
22262 @option{-mcpu} and @option{-march} are rejected.
22263
22264 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22265 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
22266 where the value of @var{family} is given by the table above.
22267
22268 @item -mtune=@var{tune}
22269 @opindex mtune
22270 Tune the code for a particular microarchitecture within the
22271 constraints set by @option{-march} and @option{-mcpu}.
22272 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22273 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22274 and @samp{cpu32}. The ColdFire microarchitectures
22275 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22276
22277 You can also use @option{-mtune=68020-40} for code that needs
22278 to run relatively well on 68020, 68030 and 68040 targets.
22279 @option{-mtune=68020-60} is similar but includes 68060 targets
22280 as well. These two options select the same tuning decisions as
22281 @option{-m68020-40} and @option{-m68020-60} respectively.
22282
22283 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22284 when tuning for 680x0 architecture @var{arch}. It also defines
22285 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22286 option is used. If GCC is tuning for a range of architectures,
22287 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22288 it defines the macros for every architecture in the range.
22289
22290 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22291 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22292 of the arguments given above.
22293
22294 @item -m68000
22295 @itemx -mc68000
22296 @opindex m68000
22297 @opindex mc68000
22298 Generate output for a 68000. This is the default
22299 when the compiler is configured for 68000-based systems.
22300 It is equivalent to @option{-march=68000}.
22301
22302 Use this option for microcontrollers with a 68000 or EC000 core,
22303 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22304
22305 @item -m68010
22306 @opindex m68010
22307 Generate output for a 68010. This is the default
22308 when the compiler is configured for 68010-based systems.
22309 It is equivalent to @option{-march=68010}.
22310
22311 @item -m68020
22312 @itemx -mc68020
22313 @opindex m68020
22314 @opindex mc68020
22315 Generate output for a 68020. This is the default
22316 when the compiler is configured for 68020-based systems.
22317 It is equivalent to @option{-march=68020}.
22318
22319 @item -m68030
22320 @opindex m68030
22321 Generate output for a 68030. This is the default when the compiler is
22322 configured for 68030-based systems. It is equivalent to
22323 @option{-march=68030}.
22324
22325 @item -m68040
22326 @opindex m68040
22327 Generate output for a 68040. This is the default when the compiler is
22328 configured for 68040-based systems. It is equivalent to
22329 @option{-march=68040}.
22330
22331 This option inhibits the use of 68881/68882 instructions that have to be
22332 emulated by software on the 68040. Use this option if your 68040 does not
22333 have code to emulate those instructions.
22334
22335 @item -m68060
22336 @opindex m68060
22337 Generate output for a 68060. This is the default when the compiler is
22338 configured for 68060-based systems. It is equivalent to
22339 @option{-march=68060}.
22340
22341 This option inhibits the use of 68020 and 68881/68882 instructions that
22342 have to be emulated by software on the 68060. Use this option if your 68060
22343 does not have code to emulate those instructions.
22344
22345 @item -mcpu32
22346 @opindex mcpu32
22347 Generate output for a CPU32. This is the default
22348 when the compiler is configured for CPU32-based systems.
22349 It is equivalent to @option{-march=cpu32}.
22350
22351 Use this option for microcontrollers with a
22352 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
22353 68336, 68340, 68341, 68349 and 68360.
22354
22355 @item -m5200
22356 @opindex m5200
22357 Generate output for a 520X ColdFire CPU@. This is the default
22358 when the compiler is configured for 520X-based systems.
22359 It is equivalent to @option{-mcpu=5206}, and is now deprecated
22360 in favor of that option.
22361
22362 Use this option for microcontroller with a 5200 core, including
22363 the MCF5202, MCF5203, MCF5204 and MCF5206.
22364
22365 @item -m5206e
22366 @opindex m5206e
22367 Generate output for a 5206e ColdFire CPU@. The option is now
22368 deprecated in favor of the equivalent @option{-mcpu=5206e}.
22369
22370 @item -m528x
22371 @opindex m528x
22372 Generate output for a member of the ColdFire 528X family.
22373 The option is now deprecated in favor of the equivalent
22374 @option{-mcpu=528x}.
22375
22376 @item -m5307
22377 @opindex m5307
22378 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
22379 in favor of the equivalent @option{-mcpu=5307}.
22380
22381 @item -m5407
22382 @opindex m5407
22383 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
22384 in favor of the equivalent @option{-mcpu=5407}.
22385
22386 @item -mcfv4e
22387 @opindex mcfv4e
22388 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22389 This includes use of hardware floating-point instructions.
22390 The option is equivalent to @option{-mcpu=547x}, and is now
22391 deprecated in favor of that option.
22392
22393 @item -m68020-40
22394 @opindex m68020-40
22395 Generate output for a 68040, without using any of the new instructions.
22396 This results in code that can run relatively efficiently on either a
22397 68020/68881 or a 68030 or a 68040. The generated code does use the
22398 68881 instructions that are emulated on the 68040.
22399
22400 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22401
22402 @item -m68020-60
22403 @opindex m68020-60
22404 Generate output for a 68060, without using any of the new instructions.
22405 This results in code that can run relatively efficiently on either a
22406 68020/68881 or a 68030 or a 68040. The generated code does use the
22407 68881 instructions that are emulated on the 68060.
22408
22409 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22410
22411 @item -mhard-float
22412 @itemx -m68881
22413 @opindex mhard-float
22414 @opindex m68881
22415 Generate floating-point instructions. This is the default for 68020
22416 and above, and for ColdFire devices that have an FPU@. It defines the
22417 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22418 on ColdFire targets.
22419
22420 @item -msoft-float
22421 @opindex msoft-float
22422 Do not generate floating-point instructions; use library calls instead.
22423 This is the default for 68000, 68010, and 68832 targets. It is also
22424 the default for ColdFire devices that have no FPU.
22425
22426 @item -mdiv
22427 @itemx -mno-div
22428 @opindex mdiv
22429 @opindex mno-div
22430 Generate (do not generate) ColdFire hardware divide and remainder
22431 instructions. If @option{-march} is used without @option{-mcpu},
22432 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22433 architectures. Otherwise, the default is taken from the target CPU
22434 (either the default CPU, or the one specified by @option{-mcpu}). For
22435 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22436 @option{-mcpu=5206e}.
22437
22438 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22439
22440 @item -mshort
22441 @opindex mshort
22442 Consider type @code{int} to be 16 bits wide, like @code{short int}.
22443 Additionally, parameters passed on the stack are also aligned to a
22444 16-bit boundary even on targets whose API mandates promotion to 32-bit.
22445
22446 @item -mno-short
22447 @opindex mno-short
22448 Do not consider type @code{int} to be 16 bits wide. This is the default.
22449
22450 @item -mnobitfield
22451 @itemx -mno-bitfield
22452 @opindex mnobitfield
22453 @opindex mno-bitfield
22454 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
22455 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22456
22457 @item -mbitfield
22458 @opindex mbitfield
22459 Do use the bit-field instructions. The @option{-m68020} option implies
22460 @option{-mbitfield}. This is the default if you use a configuration
22461 designed for a 68020.
22462
22463 @item -mrtd
22464 @opindex mrtd
22465 Use a different function-calling convention, in which functions
22466 that take a fixed number of arguments return with the @code{rtd}
22467 instruction, which pops their arguments while returning. This
22468 saves one instruction in the caller since there is no need to pop
22469 the arguments there.
22470
22471 This calling convention is incompatible with the one normally
22472 used on Unix, so you cannot use it if you need to call libraries
22473 compiled with the Unix compiler.
22474
22475 Also, you must provide function prototypes for all functions that
22476 take variable numbers of arguments (including @code{printf});
22477 otherwise incorrect code is generated for calls to those
22478 functions.
22479
22480 In addition, seriously incorrect code results if you call a
22481 function with too many arguments. (Normally, extra arguments are
22482 harmlessly ignored.)
22483
22484 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
22485 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22486
22487 The default is @option{-mno-rtd}.
22488
22489 @item -malign-int
22490 @itemx -mno-align-int
22491 @opindex malign-int
22492 @opindex mno-align-int
22493 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22494 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
22495 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22496 Aligning variables on 32-bit boundaries produces code that runs somewhat
22497 faster on processors with 32-bit busses at the expense of more memory.
22498
22499 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
22500 aligns structures containing the above types differently than
22501 most published application binary interface specifications for the m68k.
22502
22503 @opindex mpcrel
22504 Use the pc-relative addressing mode of the 68000 directly, instead of
22505 using a global offset table. At present, this option implies @option{-fpic},
22506 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
22507 not presently supported with @option{-mpcrel}, though this could be supported for
22508 68020 and higher processors.
22509
22510 @item -mno-strict-align
22511 @itemx -mstrict-align
22512 @opindex mno-strict-align
22513 @opindex mstrict-align
22514 Do not (do) assume that unaligned memory references are handled by
22515 the system.
22516
22517 @item -msep-data
22518 Generate code that allows the data segment to be located in a different
22519 area of memory from the text segment. This allows for execute-in-place in
22520 an environment without virtual memory management. This option implies
22521 @option{-fPIC}.
22522
22523 @item -mno-sep-data
22524 Generate code that assumes that the data segment follows the text segment.
22525 This is the default.
22526
22527 @item -mid-shared-library
22528 Generate code that supports shared libraries via the library ID method.
22529 This allows for execute-in-place and shared libraries in an environment
22530 without virtual memory management. This option implies @option{-fPIC}.
22531
22532 @item -mno-id-shared-library
22533 Generate code that doesn't assume ID-based shared libraries are being used.
22534 This is the default.
22535
22536 @item -mshared-library-id=n
22537 Specifies the identification number of the ID-based shared library being
22538 compiled. Specifying a value of 0 generates more compact code; specifying
22539 other values forces the allocation of that number to the current
22540 library, but is no more space- or time-efficient than omitting this option.
22541
22542 @item -mxgot
22543 @itemx -mno-xgot
22544 @opindex mxgot
22545 @opindex mno-xgot
22546 When generating position-independent code for ColdFire, generate code
22547 that works if the GOT has more than 8192 entries. This code is
22548 larger and slower than code generated without this option. On M680x0
22549 processors, this option is not needed; @option{-fPIC} suffices.
22550
22551 GCC normally uses a single instruction to load values from the GOT@.
22552 While this is relatively efficient, it only works if the GOT
22553 is smaller than about 64k. Anything larger causes the linker
22554 to report an error such as:
22555
22556 @cindex relocation truncated to fit (ColdFire)
22557 @smallexample
22558 relocation truncated to fit: R_68K_GOT16O foobar
22559 @end smallexample
22560
22561 If this happens, you should recompile your code with @option{-mxgot}.
22562 It should then work with very large GOTs. However, code generated with
22563 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
22564 the value of a global symbol.
22565
22566 Note that some linkers, including newer versions of the GNU linker,
22567 can create multiple GOTs and sort GOT entries. If you have such a linker,
22568 you should only need to use @option{-mxgot} when compiling a single
22569 object file that accesses more than 8192 GOT entries. Very few do.
22570
22571 These options have no effect unless GCC is generating
22572 position-independent code.
22573
22574 @item -mlong-jump-table-offsets
22575 @opindex mlong-jump-table-offsets
22576 Use 32-bit offsets in @code{switch} tables. The default is to use
22577 16-bit offsets.
22578
22579 @end table
22580
22581 @node MCore Options
22582 @subsection MCore Options
22583 @cindex MCore options
22584
22585 These are the @samp{-m} options defined for the Motorola M*Core
22586 processors.
22587
22588 @table @gcctabopt
22589
22590 @item -mhardlit
22591 @itemx -mno-hardlit
22592 @opindex mhardlit
22593 @opindex mno-hardlit
22594 Inline constants into the code stream if it can be done in two
22595 instructions or less.
22596
22597 @item -mdiv
22598 @itemx -mno-div
22599 @opindex mdiv
22600 @opindex mno-div
22601 Use the divide instruction. (Enabled by default).
22602
22603 @item -mrelax-immediate
22604 @itemx -mno-relax-immediate
22605 @opindex mrelax-immediate
22606 @opindex mno-relax-immediate
22607 Allow arbitrary-sized immediates in bit operations.
22608
22609 @item -mwide-bitfields
22610 @itemx -mno-wide-bitfields
22611 @opindex mwide-bitfields
22612 @opindex mno-wide-bitfields
22613 Always treat bit-fields as @code{int}-sized.
22614
22615 @item -m4byte-functions
22616 @itemx -mno-4byte-functions
22617 @opindex m4byte-functions
22618 @opindex mno-4byte-functions
22619 Force all functions to be aligned to a 4-byte boundary.
22620
22621 @item -mcallgraph-data
22622 @itemx -mno-callgraph-data
22623 @opindex mcallgraph-data
22624 @opindex mno-callgraph-data
22625 Emit callgraph information.
22626
22627 @item -mslow-bytes
22628 @itemx -mno-slow-bytes
22629 @opindex mslow-bytes
22630 @opindex mno-slow-bytes
22631 Prefer word access when reading byte quantities.
22632
22633 @item -mlittle-endian
22634 @itemx -mbig-endian
22635 @opindex mlittle-endian
22636 @opindex mbig-endian
22637 Generate code for a little-endian target.
22638
22639 @item -m210
22640 @itemx -m340
22641 @opindex m210
22642 @opindex m340
22643 Generate code for the 210 processor.
22644
22645 @item -mno-lsim
22646 @opindex mno-lsim
22647 Assume that runtime support has been provided and so omit the
22648 simulator library (@file{libsim.a)} from the linker command line.
22649
22650 @item -mstack-increment=@var{size}
22651 @opindex mstack-increment
22652 Set the maximum amount for a single stack increment operation. Large
22653 values can increase the speed of programs that contain functions
22654 that need a large amount of stack space, but they can also trigger a
22655 segmentation fault if the stack is extended too much. The default
22656 value is 0x1000.
22657
22658 @end table
22659
22660 @node MeP Options
22661 @subsection MeP Options
22662 @cindex MeP options
22663
22664 @table @gcctabopt
22665
22666 @item -mabsdiff
22667 @opindex mabsdiff
22668 Enables the @code{abs} instruction, which is the absolute difference
22669 between two registers.
22670
22671 @item -mall-opts
22672 @opindex mall-opts
22673 Enables all the optional instructions---average, multiply, divide, bit
22674 operations, leading zero, absolute difference, min/max, clip, and
22675 saturation.
22676
22677
22678 @item -maverage
22679 @opindex maverage
22680 Enables the @code{ave} instruction, which computes the average of two
22681 registers.
22682
22683 @item -mbased=@var{n}
22684 @opindex mbased=
22685 Variables of size @var{n} bytes or smaller are placed in the
22686 @code{.based} section by default. Based variables use the @code{$tp}
22687 register as a base register, and there is a 128-byte limit to the
22688 @code{.based} section.
22689
22690 @item -mbitops
22691 @opindex mbitops
22692 Enables the bit operation instructions---bit test (@code{btstm}), set
22693 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
22694 test-and-set (@code{tas}).
22695
22696 @item -mc=@var{name}
22697 @opindex mc=
22698 Selects which section constant data is placed in. @var{name} may
22699 be @samp{tiny}, @samp{near}, or @samp{far}.
22700
22701 @item -mclip
22702 @opindex mclip
22703 Enables the @code{clip} instruction. Note that @option{-mclip} is not
22704 useful unless you also provide @option{-mminmax}.
22705
22706 @item -mconfig=@var{name}
22707 @opindex mconfig=
22708 Selects one of the built-in core configurations. Each MeP chip has
22709 one or more modules in it; each module has a core CPU and a variety of
22710 coprocessors, optional instructions, and peripherals. The
22711 @code{MeP-Integrator} tool, not part of GCC, provides these
22712 configurations through this option; using this option is the same as
22713 using all the corresponding command-line options. The default
22714 configuration is @samp{default}.
22715
22716 @item -mcop
22717 @opindex mcop
22718 Enables the coprocessor instructions. By default, this is a 32-bit
22719 coprocessor. Note that the coprocessor is normally enabled via the
22720 @option{-mconfig=} option.
22721
22722 @item -mcop32
22723 @opindex mcop32
22724 Enables the 32-bit coprocessor's instructions.
22725
22726 @item -mcop64
22727 @opindex mcop64
22728 Enables the 64-bit coprocessor's instructions.
22729
22730 @item -mivc2
22731 @opindex mivc2
22732 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
22733
22734 @item -mdc
22735 @opindex mdc
22736 Causes constant variables to be placed in the @code{.near} section.
22737
22738 @item -mdiv
22739 @opindex mdiv
22740 Enables the @code{div} and @code{divu} instructions.
22741
22742 @item -meb
22743 @opindex meb
22744 Generate big-endian code.
22745
22746 @item -mel
22747 @opindex mel
22748 Generate little-endian code.
22749
22750 @item -mio-volatile
22751 @opindex mio-volatile
22752 Tells the compiler that any variable marked with the @code{io}
22753 attribute is to be considered volatile.
22754
22755 @item -ml
22756 @opindex ml
22757 Causes variables to be assigned to the @code{.far} section by default.
22758
22759 @item -mleadz
22760 @opindex mleadz
22761 Enables the @code{leadz} (leading zero) instruction.
22762
22763 @item -mm
22764 @opindex mm
22765 Causes variables to be assigned to the @code{.near} section by default.
22766
22767 @item -mminmax
22768 @opindex mminmax
22769 Enables the @code{min} and @code{max} instructions.
22770
22771 @item -mmult
22772 @opindex mmult
22773 Enables the multiplication and multiply-accumulate instructions.
22774
22775 @item -mno-opts
22776 @opindex mno-opts
22777 Disables all the optional instructions enabled by @option{-mall-opts}.
22778
22779 @item -mrepeat
22780 @opindex mrepeat
22781 Enables the @code{repeat} and @code{erepeat} instructions, used for
22782 low-overhead looping.
22783
22784 @item -ms
22785 @opindex ms
22786 Causes all variables to default to the @code{.tiny} section. Note
22787 that there is a 65536-byte limit to this section. Accesses to these
22788 variables use the @code{%gp} base register.
22789
22790 @item -msatur
22791 @opindex msatur
22792 Enables the saturation instructions. Note that the compiler does not
22793 currently generate these itself, but this option is included for
22794 compatibility with other tools, like @code{as}.
22795
22796 @item -msdram
22797 @opindex msdram
22798 Link the SDRAM-based runtime instead of the default ROM-based runtime.
22799
22800 @item -msim
22801 @opindex msim
22802 Link the simulator run-time libraries.
22803
22804 @item -msimnovec
22805 @opindex msimnovec
22806 Link the simulator runtime libraries, excluding built-in support
22807 for reset and exception vectors and tables.
22808
22809 @item -mtf
22810 @opindex mtf
22811 Causes all functions to default to the @code{.far} section. Without
22812 this option, functions default to the @code{.near} section.
22813
22814 @item -mtiny=@var{n}
22815 @opindex mtiny=
22816 Variables that are @var{n} bytes or smaller are allocated to the
22817 @code{.tiny} section. These variables use the @code{$gp} base
22818 register. The default for this option is 4, but note that there's a
22819 65536-byte limit to the @code{.tiny} section.
22820
22821 @end table
22822
22823 @node MicroBlaze Options
22824 @subsection MicroBlaze Options
22825 @cindex MicroBlaze Options
22826
22827 @table @gcctabopt
22828
22829 @item -msoft-float
22830 @opindex msoft-float
22831 Use software emulation for floating point (default).
22832
22833 @item -mhard-float
22834 @opindex mhard-float
22835 Use hardware floating-point instructions.
22836
22837 @item -mmemcpy
22838 @opindex mmemcpy
22839 Do not optimize block moves, use @code{memcpy}.
22840
22841 @item -mno-clearbss
22842 @opindex mno-clearbss
22843 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
22844
22845 @item -mcpu=@var{cpu-type}
22846 @opindex mcpu=
22847 Use features of, and schedule code for, the given CPU.
22848 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
22849 where @var{X} is a major version, @var{YY} is the minor version, and
22850 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
22851 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
22852
22853 @item -mxl-soft-mul
22854 @opindex mxl-soft-mul
22855 Use software multiply emulation (default).
22856
22857 @item -mxl-soft-div
22858 @opindex mxl-soft-div
22859 Use software emulation for divides (default).
22860
22861 @item -mxl-barrel-shift
22862 @opindex mxl-barrel-shift
22863 Use the hardware barrel shifter.
22864
22865 @item -mxl-pattern-compare
22866 @opindex mxl-pattern-compare
22867 Use pattern compare instructions.
22868
22869 @item -msmall-divides
22870 @opindex msmall-divides
22871 Use table lookup optimization for small signed integer divisions.
22872
22873 @item -mxl-stack-check
22874 @opindex mxl-stack-check
22875 This option is deprecated. Use @option{-fstack-check} instead.
22876
22877 @item -mxl-gp-opt
22878 @opindex mxl-gp-opt
22879 Use GP-relative @code{.sdata}/@code{.sbss} sections.
22880
22881 @item -mxl-multiply-high
22882 @opindex mxl-multiply-high
22883 Use multiply high instructions for high part of 32x32 multiply.
22884
22885 @item -mxl-float-convert
22886 @opindex mxl-float-convert
22887 Use hardware floating-point conversion instructions.
22888
22889 @item -mxl-float-sqrt
22890 @opindex mxl-float-sqrt
22891 Use hardware floating-point square root instruction.
22892
22893 @item -mbig-endian
22894 @opindex mbig-endian
22895 Generate code for a big-endian target.
22896
22897 @item -mlittle-endian
22898 @opindex mlittle-endian
22899 Generate code for a little-endian target.
22900
22901 @item -mxl-reorder
22902 @opindex mxl-reorder
22903 Use reorder instructions (swap and byte reversed load/store).
22904
22905 @item -mxl-mode-@var{app-model}
22906 Select application model @var{app-model}. Valid models are
22907 @table @samp
22908 @item executable
22909 normal executable (default), uses startup code @file{crt0.o}.
22910
22911 @item -mpic-data-is-text-relative
22912 @opindex mpic-data-is-text-relative
22913 Assume that the displacement between the text and data segments is fixed
22914 at static link time. This allows data to be referenced by offset from start of
22915 text address instead of GOT since PC-relative addressing is not supported.
22916
22917 @item xmdstub
22918 for use with Xilinx Microprocessor Debugger (XMD) based
22919 software intrusive debug agent called xmdstub. This uses startup file
22920 @file{crt1.o} and sets the start address of the program to 0x800.
22921
22922 @item bootstrap
22923 for applications that are loaded using a bootloader.
22924 This model uses startup file @file{crt2.o} which does not contain a processor
22925 reset vector handler. This is suitable for transferring control on a
22926 processor reset to the bootloader rather than the application.
22927
22928 @item novectors
22929 for applications that do not require any of the
22930 MicroBlaze vectors. This option may be useful for applications running
22931 within a monitoring application. This model uses @file{crt3.o} as a startup file.
22932 @end table
22933
22934 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
22935 @option{-mxl-mode-@var{app-model}}.
22936
22937 @end table
22938
22939 @node MIPS Options
22940 @subsection MIPS Options
22941 @cindex MIPS options
22942
22943 @table @gcctabopt
22944
22945 @item -EB
22946 @opindex EB
22947 Generate big-endian code.
22948
22949 @item -EL
22950 @opindex EL
22951 Generate little-endian code. This is the default for @samp{mips*el-*-*}
22952 configurations.
22953
22954 @item -march=@var{arch}
22955 @opindex march
22956 Generate code that runs on @var{arch}, which can be the name of a
22957 generic MIPS ISA, or the name of a particular processor.
22958 The ISA names are:
22959 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
22960 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
22961 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
22962 @samp{mips64r5} and @samp{mips64r6}.
22963 The processor names are:
22964 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
22965 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
22966 @samp{5kc}, @samp{5kf},
22967 @samp{20kc},
22968 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
22969 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
22970 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
22971 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
22972 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
22973 @samp{i6400}, @samp{i6500},
22974 @samp{interaptiv},
22975 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
22976 @samp{gs464e}, @samp{gs264e},
22977 @samp{m4k},
22978 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
22979 @samp{m5100}, @samp{m5101},
22980 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
22981 @samp{orion},
22982 @samp{p5600}, @samp{p6600},
22983 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
22984 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
22985 @samp{r6000}, @samp{r8000},
22986 @samp{rm7000}, @samp{rm9000},
22987 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
22988 @samp{sb1},
22989 @samp{sr71000},
22990 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
22991 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
22992 @samp{xlr} and @samp{xlp}.
22993 The special value @samp{from-abi} selects the
22994 most compatible architecture for the selected ABI (that is,
22995 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
22996
22997 The native Linux/GNU toolchain also supports the value @samp{native},
22998 which selects the best architecture option for the host processor.
22999 @option{-march=native} has no effect if GCC does not recognize
23000 the processor.
23001
23002 In processor names, a final @samp{000} can be abbreviated as @samp{k}
23003 (for example, @option{-march=r2k}). Prefixes are optional, and
23004 @samp{vr} may be written @samp{r}.
23005
23006 Names of the form @samp{@var{n}f2_1} refer to processors with
23007 FPUs clocked at half the rate of the core, names of the form
23008 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
23009 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
23010 processors with FPUs clocked a ratio of 3:2 with respect to the core.
23011 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
23012 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
23013 accepted as synonyms for @samp{@var{n}f1_1}.
23014
23015 GCC defines two macros based on the value of this option. The first
23016 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
23017 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
23018 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
23019 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
23020 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
23021
23022 Note that the @code{_MIPS_ARCH} macro uses the processor names given
23023 above. In other words, it has the full prefix and does not
23024 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
23025 the macro names the resolved architecture (either @code{"mips1"} or
23026 @code{"mips3"}). It names the default architecture when no
23027 @option{-march} option is given.
23028
23029 @item -mtune=@var{arch}
23030 @opindex mtune
23031 Optimize for @var{arch}. Among other things, this option controls
23032 the way instructions are scheduled, and the perceived cost of arithmetic
23033 operations. The list of @var{arch} values is the same as for
23034 @option{-march}.
23035
23036 When this option is not used, GCC optimizes for the processor
23037 specified by @option{-march}. By using @option{-march} and
23038 @option{-mtune} together, it is possible to generate code that
23039 runs on a family of processors, but optimize the code for one
23040 particular member of that family.
23041
23042 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
23043 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
23044 @option{-march} ones described above.
23045
23046 @item -mips1
23047 @opindex mips1
23048 Equivalent to @option{-march=mips1}.
23049
23050 @item -mips2
23051 @opindex mips2
23052 Equivalent to @option{-march=mips2}.
23053
23054 @item -mips3
23055 @opindex mips3
23056 Equivalent to @option{-march=mips3}.
23057
23058 @item -mips4
23059 @opindex mips4
23060 Equivalent to @option{-march=mips4}.
23061
23062 @item -mips32
23063 @opindex mips32
23064 Equivalent to @option{-march=mips32}.
23065
23066 @item -mips32r3
23067 @opindex mips32r3
23068 Equivalent to @option{-march=mips32r3}.
23069
23070 @item -mips32r5
23071 @opindex mips32r5
23072 Equivalent to @option{-march=mips32r5}.
23073
23074 @item -mips32r6
23075 @opindex mips32r6
23076 Equivalent to @option{-march=mips32r6}.
23077
23078 @item -mips64
23079 @opindex mips64
23080 Equivalent to @option{-march=mips64}.
23081
23082 @item -mips64r2
23083 @opindex mips64r2
23084 Equivalent to @option{-march=mips64r2}.
23085
23086 @item -mips64r3
23087 @opindex mips64r3
23088 Equivalent to @option{-march=mips64r3}.
23089
23090 @item -mips64r5
23091 @opindex mips64r5
23092 Equivalent to @option{-march=mips64r5}.
23093
23094 @item -mips64r6
23095 @opindex mips64r6
23096 Equivalent to @option{-march=mips64r6}.
23097
23098 @item -mips16
23099 @itemx -mno-mips16
23100 @opindex mips16
23101 @opindex mno-mips16
23102 Generate (do not generate) MIPS16 code. If GCC is targeting a
23103 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
23104
23105 MIPS16 code generation can also be controlled on a per-function basis
23106 by means of @code{mips16} and @code{nomips16} attributes.
23107 @xref{Function Attributes}, for more information.
23108
23109 @item -mflip-mips16
23110 @opindex mflip-mips16
23111 Generate MIPS16 code on alternating functions. This option is provided
23112 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
23113 not intended for ordinary use in compiling user code.
23114
23115 @item -minterlink-compressed
23116 @itemx -mno-interlink-compressed
23117 @opindex minterlink-compressed
23118 @opindex mno-interlink-compressed
23119 Require (do not require) that code using the standard (uncompressed) MIPS ISA
23120 be link-compatible with MIPS16 and microMIPS code, and vice versa.
23121
23122 For example, code using the standard ISA encoding cannot jump directly
23123 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
23124 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
23125 knows that the target of the jump is not compressed.
23126
23127 @item -minterlink-mips16
23128 @itemx -mno-interlink-mips16
23129 @opindex minterlink-mips16
23130 @opindex mno-interlink-mips16
23131 Aliases of @option{-minterlink-compressed} and
23132 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
23133 and are retained for backwards compatibility.
23134
23135 @item -mabi=32
23136 @itemx -mabi=o64
23137 @itemx -mabi=n32
23138 @itemx -mabi=64
23139 @itemx -mabi=eabi
23140 @opindex mabi=32
23141 @opindex mabi=o64
23142 @opindex mabi=n32
23143 @opindex mabi=64
23144 @opindex mabi=eabi
23145 Generate code for the given ABI@.
23146
23147 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23148 generates 64-bit code when you select a 64-bit architecture, but you
23149 can use @option{-mgp32} to get 32-bit code instead.
23150
23151 For information about the O64 ABI, see
23152 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23153
23154 GCC supports a variant of the o32 ABI in which floating-point registers
23155 are 64 rather than 32 bits wide. You can select this combination with
23156 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
23157 and @code{mfhc1} instructions and is therefore only supported for
23158 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23159
23160 The register assignments for arguments and return values remain the
23161 same, but each scalar value is passed in a single 64-bit register
23162 rather than a pair of 32-bit registers. For example, scalar
23163 floating-point values are returned in @samp{$f0} only, not a
23164 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
23165 remains the same in that the even-numbered double-precision registers
23166 are saved.
23167
23168 Two additional variants of the o32 ABI are supported to enable
23169 a transition from 32-bit to 64-bit registers. These are FPXX
23170 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23171 The FPXX extension mandates that all code must execute correctly
23172 when run using 32-bit or 64-bit registers. The code can be interlinked
23173 with either FP32 or FP64, but not both.
23174 The FP64A extension is similar to the FP64 extension but forbids the
23175 use of odd-numbered single-precision registers. This can be used
23176 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23177 processors and allows both FP32 and FP64A code to interlink and
23178 run in the same process without changing FPU modes.
23179
23180 @item -mabicalls
23181 @itemx -mno-abicalls
23182 @opindex mabicalls
23183 @opindex mno-abicalls
23184 Generate (do not generate) code that is suitable for SVR4-style
23185 dynamic objects. @option{-mabicalls} is the default for SVR4-based
23186 systems.
23187
23188 @item -mshared
23189 @itemx -mno-shared
23190 Generate (do not generate) code that is fully position-independent,
23191 and that can therefore be linked into shared libraries. This option
23192 only affects @option{-mabicalls}.
23193
23194 All @option{-mabicalls} code has traditionally been position-independent,
23195 regardless of options like @option{-fPIC} and @option{-fpic}. However,
23196 as an extension, the GNU toolchain allows executables to use absolute
23197 accesses for locally-binding symbols. It can also use shorter GP
23198 initialization sequences and generate direct calls to locally-defined
23199 functions. This mode is selected by @option{-mno-shared}.
23200
23201 @option{-mno-shared} depends on binutils 2.16 or higher and generates
23202 objects that can only be linked by the GNU linker. However, the option
23203 does not affect the ABI of the final executable; it only affects the ABI
23204 of relocatable objects. Using @option{-mno-shared} generally makes
23205 executables both smaller and quicker.
23206
23207 @option{-mshared} is the default.
23208
23209 @item -mplt
23210 @itemx -mno-plt
23211 @opindex mplt
23212 @opindex mno-plt
23213 Assume (do not assume) that the static and dynamic linkers
23214 support PLTs and copy relocations. This option only affects
23215 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
23216 has no effect without @option{-msym32}.
23217
23218 You can make @option{-mplt} the default by configuring
23219 GCC with @option{--with-mips-plt}. The default is
23220 @option{-mno-plt} otherwise.
23221
23222 @item -mxgot
23223 @itemx -mno-xgot
23224 @opindex mxgot
23225 @opindex mno-xgot
23226 Lift (do not lift) the usual restrictions on the size of the global
23227 offset table.
23228
23229 GCC normally uses a single instruction to load values from the GOT@.
23230 While this is relatively efficient, it only works if the GOT
23231 is smaller than about 64k. Anything larger causes the linker
23232 to report an error such as:
23233
23234 @cindex relocation truncated to fit (MIPS)
23235 @smallexample
23236 relocation truncated to fit: R_MIPS_GOT16 foobar
23237 @end smallexample
23238
23239 If this happens, you should recompile your code with @option{-mxgot}.
23240 This works with very large GOTs, although the code is also
23241 less efficient, since it takes three instructions to fetch the
23242 value of a global symbol.
23243
23244 Note that some linkers can create multiple GOTs. If you have such a
23245 linker, you should only need to use @option{-mxgot} when a single object
23246 file accesses more than 64k's worth of GOT entries. Very few do.
23247
23248 These options have no effect unless GCC is generating position
23249 independent code.
23250
23251 @item -mgp32
23252 @opindex mgp32
23253 Assume that general-purpose registers are 32 bits wide.
23254
23255 @item -mgp64
23256 @opindex mgp64
23257 Assume that general-purpose registers are 64 bits wide.
23258
23259 @item -mfp32
23260 @opindex mfp32
23261 Assume that floating-point registers are 32 bits wide.
23262
23263 @item -mfp64
23264 @opindex mfp64
23265 Assume that floating-point registers are 64 bits wide.
23266
23267 @item -mfpxx
23268 @opindex mfpxx
23269 Do not assume the width of floating-point registers.
23270
23271 @item -mhard-float
23272 @opindex mhard-float
23273 Use floating-point coprocessor instructions.
23274
23275 @item -msoft-float
23276 @opindex msoft-float
23277 Do not use floating-point coprocessor instructions. Implement
23278 floating-point calculations using library calls instead.
23279
23280 @item -mno-float
23281 @opindex mno-float
23282 Equivalent to @option{-msoft-float}, but additionally asserts that the
23283 program being compiled does not perform any floating-point operations.
23284 This option is presently supported only by some bare-metal MIPS
23285 configurations, where it may select a special set of libraries
23286 that lack all floating-point support (including, for example, the
23287 floating-point @code{printf} formats).
23288 If code compiled with @option{-mno-float} accidentally contains
23289 floating-point operations, it is likely to suffer a link-time
23290 or run-time failure.
23291
23292 @item -msingle-float
23293 @opindex msingle-float
23294 Assume that the floating-point coprocessor only supports single-precision
23295 operations.
23296
23297 @item -mdouble-float
23298 @opindex mdouble-float
23299 Assume that the floating-point coprocessor supports double-precision
23300 operations. This is the default.
23301
23302 @item -modd-spreg
23303 @itemx -mno-odd-spreg
23304 @opindex modd-spreg
23305 @opindex mno-odd-spreg
23306 Enable the use of odd-numbered single-precision floating-point registers
23307 for the o32 ABI. This is the default for processors that are known to
23308 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23309 is set by default.
23310
23311 @item -mabs=2008
23312 @itemx -mabs=legacy
23313 @opindex mabs=2008
23314 @opindex mabs=legacy
23315 These options control the treatment of the special not-a-number (NaN)
23316 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23317 @code{neg.@i{fmt}} machine instructions.
23318
23319 By default or when @option{-mabs=legacy} is used the legacy
23320 treatment is selected. In this case these instructions are considered
23321 arithmetic and avoided where correct operation is required and the
23322 input operand might be a NaN. A longer sequence of instructions that
23323 manipulate the sign bit of floating-point datum manually is used
23324 instead unless the @option{-ffinite-math-only} option has also been
23325 specified.
23326
23327 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
23328 this case these instructions are considered non-arithmetic and therefore
23329 operating correctly in all cases, including in particular where the
23330 input operand is a NaN. These instructions are therefore always used
23331 for the respective operations.
23332
23333 @item -mnan=2008
23334 @itemx -mnan=legacy
23335 @opindex mnan=2008
23336 @opindex mnan=legacy
23337 These options control the encoding of the special not-a-number (NaN)
23338 IEEE 754 floating-point data.
23339
23340 The @option{-mnan=legacy} option selects the legacy encoding. In this
23341 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23342 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23343 by the first bit of their trailing significand field being 1.
23344
23345 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
23346 this case qNaNs are denoted by the first bit of their trailing
23347 significand field being 1, whereas sNaNs are denoted by the first bit of
23348 their trailing significand field being 0.
23349
23350 The default is @option{-mnan=legacy} unless GCC has been configured with
23351 @option{--with-nan=2008}.
23352
23353 @item -mllsc
23354 @itemx -mno-llsc
23355 @opindex mllsc
23356 @opindex mno-llsc
23357 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23358 implement atomic memory built-in functions. When neither option is
23359 specified, GCC uses the instructions if the target architecture
23360 supports them.
23361
23362 @option{-mllsc} is useful if the runtime environment can emulate the
23363 instructions and @option{-mno-llsc} can be useful when compiling for
23364 nonstandard ISAs. You can make either option the default by
23365 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23366 respectively. @option{--with-llsc} is the default for some
23367 configurations; see the installation documentation for details.
23368
23369 @item -mdsp
23370 @itemx -mno-dsp
23371 @opindex mdsp
23372 @opindex mno-dsp
23373 Use (do not use) revision 1 of the MIPS DSP ASE@.
23374 @xref{MIPS DSP Built-in Functions}. This option defines the
23375 preprocessor macro @code{__mips_dsp}. It also defines
23376 @code{__mips_dsp_rev} to 1.
23377
23378 @item -mdspr2
23379 @itemx -mno-dspr2
23380 @opindex mdspr2
23381 @opindex mno-dspr2
23382 Use (do not use) revision 2 of the MIPS DSP ASE@.
23383 @xref{MIPS DSP Built-in Functions}. This option defines the
23384 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23385 It also defines @code{__mips_dsp_rev} to 2.
23386
23387 @item -msmartmips
23388 @itemx -mno-smartmips
23389 @opindex msmartmips
23390 @opindex mno-smartmips
23391 Use (do not use) the MIPS SmartMIPS ASE.
23392
23393 @item -mpaired-single
23394 @itemx -mno-paired-single
23395 @opindex mpaired-single
23396 @opindex mno-paired-single
23397 Use (do not use) paired-single floating-point instructions.
23398 @xref{MIPS Paired-Single Support}. This option requires
23399 hardware floating-point support to be enabled.
23400
23401 @item -mdmx
23402 @itemx -mno-mdmx
23403 @opindex mdmx
23404 @opindex mno-mdmx
23405 Use (do not use) MIPS Digital Media Extension instructions.
23406 This option can only be used when generating 64-bit code and requires
23407 hardware floating-point support to be enabled.
23408
23409 @item -mips3d
23410 @itemx -mno-mips3d
23411 @opindex mips3d
23412 @opindex mno-mips3d
23413 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
23414 The option @option{-mips3d} implies @option{-mpaired-single}.
23415
23416 @item -mmicromips
23417 @itemx -mno-micromips
23418 @opindex mmicromips
23419 @opindex mno-mmicromips
23420 Generate (do not generate) microMIPS code.
23421
23422 MicroMIPS code generation can also be controlled on a per-function basis
23423 by means of @code{micromips} and @code{nomicromips} attributes.
23424 @xref{Function Attributes}, for more information.
23425
23426 @item -mmt
23427 @itemx -mno-mt
23428 @opindex mmt
23429 @opindex mno-mt
23430 Use (do not use) MT Multithreading instructions.
23431
23432 @item -mmcu
23433 @itemx -mno-mcu
23434 @opindex mmcu
23435 @opindex mno-mcu
23436 Use (do not use) the MIPS MCU ASE instructions.
23437
23438 @item -meva
23439 @itemx -mno-eva
23440 @opindex meva
23441 @opindex mno-eva
23442 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23443
23444 @item -mvirt
23445 @itemx -mno-virt
23446 @opindex mvirt
23447 @opindex mno-virt
23448 Use (do not use) the MIPS Virtualization (VZ) instructions.
23449
23450 @item -mxpa
23451 @itemx -mno-xpa
23452 @opindex mxpa
23453 @opindex mno-xpa
23454 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23455
23456 @item -mcrc
23457 @itemx -mno-crc
23458 @opindex mcrc
23459 @opindex mno-crc
23460 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23461
23462 @item -mginv
23463 @itemx -mno-ginv
23464 @opindex mginv
23465 @opindex mno-ginv
23466 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23467
23468 @item -mloongson-mmi
23469 @itemx -mno-loongson-mmi
23470 @opindex mloongson-mmi
23471 @opindex mno-loongson-mmi
23472 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23473
23474 @item -mloongson-ext
23475 @itemx -mno-loongson-ext
23476 @opindex mloongson-ext
23477 @opindex mno-loongson-ext
23478 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23479
23480 @item -mloongson-ext2
23481 @itemx -mno-loongson-ext2
23482 @opindex mloongson-ext2
23483 @opindex mno-loongson-ext2
23484 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23485
23486 @item -mlong64
23487 @opindex mlong64
23488 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
23489 an explanation of the default and the way that the pointer size is
23490 determined.
23491
23492 @item -mlong32
23493 @opindex mlong32
23494 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23495
23496 The default size of @code{int}s, @code{long}s and pointers depends on
23497 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
23498 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
23499 32-bit @code{long}s. Pointers are the same size as @code{long}s,
23500 or the same size as integer registers, whichever is smaller.
23501
23502 @item -msym32
23503 @itemx -mno-sym32
23504 @opindex msym32
23505 @opindex mno-sym32
23506 Assume (do not assume) that all symbols have 32-bit values, regardless
23507 of the selected ABI@. This option is useful in combination with
23508 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23509 to generate shorter and faster references to symbolic addresses.
23510
23511 @item -G @var{num}
23512 @opindex G
23513 Put definitions of externally-visible data in a small data section
23514 if that data is no bigger than @var{num} bytes. GCC can then generate
23515 more efficient accesses to the data; see @option{-mgpopt} for details.
23516
23517 The default @option{-G} option depends on the configuration.
23518
23519 @item -mlocal-sdata
23520 @itemx -mno-local-sdata
23521 @opindex mlocal-sdata
23522 @opindex mno-local-sdata
23523 Extend (do not extend) the @option{-G} behavior to local data too,
23524 such as to static variables in C@. @option{-mlocal-sdata} is the
23525 default for all configurations.
23526
23527 If the linker complains that an application is using too much small data,
23528 you might want to try rebuilding the less performance-critical parts with
23529 @option{-mno-local-sdata}. You might also want to build large
23530 libraries with @option{-mno-local-sdata}, so that the libraries leave
23531 more room for the main program.
23532
23533 @item -mextern-sdata
23534 @itemx -mno-extern-sdata
23535 @opindex mextern-sdata
23536 @opindex mno-extern-sdata
23537 Assume (do not assume) that externally-defined data is in
23538 a small data section if the size of that data is within the @option{-G} limit.
23539 @option{-mextern-sdata} is the default for all configurations.
23540
23541 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
23542 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
23543 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
23544 is placed in a small data section. If @var{Var} is defined by another
23545 module, you must either compile that module with a high-enough
23546 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
23547 definition. If @var{Var} is common, you must link the application
23548 with a high-enough @option{-G} setting.
23549
23550 The easiest way of satisfying these restrictions is to compile
23551 and link every module with the same @option{-G} option. However,
23552 you may wish to build a library that supports several different
23553 small data limits. You can do this by compiling the library with
23554 the highest supported @option{-G} setting and additionally using
23555 @option{-mno-extern-sdata} to stop the library from making assumptions
23556 about externally-defined data.
23557
23558 @item -mgpopt
23559 @itemx -mno-gpopt
23560 @opindex mgpopt
23561 @opindex mno-gpopt
23562 Use (do not use) GP-relative accesses for symbols that are known to be
23563 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
23564 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
23565 configurations.
23566
23567 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
23568 might not hold the value of @code{_gp}. For example, if the code is
23569 part of a library that might be used in a boot monitor, programs that
23570 call boot monitor routines pass an unknown value in @code{$gp}.
23571 (In such situations, the boot monitor itself is usually compiled
23572 with @option{-G0}.)
23573
23574 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
23575 @option{-mno-extern-sdata}.
23576
23577 @item -membedded-data
23578 @itemx -mno-embedded-data
23579 @opindex membedded-data
23580 @opindex mno-embedded-data
23581 Allocate variables to the read-only data section first if possible, then
23582 next in the small data section if possible, otherwise in data. This gives
23583 slightly slower code than the default, but reduces the amount of RAM required
23584 when executing, and thus may be preferred for some embedded systems.
23585
23586 @item -muninit-const-in-rodata
23587 @itemx -mno-uninit-const-in-rodata
23588 @opindex muninit-const-in-rodata
23589 @opindex mno-uninit-const-in-rodata
23590 Put uninitialized @code{const} variables in the read-only data section.
23591 This option is only meaningful in conjunction with @option{-membedded-data}.
23592
23593 @item -mcode-readable=@var{setting}
23594 @opindex mcode-readable
23595 Specify whether GCC may generate code that reads from executable sections.
23596 There are three possible settings:
23597
23598 @table @gcctabopt
23599 @item -mcode-readable=yes
23600 Instructions may freely access executable sections. This is the
23601 default setting.
23602
23603 @item -mcode-readable=pcrel
23604 MIPS16 PC-relative load instructions can access executable sections,
23605 but other instructions must not do so. This option is useful on 4KSc
23606 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
23607 It is also useful on processors that can be configured to have a dual
23608 instruction/data SRAM interface and that, like the M4K, automatically
23609 redirect PC-relative loads to the instruction RAM.
23610
23611 @item -mcode-readable=no
23612 Instructions must not access executable sections. This option can be
23613 useful on targets that are configured to have a dual instruction/data
23614 SRAM interface but that (unlike the M4K) do not automatically redirect
23615 PC-relative loads to the instruction RAM.
23616 @end table
23617
23618 @item -msplit-addresses
23619 @itemx -mno-split-addresses
23620 @opindex msplit-addresses
23621 @opindex mno-split-addresses
23622 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
23623 relocation operators. This option has been superseded by
23624 @option{-mexplicit-relocs} but is retained for backwards compatibility.
23625
23626 @item -mexplicit-relocs
23627 @itemx -mno-explicit-relocs
23628 @opindex mexplicit-relocs
23629 @opindex mno-explicit-relocs
23630 Use (do not use) assembler relocation operators when dealing with symbolic
23631 addresses. The alternative, selected by @option{-mno-explicit-relocs},
23632 is to use assembler macros instead.
23633
23634 @option{-mexplicit-relocs} is the default if GCC was configured
23635 to use an assembler that supports relocation operators.
23636
23637 @item -mcheck-zero-division
23638 @itemx -mno-check-zero-division
23639 @opindex mcheck-zero-division
23640 @opindex mno-check-zero-division
23641 Trap (do not trap) on integer division by zero.
23642
23643 The default is @option{-mcheck-zero-division}.
23644
23645 @item -mdivide-traps
23646 @itemx -mdivide-breaks
23647 @opindex mdivide-traps
23648 @opindex mdivide-breaks
23649 MIPS systems check for division by zero by generating either a
23650 conditional trap or a break instruction. Using traps results in
23651 smaller code, but is only supported on MIPS II and later. Also, some
23652 versions of the Linux kernel have a bug that prevents trap from
23653 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
23654 allow conditional traps on architectures that support them and
23655 @option{-mdivide-breaks} to force the use of breaks.
23656
23657 The default is usually @option{-mdivide-traps}, but this can be
23658 overridden at configure time using @option{--with-divide=breaks}.
23659 Divide-by-zero checks can be completely disabled using
23660 @option{-mno-check-zero-division}.
23661
23662 @item -mload-store-pairs
23663 @itemx -mno-load-store-pairs
23664 @opindex mload-store-pairs
23665 @opindex mno-load-store-pairs
23666 Enable (disable) an optimization that pairs consecutive load or store
23667 instructions to enable load/store bonding. This option is enabled by
23668 default but only takes effect when the selected architecture is known
23669 to support bonding.
23670
23671 @item -mmemcpy
23672 @itemx -mno-memcpy
23673 @opindex mmemcpy
23674 @opindex mno-memcpy
23675 Force (do not force) the use of @code{memcpy} for non-trivial block
23676 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
23677 most constant-sized copies.
23678
23679 @item -mlong-calls
23680 @itemx -mno-long-calls
23681 @opindex mlong-calls
23682 @opindex mno-long-calls
23683 Disable (do not disable) use of the @code{jal} instruction. Calling
23684 functions using @code{jal} is more efficient but requires the caller
23685 and callee to be in the same 256 megabyte segment.
23686
23687 This option has no effect on abicalls code. The default is
23688 @option{-mno-long-calls}.
23689
23690 @item -mmad
23691 @itemx -mno-mad
23692 @opindex mmad
23693 @opindex mno-mad
23694 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
23695 instructions, as provided by the R4650 ISA@.
23696
23697 @item -mimadd
23698 @itemx -mno-imadd
23699 @opindex mimadd
23700 @opindex mno-imadd
23701 Enable (disable) use of the @code{madd} and @code{msub} integer
23702 instructions. The default is @option{-mimadd} on architectures
23703 that support @code{madd} and @code{msub} except for the 74k
23704 architecture where it was found to generate slower code.
23705
23706 @item -mfused-madd
23707 @itemx -mno-fused-madd
23708 @opindex mfused-madd
23709 @opindex mno-fused-madd
23710 Enable (disable) use of the floating-point multiply-accumulate
23711 instructions, when they are available. The default is
23712 @option{-mfused-madd}.
23713
23714 On the R8000 CPU when multiply-accumulate instructions are used,
23715 the intermediate product is calculated to infinite precision
23716 and is not subject to the FCSR Flush to Zero bit. This may be
23717 undesirable in some circumstances. On other processors the result
23718 is numerically identical to the equivalent computation using
23719 separate multiply, add, subtract and negate instructions.
23720
23721 @item -nocpp
23722 @opindex nocpp
23723 Tell the MIPS assembler to not run its preprocessor over user
23724 assembler files (with a @samp{.s} suffix) when assembling them.
23725
23726 @item -mfix-24k
23727 @itemx -mno-fix-24k
23728 @opindex mfix-24k
23729 @opindex mno-fix-24k
23730 Work around the 24K E48 (lost data on stores during refill) errata.
23731 The workarounds are implemented by the assembler rather than by GCC@.
23732
23733 @item -mfix-r4000
23734 @itemx -mno-fix-r4000
23735 @opindex mfix-r4000
23736 @opindex mno-fix-r4000
23737 Work around certain R4000 CPU errata:
23738 @itemize @minus
23739 @item
23740 A double-word or a variable shift may give an incorrect result if executed
23741 immediately after starting an integer division.
23742 @item
23743 A double-word or a variable shift may give an incorrect result if executed
23744 while an integer multiplication is in progress.
23745 @item
23746 An integer division may give an incorrect result if started in a delay slot
23747 of a taken branch or a jump.
23748 @end itemize
23749
23750 @item -mfix-r4400
23751 @itemx -mno-fix-r4400
23752 @opindex mfix-r4400
23753 @opindex mno-fix-r4400
23754 Work around certain R4400 CPU errata:
23755 @itemize @minus
23756 @item
23757 A double-word or a variable shift may give an incorrect result if executed
23758 immediately after starting an integer division.
23759 @end itemize
23760
23761 @item -mfix-r10000
23762 @itemx -mno-fix-r10000
23763 @opindex mfix-r10000
23764 @opindex mno-fix-r10000
23765 Work around certain R10000 errata:
23766 @itemize @minus
23767 @item
23768 @code{ll}/@code{sc} sequences may not behave atomically on revisions
23769 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
23770 @end itemize
23771
23772 This option can only be used if the target architecture supports
23773 branch-likely instructions. @option{-mfix-r10000} is the default when
23774 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
23775 otherwise.
23776
23777 @item -mfix-r5900
23778 @itemx -mno-fix-r5900
23779 @opindex mfix-r5900
23780 Do not attempt to schedule the preceding instruction into the delay slot
23781 of a branch instruction placed at the end of a short loop of six
23782 instructions or fewer and always schedule a @code{nop} instruction there
23783 instead. The short loop bug under certain conditions causes loops to
23784 execute only once or twice, due to a hardware bug in the R5900 chip. The
23785 workaround is implemented by the assembler rather than by GCC@.
23786
23787 @item -mfix-rm7000
23788 @itemx -mno-fix-rm7000
23789 @opindex mfix-rm7000
23790 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
23791 workarounds are implemented by the assembler rather than by GCC@.
23792
23793 @item -mfix-vr4120
23794 @itemx -mno-fix-vr4120
23795 @opindex mfix-vr4120
23796 Work around certain VR4120 errata:
23797 @itemize @minus
23798 @item
23799 @code{dmultu} does not always produce the correct result.
23800 @item
23801 @code{div} and @code{ddiv} do not always produce the correct result if one
23802 of the operands is negative.
23803 @end itemize
23804 The workarounds for the division errata rely on special functions in
23805 @file{libgcc.a}. At present, these functions are only provided by
23806 the @code{mips64vr*-elf} configurations.
23807
23808 Other VR4120 errata require a NOP to be inserted between certain pairs of
23809 instructions. These errata are handled by the assembler, not by GCC itself.
23810
23811 @item -mfix-vr4130
23812 @opindex mfix-vr4130
23813 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
23814 workarounds are implemented by the assembler rather than by GCC,
23815 although GCC avoids using @code{mflo} and @code{mfhi} if the
23816 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
23817 instructions are available instead.
23818
23819 @item -mfix-sb1
23820 @itemx -mno-fix-sb1
23821 @opindex mfix-sb1
23822 Work around certain SB-1 CPU core errata.
23823 (This flag currently works around the SB-1 revision 2
23824 ``F1'' and ``F2'' floating-point errata.)
23825
23826 @item -mr10k-cache-barrier=@var{setting}
23827 @opindex mr10k-cache-barrier
23828 Specify whether GCC should insert cache barriers to avoid the
23829 side effects of speculation on R10K processors.
23830
23831 In common with many processors, the R10K tries to predict the outcome
23832 of a conditional branch and speculatively executes instructions from
23833 the ``taken'' branch. It later aborts these instructions if the
23834 predicted outcome is wrong. However, on the R10K, even aborted
23835 instructions can have side effects.
23836
23837 This problem only affects kernel stores and, depending on the system,
23838 kernel loads. As an example, a speculatively-executed store may load
23839 the target memory into cache and mark the cache line as dirty, even if
23840 the store itself is later aborted. If a DMA operation writes to the
23841 same area of memory before the ``dirty'' line is flushed, the cached
23842 data overwrites the DMA-ed data. See the R10K processor manual
23843 for a full description, including other potential problems.
23844
23845 One workaround is to insert cache barrier instructions before every memory
23846 access that might be speculatively executed and that might have side
23847 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
23848 controls GCC's implementation of this workaround. It assumes that
23849 aborted accesses to any byte in the following regions does not have
23850 side effects:
23851
23852 @enumerate
23853 @item
23854 the memory occupied by the current function's stack frame;
23855
23856 @item
23857 the memory occupied by an incoming stack argument;
23858
23859 @item
23860 the memory occupied by an object with a link-time-constant address.
23861 @end enumerate
23862
23863 It is the kernel's responsibility to ensure that speculative
23864 accesses to these regions are indeed safe.
23865
23866 If the input program contains a function declaration such as:
23867
23868 @smallexample
23869 void foo (void);
23870 @end smallexample
23871
23872 then the implementation of @code{foo} must allow @code{j foo} and
23873 @code{jal foo} to be executed speculatively. GCC honors this
23874 restriction for functions it compiles itself. It expects non-GCC
23875 functions (such as hand-written assembly code) to do the same.
23876
23877 The option has three forms:
23878
23879 @table @gcctabopt
23880 @item -mr10k-cache-barrier=load-store
23881 Insert a cache barrier before a load or store that might be
23882 speculatively executed and that might have side effects even
23883 if aborted.
23884
23885 @item -mr10k-cache-barrier=store
23886 Insert a cache barrier before a store that might be speculatively
23887 executed and that might have side effects even if aborted.
23888
23889 @item -mr10k-cache-barrier=none
23890 Disable the insertion of cache barriers. This is the default setting.
23891 @end table
23892
23893 @item -mflush-func=@var{func}
23894 @itemx -mno-flush-func
23895 @opindex mflush-func
23896 Specifies the function to call to flush the I and D caches, or to not
23897 call any such function. If called, the function must take the same
23898 arguments as the common @code{_flush_func}, that is, the address of the
23899 memory range for which the cache is being flushed, the size of the
23900 memory range, and the number 3 (to flush both caches). The default
23901 depends on the target GCC was configured for, but commonly is either
23902 @code{_flush_func} or @code{__cpu_flush}.
23903
23904 @item mbranch-cost=@var{num}
23905 @opindex mbranch-cost
23906 Set the cost of branches to roughly @var{num} ``simple'' instructions.
23907 This cost is only a heuristic and is not guaranteed to produce
23908 consistent results across releases. A zero cost redundantly selects
23909 the default, which is based on the @option{-mtune} setting.
23910
23911 @item -mbranch-likely
23912 @itemx -mno-branch-likely
23913 @opindex mbranch-likely
23914 @opindex mno-branch-likely
23915 Enable or disable use of Branch Likely instructions, regardless of the
23916 default for the selected architecture. By default, Branch Likely
23917 instructions may be generated if they are supported by the selected
23918 architecture. An exception is for the MIPS32 and MIPS64 architectures
23919 and processors that implement those architectures; for those, Branch
23920 Likely instructions are not be generated by default because the MIPS32
23921 and MIPS64 architectures specifically deprecate their use.
23922
23923 @item -mcompact-branches=never
23924 @itemx -mcompact-branches=optimal
23925 @itemx -mcompact-branches=always
23926 @opindex mcompact-branches=never
23927 @opindex mcompact-branches=optimal
23928 @opindex mcompact-branches=always
23929 These options control which form of branches will be generated. The
23930 default is @option{-mcompact-branches=optimal}.
23931
23932 The @option{-mcompact-branches=never} option ensures that compact branch
23933 instructions will never be generated.
23934
23935 The @option{-mcompact-branches=always} option ensures that a compact
23936 branch instruction will be generated if available. If a compact branch
23937 instruction is not available, a delay slot form of the branch will be
23938 used instead.
23939
23940 This option is supported from MIPS Release 6 onwards.
23941
23942 The @option{-mcompact-branches=optimal} option will cause a delay slot
23943 branch to be used if one is available in the current ISA and the delay
23944 slot is successfully filled. If the delay slot is not filled, a compact
23945 branch will be chosen if one is available.
23946
23947 @item -mfp-exceptions
23948 @itemx -mno-fp-exceptions
23949 @opindex mfp-exceptions
23950 Specifies whether FP exceptions are enabled. This affects how
23951 FP instructions are scheduled for some processors.
23952 The default is that FP exceptions are
23953 enabled.
23954
23955 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
23956 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
23957 FP pipe.
23958
23959 @item -mvr4130-align
23960 @itemx -mno-vr4130-align
23961 @opindex mvr4130-align
23962 The VR4130 pipeline is two-way superscalar, but can only issue two
23963 instructions together if the first one is 8-byte aligned. When this
23964 option is enabled, GCC aligns pairs of instructions that it
23965 thinks should execute in parallel.
23966
23967 This option only has an effect when optimizing for the VR4130.
23968 It normally makes code faster, but at the expense of making it bigger.
23969 It is enabled by default at optimization level @option{-O3}.
23970
23971 @item -msynci
23972 @itemx -mno-synci
23973 @opindex msynci
23974 Enable (disable) generation of @code{synci} instructions on
23975 architectures that support it. The @code{synci} instructions (if
23976 enabled) are generated when @code{__builtin___clear_cache} is
23977 compiled.
23978
23979 This option defaults to @option{-mno-synci}, but the default can be
23980 overridden by configuring GCC with @option{--with-synci}.
23981
23982 When compiling code for single processor systems, it is generally safe
23983 to use @code{synci}. However, on many multi-core (SMP) systems, it
23984 does not invalidate the instruction caches on all cores and may lead
23985 to undefined behavior.
23986
23987 @item -mrelax-pic-calls
23988 @itemx -mno-relax-pic-calls
23989 @opindex mrelax-pic-calls
23990 Try to turn PIC calls that are normally dispatched via register
23991 @code{$25} into direct calls. This is only possible if the linker can
23992 resolve the destination at link time and if the destination is within
23993 range for a direct call.
23994
23995 @option{-mrelax-pic-calls} is the default if GCC was configured to use
23996 an assembler and a linker that support the @code{.reloc} assembly
23997 directive and @option{-mexplicit-relocs} is in effect. With
23998 @option{-mno-explicit-relocs}, this optimization can be performed by the
23999 assembler and the linker alone without help from the compiler.
24000
24001 @item -mmcount-ra-address
24002 @itemx -mno-mcount-ra-address
24003 @opindex mmcount-ra-address
24004 @opindex mno-mcount-ra-address
24005 Emit (do not emit) code that allows @code{_mcount} to modify the
24006 calling function's return address. When enabled, this option extends
24007 the usual @code{_mcount} interface with a new @var{ra-address}
24008 parameter, which has type @code{intptr_t *} and is passed in register
24009 @code{$12}. @code{_mcount} can then modify the return address by
24010 doing both of the following:
24011 @itemize
24012 @item
24013 Returning the new address in register @code{$31}.
24014 @item
24015 Storing the new address in @code{*@var{ra-address}},
24016 if @var{ra-address} is nonnull.
24017 @end itemize
24018
24019 The default is @option{-mno-mcount-ra-address}.
24020
24021 @item -mframe-header-opt
24022 @itemx -mno-frame-header-opt
24023 @opindex mframe-header-opt
24024 Enable (disable) frame header optimization in the o32 ABI. When using the
24025 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
24026 function to write out register arguments. When enabled, this optimization
24027 will suppress the allocation of the frame header if it can be determined that
24028 it is unused.
24029
24030 This optimization is off by default at all optimization levels.
24031
24032 @item -mlxc1-sxc1
24033 @itemx -mno-lxc1-sxc1
24034 @opindex mlxc1-sxc1
24035 When applicable, enable (disable) the generation of @code{lwxc1},
24036 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
24037
24038 @item -mmadd4
24039 @itemx -mno-madd4
24040 @opindex mmadd4
24041 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
24042 @code{madd.d} and related instructions. Enabled by default.
24043
24044 @end table
24045
24046 @node MMIX Options
24047 @subsection MMIX Options
24048 @cindex MMIX Options
24049
24050 These options are defined for the MMIX:
24051
24052 @table @gcctabopt
24053 @item -mlibfuncs
24054 @itemx -mno-libfuncs
24055 @opindex mlibfuncs
24056 @opindex mno-libfuncs
24057 Specify that intrinsic library functions are being compiled, passing all
24058 values in registers, no matter the size.
24059
24060 @item -mepsilon
24061 @itemx -mno-epsilon
24062 @opindex mepsilon
24063 @opindex mno-epsilon
24064 Generate floating-point comparison instructions that compare with respect
24065 to the @code{rE} epsilon register.
24066
24067 @item -mabi=mmixware
24068 @itemx -mabi=gnu
24069 @opindex mabi=mmixware
24070 @opindex mabi=gnu
24071 Generate code that passes function parameters and return values that (in
24072 the called function) are seen as registers @code{$0} and up, as opposed to
24073 the GNU ABI which uses global registers @code{$231} and up.
24074
24075 @item -mzero-extend
24076 @itemx -mno-zero-extend
24077 @opindex mzero-extend
24078 @opindex mno-zero-extend
24079 When reading data from memory in sizes shorter than 64 bits, use (do not
24080 use) zero-extending load instructions by default, rather than
24081 sign-extending ones.
24082
24083 @item -mknuthdiv
24084 @itemx -mno-knuthdiv
24085 @opindex mknuthdiv
24086 @opindex mno-knuthdiv
24087 Make the result of a division yielding a remainder have the same sign as
24088 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
24089 remainder follows the sign of the dividend. Both methods are
24090 arithmetically valid, the latter being almost exclusively used.
24091
24092 @item -mtoplevel-symbols
24093 @itemx -mno-toplevel-symbols
24094 @opindex mtoplevel-symbols
24095 @opindex mno-toplevel-symbols
24096 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
24097 code can be used with the @code{PREFIX} assembly directive.
24098
24099 @item -melf
24100 @opindex melf
24101 Generate an executable in the ELF format, rather than the default
24102 @samp{mmo} format used by the @command{mmix} simulator.
24103
24104 @item -mbranch-predict
24105 @itemx -mno-branch-predict
24106 @opindex mbranch-predict
24107 @opindex mno-branch-predict
24108 Use (do not use) the probable-branch instructions, when static branch
24109 prediction indicates a probable branch.
24110
24111 @item -mbase-addresses
24112 @itemx -mno-base-addresses
24113 @opindex mbase-addresses
24114 @opindex mno-base-addresses
24115 Generate (do not generate) code that uses @emph{base addresses}. Using a
24116 base address automatically generates a request (handled by the assembler
24117 and the linker) for a constant to be set up in a global register. The
24118 register is used for one or more base address requests within the range 0
24119 to 255 from the value held in the register. The generally leads to short
24120 and fast code, but the number of different data items that can be
24121 addressed is limited. This means that a program that uses lots of static
24122 data may require @option{-mno-base-addresses}.
24123
24124 @item -msingle-exit
24125 @itemx -mno-single-exit
24126 @opindex msingle-exit
24127 @opindex mno-single-exit
24128 Force (do not force) generated code to have a single exit point in each
24129 function.
24130 @end table
24131
24132 @node MN10300 Options
24133 @subsection MN10300 Options
24134 @cindex MN10300 options
24135
24136 These @option{-m} options are defined for Matsushita MN10300 architectures:
24137
24138 @table @gcctabopt
24139 @item -mmult-bug
24140 @opindex mmult-bug
24141 Generate code to avoid bugs in the multiply instructions for the MN10300
24142 processors. This is the default.
24143
24144 @item -mno-mult-bug
24145 @opindex mno-mult-bug
24146 Do not generate code to avoid bugs in the multiply instructions for the
24147 MN10300 processors.
24148
24149 @item -mam33
24150 @opindex mam33
24151 Generate code using features specific to the AM33 processor.
24152
24153 @item -mno-am33
24154 @opindex mno-am33
24155 Do not generate code using features specific to the AM33 processor. This
24156 is the default.
24157
24158 @item -mam33-2
24159 @opindex mam33-2
24160 Generate code using features specific to the AM33/2.0 processor.
24161
24162 @item -mam34
24163 @opindex mam34
24164 Generate code using features specific to the AM34 processor.
24165
24166 @item -mtune=@var{cpu-type}
24167 @opindex mtune
24168 Use the timing characteristics of the indicated CPU type when
24169 scheduling instructions. This does not change the targeted processor
24170 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
24171 @samp{am33-2} or @samp{am34}.
24172
24173 @item -mreturn-pointer-on-d0
24174 @opindex mreturn-pointer-on-d0
24175 When generating a function that returns a pointer, return the pointer
24176 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
24177 only in @code{a0}, and attempts to call such functions without a prototype
24178 result in errors. Note that this option is on by default; use
24179 @option{-mno-return-pointer-on-d0} to disable it.
24180
24181 @item -mno-crt0
24182 @opindex mno-crt0
24183 Do not link in the C run-time initialization object file.
24184
24185 @item -mrelax
24186 @opindex mrelax
24187 Indicate to the linker that it should perform a relaxation optimization pass
24188 to shorten branches, calls and absolute memory addresses. This option only
24189 has an effect when used on the command line for the final link step.
24190
24191 This option makes symbolic debugging impossible.
24192
24193 @item -mliw
24194 @opindex mliw
24195 Allow the compiler to generate @emph{Long Instruction Word}
24196 instructions if the target is the @samp{AM33} or later. This is the
24197 default. This option defines the preprocessor macro @code{__LIW__}.
24198
24199 @item -mno-liw
24200 @opindex mno-liw
24201 Do not allow the compiler to generate @emph{Long Instruction Word}
24202 instructions. This option defines the preprocessor macro
24203 @code{__NO_LIW__}.
24204
24205 @item -msetlb
24206 @opindex msetlb
24207 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24208 instructions if the target is the @samp{AM33} or later. This is the
24209 default. This option defines the preprocessor macro @code{__SETLB__}.
24210
24211 @item -mno-setlb
24212 @opindex mno-setlb
24213 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24214 instructions. This option defines the preprocessor macro
24215 @code{__NO_SETLB__}.
24216
24217 @end table
24218
24219 @node Moxie Options
24220 @subsection Moxie Options
24221 @cindex Moxie Options
24222
24223 @table @gcctabopt
24224
24225 @item -meb
24226 @opindex meb
24227 Generate big-endian code. This is the default for @samp{moxie-*-*}
24228 configurations.
24229
24230 @item -mel
24231 @opindex mel
24232 Generate little-endian code.
24233
24234 @item -mmul.x
24235 @opindex mmul.x
24236 Generate mul.x and umul.x instructions. This is the default for
24237 @samp{moxiebox-*-*} configurations.
24238
24239 @item -mno-crt0
24240 @opindex mno-crt0
24241 Do not link in the C run-time initialization object file.
24242
24243 @end table
24244
24245 @node MSP430 Options
24246 @subsection MSP430 Options
24247 @cindex MSP430 Options
24248
24249 These options are defined for the MSP430:
24250
24251 @table @gcctabopt
24252
24253 @item -masm-hex
24254 @opindex masm-hex
24255 Force assembly output to always use hex constants. Normally such
24256 constants are signed decimals, but this option is available for
24257 testsuite and/or aesthetic purposes.
24258
24259 @item -mmcu=
24260 @opindex mmcu=
24261 Select the MCU to target. This is used to create a C preprocessor
24262 symbol based upon the MCU name, converted to upper case and pre- and
24263 post-fixed with @samp{__}. This in turn is used by the
24264 @file{msp430.h} header file to select an MCU-specific supplementary
24265 header file.
24266
24267 The option also sets the ISA to use. If the MCU name is one that is
24268 known to only support the 430 ISA then that is selected, otherwise the
24269 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
24270 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
24271 name selects the 430X ISA.
24272
24273 In addition an MCU-specific linker script is added to the linker
24274 command line. The script's name is the name of the MCU with
24275 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24276 command line defines the C preprocessor symbol @code{__XXX__} and
24277 cause the linker to search for a script called @file{xxx.ld}.
24278
24279 The ISA and hardware multiply supported for the different MCUs is hard-coded
24280 into GCC. However, an external @samp{devices.csv} file can be used to
24281 extend device support beyond those that have been hard-coded.
24282
24283 GCC searches for the @samp{devices.csv} file using the following methods in the
24284 given precedence order, where the first method takes precendence over the
24285 second which takes precedence over the third.
24286
24287 @table @asis
24288 @item Include path specified with @code{-I} and @code{-L}
24289 @samp{devices.csv} will be searched for in each of the directories specified by
24290 include paths and linker library search paths.
24291 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24292 Define the value of the global environment variable
24293 @samp{MSP430_GCC_INCLUDE_DIR}
24294 to the full path to the directory containing devices.csv, and GCC will search
24295 this directory for devices.csv. If devices.csv is found, this directory will
24296 also be registered as an include path, and linker library path. Header files
24297 and linker scripts in this directory can therefore be used without manually
24298 specifying @code{-I} and @code{-L} on the command line.
24299 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
24300 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24301 toolchain root directory. This directory does not exist in a default
24302 installation, but if the user has created it and copied @samp{devices.csv}
24303 there, then the MCU data will be read. As above, this directory will
24304 also be registered as an include path, and linker library path.
24305
24306 @end table
24307 If none of the above search methods find @samp{devices.csv}, then the
24308 hard-coded MCU data is used.
24309
24310
24311 @item -mwarn-mcu
24312 @itemx -mno-warn-mcu
24313 @opindex mwarn-mcu
24314 @opindex mno-warn-mcu
24315 This option enables or disables warnings about conflicts between the
24316 MCU name specified by the @option{-mmcu} option and the ISA set by the
24317 @option{-mcpu} option and/or the hardware multiply support set by the
24318 @option{-mhwmult} option. It also toggles warnings about unrecognized
24319 MCU names. This option is on by default.
24320
24321 @item -mcpu=
24322 @opindex mcpu=
24323 Specifies the ISA to use. Accepted values are @samp{msp430},
24324 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
24325 @option{-mmcu=} option should be used to select the ISA.
24326
24327 @item -msim
24328 @opindex msim
24329 Link to the simulator runtime libraries and linker script. Overrides
24330 any scripts that would be selected by the @option{-mmcu=} option.
24331
24332 @item -mlarge
24333 @opindex mlarge
24334 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
24335
24336 @item -msmall
24337 @opindex msmall
24338 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24339
24340 @item -mrelax
24341 @opindex mrelax
24342 This option is passed to the assembler and linker, and allows the
24343 linker to perform certain optimizations that cannot be done until
24344 the final link.
24345
24346 @item mhwmult=
24347 @opindex mhwmult=
24348 Describes the type of hardware multiply supported by the target.
24349 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24350 for the original 16-bit-only multiply supported by early MCUs.
24351 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24352 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24353 A value of @samp{auto} can also be given. This tells GCC to deduce
24354 the hardware multiply support based upon the MCU name provided by the
24355 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
24356 the MCU name is not recognized then no hardware multiply support is
24357 assumed. @code{auto} is the default setting.
24358
24359 Hardware multiplies are normally performed by calling a library
24360 routine. This saves space in the generated code. When compiling at
24361 @option{-O3} or higher however the hardware multiplier is invoked
24362 inline. This makes for bigger, but faster code.
24363
24364 The hardware multiply routines disable interrupts whilst running and
24365 restore the previous interrupt state when they finish. This makes
24366 them safe to use inside interrupt handlers as well as in normal code.
24367
24368 @item -minrt
24369 @opindex minrt
24370 Enable the use of a minimum runtime environment - no static
24371 initializers or constructors. This is intended for memory-constrained
24372 devices. The compiler includes special symbols in some objects
24373 that tell the linker and runtime which code fragments are required.
24374
24375 @item -mtiny-printf
24376 @opindex mtiny-printf
24377 Enable reduced code size @code{printf} and @code{puts} library functions.
24378 The @samp{tiny} implementations of these functions are not reentrant, so
24379 must be used with caution in multi-threaded applications.
24380
24381 Support for streams has been removed and the string to be printed will
24382 always be sent to stdout via the @code{write} syscall. The string is not
24383 buffered before it is sent to write.
24384
24385 This option requires Newlib Nano IO, so GCC must be configured with
24386 @samp{--enable-newlib-nano-formatted-io}.
24387
24388 @item -mcode-region=
24389 @itemx -mdata-region=
24390 @opindex mcode-region
24391 @opindex mdata-region
24392 These options tell the compiler where to place functions and data that
24393 do not have one of the @code{lower}, @code{upper}, @code{either} or
24394 @code{section} attributes. Possible values are @code{lower},
24395 @code{upper}, @code{either} or @code{any}. The first three behave
24396 like the corresponding attribute. The fourth possible value -
24397 @code{any} - is the default. It leaves placement entirely up to the
24398 linker script and how it assigns the standard sections
24399 (@code{.text}, @code{.data}, etc) to the memory regions.
24400
24401 @item -msilicon-errata=
24402 @opindex msilicon-errata
24403 This option passes on a request to assembler to enable the fixes for
24404 the named silicon errata.
24405
24406 @item -msilicon-errata-warn=
24407 @opindex msilicon-errata-warn
24408 This option passes on a request to the assembler to enable warning
24409 messages when a silicon errata might need to be applied.
24410
24411 @item -mwarn-devices-csv
24412 @itemx -mno-warn-devices-csv
24413 @opindex mwarn-devices-csv
24414 @opindex mno-warn-devices-csv
24415 Warn if @samp{devices.csv} is not found or there are problem parsing it
24416 (default: on).
24417
24418 @end table
24419
24420 @node NDS32 Options
24421 @subsection NDS32 Options
24422 @cindex NDS32 Options
24423
24424 These options are defined for NDS32 implementations:
24425
24426 @table @gcctabopt
24427
24428 @item -mbig-endian
24429 @opindex mbig-endian
24430 Generate code in big-endian mode.
24431
24432 @item -mlittle-endian
24433 @opindex mlittle-endian
24434 Generate code in little-endian mode.
24435
24436 @item -mreduced-regs
24437 @opindex mreduced-regs
24438 Use reduced-set registers for register allocation.
24439
24440 @item -mfull-regs
24441 @opindex mfull-regs
24442 Use full-set registers for register allocation.
24443
24444 @item -mcmov
24445 @opindex mcmov
24446 Generate conditional move instructions.
24447
24448 @item -mno-cmov
24449 @opindex mno-cmov
24450 Do not generate conditional move instructions.
24451
24452 @item -mext-perf
24453 @opindex mext-perf
24454 Generate performance extension instructions.
24455
24456 @item -mno-ext-perf
24457 @opindex mno-ext-perf
24458 Do not generate performance extension instructions.
24459
24460 @item -mext-perf2
24461 @opindex mext-perf2
24462 Generate performance extension 2 instructions.
24463
24464 @item -mno-ext-perf2
24465 @opindex mno-ext-perf2
24466 Do not generate performance extension 2 instructions.
24467
24468 @item -mext-string
24469 @opindex mext-string
24470 Generate string extension instructions.
24471
24472 @item -mno-ext-string
24473 @opindex mno-ext-string
24474 Do not generate string extension instructions.
24475
24476 @item -mv3push
24477 @opindex mv3push
24478 Generate v3 push25/pop25 instructions.
24479
24480 @item -mno-v3push
24481 @opindex mno-v3push
24482 Do not generate v3 push25/pop25 instructions.
24483
24484 @item -m16-bit
24485 @opindex m16-bit
24486 Generate 16-bit instructions.
24487
24488 @item -mno-16-bit
24489 @opindex mno-16-bit
24490 Do not generate 16-bit instructions.
24491
24492 @item -misr-vector-size=@var{num}
24493 @opindex misr-vector-size
24494 Specify the size of each interrupt vector, which must be 4 or 16.
24495
24496 @item -mcache-block-size=@var{num}
24497 @opindex mcache-block-size
24498 Specify the size of each cache block,
24499 which must be a power of 2 between 4 and 512.
24500
24501 @item -march=@var{arch}
24502 @opindex march
24503 Specify the name of the target architecture.
24504
24505 @item -mcmodel=@var{code-model}
24506 @opindex mcmodel
24507 Set the code model to one of
24508 @table @asis
24509 @item @samp{small}
24510 All the data and read-only data segments must be within 512KB addressing space.
24511 The text segment must be within 16MB addressing space.
24512 @item @samp{medium}
24513 The data segment must be within 512KB while the read-only data segment can be
24514 within 4GB addressing space. The text segment should be still within 16MB
24515 addressing space.
24516 @item @samp{large}
24517 All the text and data segments can be within 4GB addressing space.
24518 @end table
24519
24520 @item -mctor-dtor
24521 @opindex mctor-dtor
24522 Enable constructor/destructor feature.
24523
24524 @item -mrelax
24525 @opindex mrelax
24526 Guide linker to relax instructions.
24527
24528 @end table
24529
24530 @node Nios II Options
24531 @subsection Nios II Options
24532 @cindex Nios II options
24533 @cindex Altera Nios II options
24534
24535 These are the options defined for the Altera Nios II processor.
24536
24537 @table @gcctabopt
24538
24539 @item -G @var{num}
24540 @opindex G
24541 @cindex smaller data references
24542 Put global and static objects less than or equal to @var{num} bytes
24543 into the small data or BSS sections instead of the normal data or BSS
24544 sections. The default value of @var{num} is 8.
24545
24546 @item -mgpopt=@var{option}
24547 @itemx -mgpopt
24548 @itemx -mno-gpopt
24549 @opindex mgpopt
24550 @opindex mno-gpopt
24551 Generate (do not generate) GP-relative accesses. The following
24552 @var{option} names are recognized:
24553
24554 @table @samp
24555
24556 @item none
24557 Do not generate GP-relative accesses.
24558
24559 @item local
24560 Generate GP-relative accesses for small data objects that are not
24561 external, weak, or uninitialized common symbols.
24562 Also use GP-relative addressing for objects that
24563 have been explicitly placed in a small data section via a @code{section}
24564 attribute.
24565
24566 @item global
24567 As for @samp{local}, but also generate GP-relative accesses for
24568 small data objects that are external, weak, or common. If you use this option,
24569 you must ensure that all parts of your program (including libraries) are
24570 compiled with the same @option{-G} setting.
24571
24572 @item data
24573 Generate GP-relative accesses for all data objects in the program. If you
24574 use this option, the entire data and BSS segments
24575 of your program must fit in 64K of memory and you must use an appropriate
24576 linker script to allocate them within the addressable range of the
24577 global pointer.
24578
24579 @item all
24580 Generate GP-relative addresses for function pointers as well as data
24581 pointers. If you use this option, the entire text, data, and BSS segments
24582 of your program must fit in 64K of memory and you must use an appropriate
24583 linker script to allocate them within the addressable range of the
24584 global pointer.
24585
24586 @end table
24587
24588 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
24589 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
24590
24591 The default is @option{-mgpopt} except when @option{-fpic} or
24592 @option{-fPIC} is specified to generate position-independent code.
24593 Note that the Nios II ABI does not permit GP-relative accesses from
24594 shared libraries.
24595
24596 You may need to specify @option{-mno-gpopt} explicitly when building
24597 programs that include large amounts of small data, including large
24598 GOT data sections. In this case, the 16-bit offset for GP-relative
24599 addressing may not be large enough to allow access to the entire
24600 small data section.
24601
24602 @item -mgprel-sec=@var{regexp}
24603 @opindex mgprel-sec
24604 This option specifies additional section names that can be accessed via
24605 GP-relative addressing. It is most useful in conjunction with
24606 @code{section} attributes on variable declarations
24607 (@pxref{Common Variable Attributes}) and a custom linker script.
24608 The @var{regexp} is a POSIX Extended Regular Expression.
24609
24610 This option does not affect the behavior of the @option{-G} option, and
24611 the specified sections are in addition to the standard @code{.sdata}
24612 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
24613
24614 @item -mr0rel-sec=@var{regexp}
24615 @opindex mr0rel-sec
24616 This option specifies names of sections that can be accessed via a
24617 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
24618 of the 32-bit address space. It is most useful in conjunction with
24619 @code{section} attributes on variable declarations
24620 (@pxref{Common Variable Attributes}) and a custom linker script.
24621 The @var{regexp} is a POSIX Extended Regular Expression.
24622
24623 In contrast to the use of GP-relative addressing for small data,
24624 zero-based addressing is never generated by default and there are no
24625 conventional section names used in standard linker scripts for sections
24626 in the low or high areas of memory.
24627
24628 @item -mel
24629 @itemx -meb
24630 @opindex mel
24631 @opindex meb
24632 Generate little-endian (default) or big-endian (experimental) code,
24633 respectively.
24634
24635 @item -march=@var{arch}
24636 @opindex march
24637 This specifies the name of the target Nios II architecture. GCC uses this
24638 name to determine what kind of instructions it can emit when generating
24639 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
24640
24641 The preprocessor macro @code{__nios2_arch__} is available to programs,
24642 with value 1 or 2, indicating the targeted ISA level.
24643
24644 @item -mbypass-cache
24645 @itemx -mno-bypass-cache
24646 @opindex mno-bypass-cache
24647 @opindex mbypass-cache
24648 Force all load and store instructions to always bypass cache by
24649 using I/O variants of the instructions. The default is not to
24650 bypass the cache.
24651
24652 @item -mno-cache-volatile
24653 @itemx -mcache-volatile
24654 @opindex mcache-volatile
24655 @opindex mno-cache-volatile
24656 Volatile memory access bypass the cache using the I/O variants of
24657 the load and store instructions. The default is not to bypass the cache.
24658
24659 @item -mno-fast-sw-div
24660 @itemx -mfast-sw-div
24661 @opindex mno-fast-sw-div
24662 @opindex mfast-sw-div
24663 Do not use table-based fast divide for small numbers. The default
24664 is to use the fast divide at @option{-O3} and above.
24665
24666 @item -mno-hw-mul
24667 @itemx -mhw-mul
24668 @itemx -mno-hw-mulx
24669 @itemx -mhw-mulx
24670 @itemx -mno-hw-div
24671 @itemx -mhw-div
24672 @opindex mno-hw-mul
24673 @opindex mhw-mul
24674 @opindex mno-hw-mulx
24675 @opindex mhw-mulx
24676 @opindex mno-hw-div
24677 @opindex mhw-div
24678 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
24679 instructions by the compiler. The default is to emit @code{mul}
24680 and not emit @code{div} and @code{mulx}.
24681
24682 @item -mbmx
24683 @itemx -mno-bmx
24684 @itemx -mcdx
24685 @itemx -mno-cdx
24686 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
24687 CDX (code density) instructions. Enabling these instructions also
24688 requires @option{-march=r2}. Since these instructions are optional
24689 extensions to the R2 architecture, the default is not to emit them.
24690
24691 @item -mcustom-@var{insn}=@var{N}
24692 @itemx -mno-custom-@var{insn}
24693 @opindex mcustom-@var{insn}
24694 @opindex mno-custom-@var{insn}
24695 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
24696 custom instruction with encoding @var{N} when generating code that uses
24697 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
24698 instruction 253 for single-precision floating-point add operations instead
24699 of the default behavior of using a library call.
24700
24701 The following values of @var{insn} are supported. Except as otherwise
24702 noted, floating-point operations are expected to be implemented with
24703 normal IEEE 754 semantics and correspond directly to the C operators or the
24704 equivalent GCC built-in functions (@pxref{Other Builtins}).
24705
24706 Single-precision floating point:
24707 @table @asis
24708
24709 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
24710 Binary arithmetic operations.
24711
24712 @item @samp{fnegs}
24713 Unary negation.
24714
24715 @item @samp{fabss}
24716 Unary absolute value.
24717
24718 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
24719 Comparison operations.
24720
24721 @item @samp{fmins}, @samp{fmaxs}
24722 Floating-point minimum and maximum. These instructions are only
24723 generated if @option{-ffinite-math-only} is specified.
24724
24725 @item @samp{fsqrts}
24726 Unary square root operation.
24727
24728 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
24729 Floating-point trigonometric and exponential functions. These instructions
24730 are only generated if @option{-funsafe-math-optimizations} is also specified.
24731
24732 @end table
24733
24734 Double-precision floating point:
24735 @table @asis
24736
24737 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
24738 Binary arithmetic operations.
24739
24740 @item @samp{fnegd}
24741 Unary negation.
24742
24743 @item @samp{fabsd}
24744 Unary absolute value.
24745
24746 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
24747 Comparison operations.
24748
24749 @item @samp{fmind}, @samp{fmaxd}
24750 Double-precision minimum and maximum. These instructions are only
24751 generated if @option{-ffinite-math-only} is specified.
24752
24753 @item @samp{fsqrtd}
24754 Unary square root operation.
24755
24756 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
24757 Double-precision trigonometric and exponential functions. These instructions
24758 are only generated if @option{-funsafe-math-optimizations} is also specified.
24759
24760 @end table
24761
24762 Conversions:
24763 @table @asis
24764 @item @samp{fextsd}
24765 Conversion from single precision to double precision.
24766
24767 @item @samp{ftruncds}
24768 Conversion from double precision to single precision.
24769
24770 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
24771 Conversion from floating point to signed or unsigned integer types, with
24772 truncation towards zero.
24773
24774 @item @samp{round}
24775 Conversion from single-precision floating point to signed integer,
24776 rounding to the nearest integer and ties away from zero.
24777 This corresponds to the @code{__builtin_lroundf} function when
24778 @option{-fno-math-errno} is used.
24779
24780 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
24781 Conversion from signed or unsigned integer types to floating-point types.
24782
24783 @end table
24784
24785 In addition, all of the following transfer instructions for internal
24786 registers X and Y must be provided to use any of the double-precision
24787 floating-point instructions. Custom instructions taking two
24788 double-precision source operands expect the first operand in the
24789 64-bit register X. The other operand (or only operand of a unary
24790 operation) is given to the custom arithmetic instruction with the
24791 least significant half in source register @var{src1} and the most
24792 significant half in @var{src2}. A custom instruction that returns a
24793 double-precision result returns the most significant 32 bits in the
24794 destination register and the other half in 32-bit register Y.
24795 GCC automatically generates the necessary code sequences to write
24796 register X and/or read register Y when double-precision floating-point
24797 instructions are used.
24798
24799 @table @asis
24800
24801 @item @samp{fwrx}
24802 Write @var{src1} into the least significant half of X and @var{src2} into
24803 the most significant half of X.
24804
24805 @item @samp{fwry}
24806 Write @var{src1} into Y.
24807
24808 @item @samp{frdxhi}, @samp{frdxlo}
24809 Read the most or least (respectively) significant half of X and store it in
24810 @var{dest}.
24811
24812 @item @samp{frdy}
24813 Read the value of Y and store it into @var{dest}.
24814 @end table
24815
24816 Note that you can gain more local control over generation of Nios II custom
24817 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
24818 and @code{target("no-custom-@var{insn}")} function attributes
24819 (@pxref{Function Attributes})
24820 or pragmas (@pxref{Function Specific Option Pragmas}).
24821
24822 @item -mcustom-fpu-cfg=@var{name}
24823 @opindex mcustom-fpu-cfg
24824
24825 This option enables a predefined, named set of custom instruction encodings
24826 (see @option{-mcustom-@var{insn}} above).
24827 Currently, the following sets are defined:
24828
24829 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
24830 @gccoptlist{-mcustom-fmuls=252 @gol
24831 -mcustom-fadds=253 @gol
24832 -mcustom-fsubs=254 @gol
24833 -fsingle-precision-constant}
24834
24835 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
24836 @gccoptlist{-mcustom-fmuls=252 @gol
24837 -mcustom-fadds=253 @gol
24838 -mcustom-fsubs=254 @gol
24839 -mcustom-fdivs=255 @gol
24840 -fsingle-precision-constant}
24841
24842 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
24843 @gccoptlist{-mcustom-floatus=243 @gol
24844 -mcustom-fixsi=244 @gol
24845 -mcustom-floatis=245 @gol
24846 -mcustom-fcmpgts=246 @gol
24847 -mcustom-fcmples=249 @gol
24848 -mcustom-fcmpeqs=250 @gol
24849 -mcustom-fcmpnes=251 @gol
24850 -mcustom-fmuls=252 @gol
24851 -mcustom-fadds=253 @gol
24852 -mcustom-fsubs=254 @gol
24853 -mcustom-fdivs=255 @gol
24854 -fsingle-precision-constant}
24855
24856 Custom instruction assignments given by individual
24857 @option{-mcustom-@var{insn}=} options override those given by
24858 @option{-mcustom-fpu-cfg=}, regardless of the
24859 order of the options on the command line.
24860
24861 Note that you can gain more local control over selection of a FPU
24862 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
24863 function attribute (@pxref{Function Attributes})
24864 or pragma (@pxref{Function Specific Option Pragmas}).
24865
24866 @end table
24867
24868 These additional @samp{-m} options are available for the Altera Nios II
24869 ELF (bare-metal) target:
24870
24871 @table @gcctabopt
24872
24873 @item -mhal
24874 @opindex mhal
24875 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
24876 startup and termination code, and is typically used in conjunction with
24877 @option{-msys-crt0=} to specify the location of the alternate startup code
24878 provided by the HAL BSP.
24879
24880 @item -msmallc
24881 @opindex msmallc
24882 Link with a limited version of the C library, @option{-lsmallc}, rather than
24883 Newlib.
24884
24885 @item -msys-crt0=@var{startfile}
24886 @opindex msys-crt0
24887 @var{startfile} is the file name of the startfile (crt0) to use
24888 when linking. This option is only useful in conjunction with @option{-mhal}.
24889
24890 @item -msys-lib=@var{systemlib}
24891 @opindex msys-lib
24892 @var{systemlib} is the library name of the library that provides
24893 low-level system calls required by the C library,
24894 e.g.@: @code{read} and @code{write}.
24895 This option is typically used to link with a library provided by a HAL BSP.
24896
24897 @end table
24898
24899 @node Nvidia PTX Options
24900 @subsection Nvidia PTX Options
24901 @cindex Nvidia PTX options
24902 @cindex nvptx options
24903
24904 These options are defined for Nvidia PTX:
24905
24906 @table @gcctabopt
24907
24908 @item -m32
24909 @itemx -m64
24910 @opindex m32
24911 @opindex m64
24912 Generate code for 32-bit or 64-bit ABI.
24913
24914 @item -misa=@var{ISA-string}
24915 @opindex march
24916 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
24917 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
24918 @samp{sm_35}. The default ISA is sm_30.
24919
24920 @item -mmainkernel
24921 @opindex mmainkernel
24922 Link in code for a __main kernel. This is for stand-alone instead of
24923 offloading execution.
24924
24925 @item -moptimize
24926 @opindex moptimize
24927 Apply partitioned execution optimizations. This is the default when any
24928 level of optimization is selected.
24929
24930 @item -msoft-stack
24931 @opindex msoft-stack
24932 Generate code that does not use @code{.local} memory
24933 directly for stack storage. Instead, a per-warp stack pointer is
24934 maintained explicitly. This enables variable-length stack allocation (with
24935 variable-length arrays or @code{alloca}), and when global memory is used for
24936 underlying storage, makes it possible to access automatic variables from other
24937 threads, or with atomic instructions. This code generation variant is used
24938 for OpenMP offloading, but the option is exposed on its own for the purpose
24939 of testing the compiler; to generate code suitable for linking into programs
24940 using OpenMP offloading, use option @option{-mgomp}.
24941
24942 @item -muniform-simt
24943 @opindex muniform-simt
24944 Switch to code generation variant that allows to execute all threads in each
24945 warp, while maintaining memory state and side effects as if only one thread
24946 in each warp was active outside of OpenMP SIMD regions. All atomic operations
24947 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
24948 current lane index equals the master lane index), and the register being
24949 assigned is copied via a shuffle instruction from the master lane. Outside of
24950 SIMD regions lane 0 is the master; inside, each thread sees itself as the
24951 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
24952 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
24953 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
24954 with current lane index to compute the master lane index.
24955
24956 @item -mgomp
24957 @opindex mgomp
24958 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
24959 @option{-muniform-simt} options, and selects corresponding multilib variant.
24960
24961 @end table
24962
24963 @node OpenRISC Options
24964 @subsection OpenRISC Options
24965 @cindex OpenRISC Options
24966
24967 These options are defined for OpenRISC:
24968
24969 @table @gcctabopt
24970
24971 @item -mboard=@var{name}
24972 @opindex mboard
24973 Configure a board specific runtime. This will be passed to the linker for
24974 newlib board library linking. The default is @code{or1ksim}.
24975
24976 @item -mnewlib
24977 @opindex mnewlib
24978 This option is ignored; it is for compatibility purposes only. This used to
24979 select linker and preprocessor options for use with newlib.
24980
24981 @item -msoft-div
24982 @itemx -mhard-div
24983 @opindex msoft-div
24984 @opindex mhard-div
24985 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
24986 This default is hardware divide.
24987
24988 @item -msoft-mul
24989 @itemx -mhard-mul
24990 @opindex msoft-mul
24991 @opindex mhard-mul
24992 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
24993 This default is hardware multiply.
24994
24995 @item -msoft-float
24996 @itemx -mhard-float
24997 @opindex msoft-float
24998 @opindex mhard-float
24999 Select software or hardware for floating point operations.
25000 The default is software.
25001
25002 @item -mdouble-float
25003 @opindex mdouble-float
25004 When @option{-mhard-float} is selected, enables generation of double-precision
25005 floating point instructions. By default functions from @file{libgcc} are used
25006 to perform double-precision floating point operations.
25007
25008 @item -munordered-float
25009 @opindex munordered-float
25010 When @option{-mhard-float} is selected, enables generation of unordered
25011 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
25012 functions from @file{libgcc} are used to perform unordered floating point
25013 compare and set flag operations.
25014
25015 @item -mcmov
25016 @opindex mcmov
25017 Enable generation of conditional move (@code{l.cmov}) instructions. By
25018 default the equivalent will be generated using set and branch.
25019
25020 @item -mror
25021 @opindex mror
25022 Enable generation of rotate right (@code{l.ror}) instructions. By default
25023 functions from @file{libgcc} are used to perform rotate right operations.
25024
25025 @item -mrori
25026 @opindex mrori
25027 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
25028 By default functions from @file{libgcc} are used to perform rotate right with
25029 immediate operations.
25030
25031 @item -msext
25032 @opindex msext
25033 Enable generation of sign extension (@code{l.ext*}) instructions. By default
25034 memory loads are used to perform sign extension.
25035
25036 @item -msfimm
25037 @opindex msfimm
25038 Enable generation of compare and set flag with immediate (@code{l.sf*i})
25039 instructions. By default extra instructions will be generated to store the
25040 immediate to a register first.
25041
25042 @item -mshftimm
25043 @opindex mshftimm
25044 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
25045 @code{l.slli}) instructions. By default extra instructions will be generated
25046 to store the immediate to a register first.
25047
25048
25049 @end table
25050
25051 @node PDP-11 Options
25052 @subsection PDP-11 Options
25053 @cindex PDP-11 Options
25054
25055 These options are defined for the PDP-11:
25056
25057 @table @gcctabopt
25058 @item -mfpu
25059 @opindex mfpu
25060 Use hardware FPP floating point. This is the default. (FIS floating
25061 point on the PDP-11/40 is not supported.) Implies -m45.
25062
25063 @item -msoft-float
25064 @opindex msoft-float
25065 Do not use hardware floating point.
25066
25067 @item -mac0
25068 @opindex mac0
25069 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
25070
25071 @item -mno-ac0
25072 @opindex mno-ac0
25073 Return floating-point results in memory. This is the default.
25074
25075 @item -m40
25076 @opindex m40
25077 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
25078
25079 @item -m45
25080 @opindex m45
25081 Generate code for a PDP-11/45. This is the default.
25082
25083 @item -m10
25084 @opindex m10
25085 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
25086
25087 @item -mint16
25088 @itemx -mno-int32
25089 @opindex mint16
25090 @opindex mno-int32
25091 Use 16-bit @code{int}. This is the default.
25092
25093 @item -mint32
25094 @itemx -mno-int16
25095 @opindex mint32
25096 @opindex mno-int16
25097 Use 32-bit @code{int}.
25098
25099 @item -msplit
25100 @opindex msplit
25101 Target has split instruction and data space. Implies -m45.
25102
25103 @item -munix-asm
25104 @opindex munix-asm
25105 Use Unix assembler syntax.
25106
25107 @item -mdec-asm
25108 @opindex mdec-asm
25109 Use DEC assembler syntax.
25110
25111 @item -mgnu-asm
25112 @opindex mgnu-asm
25113 Use GNU assembler syntax. This is the default.
25114
25115 @item -mlra
25116 @opindex mlra
25117 Use the new LRA register allocator. By default, the old ``reload''
25118 allocator is used.
25119 @end table
25120
25121 @node picoChip Options
25122 @subsection picoChip Options
25123 @cindex picoChip options
25124
25125 These @samp{-m} options are defined for picoChip implementations:
25126
25127 @table @gcctabopt
25128
25129 @item -mae=@var{ae_type}
25130 @opindex mcpu
25131 Set the instruction set, register set, and instruction scheduling
25132 parameters for array element type @var{ae_type}. Supported values
25133 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
25134
25135 @option{-mae=ANY} selects a completely generic AE type. Code
25136 generated with this option runs on any of the other AE types. The
25137 code is not as efficient as it would be if compiled for a specific
25138 AE type, and some types of operation (e.g., multiplication) do not
25139 work properly on all types of AE.
25140
25141 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
25142 for compiled code, and is the default.
25143
25144 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
25145 option may suffer from poor performance of byte (char) manipulation,
25146 since the DSP AE does not provide hardware support for byte load/stores.
25147
25148 @item -msymbol-as-address
25149 Enable the compiler to directly use a symbol name as an address in a
25150 load/store instruction, without first loading it into a
25151 register. Typically, the use of this option generates larger
25152 programs, which run faster than when the option isn't used. However, the
25153 results vary from program to program, so it is left as a user option,
25154 rather than being permanently enabled.
25155
25156 @item -mno-inefficient-warnings
25157 Disables warnings about the generation of inefficient code. These
25158 warnings can be generated, for example, when compiling code that
25159 performs byte-level memory operations on the MAC AE type. The MAC AE has
25160 no hardware support for byte-level memory operations, so all byte
25161 load/stores must be synthesized from word load/store operations. This is
25162 inefficient and a warning is generated to indicate
25163 that you should rewrite the code to avoid byte operations, or to target
25164 an AE type that has the necessary hardware support. This option disables
25165 these warnings.
25166
25167 @end table
25168
25169 @node PowerPC Options
25170 @subsection PowerPC Options
25171 @cindex PowerPC options
25172
25173 These are listed under @xref{RS/6000 and PowerPC Options}.
25174
25175 @node PRU Options
25176 @subsection PRU Options
25177 @cindex PRU Options
25178
25179 These command-line options are defined for PRU target:
25180
25181 @table @gcctabopt
25182 @item -minrt
25183 @opindex minrt
25184 Link with a minimum runtime environment, with no support for static
25185 initializers and constructors. Using this option can significantly reduce
25186 the size of the final ELF binary. Beware that the compiler could still
25187 generate code with static initializers and constructors. It is up to the
25188 programmer to ensure that the source program will not use those features.
25189
25190 @item -mmcu=@var{mcu}
25191 @opindex mmcu
25192 Specify the PRU MCU variant to use. Check Newlib for the exact list of
25193 supported MCUs.
25194
25195 @item -mno-relax
25196 @opindex mno-relax
25197 Make GCC pass the @option{--no-relax} command-line option to the linker
25198 instead of the @option{--relax} option.
25199
25200 @item -mloop
25201 @opindex mloop
25202 Allow (or do not allow) GCC to use the LOOP instruction.
25203
25204 @item -mabi=@var{variant}
25205 @opindex mabi
25206 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
25207 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25208 more naturally with certain GCC assumptions. These are the differences:
25209
25210 @table @samp
25211 @item Function Pointer Size
25212 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25213 supports only 32-bit data and code pointers.
25214
25215 @item Optional Return Value Pointer
25216 Function return values larger than 64 bits are passed by using a hidden
25217 pointer as the first argument of the function. TI ABI, though, mandates that
25218 the pointer can be NULL in case the caller is not using the returned value.
25219 GNU always passes and expects a valid return value pointer.
25220
25221 @end table
25222
25223 The current @option{-mabi=ti} implementation simply raises a compile error
25224 when any of the above code constructs is detected. As a consequence
25225 the standard C library cannot be built and it is omitted when linking with
25226 @option{-mabi=ti}.
25227
25228 Relaxation is a GNU feature and for safety reasons is disabled when using
25229 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
25230 instructions, so the GNU linker cannot adjust them when shortening adjacent
25231 LDI32 pseudo instructions.
25232
25233 @end table
25234
25235 @node RISC-V Options
25236 @subsection RISC-V Options
25237 @cindex RISC-V Options
25238
25239 These command-line options are defined for RISC-V targets:
25240
25241 @table @gcctabopt
25242 @item -mbranch-cost=@var{n}
25243 @opindex mbranch-cost
25244 Set the cost of branches to roughly @var{n} instructions.
25245
25246 @item -mplt
25247 @itemx -mno-plt
25248 @opindex plt
25249 When generating PIC code, do or don't allow the use of PLTs. Ignored for
25250 non-PIC. The default is @option{-mplt}.
25251
25252 @item -mabi=@var{ABI-string}
25253 @opindex mabi
25254 Specify integer and floating-point calling convention. @var{ABI-string}
25255 contains two parts: the size of integer types and the registers used for
25256 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
25257 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
25258 32-bit), and that floating-point values up to 64 bits wide are passed in F
25259 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25260 allows the compiler to generate code that uses the F and D extensions but only
25261 allows floating-point values up to 32 bits long to be passed in registers; or
25262 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25263 passed in registers.
25264
25265 The default for this argument is system dependent, users who want a specific
25266 calling convention should specify one explicitly. The valid calling
25267 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25268 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
25269 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25270 invalid because the ABI requires 64-bit values be passed in F registers, but F
25271 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
25272 only be used with the @samp{rv32e} architecture. This ABI is not well
25273 specified at present, and is subject to change.
25274
25275 @item -mfdiv
25276 @itemx -mno-fdiv
25277 @opindex mfdiv
25278 Do or don't use hardware floating-point divide and square root instructions.
25279 This requires the F or D extensions for floating-point registers. The default
25280 is to use them if the specified architecture has these instructions.
25281
25282 @item -mdiv
25283 @itemx -mno-div
25284 @opindex mdiv
25285 Do or don't use hardware instructions for integer division. This requires the
25286 M extension. The default is to use them if the specified architecture has
25287 these instructions.
25288
25289 @item -march=@var{ISA-string}
25290 @opindex march
25291 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
25292 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25293 @samp{rv32imaf}.
25294
25295 @item -mtune=@var{processor-string}
25296 @opindex mtune
25297 Optimize the output for the given processor, specified by microarchitecture
25298 name. Permissible values for this option are: @samp{rocket},
25299 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25300 and @samp{size}.
25301
25302 When @option{-mtune=} is not specified, the default is @samp{rocket}.
25303
25304 The @samp{size} choice is not intended for use by end-users. This is used
25305 when @option{-Os} is specified. It overrides the instruction cost info
25306 provided by @option{-mtune=}, but does not override the pipeline info. This
25307 helps reduce code size while still giving good performance.
25308
25309 @item -mpreferred-stack-boundary=@var{num}
25310 @opindex mpreferred-stack-boundary
25311 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25312 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25313 the default is 4 (16 bytes or 128-bits).
25314
25315 @strong{Warning:} If you use this switch, then you must build all modules with
25316 the same value, including any libraries. This includes the system libraries
25317 and startup modules.
25318
25319 @item -msmall-data-limit=@var{n}
25320 @opindex msmall-data-limit
25321 Put global and static data smaller than @var{n} bytes into a special section
25322 (on some targets).
25323
25324 @item -msave-restore
25325 @itemx -mno-save-restore
25326 @opindex msave-restore
25327 Do or don't use smaller but slower prologue and epilogue code that uses
25328 library function calls. The default is to use fast inline prologues and
25329 epilogues.
25330
25331 @item -mstrict-align
25332 @itemx -mno-strict-align
25333 @opindex mstrict-align
25334 Do not or do generate unaligned memory accesses. The default is set depending
25335 on whether the processor we are optimizing for supports fast unaligned access
25336 or not.
25337
25338 @item -mcmodel=medlow
25339 @opindex mcmodel=medlow
25340 Generate code for the medium-low code model. The program and its statically
25341 defined symbols must lie within a single 2 GiB address range and must lie
25342 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25343 statically or dynamically linked. This is the default code model.
25344
25345 @item -mcmodel=medany
25346 @opindex mcmodel=medany
25347 Generate code for the medium-any code model. The program and its statically
25348 defined symbols must be within any single 2 GiB address range. Programs can be
25349 statically or dynamically linked.
25350
25351 @item -mexplicit-relocs
25352 @itemx -mno-exlicit-relocs
25353 Use or do not use assembler relocation operators when dealing with symbolic
25354 addresses. The alternative is to use assembler macros instead, which may
25355 limit optimization.
25356
25357 @item -mrelax
25358 @itemx -mno-relax
25359 Take advantage of linker relaxations to reduce the number of instructions
25360 required to materialize symbol addresses. The default is to take advantage of
25361 linker relaxations.
25362
25363 @item -memit-attribute
25364 @itemx -mno-emit-attribute
25365 Emit (do not emit) RISC-V attribute to record extra information into ELF
25366 objects. This feature requires at least binutils 2.32.
25367
25368 @item -malign-data=@var{type}
25369 @opindex malign-data
25370 Control how GCC aligns variables and constants of array, structure, or union
25371 types. Supported values for @var{type} are @samp{xlen} which uses x register
25372 width as the alignment value, and @samp{natural} which uses natural alignment.
25373 @samp{xlen} is the default.
25374 @end table
25375
25376 @node RL78 Options
25377 @subsection RL78 Options
25378 @cindex RL78 Options
25379
25380 @table @gcctabopt
25381
25382 @item -msim
25383 @opindex msim
25384 Links in additional target libraries to support operation within a
25385 simulator.
25386
25387 @item -mmul=none
25388 @itemx -mmul=g10
25389 @itemx -mmul=g13
25390 @itemx -mmul=g14
25391 @itemx -mmul=rl78
25392 @opindex mmul
25393 Specifies the type of hardware multiplication and division support to
25394 be used. The simplest is @code{none}, which uses software for both
25395 multiplication and division. This is the default. The @code{g13}
25396 value is for the hardware multiply/divide peripheral found on the
25397 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
25398 the multiplication and division instructions supported by the RL78/G14
25399 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
25400 the value @code{mg10} is an alias for @code{none}.
25401
25402 In addition a C preprocessor macro is defined, based upon the setting
25403 of this option. Possible values are: @code{__RL78_MUL_NONE__},
25404 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25405
25406 @item -mcpu=g10
25407 @itemx -mcpu=g13
25408 @itemx -mcpu=g14
25409 @itemx -mcpu=rl78
25410 @opindex mcpu
25411 Specifies the RL78 core to target. The default is the G14 core, also
25412 known as an S3 core or just RL78. The G13 or S2 core does not have
25413 multiply or divide instructions, instead it uses a hardware peripheral
25414 for these operations. The G10 or S1 core does not have register
25415 banks, so it uses a different calling convention.
25416
25417 If this option is set it also selects the type of hardware multiply
25418 support to use, unless this is overridden by an explicit
25419 @option{-mmul=none} option on the command line. Thus specifying
25420 @option{-mcpu=g13} enables the use of the G13 hardware multiply
25421 peripheral and specifying @option{-mcpu=g10} disables the use of
25422 hardware multiplications altogether.
25423
25424 Note, although the RL78/G14 core is the default target, specifying
25425 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25426 change the behavior of the toolchain since it also enables G14
25427 hardware multiply support. If these options are not specified on the
25428 command line then software multiplication routines will be used even
25429 though the code targets the RL78 core. This is for backwards
25430 compatibility with older toolchains which did not have hardware
25431 multiply and divide support.
25432
25433 In addition a C preprocessor macro is defined, based upon the setting
25434 of this option. Possible values are: @code{__RL78_G10__},
25435 @code{__RL78_G13__} or @code{__RL78_G14__}.
25436
25437 @item -mg10
25438 @itemx -mg13
25439 @itemx -mg14
25440 @itemx -mrl78
25441 @opindex mg10
25442 @opindex mg13
25443 @opindex mg14
25444 @opindex mrl78
25445 These are aliases for the corresponding @option{-mcpu=} option. They
25446 are provided for backwards compatibility.
25447
25448 @item -mallregs
25449 @opindex mallregs
25450 Allow the compiler to use all of the available registers. By default
25451 registers @code{r24..r31} are reserved for use in interrupt handlers.
25452 With this option enabled these registers can be used in ordinary
25453 functions as well.
25454
25455 @item -m64bit-doubles
25456 @itemx -m32bit-doubles
25457 @opindex m64bit-doubles
25458 @opindex m32bit-doubles
25459 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25460 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25461 @option{-m32bit-doubles}.
25462
25463 @item -msave-mduc-in-interrupts
25464 @itemx -mno-save-mduc-in-interrupts
25465 @opindex msave-mduc-in-interrupts
25466 @opindex mno-save-mduc-in-interrupts
25467 Specifies that interrupt handler functions should preserve the
25468 MDUC registers. This is only necessary if normal code might use
25469 the MDUC registers, for example because it performs multiplication
25470 and division operations. The default is to ignore the MDUC registers
25471 as this makes the interrupt handlers faster. The target option -mg13
25472 needs to be passed for this to work as this feature is only available
25473 on the G13 target (S2 core). The MDUC registers will only be saved
25474 if the interrupt handler performs a multiplication or division
25475 operation or it calls another function.
25476
25477 @end table
25478
25479 @node RS/6000 and PowerPC Options
25480 @subsection IBM RS/6000 and PowerPC Options
25481 @cindex RS/6000 and PowerPC Options
25482 @cindex IBM RS/6000 and PowerPC Options
25483
25484 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25485 @table @gcctabopt
25486 @item -mpowerpc-gpopt
25487 @itemx -mno-powerpc-gpopt
25488 @itemx -mpowerpc-gfxopt
25489 @itemx -mno-powerpc-gfxopt
25490 @need 800
25491 @itemx -mpowerpc64
25492 @itemx -mno-powerpc64
25493 @itemx -mmfcrf
25494 @itemx -mno-mfcrf
25495 @itemx -mpopcntb
25496 @itemx -mno-popcntb
25497 @itemx -mpopcntd
25498 @itemx -mno-popcntd
25499 @itemx -mfprnd
25500 @itemx -mno-fprnd
25501 @need 800
25502 @itemx -mcmpb
25503 @itemx -mno-cmpb
25504 @itemx -mhard-dfp
25505 @itemx -mno-hard-dfp
25506 @opindex mpowerpc-gpopt
25507 @opindex mno-powerpc-gpopt
25508 @opindex mpowerpc-gfxopt
25509 @opindex mno-powerpc-gfxopt
25510 @opindex mpowerpc64
25511 @opindex mno-powerpc64
25512 @opindex mmfcrf
25513 @opindex mno-mfcrf
25514 @opindex mpopcntb
25515 @opindex mno-popcntb
25516 @opindex mpopcntd
25517 @opindex mno-popcntd
25518 @opindex mfprnd
25519 @opindex mno-fprnd
25520 @opindex mcmpb
25521 @opindex mno-cmpb
25522 @opindex mhard-dfp
25523 @opindex mno-hard-dfp
25524 You use these options to specify which instructions are available on the
25525 processor you are using. The default value of these options is
25526 determined when configuring GCC@. Specifying the
25527 @option{-mcpu=@var{cpu_type}} overrides the specification of these
25528 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
25529 rather than the options listed above.
25530
25531 Specifying @option{-mpowerpc-gpopt} allows
25532 GCC to use the optional PowerPC architecture instructions in the
25533 General Purpose group, including floating-point square root. Specifying
25534 @option{-mpowerpc-gfxopt} allows GCC to
25535 use the optional PowerPC architecture instructions in the Graphics
25536 group, including floating-point select.
25537
25538 The @option{-mmfcrf} option allows GCC to generate the move from
25539 condition register field instruction implemented on the POWER4
25540 processor and other processors that support the PowerPC V2.01
25541 architecture.
25542 The @option{-mpopcntb} option allows GCC to generate the popcount and
25543 double-precision FP reciprocal estimate instruction implemented on the
25544 POWER5 processor and other processors that support the PowerPC V2.02
25545 architecture.
25546 The @option{-mpopcntd} option allows GCC to generate the popcount
25547 instruction implemented on the POWER7 processor and other processors
25548 that support the PowerPC V2.06 architecture.
25549 The @option{-mfprnd} option allows GCC to generate the FP round to
25550 integer instructions implemented on the POWER5+ processor and other
25551 processors that support the PowerPC V2.03 architecture.
25552 The @option{-mcmpb} option allows GCC to generate the compare bytes
25553 instruction implemented on the POWER6 processor and other processors
25554 that support the PowerPC V2.05 architecture.
25555 The @option{-mhard-dfp} option allows GCC to generate the decimal
25556 floating-point instructions implemented on some POWER processors.
25557
25558 The @option{-mpowerpc64} option allows GCC to generate the additional
25559 64-bit instructions that are found in the full PowerPC64 architecture
25560 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25561 @option{-mno-powerpc64}.
25562
25563 @item -mcpu=@var{cpu_type}
25564 @opindex mcpu
25565 Set architecture type, register usage, and
25566 instruction scheduling parameters for machine type @var{cpu_type}.
25567 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
25568 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
25569 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
25570 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
25571 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
25572 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
25573 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
25574 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
25575 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
25576 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
25577 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
25578 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
25579
25580 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
25581 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
25582 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
25583 architecture machine types, with an appropriate, generic processor
25584 model assumed for scheduling purposes.
25585
25586 Specifying @samp{native} as cpu type detects and selects the
25587 architecture option that corresponds to the host processor of the
25588 system performing the compilation.
25589 @option{-mcpu=native} has no effect if GCC does not recognize the
25590 processor.
25591
25592 The other options specify a specific processor. Code generated under
25593 those options runs best on that processor, and may not run at all on
25594 others.
25595
25596 The @option{-mcpu} options automatically enable or disable the
25597 following options:
25598
25599 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
25600 -mpopcntb -mpopcntd -mpowerpc64 @gol
25601 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
25602 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
25603 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
25604 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
25605
25606 The particular options set for any particular CPU varies between
25607 compiler versions, depending on what setting seems to produce optimal
25608 code for that CPU; it doesn't necessarily reflect the actual hardware's
25609 capabilities. If you wish to set an individual option to a particular
25610 value, you may specify it after the @option{-mcpu} option, like
25611 @option{-mcpu=970 -mno-altivec}.
25612
25613 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
25614 not enabled or disabled by the @option{-mcpu} option at present because
25615 AIX does not have full support for these options. You may still
25616 enable or disable them individually if you're sure it'll work in your
25617 environment.
25618
25619 @item -mtune=@var{cpu_type}
25620 @opindex mtune
25621 Set the instruction scheduling parameters for machine type
25622 @var{cpu_type}, but do not set the architecture type or register usage,
25623 as @option{-mcpu=@var{cpu_type}} does. The same
25624 values for @var{cpu_type} are used for @option{-mtune} as for
25625 @option{-mcpu}. If both are specified, the code generated uses the
25626 architecture and registers set by @option{-mcpu}, but the
25627 scheduling parameters set by @option{-mtune}.
25628
25629 @item -mcmodel=small
25630 @opindex mcmodel=small
25631 Generate PowerPC64 code for the small model: The TOC is limited to
25632 64k.
25633
25634 @item -mcmodel=medium
25635 @opindex mcmodel=medium
25636 Generate PowerPC64 code for the medium model: The TOC and other static
25637 data may be up to a total of 4G in size. This is the default for 64-bit
25638 Linux.
25639
25640 @item -mcmodel=large
25641 @opindex mcmodel=large
25642 Generate PowerPC64 code for the large model: The TOC may be up to 4G
25643 in size. Other data and code is only limited by the 64-bit address
25644 space.
25645
25646 @item -maltivec
25647 @itemx -mno-altivec
25648 @opindex maltivec
25649 @opindex mno-altivec
25650 Generate code that uses (does not use) AltiVec instructions, and also
25651 enable the use of built-in functions that allow more direct access to
25652 the AltiVec instruction set. You may also need to set
25653 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
25654 enhancements.
25655
25656 When @option{-maltivec} is used, the element order for AltiVec intrinsics
25657 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
25658 match array element order corresponding to the endianness of the
25659 target. That is, element zero identifies the leftmost element in a
25660 vector register when targeting a big-endian platform, and identifies
25661 the rightmost element in a vector register when targeting a
25662 little-endian platform.
25663
25664 @item -mvrsave
25665 @itemx -mno-vrsave
25666 @opindex mvrsave
25667 @opindex mno-vrsave
25668 Generate VRSAVE instructions when generating AltiVec code.
25669
25670 @item -msecure-plt
25671 @opindex msecure-plt
25672 Generate code that allows @command{ld} and @command{ld.so}
25673 to build executables and shared
25674 libraries with non-executable @code{.plt} and @code{.got} sections.
25675 This is a PowerPC
25676 32-bit SYSV ABI option.
25677
25678 @item -mbss-plt
25679 @opindex mbss-plt
25680 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
25681 fills in, and
25682 requires @code{.plt} and @code{.got}
25683 sections that are both writable and executable.
25684 This is a PowerPC 32-bit SYSV ABI option.
25685
25686 @item -misel
25687 @itemx -mno-isel
25688 @opindex misel
25689 @opindex mno-isel
25690 This switch enables or disables the generation of ISEL instructions.
25691
25692 @item -mvsx
25693 @itemx -mno-vsx
25694 @opindex mvsx
25695 @opindex mno-vsx
25696 Generate code that uses (does not use) vector/scalar (VSX)
25697 instructions, and also enable the use of built-in functions that allow
25698 more direct access to the VSX instruction set.
25699
25700 @item -mcrypto
25701 @itemx -mno-crypto
25702 @opindex mcrypto
25703 @opindex mno-crypto
25704 Enable the use (disable) of the built-in functions that allow direct
25705 access to the cryptographic instructions that were added in version
25706 2.07 of the PowerPC ISA.
25707
25708 @item -mhtm
25709 @itemx -mno-htm
25710 @opindex mhtm
25711 @opindex mno-htm
25712 Enable (disable) the use of the built-in functions that allow direct
25713 access to the Hardware Transactional Memory (HTM) instructions that
25714 were added in version 2.07 of the PowerPC ISA.
25715
25716 @item -mpower8-fusion
25717 @itemx -mno-power8-fusion
25718 @opindex mpower8-fusion
25719 @opindex mno-power8-fusion
25720 Generate code that keeps (does not keeps) some integer operations
25721 adjacent so that the instructions can be fused together on power8 and
25722 later processors.
25723
25724 @item -mpower8-vector
25725 @itemx -mno-power8-vector
25726 @opindex mpower8-vector
25727 @opindex mno-power8-vector
25728 Generate code that uses (does not use) the vector and scalar
25729 instructions that were added in version 2.07 of the PowerPC ISA. Also
25730 enable the use of built-in functions that allow more direct access to
25731 the vector instructions.
25732
25733 @item -mquad-memory
25734 @itemx -mno-quad-memory
25735 @opindex mquad-memory
25736 @opindex mno-quad-memory
25737 Generate code that uses (does not use) the non-atomic quad word memory
25738 instructions. The @option{-mquad-memory} option requires use of
25739 64-bit mode.
25740
25741 @item -mquad-memory-atomic
25742 @itemx -mno-quad-memory-atomic
25743 @opindex mquad-memory-atomic
25744 @opindex mno-quad-memory-atomic
25745 Generate code that uses (does not use) the atomic quad word memory
25746 instructions. The @option{-mquad-memory-atomic} option requires use of
25747 64-bit mode.
25748
25749 @item -mfloat128
25750 @itemx -mno-float128
25751 @opindex mfloat128
25752 @opindex mno-float128
25753 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
25754 and use either software emulation for IEEE 128-bit floating point or
25755 hardware instructions.
25756
25757 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
25758 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
25759 use the IEEE 128-bit floating point support. The IEEE 128-bit
25760 floating point support only works on PowerPC Linux systems.
25761
25762 The default for @option{-mfloat128} is enabled on PowerPC Linux
25763 systems using the VSX instruction set, and disabled on other systems.
25764
25765 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
25766 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
25767 point support will also enable the generation of ISA 3.0 IEEE 128-bit
25768 floating point instructions. Otherwise, if you do not specify to
25769 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
25770 system, IEEE 128-bit floating point will be done with software
25771 emulation.
25772
25773 @item -mfloat128-hardware
25774 @itemx -mno-float128-hardware
25775 @opindex mfloat128-hardware
25776 @opindex mno-float128-hardware
25777 Enable/disable using ISA 3.0 hardware instructions to support the
25778 @var{__float128} data type.
25779
25780 The default for @option{-mfloat128-hardware} is enabled on PowerPC
25781 Linux systems using the ISA 3.0 instruction set, and disabled on other
25782 systems.
25783
25784 @item -m32
25785 @itemx -m64
25786 @opindex m32
25787 @opindex m64
25788 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25789 targets (including GNU/Linux). The 32-bit environment sets int, long
25790 and pointer to 32 bits and generates code that runs on any PowerPC
25791 variant. The 64-bit environment sets int to 32 bits and long and
25792 pointer to 64 bits, and generates code for PowerPC64, as for
25793 @option{-mpowerpc64}.
25794
25795 @item -mfull-toc
25796 @itemx -mno-fp-in-toc
25797 @itemx -mno-sum-in-toc
25798 @itemx -mminimal-toc
25799 @opindex mfull-toc
25800 @opindex mno-fp-in-toc
25801 @opindex mno-sum-in-toc
25802 @opindex mminimal-toc
25803 Modify generation of the TOC (Table Of Contents), which is created for
25804 every executable file. The @option{-mfull-toc} option is selected by
25805 default. In that case, GCC allocates at least one TOC entry for
25806 each unique non-automatic variable reference in your program. GCC
25807 also places floating-point constants in the TOC@. However, only
25808 16,384 entries are available in the TOC@.
25809
25810 If you receive a linker error message that saying you have overflowed
25811 the available TOC space, you can reduce the amount of TOC space used
25812 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
25813 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
25814 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
25815 generate code to calculate the sum of an address and a constant at
25816 run time instead of putting that sum into the TOC@. You may specify one
25817 or both of these options. Each causes GCC to produce very slightly
25818 slower and larger code at the expense of conserving TOC space.
25819
25820 If you still run out of space in the TOC even when you specify both of
25821 these options, specify @option{-mminimal-toc} instead. This option causes
25822 GCC to make only one TOC entry for every file. When you specify this
25823 option, GCC produces code that is slower and larger but which
25824 uses extremely little TOC space. You may wish to use this option
25825 only on files that contain less frequently-executed code.
25826
25827 @item -maix64
25828 @itemx -maix32
25829 @opindex maix64
25830 @opindex maix32
25831 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
25832 @code{long} type, and the infrastructure needed to support them.
25833 Specifying @option{-maix64} implies @option{-mpowerpc64},
25834 while @option{-maix32} disables the 64-bit ABI and
25835 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
25836
25837 @item -mxl-compat
25838 @itemx -mno-xl-compat
25839 @opindex mxl-compat
25840 @opindex mno-xl-compat
25841 Produce code that conforms more closely to IBM XL compiler semantics
25842 when using AIX-compatible ABI@. Pass floating-point arguments to
25843 prototyped functions beyond the register save area (RSA) on the stack
25844 in addition to argument FPRs. Do not assume that most significant
25845 double in 128-bit long double value is properly rounded when comparing
25846 values and converting to double. Use XL symbol names for long double
25847 support routines.
25848
25849 The AIX calling convention was extended but not initially documented to
25850 handle an obscure K&R C case of calling a function that takes the
25851 address of its arguments with fewer arguments than declared. IBM XL
25852 compilers access floating-point arguments that do not fit in the
25853 RSA from the stack when a subroutine is compiled without
25854 optimization. Because always storing floating-point arguments on the
25855 stack is inefficient and rarely needed, this option is not enabled by
25856 default and only is necessary when calling subroutines compiled by IBM
25857 XL compilers without optimization.
25858
25859 @item -mpe
25860 @opindex mpe
25861 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
25862 application written to use message passing with special startup code to
25863 enable the application to run. The system must have PE installed in the
25864 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
25865 must be overridden with the @option{-specs=} option to specify the
25866 appropriate directory location. The Parallel Environment does not
25867 support threads, so the @option{-mpe} option and the @option{-pthread}
25868 option are incompatible.
25869
25870 @item -malign-natural
25871 @itemx -malign-power
25872 @opindex malign-natural
25873 @opindex malign-power
25874 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25875 @option{-malign-natural} overrides the ABI-defined alignment of larger
25876 types, such as floating-point doubles, on their natural size-based boundary.
25877 The option @option{-malign-power} instructs GCC to follow the ABI-specified
25878 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
25879
25880 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
25881 is not supported.
25882
25883 @item -msoft-float
25884 @itemx -mhard-float
25885 @opindex msoft-float
25886 @opindex mhard-float
25887 Generate code that does not use (uses) the floating-point register set.
25888 Software floating-point emulation is provided if you use the
25889 @option{-msoft-float} option, and pass the option to GCC when linking.
25890
25891 @item -mmultiple
25892 @itemx -mno-multiple
25893 @opindex mmultiple
25894 @opindex mno-multiple
25895 Generate code that uses (does not use) the load multiple word
25896 instructions and the store multiple word instructions. These
25897 instructions are generated by default on POWER systems, and not
25898 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
25899 PowerPC systems, since those instructions do not work when the
25900 processor is in little-endian mode. The exceptions are PPC740 and
25901 PPC750 which permit these instructions in little-endian mode.
25902
25903 @item -mupdate
25904 @itemx -mno-update
25905 @opindex mupdate
25906 @opindex mno-update
25907 Generate code that uses (does not use) the load or store instructions
25908 that update the base register to the address of the calculated memory
25909 location. These instructions are generated by default. If you use
25910 @option{-mno-update}, there is a small window between the time that the
25911 stack pointer is updated and the address of the previous frame is
25912 stored, which means code that walks the stack frame across interrupts or
25913 signals may get corrupted data.
25914
25915 @item -mavoid-indexed-addresses
25916 @itemx -mno-avoid-indexed-addresses
25917 @opindex mavoid-indexed-addresses
25918 @opindex mno-avoid-indexed-addresses
25919 Generate code that tries to avoid (not avoid) the use of indexed load
25920 or store instructions. These instructions can incur a performance
25921 penalty on Power6 processors in certain situations, such as when
25922 stepping through large arrays that cross a 16M boundary. This option
25923 is enabled by default when targeting Power6 and disabled otherwise.
25924
25925 @item -mfused-madd
25926 @itemx -mno-fused-madd
25927 @opindex mfused-madd
25928 @opindex mno-fused-madd
25929 Generate code that uses (does not use) the floating-point multiply and
25930 accumulate instructions. These instructions are generated by default
25931 if hardware floating point is used. The machine-dependent
25932 @option{-mfused-madd} option is now mapped to the machine-independent
25933 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25934 mapped to @option{-ffp-contract=off}.
25935
25936 @item -mmulhw
25937 @itemx -mno-mulhw
25938 @opindex mmulhw
25939 @opindex mno-mulhw
25940 Generate code that uses (does not use) the half-word multiply and
25941 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
25942 These instructions are generated by default when targeting those
25943 processors.
25944
25945 @item -mdlmzb
25946 @itemx -mno-dlmzb
25947 @opindex mdlmzb
25948 @opindex mno-dlmzb
25949 Generate code that uses (does not use) the string-search @samp{dlmzb}
25950 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
25951 generated by default when targeting those processors.
25952
25953 @item -mno-bit-align
25954 @itemx -mbit-align
25955 @opindex mno-bit-align
25956 @opindex mbit-align
25957 On System V.4 and embedded PowerPC systems do not (do) force structures
25958 and unions that contain bit-fields to be aligned to the base type of the
25959 bit-field.
25960
25961 For example, by default a structure containing nothing but 8
25962 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
25963 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
25964 the structure is aligned to a 1-byte boundary and is 1 byte in
25965 size.
25966
25967 @item -mno-strict-align
25968 @itemx -mstrict-align
25969 @opindex mno-strict-align
25970 @opindex mstrict-align
25971 On System V.4 and embedded PowerPC systems do not (do) assume that
25972 unaligned memory references are handled by the system.
25973
25974 @item -mrelocatable
25975 @itemx -mno-relocatable
25976 @opindex mrelocatable
25977 @opindex mno-relocatable
25978 Generate code that allows (does not allow) a static executable to be
25979 relocated to a different address at run time. A simple embedded
25980 PowerPC system loader should relocate the entire contents of
25981 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
25982 a table of 32-bit addresses generated by this option. For this to
25983 work, all objects linked together must be compiled with
25984 @option{-mrelocatable} or @option{-mrelocatable-lib}.
25985 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
25986
25987 @item -mrelocatable-lib
25988 @itemx -mno-relocatable-lib
25989 @opindex mrelocatable-lib
25990 @opindex mno-relocatable-lib
25991 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
25992 @code{.fixup} section to allow static executables to be relocated at
25993 run time, but @option{-mrelocatable-lib} does not use the smaller stack
25994 alignment of @option{-mrelocatable}. Objects compiled with
25995 @option{-mrelocatable-lib} may be linked with objects compiled with
25996 any combination of the @option{-mrelocatable} options.
25997
25998 @item -mno-toc
25999 @itemx -mtoc
26000 @opindex mno-toc
26001 @opindex mtoc
26002 On System V.4 and embedded PowerPC systems do not (do) assume that
26003 register 2 contains a pointer to a global area pointing to the addresses
26004 used in the program.
26005
26006 @item -mlittle
26007 @itemx -mlittle-endian
26008 @opindex mlittle
26009 @opindex mlittle-endian
26010 On System V.4 and embedded PowerPC systems compile code for the
26011 processor in little-endian mode. The @option{-mlittle-endian} option is
26012 the same as @option{-mlittle}.
26013
26014 @item -mbig
26015 @itemx -mbig-endian
26016 @opindex mbig
26017 @opindex mbig-endian
26018 On System V.4 and embedded PowerPC systems compile code for the
26019 processor in big-endian mode. The @option{-mbig-endian} option is
26020 the same as @option{-mbig}.
26021
26022 @item -mdynamic-no-pic
26023 @opindex mdynamic-no-pic
26024 On Darwin and Mac OS X systems, compile code so that it is not
26025 relocatable, but that its external references are relocatable. The
26026 resulting code is suitable for applications, but not shared
26027 libraries.
26028
26029 @item -msingle-pic-base
26030 @opindex msingle-pic-base
26031 Treat the register used for PIC addressing as read-only, rather than
26032 loading it in the prologue for each function. The runtime system is
26033 responsible for initializing this register with an appropriate value
26034 before execution begins.
26035
26036 @item -mprioritize-restricted-insns=@var{priority}
26037 @opindex mprioritize-restricted-insns
26038 This option controls the priority that is assigned to
26039 dispatch-slot restricted instructions during the second scheduling
26040 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
26041 or @samp{2} to assign no, highest, or second-highest (respectively)
26042 priority to dispatch-slot restricted
26043 instructions.
26044
26045 @item -msched-costly-dep=@var{dependence_type}
26046 @opindex msched-costly-dep
26047 This option controls which dependences are considered costly
26048 by the target during instruction scheduling. The argument
26049 @var{dependence_type} takes one of the following values:
26050
26051 @table @asis
26052 @item @samp{no}
26053 No dependence is costly.
26054
26055 @item @samp{all}
26056 All dependences are costly.
26057
26058 @item @samp{true_store_to_load}
26059 A true dependence from store to load is costly.
26060
26061 @item @samp{store_to_load}
26062 Any dependence from store to load is costly.
26063
26064 @item @var{number}
26065 Any dependence for which the latency is greater than or equal to
26066 @var{number} is costly.
26067 @end table
26068
26069 @item -minsert-sched-nops=@var{scheme}
26070 @opindex minsert-sched-nops
26071 This option controls which NOP insertion scheme is used during
26072 the second scheduling pass. The argument @var{scheme} takes one of the
26073 following values:
26074
26075 @table @asis
26076 @item @samp{no}
26077 Don't insert NOPs.
26078
26079 @item @samp{pad}
26080 Pad with NOPs any dispatch group that has vacant issue slots,
26081 according to the scheduler's grouping.
26082
26083 @item @samp{regroup_exact}
26084 Insert NOPs to force costly dependent insns into
26085 separate groups. Insert exactly as many NOPs as needed to force an insn
26086 to a new group, according to the estimated processor grouping.
26087
26088 @item @var{number}
26089 Insert NOPs to force costly dependent insns into
26090 separate groups. Insert @var{number} NOPs to force an insn to a new group.
26091 @end table
26092
26093 @item -mcall-sysv
26094 @opindex mcall-sysv
26095 On System V.4 and embedded PowerPC systems compile code using calling
26096 conventions that adhere to the March 1995 draft of the System V
26097 Application Binary Interface, PowerPC processor supplement. This is the
26098 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
26099
26100 @item -mcall-sysv-eabi
26101 @itemx -mcall-eabi
26102 @opindex mcall-sysv-eabi
26103 @opindex mcall-eabi
26104 Specify both @option{-mcall-sysv} and @option{-meabi} options.
26105
26106 @item -mcall-sysv-noeabi
26107 @opindex mcall-sysv-noeabi
26108 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
26109
26110 @item -mcall-aixdesc
26111 @opindex m
26112 On System V.4 and embedded PowerPC systems compile code for the AIX
26113 operating system.
26114
26115 @item -mcall-linux
26116 @opindex mcall-linux
26117 On System V.4 and embedded PowerPC systems compile code for the
26118 Linux-based GNU system.
26119
26120 @item -mcall-freebsd
26121 @opindex mcall-freebsd
26122 On System V.4 and embedded PowerPC systems compile code for the
26123 FreeBSD operating system.
26124
26125 @item -mcall-netbsd
26126 @opindex mcall-netbsd
26127 On System V.4 and embedded PowerPC systems compile code for the
26128 NetBSD operating system.
26129
26130 @item -mcall-openbsd
26131 @opindex mcall-netbsd
26132 On System V.4 and embedded PowerPC systems compile code for the
26133 OpenBSD operating system.
26134
26135 @item -mtraceback=@var{traceback_type}
26136 @opindex mtraceback
26137 Select the type of traceback table. Valid values for @var{traceback_type}
26138 are @samp{full}, @samp{part}, and @samp{no}.
26139
26140 @item -maix-struct-return
26141 @opindex maix-struct-return
26142 Return all structures in memory (as specified by the AIX ABI)@.
26143
26144 @item -msvr4-struct-return
26145 @opindex msvr4-struct-return
26146 Return structures smaller than 8 bytes in registers (as specified by the
26147 SVR4 ABI)@.
26148
26149 @item -mabi=@var{abi-type}
26150 @opindex mabi
26151 Extend the current ABI with a particular extension, or remove such extension.
26152 Valid values are @samp{altivec}, @samp{no-altivec},
26153 @samp{ibmlongdouble}, @samp{ieeelongdouble},
26154 @samp{elfv1}, @samp{elfv2}@.
26155
26156 @item -mabi=ibmlongdouble
26157 @opindex mabi=ibmlongdouble
26158 Change the current ABI to use IBM extended-precision long double.
26159 This is not likely to work if your system defaults to using IEEE
26160 extended-precision long double. If you change the long double type
26161 from IEEE extended-precision, the compiler will issue a warning unless
26162 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26163 to be enabled.
26164
26165 @item -mabi=ieeelongdouble
26166 @opindex mabi=ieeelongdouble
26167 Change the current ABI to use IEEE extended-precision long double.
26168 This is not likely to work if your system defaults to using IBM
26169 extended-precision long double. If you change the long double type
26170 from IBM extended-precision, the compiler will issue a warning unless
26171 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26172 to be enabled.
26173
26174 @item -mabi=elfv1
26175 @opindex mabi=elfv1
26176 Change the current ABI to use the ELFv1 ABI.
26177 This is the default ABI for big-endian PowerPC 64-bit Linux.
26178 Overriding the default ABI requires special system support and is
26179 likely to fail in spectacular ways.
26180
26181 @item -mabi=elfv2
26182 @opindex mabi=elfv2
26183 Change the current ABI to use the ELFv2 ABI.
26184 This is the default ABI for little-endian PowerPC 64-bit Linux.
26185 Overriding the default ABI requires special system support and is
26186 likely to fail in spectacular ways.
26187
26188 @item -mgnu-attribute
26189 @itemx -mno-gnu-attribute
26190 @opindex mgnu-attribute
26191 @opindex mno-gnu-attribute
26192 Emit .gnu_attribute assembly directives to set tag/value pairs in a
26193 .gnu.attributes section that specify ABI variations in function
26194 parameters or return values.
26195
26196 @item -mprototype
26197 @itemx -mno-prototype
26198 @opindex mprototype
26199 @opindex mno-prototype
26200 On System V.4 and embedded PowerPC systems assume that all calls to
26201 variable argument functions are properly prototyped. Otherwise, the
26202 compiler must insert an instruction before every non-prototyped call to
26203 set or clear bit 6 of the condition code register (@code{CR}) to
26204 indicate whether floating-point values are passed in the floating-point
26205 registers in case the function takes variable arguments. With
26206 @option{-mprototype}, only calls to prototyped variable argument functions
26207 set or clear the bit.
26208
26209 @item -msim
26210 @opindex msim
26211 On embedded PowerPC systems, assume that the startup module is called
26212 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26213 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
26214 configurations.
26215
26216 @item -mmvme
26217 @opindex mmvme
26218 On embedded PowerPC systems, assume that the startup module is called
26219 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26220 @file{libc.a}.
26221
26222 @item -mads
26223 @opindex mads
26224 On embedded PowerPC systems, assume that the startup module is called
26225 @file{crt0.o} and the standard C libraries are @file{libads.a} and
26226 @file{libc.a}.
26227
26228 @item -myellowknife
26229 @opindex myellowknife
26230 On embedded PowerPC systems, assume that the startup module is called
26231 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
26232 @file{libc.a}.
26233
26234 @item -mvxworks
26235 @opindex mvxworks
26236 On System V.4 and embedded PowerPC systems, specify that you are
26237 compiling for a VxWorks system.
26238
26239 @item -memb
26240 @opindex memb
26241 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26242 header to indicate that @samp{eabi} extended relocations are used.
26243
26244 @item -meabi
26245 @itemx -mno-eabi
26246 @opindex meabi
26247 @opindex mno-eabi
26248 On System V.4 and embedded PowerPC systems do (do not) adhere to the
26249 Embedded Applications Binary Interface (EABI), which is a set of
26250 modifications to the System V.4 specifications. Selecting @option{-meabi}
26251 means that the stack is aligned to an 8-byte boundary, a function
26252 @code{__eabi} is called from @code{main} to set up the EABI
26253 environment, and the @option{-msdata} option can use both @code{r2} and
26254 @code{r13} to point to two separate small data areas. Selecting
26255 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26256 no EABI initialization function is called from @code{main}, and the
26257 @option{-msdata} option only uses @code{r13} to point to a single
26258 small data area. The @option{-meabi} option is on by default if you
26259 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26260
26261 @item -msdata=eabi
26262 @opindex msdata=eabi
26263 On System V.4 and embedded PowerPC systems, put small initialized
26264 @code{const} global and static data in the @code{.sdata2} section, which
26265 is pointed to by register @code{r2}. Put small initialized
26266 non-@code{const} global and static data in the @code{.sdata} section,
26267 which is pointed to by register @code{r13}. Put small uninitialized
26268 global and static data in the @code{.sbss} section, which is adjacent to
26269 the @code{.sdata} section. The @option{-msdata=eabi} option is
26270 incompatible with the @option{-mrelocatable} option. The
26271 @option{-msdata=eabi} option also sets the @option{-memb} option.
26272
26273 @item -msdata=sysv
26274 @opindex msdata=sysv
26275 On System V.4 and embedded PowerPC systems, put small global and static
26276 data in the @code{.sdata} section, which is pointed to by register
26277 @code{r13}. Put small uninitialized global and static data in the
26278 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
26279 The @option{-msdata=sysv} option is incompatible with the
26280 @option{-mrelocatable} option.
26281
26282 @item -msdata=default
26283 @itemx -msdata
26284 @opindex msdata=default
26285 @opindex msdata
26286 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26287 compile code the same as @option{-msdata=eabi}, otherwise compile code the
26288 same as @option{-msdata=sysv}.
26289
26290 @item -msdata=data
26291 @opindex msdata=data
26292 On System V.4 and embedded PowerPC systems, put small global
26293 data in the @code{.sdata} section. Put small uninitialized global
26294 data in the @code{.sbss} section. Do not use register @code{r13}
26295 to address small data however. This is the default behavior unless
26296 other @option{-msdata} options are used.
26297
26298 @item -msdata=none
26299 @itemx -mno-sdata
26300 @opindex msdata=none
26301 @opindex mno-sdata
26302 On embedded PowerPC systems, put all initialized global and static data
26303 in the @code{.data} section, and all uninitialized data in the
26304 @code{.bss} section.
26305
26306 @item -mreadonly-in-sdata
26307 @opindex mreadonly-in-sdata
26308 @opindex mno-readonly-in-sdata
26309 Put read-only objects in the @code{.sdata} section as well. This is the
26310 default.
26311
26312 @item -mblock-move-inline-limit=@var{num}
26313 @opindex mblock-move-inline-limit
26314 Inline all block moves (such as calls to @code{memcpy} or structure
26315 copies) less than or equal to @var{num} bytes. The minimum value for
26316 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26317 targets. The default value is target-specific.
26318
26319 @item -mblock-compare-inline-limit=@var{num}
26320 @opindex mblock-compare-inline-limit
26321 Generate non-looping inline code for all block compares (such as calls
26322 to @code{memcmp} or structure compares) less than or equal to @var{num}
26323 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26324 block compare is disabled. The default value is target-specific.
26325
26326 @item -mblock-compare-inline-loop-limit=@var{num}
26327 @opindex mblock-compare-inline-loop-limit
26328 Generate an inline expansion using loop code for all block compares that
26329 are less than or equal to @var{num} bytes, but greater than the limit
26330 for non-loop inline block compare expansion. If the block length is not
26331 constant, at most @var{num} bytes will be compared before @code{memcmp}
26332 is called to compare the remainder of the block. The default value is
26333 target-specific.
26334
26335 @item -mstring-compare-inline-limit=@var{num}
26336 @opindex mstring-compare-inline-limit
26337 Compare at most @var{num} string bytes with inline code.
26338 If the difference or end of string is not found at the
26339 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26340 take care of the rest of the comparison. The default is 64 bytes.
26341
26342 @item -G @var{num}
26343 @opindex G
26344 @cindex smaller data references (PowerPC)
26345 @cindex .sdata/.sdata2 references (PowerPC)
26346 On embedded PowerPC systems, put global and static items less than or
26347 equal to @var{num} bytes into the small data or BSS sections instead of
26348 the normal data or BSS section. By default, @var{num} is 8. The
26349 @option{-G @var{num}} switch is also passed to the linker.
26350 All modules should be compiled with the same @option{-G @var{num}} value.
26351
26352 @item -mregnames
26353 @itemx -mno-regnames
26354 @opindex mregnames
26355 @opindex mno-regnames
26356 On System V.4 and embedded PowerPC systems do (do not) emit register
26357 names in the assembly language output using symbolic forms.
26358
26359 @item -mlongcall
26360 @itemx -mno-longcall
26361 @opindex mlongcall
26362 @opindex mno-longcall
26363 By default assume that all calls are far away so that a longer and more
26364 expensive calling sequence is required. This is required for calls
26365 farther than 32 megabytes (33,554,432 bytes) from the current location.
26366 A short call is generated if the compiler knows
26367 the call cannot be that far away. This setting can be overridden by
26368 the @code{shortcall} function attribute, or by @code{#pragma
26369 longcall(0)}.
26370
26371 Some linkers are capable of detecting out-of-range calls and generating
26372 glue code on the fly. On these systems, long calls are unnecessary and
26373 generate slower code. As of this writing, the AIX linker can do this,
26374 as can the GNU linker for PowerPC/64. It is planned to add this feature
26375 to the GNU linker for 32-bit PowerPC systems as well.
26376
26377 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26378 GCC can generate long calls using an inline PLT call sequence (see
26379 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
26380 ELFv1 (big-endian) do not support inline PLT calls.
26381
26382 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26383 callee, L42}, plus a @dfn{branch island} (glue code). The two target
26384 addresses represent the callee and the branch island. The
26385 Darwin/PPC linker prefers the first address and generates a @code{bl
26386 callee} if the PPC @code{bl} instruction reaches the callee directly;
26387 otherwise, the linker generates @code{bl L42} to call the branch
26388 island. The branch island is appended to the body of the
26389 calling function; it computes the full 32-bit address of the callee
26390 and jumps to it.
26391
26392 On Mach-O (Darwin) systems, this option directs the compiler emit to
26393 the glue for every direct call, and the Darwin linker decides whether
26394 to use or discard it.
26395
26396 In the future, GCC may ignore all longcall specifications
26397 when the linker is known to generate glue.
26398
26399 @item -mpltseq
26400 @itemx -mno-pltseq
26401 @opindex mpltseq
26402 @opindex mno-pltseq
26403 Implement (do not implement) -fno-plt and long calls using an inline
26404 PLT call sequence that supports lazy linking and long calls to
26405 functions in dlopen'd shared libraries. Inline PLT calls are only
26406 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26407 linkers, and are enabled by default if the support is detected when
26408 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26409 configured with @option{--enable-secureplt}. @option{-mpltseq} code
26410 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26411 linked together.
26412
26413 @item -mtls-markers
26414 @itemx -mno-tls-markers
26415 @opindex mtls-markers
26416 @opindex mno-tls-markers
26417 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26418 specifying the function argument. The relocation allows the linker to
26419 reliably associate function call with argument setup instructions for
26420 TLS optimization, which in turn allows GCC to better schedule the
26421 sequence.
26422
26423 @item -mrecip
26424 @itemx -mno-recip
26425 @opindex mrecip
26426 This option enables use of the reciprocal estimate and
26427 reciprocal square root estimate instructions with additional
26428 Newton-Raphson steps to increase precision instead of doing a divide or
26429 square root and divide for floating-point arguments. You should use
26430 the @option{-ffast-math} option when using @option{-mrecip} (or at
26431 least @option{-funsafe-math-optimizations},
26432 @option{-ffinite-math-only}, @option{-freciprocal-math} and
26433 @option{-fno-trapping-math}). Note that while the throughput of the
26434 sequence is generally higher than the throughput of the non-reciprocal
26435 instruction, the precision of the sequence can be decreased by up to 2
26436 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26437 roots.
26438
26439 @item -mrecip=@var{opt}
26440 @opindex mrecip=opt
26441 This option controls which reciprocal estimate instructions
26442 may be used. @var{opt} is a comma-separated list of options, which may
26443 be preceded by a @code{!} to invert the option:
26444
26445 @table @samp
26446
26447 @item all
26448 Enable all estimate instructions.
26449
26450 @item default
26451 Enable the default instructions, equivalent to @option{-mrecip}.
26452
26453 @item none
26454 Disable all estimate instructions, equivalent to @option{-mno-recip}.
26455
26456 @item div
26457 Enable the reciprocal approximation instructions for both
26458 single and double precision.
26459
26460 @item divf
26461 Enable the single-precision reciprocal approximation instructions.
26462
26463 @item divd
26464 Enable the double-precision reciprocal approximation instructions.
26465
26466 @item rsqrt
26467 Enable the reciprocal square root approximation instructions for both
26468 single and double precision.
26469
26470 @item rsqrtf
26471 Enable the single-precision reciprocal square root approximation instructions.
26472
26473 @item rsqrtd
26474 Enable the double-precision reciprocal square root approximation instructions.
26475
26476 @end table
26477
26478 So, for example, @option{-mrecip=all,!rsqrtd} enables
26479 all of the reciprocal estimate instructions, except for the
26480 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26481 which handle the double-precision reciprocal square root calculations.
26482
26483 @item -mrecip-precision
26484 @itemx -mno-recip-precision
26485 @opindex mrecip-precision
26486 Assume (do not assume) that the reciprocal estimate instructions
26487 provide higher-precision estimates than is mandated by the PowerPC
26488 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26489 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26490 The double-precision square root estimate instructions are not generated by
26491 default on low-precision machines, since they do not provide an
26492 estimate that converges after three steps.
26493
26494 @item -mveclibabi=@var{type}
26495 @opindex mveclibabi
26496 Specifies the ABI type to use for vectorizing intrinsics using an
26497 external library. The only type supported at present is @samp{mass},
26498 which specifies to use IBM's Mathematical Acceleration Subsystem
26499 (MASS) libraries for vectorizing intrinsics using external libraries.
26500 GCC currently emits calls to @code{acosd2}, @code{acosf4},
26501 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
26502 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
26503 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
26504 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
26505 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
26506 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
26507 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
26508 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
26509 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
26510 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
26511 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
26512 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
26513 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
26514 for power7. Both @option{-ftree-vectorize} and
26515 @option{-funsafe-math-optimizations} must also be enabled. The MASS
26516 libraries must be specified at link time.
26517
26518 @item -mfriz
26519 @itemx -mno-friz
26520 @opindex mfriz
26521 Generate (do not generate) the @code{friz} instruction when the
26522 @option{-funsafe-math-optimizations} option is used to optimize
26523 rounding of floating-point values to 64-bit integer and back to floating
26524 point. The @code{friz} instruction does not return the same value if
26525 the floating-point number is too large to fit in an integer.
26526
26527 @item -mpointers-to-nested-functions
26528 @itemx -mno-pointers-to-nested-functions
26529 @opindex mpointers-to-nested-functions
26530 Generate (do not generate) code to load up the static chain register
26531 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
26532 systems where a function pointer points to a 3-word descriptor giving
26533 the function address, TOC value to be loaded in register @code{r2}, and
26534 static chain value to be loaded in register @code{r11}. The
26535 @option{-mpointers-to-nested-functions} is on by default. You cannot
26536 call through pointers to nested functions or pointers
26537 to functions compiled in other languages that use the static chain if
26538 you use @option{-mno-pointers-to-nested-functions}.
26539
26540 @item -msave-toc-indirect
26541 @itemx -mno-save-toc-indirect
26542 @opindex msave-toc-indirect
26543 Generate (do not generate) code to save the TOC value in the reserved
26544 stack location in the function prologue if the function calls through
26545 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
26546 saved in the prologue, it is saved just before the call through the
26547 pointer. The @option{-mno-save-toc-indirect} option is the default.
26548
26549 @item -mcompat-align-parm
26550 @itemx -mno-compat-align-parm
26551 @opindex mcompat-align-parm
26552 Generate (do not generate) code to pass structure parameters with a
26553 maximum alignment of 64 bits, for compatibility with older versions
26554 of GCC.
26555
26556 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26557 structure parameter on a 128-bit boundary when that structure contained
26558 a member requiring 128-bit alignment. This is corrected in more
26559 recent versions of GCC. This option may be used to generate code
26560 that is compatible with functions compiled with older versions of
26561 GCC.
26562
26563 The @option{-mno-compat-align-parm} option is the default.
26564
26565 @item -mstack-protector-guard=@var{guard}
26566 @itemx -mstack-protector-guard-reg=@var{reg}
26567 @itemx -mstack-protector-guard-offset=@var{offset}
26568 @itemx -mstack-protector-guard-symbol=@var{symbol}
26569 @opindex mstack-protector-guard
26570 @opindex mstack-protector-guard-reg
26571 @opindex mstack-protector-guard-offset
26572 @opindex mstack-protector-guard-symbol
26573 Generate stack protection code using canary at @var{guard}. Supported
26574 locations are @samp{global} for global canary or @samp{tls} for per-thread
26575 canary in the TLS block (the default with GNU libc version 2.4 or later).
26576
26577 With the latter choice the options
26578 @option{-mstack-protector-guard-reg=@var{reg}} and
26579 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26580 which register to use as base register for reading the canary, and from what
26581 offset from that base register. The default for those is as specified in the
26582 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
26583 the offset with a symbol reference to a canary in the TLS block.
26584
26585 @item -mpcrel
26586 @itemx -mno-pcrel
26587 @opindex mpcrel
26588 @opindex mno-pcrel
26589 Generate (do not generate) pc-relative addressing when the option
26590 @option{-mcpu=future} is used. The @option{-mpcrel} option requires
26591 that the medium code model (@option{-mcmodel=medium}) and prefixed
26592 addressing (@option{-mprefixed}) options are enabled.
26593
26594 @item -mprefixed
26595 @itemx -mno-prefixed
26596 @opindex mprefixed
26597 @opindex mno-prefixed
26598 Generate (do not generate) addressing modes using prefixed load and
26599 store instructions when the option @option{-mcpu=future} is used.
26600 @end table
26601
26602 @node RX Options
26603 @subsection RX Options
26604 @cindex RX Options
26605
26606 These command-line options are defined for RX targets:
26607
26608 @table @gcctabopt
26609 @item -m64bit-doubles
26610 @itemx -m32bit-doubles
26611 @opindex m64bit-doubles
26612 @opindex m32bit-doubles
26613 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26614 or 32 bits (@option{-m32bit-doubles}) in size. The default is
26615 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
26616 works on 32-bit values, which is why the default is
26617 @option{-m32bit-doubles}.
26618
26619 @item -fpu
26620 @itemx -nofpu
26621 @opindex fpu
26622 @opindex nofpu
26623 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
26624 floating-point hardware. The default is enabled for the RX600
26625 series and disabled for the RX200 series.
26626
26627 Floating-point instructions are only generated for 32-bit floating-point
26628 values, however, so the FPU hardware is not used for doubles if the
26629 @option{-m64bit-doubles} option is used.
26630
26631 @emph{Note} If the @option{-fpu} option is enabled then
26632 @option{-funsafe-math-optimizations} is also enabled automatically.
26633 This is because the RX FPU instructions are themselves unsafe.
26634
26635 @item -mcpu=@var{name}
26636 @opindex mcpu
26637 Selects the type of RX CPU to be targeted. Currently three types are
26638 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
26639 the specific @samp{RX610} CPU. The default is @samp{RX600}.
26640
26641 The only difference between @samp{RX600} and @samp{RX610} is that the
26642 @samp{RX610} does not support the @code{MVTIPL} instruction.
26643
26644 The @samp{RX200} series does not have a hardware floating-point unit
26645 and so @option{-nofpu} is enabled by default when this type is
26646 selected.
26647
26648 @item -mbig-endian-data
26649 @itemx -mlittle-endian-data
26650 @opindex mbig-endian-data
26651 @opindex mlittle-endian-data
26652 Store data (but not code) in the big-endian format. The default is
26653 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
26654 format.
26655
26656 @item -msmall-data-limit=@var{N}
26657 @opindex msmall-data-limit
26658 Specifies the maximum size in bytes of global and static variables
26659 which can be placed into the small data area. Using the small data
26660 area can lead to smaller and faster code, but the size of area is
26661 limited and it is up to the programmer to ensure that the area does
26662 not overflow. Also when the small data area is used one of the RX's
26663 registers (usually @code{r13}) is reserved for use pointing to this
26664 area, so it is no longer available for use by the compiler. This
26665 could result in slower and/or larger code if variables are pushed onto
26666 the stack instead of being held in this register.
26667
26668 Note, common variables (variables that have not been initialized) and
26669 constants are not placed into the small data area as they are assigned
26670 to other sections in the output executable.
26671
26672 The default value is zero, which disables this feature. Note, this
26673 feature is not enabled by default with higher optimization levels
26674 (@option{-O2} etc) because of the potentially detrimental effects of
26675 reserving a register. It is up to the programmer to experiment and
26676 discover whether this feature is of benefit to their program. See the
26677 description of the @option{-mpid} option for a description of how the
26678 actual register to hold the small data area pointer is chosen.
26679
26680 @item -msim
26681 @itemx -mno-sim
26682 @opindex msim
26683 @opindex mno-sim
26684 Use the simulator runtime. The default is to use the libgloss
26685 board-specific runtime.
26686
26687 @item -mas100-syntax
26688 @itemx -mno-as100-syntax
26689 @opindex mas100-syntax
26690 @opindex mno-as100-syntax
26691 When generating assembler output use a syntax that is compatible with
26692 Renesas's AS100 assembler. This syntax can also be handled by the GAS
26693 assembler, but it has some restrictions so it is not generated by default.
26694
26695 @item -mmax-constant-size=@var{N}
26696 @opindex mmax-constant-size
26697 Specifies the maximum size, in bytes, of a constant that can be used as
26698 an operand in a RX instruction. Although the RX instruction set does
26699 allow constants of up to 4 bytes in length to be used in instructions,
26700 a longer value equates to a longer instruction. Thus in some
26701 circumstances it can be beneficial to restrict the size of constants
26702 that are used in instructions. Constants that are too big are instead
26703 placed into a constant pool and referenced via register indirection.
26704
26705 The value @var{N} can be between 0 and 4. A value of 0 (the default)
26706 or 4 means that constants of any size are allowed.
26707
26708 @item -mrelax
26709 @opindex mrelax
26710 Enable linker relaxation. Linker relaxation is a process whereby the
26711 linker attempts to reduce the size of a program by finding shorter
26712 versions of various instructions. Disabled by default.
26713
26714 @item -mint-register=@var{N}
26715 @opindex mint-register
26716 Specify the number of registers to reserve for fast interrupt handler
26717 functions. The value @var{N} can be between 0 and 4. A value of 1
26718 means that register @code{r13} is reserved for the exclusive use
26719 of fast interrupt handlers. A value of 2 reserves @code{r13} and
26720 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
26721 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
26722 A value of 0, the default, does not reserve any registers.
26723
26724 @item -msave-acc-in-interrupts
26725 @opindex msave-acc-in-interrupts
26726 Specifies that interrupt handler functions should preserve the
26727 accumulator register. This is only necessary if normal code might use
26728 the accumulator register, for example because it performs 64-bit
26729 multiplications. The default is to ignore the accumulator as this
26730 makes the interrupt handlers faster.
26731
26732 @item -mpid
26733 @itemx -mno-pid
26734 @opindex mpid
26735 @opindex mno-pid
26736 Enables the generation of position independent data. When enabled any
26737 access to constant data is done via an offset from a base address
26738 held in a register. This allows the location of constant data to be
26739 determined at run time without requiring the executable to be
26740 relocated, which is a benefit to embedded applications with tight
26741 memory constraints. Data that can be modified is not affected by this
26742 option.
26743
26744 Note, using this feature reserves a register, usually @code{r13}, for
26745 the constant data base address. This can result in slower and/or
26746 larger code, especially in complicated functions.
26747
26748 The actual register chosen to hold the constant data base address
26749 depends upon whether the @option{-msmall-data-limit} and/or the
26750 @option{-mint-register} command-line options are enabled. Starting
26751 with register @code{r13} and proceeding downwards, registers are
26752 allocated first to satisfy the requirements of @option{-mint-register},
26753 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
26754 is possible for the small data area register to be @code{r8} if both
26755 @option{-mint-register=4} and @option{-mpid} are specified on the
26756 command line.
26757
26758 By default this feature is not enabled. The default can be restored
26759 via the @option{-mno-pid} command-line option.
26760
26761 @item -mno-warn-multiple-fast-interrupts
26762 @itemx -mwarn-multiple-fast-interrupts
26763 @opindex mno-warn-multiple-fast-interrupts
26764 @opindex mwarn-multiple-fast-interrupts
26765 Prevents GCC from issuing a warning message if it finds more than one
26766 fast interrupt handler when it is compiling a file. The default is to
26767 issue a warning for each extra fast interrupt handler found, as the RX
26768 only supports one such interrupt.
26769
26770 @item -mallow-string-insns
26771 @itemx -mno-allow-string-insns
26772 @opindex mallow-string-insns
26773 @opindex mno-allow-string-insns
26774 Enables or disables the use of the string manipulation instructions
26775 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
26776 @code{SWHILE} and also the @code{RMPA} instruction. These
26777 instructions may prefetch data, which is not safe to do if accessing
26778 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
26779 for more information).
26780
26781 The default is to allow these instructions, but it is not possible for
26782 GCC to reliably detect all circumstances where a string instruction
26783 might be used to access an I/O register, so their use cannot be
26784 disabled automatically. Instead it is reliant upon the programmer to
26785 use the @option{-mno-allow-string-insns} option if their program
26786 accesses I/O space.
26787
26788 When the instructions are enabled GCC defines the C preprocessor
26789 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
26790 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
26791
26792 @item -mjsr
26793 @itemx -mno-jsr
26794 @opindex mjsr
26795 @opindex mno-jsr
26796 Use only (or not only) @code{JSR} instructions to access functions.
26797 This option can be used when code size exceeds the range of @code{BSR}
26798 instructions. Note that @option{-mno-jsr} does not mean to not use
26799 @code{JSR} but instead means that any type of branch may be used.
26800 @end table
26801
26802 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
26803 has special significance to the RX port when used with the
26804 @code{interrupt} function attribute. This attribute indicates a
26805 function intended to process fast interrupts. GCC ensures
26806 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
26807 and/or @code{r13} and only provided that the normal use of the
26808 corresponding registers have been restricted via the
26809 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
26810 options.
26811
26812 @node S/390 and zSeries Options
26813 @subsection S/390 and zSeries Options
26814 @cindex S/390 and zSeries Options
26815
26816 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
26817
26818 @table @gcctabopt
26819 @item -mhard-float
26820 @itemx -msoft-float
26821 @opindex mhard-float
26822 @opindex msoft-float
26823 Use (do not use) the hardware floating-point instructions and registers
26824 for floating-point operations. When @option{-msoft-float} is specified,
26825 functions in @file{libgcc.a} are used to perform floating-point
26826 operations. When @option{-mhard-float} is specified, the compiler
26827 generates IEEE floating-point instructions. This is the default.
26828
26829 @item -mhard-dfp
26830 @itemx -mno-hard-dfp
26831 @opindex mhard-dfp
26832 @opindex mno-hard-dfp
26833 Use (do not use) the hardware decimal-floating-point instructions for
26834 decimal-floating-point operations. When @option{-mno-hard-dfp} is
26835 specified, functions in @file{libgcc.a} are used to perform
26836 decimal-floating-point operations. When @option{-mhard-dfp} is
26837 specified, the compiler generates decimal-floating-point hardware
26838 instructions. This is the default for @option{-march=z9-ec} or higher.
26839
26840 @item -mlong-double-64
26841 @itemx -mlong-double-128
26842 @opindex mlong-double-64
26843 @opindex mlong-double-128
26844 These switches control the size of @code{long double} type. A size
26845 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26846 type. This is the default.
26847
26848 @item -mbackchain
26849 @itemx -mno-backchain
26850 @opindex mbackchain
26851 @opindex mno-backchain
26852 Store (do not store) the address of the caller's frame as backchain pointer
26853 into the callee's stack frame.
26854 A backchain may be needed to allow debugging using tools that do not understand
26855 DWARF call frame information.
26856 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
26857 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
26858 the backchain is placed into the topmost word of the 96/160 byte register
26859 save area.
26860
26861 In general, code compiled with @option{-mbackchain} is call-compatible with
26862 code compiled with @option{-mmo-backchain}; however, use of the backchain
26863 for debugging purposes usually requires that the whole binary is built with
26864 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
26865 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
26866 to build a linux kernel use @option{-msoft-float}.
26867
26868 The default is to not maintain the backchain.
26869
26870 @item -mpacked-stack
26871 @itemx -mno-packed-stack
26872 @opindex mpacked-stack
26873 @opindex mno-packed-stack
26874 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
26875 specified, the compiler uses the all fields of the 96/160 byte register save
26876 area only for their default purpose; unused fields still take up stack space.
26877 When @option{-mpacked-stack} is specified, register save slots are densely
26878 packed at the top of the register save area; unused space is reused for other
26879 purposes, allowing for more efficient use of the available stack space.
26880 However, when @option{-mbackchain} is also in effect, the topmost word of
26881 the save area is always used to store the backchain, and the return address
26882 register is always saved two words below the backchain.
26883
26884 As long as the stack frame backchain is not used, code generated with
26885 @option{-mpacked-stack} is call-compatible with code generated with
26886 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
26887 S/390 or zSeries generated code that uses the stack frame backchain at run
26888 time, not just for debugging purposes. Such code is not call-compatible
26889 with code compiled with @option{-mpacked-stack}. Also, note that the
26890 combination of @option{-mbackchain},
26891 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
26892 to build a linux kernel use @option{-msoft-float}.
26893
26894 The default is to not use the packed stack layout.
26895
26896 @item -msmall-exec
26897 @itemx -mno-small-exec
26898 @opindex msmall-exec
26899 @opindex mno-small-exec
26900 Generate (or do not generate) code using the @code{bras} instruction
26901 to do subroutine calls.
26902 This only works reliably if the total executable size does not
26903 exceed 64k. The default is to use the @code{basr} instruction instead,
26904 which does not have this limitation.
26905
26906 @item -m64
26907 @itemx -m31
26908 @opindex m64
26909 @opindex m31
26910 When @option{-m31} is specified, generate code compliant to the
26911 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
26912 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
26913 particular to generate 64-bit instructions. For the @samp{s390}
26914 targets, the default is @option{-m31}, while the @samp{s390x}
26915 targets default to @option{-m64}.
26916
26917 @item -mzarch
26918 @itemx -mesa
26919 @opindex mzarch
26920 @opindex mesa
26921 When @option{-mzarch} is specified, generate code using the
26922 instructions available on z/Architecture.
26923 When @option{-mesa} is specified, generate code using the
26924 instructions available on ESA/390. Note that @option{-mesa} is
26925 not possible with @option{-m64}.
26926 When generating code compliant to the GNU/Linux for S/390 ABI,
26927 the default is @option{-mesa}. When generating code compliant
26928 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
26929
26930 @item -mhtm
26931 @itemx -mno-htm
26932 @opindex mhtm
26933 @opindex mno-htm
26934 The @option{-mhtm} option enables a set of builtins making use of
26935 instructions available with the transactional execution facility
26936 introduced with the IBM zEnterprise EC12 machine generation
26937 @ref{S/390 System z Built-in Functions}.
26938 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
26939
26940 @item -mvx
26941 @itemx -mno-vx
26942 @opindex mvx
26943 @opindex mno-vx
26944 When @option{-mvx} is specified, generate code using the instructions
26945 available with the vector extension facility introduced with the IBM
26946 z13 machine generation.
26947 This option changes the ABI for some vector type values with regard to
26948 alignment and calling conventions. In case vector type values are
26949 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
26950 command will be added to mark the resulting binary with the ABI used.
26951 @option{-mvx} is enabled by default when using @option{-march=z13}.
26952
26953 @item -mzvector
26954 @itemx -mno-zvector
26955 @opindex mzvector
26956 @opindex mno-zvector
26957 The @option{-mzvector} option enables vector language extensions and
26958 builtins using instructions available with the vector extension
26959 facility introduced with the IBM z13 machine generation.
26960 This option adds support for @samp{vector} to be used as a keyword to
26961 define vector type variables and arguments. @samp{vector} is only
26962 available when GNU extensions are enabled. It will not be expanded
26963 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
26964 In addition to the GCC low-level builtins @option{-mzvector} enables
26965 a set of builtins added for compatibility with AltiVec-style
26966 implementations like Power and Cell. In order to make use of these
26967 builtins the header file @file{vecintrin.h} needs to be included.
26968 @option{-mzvector} is disabled by default.
26969
26970 @item -mmvcle
26971 @itemx -mno-mvcle
26972 @opindex mmvcle
26973 @opindex mno-mvcle
26974 Generate (or do not generate) code using the @code{mvcle} instruction
26975 to perform block moves. When @option{-mno-mvcle} is specified,
26976 use a @code{mvc} loop instead. This is the default unless optimizing for
26977 size.
26978
26979 @item -mdebug
26980 @itemx -mno-debug
26981 @opindex mdebug
26982 @opindex mno-debug
26983 Print (or do not print) additional debug information when compiling.
26984 The default is to not print debug information.
26985
26986 @item -march=@var{cpu-type}
26987 @opindex march
26988 Generate code that runs on @var{cpu-type}, which is the name of a
26989 system representing a certain processor type. Possible values for
26990 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
26991 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
26992 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
26993 @samp{z14}/@samp{arch12}, and @samp{native}.
26994
26995 The default is @option{-march=z900}.
26996
26997 Specifying @samp{native} as cpu type can be used to select the best
26998 architecture option for the host processor.
26999 @option{-march=native} has no effect if GCC does not recognize the
27000 processor.
27001
27002 @item -mtune=@var{cpu-type}
27003 @opindex mtune
27004 Tune to @var{cpu-type} everything applicable about the generated code,
27005 except for the ABI and the set of available instructions.
27006 The list of @var{cpu-type} values is the same as for @option{-march}.
27007 The default is the value used for @option{-march}.
27008
27009 @item -mtpf-trace
27010 @itemx -mno-tpf-trace
27011 @opindex mtpf-trace
27012 @opindex mno-tpf-trace
27013 Generate code that adds (does not add) in TPF OS specific branches to trace
27014 routines in the operating system. This option is off by default, even
27015 when compiling for the TPF OS@.
27016
27017 @item -mtpf-trace-skip
27018 @itemx -mno-tpf-trace-skip
27019 @opindex mtpf-trace-skip
27020 @opindex mno-tpf-trace-skip
27021 Generate code that changes (does not change) the default branch
27022 targets enabled by @option{-mtpf-trace} to point to specialized trace
27023 routines providing the ability of selectively skipping function trace
27024 entries for the TPF OS. This option is off by default, even when
27025 compiling for the TPF OS and specifying @option{-mtpf-trace}.
27026
27027 @item -mfused-madd
27028 @itemx -mno-fused-madd
27029 @opindex mfused-madd
27030 @opindex mno-fused-madd
27031 Generate code that uses (does not use) the floating-point multiply and
27032 accumulate instructions. These instructions are generated by default if
27033 hardware floating point is used.
27034
27035 @item -mwarn-framesize=@var{framesize}
27036 @opindex mwarn-framesize
27037 Emit a warning if the current function exceeds the given frame size. Because
27038 this is a compile-time check it doesn't need to be a real problem when the program
27039 runs. It is intended to identify functions that most probably cause
27040 a stack overflow. It is useful to be used in an environment with limited stack
27041 size e.g.@: the linux kernel.
27042
27043 @item -mwarn-dynamicstack
27044 @opindex mwarn-dynamicstack
27045 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
27046 arrays. This is generally a bad idea with a limited stack size.
27047
27048 @item -mstack-guard=@var{stack-guard}
27049 @itemx -mstack-size=@var{stack-size}
27050 @opindex mstack-guard
27051 @opindex mstack-size
27052 If these options are provided the S/390 back end emits additional instructions in
27053 the function prologue that trigger a trap if the stack size is @var{stack-guard}
27054 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
27055 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
27056 the frame size of the compiled function is chosen.
27057 These options are intended to be used to help debugging stack overflow problems.
27058 The additionally emitted code causes only little overhead and hence can also be
27059 used in production-like systems without greater performance degradation. The given
27060 values have to be exact powers of 2 and @var{stack-size} has to be greater than
27061 @var{stack-guard} without exceeding 64k.
27062 In order to be efficient the extra code makes the assumption that the stack starts
27063 at an address aligned to the value given by @var{stack-size}.
27064 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
27065
27066 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
27067 @opindex mhotpatch
27068 If the hotpatch option is enabled, a ``hot-patching'' function
27069 prologue is generated for all functions in the compilation unit.
27070 The funtion label is prepended with the given number of two-byte
27071 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
27072 the label, 2 * @var{post-halfwords} bytes are appended, using the
27073 largest NOP like instructions the architecture allows (maximum
27074 1000000).
27075
27076 If both arguments are zero, hotpatching is disabled.
27077
27078 This option can be overridden for individual functions with the
27079 @code{hotpatch} attribute.
27080 @end table
27081
27082 @node Score Options
27083 @subsection Score Options
27084 @cindex Score Options
27085
27086 These options are defined for Score implementations:
27087
27088 @table @gcctabopt
27089 @item -meb
27090 @opindex meb
27091 Compile code for big-endian mode. This is the default.
27092
27093 @item -mel
27094 @opindex mel
27095 Compile code for little-endian mode.
27096
27097 @item -mnhwloop
27098 @opindex mnhwloop
27099 Disable generation of @code{bcnz} instructions.
27100
27101 @item -muls
27102 @opindex muls
27103 Enable generation of unaligned load and store instructions.
27104
27105 @item -mmac
27106 @opindex mmac
27107 Enable the use of multiply-accumulate instructions. Disabled by default.
27108
27109 @item -mscore5
27110 @opindex mscore5
27111 Specify the SCORE5 as the target architecture.
27112
27113 @item -mscore5u
27114 @opindex mscore5u
27115 Specify the SCORE5U of the target architecture.
27116
27117 @item -mscore7
27118 @opindex mscore7
27119 Specify the SCORE7 as the target architecture. This is the default.
27120
27121 @item -mscore7d
27122 @opindex mscore7d
27123 Specify the SCORE7D as the target architecture.
27124 @end table
27125
27126 @node SH Options
27127 @subsection SH Options
27128
27129 These @samp{-m} options are defined for the SH implementations:
27130
27131 @table @gcctabopt
27132 @item -m1
27133 @opindex m1
27134 Generate code for the SH1.
27135
27136 @item -m2
27137 @opindex m2
27138 Generate code for the SH2.
27139
27140 @item -m2e
27141 Generate code for the SH2e.
27142
27143 @item -m2a-nofpu
27144 @opindex m2a-nofpu
27145 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
27146 that the floating-point unit is not used.
27147
27148 @item -m2a-single-only
27149 @opindex m2a-single-only
27150 Generate code for the SH2a-FPU, in such a way that no double-precision
27151 floating-point operations are used.
27152
27153 @item -m2a-single
27154 @opindex m2a-single
27155 Generate code for the SH2a-FPU assuming the floating-point unit is in
27156 single-precision mode by default.
27157
27158 @item -m2a
27159 @opindex m2a
27160 Generate code for the SH2a-FPU assuming the floating-point unit is in
27161 double-precision mode by default.
27162
27163 @item -m3
27164 @opindex m3
27165 Generate code for the SH3.
27166
27167 @item -m3e
27168 @opindex m3e
27169 Generate code for the SH3e.
27170
27171 @item -m4-nofpu
27172 @opindex m4-nofpu
27173 Generate code for the SH4 without a floating-point unit.
27174
27175 @item -m4-single-only
27176 @opindex m4-single-only
27177 Generate code for the SH4 with a floating-point unit that only
27178 supports single-precision arithmetic.
27179
27180 @item -m4-single
27181 @opindex m4-single
27182 Generate code for the SH4 assuming the floating-point unit is in
27183 single-precision mode by default.
27184
27185 @item -m4
27186 @opindex m4
27187 Generate code for the SH4.
27188
27189 @item -m4-100
27190 @opindex m4-100
27191 Generate code for SH4-100.
27192
27193 @item -m4-100-nofpu
27194 @opindex m4-100-nofpu
27195 Generate code for SH4-100 in such a way that the
27196 floating-point unit is not used.
27197
27198 @item -m4-100-single
27199 @opindex m4-100-single
27200 Generate code for SH4-100 assuming the floating-point unit is in
27201 single-precision mode by default.
27202
27203 @item -m4-100-single-only
27204 @opindex m4-100-single-only
27205 Generate code for SH4-100 in such a way that no double-precision
27206 floating-point operations are used.
27207
27208 @item -m4-200
27209 @opindex m4-200
27210 Generate code for SH4-200.
27211
27212 @item -m4-200-nofpu
27213 @opindex m4-200-nofpu
27214 Generate code for SH4-200 without in such a way that the
27215 floating-point unit is not used.
27216
27217 @item -m4-200-single
27218 @opindex m4-200-single
27219 Generate code for SH4-200 assuming the floating-point unit is in
27220 single-precision mode by default.
27221
27222 @item -m4-200-single-only
27223 @opindex m4-200-single-only
27224 Generate code for SH4-200 in such a way that no double-precision
27225 floating-point operations are used.
27226
27227 @item -m4-300
27228 @opindex m4-300
27229 Generate code for SH4-300.
27230
27231 @item -m4-300-nofpu
27232 @opindex m4-300-nofpu
27233 Generate code for SH4-300 without in such a way that the
27234 floating-point unit is not used.
27235
27236 @item -m4-300-single
27237 @opindex m4-300-single
27238 Generate code for SH4-300 in such a way that no double-precision
27239 floating-point operations are used.
27240
27241 @item -m4-300-single-only
27242 @opindex m4-300-single-only
27243 Generate code for SH4-300 in such a way that no double-precision
27244 floating-point operations are used.
27245
27246 @item -m4-340
27247 @opindex m4-340
27248 Generate code for SH4-340 (no MMU, no FPU).
27249
27250 @item -m4-500
27251 @opindex m4-500
27252 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
27253 assembler.
27254
27255 @item -m4a-nofpu
27256 @opindex m4a-nofpu
27257 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27258 floating-point unit is not used.
27259
27260 @item -m4a-single-only
27261 @opindex m4a-single-only
27262 Generate code for the SH4a, in such a way that no double-precision
27263 floating-point operations are used.
27264
27265 @item -m4a-single
27266 @opindex m4a-single
27267 Generate code for the SH4a assuming the floating-point unit is in
27268 single-precision mode by default.
27269
27270 @item -m4a
27271 @opindex m4a
27272 Generate code for the SH4a.
27273
27274 @item -m4al
27275 @opindex m4al
27276 Same as @option{-m4a-nofpu}, except that it implicitly passes
27277 @option{-dsp} to the assembler. GCC doesn't generate any DSP
27278 instructions at the moment.
27279
27280 @item -mb
27281 @opindex mb
27282 Compile code for the processor in big-endian mode.
27283
27284 @item -ml
27285 @opindex ml
27286 Compile code for the processor in little-endian mode.
27287
27288 @item -mdalign
27289 @opindex mdalign
27290 Align doubles at 64-bit boundaries. Note that this changes the calling
27291 conventions, and thus some functions from the standard C library do
27292 not work unless you recompile it first with @option{-mdalign}.
27293
27294 @item -mrelax
27295 @opindex mrelax
27296 Shorten some address references at link time, when possible; uses the
27297 linker option @option{-relax}.
27298
27299 @item -mbigtable
27300 @opindex mbigtable
27301 Use 32-bit offsets in @code{switch} tables. The default is to use
27302 16-bit offsets.
27303
27304 @item -mbitops
27305 @opindex mbitops
27306 Enable the use of bit manipulation instructions on SH2A.
27307
27308 @item -mfmovd
27309 @opindex mfmovd
27310 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
27311 alignment constraints.
27312
27313 @item -mrenesas
27314 @opindex mrenesas
27315 Comply with the calling conventions defined by Renesas.
27316
27317 @item -mno-renesas
27318 @opindex mno-renesas
27319 Comply with the calling conventions defined for GCC before the Renesas
27320 conventions were available. This option is the default for all
27321 targets of the SH toolchain.
27322
27323 @item -mnomacsave
27324 @opindex mnomacsave
27325 Mark the @code{MAC} register as call-clobbered, even if
27326 @option{-mrenesas} is given.
27327
27328 @item -mieee
27329 @itemx -mno-ieee
27330 @opindex mieee
27331 @opindex mno-ieee
27332 Control the IEEE compliance of floating-point comparisons, which affects the
27333 handling of cases where the result of a comparison is unordered. By default
27334 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
27335 enabled @option{-mno-ieee} is implicitly set, which results in faster
27336 floating-point greater-equal and less-equal comparisons. The implicit settings
27337 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27338
27339 @item -minline-ic_invalidate
27340 @opindex minline-ic_invalidate
27341 Inline code to invalidate instruction cache entries after setting up
27342 nested function trampolines.
27343 This option has no effect if @option{-musermode} is in effect and the selected
27344 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27345 instruction.
27346 If the selected code generation option does not allow the use of the @code{icbi}
27347 instruction, and @option{-musermode} is not in effect, the inlined code
27348 manipulates the instruction cache address array directly with an associative
27349 write. This not only requires privileged mode at run time, but it also
27350 fails if the cache line had been mapped via the TLB and has become unmapped.
27351
27352 @item -misize
27353 @opindex misize
27354 Dump instruction size and location in the assembly code.
27355
27356 @item -mpadstruct
27357 @opindex mpadstruct
27358 This option is deprecated. It pads structures to multiple of 4 bytes,
27359 which is incompatible with the SH ABI@.
27360
27361 @item -matomic-model=@var{model}
27362 @opindex matomic-model=@var{model}
27363 Sets the model of atomic operations and additional parameters as a comma
27364 separated list. For details on the atomic built-in functions see
27365 @ref{__atomic Builtins}. The following models and parameters are supported:
27366
27367 @table @samp
27368
27369 @item none
27370 Disable compiler generated atomic sequences and emit library calls for atomic
27371 operations. This is the default if the target is not @code{sh*-*-linux*}.
27372
27373 @item soft-gusa
27374 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27375 built-in functions. The generated atomic sequences require additional support
27376 from the interrupt/exception handling code of the system and are only suitable
27377 for SH3* and SH4* single-core systems. This option is enabled by default when
27378 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
27379 this option also partially utilizes the hardware atomic instructions
27380 @code{movli.l} and @code{movco.l} to create more efficient code, unless
27381 @samp{strict} is specified.
27382
27383 @item soft-tcb
27384 Generate software atomic sequences that use a variable in the thread control
27385 block. This is a variation of the gUSA sequences which can also be used on
27386 SH1* and SH2* targets. The generated atomic sequences require additional
27387 support from the interrupt/exception handling code of the system and are only
27388 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
27389 parameter has to be specified as well.
27390
27391 @item soft-imask
27392 Generate software atomic sequences that temporarily disable interrupts by
27393 setting @code{SR.IMASK = 1111}. This model works only when the program runs
27394 in privileged mode and is only suitable for single-core systems. Additional
27395 support from the interrupt/exception handling code of the system is not
27396 required. This model is enabled by default when the target is
27397 @code{sh*-*-linux*} and SH1* or SH2*.
27398
27399 @item hard-llcs
27400 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27401 instructions only. This is only available on SH4A and is suitable for
27402 multi-core systems. Since the hardware instructions support only 32 bit atomic
27403 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27404 Code compiled with this option is also compatible with other software
27405 atomic model interrupt/exception handling systems if executed on an SH4A
27406 system. Additional support from the interrupt/exception handling code of the
27407 system is not required for this model.
27408
27409 @item gbr-offset=
27410 This parameter specifies the offset in bytes of the variable in the thread
27411 control block structure that should be used by the generated atomic sequences
27412 when the @samp{soft-tcb} model has been selected. For other models this
27413 parameter is ignored. The specified value must be an integer multiple of four
27414 and in the range 0-1020.
27415
27416 @item strict
27417 This parameter prevents mixed usage of multiple atomic models, even if they
27418 are compatible, and makes the compiler generate atomic sequences of the
27419 specified model only.
27420
27421 @end table
27422
27423 @item -mtas
27424 @opindex mtas
27425 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27426 Notice that depending on the particular hardware and software configuration
27427 this can degrade overall performance due to the operand cache line flushes
27428 that are implied by the @code{tas.b} instruction. On multi-core SH4A
27429 processors the @code{tas.b} instruction must be used with caution since it
27430 can result in data corruption for certain cache configurations.
27431
27432 @item -mprefergot
27433 @opindex mprefergot
27434 When generating position-independent code, emit function calls using
27435 the Global Offset Table instead of the Procedure Linkage Table.
27436
27437 @item -musermode
27438 @itemx -mno-usermode
27439 @opindex musermode
27440 @opindex mno-usermode
27441 Don't allow (allow) the compiler generating privileged mode code. Specifying
27442 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27443 inlined code would not work in user mode. @option{-musermode} is the default
27444 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
27445 @option{-musermode} has no effect, since there is no user mode.
27446
27447 @item -multcost=@var{number}
27448 @opindex multcost=@var{number}
27449 Set the cost to assume for a multiply insn.
27450
27451 @item -mdiv=@var{strategy}
27452 @opindex mdiv=@var{strategy}
27453 Set the division strategy to be used for integer division operations.
27454 @var{strategy} can be one of:
27455
27456 @table @samp
27457
27458 @item call-div1
27459 Calls a library function that uses the single-step division instruction
27460 @code{div1} to perform the operation. Division by zero calculates an
27461 unspecified result and does not trap. This is the default except for SH4,
27462 SH2A and SHcompact.
27463
27464 @item call-fp
27465 Calls a library function that performs the operation in double precision
27466 floating point. Division by zero causes a floating-point exception. This is
27467 the default for SHcompact with FPU. Specifying this for targets that do not
27468 have a double precision FPU defaults to @code{call-div1}.
27469
27470 @item call-table
27471 Calls a library function that uses a lookup table for small divisors and
27472 the @code{div1} instruction with case distinction for larger divisors. Division
27473 by zero calculates an unspecified result and does not trap. This is the default
27474 for SH4. Specifying this for targets that do not have dynamic shift
27475 instructions defaults to @code{call-div1}.
27476
27477 @end table
27478
27479 When a division strategy has not been specified the default strategy is
27480 selected based on the current target. For SH2A the default strategy is to
27481 use the @code{divs} and @code{divu} instructions instead of library function
27482 calls.
27483
27484 @item -maccumulate-outgoing-args
27485 @opindex maccumulate-outgoing-args
27486 Reserve space once for outgoing arguments in the function prologue rather
27487 than around each call. Generally beneficial for performance and size. Also
27488 needed for unwinding to avoid changing the stack frame around conditional code.
27489
27490 @item -mdivsi3_libfunc=@var{name}
27491 @opindex mdivsi3_libfunc=@var{name}
27492 Set the name of the library function used for 32-bit signed division to
27493 @var{name}.
27494 This only affects the name used in the @samp{call} division strategies, and
27495 the compiler still expects the same sets of input/output/clobbered registers as
27496 if this option were not present.
27497
27498 @item -mfixed-range=@var{register-range}
27499 @opindex mfixed-range
27500 Generate code treating the given register range as fixed registers.
27501 A fixed register is one that the register allocator cannot use. This is
27502 useful when compiling kernel code. A register range is specified as
27503 two registers separated by a dash. Multiple register ranges can be
27504 specified separated by a comma.
27505
27506 @item -mbranch-cost=@var{num}
27507 @opindex mbranch-cost=@var{num}
27508 Assume @var{num} to be the cost for a branch instruction. Higher numbers
27509 make the compiler try to generate more branch-free code if possible.
27510 If not specified the value is selected depending on the processor type that
27511 is being compiled for.
27512
27513 @item -mzdcbranch
27514 @itemx -mno-zdcbranch
27515 @opindex mzdcbranch
27516 @opindex mno-zdcbranch
27517 Assume (do not assume) that zero displacement conditional branch instructions
27518 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
27519 compiler prefers zero displacement branch code sequences. This is
27520 enabled by default when generating code for SH4 and SH4A. It can be explicitly
27521 disabled by specifying @option{-mno-zdcbranch}.
27522
27523 @item -mcbranch-force-delay-slot
27524 @opindex mcbranch-force-delay-slot
27525 Force the usage of delay slots for conditional branches, which stuffs the delay
27526 slot with a @code{nop} if a suitable instruction cannot be found. By default
27527 this option is disabled. It can be enabled to work around hardware bugs as
27528 found in the original SH7055.
27529
27530 @item -mfused-madd
27531 @itemx -mno-fused-madd
27532 @opindex mfused-madd
27533 @opindex mno-fused-madd
27534 Generate code that uses (does not use) the floating-point multiply and
27535 accumulate instructions. These instructions are generated by default
27536 if hardware floating point is used. The machine-dependent
27537 @option{-mfused-madd} option is now mapped to the machine-independent
27538 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27539 mapped to @option{-ffp-contract=off}.
27540
27541 @item -mfsca
27542 @itemx -mno-fsca
27543 @opindex mfsca
27544 @opindex mno-fsca
27545 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
27546 and cosine approximations. The option @option{-mfsca} must be used in
27547 combination with @option{-funsafe-math-optimizations}. It is enabled by default
27548 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
27549 approximations even if @option{-funsafe-math-optimizations} is in effect.
27550
27551 @item -mfsrra
27552 @itemx -mno-fsrra
27553 @opindex mfsrra
27554 @opindex mno-fsrra
27555 Allow or disallow the compiler to emit the @code{fsrra} instruction for
27556 reciprocal square root approximations. The option @option{-mfsrra} must be used
27557 in combination with @option{-funsafe-math-optimizations} and
27558 @option{-ffinite-math-only}. It is enabled by default when generating code for
27559 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
27560 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
27561 in effect.
27562
27563 @item -mpretend-cmove
27564 @opindex mpretend-cmove
27565 Prefer zero-displacement conditional branches for conditional move instruction
27566 patterns. This can result in faster code on the SH4 processor.
27567
27568 @item -mfdpic
27569 @opindex fdpic
27570 Generate code using the FDPIC ABI.
27571
27572 @end table
27573
27574 @node Solaris 2 Options
27575 @subsection Solaris 2 Options
27576 @cindex Solaris 2 options
27577
27578 These @samp{-m} options are supported on Solaris 2:
27579
27580 @table @gcctabopt
27581 @item -mclear-hwcap
27582 @opindex mclear-hwcap
27583 @option{-mclear-hwcap} tells the compiler to remove the hardware
27584 capabilities generated by the Solaris assembler. This is only necessary
27585 when object files use ISA extensions not supported by the current
27586 machine, but check at runtime whether or not to use them.
27587
27588 @item -mimpure-text
27589 @opindex mimpure-text
27590 @option{-mimpure-text}, used in addition to @option{-shared}, tells
27591 the compiler to not pass @option{-z text} to the linker when linking a
27592 shared object. Using this option, you can link position-dependent
27593 code into a shared object.
27594
27595 @option{-mimpure-text} suppresses the ``relocations remain against
27596 allocatable but non-writable sections'' linker error message.
27597 However, the necessary relocations trigger copy-on-write, and the
27598 shared object is not actually shared across processes. Instead of
27599 using @option{-mimpure-text}, you should compile all source code with
27600 @option{-fpic} or @option{-fPIC}.
27601
27602 @end table
27603
27604 These switches are supported in addition to the above on Solaris 2:
27605
27606 @table @gcctabopt
27607 @item -pthreads
27608 @opindex pthreads
27609 This is a synonym for @option{-pthread}.
27610 @end table
27611
27612 @node SPARC Options
27613 @subsection SPARC Options
27614 @cindex SPARC options
27615
27616 These @samp{-m} options are supported on the SPARC:
27617
27618 @table @gcctabopt
27619 @item -mno-app-regs
27620 @itemx -mapp-regs
27621 @opindex mno-app-regs
27622 @opindex mapp-regs
27623 Specify @option{-mapp-regs} to generate output using the global registers
27624 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
27625 global register 1, each global register 2 through 4 is then treated as an
27626 allocable register that is clobbered by function calls. This is the default.
27627
27628 To be fully SVR4 ABI-compliant at the cost of some performance loss,
27629 specify @option{-mno-app-regs}. You should compile libraries and system
27630 software with this option.
27631
27632 @item -mflat
27633 @itemx -mno-flat
27634 @opindex mflat
27635 @opindex mno-flat
27636 With @option{-mflat}, the compiler does not generate save/restore instructions
27637 and uses a ``flat'' or single register window model. This model is compatible
27638 with the regular register window model. The local registers and the input
27639 registers (0--5) are still treated as ``call-saved'' registers and are
27640 saved on the stack as needed.
27641
27642 With @option{-mno-flat} (the default), the compiler generates save/restore
27643 instructions (except for leaf functions). This is the normal operating mode.
27644
27645 @item -mfpu
27646 @itemx -mhard-float
27647 @opindex mfpu
27648 @opindex mhard-float
27649 Generate output containing floating-point instructions. This is the
27650 default.
27651
27652 @item -mno-fpu
27653 @itemx -msoft-float
27654 @opindex mno-fpu
27655 @opindex msoft-float
27656 Generate output containing library calls for floating point.
27657 @strong{Warning:} the requisite libraries are not available for all SPARC
27658 targets. Normally the facilities of the machine's usual C compiler are
27659 used, but this cannot be done directly in cross-compilation. You must make
27660 your own arrangements to provide suitable library functions for
27661 cross-compilation. The embedded targets @samp{sparc-*-aout} and
27662 @samp{sparclite-*-*} do provide software floating-point support.
27663
27664 @option{-msoft-float} changes the calling convention in the output file;
27665 therefore, it is only useful if you compile @emph{all} of a program with
27666 this option. In particular, you need to compile @file{libgcc.a}, the
27667 library that comes with GCC, with @option{-msoft-float} in order for
27668 this to work.
27669
27670 @item -mhard-quad-float
27671 @opindex mhard-quad-float
27672 Generate output containing quad-word (long double) floating-point
27673 instructions.
27674
27675 @item -msoft-quad-float
27676 @opindex msoft-quad-float
27677 Generate output containing library calls for quad-word (long double)
27678 floating-point instructions. The functions called are those specified
27679 in the SPARC ABI@. This is the default.
27680
27681 As of this writing, there are no SPARC implementations that have hardware
27682 support for the quad-word floating-point instructions. They all invoke
27683 a trap handler for one of these instructions, and then the trap handler
27684 emulates the effect of the instruction. Because of the trap handler overhead,
27685 this is much slower than calling the ABI library routines. Thus the
27686 @option{-msoft-quad-float} option is the default.
27687
27688 @item -mno-unaligned-doubles
27689 @itemx -munaligned-doubles
27690 @opindex mno-unaligned-doubles
27691 @opindex munaligned-doubles
27692 Assume that doubles have 8-byte alignment. This is the default.
27693
27694 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
27695 alignment only if they are contained in another type, or if they have an
27696 absolute address. Otherwise, it assumes they have 4-byte alignment.
27697 Specifying this option avoids some rare compatibility problems with code
27698 generated by other compilers. It is not the default because it results
27699 in a performance loss, especially for floating-point code.
27700
27701 @item -muser-mode
27702 @itemx -mno-user-mode
27703 @opindex muser-mode
27704 @opindex mno-user-mode
27705 Do not generate code that can only run in supervisor mode. This is relevant
27706 only for the @code{casa} instruction emitted for the LEON3 processor. This
27707 is the default.
27708
27709 @item -mfaster-structs
27710 @itemx -mno-faster-structs
27711 @opindex mfaster-structs
27712 @opindex mno-faster-structs
27713 With @option{-mfaster-structs}, the compiler assumes that structures
27714 should have 8-byte alignment. This enables the use of pairs of
27715 @code{ldd} and @code{std} instructions for copies in structure
27716 assignment, in place of twice as many @code{ld} and @code{st} pairs.
27717 However, the use of this changed alignment directly violates the SPARC
27718 ABI@. Thus, it's intended only for use on targets where the developer
27719 acknowledges that their resulting code is not directly in line with
27720 the rules of the ABI@.
27721
27722 @item -mstd-struct-return
27723 @itemx -mno-std-struct-return
27724 @opindex mstd-struct-return
27725 @opindex mno-std-struct-return
27726 With @option{-mstd-struct-return}, the compiler generates checking code
27727 in functions returning structures or unions to detect size mismatches
27728 between the two sides of function calls, as per the 32-bit ABI@.
27729
27730 The default is @option{-mno-std-struct-return}. This option has no effect
27731 in 64-bit mode.
27732
27733 @item -mlra
27734 @itemx -mno-lra
27735 @opindex mlra
27736 @opindex mno-lra
27737 Enable Local Register Allocation. This is the default for SPARC since GCC 7
27738 so @option{-mno-lra} needs to be passed to get old Reload.
27739
27740 @item -mcpu=@var{cpu_type}
27741 @opindex mcpu
27742 Set the instruction set, register set, and instruction scheduling parameters
27743 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27744 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
27745 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
27746 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
27747 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
27748 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
27749
27750 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
27751 which selects the best architecture option for the host processor.
27752 @option{-mcpu=native} has no effect if GCC does not recognize
27753 the processor.
27754
27755 Default instruction scheduling parameters are used for values that select
27756 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
27757 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
27758
27759 Here is a list of each supported architecture and their supported
27760 implementations.
27761
27762 @table @asis
27763 @item v7
27764 cypress, leon3v7
27765
27766 @item v8
27767 supersparc, hypersparc, leon, leon3
27768
27769 @item sparclite
27770 f930, f934, sparclite86x
27771
27772 @item sparclet
27773 tsc701
27774
27775 @item v9
27776 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27777 niagara7, m8
27778 @end table
27779
27780 By default (unless configured otherwise), GCC generates code for the V7
27781 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
27782 additionally optimizes it for the Cypress CY7C602 chip, as used in the
27783 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
27784 SPARCStation 1, 2, IPX etc.
27785
27786 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
27787 architecture. The only difference from V7 code is that the compiler emits
27788 the integer multiply and integer divide instructions which exist in SPARC-V8
27789 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
27790 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
27791 2000 series.
27792
27793 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
27794 the SPARC architecture. This adds the integer multiply, integer divide step
27795 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
27796 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
27797 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
27798 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
27799 MB86934 chip, which is the more recent SPARClite with FPU@.
27800
27801 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
27802 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
27803 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
27804 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
27805 optimizes it for the TEMIC SPARClet chip.
27806
27807 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
27808 architecture. This adds 64-bit integer and floating-point move instructions,
27809 3 additional floating-point condition code registers and conditional move
27810 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
27811 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
27812 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
27813 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
27814 @option{-mcpu=niagara}, the compiler additionally optimizes it for
27815 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
27816 additionally optimizes it for Sun UltraSPARC T2 chips. With
27817 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
27818 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
27819 additionally optimizes it for Sun UltraSPARC T4 chips. With
27820 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
27821 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
27822 additionally optimizes it for Oracle M8 chips.
27823
27824 @item -mtune=@var{cpu_type}
27825 @opindex mtune
27826 Set the instruction scheduling parameters for machine type
27827 @var{cpu_type}, but do not set the instruction set or register set that the
27828 option @option{-mcpu=@var{cpu_type}} does.
27829
27830 The same values for @option{-mcpu=@var{cpu_type}} can be used for
27831 @option{-mtune=@var{cpu_type}}, but the only useful values are those
27832 that select a particular CPU implementation. Those are
27833 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
27834 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
27835 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
27836 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
27837 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
27838 and GNU/Linux toolchains, @samp{native} can also be used.
27839
27840 @item -mv8plus
27841 @itemx -mno-v8plus
27842 @opindex mv8plus
27843 @opindex mno-v8plus
27844 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
27845 difference from the V8 ABI is that the global and out registers are
27846 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
27847 mode for all SPARC-V9 processors.
27848
27849 @item -mvis
27850 @itemx -mno-vis
27851 @opindex mvis
27852 @opindex mno-vis
27853 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
27854 Visual Instruction Set extensions. The default is @option{-mno-vis}.
27855
27856 @item -mvis2
27857 @itemx -mno-vis2
27858 @opindex mvis2
27859 @opindex mno-vis2
27860 With @option{-mvis2}, GCC generates code that takes advantage of
27861 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
27862 default is @option{-mvis2} when targeting a cpu that supports such
27863 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
27864 also sets @option{-mvis}.
27865
27866 @item -mvis3
27867 @itemx -mno-vis3
27868 @opindex mvis3
27869 @opindex mno-vis3
27870 With @option{-mvis3}, GCC generates code that takes advantage of
27871 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
27872 default is @option{-mvis3} when targeting a cpu that supports such
27873 instructions, such as niagara-3 and later. Setting @option{-mvis3}
27874 also sets @option{-mvis2} and @option{-mvis}.
27875
27876 @item -mvis4
27877 @itemx -mno-vis4
27878 @opindex mvis4
27879 @opindex mno-vis4
27880 With @option{-mvis4}, GCC generates code that takes advantage of
27881 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
27882 default is @option{-mvis4} when targeting a cpu that supports such
27883 instructions, such as niagara-7 and later. Setting @option{-mvis4}
27884 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
27885
27886 @item -mvis4b
27887 @itemx -mno-vis4b
27888 @opindex mvis4b
27889 @opindex mno-vis4b
27890 With @option{-mvis4b}, GCC generates code that takes advantage of
27891 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
27892 the additional VIS instructions introduced in the Oracle SPARC
27893 Architecture 2017. The default is @option{-mvis4b} when targeting a
27894 cpu that supports such instructions, such as m8 and later. Setting
27895 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
27896 @option{-mvis2} and @option{-mvis}.
27897
27898 @item -mcbcond
27899 @itemx -mno-cbcond
27900 @opindex mcbcond
27901 @opindex mno-cbcond
27902 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
27903 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
27904 when targeting a CPU that supports such instructions, such as Niagara-4 and
27905 later.
27906
27907 @item -mfmaf
27908 @itemx -mno-fmaf
27909 @opindex mfmaf
27910 @opindex mno-fmaf
27911 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
27912 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
27913 when targeting a CPU that supports such instructions, such as Niagara-3 and
27914 later.
27915
27916 @item -mfsmuld
27917 @itemx -mno-fsmuld
27918 @opindex mfsmuld
27919 @opindex mno-fsmuld
27920 With @option{-mfsmuld}, GCC generates code that takes advantage of the
27921 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
27922 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
27923 or V9 with FPU except @option{-mcpu=leon}.
27924
27925 @item -mpopc
27926 @itemx -mno-popc
27927 @opindex mpopc
27928 @opindex mno-popc
27929 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
27930 Population Count instruction. The default is @option{-mpopc}
27931 when targeting a CPU that supports such an instruction, such as Niagara-2 and
27932 later.
27933
27934 @item -msubxc
27935 @itemx -mno-subxc
27936 @opindex msubxc
27937 @opindex mno-subxc
27938 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
27939 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
27940 when targeting a CPU that supports such an instruction, such as Niagara-7 and
27941 later.
27942
27943 @item -mfix-at697f
27944 @opindex mfix-at697f
27945 Enable the documented workaround for the single erratum of the Atmel AT697F
27946 processor (which corresponds to erratum #13 of the AT697E processor).
27947
27948 @item -mfix-ut699
27949 @opindex mfix-ut699
27950 Enable the documented workarounds for the floating-point errata and the data
27951 cache nullify errata of the UT699 processor.
27952
27953 @item -mfix-ut700
27954 @opindex mfix-ut700
27955 Enable the documented workaround for the back-to-back store errata of
27956 the UT699E/UT700 processor.
27957
27958 @item -mfix-gr712rc
27959 @opindex mfix-gr712rc
27960 Enable the documented workaround for the back-to-back store errata of
27961 the GR712RC processor.
27962 @end table
27963
27964 These @samp{-m} options are supported in addition to the above
27965 on SPARC-V9 processors in 64-bit environments:
27966
27967 @table @gcctabopt
27968 @item -m32
27969 @itemx -m64
27970 @opindex m32
27971 @opindex m64
27972 Generate code for a 32-bit or 64-bit environment.
27973 The 32-bit environment sets int, long and pointer to 32 bits.
27974 The 64-bit environment sets int to 32 bits and long and pointer
27975 to 64 bits.
27976
27977 @item -mcmodel=@var{which}
27978 @opindex mcmodel
27979 Set the code model to one of
27980
27981 @table @samp
27982 @item medlow
27983 The Medium/Low code model: 64-bit addresses, programs
27984 must be linked in the low 32 bits of memory. Programs can be statically
27985 or dynamically linked.
27986
27987 @item medmid
27988 The Medium/Middle code model: 64-bit addresses, programs
27989 must be linked in the low 44 bits of memory, the text and data segments must
27990 be less than 2GB in size and the data segment must be located within 2GB of
27991 the text segment.
27992
27993 @item medany
27994 The Medium/Anywhere code model: 64-bit addresses, programs
27995 may be linked anywhere in memory, the text and data segments must be less
27996 than 2GB in size and the data segment must be located within 2GB of the
27997 text segment.
27998
27999 @item embmedany
28000 The Medium/Anywhere code model for embedded systems:
28001 64-bit addresses, the text and data segments must be less than 2GB in
28002 size, both starting anywhere in memory (determined at link time). The
28003 global register %g4 points to the base of the data segment. Programs
28004 are statically linked and PIC is not supported.
28005 @end table
28006
28007 @item -mmemory-model=@var{mem-model}
28008 @opindex mmemory-model
28009 Set the memory model in force on the processor to one of
28010
28011 @table @samp
28012 @item default
28013 The default memory model for the processor and operating system.
28014
28015 @item rmo
28016 Relaxed Memory Order
28017
28018 @item pso
28019 Partial Store Order
28020
28021 @item tso
28022 Total Store Order
28023
28024 @item sc
28025 Sequential Consistency
28026 @end table
28027
28028 These memory models are formally defined in Appendix D of the SPARC-V9
28029 architecture manual, as set in the processor's @code{PSTATE.MM} field.
28030
28031 @item -mstack-bias
28032 @itemx -mno-stack-bias
28033 @opindex mstack-bias
28034 @opindex mno-stack-bias
28035 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
28036 frame pointer if present, are offset by @minus{}2047 which must be added back
28037 when making stack frame references. This is the default in 64-bit mode.
28038 Otherwise, assume no such offset is present.
28039 @end table
28040
28041 @node System V Options
28042 @subsection Options for System V
28043
28044 These additional options are available on System V Release 4 for
28045 compatibility with other compilers on those systems:
28046
28047 @table @gcctabopt
28048 @item -G
28049 @opindex G
28050 Create a shared object.
28051 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
28052
28053 @item -Qy
28054 @opindex Qy
28055 Identify the versions of each tool used by the compiler, in a
28056 @code{.ident} assembler directive in the output.
28057
28058 @item -Qn
28059 @opindex Qn
28060 Refrain from adding @code{.ident} directives to the output file (this is
28061 the default).
28062
28063 @item -YP,@var{dirs}
28064 @opindex YP
28065 Search the directories @var{dirs}, and no others, for libraries
28066 specified with @option{-l}.
28067
28068 @item -Ym,@var{dir}
28069 @opindex Ym
28070 Look in the directory @var{dir} to find the M4 preprocessor.
28071 The assembler uses this option.
28072 @c This is supposed to go with a -Yd for predefined M4 macro files, but
28073 @c the generic assembler that comes with Solaris takes just -Ym.
28074 @end table
28075
28076 @node TILE-Gx Options
28077 @subsection TILE-Gx Options
28078 @cindex TILE-Gx options
28079
28080 These @samp{-m} options are supported on the TILE-Gx:
28081
28082 @table @gcctabopt
28083 @item -mcmodel=small
28084 @opindex mcmodel=small
28085 Generate code for the small model. The distance for direct calls is
28086 limited to 500M in either direction. PC-relative addresses are 32
28087 bits. Absolute addresses support the full address range.
28088
28089 @item -mcmodel=large
28090 @opindex mcmodel=large
28091 Generate code for the large model. There is no limitation on call
28092 distance, pc-relative addresses, or absolute addresses.
28093
28094 @item -mcpu=@var{name}
28095 @opindex mcpu
28096 Selects the type of CPU to be targeted. Currently the only supported
28097 type is @samp{tilegx}.
28098
28099 @item -m32
28100 @itemx -m64
28101 @opindex m32
28102 @opindex m64
28103 Generate code for a 32-bit or 64-bit environment. The 32-bit
28104 environment sets int, long, and pointer to 32 bits. The 64-bit
28105 environment sets int to 32 bits and long and pointer to 64 bits.
28106
28107 @item -mbig-endian
28108 @itemx -mlittle-endian
28109 @opindex mbig-endian
28110 @opindex mlittle-endian
28111 Generate code in big/little endian mode, respectively.
28112 @end table
28113
28114 @node TILEPro Options
28115 @subsection TILEPro Options
28116 @cindex TILEPro options
28117
28118 These @samp{-m} options are supported on the TILEPro:
28119
28120 @table @gcctabopt
28121 @item -mcpu=@var{name}
28122 @opindex mcpu
28123 Selects the type of CPU to be targeted. Currently the only supported
28124 type is @samp{tilepro}.
28125
28126 @item -m32
28127 @opindex m32
28128 Generate code for a 32-bit environment, which sets int, long, and
28129 pointer to 32 bits. This is the only supported behavior so the flag
28130 is essentially ignored.
28131 @end table
28132
28133 @node V850 Options
28134 @subsection V850 Options
28135 @cindex V850 Options
28136
28137 These @samp{-m} options are defined for V850 implementations:
28138
28139 @table @gcctabopt
28140 @item -mlong-calls
28141 @itemx -mno-long-calls
28142 @opindex mlong-calls
28143 @opindex mno-long-calls
28144 Treat all calls as being far away (near). If calls are assumed to be
28145 far away, the compiler always loads the function's address into a
28146 register, and calls indirect through the pointer.
28147
28148 @item -mno-ep
28149 @itemx -mep
28150 @opindex mno-ep
28151 @opindex mep
28152 Do not optimize (do optimize) basic blocks that use the same index
28153 pointer 4 or more times to copy pointer into the @code{ep} register, and
28154 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
28155 option is on by default if you optimize.
28156
28157 @item -mno-prolog-function
28158 @itemx -mprolog-function
28159 @opindex mno-prolog-function
28160 @opindex mprolog-function
28161 Do not use (do use) external functions to save and restore registers
28162 at the prologue and epilogue of a function. The external functions
28163 are slower, but use less code space if more than one function saves
28164 the same number of registers. The @option{-mprolog-function} option
28165 is on by default if you optimize.
28166
28167 @item -mspace
28168 @opindex mspace
28169 Try to make the code as small as possible. At present, this just turns
28170 on the @option{-mep} and @option{-mprolog-function} options.
28171
28172 @item -mtda=@var{n}
28173 @opindex mtda
28174 Put static or global variables whose size is @var{n} bytes or less into
28175 the tiny data area that register @code{ep} points to. The tiny data
28176 area can hold up to 256 bytes in total (128 bytes for byte references).
28177
28178 @item -msda=@var{n}
28179 @opindex msda
28180 Put static or global variables whose size is @var{n} bytes or less into
28181 the small data area that register @code{gp} points to. The small data
28182 area can hold up to 64 kilobytes.
28183
28184 @item -mzda=@var{n}
28185 @opindex mzda
28186 Put static or global variables whose size is @var{n} bytes or less into
28187 the first 32 kilobytes of memory.
28188
28189 @item -mv850
28190 @opindex mv850
28191 Specify that the target processor is the V850.
28192
28193 @item -mv850e3v5
28194 @opindex mv850e3v5
28195 Specify that the target processor is the V850E3V5. The preprocessor
28196 constant @code{__v850e3v5__} is defined if this option is used.
28197
28198 @item -mv850e2v4
28199 @opindex mv850e2v4
28200 Specify that the target processor is the V850E3V5. This is an alias for
28201 the @option{-mv850e3v5} option.
28202
28203 @item -mv850e2v3
28204 @opindex mv850e2v3
28205 Specify that the target processor is the V850E2V3. The preprocessor
28206 constant @code{__v850e2v3__} is defined if this option is used.
28207
28208 @item -mv850e2
28209 @opindex mv850e2
28210 Specify that the target processor is the V850E2. The preprocessor
28211 constant @code{__v850e2__} is defined if this option is used.
28212
28213 @item -mv850e1
28214 @opindex mv850e1
28215 Specify that the target processor is the V850E1. The preprocessor
28216 constants @code{__v850e1__} and @code{__v850e__} are defined if
28217 this option is used.
28218
28219 @item -mv850es
28220 @opindex mv850es
28221 Specify that the target processor is the V850ES. This is an alias for
28222 the @option{-mv850e1} option.
28223
28224 @item -mv850e
28225 @opindex mv850e
28226 Specify that the target processor is the V850E@. The preprocessor
28227 constant @code{__v850e__} is defined if this option is used.
28228
28229 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28230 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28231 are defined then a default target processor is chosen and the
28232 relevant @samp{__v850*__} preprocessor constant is defined.
28233
28234 The preprocessor constants @code{__v850} and @code{__v851__} are always
28235 defined, regardless of which processor variant is the target.
28236
28237 @item -mdisable-callt
28238 @itemx -mno-disable-callt
28239 @opindex mdisable-callt
28240 @opindex mno-disable-callt
28241 This option suppresses generation of the @code{CALLT} instruction for the
28242 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28243 architecture.
28244
28245 This option is enabled by default when the RH850 ABI is
28246 in use (see @option{-mrh850-abi}), and disabled by default when the
28247 GCC ABI is in use. If @code{CALLT} instructions are being generated
28248 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28249
28250 @item -mrelax
28251 @itemx -mno-relax
28252 @opindex mrelax
28253 @opindex mno-relax
28254 Pass on (or do not pass on) the @option{-mrelax} command-line option
28255 to the assembler.
28256
28257 @item -mlong-jumps
28258 @itemx -mno-long-jumps
28259 @opindex mlong-jumps
28260 @opindex mno-long-jumps
28261 Disable (or re-enable) the generation of PC-relative jump instructions.
28262
28263 @item -msoft-float
28264 @itemx -mhard-float
28265 @opindex msoft-float
28266 @opindex mhard-float
28267 Disable (or re-enable) the generation of hardware floating point
28268 instructions. This option is only significant when the target
28269 architecture is @samp{V850E2V3} or higher. If hardware floating point
28270 instructions are being generated then the C preprocessor symbol
28271 @code{__FPU_OK__} is defined, otherwise the symbol
28272 @code{__NO_FPU__} is defined.
28273
28274 @item -mloop
28275 @opindex mloop
28276 Enables the use of the e3v5 LOOP instruction. The use of this
28277 instruction is not enabled by default when the e3v5 architecture is
28278 selected because its use is still experimental.
28279
28280 @item -mrh850-abi
28281 @itemx -mghs
28282 @opindex mrh850-abi
28283 @opindex mghs
28284 Enables support for the RH850 version of the V850 ABI. This is the
28285 default. With this version of the ABI the following rules apply:
28286
28287 @itemize
28288 @item
28289 Integer sized structures and unions are returned via a memory pointer
28290 rather than a register.
28291
28292 @item
28293 Large structures and unions (more than 8 bytes in size) are passed by
28294 value.
28295
28296 @item
28297 Functions are aligned to 16-bit boundaries.
28298
28299 @item
28300 The @option{-m8byte-align} command-line option is supported.
28301
28302 @item
28303 The @option{-mdisable-callt} command-line option is enabled by
28304 default. The @option{-mno-disable-callt} command-line option is not
28305 supported.
28306 @end itemize
28307
28308 When this version of the ABI is enabled the C preprocessor symbol
28309 @code{__V850_RH850_ABI__} is defined.
28310
28311 @item -mgcc-abi
28312 @opindex mgcc-abi
28313 Enables support for the old GCC version of the V850 ABI. With this
28314 version of the ABI the following rules apply:
28315
28316 @itemize
28317 @item
28318 Integer sized structures and unions are returned in register @code{r10}.
28319
28320 @item
28321 Large structures and unions (more than 8 bytes in size) are passed by
28322 reference.
28323
28324 @item
28325 Functions are aligned to 32-bit boundaries, unless optimizing for
28326 size.
28327
28328 @item
28329 The @option{-m8byte-align} command-line option is not supported.
28330
28331 @item
28332 The @option{-mdisable-callt} command-line option is supported but not
28333 enabled by default.
28334 @end itemize
28335
28336 When this version of the ABI is enabled the C preprocessor symbol
28337 @code{__V850_GCC_ABI__} is defined.
28338
28339 @item -m8byte-align
28340 @itemx -mno-8byte-align
28341 @opindex m8byte-align
28342 @opindex mno-8byte-align
28343 Enables support for @code{double} and @code{long long} types to be
28344 aligned on 8-byte boundaries. The default is to restrict the
28345 alignment of all objects to at most 4-bytes. When
28346 @option{-m8byte-align} is in effect the C preprocessor symbol
28347 @code{__V850_8BYTE_ALIGN__} is defined.
28348
28349 @item -mbig-switch
28350 @opindex mbig-switch
28351 Generate code suitable for big switch tables. Use this option only if
28352 the assembler/linker complain about out of range branches within a switch
28353 table.
28354
28355 @item -mapp-regs
28356 @opindex mapp-regs
28357 This option causes r2 and r5 to be used in the code generated by
28358 the compiler. This setting is the default.
28359
28360 @item -mno-app-regs
28361 @opindex mno-app-regs
28362 This option causes r2 and r5 to be treated as fixed registers.
28363
28364 @end table
28365
28366 @node VAX Options
28367 @subsection VAX Options
28368 @cindex VAX options
28369
28370 These @samp{-m} options are defined for the VAX:
28371
28372 @table @gcctabopt
28373 @item -munix
28374 @opindex munix
28375 Do not output certain jump instructions (@code{aobleq} and so on)
28376 that the Unix assembler for the VAX cannot handle across long
28377 ranges.
28378
28379 @item -mgnu
28380 @opindex mgnu
28381 Do output those jump instructions, on the assumption that the
28382 GNU assembler is being used.
28383
28384 @item -mg
28385 @opindex mg
28386 Output code for G-format floating-point numbers instead of D-format.
28387 @end table
28388
28389 @node Visium Options
28390 @subsection Visium Options
28391 @cindex Visium options
28392
28393 @table @gcctabopt
28394
28395 @item -mdebug
28396 @opindex mdebug
28397 A program which performs file I/O and is destined to run on an MCM target
28398 should be linked with this option. It causes the libraries libc.a and
28399 libdebug.a to be linked. The program should be run on the target under
28400 the control of the GDB remote debugging stub.
28401
28402 @item -msim
28403 @opindex msim
28404 A program which performs file I/O and is destined to run on the simulator
28405 should be linked with option. This causes libraries libc.a and libsim.a to
28406 be linked.
28407
28408 @item -mfpu
28409 @itemx -mhard-float
28410 @opindex mfpu
28411 @opindex mhard-float
28412 Generate code containing floating-point instructions. This is the
28413 default.
28414
28415 @item -mno-fpu
28416 @itemx -msoft-float
28417 @opindex mno-fpu
28418 @opindex msoft-float
28419 Generate code containing library calls for floating-point.
28420
28421 @option{-msoft-float} changes the calling convention in the output file;
28422 therefore, it is only useful if you compile @emph{all} of a program with
28423 this option. In particular, you need to compile @file{libgcc.a}, the
28424 library that comes with GCC, with @option{-msoft-float} in order for
28425 this to work.
28426
28427 @item -mcpu=@var{cpu_type}
28428 @opindex mcpu
28429 Set the instruction set, register set, and instruction scheduling parameters
28430 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
28431 @samp{mcm}, @samp{gr5} and @samp{gr6}.
28432
28433 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28434
28435 By default (unless configured otherwise), GCC generates code for the GR5
28436 variant of the Visium architecture.
28437
28438 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28439 architecture. The only difference from GR5 code is that the compiler will
28440 generate block move instructions.
28441
28442 @item -mtune=@var{cpu_type}
28443 @opindex mtune
28444 Set the instruction scheduling parameters for machine type @var{cpu_type},
28445 but do not set the instruction set or register set that the option
28446 @option{-mcpu=@var{cpu_type}} would.
28447
28448 @item -msv-mode
28449 @opindex msv-mode
28450 Generate code for the supervisor mode, where there are no restrictions on
28451 the access to general registers. This is the default.
28452
28453 @item -muser-mode
28454 @opindex muser-mode
28455 Generate code for the user mode, where the access to some general registers
28456 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28457 mode; on the GR6, only registers r29 to r31 are affected.
28458 @end table
28459
28460 @node VMS Options
28461 @subsection VMS Options
28462
28463 These @samp{-m} options are defined for the VMS implementations:
28464
28465 @table @gcctabopt
28466 @item -mvms-return-codes
28467 @opindex mvms-return-codes
28468 Return VMS condition codes from @code{main}. The default is to return POSIX-style
28469 condition (e.g.@: error) codes.
28470
28471 @item -mdebug-main=@var{prefix}
28472 @opindex mdebug-main=@var{prefix}
28473 Flag the first routine whose name starts with @var{prefix} as the main
28474 routine for the debugger.
28475
28476 @item -mmalloc64
28477 @opindex mmalloc64
28478 Default to 64-bit memory allocation routines.
28479
28480 @item -mpointer-size=@var{size}
28481 @opindex mpointer-size=@var{size}
28482 Set the default size of pointers. Possible options for @var{size} are
28483 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28484 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28485 The later option disables @code{pragma pointer_size}.
28486 @end table
28487
28488 @node VxWorks Options
28489 @subsection VxWorks Options
28490 @cindex VxWorks Options
28491
28492 The options in this section are defined for all VxWorks targets.
28493 Options specific to the target hardware are listed with the other
28494 options for that target.
28495
28496 @table @gcctabopt
28497 @item -mrtp
28498 @opindex mrtp
28499 GCC can generate code for both VxWorks kernels and real time processes
28500 (RTPs). This option switches from the former to the latter. It also
28501 defines the preprocessor macro @code{__RTP__}.
28502
28503 @item -non-static
28504 @opindex non-static
28505 Link an RTP executable against shared libraries rather than static
28506 libraries. The options @option{-static} and @option{-shared} can
28507 also be used for RTPs (@pxref{Link Options}); @option{-static}
28508 is the default.
28509
28510 @item -Bstatic
28511 @itemx -Bdynamic
28512 @opindex Bstatic
28513 @opindex Bdynamic
28514 These options are passed down to the linker. They are defined for
28515 compatibility with Diab.
28516
28517 @item -Xbind-lazy
28518 @opindex Xbind-lazy
28519 Enable lazy binding of function calls. This option is equivalent to
28520 @option{-Wl,-z,now} and is defined for compatibility with Diab.
28521
28522 @item -Xbind-now
28523 @opindex Xbind-now
28524 Disable lazy binding of function calls. This option is the default and
28525 is defined for compatibility with Diab.
28526 @end table
28527
28528 @node x86 Options
28529 @subsection x86 Options
28530 @cindex x86 Options
28531
28532 These @samp{-m} options are defined for the x86 family of computers.
28533
28534 @table @gcctabopt
28535
28536 @item -march=@var{cpu-type}
28537 @opindex march
28538 Generate instructions for the machine type @var{cpu-type}. In contrast to
28539 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
28540 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
28541 to generate code that may not run at all on processors other than the one
28542 indicated. Specifying @option{-march=@var{cpu-type}} implies
28543 @option{-mtune=@var{cpu-type}}.
28544
28545 The choices for @var{cpu-type} are:
28546
28547 @table @samp
28548 @item native
28549 This selects the CPU to generate code for at compilation time by determining
28550 the processor type of the compiling machine. Using @option{-march=native}
28551 enables all instruction subsets supported by the local machine (hence
28552 the result might not run on different machines). Using @option{-mtune=native}
28553 produces code optimized for the local machine under the constraints
28554 of the selected instruction set.
28555
28556 @item x86-64
28557 A generic CPU with 64-bit extensions.
28558
28559 @item i386
28560 Original Intel i386 CPU@.
28561
28562 @item i486
28563 Intel i486 CPU@. (No scheduling is implemented for this chip.)
28564
28565 @item i586
28566 @itemx pentium
28567 Intel Pentium CPU with no MMX support.
28568
28569 @item lakemont
28570 Intel Lakemont MCU, based on Intel Pentium CPU.
28571
28572 @item pentium-mmx
28573 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
28574
28575 @item pentiumpro
28576 Intel Pentium Pro CPU@.
28577
28578 @item i686
28579 When used with @option{-march}, the Pentium Pro
28580 instruction set is used, so the code runs on all i686 family chips.
28581 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
28582
28583 @item pentium2
28584 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
28585 support.
28586
28587 @item pentium3
28588 @itemx pentium3m
28589 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
28590 set support.
28591
28592 @item pentium-m
28593 Intel Pentium M; low-power version of Intel Pentium III CPU
28594 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
28595
28596 @item pentium4
28597 @itemx pentium4m
28598 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
28599
28600 @item prescott
28601 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
28602 set support.
28603
28604 @item nocona
28605 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
28606 SSE2 and SSE3 instruction set support.
28607
28608 @item core2
28609 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
28610 instruction set support.
28611
28612 @item nehalem
28613 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28614 SSE4.1, SSE4.2 and POPCNT instruction set support.
28615
28616 @item westmere
28617 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28618 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
28619
28620 @item sandybridge
28621 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28622 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
28623
28624 @item ivybridge
28625 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28626 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
28627 instruction set support.
28628
28629 @item haswell
28630 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28631 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28632 BMI, BMI2 and F16C instruction set support.
28633
28634 @item broadwell
28635 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28636 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28637 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
28638
28639 @item skylake
28640 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28641 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28642 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
28643 XSAVES instruction set support.
28644
28645 @item bonnell
28646 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
28647 instruction set support.
28648
28649 @item silvermont
28650 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28651 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
28652
28653 @item goldmont
28654 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28655 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
28656 instruction set support.
28657
28658 @item goldmont-plus
28659 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28660 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
28661 PTWRITE, RDPID, SGX and UMIP instruction set support.
28662
28663 @item tremont
28664 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28665 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
28666 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
28667
28668 @item knl
28669 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28670 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28671 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
28672 AVX512CD instruction set support.
28673
28674 @item knm
28675 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28676 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28677 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28678 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
28679
28680 @item skylake-avx512
28681 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28682 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28683 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28684 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
28685
28686 @item cannonlake
28687 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28688 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28689 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28690 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28691 AVX512IFMA, SHA and UMIP instruction set support.
28692
28693 @item icelake-client
28694 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28695 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28696 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28697 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28698 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28699 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
28700
28701 @item icelake-server
28702 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28703 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28704 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28705 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28706 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28707 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
28708 set support.
28709
28710 @item cascadelake
28711 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28712 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28713 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28714 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
28715
28716 @item cooperlake
28717 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28718 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28719 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28720 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
28721 set support.
28722
28723 @item tigerlake
28724 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28725 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28726 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28727 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
28728 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
28729 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
28730 set support.
28731
28732 @item k6
28733 AMD K6 CPU with MMX instruction set support.
28734
28735 @item k6-2
28736 @itemx k6-3
28737 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
28738
28739 @item athlon
28740 @itemx athlon-tbird
28741 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
28742 support.
28743
28744 @item athlon-4
28745 @itemx athlon-xp
28746 @itemx athlon-mp
28747 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
28748 instruction set support.
28749
28750 @item k8
28751 @itemx opteron
28752 @itemx athlon64
28753 @itemx athlon-fx
28754 Processors based on the AMD K8 core with x86-64 instruction set support,
28755 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
28756 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
28757 instruction set extensions.)
28758
28759 @item k8-sse3
28760 @itemx opteron-sse3
28761 @itemx athlon64-sse3
28762 Improved versions of AMD K8 cores with SSE3 instruction set support.
28763
28764 @item amdfam10
28765 @itemx barcelona
28766 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
28767 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
28768 instruction set extensions.)
28769
28770 @item bdver1
28771 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
28772 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
28773 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
28774
28775 @item bdver2
28776 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
28777 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
28778 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
28779 extensions.)
28780
28781 @item bdver3
28782 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
28783 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
28784 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
28785 64-bit instruction set extensions.)
28786
28787 @item bdver4
28788 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
28789 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
28790 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28791 SSE4.2, ABM and 64-bit instruction set extensions.)
28792
28793 @item znver1
28794 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28795 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
28796 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
28797 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
28798 instruction set extensions.)
28799
28800 @item znver2
28801 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28802 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28803 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28804 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28805 WBNOINVD, and 64-bit instruction set extensions.)
28806
28807 @item btver1
28808 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
28809 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
28810 instruction set extensions.)
28811
28812 @item btver2
28813 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
28814 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
28815 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
28816
28817 @item winchip-c6
28818 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
28819 set support.
28820
28821 @item winchip2
28822 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
28823 instruction set support.
28824
28825 @item c3
28826 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
28827 (No scheduling is implemented for this chip.)
28828
28829 @item c3-2
28830 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
28831 (No scheduling is implemented for this chip.)
28832
28833 @item c7
28834 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28835 (No scheduling is implemented for this chip.)
28836
28837 @item samuel-2
28838 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
28839 (No scheduling is implemented for this chip.)
28840
28841 @item nehemiah
28842 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28843 (No scheduling is implemented for this chip.)
28844
28845 @item esther
28846 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28847 (No scheduling is implemented for this chip.)
28848
28849 @item eden-x2
28850 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
28851 (No scheduling is implemented for this chip.)
28852
28853 @item eden-x4
28854 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
28855 AVX and AVX2 instruction set support.
28856 (No scheduling is implemented for this chip.)
28857
28858 @item nano
28859 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28860 instruction set support.
28861 (No scheduling is implemented for this chip.)
28862
28863 @item nano-1000
28864 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28865 instruction set support.
28866 (No scheduling is implemented for this chip.)
28867
28868 @item nano-2000
28869 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28870 instruction set support.
28871 (No scheduling is implemented for this chip.)
28872
28873 @item nano-3000
28874 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28875 instruction set support.
28876 (No scheduling is implemented for this chip.)
28877
28878 @item nano-x2
28879 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28880 instruction set support.
28881 (No scheduling is implemented for this chip.)
28882
28883 @item nano-x4
28884 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28885 instruction set support.
28886 (No scheduling is implemented for this chip.)
28887
28888 @item geode
28889 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
28890 @end table
28891
28892 @item -mtune=@var{cpu-type}
28893 @opindex mtune
28894 Tune to @var{cpu-type} everything applicable about the generated code, except
28895 for the ABI and the set of available instructions.
28896 While picking a specific @var{cpu-type} schedules things appropriately
28897 for that particular chip, the compiler does not generate any code that
28898 cannot run on the default machine type unless you use a
28899 @option{-march=@var{cpu-type}} option.
28900 For example, if GCC is configured for i686-pc-linux-gnu
28901 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
28902 but still runs on i686 machines.
28903
28904 The choices for @var{cpu-type} are the same as for @option{-march}.
28905 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
28906
28907 @table @samp
28908 @item generic
28909 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
28910 If you know the CPU on which your code will run, then you should use
28911 the corresponding @option{-mtune} or @option{-march} option instead of
28912 @option{-mtune=generic}. But, if you do not know exactly what CPU users
28913 of your application will have, then you should use this option.
28914
28915 As new processors are deployed in the marketplace, the behavior of this
28916 option will change. Therefore, if you upgrade to a newer version of
28917 GCC, code generation controlled by this option will change to reflect
28918 the processors
28919 that are most common at the time that version of GCC is released.
28920
28921 There is no @option{-march=generic} option because @option{-march}
28922 indicates the instruction set the compiler can use, and there is no
28923 generic instruction set applicable to all processors. In contrast,
28924 @option{-mtune} indicates the processor (or, in this case, collection of
28925 processors) for which the code is optimized.
28926
28927 @item intel
28928 Produce code optimized for the most current Intel processors, which are
28929 Haswell and Silvermont for this version of GCC. If you know the CPU
28930 on which your code will run, then you should use the corresponding
28931 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
28932 But, if you want your application performs better on both Haswell and
28933 Silvermont, then you should use this option.
28934
28935 As new Intel processors are deployed in the marketplace, the behavior of
28936 this option will change. Therefore, if you upgrade to a newer version of
28937 GCC, code generation controlled by this option will change to reflect
28938 the most current Intel processors at the time that version of GCC is
28939 released.
28940
28941 There is no @option{-march=intel} option because @option{-march} indicates
28942 the instruction set the compiler can use, and there is no common
28943 instruction set applicable to all processors. In contrast,
28944 @option{-mtune} indicates the processor (or, in this case, collection of
28945 processors) for which the code is optimized.
28946 @end table
28947
28948 @item -mcpu=@var{cpu-type}
28949 @opindex mcpu
28950 A deprecated synonym for @option{-mtune}.
28951
28952 @item -mfpmath=@var{unit}
28953 @opindex mfpmath
28954 Generate floating-point arithmetic for selected unit @var{unit}. The choices
28955 for @var{unit} are:
28956
28957 @table @samp
28958 @item 387
28959 Use the standard 387 floating-point coprocessor present on the majority of chips and
28960 emulated otherwise. Code compiled with this option runs almost everywhere.
28961 The temporary results are computed in 80-bit precision instead of the precision
28962 specified by the type, resulting in slightly different results compared to most
28963 of other chips. See @option{-ffloat-store} for more detailed description.
28964
28965 This is the default choice for non-Darwin x86-32 targets.
28966
28967 @item sse
28968 Use scalar floating-point instructions present in the SSE instruction set.
28969 This instruction set is supported by Pentium III and newer chips,
28970 and in the AMD line
28971 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
28972 instruction set supports only single-precision arithmetic, thus the double and
28973 extended-precision arithmetic are still done using 387. A later version, present
28974 only in Pentium 4 and AMD x86-64 chips, supports double-precision
28975 arithmetic too.
28976
28977 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
28978 or @option{-msse2} switches to enable SSE extensions and make this option
28979 effective. For the x86-64 compiler, these extensions are enabled by default.
28980
28981 The resulting code should be considerably faster in the majority of cases and avoid
28982 the numerical instability problems of 387 code, but may break some existing
28983 code that expects temporaries to be 80 bits.
28984
28985 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
28986 and the default choice for x86-32 targets with the SSE2 instruction set
28987 when @option{-ffast-math} is enabled.
28988
28989 @item sse,387
28990 @itemx sse+387
28991 @itemx both
28992 Attempt to utilize both instruction sets at once. This effectively doubles the
28993 amount of available registers, and on chips with separate execution units for
28994 387 and SSE the execution resources too. Use this option with care, as it is
28995 still experimental, because the GCC register allocator does not model separate
28996 functional units well, resulting in unstable performance.
28997 @end table
28998
28999 @item -masm=@var{dialect}
29000 @opindex masm=@var{dialect}
29001 Output assembly instructions using selected @var{dialect}. Also affects
29002 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
29003 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
29004 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
29005 not support @samp{intel}.
29006
29007 @item -mieee-fp
29008 @itemx -mno-ieee-fp
29009 @opindex mieee-fp
29010 @opindex mno-ieee-fp
29011 Control whether or not the compiler uses IEEE floating-point
29012 comparisons. These correctly handle the case where the result of a
29013 comparison is unordered.
29014
29015 @item -m80387
29016 @itemx -mhard-float
29017 @opindex 80387
29018 @opindex mhard-float
29019 Generate output containing 80387 instructions for floating point.
29020
29021 @item -mno-80387
29022 @itemx -msoft-float
29023 @opindex no-80387
29024 @opindex msoft-float
29025 Generate output containing library calls for floating point.
29026
29027 @strong{Warning:} the requisite libraries are not part of GCC@.
29028 Normally the facilities of the machine's usual C compiler are used, but
29029 this cannot be done directly in cross-compilation. You must make your
29030 own arrangements to provide suitable library functions for
29031 cross-compilation.
29032
29033 On machines where a function returns floating-point results in the 80387
29034 register stack, some floating-point opcodes may be emitted even if
29035 @option{-msoft-float} is used.
29036
29037 @item -mno-fp-ret-in-387
29038 @opindex mno-fp-ret-in-387
29039 @opindex mfp-ret-in-387
29040 Do not use the FPU registers for return values of functions.
29041
29042 The usual calling convention has functions return values of types
29043 @code{float} and @code{double} in an FPU register, even if there
29044 is no FPU@. The idea is that the operating system should emulate
29045 an FPU@.
29046
29047 The option @option{-mno-fp-ret-in-387} causes such values to be returned
29048 in ordinary CPU registers instead.
29049
29050 @item -mno-fancy-math-387
29051 @opindex mno-fancy-math-387
29052 @opindex mfancy-math-387
29053 Some 387 emulators do not support the @code{sin}, @code{cos} and
29054 @code{sqrt} instructions for the 387. Specify this option to avoid
29055 generating those instructions.
29056 This option is overridden when @option{-march}
29057 indicates that the target CPU always has an FPU and so the
29058 instruction does not need emulation. These
29059 instructions are not generated unless you also use the
29060 @option{-funsafe-math-optimizations} switch.
29061
29062 @item -malign-double
29063 @itemx -mno-align-double
29064 @opindex malign-double
29065 @opindex mno-align-double
29066 Control whether GCC aligns @code{double}, @code{long double}, and
29067 @code{long long} variables on a two-word boundary or a one-word
29068 boundary. Aligning @code{double} variables on a two-word boundary
29069 produces code that runs somewhat faster on a Pentium at the
29070 expense of more memory.
29071
29072 On x86-64, @option{-malign-double} is enabled by default.
29073
29074 @strong{Warning:} if you use the @option{-malign-double} switch,
29075 structures containing the above types are aligned differently than
29076 the published application binary interface specifications for the x86-32
29077 and are not binary compatible with structures in code compiled
29078 without that switch.
29079
29080 @item -m96bit-long-double
29081 @itemx -m128bit-long-double
29082 @opindex m96bit-long-double
29083 @opindex m128bit-long-double
29084 These switches control the size of @code{long double} type. The x86-32
29085 application binary interface specifies the size to be 96 bits,
29086 so @option{-m96bit-long-double} is the default in 32-bit mode.
29087
29088 Modern architectures (Pentium and newer) prefer @code{long double}
29089 to be aligned to an 8- or 16-byte boundary. In arrays or structures
29090 conforming to the ABI, this is not possible. So specifying
29091 @option{-m128bit-long-double} aligns @code{long double}
29092 to a 16-byte boundary by padding the @code{long double} with an additional
29093 32-bit zero.
29094
29095 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
29096 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
29097
29098 Notice that neither of these options enable any extra precision over the x87
29099 standard of 80 bits for a @code{long double}.
29100
29101 @strong{Warning:} if you override the default value for your target ABI, this
29102 changes the size of
29103 structures and arrays containing @code{long double} variables,
29104 as well as modifying the function calling convention for functions taking
29105 @code{long double}. Hence they are not binary-compatible
29106 with code compiled without that switch.
29107
29108 @item -mlong-double-64
29109 @itemx -mlong-double-80
29110 @itemx -mlong-double-128
29111 @opindex mlong-double-64
29112 @opindex mlong-double-80
29113 @opindex mlong-double-128
29114 These switches control the size of @code{long double} type. A size
29115 of 64 bits makes the @code{long double} type equivalent to the @code{double}
29116 type. This is the default for 32-bit Bionic C library. A size
29117 of 128 bits makes the @code{long double} type equivalent to the
29118 @code{__float128} type. This is the default for 64-bit Bionic C library.
29119
29120 @strong{Warning:} if you override the default value for your target ABI, this
29121 changes the size of
29122 structures and arrays containing @code{long double} variables,
29123 as well as modifying the function calling convention for functions taking
29124 @code{long double}. Hence they are not binary-compatible
29125 with code compiled without that switch.
29126
29127 @item -malign-data=@var{type}
29128 @opindex malign-data
29129 Control how GCC aligns variables. Supported values for @var{type} are
29130 @samp{compat} uses increased alignment value compatible uses GCC 4.8
29131 and earlier, @samp{abi} uses alignment value as specified by the
29132 psABI, and @samp{cacheline} uses increased alignment value to match
29133 the cache line size. @samp{compat} is the default.
29134
29135 @item -mlarge-data-threshold=@var{threshold}
29136 @opindex mlarge-data-threshold
29137 When @option{-mcmodel=medium} is specified, data objects larger than
29138 @var{threshold} are placed in the large data section. This value must be the
29139 same across all objects linked into the binary, and defaults to 65535.
29140
29141 @item -mrtd
29142 @opindex mrtd
29143 Use a different function-calling convention, in which functions that
29144 take a fixed number of arguments return with the @code{ret @var{num}}
29145 instruction, which pops their arguments while returning. This saves one
29146 instruction in the caller since there is no need to pop the arguments
29147 there.
29148
29149 You can specify that an individual function is called with this calling
29150 sequence with the function attribute @code{stdcall}. You can also
29151 override the @option{-mrtd} option by using the function attribute
29152 @code{cdecl}. @xref{Function Attributes}.
29153
29154 @strong{Warning:} this calling convention is incompatible with the one
29155 normally used on Unix, so you cannot use it if you need to call
29156 libraries compiled with the Unix compiler.
29157
29158 Also, you must provide function prototypes for all functions that
29159 take variable numbers of arguments (including @code{printf});
29160 otherwise incorrect code is generated for calls to those
29161 functions.
29162
29163 In addition, seriously incorrect code results if you call a
29164 function with too many arguments. (Normally, extra arguments are
29165 harmlessly ignored.)
29166
29167 @item -mregparm=@var{num}
29168 @opindex mregparm
29169 Control how many registers are used to pass integer arguments. By
29170 default, no registers are used to pass arguments, and at most 3
29171 registers can be used. You can control this behavior for a specific
29172 function by using the function attribute @code{regparm}.
29173 @xref{Function Attributes}.
29174
29175 @strong{Warning:} if you use this switch, and
29176 @var{num} is nonzero, then you must build all modules with the same
29177 value, including any libraries. This includes the system libraries and
29178 startup modules.
29179
29180 @item -msseregparm
29181 @opindex msseregparm
29182 Use SSE register passing conventions for float and double arguments
29183 and return values. You can control this behavior for a specific
29184 function by using the function attribute @code{sseregparm}.
29185 @xref{Function Attributes}.
29186
29187 @strong{Warning:} if you use this switch then you must build all
29188 modules with the same value, including any libraries. This includes
29189 the system libraries and startup modules.
29190
29191 @item -mvect8-ret-in-mem
29192 @opindex mvect8-ret-in-mem
29193 Return 8-byte vectors in memory instead of MMX registers. This is the
29194 default on VxWorks to match the ABI of the Sun Studio compilers until
29195 version 12. @emph{Only} use this option if you need to remain
29196 compatible with existing code produced by those previous compiler
29197 versions or older versions of GCC@.
29198
29199 @item -mpc32
29200 @itemx -mpc64
29201 @itemx -mpc80
29202 @opindex mpc32
29203 @opindex mpc64
29204 @opindex mpc80
29205
29206 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
29207 is specified, the significands of results of floating-point operations are
29208 rounded to 24 bits (single precision); @option{-mpc64} rounds the
29209 significands of results of floating-point operations to 53 bits (double
29210 precision) and @option{-mpc80} rounds the significands of results of
29211 floating-point operations to 64 bits (extended double precision), which is
29212 the default. When this option is used, floating-point operations in higher
29213 precisions are not available to the programmer without setting the FPU
29214 control word explicitly.
29215
29216 Setting the rounding of floating-point operations to less than the default
29217 80 bits can speed some programs by 2% or more. Note that some mathematical
29218 libraries assume that extended-precision (80-bit) floating-point operations
29219 are enabled by default; routines in such libraries could suffer significant
29220 loss of accuracy, typically through so-called ``catastrophic cancellation'',
29221 when this option is used to set the precision to less than extended precision.
29222
29223 @item -mstackrealign
29224 @opindex mstackrealign
29225 Realign the stack at entry. On the x86, the @option{-mstackrealign}
29226 option generates an alternate prologue and epilogue that realigns the
29227 run-time stack if necessary. This supports mixing legacy codes that keep
29228 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
29229 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
29230 applicable to individual functions.
29231
29232 @item -mpreferred-stack-boundary=@var{num}
29233 @opindex mpreferred-stack-boundary
29234 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29235 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
29236 the default is 4 (16 bytes or 128 bits).
29237
29238 @strong{Warning:} When generating code for the x86-64 architecture with
29239 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29240 used to keep the stack boundary aligned to 8 byte boundary. Since
29241 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29242 intended to be used in controlled environment where stack space is
29243 important limitation. This option leads to wrong code when functions
29244 compiled with 16 byte stack alignment (such as functions from a standard
29245 library) are called with misaligned stack. In this case, SSE
29246 instructions may lead to misaligned memory access traps. In addition,
29247 variable arguments are handled incorrectly for 16 byte aligned
29248 objects (including x87 long double and __int128), leading to wrong
29249 results. You must build all modules with
29250 @option{-mpreferred-stack-boundary=3}, including any libraries. This
29251 includes the system libraries and startup modules.
29252
29253 @item -mincoming-stack-boundary=@var{num}
29254 @opindex mincoming-stack-boundary
29255 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29256 boundary. If @option{-mincoming-stack-boundary} is not specified,
29257 the one specified by @option{-mpreferred-stack-boundary} is used.
29258
29259 On Pentium and Pentium Pro, @code{double} and @code{long double} values
29260 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29261 suffer significant run time performance penalties. On Pentium III, the
29262 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29263 properly if it is not 16-byte aligned.
29264
29265 To ensure proper alignment of this values on the stack, the stack boundary
29266 must be as aligned as that required by any value stored on the stack.
29267 Further, every function must be generated such that it keeps the stack
29268 aligned. Thus calling a function compiled with a higher preferred
29269 stack boundary from a function compiled with a lower preferred stack
29270 boundary most likely misaligns the stack. It is recommended that
29271 libraries that use callbacks always use the default setting.
29272
29273 This extra alignment does consume extra stack space, and generally
29274 increases code size. Code that is sensitive to stack space usage, such
29275 as embedded systems and operating system kernels, may want to reduce the
29276 preferred alignment to @option{-mpreferred-stack-boundary=2}.
29277
29278 @need 200
29279 @item -mmmx
29280 @opindex mmmx
29281 @need 200
29282 @itemx -msse
29283 @opindex msse
29284 @need 200
29285 @itemx -msse2
29286 @opindex msse2
29287 @need 200
29288 @itemx -msse3
29289 @opindex msse3
29290 @need 200
29291 @itemx -mssse3
29292 @opindex mssse3
29293 @need 200
29294 @itemx -msse4
29295 @opindex msse4
29296 @need 200
29297 @itemx -msse4a
29298 @opindex msse4a
29299 @need 200
29300 @itemx -msse4.1
29301 @opindex msse4.1
29302 @need 200
29303 @itemx -msse4.2
29304 @opindex msse4.2
29305 @need 200
29306 @itemx -mavx
29307 @opindex mavx
29308 @need 200
29309 @itemx -mavx2
29310 @opindex mavx2
29311 @need 200
29312 @itemx -mavx512f
29313 @opindex mavx512f
29314 @need 200
29315 @itemx -mavx512pf
29316 @opindex mavx512pf
29317 @need 200
29318 @itemx -mavx512er
29319 @opindex mavx512er
29320 @need 200
29321 @itemx -mavx512cd
29322 @opindex mavx512cd
29323 @need 200
29324 @itemx -mavx512vl
29325 @opindex mavx512vl
29326 @need 200
29327 @itemx -mavx512bw
29328 @opindex mavx512bw
29329 @need 200
29330 @itemx -mavx512dq
29331 @opindex mavx512dq
29332 @need 200
29333 @itemx -mavx512ifma
29334 @opindex mavx512ifma
29335 @need 200
29336 @itemx -mavx512vbmi
29337 @opindex mavx512vbmi
29338 @need 200
29339 @itemx -msha
29340 @opindex msha
29341 @need 200
29342 @itemx -maes
29343 @opindex maes
29344 @need 200
29345 @itemx -mpclmul
29346 @opindex mpclmul
29347 @need 200
29348 @itemx -mclflushopt
29349 @opindex mclflushopt
29350 @need 200
29351 @itemx -mclwb
29352 @opindex mclwb
29353 @need 200
29354 @itemx -mfsgsbase
29355 @opindex mfsgsbase
29356 @need 200
29357 @itemx -mptwrite
29358 @opindex mptwrite
29359 @need 200
29360 @itemx -mrdrnd
29361 @opindex mrdrnd
29362 @need 200
29363 @itemx -mf16c
29364 @opindex mf16c
29365 @need 200
29366 @itemx -mfma
29367 @opindex mfma
29368 @need 200
29369 @itemx -mpconfig
29370 @opindex mpconfig
29371 @need 200
29372 @itemx -mwbnoinvd
29373 @opindex mwbnoinvd
29374 @need 200
29375 @itemx -mfma4
29376 @opindex mfma4
29377 @need 200
29378 @itemx -mprfchw
29379 @opindex mprfchw
29380 @need 200
29381 @itemx -mrdpid
29382 @opindex mrdpid
29383 @need 200
29384 @itemx -mprefetchwt1
29385 @opindex mprefetchwt1
29386 @need 200
29387 @itemx -mrdseed
29388 @opindex mrdseed
29389 @need 200
29390 @itemx -msgx
29391 @opindex msgx
29392 @need 200
29393 @itemx -mxop
29394 @opindex mxop
29395 @need 200
29396 @itemx -mlwp
29397 @opindex mlwp
29398 @need 200
29399 @itemx -m3dnow
29400 @opindex m3dnow
29401 @need 200
29402 @itemx -m3dnowa
29403 @opindex m3dnowa
29404 @need 200
29405 @itemx -mpopcnt
29406 @opindex mpopcnt
29407 @need 200
29408 @itemx -mabm
29409 @opindex mabm
29410 @need 200
29411 @itemx -madx
29412 @opindex madx
29413 @need 200
29414 @itemx -mbmi
29415 @opindex mbmi
29416 @need 200
29417 @itemx -mbmi2
29418 @opindex mbmi2
29419 @need 200
29420 @itemx -mlzcnt
29421 @opindex mlzcnt
29422 @need 200
29423 @itemx -mfxsr
29424 @opindex mfxsr
29425 @need 200
29426 @itemx -mxsave
29427 @opindex mxsave
29428 @need 200
29429 @itemx -mxsaveopt
29430 @opindex mxsaveopt
29431 @need 200
29432 @itemx -mxsavec
29433 @opindex mxsavec
29434 @need 200
29435 @itemx -mxsaves
29436 @opindex mxsaves
29437 @need 200
29438 @itemx -mrtm
29439 @opindex mrtm
29440 @need 200
29441 @itemx -mhle
29442 @opindex mhle
29443 @need 200
29444 @itemx -mtbm
29445 @opindex mtbm
29446 @need 200
29447 @itemx -mmwaitx
29448 @opindex mmwaitx
29449 @need 200
29450 @itemx -mclzero
29451 @opindex mclzero
29452 @need 200
29453 @itemx -mpku
29454 @opindex mpku
29455 @need 200
29456 @itemx -mavx512vbmi2
29457 @opindex mavx512vbmi2
29458 @need 200
29459 @itemx -mavx512bf16
29460 @opindex mavx512bf16
29461 @need 200
29462 @itemx -mgfni
29463 @opindex mgfni
29464 @need 200
29465 @itemx -mvaes
29466 @opindex mvaes
29467 @need 200
29468 @itemx -mwaitpkg
29469 @opindex mwaitpkg
29470 @need 200
29471 @itemx -mvpclmulqdq
29472 @opindex mvpclmulqdq
29473 @need 200
29474 @itemx -mavx512bitalg
29475 @opindex mavx512bitalg
29476 @need 200
29477 @itemx -mmovdiri
29478 @opindex mmovdiri
29479 @need 200
29480 @itemx -mmovdir64b
29481 @opindex mmovdir64b
29482 @need 200
29483 @itemx -menqcmd
29484 @opindex menqcmd
29485 @need 200
29486 @itemx -mtsxldtrk
29487 @opindex mtsxldtrk
29488 @need 200
29489 @itemx -mavx512vpopcntdq
29490 @opindex mavx512vpopcntdq
29491 @need 200
29492 @itemx -mavx512vp2intersect
29493 @opindex mavx512vp2intersect
29494 @need 200
29495 @itemx -mavx5124fmaps
29496 @opindex mavx5124fmaps
29497 @need 200
29498 @itemx -mavx512vnni
29499 @opindex mavx512vnni
29500 @need 200
29501 @itemx -mavx5124vnniw
29502 @opindex mavx5124vnniw
29503 @need 200
29504 @itemx -mcldemote
29505 @opindex mcldemote
29506 @need 200
29507 @itemx -mserialize
29508 @opindex mserialize
29509 These switches enable the use of instructions in the MMX, SSE,
29510 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
29511 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
29512 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
29513 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
29514 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
29515 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
29516 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
29517 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE
29518 or CLDEMOTE extended instruction sets. Each has a corresponding
29519 @option{-mno-} option to disable use of these instructions.
29520
29521 These extensions are also available as built-in functions: see
29522 @ref{x86 Built-in Functions}, for details of the functions enabled and
29523 disabled by these switches.
29524
29525 To generate SSE/SSE2 instructions automatically from floating-point
29526 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
29527
29528 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
29529 generates new AVX instructions or AVX equivalence for all SSEx instructions
29530 when needed.
29531
29532 These options enable GCC to use these extended instructions in
29533 generated code, even without @option{-mfpmath=sse}. Applications that
29534 perform run-time CPU detection must compile separate files for each
29535 supported architecture, using the appropriate flags. In particular,
29536 the file containing the CPU detection code should be compiled without
29537 these options.
29538
29539 @item -mdump-tune-features
29540 @opindex mdump-tune-features
29541 This option instructs GCC to dump the names of the x86 performance
29542 tuning features and default settings. The names can be used in
29543 @option{-mtune-ctrl=@var{feature-list}}.
29544
29545 @item -mtune-ctrl=@var{feature-list}
29546 @opindex mtune-ctrl=@var{feature-list}
29547 This option is used to do fine grain control of x86 code generation features.
29548 @var{feature-list} is a comma separated list of @var{feature} names. See also
29549 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
29550 on if it is not preceded with @samp{^}, otherwise, it is turned off.
29551 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
29552 developers. Using it may lead to code paths not covered by testing and can
29553 potentially result in compiler ICEs or runtime errors.
29554
29555 @item -mno-default
29556 @opindex mno-default
29557 This option instructs GCC to turn off all tunable features. See also
29558 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
29559
29560 @item -mcld
29561 @opindex mcld
29562 This option instructs GCC to emit a @code{cld} instruction in the prologue
29563 of functions that use string instructions. String instructions depend on
29564 the DF flag to select between autoincrement or autodecrement mode. While the
29565 ABI specifies the DF flag to be cleared on function entry, some operating
29566 systems violate this specification by not clearing the DF flag in their
29567 exception dispatchers. The exception handler can be invoked with the DF flag
29568 set, which leads to wrong direction mode when string instructions are used.
29569 This option can be enabled by default on 32-bit x86 targets by configuring
29570 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
29571 instructions can be suppressed with the @option{-mno-cld} compiler option
29572 in this case.
29573
29574 @item -mvzeroupper
29575 @opindex mvzeroupper
29576 This option instructs GCC to emit a @code{vzeroupper} instruction
29577 before a transfer of control flow out of the function to minimize
29578 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
29579 intrinsics.
29580
29581 @item -mprefer-avx128
29582 @opindex mprefer-avx128
29583 This option instructs GCC to use 128-bit AVX instructions instead of
29584 256-bit AVX instructions in the auto-vectorizer.
29585
29586 @item -mprefer-vector-width=@var{opt}
29587 @opindex mprefer-vector-width
29588 This option instructs GCC to use @var{opt}-bit vector width in instructions
29589 instead of default on the selected platform.
29590
29591 @table @samp
29592 @item none
29593 No extra limitations applied to GCC other than defined by the selected platform.
29594
29595 @item 128
29596 Prefer 128-bit vector width for instructions.
29597
29598 @item 256
29599 Prefer 256-bit vector width for instructions.
29600
29601 @item 512
29602 Prefer 512-bit vector width for instructions.
29603 @end table
29604
29605 @item -mcx16
29606 @opindex mcx16
29607 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
29608 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
29609 objects. This is useful for atomic updates of data structures exceeding one
29610 machine word in size. The compiler uses this instruction to implement
29611 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
29612 128-bit integers, a library call is always used.
29613
29614 @item -msahf
29615 @opindex msahf
29616 This option enables generation of @code{SAHF} instructions in 64-bit code.
29617 Early Intel Pentium 4 CPUs with Intel 64 support,
29618 prior to the introduction of Pentium 4 G1 step in December 2005,
29619 lacked the @code{LAHF} and @code{SAHF} instructions
29620 which are supported by AMD64.
29621 These are load and store instructions, respectively, for certain status flags.
29622 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
29623 @code{drem}, and @code{remainder} built-in functions;
29624 see @ref{Other Builtins} for details.
29625
29626 @item -mmovbe
29627 @opindex mmovbe
29628 This option enables use of the @code{movbe} instruction to implement
29629 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
29630
29631 @item -mshstk
29632 @opindex mshstk
29633 The @option{-mshstk} option enables shadow stack built-in functions
29634 from x86 Control-flow Enforcement Technology (CET).
29635
29636 @item -mcrc32
29637 @opindex mcrc32
29638 This option enables built-in functions @code{__builtin_ia32_crc32qi},
29639 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
29640 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
29641
29642 @item -mrecip
29643 @opindex mrecip
29644 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
29645 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
29646 with an additional Newton-Raphson step
29647 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
29648 (and their vectorized
29649 variants) for single-precision floating-point arguments. These instructions
29650 are generated only when @option{-funsafe-math-optimizations} is enabled
29651 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
29652 Note that while the throughput of the sequence is higher than the throughput
29653 of the non-reciprocal instruction, the precision of the sequence can be
29654 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
29655
29656 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
29657 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
29658 combination), and doesn't need @option{-mrecip}.
29659
29660 Also note that GCC emits the above sequence with additional Newton-Raphson step
29661 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
29662 already with @option{-ffast-math} (or the above option combination), and
29663 doesn't need @option{-mrecip}.
29664
29665 @item -mrecip=@var{opt}
29666 @opindex mrecip=opt
29667 This option controls which reciprocal estimate instructions
29668 may be used. @var{opt} is a comma-separated list of options, which may
29669 be preceded by a @samp{!} to invert the option:
29670
29671 @table @samp
29672 @item all
29673 Enable all estimate instructions.
29674
29675 @item default
29676 Enable the default instructions, equivalent to @option{-mrecip}.
29677
29678 @item none
29679 Disable all estimate instructions, equivalent to @option{-mno-recip}.
29680
29681 @item div
29682 Enable the approximation for scalar division.
29683
29684 @item vec-div
29685 Enable the approximation for vectorized division.
29686
29687 @item sqrt
29688 Enable the approximation for scalar square root.
29689
29690 @item vec-sqrt
29691 Enable the approximation for vectorized square root.
29692 @end table
29693
29694 So, for example, @option{-mrecip=all,!sqrt} enables
29695 all of the reciprocal approximations, except for square root.
29696
29697 @item -mveclibabi=@var{type}
29698 @opindex mveclibabi
29699 Specifies the ABI type to use for vectorizing intrinsics using an
29700 external library. Supported values for @var{type} are @samp{svml}
29701 for the Intel short
29702 vector math library and @samp{acml} for the AMD math core library.
29703 To use this option, both @option{-ftree-vectorize} and
29704 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
29705 ABI-compatible library must be specified at link time.
29706
29707 GCC currently emits calls to @code{vmldExp2},
29708 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
29709 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
29710 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
29711 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
29712 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
29713 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
29714 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
29715 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
29716 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
29717 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
29718 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
29719 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
29720 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
29721 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
29722 when @option{-mveclibabi=acml} is used.
29723
29724 @item -mabi=@var{name}
29725 @opindex mabi
29726 Generate code for the specified calling convention. Permissible values
29727 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
29728 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
29729 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
29730 You can control this behavior for specific functions by
29731 using the function attributes @code{ms_abi} and @code{sysv_abi}.
29732 @xref{Function Attributes}.
29733
29734 @item -mforce-indirect-call
29735 @opindex mforce-indirect-call
29736 Force all calls to functions to be indirect. This is useful
29737 when using Intel Processor Trace where it generates more precise timing
29738 information for function calls.
29739
29740 @item -mmanual-endbr
29741 @opindex mmanual-endbr
29742 Insert ENDBR instruction at function entry only via the @code{cf_check}
29743 function attribute. This is useful when used with the option
29744 @option{-fcf-protection=branch} to control ENDBR insertion at the
29745 function entry.
29746
29747 @item -mcall-ms2sysv-xlogues
29748 @opindex mcall-ms2sysv-xlogues
29749 @opindex mno-call-ms2sysv-xlogues
29750 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
29751 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
29752 default, the code for saving and restoring these registers is emitted inline,
29753 resulting in fairly lengthy prologues and epilogues. Using
29754 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
29755 use stubs in the static portion of libgcc to perform these saves and restores,
29756 thus reducing function size at the cost of a few extra instructions.
29757
29758 @item -mtls-dialect=@var{type}
29759 @opindex mtls-dialect
29760 Generate code to access thread-local storage using the @samp{gnu} or
29761 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
29762 @samp{gnu2} is more efficient, but it may add compile- and run-time
29763 requirements that cannot be satisfied on all systems.
29764
29765 @item -mpush-args
29766 @itemx -mno-push-args
29767 @opindex mpush-args
29768 @opindex mno-push-args
29769 Use PUSH operations to store outgoing parameters. This method is shorter
29770 and usually equally fast as method using SUB/MOV operations and is enabled
29771 by default. In some cases disabling it may improve performance because of
29772 improved scheduling and reduced dependencies.
29773
29774 @item -maccumulate-outgoing-args
29775 @opindex maccumulate-outgoing-args
29776 If enabled, the maximum amount of space required for outgoing arguments is
29777 computed in the function prologue. This is faster on most modern CPUs
29778 because of reduced dependencies, improved scheduling and reduced stack usage
29779 when the preferred stack boundary is not equal to 2. The drawback is a notable
29780 increase in code size. This switch implies @option{-mno-push-args}.
29781
29782 @item -mthreads
29783 @opindex mthreads
29784 Support thread-safe exception handling on MinGW. Programs that rely
29785 on thread-safe exception handling must compile and link all code with the
29786 @option{-mthreads} option. When compiling, @option{-mthreads} defines
29787 @option{-D_MT}; when linking, it links in a special thread helper library
29788 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
29789
29790 @item -mms-bitfields
29791 @itemx -mno-ms-bitfields
29792 @opindex mms-bitfields
29793 @opindex mno-ms-bitfields
29794
29795 Enable/disable bit-field layout compatible with the native Microsoft
29796 Windows compiler.
29797
29798 If @code{packed} is used on a structure, or if bit-fields are used,
29799 it may be that the Microsoft ABI lays out the structure differently
29800 than the way GCC normally does. Particularly when moving packed
29801 data between functions compiled with GCC and the native Microsoft compiler
29802 (either via function call or as data in a file), it may be necessary to access
29803 either format.
29804
29805 This option is enabled by default for Microsoft Windows
29806 targets. This behavior can also be controlled locally by use of variable
29807 or type attributes. For more information, see @ref{x86 Variable Attributes}
29808 and @ref{x86 Type Attributes}.
29809
29810 The Microsoft structure layout algorithm is fairly simple with the exception
29811 of the bit-field packing.
29812 The padding and alignment of members of structures and whether a bit-field
29813 can straddle a storage-unit boundary are determine by these rules:
29814
29815 @enumerate
29816 @item Structure members are stored sequentially in the order in which they are
29817 declared: the first member has the lowest memory address and the last member
29818 the highest.
29819
29820 @item Every data object has an alignment requirement. The alignment requirement
29821 for all data except structures, unions, and arrays is either the size of the
29822 object or the current packing size (specified with either the
29823 @code{aligned} attribute or the @code{pack} pragma),
29824 whichever is less. For structures, unions, and arrays,
29825 the alignment requirement is the largest alignment requirement of its members.
29826 Every object is allocated an offset so that:
29827
29828 @smallexample
29829 offset % alignment_requirement == 0
29830 @end smallexample
29831
29832 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
29833 unit if the integral types are the same size and if the next bit-field fits
29834 into the current allocation unit without crossing the boundary imposed by the
29835 common alignment requirements of the bit-fields.
29836 @end enumerate
29837
29838 MSVC interprets zero-length bit-fields in the following ways:
29839
29840 @enumerate
29841 @item If a zero-length bit-field is inserted between two bit-fields that
29842 are normally coalesced, the bit-fields are not coalesced.
29843
29844 For example:
29845
29846 @smallexample
29847 struct
29848 @{
29849 unsigned long bf_1 : 12;
29850 unsigned long : 0;
29851 unsigned long bf_2 : 12;
29852 @} t1;
29853 @end smallexample
29854
29855 @noindent
29856 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
29857 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
29858
29859 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
29860 alignment of the zero-length bit-field is greater than the member that follows it,
29861 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
29862
29863 For example:
29864
29865 @smallexample
29866 struct
29867 @{
29868 char foo : 4;
29869 short : 0;
29870 char bar;
29871 @} t2;
29872
29873 struct
29874 @{
29875 char foo : 4;
29876 short : 0;
29877 double bar;
29878 @} t3;
29879 @end smallexample
29880
29881 @noindent
29882 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
29883 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
29884 bit-field does not affect the alignment of @code{bar} or, as a result, the size
29885 of the structure.
29886
29887 Taking this into account, it is important to note the following:
29888
29889 @enumerate
29890 @item If a zero-length bit-field follows a normal bit-field, the type of the
29891 zero-length bit-field may affect the alignment of the structure as whole. For
29892 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
29893 normal bit-field, and is of type short.
29894
29895 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
29896 still affect the alignment of the structure:
29897
29898 @smallexample
29899 struct
29900 @{
29901 char foo : 6;
29902 long : 0;
29903 @} t4;
29904 @end smallexample
29905
29906 @noindent
29907 Here, @code{t4} takes up 4 bytes.
29908 @end enumerate
29909
29910 @item Zero-length bit-fields following non-bit-field members are ignored:
29911
29912 @smallexample
29913 struct
29914 @{
29915 char foo;
29916 long : 0;
29917 char bar;
29918 @} t5;
29919 @end smallexample
29920
29921 @noindent
29922 Here, @code{t5} takes up 2 bytes.
29923 @end enumerate
29924
29925
29926 @item -mno-align-stringops
29927 @opindex mno-align-stringops
29928 @opindex malign-stringops
29929 Do not align the destination of inlined string operations. This switch reduces
29930 code size and improves performance in case the destination is already aligned,
29931 but GCC doesn't know about it.
29932
29933 @item -minline-all-stringops
29934 @opindex minline-all-stringops
29935 By default GCC inlines string operations only when the destination is
29936 known to be aligned to least a 4-byte boundary.
29937 This enables more inlining and increases code
29938 size, but may improve performance of code that depends on fast
29939 @code{memcpy} and @code{memset} for short lengths.
29940 The option enables inline expansion of @code{strlen} for all
29941 pointer alignments.
29942
29943 @item -minline-stringops-dynamically
29944 @opindex minline-stringops-dynamically
29945 For string operations of unknown size, use run-time checks with
29946 inline code for small blocks and a library call for large blocks.
29947
29948 @item -mstringop-strategy=@var{alg}
29949 @opindex mstringop-strategy=@var{alg}
29950 Override the internal decision heuristic for the particular algorithm to use
29951 for inlining string operations. The allowed values for @var{alg} are:
29952
29953 @table @samp
29954 @item rep_byte
29955 @itemx rep_4byte
29956 @itemx rep_8byte
29957 Expand using i386 @code{rep} prefix of the specified size.
29958
29959 @item byte_loop
29960 @itemx loop
29961 @itemx unrolled_loop
29962 Expand into an inline loop.
29963
29964 @item libcall
29965 Always use a library call.
29966 @end table
29967
29968 @item -mmemcpy-strategy=@var{strategy}
29969 @opindex mmemcpy-strategy=@var{strategy}
29970 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
29971 should be inlined and what inline algorithm to use when the expected size
29972 of the copy operation is known. @var{strategy}
29973 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
29974 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
29975 the max byte size with which inline algorithm @var{alg} is allowed. For the last
29976 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
29977 in the list must be specified in increasing order. The minimal byte size for
29978 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
29979 preceding range.
29980
29981 @item -mmemset-strategy=@var{strategy}
29982 @opindex mmemset-strategy=@var{strategy}
29983 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
29984 @code{__builtin_memset} expansion.
29985
29986 @item -momit-leaf-frame-pointer
29987 @opindex momit-leaf-frame-pointer
29988 Don't keep the frame pointer in a register for leaf functions. This
29989 avoids the instructions to save, set up, and restore frame pointers and
29990 makes an extra register available in leaf functions. The option
29991 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
29992 which might make debugging harder.
29993
29994 @item -mtls-direct-seg-refs
29995 @itemx -mno-tls-direct-seg-refs
29996 @opindex mtls-direct-seg-refs
29997 Controls whether TLS variables may be accessed with offsets from the
29998 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
29999 or whether the thread base pointer must be added. Whether or not this
30000 is valid depends on the operating system, and whether it maps the
30001 segment to cover the entire TLS area.
30002
30003 For systems that use the GNU C Library, the default is on.
30004
30005 @item -msse2avx
30006 @itemx -mno-sse2avx
30007 @opindex msse2avx
30008 Specify that the assembler should encode SSE instructions with VEX
30009 prefix. The option @option{-mavx} turns this on by default.
30010
30011 @item -mfentry
30012 @itemx -mno-fentry
30013 @opindex mfentry
30014 If profiling is active (@option{-pg}), put the profiling
30015 counter call before the prologue.
30016 Note: On x86 architectures the attribute @code{ms_hook_prologue}
30017 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
30018
30019 @item -mrecord-mcount
30020 @itemx -mno-record-mcount
30021 @opindex mrecord-mcount
30022 If profiling is active (@option{-pg}), generate a __mcount_loc section
30023 that contains pointers to each profiling call. This is useful for
30024 automatically patching and out calls.
30025
30026 @item -mnop-mcount
30027 @itemx -mno-nop-mcount
30028 @opindex mnop-mcount
30029 If profiling is active (@option{-pg}), generate the calls to
30030 the profiling functions as NOPs. This is useful when they
30031 should be patched in later dynamically. This is likely only
30032 useful together with @option{-mrecord-mcount}.
30033
30034 @item -minstrument-return=@var{type}
30035 @opindex minstrument-return
30036 Instrument function exit in -pg -mfentry instrumented functions with
30037 call to specified function. This only instruments true returns ending
30038 with ret, but not sibling calls ending with jump. Valid types
30039 are @var{none} to not instrument, @var{call} to generate a call to __return__,
30040 or @var{nop5} to generate a 5 byte nop.
30041
30042 @item -mrecord-return
30043 @itemx -mno-record-return
30044 @opindex mrecord-return
30045 Generate a __return_loc section pointing to all return instrumentation code.
30046
30047 @item -mfentry-name=@var{name}
30048 @opindex mfentry-name
30049 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
30050
30051 @item -mfentry-section=@var{name}
30052 @opindex mfentry-section
30053 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
30054
30055 @item -mskip-rax-setup
30056 @itemx -mno-skip-rax-setup
30057 @opindex mskip-rax-setup
30058 When generating code for the x86-64 architecture with SSE extensions
30059 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
30060 register when there are no variable arguments passed in vector registers.
30061
30062 @strong{Warning:} Since RAX register is used to avoid unnecessarily
30063 saving vector registers on stack when passing variable arguments, the
30064 impacts of this option are callees may waste some stack space,
30065 misbehave or jump to a random location. GCC 4.4 or newer don't have
30066 those issues, regardless the RAX register value.
30067
30068 @item -m8bit-idiv
30069 @itemx -mno-8bit-idiv
30070 @opindex m8bit-idiv
30071 On some processors, like Intel Atom, 8-bit unsigned integer divide is
30072 much faster than 32-bit/64-bit integer divide. This option generates a
30073 run-time check. If both dividend and divisor are within range of 0
30074 to 255, 8-bit unsigned integer divide is used instead of
30075 32-bit/64-bit integer divide.
30076
30077 @item -mavx256-split-unaligned-load
30078 @itemx -mavx256-split-unaligned-store
30079 @opindex mavx256-split-unaligned-load
30080 @opindex mavx256-split-unaligned-store
30081 Split 32-byte AVX unaligned load and store.
30082
30083 @item -mstack-protector-guard=@var{guard}
30084 @itemx -mstack-protector-guard-reg=@var{reg}
30085 @itemx -mstack-protector-guard-offset=@var{offset}
30086 @opindex mstack-protector-guard
30087 @opindex mstack-protector-guard-reg
30088 @opindex mstack-protector-guard-offset
30089 Generate stack protection code using canary at @var{guard}. Supported
30090 locations are @samp{global} for global canary or @samp{tls} for per-thread
30091 canary in the TLS block (the default). This option has effect only when
30092 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
30093
30094 With the latter choice the options
30095 @option{-mstack-protector-guard-reg=@var{reg}} and
30096 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30097 which segment register (@code{%fs} or @code{%gs}) to use as base register
30098 for reading the canary, and from what offset from that base register.
30099 The default for those is as specified in the relevant ABI.
30100
30101 @item -mgeneral-regs-only
30102 @opindex mgeneral-regs-only
30103 Generate code that uses only the general-purpose registers. This
30104 prevents the compiler from using floating-point, vector, mask and bound
30105 registers.
30106
30107 @item -mindirect-branch=@var{choice}
30108 @opindex mindirect-branch
30109 Convert indirect call and jump with @var{choice}. The default is
30110 @samp{keep}, which keeps indirect call and jump unmodified.
30111 @samp{thunk} converts indirect call and jump to call and return thunk.
30112 @samp{thunk-inline} converts indirect call and jump to inlined call
30113 and return thunk. @samp{thunk-extern} converts indirect call and jump
30114 to external call and return thunk provided in a separate object file.
30115 You can control this behavior for a specific function by using the
30116 function attribute @code{indirect_branch}. @xref{Function Attributes}.
30117
30118 Note that @option{-mcmodel=large} is incompatible with
30119 @option{-mindirect-branch=thunk} and
30120 @option{-mindirect-branch=thunk-extern} since the thunk function may
30121 not be reachable in the large code model.
30122
30123 Note that @option{-mindirect-branch=thunk-extern} is compatible with
30124 @option{-fcf-protection=branch} since the external thunk can be made
30125 to enable control-flow check.
30126
30127 @item -mfunction-return=@var{choice}
30128 @opindex mfunction-return
30129 Convert function return with @var{choice}. The default is @samp{keep},
30130 which keeps function return unmodified. @samp{thunk} converts function
30131 return to call and return thunk. @samp{thunk-inline} converts function
30132 return to inlined call and return thunk. @samp{thunk-extern} converts
30133 function return to external call and return thunk provided in a separate
30134 object file. You can control this behavior for a specific function by
30135 using the function attribute @code{function_return}.
30136 @xref{Function Attributes}.
30137
30138 Note that @option{-mindirect-return=thunk-extern} is compatible with
30139 @option{-fcf-protection=branch} since the external thunk can be made
30140 to enable control-flow check.
30141
30142 Note that @option{-mcmodel=large} is incompatible with
30143 @option{-mfunction-return=thunk} and
30144 @option{-mfunction-return=thunk-extern} since the thunk function may
30145 not be reachable in the large code model.
30146
30147
30148 @item -mindirect-branch-register
30149 @opindex mindirect-branch-register
30150 Force indirect call and jump via register.
30151
30152 @end table
30153
30154 These @samp{-m} switches are supported in addition to the above
30155 on x86-64 processors in 64-bit environments.
30156
30157 @table @gcctabopt
30158 @item -m32
30159 @itemx -m64
30160 @itemx -mx32
30161 @itemx -m16
30162 @itemx -miamcu
30163 @opindex m32
30164 @opindex m64
30165 @opindex mx32
30166 @opindex m16
30167 @opindex miamcu
30168 Generate code for a 16-bit, 32-bit or 64-bit environment.
30169 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30170 to 32 bits, and
30171 generates code that runs on any i386 system.
30172
30173 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30174 types to 64 bits, and generates code for the x86-64 architecture.
30175 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30176 and @option{-mdynamic-no-pic} options.
30177
30178 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30179 to 32 bits, and
30180 generates code for the x86-64 architecture.
30181
30182 The @option{-m16} option is the same as @option{-m32}, except for that
30183 it outputs the @code{.code16gcc} assembly directive at the beginning of
30184 the assembly output so that the binary can run in 16-bit mode.
30185
30186 The @option{-miamcu} option generates code which conforms to Intel MCU
30187 psABI. It requires the @option{-m32} option to be turned on.
30188
30189 @item -mno-red-zone
30190 @opindex mno-red-zone
30191 @opindex mred-zone
30192 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
30193 by the x86-64 ABI; it is a 128-byte area beyond the location of the
30194 stack pointer that is not modified by signal or interrupt handlers
30195 and therefore can be used for temporary data without adjusting the stack
30196 pointer. The flag @option{-mno-red-zone} disables this red zone.
30197
30198 @item -mcmodel=small
30199 @opindex mcmodel=small
30200 Generate code for the small code model: the program and its symbols must
30201 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
30202 Programs can be statically or dynamically linked. This is the default
30203 code model.
30204
30205 @item -mcmodel=kernel
30206 @opindex mcmodel=kernel
30207 Generate code for the kernel code model. The kernel runs in the
30208 negative 2 GB of the address space.
30209 This model has to be used for Linux kernel code.
30210
30211 @item -mcmodel=medium
30212 @opindex mcmodel=medium
30213 Generate code for the medium model: the program is linked in the lower 2
30214 GB of the address space. Small symbols are also placed there. Symbols
30215 with sizes larger than @option{-mlarge-data-threshold} are put into
30216 large data or BSS sections and can be located above 2GB. Programs can
30217 be statically or dynamically linked.
30218
30219 @item -mcmodel=large
30220 @opindex mcmodel=large
30221 Generate code for the large model. This model makes no assumptions
30222 about addresses and sizes of sections.
30223
30224 @item -maddress-mode=long
30225 @opindex maddress-mode=long
30226 Generate code for long address mode. This is only supported for 64-bit
30227 and x32 environments. It is the default address mode for 64-bit
30228 environments.
30229
30230 @item -maddress-mode=short
30231 @opindex maddress-mode=short
30232 Generate code for short address mode. This is only supported for 32-bit
30233 and x32 environments. It is the default address mode for 32-bit and
30234 x32 environments.
30235 @end table
30236
30237 @node x86 Windows Options
30238 @subsection x86 Windows Options
30239 @cindex x86 Windows Options
30240 @cindex Windows Options for x86
30241
30242 These additional options are available for Microsoft Windows targets:
30243
30244 @table @gcctabopt
30245 @item -mconsole
30246 @opindex mconsole
30247 This option
30248 specifies that a console application is to be generated, by
30249 instructing the linker to set the PE header subsystem type
30250 required for console applications.
30251 This option is available for Cygwin and MinGW targets and is
30252 enabled by default on those targets.
30253
30254 @item -mdll
30255 @opindex mdll
30256 This option is available for Cygwin and MinGW targets. It
30257 specifies that a DLL---a dynamic link library---is to be
30258 generated, enabling the selection of the required runtime
30259 startup object and entry point.
30260
30261 @item -mnop-fun-dllimport
30262 @opindex mnop-fun-dllimport
30263 This option is available for Cygwin and MinGW targets. It
30264 specifies that the @code{dllimport} attribute should be ignored.
30265
30266 @item -mthread
30267 @opindex mthread
30268 This option is available for MinGW targets. It specifies
30269 that MinGW-specific thread support is to be used.
30270
30271 @item -municode
30272 @opindex municode
30273 This option is available for MinGW-w64 targets. It causes
30274 the @code{UNICODE} preprocessor macro to be predefined, and
30275 chooses Unicode-capable runtime startup code.
30276
30277 @item -mwin32
30278 @opindex mwin32
30279 This option is available for Cygwin and MinGW targets. It
30280 specifies that the typical Microsoft Windows predefined macros are to
30281 be set in the pre-processor, but does not influence the choice
30282 of runtime library/startup code.
30283
30284 @item -mwindows
30285 @opindex mwindows
30286 This option is available for Cygwin and MinGW targets. It
30287 specifies that a GUI application is to be generated by
30288 instructing the linker to set the PE header subsystem type
30289 appropriately.
30290
30291 @item -fno-set-stack-executable
30292 @opindex fno-set-stack-executable
30293 @opindex fset-stack-executable
30294 This option is available for MinGW targets. It specifies that
30295 the executable flag for the stack used by nested functions isn't
30296 set. This is necessary for binaries running in kernel mode of
30297 Microsoft Windows, as there the User32 API, which is used to set executable
30298 privileges, isn't available.
30299
30300 @item -fwritable-relocated-rdata
30301 @opindex fno-writable-relocated-rdata
30302 @opindex fwritable-relocated-rdata
30303 This option is available for MinGW and Cygwin targets. It specifies
30304 that relocated-data in read-only section is put into the @code{.data}
30305 section. This is a necessary for older runtimes not supporting
30306 modification of @code{.rdata} sections for pseudo-relocation.
30307
30308 @item -mpe-aligned-commons
30309 @opindex mpe-aligned-commons
30310 This option is available for Cygwin and MinGW targets. It
30311 specifies that the GNU extension to the PE file format that
30312 permits the correct alignment of COMMON variables should be
30313 used when generating code. It is enabled by default if
30314 GCC detects that the target assembler found during configuration
30315 supports the feature.
30316 @end table
30317
30318 See also under @ref{x86 Options} for standard options.
30319
30320 @node Xstormy16 Options
30321 @subsection Xstormy16 Options
30322 @cindex Xstormy16 Options
30323
30324 These options are defined for Xstormy16:
30325
30326 @table @gcctabopt
30327 @item -msim
30328 @opindex msim
30329 Choose startup files and linker script suitable for the simulator.
30330 @end table
30331
30332 @node Xtensa Options
30333 @subsection Xtensa Options
30334 @cindex Xtensa Options
30335
30336 These options are supported for Xtensa targets:
30337
30338 @table @gcctabopt
30339 @item -mconst16
30340 @itemx -mno-const16
30341 @opindex mconst16
30342 @opindex mno-const16
30343 Enable or disable use of @code{CONST16} instructions for loading
30344 constant values. The @code{CONST16} instruction is currently not a
30345 standard option from Tensilica. When enabled, @code{CONST16}
30346 instructions are always used in place of the standard @code{L32R}
30347 instructions. The use of @code{CONST16} is enabled by default only if
30348 the @code{L32R} instruction is not available.
30349
30350 @item -mfused-madd
30351 @itemx -mno-fused-madd
30352 @opindex mfused-madd
30353 @opindex mno-fused-madd
30354 Enable or disable use of fused multiply/add and multiply/subtract
30355 instructions in the floating-point option. This has no effect if the
30356 floating-point option is not also enabled. Disabling fused multiply/add
30357 and multiply/subtract instructions forces the compiler to use separate
30358 instructions for the multiply and add/subtract operations. This may be
30359 desirable in some cases where strict IEEE 754-compliant results are
30360 required: the fused multiply add/subtract instructions do not round the
30361 intermediate result, thereby producing results with @emph{more} bits of
30362 precision than specified by the IEEE standard. Disabling fused multiply
30363 add/subtract instructions also ensures that the program output is not
30364 sensitive to the compiler's ability to combine multiply and add/subtract
30365 operations.
30366
30367 @item -mserialize-volatile
30368 @itemx -mno-serialize-volatile
30369 @opindex mserialize-volatile
30370 @opindex mno-serialize-volatile
30371 When this option is enabled, GCC inserts @code{MEMW} instructions before
30372 @code{volatile} memory references to guarantee sequential consistency.
30373 The default is @option{-mserialize-volatile}. Use
30374 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30375
30376 @item -mforce-no-pic
30377 @opindex mforce-no-pic
30378 For targets, like GNU/Linux, where all user-mode Xtensa code must be
30379 position-independent code (PIC), this option disables PIC for compiling
30380 kernel code.
30381
30382 @item -mtext-section-literals
30383 @itemx -mno-text-section-literals
30384 @opindex mtext-section-literals
30385 @opindex mno-text-section-literals
30386 These options control the treatment of literal pools. The default is
30387 @option{-mno-text-section-literals}, which places literals in a separate
30388 section in the output file. This allows the literal pool to be placed
30389 in a data RAM/ROM, and it also allows the linker to combine literal
30390 pools from separate object files to remove redundant literals and
30391 improve code size. With @option{-mtext-section-literals}, the literals
30392 are interspersed in the text section in order to keep them as close as
30393 possible to their references. This may be necessary for large assembly
30394 files. Literals for each function are placed right before that function.
30395
30396 @item -mauto-litpools
30397 @itemx -mno-auto-litpools
30398 @opindex mauto-litpools
30399 @opindex mno-auto-litpools
30400 These options control the treatment of literal pools. The default is
30401 @option{-mno-auto-litpools}, which places literals in a separate
30402 section in the output file unless @option{-mtext-section-literals} is
30403 used. With @option{-mauto-litpools} the literals are interspersed in
30404 the text section by the assembler. Compiler does not produce explicit
30405 @code{.literal} directives and loads literals into registers with
30406 @code{MOVI} instructions instead of @code{L32R} to let the assembler
30407 do relaxation and place literals as necessary. This option allows
30408 assembler to create several literal pools per function and assemble
30409 very big functions, which may not be possible with
30410 @option{-mtext-section-literals}.
30411
30412 @item -mtarget-align
30413 @itemx -mno-target-align
30414 @opindex mtarget-align
30415 @opindex mno-target-align
30416 When this option is enabled, GCC instructs the assembler to
30417 automatically align instructions to reduce branch penalties at the
30418 expense of some code density. The assembler attempts to widen density
30419 instructions to align branch targets and the instructions following call
30420 instructions. If there are not enough preceding safe density
30421 instructions to align a target, no widening is performed. The
30422 default is @option{-mtarget-align}. These options do not affect the
30423 treatment of auto-aligned instructions like @code{LOOP}, which the
30424 assembler always aligns, either by widening density instructions or
30425 by inserting NOP instructions.
30426
30427 @item -mlongcalls
30428 @itemx -mno-longcalls
30429 @opindex mlongcalls
30430 @opindex mno-longcalls
30431 When this option is enabled, GCC instructs the assembler to translate
30432 direct calls to indirect calls unless it can determine that the target
30433 of a direct call is in the range allowed by the call instruction. This
30434 translation typically occurs for calls to functions in other source
30435 files. Specifically, the assembler translates a direct @code{CALL}
30436 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30437 The default is @option{-mno-longcalls}. This option should be used in
30438 programs where the call target can potentially be out of range. This
30439 option is implemented in the assembler, not the compiler, so the
30440 assembly code generated by GCC still shows direct call
30441 instructions---look at the disassembled object code to see the actual
30442 instructions. Note that the assembler uses an indirect call for
30443 every cross-file call, not just those that really are out of range.
30444 @end table
30445
30446 @node zSeries Options
30447 @subsection zSeries Options
30448 @cindex zSeries options
30449
30450 These are listed under @xref{S/390 and zSeries Options}.
30451
30452
30453 @c man end
30454
30455 @node Spec Files
30456 @section Specifying Subprocesses and the Switches to Pass to Them
30457 @cindex Spec Files
30458
30459 @command{gcc} is a driver program. It performs its job by invoking a
30460 sequence of other programs to do the work of compiling, assembling and
30461 linking. GCC interprets its command-line parameters and uses these to
30462 deduce which programs it should invoke, and which command-line options
30463 it ought to place on their command lines. This behavior is controlled
30464 by @dfn{spec strings}. In most cases there is one spec string for each
30465 program that GCC can invoke, but a few programs have multiple spec
30466 strings to control their behavior. The spec strings built into GCC can
30467 be overridden by using the @option{-specs=} command-line switch to specify
30468 a spec file.
30469
30470 @dfn{Spec files} are plain-text files that are used to construct spec
30471 strings. They consist of a sequence of directives separated by blank
30472 lines. The type of directive is determined by the first non-whitespace
30473 character on the line, which can be one of the following:
30474
30475 @table @code
30476 @item %@var{command}
30477 Issues a @var{command} to the spec file processor. The commands that can
30478 appear here are:
30479
30480 @table @code
30481 @item %include <@var{file}>
30482 @cindex @code{%include}
30483 Search for @var{file} and insert its text at the current point in the
30484 specs file.
30485
30486 @item %include_noerr <@var{file}>
30487 @cindex @code{%include_noerr}
30488 Just like @samp{%include}, but do not generate an error message if the include
30489 file cannot be found.
30490
30491 @item %rename @var{old_name} @var{new_name}
30492 @cindex @code{%rename}
30493 Rename the spec string @var{old_name} to @var{new_name}.
30494
30495 @end table
30496
30497 @item *[@var{spec_name}]:
30498 This tells the compiler to create, override or delete the named spec
30499 string. All lines after this directive up to the next directive or
30500 blank line are considered to be the text for the spec string. If this
30501 results in an empty string then the spec is deleted. (Or, if the
30502 spec did not exist, then nothing happens.) Otherwise, if the spec
30503 does not currently exist a new spec is created. If the spec does
30504 exist then its contents are overridden by the text of this
30505 directive, unless the first character of that text is the @samp{+}
30506 character, in which case the text is appended to the spec.
30507
30508 @item [@var{suffix}]:
30509 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
30510 and up to the next directive or blank line are considered to make up the
30511 spec string for the indicated suffix. When the compiler encounters an
30512 input file with the named suffix, it processes the spec string in
30513 order to work out how to compile that file. For example:
30514
30515 @smallexample
30516 .ZZ:
30517 z-compile -input %i
30518 @end smallexample
30519
30520 This says that any input file whose name ends in @samp{.ZZ} should be
30521 passed to the program @samp{z-compile}, which should be invoked with the
30522 command-line switch @option{-input} and with the result of performing the
30523 @samp{%i} substitution. (See below.)
30524
30525 As an alternative to providing a spec string, the text following a
30526 suffix directive can be one of the following:
30527
30528 @table @code
30529 @item @@@var{language}
30530 This says that the suffix is an alias for a known @var{language}. This is
30531 similar to using the @option{-x} command-line switch to GCC to specify a
30532 language explicitly. For example:
30533
30534 @smallexample
30535 .ZZ:
30536 @@c++
30537 @end smallexample
30538
30539 Says that .ZZ files are, in fact, C++ source files.
30540
30541 @item #@var{name}
30542 This causes an error messages saying:
30543
30544 @smallexample
30545 @var{name} compiler not installed on this system.
30546 @end smallexample
30547 @end table
30548
30549 GCC already has an extensive list of suffixes built into it.
30550 This directive adds an entry to the end of the list of suffixes, but
30551 since the list is searched from the end backwards, it is effectively
30552 possible to override earlier entries using this technique.
30553
30554 @end table
30555
30556 GCC has the following spec strings built into it. Spec files can
30557 override these strings or create their own. Note that individual
30558 targets can also add their own spec strings to this list.
30559
30560 @smallexample
30561 asm Options to pass to the assembler
30562 asm_final Options to pass to the assembler post-processor
30563 cpp Options to pass to the C preprocessor
30564 cc1 Options to pass to the C compiler
30565 cc1plus Options to pass to the C++ compiler
30566 endfile Object files to include at the end of the link
30567 link Options to pass to the linker
30568 lib Libraries to include on the command line to the linker
30569 libgcc Decides which GCC support library to pass to the linker
30570 linker Sets the name of the linker
30571 predefines Defines to be passed to the C preprocessor
30572 signed_char Defines to pass to CPP to say whether @code{char} is signed
30573 by default
30574 startfile Object files to include at the start of the link
30575 @end smallexample
30576
30577 Here is a small example of a spec file:
30578
30579 @smallexample
30580 %rename lib old_lib
30581
30582 *lib:
30583 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
30584 @end smallexample
30585
30586 This example renames the spec called @samp{lib} to @samp{old_lib} and
30587 then overrides the previous definition of @samp{lib} with a new one.
30588 The new definition adds in some extra command-line options before
30589 including the text of the old definition.
30590
30591 @dfn{Spec strings} are a list of command-line options to be passed to their
30592 corresponding program. In addition, the spec strings can contain
30593 @samp{%}-prefixed sequences to substitute variable text or to
30594 conditionally insert text into the command line. Using these constructs
30595 it is possible to generate quite complex command lines.
30596
30597 Here is a table of all defined @samp{%}-sequences for spec
30598 strings. Note that spaces are not generated automatically around the
30599 results of expanding these sequences. Therefore you can concatenate them
30600 together or combine them with constant text in a single argument.
30601
30602 @table @code
30603 @item %%
30604 Substitute one @samp{%} into the program name or argument.
30605
30606 @item %i
30607 Substitute the name of the input file being processed.
30608
30609 @item %b
30610 Substitute the basename of the input file being processed.
30611 This is the substring up to (and not including) the last period
30612 and not including the directory.
30613
30614 @item %B
30615 This is the same as @samp{%b}, but include the file suffix (text after
30616 the last period).
30617
30618 @item %d
30619 Marks the argument containing or following the @samp{%d} as a
30620 temporary file name, so that that file is deleted if GCC exits
30621 successfully. Unlike @samp{%g}, this contributes no text to the
30622 argument.
30623
30624 @item %g@var{suffix}
30625 Substitute a file name that has suffix @var{suffix} and is chosen
30626 once per compilation, and mark the argument in the same way as
30627 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
30628 name is now chosen in a way that is hard to predict even when previously
30629 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
30630 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
30631 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
30632 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
30633 was simply substituted with a file name chosen once per compilation,
30634 without regard to any appended suffix (which was therefore treated
30635 just like ordinary text), making such attacks more likely to succeed.
30636
30637 @item %u@var{suffix}
30638 Like @samp{%g}, but generates a new temporary file name
30639 each time it appears instead of once per compilation.
30640
30641 @item %U@var{suffix}
30642 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
30643 new one if there is no such last file name. In the absence of any
30644 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
30645 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
30646 involves the generation of two distinct file names, one
30647 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
30648 simply substituted with a file name chosen for the previous @samp{%u},
30649 without regard to any appended suffix.
30650
30651 @item %j@var{suffix}
30652 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
30653 writable, and if @option{-save-temps} is not used;
30654 otherwise, substitute the name
30655 of a temporary file, just like @samp{%u}. This temporary file is not
30656 meant for communication between processes, but rather as a junk
30657 disposal mechanism.
30658
30659 @item %|@var{suffix}
30660 @itemx %m@var{suffix}
30661 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
30662 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
30663 all. These are the two most common ways to instruct a program that it
30664 should read from standard input or write to standard output. If you
30665 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
30666 construct: see for example @file{gcc/fortran/lang-specs.h}.
30667
30668 @item %.@var{SUFFIX}
30669 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
30670 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
30671 terminated by the next space or %.
30672
30673 @item %w
30674 Marks the argument containing or following the @samp{%w} as the
30675 designated output file of this compilation. This puts the argument
30676 into the sequence of arguments that @samp{%o} substitutes.
30677
30678 @item %o
30679 Substitutes the names of all the output files, with spaces
30680 automatically placed around them. You should write spaces
30681 around the @samp{%o} as well or the results are undefined.
30682 @samp{%o} is for use in the specs for running the linker.
30683 Input files whose names have no recognized suffix are not compiled
30684 at all, but they are included among the output files, so they are
30685 linked.
30686
30687 @item %O
30688 Substitutes the suffix for object files. Note that this is
30689 handled specially when it immediately follows @samp{%g, %u, or %U},
30690 because of the need for those to form complete file names. The
30691 handling is such that @samp{%O} is treated exactly as if it had already
30692 been substituted, except that @samp{%g, %u, and %U} do not currently
30693 support additional @var{suffix} characters following @samp{%O} as they do
30694 following, for example, @samp{.o}.
30695
30696 @item %p
30697 Substitutes the standard macro predefinitions for the
30698 current target machine. Use this when running @command{cpp}.
30699
30700 @item %P
30701 Like @samp{%p}, but puts @samp{__} before and after the name of each
30702 predefined macro, except for macros that start with @samp{__} or with
30703 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
30704 C@.
30705
30706 @item %I
30707 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
30708 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
30709 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
30710 and @option{-imultilib} as necessary.
30711
30712 @item %s
30713 Current argument is the name of a library or startup file of some sort.
30714 Search for that file in a standard list of directories and substitute
30715 the full name found. The current working directory is included in the
30716 list of directories scanned.
30717
30718 @item %T
30719 Current argument is the name of a linker script. Search for that file
30720 in the current list of directories to scan for libraries. If the file
30721 is located insert a @option{--script} option into the command line
30722 followed by the full path name found. If the file is not found then
30723 generate an error message. Note: the current working directory is not
30724 searched.
30725
30726 @item %e@var{str}
30727 Print @var{str} as an error message. @var{str} is terminated by a newline.
30728 Use this when inconsistent options are detected.
30729
30730 @item %(@var{name})
30731 Substitute the contents of spec string @var{name} at this point.
30732
30733 @item %x@{@var{option}@}
30734 Accumulate an option for @samp{%X}.
30735
30736 @item %X
30737 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
30738 spec string.
30739
30740 @item %Y
30741 Output the accumulated assembler options specified by @option{-Wa}.
30742
30743 @item %Z
30744 Output the accumulated preprocessor options specified by @option{-Wp}.
30745
30746 @item %a
30747 Process the @code{asm} spec. This is used to compute the
30748 switches to be passed to the assembler.
30749
30750 @item %A
30751 Process the @code{asm_final} spec. This is a spec string for
30752 passing switches to an assembler post-processor, if such a program is
30753 needed.
30754
30755 @item %l
30756 Process the @code{link} spec. This is the spec for computing the
30757 command line passed to the linker. Typically it makes use of the
30758 @samp{%L %G %S %D and %E} sequences.
30759
30760 @item %D
30761 Dump out a @option{-L} option for each directory that GCC believes might
30762 contain startup files. If the target supports multilibs then the
30763 current multilib directory is prepended to each of these paths.
30764
30765 @item %L
30766 Process the @code{lib} spec. This is a spec string for deciding which
30767 libraries are included on the command line to the linker.
30768
30769 @item %G
30770 Process the @code{libgcc} spec. This is a spec string for deciding
30771 which GCC support library is included on the command line to the linker.
30772
30773 @item %S
30774 Process the @code{startfile} spec. This is a spec for deciding which
30775 object files are the first ones passed to the linker. Typically
30776 this might be a file named @file{crt0.o}.
30777
30778 @item %E
30779 Process the @code{endfile} spec. This is a spec string that specifies
30780 the last object files that are passed to the linker.
30781
30782 @item %C
30783 Process the @code{cpp} spec. This is used to construct the arguments
30784 to be passed to the C preprocessor.
30785
30786 @item %1
30787 Process the @code{cc1} spec. This is used to construct the options to be
30788 passed to the actual C compiler (@command{cc1}).
30789
30790 @item %2
30791 Process the @code{cc1plus} spec. This is used to construct the options to be
30792 passed to the actual C++ compiler (@command{cc1plus}).
30793
30794 @item %*
30795 Substitute the variable part of a matched option. See below.
30796 Note that each comma in the substituted string is replaced by
30797 a single space.
30798
30799 @item %<S
30800 Remove all occurrences of @code{-S} from the command line. Note---this
30801 command is position dependent. @samp{%} commands in the spec string
30802 before this one see @code{-S}, @samp{%} commands in the spec string
30803 after this one do not.
30804
30805 @item %:@var{function}(@var{args})
30806 Call the named function @var{function}, passing it @var{args}.
30807 @var{args} is first processed as a nested spec string, then split
30808 into an argument vector in the usual fashion. The function returns
30809 a string which is processed as if it had appeared literally as part
30810 of the current spec.
30811
30812 The following built-in spec functions are provided:
30813
30814 @table @code
30815 @item @code{getenv}
30816 The @code{getenv} spec function takes two arguments: an environment
30817 variable name and a string. If the environment variable is not
30818 defined, a fatal error is issued. Otherwise, the return value is the
30819 value of the environment variable concatenated with the string. For
30820 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
30821
30822 @smallexample
30823 %:getenv(TOPDIR /include)
30824 @end smallexample
30825
30826 expands to @file{/path/to/top/include}.
30827
30828 @item @code{if-exists}
30829 The @code{if-exists} spec function takes one argument, an absolute
30830 pathname to a file. If the file exists, @code{if-exists} returns the
30831 pathname. Here is a small example of its usage:
30832
30833 @smallexample
30834 *startfile:
30835 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
30836 @end smallexample
30837
30838 @item @code{if-exists-else}
30839 The @code{if-exists-else} spec function is similar to the @code{if-exists}
30840 spec function, except that it takes two arguments. The first argument is
30841 an absolute pathname to a file. If the file exists, @code{if-exists-else}
30842 returns the pathname. If it does not exist, it returns the second argument.
30843 This way, @code{if-exists-else} can be used to select one file or another,
30844 based on the existence of the first. Here is a small example of its usage:
30845
30846 @smallexample
30847 *startfile:
30848 crt0%O%s %:if-exists(crti%O%s) \
30849 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
30850 @end smallexample
30851
30852 @item @code{replace-outfile}
30853 The @code{replace-outfile} spec function takes two arguments. It looks for the
30854 first argument in the outfiles array and replaces it with the second argument. Here
30855 is a small example of its usage:
30856
30857 @smallexample
30858 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
30859 @end smallexample
30860
30861 @item @code{remove-outfile}
30862 The @code{remove-outfile} spec function takes one argument. It looks for the
30863 first argument in the outfiles array and removes it. Here is a small example
30864 its usage:
30865
30866 @smallexample
30867 %:remove-outfile(-lm)
30868 @end smallexample
30869
30870 @item @code{pass-through-libs}
30871 The @code{pass-through-libs} spec function takes any number of arguments. It
30872 finds any @option{-l} options and any non-options ending in @file{.a} (which it
30873 assumes are the names of linker input library archive files) and returns a
30874 result containing all the found arguments each prepended by
30875 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
30876 intended to be passed to the LTO linker plugin.
30877
30878 @smallexample
30879 %:pass-through-libs(%G %L %G)
30880 @end smallexample
30881
30882 @item @code{print-asm-header}
30883 The @code{print-asm-header} function takes no arguments and simply
30884 prints a banner like:
30885
30886 @smallexample
30887 Assembler options
30888 =================
30889
30890 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
30891 @end smallexample
30892
30893 It is used to separate compiler options from assembler options
30894 in the @option{--target-help} output.
30895 @end table
30896
30897 @item %@{S@}
30898 Substitutes the @code{-S} switch, if that switch is given to GCC@.
30899 If that switch is not specified, this substitutes nothing. Note that
30900 the leading dash is omitted when specifying this option, and it is
30901 automatically inserted if the substitution is performed. Thus the spec
30902 string @samp{%@{foo@}} matches the command-line option @option{-foo}
30903 and outputs the command-line option @option{-foo}.
30904
30905 @item %W@{S@}
30906 Like %@{@code{S}@} but mark last argument supplied within as a file to be
30907 deleted on failure.
30908
30909 @item %@{S*@}
30910 Substitutes all the switches specified to GCC whose names start
30911 with @code{-S}, but which also take an argument. This is used for
30912 switches like @option{-o}, @option{-D}, @option{-I}, etc.
30913 GCC considers @option{-o foo} as being
30914 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
30915 text, including the space. Thus two arguments are generated.
30916
30917 @item %@{S*&T*@}
30918 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
30919 (the order of @code{S} and @code{T} in the spec is not significant).
30920 There can be any number of ampersand-separated variables; for each the
30921 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
30922
30923 @item %@{S:X@}
30924 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
30925
30926 @item %@{!S:X@}
30927 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
30928
30929 @item %@{S*:X@}
30930 Substitutes @code{X} if one or more switches whose names start with
30931 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
30932 once, no matter how many such switches appeared. However, if @code{%*}
30933 appears somewhere in @code{X}, then @code{X} is substituted once
30934 for each matching switch, with the @code{%*} replaced by the part of
30935 that switch matching the @code{*}.
30936
30937 If @code{%*} appears as the last part of a spec sequence then a space
30938 is added after the end of the last substitution. If there is more
30939 text in the sequence, however, then a space is not generated. This
30940 allows the @code{%*} substitution to be used as part of a larger
30941 string. For example, a spec string like this:
30942
30943 @smallexample
30944 %@{mcu=*:--script=%*/memory.ld@}
30945 @end smallexample
30946
30947 @noindent
30948 when matching an option like @option{-mcu=newchip} produces:
30949
30950 @smallexample
30951 --script=newchip/memory.ld
30952 @end smallexample
30953
30954 @item %@{.S:X@}
30955 Substitutes @code{X}, if processing a file with suffix @code{S}.
30956
30957 @item %@{!.S:X@}
30958 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
30959
30960 @item %@{,S:X@}
30961 Substitutes @code{X}, if processing a file for language @code{S}.
30962
30963 @item %@{!,S:X@}
30964 Substitutes @code{X}, if not processing a file for language @code{S}.
30965
30966 @item %@{S|P:X@}
30967 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
30968 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
30969 @code{*} sequences as well, although they have a stronger binding than
30970 the @samp{|}. If @code{%*} appears in @code{X}, all of the
30971 alternatives must be starred, and only the first matching alternative
30972 is substituted.
30973
30974 For example, a spec string like this:
30975
30976 @smallexample
30977 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
30978 @end smallexample
30979
30980 @noindent
30981 outputs the following command-line options from the following input
30982 command-line options:
30983
30984 @smallexample
30985 fred.c -foo -baz
30986 jim.d -bar -boggle
30987 -d fred.c -foo -baz -boggle
30988 -d jim.d -bar -baz -boggle
30989 @end smallexample
30990
30991 @item %@{S:X; T:Y; :D@}
30992
30993 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
30994 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
30995 be as many clauses as you need. This may be combined with @code{.},
30996 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
30997
30998
30999 @end table
31000
31001 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
31002 or similar construct can use a backslash to ignore the special meaning
31003 of the character following it, thus allowing literal matching of a
31004 character that is otherwise specially treated. For example,
31005 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
31006 @option{-std=iso9899:1999} option is given.
31007
31008 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
31009 construct may contain other nested @samp{%} constructs or spaces, or
31010 even newlines. They are processed as usual, as described above.
31011 Trailing white space in @code{X} is ignored. White space may also
31012 appear anywhere on the left side of the colon in these constructs,
31013 except between @code{.} or @code{*} and the corresponding word.
31014
31015 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
31016 handled specifically in these constructs. If another value of
31017 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
31018 @option{-W} switch is found later in the command line, the earlier
31019 switch value is ignored, except with @{@code{S}*@} where @code{S} is
31020 just one letter, which passes all matching options.
31021
31022 The character @samp{|} at the beginning of the predicate text is used to
31023 indicate that a command should be piped to the following command, but
31024 only if @option{-pipe} is specified.
31025
31026 It is built into GCC which switches take arguments and which do not.
31027 (You might think it would be useful to generalize this to allow each
31028 compiler's spec to say which switches take arguments. But this cannot
31029 be done in a consistent fashion. GCC cannot even decide which input
31030 files have been specified without knowing which switches take arguments,
31031 and it must know which input files to compile in order to tell which
31032 compilers to run).
31033
31034 GCC also knows implicitly that arguments starting in @option{-l} are to be
31035 treated as compiler output files, and passed to the linker in their
31036 proper position among the other output files.
31037
31038 @node Environment Variables
31039 @section Environment Variables Affecting GCC
31040 @cindex environment variables
31041
31042 @c man begin ENVIRONMENT
31043 This section describes several environment variables that affect how GCC
31044 operates. Some of them work by specifying directories or prefixes to use
31045 when searching for various kinds of files. Some are used to specify other
31046 aspects of the compilation environment.
31047
31048 Note that you can also specify places to search using options such as
31049 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
31050 take precedence over places specified using environment variables, which
31051 in turn take precedence over those specified by the configuration of GCC@.
31052 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
31053 GNU Compiler Collection (GCC) Internals}.
31054
31055 @table @env
31056 @item LANG
31057 @itemx LC_CTYPE
31058 @c @itemx LC_COLLATE
31059 @itemx LC_MESSAGES
31060 @c @itemx LC_MONETARY
31061 @c @itemx LC_NUMERIC
31062 @c @itemx LC_TIME
31063 @itemx LC_ALL
31064 @findex LANG
31065 @findex LC_CTYPE
31066 @c @findex LC_COLLATE
31067 @findex LC_MESSAGES
31068 @c @findex LC_MONETARY
31069 @c @findex LC_NUMERIC
31070 @c @findex LC_TIME
31071 @findex LC_ALL
31072 @cindex locale
31073 These environment variables control the way that GCC uses
31074 localization information which allows GCC to work with different
31075 national conventions. GCC inspects the locale categories
31076 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
31077 so. These locale categories can be set to any value supported by your
31078 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
31079 Kingdom encoded in UTF-8.
31080
31081 The @env{LC_CTYPE} environment variable specifies character
31082 classification. GCC uses it to determine the character boundaries in
31083 a string; this is needed for some multibyte encodings that contain quote
31084 and escape characters that are otherwise interpreted as a string
31085 end or escape.
31086
31087 The @env{LC_MESSAGES} environment variable specifies the language to
31088 use in diagnostic messages.
31089
31090 If the @env{LC_ALL} environment variable is set, it overrides the value
31091 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
31092 and @env{LC_MESSAGES} default to the value of the @env{LANG}
31093 environment variable. If none of these variables are set, GCC
31094 defaults to traditional C English behavior.
31095
31096 @item TMPDIR
31097 @findex TMPDIR
31098 If @env{TMPDIR} is set, it specifies the directory to use for temporary
31099 files. GCC uses temporary files to hold the output of one stage of
31100 compilation which is to be used as input to the next stage: for example,
31101 the output of the preprocessor, which is the input to the compiler
31102 proper.
31103
31104 @item GCC_COMPARE_DEBUG
31105 @findex GCC_COMPARE_DEBUG
31106 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
31107 @option{-fcompare-debug} to the compiler driver. See the documentation
31108 of this option for more details.
31109
31110 @item GCC_EXEC_PREFIX
31111 @findex GCC_EXEC_PREFIX
31112 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
31113 names of the subprograms executed by the compiler. No slash is added
31114 when this prefix is combined with the name of a subprogram, but you can
31115 specify a prefix that ends with a slash if you wish.
31116
31117 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
31118 an appropriate prefix to use based on the pathname it is invoked with.
31119
31120 If GCC cannot find the subprogram using the specified prefix, it
31121 tries looking in the usual places for the subprogram.
31122
31123 The default value of @env{GCC_EXEC_PREFIX} is
31124 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
31125 the installed compiler. In many cases @var{prefix} is the value
31126 of @code{prefix} when you ran the @file{configure} script.
31127
31128 Other prefixes specified with @option{-B} take precedence over this prefix.
31129
31130 This prefix is also used for finding files such as @file{crt0.o} that are
31131 used for linking.
31132
31133 In addition, the prefix is used in an unusual way in finding the
31134 directories to search for header files. For each of the standard
31135 directories whose name normally begins with @samp{/usr/local/lib/gcc}
31136 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
31137 replacing that beginning with the specified prefix to produce an
31138 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
31139 @file{foo/bar} just before it searches the standard directory
31140 @file{/usr/local/lib/bar}.
31141 If a standard directory begins with the configured
31142 @var{prefix} then the value of @var{prefix} is replaced by
31143 @env{GCC_EXEC_PREFIX} when looking for header files.
31144
31145 @item COMPILER_PATH
31146 @findex COMPILER_PATH
31147 The value of @env{COMPILER_PATH} is a colon-separated list of
31148 directories, much like @env{PATH}. GCC tries the directories thus
31149 specified when searching for subprograms, if it cannot find the
31150 subprograms using @env{GCC_EXEC_PREFIX}.
31151
31152 @item LIBRARY_PATH
31153 @findex LIBRARY_PATH
31154 The value of @env{LIBRARY_PATH} is a colon-separated list of
31155 directories, much like @env{PATH}. When configured as a native compiler,
31156 GCC tries the directories thus specified when searching for special
31157 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
31158 using GCC also uses these directories when searching for ordinary
31159 libraries for the @option{-l} option (but directories specified with
31160 @option{-L} come first).
31161
31162 @item LANG
31163 @findex LANG
31164 @cindex locale definition
31165 This variable is used to pass locale information to the compiler. One way in
31166 which this information is used is to determine the character set to be used
31167 when character literals, string literals and comments are parsed in C and C++.
31168 When the compiler is configured to allow multibyte characters,
31169 the following values for @env{LANG} are recognized:
31170
31171 @table @samp
31172 @item C-JIS
31173 Recognize JIS characters.
31174 @item C-SJIS
31175 Recognize SJIS characters.
31176 @item C-EUCJP
31177 Recognize EUCJP characters.
31178 @end table
31179
31180 If @env{LANG} is not defined, or if it has some other value, then the
31181 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31182 recognize and translate multibyte characters.
31183 @end table
31184
31185 @noindent
31186 Some additional environment variables affect the behavior of the
31187 preprocessor.
31188
31189 @include cppenv.texi
31190
31191 @c man end
31192
31193 @node Precompiled Headers
31194 @section Using Precompiled Headers
31195 @cindex precompiled headers
31196 @cindex speed of compilation
31197
31198 Often large projects have many header files that are included in every
31199 source file. The time the compiler takes to process these header files
31200 over and over again can account for nearly all of the time required to
31201 build the project. To make builds faster, GCC allows you to
31202 @dfn{precompile} a header file.
31203
31204 To create a precompiled header file, simply compile it as you would any
31205 other file, if necessary using the @option{-x} option to make the driver
31206 treat it as a C or C++ header file. You may want to use a
31207 tool like @command{make} to keep the precompiled header up-to-date when
31208 the headers it contains change.
31209
31210 A precompiled header file is searched for when @code{#include} is
31211 seen in the compilation. As it searches for the included file
31212 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31213 compiler looks for a precompiled header in each directory just before it
31214 looks for the include file in that directory. The name searched for is
31215 the name specified in the @code{#include} with @samp{.gch} appended. If
31216 the precompiled header file cannot be used, it is ignored.
31217
31218 For instance, if you have @code{#include "all.h"}, and you have
31219 @file{all.h.gch} in the same directory as @file{all.h}, then the
31220 precompiled header file is used if possible, and the original
31221 header is used otherwise.
31222
31223 Alternatively, you might decide to put the precompiled header file in a
31224 directory and use @option{-I} to ensure that directory is searched
31225 before (or instead of) the directory containing the original header.
31226 Then, if you want to check that the precompiled header file is always
31227 used, you can put a file of the same name as the original header in this
31228 directory containing an @code{#error} command.
31229
31230 This also works with @option{-include}. So yet another way to use
31231 precompiled headers, good for projects not designed with precompiled
31232 header files in mind, is to simply take most of the header files used by
31233 a project, include them from another header file, precompile that header
31234 file, and @option{-include} the precompiled header. If the header files
31235 have guards against multiple inclusion, they are skipped because
31236 they've already been included (in the precompiled header).
31237
31238 If you need to precompile the same header file for different
31239 languages, targets, or compiler options, you can instead make a
31240 @emph{directory} named like @file{all.h.gch}, and put each precompiled
31241 header in the directory, perhaps using @option{-o}. It doesn't matter
31242 what you call the files in the directory; every precompiled header in
31243 the directory is considered. The first precompiled header
31244 encountered in the directory that is valid for this compilation is
31245 used; they're searched in no particular order.
31246
31247 There are many other possibilities, limited only by your imagination,
31248 good sense, and the constraints of your build system.
31249
31250 A precompiled header file can be used only when these conditions apply:
31251
31252 @itemize
31253 @item
31254 Only one precompiled header can be used in a particular compilation.
31255
31256 @item
31257 A precompiled header cannot be used once the first C token is seen. You
31258 can have preprocessor directives before a precompiled header; you cannot
31259 include a precompiled header from inside another header.
31260
31261 @item
31262 The precompiled header file must be produced for the same language as
31263 the current compilation. You cannot use a C precompiled header for a C++
31264 compilation.
31265
31266 @item
31267 The precompiled header file must have been produced by the same compiler
31268 binary as the current compilation is using.
31269
31270 @item
31271 Any macros defined before the precompiled header is included must
31272 either be defined in the same way as when the precompiled header was
31273 generated, or must not affect the precompiled header, which usually
31274 means that they don't appear in the precompiled header at all.
31275
31276 The @option{-D} option is one way to define a macro before a
31277 precompiled header is included; using a @code{#define} can also do it.
31278 There are also some options that define macros implicitly, like
31279 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31280 defined this way.
31281
31282 @item If debugging information is output when using the precompiled
31283 header, using @option{-g} or similar, the same kind of debugging information
31284 must have been output when building the precompiled header. However,
31285 a precompiled header built using @option{-g} can be used in a compilation
31286 when no debugging information is being output.
31287
31288 @item The same @option{-m} options must generally be used when building
31289 and using the precompiled header. @xref{Submodel Options},
31290 for any cases where this rule is relaxed.
31291
31292 @item Each of the following options must be the same when building and using
31293 the precompiled header:
31294
31295 @gccoptlist{-fexceptions}
31296
31297 @item
31298 Some other command-line options starting with @option{-f},
31299 @option{-p}, or @option{-O} must be defined in the same way as when
31300 the precompiled header was generated. At present, it's not clear
31301 which options are safe to change and which are not; the safest choice
31302 is to use exactly the same options when generating and using the
31303 precompiled header. The following are known to be safe:
31304
31305 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
31306 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
31307 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
31308 -pedantic-errors}
31309
31310 @item Address space layout randomization (ASLR) can lead to not binary identical
31311 PCH files. If you rely on stable PCH file contents disable ASLR when generating
31312 PCH files.
31313
31314 @end itemize
31315
31316 For all of these except the last, the compiler automatically
31317 ignores the precompiled header if the conditions aren't met. If you
31318 find an option combination that doesn't work and doesn't cause the
31319 precompiled header to be ignored, please consider filing a bug report,
31320 see @ref{Bugs}.
31321
31322 If you do use differing options when generating and using the
31323 precompiled header, the actual behavior is a mixture of the
31324 behavior for the options. For instance, if you use @option{-g} to
31325 generate the precompiled header but not when using it, you may or may
31326 not get debugging information for routines in the precompiled header.